Skip to content

Commit

Permalink
stop byte compiler from warning about docstring formats
Browse files Browse the repository at this point in the history
  • Loading branch information
wyuenho committed Dec 6, 2024
1 parent 79c9b43 commit 9c7b1e4
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 59 deletions.
39 changes: 20 additions & 19 deletions window-purpose-configuration.el
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@

(defmacro define-purpose-list-checker (name entry-pred)
"Create a function named NAME to check the content of a list.
The generated function receives parameter OBJ, and checks that it is a
list and each entry in it satisifies ENTRY-PRED."
The generated function receives parameter OBJ, and checks that it
is a list and each entry in it satisifies ENTRY-PRED."
(declare (indent defun) (debug (&define name function-form)))
`(defun ,name (obj)
,(format "Check that OBJ is a list, and each entry in it satisifies %s." entry-pred)
(and (listp obj)
(cl-loop for entry in obj
always (funcall ,entry-pred entry)))))
(let ((pred (replace-regexp-in-string "#'" "\\\\='" (format "%s" entry-pred))))
`(defun ,name (obj)
,(format "If OBJ is a list and every entry satisifies %s." pred)
(and (listp obj)
(cl-loop for entry in obj
always (funcall ,entry-pred entry))))))

(defun purpose-non-nil-symbol-p (obj)
"Check that OBJ is a symbol and not nil."
Expand Down Expand Up @@ -175,10 +176,10 @@ If you set this variable in elisp-code, you should call the function
"A plist containing `purpose-conf' objects.
An example of `purpose-extended-configuration':
(list :python (purpose-conf
:mode-purposes '((python-mode . python)
:mode-purposes \\='((python-mode . python)
(python-inferior-mode . interpreter)))
:popups (purpose-conf
:mode-purposes '((help-mode . right)
:mode-purposes \\='((help-mode . right)
(occur-mode . bottom)
(grep-mode . bottom))))")

Expand Down Expand Up @@ -358,7 +359,7 @@ Example:
(purpose-set-extension-configuration
:python
(purpose-conf :mode-purposes
'((python-mode . python)
\\='((python-mode . python)
(inferior-python-mode . interpreter))))
This function calls `purpose-compile-extended-configuration' when its
Expand Down Expand Up @@ -393,7 +394,7 @@ This function calls `purpose-compile-extended-configuration'.
Example:
(purpose-add-extension-purposes :python
:regexps '((\"\\.hy$\" . python)))"
:regexps \\='((\"\\.hy$\" . python)))"
(let ((config (purpose-get-extension-configuration ext-keyword)))
(unless config
(user-error "Missing extension configuration: %s" ext-keyword))
Expand All @@ -409,8 +410,8 @@ This function calls `purpose-compile-extended-configuration'.
Example:
(purpose-remove-extension-purposes :python
:modes '(inferior-python-mode)
:regexps '(\"\\.hy$\"))"
:modes \\='(inferior-python-mode)
:regexps \\='(\"\\.hy$\"))"
(let ((config (purpose-get-extension-configuration ext-keyword)))
(unless config
(user-error "Missing extension configuration: %s" ext-keyword))
Expand All @@ -427,10 +428,10 @@ This function calls `purpose-compile-user-configuration' to
update user purposes.
Example:
(purpose-add-user-purposes :modes '((org-mode . org)
(purpose-add-user-purposes :modes \\='((org-mode . org)
(help-mode . popup))
:names '((\"*scratch*\" . popup))
:regexps '((\"^\\*foo\" . terminal)))"
:names \\='((\"*scratch*\" . popup))
:regexps \\='((\"^\\*foo\" . terminal)))"
(setq purpose-user-mode-purposes (append modes purpose-user-mode-purposes)
purpose-user-name-purposes (append names purpose-user-name-purposes)
purpose-user-regexp-purposes (append regexps purpose-user-regexp-purposes))
Expand All @@ -446,9 +447,9 @@ This function calls `purpose-compile-user-configuration' to
update user purposes.
Example:
(purpose-remove-user-purposes :modes '(org-mode help-mode)
:names '(\"*scratch*\")
:regexps '(\"^\\*foo\"))"
(purpose-remove-user-purposes :modes \\='(org-mode help-mode)
:names \\='(\"*scratch*\")
:regexps \\='(\"^\\*foo\"))"
;; let-bind before setq-ing, so we don't apply partial changes if one
;; of MODES, NAMES or REGEXPS is malformed
(let ((new-modes (cl-set-difference purpose-user-mode-purposes modes
Expand Down
8 changes: 4 additions & 4 deletions window-purpose-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@

(defun purpose--dummy-buffer-name (purpose)
"Create the name for a dummy buffer with purpose PURPOSE.
The name created is \"*pu-dummy-PURPOSE-*\". e.g. for purpose 'edit,
The name created is \"*pu-dummy-PURPOSE-*\". e.g. for purpose `edit',
the name is \"*pu-dummy-edit-*\"."
(concat "*pu-dummy-" (symbol-name purpose) "*"))

(defun purpose--dummy-buffer-purpose (buffer-or-name)
"Get buffer's purpose for dummy buffers.
A dummy buffer is a buffer with a name that starts with \"*pu-dummy-\"
and ends with \"*\". For example, the buffer \"*pu-dummy-edit*\" is a
dummy buffer with the purpose 'edit."
dummy buffer with the purpose `edit'."
(let ((name (if (stringp buffer-or-name)
buffer-or-name
(buffer-name buffer-or-name))))
Expand Down Expand Up @@ -240,14 +240,14 @@ purpose PURPOSE."

;;; window purpose dedication
(defun purpose-set-window-purpose-dedicated-p (window flag)
"Set window parameter 'purpose-dedicated of window WINDOW to value
"Set window parameter `purpose-dedicated' of window WINDOW to value
FLAG.
WINDOW defaults to the selected window."
(set-window-parameter window 'purpose-dedicated flag))

(defun purpose-window-purpose-dedicated-p (&optional window)
"Return non-nil if window WINDOW is dedicated to its purpose.
The result is determined by window parameter 'purpose-dedicated.
The result is determined by window parameter `purpose-dedicated'.
WINDOW defaults to the selected window."
(window-parameter window 'purpose-dedicated))

Expand Down
24 changes: 12 additions & 12 deletions window-purpose-fixes.el
Original file line number Diff line number Diff line change
Expand Up @@ -393,19 +393,19 @@ Don't call this function before `popwin' is loaded."
"Install fixes for integrating Purpose with other features.
EXCLUDE is a list of integrations to skip. Known members of EXCLUDE
are:
- 'edebug : don't integrate with edebug
- 'compilation-next-error-function : don't integrate with
- `edebug' : don't integrate with edebug
- `compilation-next-error-function' : don't integrate with
`compilation-next-error-function'.
- 'isearch : don't integrate with isearch
- 'next-error : don't integrate with `next-error'
- 'lv : don't integrate with lv (hydra)
- 'helm : don't integrate with helm
- 'neotree : don't integrate with neotree
- 'org : don't integrate with org
- 'popwin : don't integrate with popwin
- 'guide-key : don't integrate with guide-key
- 'which-key : don't integrate with which-key
- 'whitespace : don't integrate with whitespace"
- `isearch' : don't integrate with isearch
- `next-error' : don't integrate with `next-error'
- `lv' : don't integrate with lv (hydra)
- `helm' : don't integrate with helm
- `neotree' : don't integrate with neotree
- `org' : don't integrate with org
- `popwin' : don't integrate with popwin
- `guide-key' : don't integrate with guide-key
- `which-key' : don't integrate with which-key
- `whitespace' : don't integrate with whitespace"
(interactive)
(unless (member 'edebug exclude)
(purpose--fix-edebug))
Expand Down
15 changes: 8 additions & 7 deletions window-purpose-layout.el
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ This variable is used by `purpose-window-params'. See

(defcustom purpose-set-window-properties-functions nil
"Hook to run after calling `purpose-set-window-properties'.
Use this to set additional properties for windows as they are created,
when `purpose-set-window-layout' or `purpose-load-window-layout-file' is called. Each
function in `purpose-set-window-properties-functions' is called with two
arguments: PROPERTIES and WINDOW. PROPERTIES is the window's property
list as saved in the used layout, and WINDOW is the new window. If
WINDOW is nil, your function should act on the selected window
instead."
Use this to set additional properties for windows as they are
created, when `purpose-set-window-layout' or
`purpose-load-window-layout-file' is called. Each function in
`purpose-set-window-properties-functions' is called with two
arguments: PROPERTIES and WINDOW. PROPERTIES is the window's
property list as saved in the used layout, and WINDOW is the new
window. If WINDOW is nil, your function should act on the
selected window instead."
:group 'purpose
:type 'hook
:package-version '(window-purpose . "1.2"))
Expand Down
2 changes: 1 addition & 1 deletion window-purpose-prefix-overload.el
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ C-u or C-u 1: second command;
C-u C-u or C-u 2: third command;
and so on.
Use it like this:
(define-purpose-prefix-overload hello '(command1 command2 command3))"
(define-purpose-prefix-overload hello \\='(command1 command2 command3))"
(declare (indent defun) (debug (&define name (&rest sexp))))
(unless (eval commands)
(error "Argument COMMANDS cannot be empty"))
Expand Down
10 changes: 5 additions & 5 deletions window-purpose-switch.el
Original file line number Diff line number Diff line change
Expand Up @@ -1118,12 +1118,12 @@ and EXTRA-ARGS, like so:
(apply display-fn buffer alist extra-args).
Example of how this macro might be used:
(defalias 'display-at-bottom-and-dedicate
(defalias \\='display-at-bottom-and-dedicate
(purpose-generate-display-and-dedicate
'purpose-display-at-bottom))
\\='purpose-display-at-bottom))
Another example:
(add-to-list purpose-special-action-sequences
`(terminal ,(purpose-generate-display-and-dedicate
\\=`(terminal ,(purpose-generate-display-and-dedicate
purpose-display-at-bottom 6)))"
(declare (indent defun) (debug (function-form &rest sexp)))
`(lambda (buffer alist)
Expand All @@ -1144,9 +1144,9 @@ The lambda returns the window used for display, or nil if display was
unsuccessful.
Possible usage:
(defalias 'display-at-left-and-do-stuff
(defalias \\='display-at-left-and-do-stuff
(purpose-generate-display-and-do
'purpose-display-at-left
\\='purpose-display-at-left
(lambda (window) (message \"Let's do stuff!!\"))))"
(declare (indent defun) (debug (function-form function-form)))
`(lambda (buffer alist)
Expand Down
22 changes: 11 additions & 11 deletions window-purpose-x.el
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
(:purpose ilist :purpose-dedicated t :width 0.15333333333333332 :height 0.9722222222222222 :edges
(0.8266666666666667 0.0 1.0133333333333334 0.9722222222222222)))
"Window layout for purpose-x-code1-dired-ibuffer.
Has a main 'edit window, and two side windows - 'dired and 'buffers.
Has a main `edit' window, and two side windows - `dired' and `buffers'.
All windows are purpose-dedicated.")

;; the name arg ("purpose-x-code1") is necessary for Emacs 24.5 and older
Expand Down Expand Up @@ -121,10 +121,10 @@ All windows are purpose-dedicated.")

(defun purpose-x-code1-update-dired ()
"Update free dired window with current buffer's directory.
If a non-buffer-dedicated window with purpose 'dired exists, display
the directory of the current buffer in that window, using `dired'.
If there is no window available, do nothing.
If current buffer doesn't have a filename, do nothing."
If a non-buffer-dedicated window with purpose `dired' exists,
display the directory of the current buffer in that window, using
`dired'. If there is no window available, do nothing. If
current buffer doesn't have a filename, do nothing."
(when (and (buffer-file-name)
(cl-delete-if #'window-dedicated-p
(purpose-windows-with-purpose 'dired)))
Expand All @@ -148,13 +148,13 @@ buffer had changed."
(defun purpose-x-code1-setup ()
"Setup purpose-x-code1.
This setup includes 4 windows:
1. dedicated 'edit window
2. dedicated 'dired window. This window shows the current buffer's
1. dedicated `edit' window
2. dedicated `dired' window. This window shows the current buffer's
directory in a special window, using `dired' and
`dired-hide-details-mode' (if available).
3. dedicated 'buffers window. This window shows the currently open
3. dedicated `buffers' window. This window shows the currently open
files, using `ibuffer'.
4. dedicated 'ilist window. This window shows the current buffer's
4. dedicated `ilist' window. This window shows the current buffer's
imenu."
(interactive)
(purpose-set-extension-configuration :purpose-x-code1 purpose-x-code1-purpose-config)
Expand Down Expand Up @@ -319,7 +319,7 @@ Add `golden-ratio' at the end of `purpose-select-buffer-hook' if

(defcustom purpose-x-popwin-position 'bottom
"Position for the popup window.
Legal values for this variable are 'top, 'bottom, 'left and 'right. It
Legal values for this variable are `top', `bottom', `left' and `right.' It
is also possible to set this variable to a function. That function will
be used to create new popup windows and should be a display function
compatible with `display-buffer'."
Expand Down Expand Up @@ -453,7 +453,7 @@ See `display-buffer' for the meaning of ALIST."
(defun purpose-x-popwin-close-windows ()
"Delete all popup windows.
Internally, this function works be deleting all windows that have the
'popup purpose. It also buried all popup buffers so they don't bother
`popup' purpose. It also buried all popup buffers so they don't bother
the user when switching buffers."
(interactive)
(mapc #'delete-window (purpose-windows-with-purpose 'popup))
Expand Down

0 comments on commit 9c7b1e4

Please sign in to comment.