diff options
| -rw-r--r-- | default.mk | 1 | ||||
| -rw-r--r-- | lisp/transient.el | 81 |
2 files changed, 37 insertions, 45 deletions
@@ -8,7 +8,6 @@ ELS = $(PKG).el ELCS = $(ELS:.el=.elc) DEPS = compat -DEPS += cond-let DEPS += seq LOAD_PATH ?= $(addprefix -L ../../,$(DEPS)) diff --git a/lisp/transient.el b/lisp/transient.el index 67bb842..9e239d4 100644 --- a/lisp/transient.el +++ b/lisp/transient.el @@ -10,7 +10,6 @@ ;; Package-Requires: ( ;; (emacs "28.1") ;; (compat "30.1") -;; (cond-let "0.2") ;; (seq "2.24")) ;; SPDX-License-Identifier: GPL-3.0-or-later @@ -49,7 +48,6 @@ (require 'cl-lib) (require 'compat) -(require 'cond-let) (require 'eieio) (require 'edmacro) (require 'format-spec) @@ -1416,7 +1414,7 @@ commands are aliases for." (setq class v) (push k keys) (push v keys)))) - (while-let* + (while-let ((arg (car args)) (arg (cond ;; Inline group definition. @@ -1432,7 +1430,7 @@ commands are aliases for." (when (eq (car-safe (car args)) 'declare) (setq declare (car args)) (setq args (cdr args)) - (when-let ((int (assq 'interactive-only declare))) + (when-let* ((int (assq 'interactive-only declare))) (setq interactive-only (cadr int)) (delq int declare)) (unless (cdr declare) @@ -1542,7 +1540,7 @@ commands are aliases for." (use :argument (cadr arg)) (setq arg (cadr arg))) (string - (when-let ((shortarg (transient--derive-shortarg arg))) + (when-let* ((shortarg (transient--derive-shortarg arg))) (use :shortarg shortarg)) (use :argument arg))) (use :command @@ -1898,7 +1896,7 @@ See info node `(transient)Modifying Existing Transients'." (plist-get props :command))))) (defun transient--command-key (cmd) - (and-let ((obj (transient--suffix-prototype cmd))) + (and-let* ((obj (transient--suffix-prototype cmd))) (cond ((slot-boundp obj 'key) (oref obj key)) ((slot-exists-p obj 'shortarg) @@ -1916,7 +1914,7 @@ level of such a binding. The default level can only be set for commands that were defined using `transient-define-suffix', `transient-define-infix' or `transient-define-argument'." - (if-let ((proto (transient--suffix-prototype command))) + (if-let* ((proto (transient--suffix-prototype command))) (oset proto level level) (user-error "Cannot set level for `%s'; no prototype object exists" command))) @@ -2425,7 +2423,7 @@ of the corresponding object." ((eq alt cmd)) ((oref obj inactive)) ((oref obj inapt)) - ((and-let ((alt (transient-suffix-object alt))) + ((and-let* ((alt (transient-suffix-object alt))) (or (oref alt inactive) (oref alt inapt))) (define-key map kbd cmd)) @@ -2491,7 +2489,7 @@ of the corresponding object." (`(suffix nil nil) #'transient--do-exit) (`(suffix ,do ,_) do)))))) (when pre - (if-let ((alt (lookup-key map id))) + (if-let* ((alt (lookup-key map id))) (unless (eq alt pre) (define-key map (vconcat (oref obj key) id) pre)) (define-key map id pre))))) @@ -2527,7 +2525,7 @@ of the corresponding object." (if transient--redisplay-key (let ((key (vconcat transient--redisplay-key))) (or (lookup-key transient--transient-map key) - (and-let ((regular (lookup-key local-function-key-map key))) + (and-let* ((regular (lookup-key local-function-key-map key))) (lookup-key transient--transient-map (vconcat regular))))) transient--transient-map)) topmap)) @@ -2590,7 +2588,7 @@ value. Otherwise return CHILDREN as is.") children)) (defun transient--env-apply (fn &optional prefix) - (if-let ((env (oref (or prefix transient--prefix) environment))) + (if-let* ((env (oref (or prefix transient--prefix) environment))) (funcall env fn) (funcall fn))) @@ -2927,7 +2925,7 @@ value. Otherwise return CHILDREN as is.") ((and transient--prefix transient--redisplay-key) (setq transient--redisplay-key nil) (when transient--showp - (if-let ((win (minibuffer-selected-window))) + (if-let* ((win (minibuffer-selected-window))) (with-selected-window win (transient--show)) (transient--show))))) @@ -3024,7 +3022,7 @@ value. Otherwise return CHILDREN as is.") (advice-eval-interactive-spec spec))) (setq abort nil)) (when abort - (when-let ((unwind (oref prefix unwind-suffix))) + (when-let* ((unwind (oref prefix unwind-suffix))) (transient--debug 'unwind-interactive) (funcall unwind command)) (when (symbolp command) @@ -3040,7 +3038,7 @@ value. Otherwise return CHILDREN as is.") (oref grp advice*)))) (apply adv fn args) (apply fn args))) - (when-let ((unwind (oref prefix unwind-suffix))) + (when-let* ((unwind (oref prefix unwind-suffix))) (transient--debug 'unwind-command) (funcall unwind command)) (when (symbolp command) @@ -3069,7 +3067,7 @@ value. Otherwise return CHILDREN as is.") (advice-eval-interactive-spec spec))) (setq abort nil)) (when abort - (when-let ((unwind (oref prefix unwind-suffix))) + (when-let* ((unwind (oref prefix unwind-suffix))) (transient--debug 'unwind-interactive) (funcall unwind command)) (when (symbolp command) @@ -3087,7 +3085,7 @@ value. Otherwise return CHILDREN as is.") (oref grp advice*)))) (apply adv fn args) (apply fn args))) - (when-let ((unwind (oref prefix unwind-suffix))) + (when-let* ((unwind (oref prefix unwind-suffix))) (transient--debug 'unwind-command) (funcall unwind command)) (when (symbolp command) @@ -3546,8 +3544,8 @@ prefix argument and pivot to `transient-update'." ;; `this-command' is `transient-undefined' or `transient-inapt'. ;; Show the command (`this-original-command') the user actually ;; tried to invoke. - (if-let ((cmd (or (ignore-errors (symbol-name this-original-command)) - (ignore-errors (symbol-name this-command))))) + (if-let* ((cmd (or (ignore-errors (symbol-name this-original-command)) + (ignore-errors (symbol-name this-command))))) (format " [%s]" (propertize cmd 'face 'font-lock-warning-face)) "")) (unless (and transient--transient-map @@ -3876,7 +3874,7 @@ Use `transient-default-value' to determine the default value." ;; the prototype, were the set (if any) value is stored. (oref obj value) (oset obj value - (if-let ((saved (assq (oref obj command) transient-values))) + (if-let* ((saved (assq (oref obj command) transient-values))) (cdr saved) (transient-default-value obj))))) @@ -3925,8 +3923,8 @@ Call `transient-default-value' but because that is a noop for If the value of the `default-value' slot is a function, call it to determine the value. If the slot's value isn't a function, return that. If the slot is unbound, return nil." - (if-let ((default (and (slot-boundp obj 'default-value) - (oref obj default-value)))) + (if-let* ((default (and (slot-boundp obj 'default-value) + (oref obj default-value)))) (if (functionp default) (funcall default) default) @@ -4056,7 +4054,7 @@ The last value is \"don't use any of these switches\"." "Elsewhere use the reader of the infix command COMMAND. Use this if you want to share an infix's history with a regular stand-alone command." - (if-let ((obj (transient--suffix-prototype command))) + (if-let* ((obj (transient--suffix-prototype command))) (cl-letf (((symbol-function #'transient--show) #'ignore)) (transient-infix-read obj)) (error "Not a suffix command: `%s'" command))) @@ -4282,7 +4280,7 @@ setting up a menu and its suffixes, in which case `transient-get-value' should be used." (when (listp prefix) (setq prefix (car (or (memq transient-current-command prefix) prefix)))) - (if-let ((obj (get prefix 'transient--prefix))) + (if-let* ((obj (get prefix 'transient--prefix))) ;; This OBJ is only used for dispatch purposes; see below. (transient-prefix-value obj) (error "Not a transient prefix: %s" prefix))) @@ -4373,7 +4371,7 @@ slot, but callers of `transient-args' wish to treat the values of certain suffixes as multiple values. That translation is handled here. The object's `multi-value' slot specifies whether and how to interpret the `value' as multiple values." - (and-let ((value (transient-infix-value obj))) + (and-let* ((value (transient-infix-value obj))) (pcase-exhaustive (and (slot-exists-p obj 'multi-value) (oref obj multi-value)) ('nil (list value)) @@ -4411,7 +4409,7 @@ does nothing." nil) (cl-defmethod transient-infix-value ((obj transient-option)) "Return ARGUMENT and VALUE as a unit or nil if the latter is nil." - (and-let ((value (oref obj value))) + (and-let* ((value (oref obj value))) (let ((arg (oref obj argument))) (pcase-exhaustive (oref obj multi-value) ('nil (concat arg value)) @@ -4748,7 +4746,7 @@ have a history of their own.") (transient--insert-groups) (when (or transient--helpp transient--editp) (transient--insert-help)) - (when-let ((line (transient--separator-line))) + (when-let* ((line (transient--separator-line))) (insert line))) (defun transient--mode-line-format () @@ -4802,8 +4800,8 @@ have a history of their own.") (cl-defmethod transient--insert-group :around ((group transient-group) &optional _) "Insert GROUP's description, if any." - (when-let ((desc (transient-with-shadowed-buffer - (transient-format-description group)))) + (when-let* ((desc (transient-with-shadowed-buffer + (transient-format-description group)))) (insert desc ?\n)) (let ((transient--max-group-level (max (oref group level) transient--max-group-level)) @@ -4836,7 +4834,7 @@ have a history of their own.") (lambda (column) (transient--maybe-pad-keys column group) (transient-with-shadowed-buffer - `(,@(and-let ((desc (transient-format-description column))) + `(,@(and-let* ((desc (transient-format-description column))) (list desc)) ,@(let ((transient--pending-group column)) (mapcar #'transient-format @@ -4930,7 +4928,7 @@ as a button." "Format OBJ's `key' for display and return the result." (let ((key (if (slot-boundp obj 'key) (oref obj key) "")) (cmd (and (slot-boundp obj 'command) (oref obj command)))) - (when-let ((width (oref transient--pending-group pad-keys))) + (when-let* ((width (oref transient--pending-group pad-keys))) (setq key (truncate-string-to-width key width nil ?\s))) (if transient--redisplay-key (let ((len (length transient--redisplay-key)) @@ -5043,7 +5041,7 @@ apply the face `transient-unreachable' to the complete string." `((?c . ,desc) (?s . ,docstr))))) (if desc - (when-let ((face (transient--get-face obj 'face))) + (when-let* ((face (transient--get-face obj 'face))) (setq desc (transient--add-face desc face t))) (setq desc (propertize "(BUG: no description)" 'face 'error))) (when (cond (transient--all-levels-p @@ -5052,8 +5050,8 @@ apply the face `transient-unreachable' to the complete string." (> (max (oref obj level) transient--max-group-level) transient--default-prefix-level))) (setq desc (transient--add-face desc 'transient-higher-level))) - (when-let ((inapt-face (and (oref obj inapt) - (transient--get-face obj 'inapt-face)))) + (when-let* ((inapt-face (and (oref obj inapt) + (transient--get-face obj 'inapt-face)))) (setq desc (transient--add-face desc inapt-face))) (when (and (slot-boundp obj 'key) (transient--key-unreachable-p obj)) @@ -5075,7 +5073,7 @@ apply the face `transient-unreachable' to the complete string." (let ((argument (prin1-to-string (oref obj argument) t)) (aface (transient-argument-face obj)) (vface (transient-value-face obj))) - (if-let ((value (oref obj value))) + (if-let* ((value (oref obj value))) (pcase-exhaustive (oref obj multi-value) ('nil (concat (propertize argument 'face aface) @@ -5189,8 +5187,8 @@ apply the face `transient-unreachable' to the complete string." (and val (not (integerp val)) val))) (defun transient--maybe-pad-keys (group &optional parent) - (when-let ((pad (or (oref group pad-keys) - (and parent (oref parent pad-keys))))) + (when-let* ((pad (or (oref group pad-keys) + (and parent (oref parent pad-keys))))) (oset group pad-keys (apply #'max (if (integerp pad) pad 0) @@ -5246,7 +5244,7 @@ that, else its name. Intended to be temporarily used as the `:suffix-description' of a prefix command, while porting a regular keymap to a transient." (let ((command (oref obj command))) - (if-let ((doc (documentation command))) + (if-let* ((doc (documentation command))) (propertize (car (split-string doc "\n")) 'face 'font-lock-doc-face) (propertize (symbol-name command) 'face 'font-lock-function-name-face)))) @@ -5508,8 +5506,8 @@ See `forward-button' for information about N." (transient--button-move-echo))) (defun transient--button-move-echo () - (when-let ((_(memq transient-enable-menu-navigation '(verbose force-verbose))) - (obj (get-text-property (point) 'button-data))) + (when-let* ((_(memq transient-enable-menu-navigation '(verbose force-verbose))) + (obj (get-text-property (point) 'button-data))) (let ((message-log-max nil)) (message "%s" (or (transient-get-summary obj) ""))))) @@ -5800,10 +5798,5 @@ as stand-in for elements of exhausted lists." ;; (cond . 0) ;; (cond* . 0) ;; (interactive . 0)) -;; read-symbol-shorthands: ( -;; ("and-let" . "cond-let--and-let") -;; ("if-let" . "cond-let--if-let") -;; ("when-let" . "cond-let--when-let") -;; ("while-let" . "cond-let--while-let")) ;; End: ;;; transient.el ends here |
