Skip to content

Commit

Permalink
Rename dummy keyword parameter variable names.
Browse files Browse the repository at this point in the history
Closes #2694.
  • Loading branch information
aadcg committed Nov 11, 2024
1 parent 36d44d8 commit 5cd8571
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
5 changes: 4 additions & 1 deletion developer-manual.org
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,10 @@ When =slot-value= is the only parameter specified then:
=error=).
- Dummy variables are called =_=.
- Prefer American spelling.
- Construct =define-command= requires a short one-line docstring without newlines.
- Construct =define-command= requires a short one-line docstring without
newlines.
- Name keyword function parameters as follows =&key (var default-value
var-supplied-p)=.

# - Conversion functions =FROM->TO= or =->TO= for generic functions. The
# only one that comes to mind is =url= which does not follow this convention...
Expand Down
4 changes: 2 additions & 2 deletions source/buffer.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,11 +1143,11 @@ is listed first."
(lambda (buffer)
(member (url buffer) buffers
:key #'url :test #'quri:uri-equal)))))))
explicit-buffers-p))
buffers-supplied-p))
"Query the buffer(s) to delete.
BUFFERS should be a list of `buffer's."
(when explicit-buffers-p
(when buffers-supplied-p
(delete-all (uiop:ensure-list buffers)))))

(define-command delete-all-buffers (&key (confirmation-p t))
Expand Down
10 changes: 5 additions & 5 deletions source/configuration.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Return NIL if not a class form."
(log:info "Writing auto configuration to ~s." (files:expand file))
(call-next-method)))

(defun auto-configure (&key form class-name slot (slot-value nil slot-value-p))
(defun auto-configure (&key form class-name slot (slot-value nil slot-value-supplied-p))
(files:with-file-content (config *auto-config-file*)
(if class-name
(flet ((ensure-class-form (class-name)
Expand All @@ -269,7 +269,7 @@ Return NIL if not a class form."
(delete-if (sera:eqs slot) (sera:filter #'slot-form-p (forms class-form)) :key #'name)))
(let ((class-form (ensure-class-form class-name)))
(if slot
(if slot-value-p
(if slot-value-supplied-p
(sera:lret ((slot-form (ensure-slot-form class-form slot)))
(setf (value slot-form) slot-value))
(setf (forms class-form) (delete-slot-form class-form slot)))
Expand Down Expand Up @@ -401,7 +401,7 @@ To discover the default value of a slot or all slots of a class, use the
;; - Or simply leaving the interpretation of this clause to the user.
;; But maybe that's beyond if-confirm.
(export-always 'if-confirm)
(defmacro if-confirm ((prompt &key (yes "yes" explicit-yes-p) (no "no" explicit-no-p))
(defmacro if-confirm ((prompt &key (yes "yes" yes-supplied-p) (no "no" no-supplied-p))
&optional (yes-form t) no-form)
"Ask the user for confirmation before executing either YES-FORM or NO-FORM.
YES-FORM is executed on YES answer, NO-FORM -- otherwise (including NO and
Expand All @@ -424,9 +424,9 @@ Examples:
(prompt1
:prompt ,prompt
:sources (make-instance 'prompter:yes-no-source
,@(when explicit-yes-p
,@(when yes-supplied-p
(list :yes yes))
,@(when explicit-no-p
,@(when no-supplied-p
(list :no no)))
:hide-suggestion-count-p t)
(prompt-buffer-canceled () nil))))
Expand Down
4 changes: 2 additions & 2 deletions source/describe.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ Otherwise prompt for matches."
(:dt "Slot in " (:nxref :class-name class))
(:dd (:nxref :class-name class :slot input))))))))

(defmethod describe-any :around (&key (input nil input-provided-p))
(defmethod describe-any :around (&key (input nil input-supplied-p))
(declare (ignorable input))
(cond
((and input-provided-p (symbolp input))
((and input-supplied-p (symbolp input))
(call-next-method))
(t
(let ((sources
Expand Down
24 changes: 12 additions & 12 deletions source/mode.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ Only used to mandate whether the mode needs a toggler command:
name
`(lambda (&rest args
&key (buffer (or (current-prompt-buffer) (current-buffer)))
(activate t explicit?)
(activate t activate-supplied-p)
&allow-other-keys)
,(let ((*print-case* :downcase))
(format nil "Toggle `~a'." name))
(declare (ignorable buffer activate explicit?))
(declare (ignorable buffer activate activate-supplied-p))
(apply #'toggle-mode ',name args))
:global)))
(setf (fdefinition name) command))
Expand Down Expand Up @@ -412,8 +412,8 @@ ARGS are the keyword arguments for `make-instance'/`enable' on MODES.
If REMEMBER-P is true, save active modes so that auto-rules don't override those."))

(define-command enable-modes (&key
(modes nil explicit-modes-p)
(buffers (current-buffer) explicit-buffers-p))
(modes nil modes-supplied-p)
(buffers (current-buffer) buffers-supplied-p))
"Enable MODES for BUFFERS prompting for either or both.
MODES should be a list of mode symbols or a mode symbol.
BUFFERS and MODES are automatically coerced into a list.
Expand All @@ -424,14 +424,14 @@ If it's a single buffer, return it directly (not as a list)."
;; case it's handy that this function does not error, it simply does nothing.
;; REVIEW: But we wrap commands into `with-protect' for this, don't we?
(let* ((buffers (or buffers
(unless explicit-buffers-p
(unless buffers-supplied-p
(prompt
:prompt "Enable mode(s) for buffer(s)"
:sources (make-instance 'buffer-source
:enable-marks-p t
:actions-on-return '())))))
(modes (or modes
(unless explicit-modes-p
(unless modes-supplied-p
(prompt
:prompt "Enable mode(s)"
:sources (make-instance 'inactive-mode-source
Expand Down Expand Up @@ -459,23 +459,23 @@ If it's a single buffer, return it directly (not as a list)."
(:documentation "Disable MODES in BUFFERS.
If REMEMBER-P is true, save active modes so that auto-rules don't override those."))

(define-command disable-modes (&key (modes nil explicit-modes-p)
(buffers (current-buffer) explicit-buffers-p))
(define-command disable-modes (&key (modes nil modes-supplied-p)
(buffers (current-buffer) buffers-supplied-p))
"Disable MODES for BUFFERS.
MODES should be a list of mode symbols.
BUFFERS and MODES are automatically coerced into a list.
If BUFFERS is a list, return it.
If it's a single buffer, return it directly (not as a list)."
(let* ((buffers (or buffers
(unless explicit-buffers-p
(unless buffers-supplied-p
(prompt
:prompt "Enable mode(s) for buffer(s)"
:sources (make-instance 'buffer-source
:enable-marks-p t
:actions-on-return '())))))
(modes (or modes
(unless explicit-modes-p
(unless modes-supplied-p
(prompt
:prompt "Disable mode(s)"
:sources (make-instance 'active-mode-source
Expand Down Expand Up @@ -507,12 +507,12 @@ If it's a single buffer, return it directly (not as a list)."
(defun toggle-mode (mode-sym
&rest args
&key (buffer (or (current-prompt-buffer) (current-buffer)))
(activate t explicit?)
(activate t activate-supplied-p)
&allow-other-keys)
"Enable MODE-SYM if not already enabled, disable it otherwise."
(when (modable-buffer-p buffer)
(let ((existing-instance (find mode-sym (slot-value buffer 'modes) :key #'sera:class-name-of)))
(unless explicit?
(unless activate-supplied-p
(setf activate (or (not existing-instance)
(not (enabled-p existing-instance)))))
(if activate
Expand Down

0 comments on commit 5cd8571

Please sign in to comment.