diff --git a/nix3-core.el b/nix3-core.el index 76d69ce..20508a9 100644 --- a/nix3-core.el +++ b/nix3-core.el @@ -160,7 +160,7 @@ This command discard the exit code or output of the command." (defun nix3-config-lookup (key) "Look up the configuration of Nix." - (if-let (h (map-elt (nix3--config-memoized) key)) + (if-let* ((h (map-elt (nix3--config-memoized) key))) (map-elt h "value") (error "Key %s is not found in the nix conf" key))) diff --git a/nix3-flake-input.el b/nix3-flake-input.el index c9f243c..971d956 100644 --- a/nix3-flake-input.el +++ b/nix3-flake-input.el @@ -129,7 +129,7 @@ (defun nix3-flake-input-at-point () "Return a cons cell of (NAME . DATA) of the input." - (when-let (section (magit-current-section)) + (when-let* ((section (magit-current-section))) (when (eq (slot-value section 'type) 'flake-input) (oref section value)))) @@ -178,7 +178,7 @@ (defun nix3-flake-input-update-to-rev (rev) (interactive "sRevision: ") (let ((alist (alist-get 'original (cdr nix3-flake-input)))) - (if-let (cell (assq 'rev alist)) + (if-let* ((cell (assq 'rev alist))) (setcdr cell rev) (setq alist (cons (cons 'rev rev) alist))) (nix3-flake-input-update alist))) @@ -186,7 +186,7 @@ (defun nix3-flake-input-update-to-ref (ref) (interactive "sRef: ") (let ((alist (alist-get 'original (cdr nix3-flake-input)))) - (if-let (cell (assq 'ref alist)) + (if-let* ((cell (assq 'ref alist))) (setcdr cell ref) (setq alist (cons (cons 'ref ref) alist))) (nix3-flake-input-update alist))) diff --git a/nix3-flake-lock.el b/nix3-flake-lock.el index 235225a..6ea1a95 100644 --- a/nix3-flake-lock.el +++ b/nix3-flake-lock.el @@ -146,7 +146,7 @@ ;;;###autoload (defun nix3-flake-lock-diff-section () - (when-let (files (nix3-flake-lock-magit-sections)) + (when-let* ((files (nix3-flake-lock-magit-sections))) (cl-flet* ((format-mtime (locked) (format-time-string "%Y-%m-%d" (alist-get 'lastModified locked))) @@ -194,7 +194,7 @@ (defun nix3-flake-lock-source-at-point () "Display the source at point." (interactive) - (when-let (section (magit-current-section)) + (when-let* ((section (magit-current-section))) (pcase (oref section value) (`(,_id ,old ,new) (cond diff --git a/nix3-flake.el b/nix3-flake.el index defe7e4..794d8f6 100644 --- a/nix3-flake.el +++ b/nix3-flake.el @@ -281,7 +281,7 @@ If DIR is non-nil, the function returns a flake at or above the directory. It implies LOCAL." (or (unless (or local dir) nix3-flake-url) - (if-let (root (locate-dominating-file (or dir default-directory) "flake.nix")) + (if-let* ((root (locate-dominating-file (or dir default-directory) "flake.nix"))) (nix3-normalize-path root) (unless allow-missing (error "No flake.nix is found"))))) @@ -324,12 +324,12 @@ directory. It implies LOCAL." (pcase \.type ("indirect" (require 'nix3-registry) - (if-let (entry (thread-last + (if-let* ((entry (thread-last (nix3-registry--collect-entries) (cl-remove-if (lambda (x) (equal (cdr (assq 'type (cddr x))) "path"))) - (assoc \.id))) + (assoc \.id)))) (to-url (cddr entry)) (error "Failed to find a registry entry for %s" \.id))) ("github" @@ -445,7 +445,7 @@ directory. It implies LOCAL." type) result)) ("unknown" - (when-let (match (seq-find (apply-partially #'prefixp path) extra-derivations)) + (when-let* ((match (seq-find (apply-partially #'prefixp path) extra-derivations))) (let ((rest (seq-drop match (length path)))) (go2 path rest)))))) (go2 (path rest) @@ -510,7 +510,7 @@ directory. It implies LOCAL." (defun nix3-flake-insert-metadata () (magit-insert-section (flake-metadata nil) - (when-let (metadata (nix3-flake--get-metadata-result)) + (when-let* ((metadata (nix3-flake--get-metadata-result))) (let-alist metadata (nix3-section-dlist 0 nil @@ -539,14 +539,14 @@ directory. It implies LOCAL." (defun nix3-flake-output-return () (interactive) - (when-let (output (nix3-flake-output-path-at-point)) + (when-let* ((output (nix3-flake-output-path-at-point))) (setq nix3-transient-flake (nix3-flake--buffer-url)) (setq nix3-transient-flake-output output) (setq nix3-transient-flake-output-type (nix3-flake-output-type)) (nix3-transient-on-output))) (defun nix3-flake-output-path-at-point () - (when-let (section (magit-current-section)) + (when-let* ((section (magit-current-section))) (when (eq (oref section type) 'flake-output) (oref section value)))) @@ -558,7 +558,7 @@ directory. It implies LOCAL." (while (setq section (magit-current-section)) (when (eq (oref section type) 'flake-output-type) (throw 'output-type (oref section value))) - (if-let (parent (oref section parent)) + (if-let* ((parent (oref section parent))) (let ((pos (point))) (magit-section-goto parent) ;; If there is no heading for the parent branch, the position @@ -618,7 +618,7 @@ directory. It implies LOCAL." (defun nix3-flake-insert-header (url) (insert (propertize "Flake: " 'face 'magit-section-heading)) - (if-let (metadata (nix3-flake-metadata--get url)) + (if-let* ((metadata (nix3-flake-metadata--get url))) (if (member (nix3-lookup-tree '(original type) metadata) '("indirect" "path" "git")) (insert (cdr (assq 'originalUrl metadata))) @@ -632,7 +632,7 @@ directory. It implies LOCAL." (let (result) (cl-labels ((go (rev-path node) - (if-let (type (cdr (assq 'type node))) + (if-let* ((type (cdr (assq 'type node)))) (push (cons type rev-path) result) (pcase-dolist (`(,name . ,child) node) (go (cons name rev-path) child))))) @@ -645,7 +645,7 @@ directory. It implies LOCAL." (seq-sort-by #'car #'string<)))) (defun nix3-flake--direct-inputs () - (if-let (result (nix3-flake--get-metadata-result)) + (if-let* ((result (nix3-flake--get-metadata-result))) (let* ((nodes (nix3-lookup-tree '(locks nodes) result)) (names (mapcar #'car (nix3-lookup-tree '(root inputs) nodes)))) (mapcar (lambda (name) @@ -656,7 +656,7 @@ directory. It implies LOCAL." (defun nix3-flake-insert-inputs () (require 'nix3-flake-input) - (when-let (result (nix3-flake--get-metadata-result)) + (when-let* ((result (nix3-flake--get-metadata-result))) (nix3-section-with-keymap nix3-flake-input-map (magit-insert-section (flake-inputs nil (nix3-flake--fold-toplevel-p)) (magit-insert-heading "Flake inputs") @@ -783,7 +783,7 @@ directory. It implies LOCAL." (read-only-mode 1)) (defun nix3-flake-show-eldoc (callback) - (when-let (help (get-char-property (point) 'help-echo)) + (when-let* ((help (get-char-property (point) 'help-echo))) (when (stringp help) (funcall callback help)))) @@ -921,7 +921,7 @@ directory. It implies LOCAL." "Go to the flake buffer." (interactive) (when (eq major-mode 'nix3-flake-show-mode) - (when-let (buffer (pop nix3-flake-show-history)) + (when-let* ((buffer (pop nix3-flake-show-history))) (switch-to-buffer buffer)))) ;;;; Bookmark integration @@ -937,9 +937,9 @@ directory. It implies LOCAL." ;;;###autoload (defun nix3-flake-show-bookmark-handler (bookmark) - (if-let (url (bookmark-prop-get bookmark 'url)) + (if-let* ((url (bookmark-prop-get bookmark 'url))) (nix3-flake-show-url url) - (if-let (dir (bookmark-prop-get bookmark 'default-directory)) + (if-let* ((dir (bookmark-prop-get bookmark 'default-directory))) (if (file-directory-p dir) (nix3-flake-show dir) (user-error "Trying to open a bookmark on a non-existent directory: %s" bookmark)) @@ -1005,11 +1005,11 @@ If NO-CONFIRM is non-nil, " (then `(lambda (_) (let (message-log-max) (message nil)) - (if-let (templates (thread-last - (nix3-flake-show--get ,url) - ;; Since Nix 2.7, the default template is templates.default, so we - ;; won't consider defaultTemplate. - (alist-get 'templates))) + (if-let* ((templates (thread-last + (nix3-flake-show--get ,url) + ;; Since Nix 2.7, the default template is templates.default, so we + ;; won't consider defaultTemplate. + (alist-get 'templates)))) (concat ,name-or-url "#" (nix3-flake--complete-template ,prompt templates)) (error "No template")))) @@ -1065,7 +1065,7 @@ If NO-CONFIRM is non-nil, " templates))) (cl-labels ((annotator (candidate) - (if-let (description (cdr (assoc candidate template-alist))) + (if-let* ((description (cdr (assoc candidate template-alist)))) (concat " " description) "")) (group (candidate transform) @@ -1098,7 +1098,7 @@ then runs `nix3-flake-init'." (interactive) (when nix3-flake-url (user-error "You must run this command inside a local flake")) - (if-let (dir (locate-dominating-file default-directory "flake.nix")) + (if-let* ((dir (locate-dominating-file default-directory "flake.nix"))) (funcall nix3-flake-edit-find-file-fn (expand-file-name "flake.nix" dir)) (let ((default-directory (or (vc-git-root default-directory) (progn @@ -1122,7 +1122,7 @@ then runs `nix3-flake-init'." (defun nix3-flake-remember-this-project () "Remember the current project." - (when-let (pr (project-current)) + (when-let* ((pr (project-current))) (project-remember-project pr))) ;;;; Manage relationships between remote repositories and local copies diff --git a/nix3-help.el b/nix3-help.el index a500dea..7dea098 100644 --- a/nix3-help.el +++ b/nix3-help.el @@ -80,7 +80,7 @@ last-end start)))) (when (string-match capture string) (push (cons (match-string 1 string) - (when-let (desc (match-string 2 string)) + (when-let* ((desc (match-string 2 string))) (replace-regexp-in-string (rx (+ space)) " " desc))) @@ -92,7 +92,7 @@ (let (alist) (cl-labels ((add-commands (subcommands &optional description) - (if-let (subalist (apply #'nix3-help-parse 'commands subcommands)) + (if-let* ((subalist (apply #'nix3-help-parse 'commands subcommands))) (dolist (x subalist) (add-commands (append subcommands (list (car x))) (cdr x))) diff --git a/nix3-registry.el b/nix3-registry.el index d41af25..fc0c0d8 100644 --- a/nix3-registry.el +++ b/nix3-registry.el @@ -175,7 +175,7 @@ registry type and the \"to\" value of the entry." (group (id transform) (if transform id - (if-let (cell (gethash id table)) + (if-let* ((cell (gethash id table))) (format "%s registry" (capitalize (symbol-name (car cell)))) ""))) @@ -187,7 +187,7 @@ registry type and the \"to\" value of the entry." (cons 'annotation-function #'annotator))) (complete-with-action action items string pred)))) (let ((input (completing-read prompt #'completions))) - (if-let (entry (gethash input table)) + (if-let* ((entry (gethash input table))) (cons input (cdr entry)) (when (and add-to-registry (nix3-registry--flake-url-p input) @@ -243,7 +243,7 @@ registry type and the \"to\" value of the entry." name flake)) (defun nix3-registry--maybe-origin-flake-url () - (when-let (git-url (cdr (assoc "origin" (nix3-git-remotes)))) + (when-let* ((git-url (cdr (assoc "origin" (nix3-git-remotes))))) (nix3-flake-ref-alist-to-url (nix3-git-url-to-flake-alist git-url)))) diff --git a/nix3-transient.el b/nix3-transient.el index a9a83b7..90d6d10 100644 --- a/nix3-transient.el +++ b/nix3-transient.el @@ -138,7 +138,7 @@ This is a function that takes a command line as an argument." (required :initarg :required :initform t))) (cl-defmethod transient-init-value ((obj nix3-transient-output-variable)) - (if-let (value (eval (oref obj variable))) + (if-let* ((value (eval (oref obj variable)))) (oset obj value value) (when (oref obj required) (let ((value (transient-infix-read obj))) @@ -442,7 +442,7 @@ will be refreshed." (format "*nix eval<%s>*" path))) (message "%s: %s" path string))) (go (path) - (if-let (names (get-attr-names path)) + (if-let* ((names (get-attr-names path))) (let ((new-path (completing-read (format "Attribute (%s): " path) ;; Build candidates that are full ;; attribute paths. This will make @@ -509,7 +509,7 @@ will be refreshed." ",")) (propertize ")" 'face 'transient-inactive-value)))) (interactive) - (if-let (licenses (nix3-transient--package-license)) + (if-let* ((licenses (nix3-transient--package-license))) (nix3-transient--browse-license-url (if (assq 'fullName licenses) licenses @@ -521,7 +521,7 @@ will be refreshed." (user-error "No license"))) (defun nix3-transient--browse-license-url (license) - (if-let (url (alist-get 'url license)) + (if-let* ((url (alist-get 'url license))) (browse-url url) (user-error "License %s has no URL" (or (alist-get 'spdxId license) @@ -534,7 +534,7 @@ will be refreshed." licenses))) (cl-labels ((annotator (candidate) - (when-let (license (cdr (assoc candidate alist))) + (when-let* ((license (cdr (assoc candidate alist)))) (format " (%s)" (mapconcat (lambda (x) (symbol-name (car x)))