emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] scratch/dirvish bee94d6707: Minor fixes in response to compiler


From: Stefan Monnier
Subject: [nongnu] scratch/dirvish bee94d6707: Minor fixes in response to compiler warnings
Date: Thu, 28 Nov 2024 19:16:00 -0500 (EST)

branch: scratch/dirvish
commit bee94d67077b497d867e231a1d2352d733f2c2bb
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    Minor fixes in response to compiler warnings
    
    Remove redundant `:group` arguments.
    Prefer #' to quote function names.
    Avoid obsolete `when/if-let`.
    Use lexical-binding also in `eval`.
    
    * .gitignore: New file.
    
    * extensions/dirvish-emerge.el (dirvish-emerge--make-pred):
    Use proper closures rather than `(lambda ...).  Also use `val` rather
    than fetching it again from `recipe`.
    
    * dirvish.el (dirvish-mode-line-height, dirvish-header-line-height)
    (dirvish-open-with-programs):
    * extensions/dirvish-vc.el (dirvish-vc-state-face-alist):
    * extensions/dirvish-peek.el (dirvish-peek-candidate-fetcher)
    (dirvish-peek-categories):
    * extensions/dirvish-icons.el (dirvish-all-the-icons-palette)
    (dirvish-nerd-icons-palette):
    * extensions/dirvish-yank.el (dirvish-yank-rsync-args): Fix Custom type.
    (dirvish-yank--rsync-transient-init-value): Use `or`.
    (dirvish-yank--rsync-transient-read-multiple): Use `dlet`.
---
 .gitignore                         |  5 +++
 dirvish-extras.el                  | 10 +++--
 dirvish.el                         | 84 ++++++++++++++++++--------------------
 extensions/dirvish-emerge.el       | 24 ++++++-----
 extensions/dirvish-icons.el        |  4 +-
 extensions/dirvish-ls.el           |  5 ++-
 extensions/dirvish-peek.el         |  6 +--
 extensions/dirvish-quick-access.el |  5 ++-
 extensions/dirvish-side.el         |  2 +-
 extensions/dirvish-subtree.el      |  2 +-
 extensions/dirvish-vc.el           |  2 +-
 extensions/dirvish-yank.el         | 27 ++++++------
 12 files changed, 96 insertions(+), 80 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..742d46c79d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+*.elc
+
+# ELPA-generated files.
+/dirvish-autoloads.el
+/dirvish-pkg.el
diff --git a/dirvish-extras.el b/dirvish-extras.el
index 4f64760c43..b5d6208210 100644
--- a/dirvish-extras.el
+++ b/dirvish-extras.el
@@ -116,13 +116,16 @@ predicate for that infix."
      with (attrs . layouts) = ()
      for (k v desc pred) in value
      for name = (and (symbolp v) (intern (format "dirvish-%s-infix" v)))
+     ;; FIXME: We shouldn't need `eval' to do these `transient' definitions!
      do (if (not name)
             (push (list k (propertize desc 'face 'font-lock-doc-face)
+                        ;; FIXME: Use a proper closure?
                         `(lambda () (interactive) (dirvish-layout-switch ,v)))
                   layouts)
           (eval `(transient-define-infix ,name ()
                    :class 'dirvish-attribute :variable ',v
-                   :description ,desc :if (lambda () ,(if pred `,@pred t))))
+                   :description ,desc :if (lambda () ,(if pred `,@pred t)))
+                t)
           (push (list k name) attrs))
      finally
      (eval
@@ -139,7 +142,8 @@ predicate for that infix."
              (setq-default dirvish-attributes dirvish-attributes)
              (setq dirvish-default-layout (cdr (dv-layout (dirvish-curr))))
              (dirvish--init-session (dirvish-curr))
-             (revert-buffer)))])))))
+             (revert-buffer)))])
+      t))))
 
 (defconst dirvish-tramp-preview-cmd
   "head -n 1000 %s 2>/dev/null || ls -Alh --group-directories-first %s 
2>/dev/null")
@@ -225,7 +229,7 @@ FN is the original `dired-noselect' closure."
       (let ((process-connection-type nil)
             (localname (file-remote-p file 'localname))
             (buf (dirvish--util-buffer 'preview dv nil t)) proc)
-        (when-let ((proc (get-buffer-process buf))) (delete-process proc))
+        (when-let* ((proc (get-buffer-process buf))) (delete-process proc))
         (setq proc (start-file-process-shell-command
                     (buffer-name buf) buf
                     (format dirvish-tramp-preview-cmd localname localname)))
diff --git a/dirvish.el b/dirvish.el
index 07c50b8498..a8a3ba75cf 100644
--- a/dirvish.el
+++ b/dirvish.el
@@ -44,7 +44,7 @@ Dirvish ships with these attributes:
 - `vc-state': The version control state at left fringe.
 - `file-size': file size or directories file count at right fringe.
 - `file-time': Show file modification time before the `file-size'."
-  :group 'dirvish :type '(repeat (symbol :tag "Dirvish attribute")))
+  :type '(repeat (symbol :tag "Dirvish attribute")))
 
 (defcustom dirvish-preview-dispatchers '(image gif video audio epub archive 
pdf)
   "List of preview dispatchers.
@@ -60,23 +60,23 @@ The default value contains:
 - epub: preview epub documents, requires `epub-thumbnailer'.
 - pdf: preview pdf documents via `pdf-tools'.
 - archive: preview archive files such as .tar, .zip, requires `tar' / `unzip'."
-  :group 'dirvish :type '(repeat (symbol :tag "Dirvish preview methods")))
+  :type '(repeat (symbol :tag "Dirvish preview methods")))
 
 (defcustom dirvish-preview-disabled-exts '("iso" "bin" "exe" "gpg" "elc" "eln")
   "Do not preview files end with these extensions."
-  :group 'dirvish :type '(repeat (string :tag "File name extension")))
+  :type '(repeat (string :tag "File name extension")))
 
 (defcustom dirvish-preview-environment
   '((inhibit-message . t) (non-essential . t) (delay-mode-hooks . t)
     (enable-dir-local-variables . nil) (enable-local-variables . :safe))
   "Variables which are bound for default file preview dispatcher.
 Credit: copied from `consult-preview-variables' in `consult.el'."
-  :group 'dirvish :type 'alist)
+  :type 'alist)
 
 (defcustom dirvish-cache-dir
   (expand-file-name "dirvish/" user-emacs-directory)
   "Preview / thumbnail cache directory for dirvish."
-  :group 'dirvish :type 'string)
+  :type 'string)
 
 (defcustom dirvish-default-layout '(1 0.11 0.55)
   "Default layout recipe for fullscreen Dirvish sessions.
@@ -88,14 +88,13 @@ to each parent windows.  PREVIEW-WIDTH controls the width
 allocated to preview window.  The default value provides a
 1:3:5 (approximately) pane ratio.  Also see
 `dirvish-layout-recipes' in `dirvish-extras.el'."
-  :group 'dirvish :type '(list (integer :tag "number of parent windows")
+  :type '(list (integer :tag "number of parent windows")
                                (float :tag "max width of parent windows")
                                (float :tag "width of preview windows")))
 
 (defface dirvish-hl-line
   '((t :inherit highlight :extend t))
-  "Face for Dirvish line highlighting."
-  :group 'dirvish)
+  "Face for Dirvish line highlighting.")
 
 (define-obsolete-variable-alias 'dirvish-mode-line-position 
'dirvish-use-mode-line "Aug 5, 2022")
 (defcustom dirvish-use-mode-line t
@@ -104,7 +103,6 @@ The valid value are:
 - nil: hide mode line in dirvish sessions
 - global: display the mode line across all panes
 - t (and others): Display the mode line across directory panes"
-  :group 'dirvish
   :type '(choice (const :tag "Do not show the mode line" nil)
                  (const :tag "Display the mode line across directory panes" t)
                  (const :tag "Make the mode line span all panes" global)))
@@ -112,7 +110,7 @@ The valid value are:
 (define-obsolete-variable-alias 'dirvish-header-line-position 
'dirvish-use-header-line "Aug 5, 2022")
 (defcustom dirvish-use-header-line t
   "Like `dirvish-use-mode-line', but for header line."
-  :group 'dirvish :type 'symbol)
+  :type 'symbol)
 
 (defcustom dirvish-mode-line-height 30
   "Height of Dirvish's mode line.
@@ -120,12 +118,11 @@ The value should be a cons cell (H-WIN . H-FRAME), where 
H-WIN
 and H-FRAME represent the height of mode line in single window
 state and fullframe state respectively.  If this value is a
 integer INT, it is seen as a shorthand for (INT . INT)."
-  :group 'dirvish
-  :type '(choice interger (cons integer integer)))
+  :type '(choice integer (cons integer integer)))
 
 (defcustom dirvish-header-line-height 30
   "Like `dirvish-mode-line-height', but for header line."
-  :type '(choice interger (cons integer integer)))
+  :type '(choice integer (cons integer integer)))
 
 (defcustom dirvish-mode-line-format
   '(:left (sort omit symlink) :right (index))
@@ -148,20 +145,20 @@ Others are self-explanatory:
 `yank': file transfer progress (from `dirvish-yank').
 
 Set it to nil to use the default `mode-line-format'."
-  :group 'dirvish :type 'plist)
+  :type 'plist)
 
 (defcustom dirvish-header-line-format
   '(:left (path) :right ())
   "Like `dirvish-mode-line-format', but for header line ."
-  :group 'dirvish :type 'plist)
+  :type 'plist)
 
 (defcustom dirvish-hide-details t
   "Whether to hide detailed information on session startup."
-  :group 'dirvish :type 'boolean)
+  :type 'boolean)
 
 (defcustom dirvish-hide-cursor t
   "Whether to hide cursor in dirvish buffers."
-  :group 'dirvish :type 'boolean)
+  :type 'boolean)
 
 (defconst dirvish-emacs-bin
   (cond
@@ -186,9 +183,8 @@ the EXTS using `dired-find-file', a subprocess according to 
CMD
 and its ARGS is issued to open the file externally.  The special
 placeholder \"%f\" in the ARGS is replaced by the FILENAME at
 runtime.  Set it to nil disables this feature."
-  :group 'dirvish
-  :type '(alist :key-type ((repeat string) :tag "File extensions")
-                :value-type ((repeat string) :tag "External command and 
args")))
+  :type '(alist :key-type (repeat :tag "File extensions" string)
+                :value-type (repeat :tag "External command and args" string)))
 
 (defcustom dirvish-reuse-session t
   "Whether to reuse the hidden sessions.
@@ -197,7 +193,7 @@ exit.  The hidden session can be reused in the future by 
command
 `dirvish' and friends.  If the value is \\='resume, dirvish
 exhibits the last entry of the hidden session unless the PATH
 argument is specified via prompt."
-  :group 'dirvish :type '(choice (const :tag "Do not reuse the session, quit 
it completely" nil)
+  :type '(choice (const :tag "Do not reuse the session, quit it completely" 
nil)
                                  (const :tag "Reuse the session and open new 
path when reusing" t)
                                  (const :tag "Reuse the session and resume its 
last entry when reusing" resume)))
 
@@ -205,22 +201,22 @@ argument is specified via prompt."
   "Input debounce for dirvish UI redisplay.
 The UI of dirvish is refreshed only when there has not been new
 input for `dirvish-redisplay-debounce' seconds."
-  :group 'dirvish :type 'float)
+  :type 'float)
 
 (cl-defgeneric dirvish-clean-cache () "Clean cache for selected files." nil)
 (cl-defgeneric dirvish-build-cache () "Build cache for current directory." nil)
 
 (defcustom dirvish-after-revert-hook '(dirvish-clean-cache)
   "Executed after `revert-buffer'."
-  :group 'dirvish :type 'hook)
+  :type 'hook)
 
 (defcustom dirvish-setup-hook '(dirvish-build-cache)
   "Executed after the Dired buffer is showed up."
-  :group 'dirvish :type 'hook)
+  :type 'hook)
 
 (defcustom dirvish-find-entry-hook '(dirvish-insert-entry-h)
   "Executed after finding a entry."
-  :group 'dirvish :type 'hook)
+  :type 'hook)
 
 ;;;; Internal variables
 
@@ -239,8 +235,8 @@ input for `dirvish-redisplay-debounce' seconds."
 (defvar dirvish-mode-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map dired-mode-map)
-    (define-key map (kbd "?") 'dirvish-dispatch)
-    (define-key map (kbd "q") 'dirvish-quit) map)
+    (define-key map (kbd "?") #'dirvish-dispatch)
+    (define-key map (kbd "q") #'dirvish-quit) map)
   "Keymap used in dirvish buffers.")
 (defvar dirvish-redisplay-debounce-timer nil)
 (defvar dirvish--history nil)
@@ -494,7 +490,7 @@ ARGS is a list of keyword arguments for `dirvish' struct."
           (setq header-line-format dirvish--header-line-fmt)))
       (cl-loop for (_d . b) in (dv-roots dv)
                when (not (eq b index)) do (kill-buffer b))
-      (when-let ((wconf (dv-winconf dv))) (set-window-configuration wconf)))
+      (when-let* ((wconf (dv-winconf dv))) (set-window-configuration wconf)))
     (mapc #'dirvish--kill-buffer (dv-preview-buffers dv))
     (cl-loop for b in (buffer-list) for bn = (buffer-name b) when
              (string-match-p (format " ?\\*Dirvish-.*-%s\\*" (dv-name dv)) bn)
@@ -529,7 +525,7 @@ ARGS is a list of keyword arguments for `dirvish' struct."
   (sort (cl-loop for attr in attrs
                  for lst = (alist-get attr dirvish--available-attrs)
                  for (idx width pred render ov _) = lst
-                 collect (list idx (eval width) pred render ov))
+                 collect (list idx (eval width t) pred render ov))
         (lambda (a b) (< (car a) (car b)))))
 
 (defun dirvish--check-deps ()
@@ -643,7 +639,7 @@ buffer, it defaults to filename under the cursor when it is 
nil."
                                (member ext exts)
                                (append (list cmd) args)))))
         (if ex (apply #'start-process "" nil "nohup"
-                      (cl-substitute file "%f" ex :test 'string=))
+                      (cl-substitute file "%f" ex :test #'string=))
           (let* ((dv (dirvish-curr)) (fn (nth 4 (dv-type dv))))
             (if fn (funcall fn) (dirvish-kill dv)))
           (find-file file))))))
@@ -665,7 +661,7 @@ buffer, it defaults to filename under the cursor when it is 
nil."
 
 (defun dirvish-thumb-buf-a (fn)
   "Advice for FN `image-dired-create-thumbnail-buffer'."
-  (when-let ((dv dirvish--this) ((dv-preview-window dv)))
+  (when-let* ((dv dirvish--this) ((dv-preview-window dv)))
     (dirvish--init-session dv)
     (with-selected-window (dv-preview-window dv)
       (switch-to-buffer image-dired-thumbnail-buffer)))
@@ -723,7 +719,7 @@ buffer, it defaults to filename under the cursor when it is 
nil."
 (defun dirvish-update-body-h (&optional force)
   "Update UI of current Dirvish.
 When FORCE, ensure the preview get refreshed."
-  (when-let ((dv (dirvish-curr)))
+  (when-let* ((dv (dirvish-curr)))
     (cond ((not dirvish-hide-cursor))
           ((eobp) (forward-line -1))
           ((cdr dired-subdir-alist))
@@ -731,7 +727,7 @@ When FORCE, ensure the preview get refreshed."
            (goto-char (dirvish-prop :content-begin))))
     (when dirvish-hide-cursor (dired-move-to-filename))
     (dirvish--render-attrs)
-    (when-let ((filename (dired-get-filename nil t)))
+    (when-let* ((filename (dired-get-filename nil t)))
       (dirvish-prop :index filename)
       (let ((h-buf (dirvish--util-buffer 'header dv t))
             (f-buf (dirvish--util-buffer 'footer dv t))
@@ -755,12 +751,12 @@ When FORCE, ensure the preview get refreshed."
 
 (defun dirvish-kill-buffer-h ()
   "Remove buffer from session's buffer list."
-  (when-let ((dv (dirvish-curr)) (buf (current-buffer)))
+  (when-let* ((dv (dirvish-curr)) (buf (current-buffer)))
     (let ((win (get-buffer-window buf)))
       (when (window-live-p win) (set-window-dedicated-p win nil)))
     (setf (dv-roots dv) (cl-remove-if (lambda (i) (eq (cdr i) buf)) (dv-roots 
dv)))
     (unless (dv-roots dv)
-      (when-let ((layout (car (dv-layout dv)))
+      (when-let* ((layout (car (dv-layout dv)))
                  (wconf (dv-winconf dv))
                  ((eq buf (window-buffer (selected-window)))))
         (set-window-configuration wconf))
@@ -791,7 +787,7 @@ When FORCE, ensure the preview get refreshed."
   "Rebuild layout once buffer in FRAME-OR-WINDOW changed."
   (let ((win (frame-selected-window frame-or-window)))
     (with-current-buffer (window-buffer win)
-      (when-let ((dv (dirvish-curr))) (dirvish--init-session dv)))))
+      (when-let* ((dv (dirvish-curr))) (dirvish--init-session dv)))))
 
 (defun dirvish-tab-new-post-h (_tab)
   "Do not reuse sessions from other tabs."
@@ -830,7 +826,7 @@ When FORCE, ensure the preview get refreshed."
 
 (dirvish-define-preview default (file ext)
   "Default preview dispatcher for FILE."
-  (when-let ((attrs (ignore-errors (file-attributes file)))
+  (when-let* ((attrs (ignore-errors (file-attributes file)))
              (size (file-attribute-size attrs)))
     (cond ((file-directory-p file) ; default directory previewer
            (let* ((script `(with-current-buffer
@@ -864,7 +860,7 @@ When FORCE, ensure the preview get refreshed."
 (defun dirvish-shell-preview-proc-s (proc _exitcode)
   "A sentinel for dirvish preview process.
 When PROC finishes, fill preview buffer with process result."
-  (when-let ((dv (or (dirvish-curr) dirvish--this)))
+  (when-let* ((dv (or (dirvish-curr) dirvish--this)))
     (with-current-buffer (dirvish--util-buffer 'preview dv nil t)
       (erase-buffer) (remove-overlays)
       (insert (with-current-buffer (process-buffer proc) (buffer-string)))
@@ -881,12 +877,12 @@ When PROC finishes, fill preview buffer with process 
result."
 
 (defun dirvish--run-shell-for-preview (dv recipe)
   "Dispatch shell cmd with RECIPE for session DV."
-  (when-let ((proc (get-buffer-process (get-buffer " *Dirvish-temp*"))))
+  (when-let* ((proc (get-buffer-process (get-buffer " *Dirvish-temp*"))))
     (delete-process proc))
   (let ((buf (dirvish--util-buffer 'preview dv nil t))
         (proc (make-process :name "sh-out" :connection-type nil
                             :buffer " *Dirvish-temp*" :command (cdr recipe)
-                            :sentinel 'dirvish-shell-preview-proc-s)))
+                            :sentinel #'dirvish-shell-preview-proc-s)))
     (process-put proc 'cmd-info (car recipe))
     (with-current-buffer buf (erase-buffer) (remove-overlays) buf)))
 
@@ -1073,7 +1069,7 @@ LEVEL is the depth of current window."
          (depth (or (caar (dv-layout dv)) 0))
          (i 0))
     (dirvish--setup-mode-line (car (dv-layout dv)))
-    (when-let (fixed (nth 1 (dv-type dv))) (setq window-size-fixed fixed))
+    (when-let* ((fixed (nth 1 (dv-type dv)))) (setq window-size-fixed fixed))
     (set-window-dedicated-p
      nil (and (or (car (dv-layout dv)) (nth 2 (dv-type dv))) t))
     (set-window-fringes nil 1 1)
@@ -1156,7 +1152,7 @@ Run `dirvish-setup-hook' afterwards when SETUP is 
non-nil."
          (c (format "%S" `(message "%s" ,(dirvish--dir-data-getter dir))))
          (proc (make-process :name "dir-data" :connection-type nil :buffer buf
                              :command (list dirvish-emacs-bin "-Q" "-batch" 
"--eval" c)
-                             :sentinel 'dirvish-dir-data-proc-s)))
+                             :sentinel #'dirvish-dir-data-proc-s)))
     (process-put proc 'meta (cons buffer setup))))
 
 (defun dirvish--window-split-order ()
@@ -1223,7 +1219,7 @@ Run `dirvish-setup-hook' afterwards when SETUP is 
non-nil."
 (define-derived-mode dirvish-directory-view-mode
   fundamental-mode "Dirvish-directory-view"
   "Major mode for dirvish parent buffers."
-  :group 'dirvish :interactive nil)
+  :interactive nil)
 
 ;;;; Commands
 
@@ -1246,7 +1242,7 @@ the selected window are buried."
 ;;;###autoload
 (define-minor-mode dirvish-override-dired-mode
   "Let Dirvish take over Dired globally."
-  :group 'dirvish :global t
+  :global t
   (let ((ads '((dired-find-file dirvish-find-entry-a :override)
                (dired-noselect dirvish-dired-noselect-a :around)
                (dired-insert-subdir dirvish-insert-subdir-a :after)
diff --git a/extensions/dirvish-emerge.el b/extensions/dirvish-emerge.el
index b7c58d4d22..3400013eda 100644
--- a/extensions/dirvish-emerge.el
+++ b/extensions/dirvish-emerge.el
@@ -108,7 +108,7 @@ turned on in the buffer."
 
 (cl-defmethod transient-infix-set ((obj dirvish-emerge-group) _value)
   "Set value for OBJ."
-  (if-let ((sel (oref obj selected)))
+  (if-let* ((sel (oref obj selected)))
       (dirvish-emerge-read-recipe (oref obj recipe) obj)
     (oset obj selected t)))
 
@@ -212,12 +212,12 @@ The predicate is consumed by `dirvish-emerge-groups'."
   (pcase-let ((`(,type . ,val) recipe))
     (pcase type
       ('regex
-       `(lambda (local-name _ _ _) (string-match ,val local-name)))
+       (lambda (local-name _ _ _) (string-match val local-name)))
       ('extensions
        (let ((exts (format "\\.\\(%s\\)$" (mapconcat #'concat val "\\|"))))
-         `(lambda (local-name _ _ _) (string-match ,exts local-name))))
+         (lambda (local-name _ _ _) (string-match exts local-name))))
       ('predicate
-       (cadr (assq (cdr recipe) dirvish-emerge--available-preds))))))
+       (cadr (assq val dirvish-emerge--available-preds))))))
 
 (defun dirvish-emerge--update-groups (groups)
   "Update dir-local groups to GROUPS."
@@ -234,12 +234,14 @@ The predicate is consumed by `dirvish-emerge-groups'."
   "Create an transient infix IFX of emerge group.
 DESCRIPTION, RECIPE, SELECTED and HIDE are inserted into the
 corresponding slots."
+  ;; FIXME: We shouldn't need to use `eval' to do this!
   (eval `(transient-define-infix ,ifx ()
            :class 'dirvish-emerge-group
            :recipe ',recipe
            :selected ,selected
            :hide ,hide
-           :description ,description)))
+           :description ,description)
+        t))
 
 (defun dirvish-emerge--create-infixes ()
   "Define and collect emerge groups from `dirvish-emerge-groups'."
@@ -370,7 +372,7 @@ When RE-READ, read groups from .dir-locals.el regardless of 
cache."
 
 (defvar dirvish-emerge-group-heading-map
   (let ((map (make-sparse-keymap)))
-    (define-key map (kbd "TAB") 'dirvish-emerge-toggle-current-group)
+    (define-key map (kbd "TAB") #'dirvish-emerge-toggle-current-group)
     map)
   "Keymap used when over a group heading.")
 
@@ -435,8 +437,8 @@ PREDS are locally composed predicates."
         (max-idx (length preds))
         (dir (file-local-name (dired-current-directory))))
     (while (< (point) end)
-      (when-let ((f-beg (dired-move-to-filename))
-                 (f-end (dired-move-to-end-of-filename)))
+      (when-let* ((f-beg (dired-move-to-filename))
+                  (f-end (dired-move-to-end-of-filename)))
         (let* ((l-beg (line-beginning-position))
                (l-end (1+ (line-end-position)))
                (local (buffer-substring-no-properties f-beg f-end))
@@ -458,7 +460,7 @@ PREDS are locally composed predicates."
                  (< (hash-table-count dirvish--attrs-hash)
                     dirvish-emerge-max-file-count)))
     (dirvish-emerge--readin-groups)
-    (when-let ((preds (dirvish-prop :emerge-preds)))
+    (when-let* ((preds (dirvish-prop :emerge-preds)))
       (dirvish-emerge--apply-1 preds))))
 
 ;;;; Interactive commands
@@ -468,6 +470,7 @@ PREDS are locally composed predicates."
   "Manage pinned files in Dirvish."
   (interactive)
   (dirvish-emerge--readin-groups)
+  ;; FIXME: We shouldn't need to use `eval' to do this!
   (eval
    `(transient-define-prefix dirvish-emerge--menu ()
       "Manage pinned files in Dirvish."
@@ -502,7 +505,8 @@ Press again to set the value for the group"))
         ("r" "  Read groups from .dir-locals.el"
          (lambda () (interactive) (dirvish-emerge--ifx-read)))
         ("w" "  Write groups to .dir-locals.el"
-         (lambda () (interactive) (dirvish-emerge--ifx-write)))]]))
+         (lambda () (interactive) (dirvish-emerge--ifx-write)))]])
+   t)
   (dirvish-emerge--menu))
 
 ;;;###autoload
diff --git a/extensions/dirvish-icons.el b/extensions/dirvish-icons.el
index c228750567..fc1586e141 100644
--- a/extensions/dirvish-icons.el
+++ b/extensions/dirvish-icons.el
@@ -53,7 +53,7 @@ Values are interpreted as follows:
 - all-the-icons, meaning let `all-the-icons.el' to do the coloring.
 - A face that is used for all the icons.
 - nil, inherit face at point."
-  :group 'dirvish :type '(choice face symbol nil))
+  :group 'dirvish :type '(choice face symbol (const nil)))
 
 (defcustom dirvish-nerd-icons-offset 0.00
   "Icon's vertical offset used for `nerd-icons' backend.
@@ -72,7 +72,7 @@ Values are interpreted as follows:
 - nerd-icons, meaning let `nerd-icons.el' to do the coloring.
 - A face that is used for all the icons.
 - nil, inherit face at point."
-  :group 'dirvish :type '(choice face symbol nil))
+  :group 'dirvish :type '(choice face symbol (const nil)))
 
 (defcustom dirvish-vscode-icon-size 32
   "Icon (image pixel) size used for `vscode-icon' backend.
diff --git a/extensions/dirvish-ls.el b/extensions/dirvish-ls.el
index 1e0e2131ad..905988937e 100644
--- a/extensions/dirvish-ls.el
+++ b/extensions/dirvish-ls.el
@@ -123,6 +123,7 @@ invoke the sort function, SWITCHES is the the sort flags for
   :set
   (lambda (k v)
     (set k v)
+    ;; FIXME: We shouldn't need to use `eval' to do this!
     (eval
      `(transient-define-prefix dirvish-quicksort ()
         "Sort Dirvish buffer by different criteria."
@@ -130,9 +131,11 @@ invoke the sort function, SWITCHES is the the sort flags 
for
          (lambda () (dirvish--format-menu-heading "Sort by:"))
          ,@(cl-loop
             for (key switches desc) in v collect
+            ;; FIXME: Use a proper closure?
             (list key desc `(lambda ()
                               (interactive)
-                              (dirvish-ls--quicksort-do-sort ,switches))))]))))
+                              (dirvish-ls--quicksort-do-sort ,switches))))])
+     t)))
 
 ;;;###autoload (autoload 'dirvish-ls-switches-menu "dirvish-ls" nil t)
 (transient-define-prefix dirvish-ls-switches-menu ()
diff --git a/extensions/dirvish-peek.el b/extensions/dirvish-peek.el
index a4ea423c71..41f653ae8e 100644
--- a/extensions/dirvish-peek.el
+++ b/extensions/dirvish-peek.el
@@ -25,13 +25,13 @@
 (defcustom dirvish-peek-candidate-fetcher nil
   "Function to get current candidate in minibuffer.
 If this value is nil, a candidate fetcher function is
-automatically choosed according to your completion framework
+automatically chosen according to your completion framework
 being used at runtime."
-  :group 'dirvish :type '(choice function nil))
+  :group 'dirvish :type '(choice function (const nil)))
 
 (defcustom dirvish-peek-categories '(file project-file library)
   "Minibuffer metadata categories to show file preview."
-  :group 'dirvish :type 'list)
+  :group 'dirvish :type '(repeat symbol))
 
 (defvar dirvish-peek--cand-fetcher nil)
 (defun dirvish-peek--prepare-cand-fetcher ()
diff --git a/extensions/dirvish-quick-access.el 
b/extensions/dirvish-quick-access.el
index fff508f00a..2e69154c8d 100644
--- a/extensions/dirvish-quick-access.el
+++ b/extensions/dirvish-quick-access.el
@@ -48,6 +48,7 @@ Here is a sample value for this variable.
     (set k v)
     (when-let* ((desc-len (mapcar (lambda (i) (length (nth 2 i))) v))
                 (max-desc-len (seq-max desc-len)))
+      ;; FIXME: We shouldn't need to use `eval' to do this!
       (eval
        `(transient-define-prefix dirvish-quick-access ()
           "Jump to Dirvish quick access entries."
@@ -60,12 +61,14 @@ Here is a sample value for this variable.
                     (concat desc "  "
                             (make-string (- max-desc-len (length desc)) ?\ )
                             (propertize path 'face 'font-lock-comment-face))
+                    ;; FIXME: Use a proper closure?
                     `(lambda ()
                        (interactive)
                        (funcall dirvish-quick-access-function ,path))))]
           (interactive)
           (require 'dirvish-fd nil t)
-          (transient-setup 'dirvish-quick-access))))))
+          (transient-setup 'dirvish-quick-access))
+       t))))
 
 (provide 'dirvish-quick-access)
 ;;; dirvish-quick-access.el ends here
diff --git a/extensions/dirvish-side.el b/extensions/dirvish-side.el
index 4dd6ca1ecf..2170d38974 100644
--- a/extensions/dirvish-side.el
+++ b/extensions/dirvish-side.el
@@ -172,7 +172,7 @@ If called with \\[universal-arguments], prompt for PATH,
 otherwise it defaults to `project-current'."
   (interactive (list (and current-prefix-arg
                           (read-directory-name "Open sidetree: "))))
-  (let ((fullframep (when-let ((dv (dirvish-curr))) (car (dv-layout dv))))
+  (let ((fullframep (when-let* ((dv (dirvish-curr))) (car (dv-layout dv))))
         (visible (dirvish-side--session-visible-p))
         (path (or path (dirvish--get-project-root) default-directory)))
     (cond (fullframep (user-error "Can not create side session here"))
diff --git a/extensions/dirvish-subtree.el b/extensions/dirvish-subtree.el
index 55798a1ce8..3b236bb643 100644
--- a/extensions/dirvish-subtree.el
+++ b/extensions/dirvish-subtree.el
@@ -314,7 +314,7 @@ See `dirvish-subtree-file-viewer' for details"
 (defun dirvish-subtree-up ()
   "Jump to beginning of current subtree."
   (interactive)
-  (when-let ((ov (dirvish-subtree--parent)))
+  (when-let* ((ov (dirvish-subtree--parent)))
     (goto-char (overlay-start ov))
     (dired-previous-line 1)))
 
diff --git a/extensions/dirvish-vc.el b/extensions/dirvish-vc.el
index ad7b664479..fa324accf9 100644
--- a/extensions/dirvish-vc.el
+++ b/extensions/dirvish-vc.el
@@ -37,7 +37,7 @@ This value is consumed by `vc-state' attribute in Dirvish.  
FACE
 is the face used for that VC-STATE.  See `vc-state' in (in
 vc-hooks.el) for detail explanation of these states."
   :group 'dirvish
-  :type '(alist :key-type symbol :value-type '(symbol :tag "Face")))
+  :type '(alist :key-type symbol :value-type (symbol :tag "Face")))
 
 (defface dirvish-vc-needs-merge-face
   '((((background dark)) (:background "#500f29"))
diff --git a/extensions/dirvish-yank.el b/extensions/dirvish-yank.el
index e56c62a1de..d50e200ee8 100644
--- a/extensions/dirvish-yank.el
+++ b/extensions/dirvish-yank.el
@@ -65,7 +65,7 @@ The value can be a symbol or a function that returns a 
fileset."
 
 (defcustom dirvish-yank-rsync-args '("--archive" "--verbose" "--compress" 
"--info=progress2")
   "The default options for the rsync command."
-  :type 'list :group 'dirvish)
+  :type '(repeat string) :group 'dirvish)
 
 (defcustom dirvish-yank-keep-success-log t
   "If non-nil then keep logs of all completed yanks.
@@ -87,6 +87,7 @@ invoke the CMD, DOC is the documentation string."
   :set
   (lambda (k v)
     (set k v)
+    ;; FIXME: We shouldn't need to use `eval' to do this!
     (eval
      `(transient-define-prefix dirvish-yank-menu ()
         "Yank commands menu."
@@ -96,7 +97,8 @@ invoke the CMD, DOC is the documentation string."
         (interactive)
         (if (derived-mode-p 'dired-mode)
             (transient-setup 'dirvish-yank-menu)
-          (user-error "Not in a Dirvish buffer"))))))
+          (user-error "Not in a Dirvish buffer")))
+     t)))
 
 (defconst dirvish-yank-fn-string
   '((dired-copy-file . "Copying")
@@ -522,16 +524,15 @@ unexpected errors."
 
 (defun dirvish-yank--rsync-transient-init-value (obj)
   "Select init values from the local session or emacs session or saved 
transient values."
-  (if-let ((session-switches (dirvish-prop :rsync-switches)))
-      session-switches
-    ;; dont touch if it is alreday set
-    (if (slot-boundp obj 'value)
-        (oref obj value)
-      ;; check saved values
-      (if-let ((saved (assq (oref obj command) transient-values)))
-          (cdr saved)
-        ;; use flags set via defcustom at last resort
-        dirvish-yank-rsync-args))))
+  (or (dirvish-prop :rsync-switches)
+      ;; dont touch if it is alreday set
+      (if (slot-boundp obj 'value)
+          (oref obj value)
+        ;; check saved values
+        (if-let* ((saved (assq (oref obj command) transient-values)))
+            (cdr saved)
+          ;; use flags set via defcustom at last resort
+          dirvish-yank-rsync-args))))
 
 ;; inspired by `dired-rsync-transient'
 ;;;###autoload (autoload 'dirvish-rsync-transient "dirvish-yank" nil t)
@@ -585,7 +586,7 @@ unexpected errors."
 
 (defun dirvish-yank--rsync-transient-read-multiple (prompt &optional 
_initial-input history)
   "Read multiple values after PROMPT with optional INITIAL_INPUT and HISTORY."
-  (let ((crm-separator ","))
+  (dlet ((crm-separator ","))
     (completing-read-multiple prompt nil nil nil nil history)))
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]