Minor refactors across the board
- when-let* -> when-let - Fix projectile-locate-dominating-file for connected remote files
This commit is contained in:
parent
4ecf6c9414
commit
9a02bd8ac8
42 changed files with 114 additions and 110 deletions
|
@ -255,7 +255,7 @@ This and `+doom-dashboard|record-project' provides `persp-mode' integration with
|
|||
the Doom dashboard. It ensures that the dashboard is always in the correct
|
||||
project (which may be different across perspective)."
|
||||
(when (bound-and-true-p persp-mode)
|
||||
(when-let* ((pwd (persp-parameter 'last-project-root)))
|
||||
(when-let (pwd (persp-parameter 'last-project-root))
|
||||
(+doom-dashboard-update-pwd pwd))))
|
||||
|
||||
(defun +doom-dashboard|record-project (&optional persp &rest _)
|
||||
|
@ -420,7 +420,7 @@ controlled by `+doom-dashboard-pwd-policy'."
|
|||
(propertize (symbol-name action) 'face 'font-lock-constant-face)))
|
||||
(format "%-37s" (buffer-string)))
|
||||
;; Lookup command keys dynamically
|
||||
(or (when-let* ((key (where-is-internal action nil t)))
|
||||
(or (when-let (key (where-is-internal action nil t))
|
||||
(with-temp-buffer
|
||||
(save-excursion (insert (key-description key)))
|
||||
(while (re-search-forward "<\\([^>]+\\)>" nil t)
|
||||
|
|
|
@ -45,12 +45,12 @@
|
|||
:defer t
|
||||
:init
|
||||
(defun +doom|solaire-mode-swap-bg-maybe ()
|
||||
(when-let* ((rule (assq doom-theme +doom-solaire-themes)))
|
||||
(when-let (rule (assq doom-theme +doom-solaire-themes))
|
||||
(require 'solaire-mode)
|
||||
(when (cdr rule)
|
||||
(solaire-mode-swap-bg)
|
||||
(with-eval-after-load 'ansi-color
|
||||
(when-let* ((color (face-background 'default)))
|
||||
(when-let (color (face-background 'default))
|
||||
(setf (aref ansi-color-names-vector 0) color))))))
|
||||
(add-hook 'doom-load-theme-hook #'+doom|solaire-mode-swap-bg-maybe t)
|
||||
:config
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
(defun +neotree/collapse-or-up ()
|
||||
"Collapse an expanded directory node or go to the parent node."
|
||||
(interactive)
|
||||
(when-let* ((node (neo-buffer--get-filename-current-line)))
|
||||
(when-let (node (neo-buffer--get-filename-current-line))
|
||||
(if (file-directory-p node)
|
||||
(if (neo-buffer--expanded-node-p node)
|
||||
(+neotree/collapse)
|
||||
|
@ -49,7 +49,7 @@
|
|||
(defun +neotree/collapse ()
|
||||
"Collapse a neotree node."
|
||||
(interactive)
|
||||
(when-let* ((node (neo-buffer--get-filename-current-line)))
|
||||
(when-let (node (neo-buffer--get-filename-current-line))
|
||||
(when (file-directory-p node)
|
||||
(neo-buffer--set-expand node nil)
|
||||
(neo-buffer--refresh t))
|
||||
|
@ -60,7 +60,7 @@
|
|||
(defun +neotree/expand-or-open ()
|
||||
"Expand or open a neotree node."
|
||||
(interactive)
|
||||
(when-let* ((node (neo-buffer--get-filename-current-line)))
|
||||
(when-let (node (neo-buffer--get-filename-current-line))
|
||||
(cond ((file-directory-p node)
|
||||
(neo-buffer--set-expand node t)
|
||||
(neo-buffer--refresh t)
|
||||
|
|
|
@ -160,8 +160,8 @@ the command buffer."
|
|||
origin)
|
||||
(save-popups!
|
||||
(find-file path)
|
||||
(-when-let (pos (get-text-property button 'position
|
||||
(marker-buffer button)))
|
||||
(when-let (pos (get-text-property button 'position
|
||||
(marker-buffer button)))
|
||||
(goto-char pos))
|
||||
(setq origin (selected-window))
|
||||
(recenter))
|
||||
|
@ -179,7 +179,7 @@ the command buffer."
|
|||
(cl-letf* ((old-org-completing-read (symbol-function 'org-completing-read))
|
||||
((symbol-function 'org-completing-read)
|
||||
(lambda (&rest args)
|
||||
(when-let* ((win (get-buffer-window "*Org Links*")))
|
||||
(when-let (win (get-buffer-window "*Org Links*"))
|
||||
;; While helm is opened as a popup, it will mistaken the
|
||||
;; *Org Links* popup for the "originated window", and will
|
||||
;; target it for actions invoked by the user. However, since
|
||||
|
@ -216,7 +216,7 @@ the command buffer."
|
|||
|
||||
;;;###package Info
|
||||
(defun +popup*switch-to-info-window (&rest _)
|
||||
(when-let* ((win (get-buffer-window "*info*")))
|
||||
(when-let (win (get-buffer-window "*info*"))
|
||||
(when (+popup-window-p win)
|
||||
(select-window win))))
|
||||
(advice-add #'info-lookup-symbol :after #'+popup*switch-to-info-window)
|
||||
|
|
|
@ -25,7 +25,7 @@ the buffer is visible, then set another timer and try again later."
|
|||
((with-demoted-errors "Error killing transient buffer: %s"
|
||||
(with-current-buffer buffer
|
||||
(let (confirm-kill-processes)
|
||||
(when-let* ((process (get-buffer-process buffer)))
|
||||
(when-let (process (get-buffer-process buffer))
|
||||
(kill-process process))
|
||||
(let (kill-buffer-hook kill-buffer-query-functions)
|
||||
(kill-buffer buffer))))))))))
|
||||
|
@ -50,7 +50,7 @@ the buffer is visible, then set another timer and try again later."
|
|||
(funcall autosave buffer))))
|
||||
(with-current-buffer buffer (save-buffer)))
|
||||
(let ((ignore-window-parameters t))
|
||||
(if-let* ((wconf (window-parameter window 'saved-wconf)))
|
||||
(if-let (wconf (window-parameter window 'saved-wconf))
|
||||
(set-window-configuration wconf)
|
||||
(delete-window window)))
|
||||
(unless (window-live-p window)
|
||||
|
@ -75,7 +75,7 @@ the buffer is visible, then set another timer and try again later."
|
|||
|
||||
(defun +popup--delete-other-windows (window)
|
||||
"Fixes `delete-other-windows' when used from a popup window."
|
||||
(when-let* ((window (ignore-errors (+popup/raise window))))
|
||||
(when-let (window (ignore-errors (+popup/raise window)))
|
||||
(let ((ignore-window-parameters t))
|
||||
(delete-other-windows window)))
|
||||
nil)
|
||||
|
@ -179,9 +179,9 @@ and enables `+popup-buffer-mode'."
|
|||
(unless +popup--inhibit-select
|
||||
(select-window window))
|
||||
window))
|
||||
(when-let* ((popup (cl-loop for func in actions
|
||||
if (funcall func buffer alist)
|
||||
return it)))
|
||||
(when-let (popup (cl-loop for func in actions
|
||||
if (funcall func buffer alist)
|
||||
return it))
|
||||
(+popup--init popup alist)
|
||||
(unless +popup--inhibit-select
|
||||
(let ((select (+popup-parameter 'select popup)))
|
||||
|
@ -302,7 +302,7 @@ Any non-nil value besides the above will be used as the raw value for
|
|||
;;;###autoload
|
||||
(defun +popup|kill-buffer-hook ()
|
||||
"TODO"
|
||||
(when-let* ((window (get-buffer-window)))
|
||||
(when-let (window (get-buffer-window))
|
||||
(when (+popup-window-p window)
|
||||
(let ((+popup--inhibit-transient t))
|
||||
(+popup--delete-window window)))))
|
||||
|
@ -504,7 +504,7 @@ Accepts the same arguments as `display-buffer-in-side-window'. You must set
|
|||
((not windows)
|
||||
(cl-letf (((symbol-function 'window--make-major-side-window-next-to)
|
||||
(lambda (_side) (frame-root-window (selected-frame)))))
|
||||
(when-let* ((window (window--make-major-side-window buffer side slot alist)))
|
||||
(when-let (window (window--make-major-side-window buffer side slot alist))
|
||||
(set-window-parameter window 'window-vslot vslot)
|
||||
(add-to-list 'window-persistent-parameters '(window-vslot . writable))
|
||||
window)))
|
||||
|
|
|
@ -98,7 +98,7 @@ Pretty symbols can be unset for emacs-lisp-mode with:
|
|||
(:merge (setq merge (pop plist)))
|
||||
(:alist (setq results (append (pop plist) results)))
|
||||
(_
|
||||
(when-let* ((char (plist-get +pretty-code-symbols key)))
|
||||
(when-let (char (plist-get +pretty-code-symbols key))
|
||||
(push (cons (pop plist) char) results)))))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(unless merge
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
"Return a workspace named NAME. Unless NOERROR is non-nil, this throws an
|
||||
error if NAME doesn't exist."
|
||||
(cl-check-type name string)
|
||||
(when-let* ((persp (persp-get-by-name name)))
|
||||
(when-let (persp (persp-get-by-name name))
|
||||
(cond ((+workspace-p persp) persp)
|
||||
((not noerror)
|
||||
(error "No workspace called '%s' was found" name)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue