mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-18 16:06:56 -05:00
refactor: (if|when)-let -> (if|when)-let*
With the former macros' future in the air (and likely to be targeted in future, potentially breaking changes), I'll deal with this now than have it bite me later. Ref: https://lists.gnu.org/archive/html/emacs-devel/2024-10/msg00637.html
This commit is contained in:
@@ -5,9 +5,9 @@
|
||||
"Name of the workspace created by `=calendar', dedicated to calfw.")
|
||||
|
||||
(defun +calendar--init ()
|
||||
(if-let (win (cl-find-if (lambda (b) (string-match-p "^\\*cfw:" (buffer-name b)))
|
||||
(doom-visible-windows)
|
||||
:key #'window-buffer))
|
||||
(if-let* ((win (cl-find-if (lambda (b) (string-match-p "^\\*cfw:" (buffer-name b)))
|
||||
(doom-visible-windows)
|
||||
:key #'window-buffer)))
|
||||
(select-window win)
|
||||
(call-interactively +calendar-open-function)))
|
||||
|
||||
|
@@ -160,10 +160,10 @@ If ARG (universal argument), open selection in other-window."
|
||||
(user-error "No completion session is active"))
|
||||
(require 'wgrep)
|
||||
(let ((caller (ivy-state-caller ivy-last)))
|
||||
(if-let (occur-fn (plist-get +ivy-edit-functions caller))
|
||||
(if-let* ((occur-fn (plist-get +ivy-edit-functions caller)))
|
||||
(ivy-exit-with-action
|
||||
(lambda (_) (funcall occur-fn)))
|
||||
(if-let (occur-fn (plist-get ivy--occurs-list caller))
|
||||
(if-let* ((occur-fn (plist-get ivy--occurs-list caller)))
|
||||
(let ((buffer (generate-new-buffer
|
||||
(format "*ivy-occur%s \"%s\"*"
|
||||
(if caller (concat " " (prin1-to-string caller)) "")
|
||||
|
@@ -81,7 +81,7 @@ buffer will be opened in the current workspace instead."
|
||||
(funcall consult--buffer-display (car buffer))
|
||||
(+workspace-switch origin-workspace)
|
||||
(message "Switched to %S workspace" origin-workspace)
|
||||
(if-let (window (get-buffer-window (car buffer)))
|
||||
(if-let* ((window (get-buffer-window (car buffer))))
|
||||
(select-window window)
|
||||
(funcall consult--buffer-display (car buffer)))))))
|
||||
|
||||
|
@@ -77,7 +77,7 @@ If prefix ARG is set, include ignored/hidden files."
|
||||
(current-prefix-arg (unless (eq arg 'other) arg))
|
||||
(default-directory
|
||||
(if (eq arg 'other)
|
||||
(if-let (projects (projectile-relevant-known-projects))
|
||||
(if-let* ((projects (projectile-relevant-known-projects)))
|
||||
(completing-read "Search project: " projects nil t)
|
||||
(user-error "There are no known projects"))
|
||||
default-directory)))
|
||||
@@ -101,7 +101,7 @@ If prefix ARG is set, prompt for a known project to search from."
|
||||
(list (or (doom-thing-at-point-or-region) "")
|
||||
(let ((projectile-project-root nil))
|
||||
(if current-prefix-arg
|
||||
(if-let (projects (projectile-relevant-known-projects))
|
||||
(if-let* ((projects (projectile-relevant-known-projects)))
|
||||
(completing-read "Search project: " projects nil t)
|
||||
(user-error "There are no known projects"))
|
||||
(doom-project-root default-directory)))))
|
||||
|
@@ -42,8 +42,8 @@
|
||||
(defun +default/yank-buffer-path (&optional root)
|
||||
"Copy the current buffer's path to the kill ring."
|
||||
(interactive)
|
||||
(if-let (filename (or (buffer-file-name (buffer-base-buffer))
|
||||
(bound-and-true-p list-buffers-directory)))
|
||||
(if-let* ((filename (or (buffer-file-name (buffer-base-buffer))
|
||||
(bound-and-true-p list-buffers-directory))))
|
||||
(let ((path (abbreviate-file-name
|
||||
(if root
|
||||
(file-relative-name filename root)
|
||||
|
@@ -50,7 +50,7 @@
|
||||
(not (re-search-forward "^ *#\\+begin_src e\\(?:macs-\\)?lisp" nil t))))
|
||||
(print! (warn "No src blocks to tangle in %s. Skipping...") (path target))
|
||||
nil)
|
||||
((if-let (files (org-babel-tangle-file target dest))
|
||||
((if-let* ((files (org-babel-tangle-file target dest)))
|
||||
(always (print! (success "Done tangling %d file(s)!" (length files))))
|
||||
(print! (error "Failed to tangle any blocks from your config."))
|
||||
nil))))))))
|
||||
|
@@ -26,7 +26,7 @@ This excludes the protocol and querystring."
|
||||
(re-search-forward "://" end t))
|
||||
(save-excursion
|
||||
(goto-char end)
|
||||
(- (if-let (pos (re-search-backward "[?#]" beg t))
|
||||
(- (if-let* ((pos (re-search-backward "[?#]" beg t)))
|
||||
pos
|
||||
end)
|
||||
(if (evil-visual-state-p)
|
||||
|
@@ -32,7 +32,7 @@
|
||||
;; Use GNU ls as `gls' from `coreutils' if available. Add `(setq
|
||||
;; dired-use-ls-dired nil)' to your config to suppress the Dired warning
|
||||
;; when not using GNU ls.
|
||||
(if-let (gls (executable-find "gls"))
|
||||
(if-let* ((gls (executable-find "gls")))
|
||||
(setq insert-directory-program gls)
|
||||
;; BSD ls doesn't support -v or --group-directories-first
|
||||
(setq args (list (car args)))))
|
||||
|
@@ -20,10 +20,10 @@
|
||||
(let ((buf (ibuffer-current-buffer t)))
|
||||
(unless (buffer-live-p buf)
|
||||
(user-error "Not a valid or live buffer: %s" buf))
|
||||
(if-let (workspaces
|
||||
(cl-loop for wk in (+workspace-list)
|
||||
if (+workspace-contains-buffer-p buf wk)
|
||||
collect wk))
|
||||
(if-let* ((workspaces
|
||||
(cl-loop for wk in (+workspace-list)
|
||||
if (+workspace-contains-buffer-p buf wk)
|
||||
collect wk)))
|
||||
(+workspace-switch
|
||||
(if (and (not select-first) (cdr workspaces))
|
||||
(or (completing-read "Select workspace: " (mapcar #'persp-name workspaces))
|
||||
|
@@ -311,7 +311,7 @@ When otherwise called, open a dired buffer and enable `dired-mu4e-attach-ctrl-c-
|
||||
(progn
|
||||
(message "No files marked, aborting.")
|
||||
(kill-buffer-and-window))
|
||||
(if-let ((mail-target-buffer (bound-and-true-p dired-mail-buffer)))
|
||||
(if-let* ((mail-target-buffer (bound-and-true-p dired-mail-buffer)))
|
||||
(progn (kill-buffer-and-window)
|
||||
(switch-to-buffer mail-target-buffer))
|
||||
(if (and (+mu4e-current-buffers)
|
||||
|
@@ -115,9 +115,9 @@ is non-nil."
|
||||
(t #'ido-completing-read))
|
||||
mu4e-attachment-dir
|
||||
(concat
|
||||
(if-let ((xdg-download-query (and (executable-find "xdg-user-dir")
|
||||
(doom-call-process "xdg-user-dir" "DOWNLOAD")))
|
||||
(xdg-download-dir (and (= 0 (car xdg-download-query)) (cdr xdg-download-query))))
|
||||
(if-let* ((xdg-download-query (and (executable-find "xdg-user-dir")
|
||||
(doom-call-process "xdg-user-dir" "DOWNLOAD")))
|
||||
(xdg-download-dir (and (= 0 (car xdg-download-query)) (cdr xdg-download-query))))
|
||||
xdg-download-dir
|
||||
(expand-file-name (or (getenv "XDG_DOWNLOAD_DIR")
|
||||
"Downloads")
|
||||
@@ -291,12 +291,12 @@ is non-nil."
|
||||
(defun +mu4e-view-select-attachment ()
|
||||
"Use completing-read to select a single attachment.
|
||||
Acts like a singular `mu4e-view-save-attachments', without the saving."
|
||||
(if-let ((parts (delq nil (mapcar
|
||||
(lambda (part)
|
||||
(when (assoc "attachment" (cdr part))
|
||||
part))
|
||||
(mu4e--view-gather-mime-parts))))
|
||||
(files (+mu4e-part-selectors parts)))
|
||||
(if-let* ((parts (delq nil (mapcar
|
||||
(lambda (part)
|
||||
(when (assoc "attachment" (cdr part))
|
||||
part))
|
||||
(mu4e--view-gather-mime-parts))))
|
||||
(files (+mu4e-part-selectors parts)))
|
||||
(cdr (assoc (completing-read "Select attachment: " (mapcar #'car files)) files))
|
||||
(user-error (mu4e-format "No attached files found"))))
|
||||
|
||||
|
@@ -44,10 +44,10 @@
|
||||
((or `mbsync
|
||||
`mbsync-xdg) ; DEPRECATED `mbsync-xdg' is now just `mbsync'
|
||||
(format "mbsync %s -a && notmuch new"
|
||||
(if-let (config-file
|
||||
(doom-glob (or (getenv "XDG_CONFIG_HOME")
|
||||
"~/.config")
|
||||
"isync/mbsyncrc"))
|
||||
(if-let* ((config-file
|
||||
(doom-glob (or (getenv "XDG_CONFIG_HOME")
|
||||
"~/.config")
|
||||
"isync/mbsyncrc")))
|
||||
(format "-c %S" (car config-file))
|
||||
"")))
|
||||
(`offlineimap
|
||||
|
@@ -20,7 +20,7 @@ at point."
|
||||
;; type is `clj' for clojure and `cljs' for clojurescript
|
||||
;; ... with no type specified, assume `clj'.
|
||||
(let ((type (or type 'clj)))
|
||||
(if-let (buffer (cider-current-repl type))
|
||||
(if-let* ((buffer (cider-current-repl type)))
|
||||
(pop-to-buffer buffer)
|
||||
(let ((process (cond ((eq type 'clj) (cider-jack-in-clj arg))
|
||||
((eq type 'cljs) (cider-jack-in-cljs arg)))))
|
||||
|
@@ -91,7 +91,7 @@ Intended to replace `lisp-outline-level'."
|
||||
;;;###autoload
|
||||
(defun +emacs-lisp-lookup-definition (_thing)
|
||||
"Lookup definition of THING."
|
||||
(if-let (module (+emacs-lisp--module-at-point))
|
||||
(if-let* ((module (+emacs-lisp--module-at-point)))
|
||||
(doom/help-modules (car module) (cadr module) 'visit-dir)
|
||||
(call-interactively #'elisp-def)))
|
||||
|
||||
|
@@ -7,8 +7,8 @@
|
||||
(interactive)
|
||||
(let ((config (json-read-file (graphql-locate-config "."))))
|
||||
(let-alist config
|
||||
(if-let ((endpoints .extensions.endpoints)
|
||||
(endpoint (cdr (assq (intern (graphql--completing-read-endpoint endpoints)) endpoints))))
|
||||
(if-let* ((endpoints .extensions.endpoints)
|
||||
(endpoint (cdr (assq (intern (graphql--completing-read-endpoint endpoints)) endpoints))))
|
||||
(let-alist endpoint
|
||||
(graphql-doc--start .url `(:url ,.url :headers ,.headers)))
|
||||
(error "No endpoint configurations in .graphqlconfig")))))
|
||||
|
@@ -5,9 +5,9 @@
|
||||
"Opens a Haskell REPL."
|
||||
(interactive "P")
|
||||
(require 'haskell-interactive-mode)
|
||||
(if-let (window
|
||||
(display-buffer
|
||||
(haskell-session-interactive-buffer (haskell-session))))
|
||||
(if-let* ((window
|
||||
(display-buffer
|
||||
(haskell-session-interactive-buffer (haskell-session)))))
|
||||
(window-buffer window)
|
||||
(error "Failed to display Haskell REPL")))
|
||||
|
||||
|
@@ -47,6 +47,6 @@ Returns nil if 'love' executable can't be found."
|
||||
(defun +lua/run-love-game ()
|
||||
"Run the current project with Love2D."
|
||||
(interactive)
|
||||
(if-let (cmd (+lua-love-build-command))
|
||||
(if-let* ((cmd (+lua-love-build-command)))
|
||||
(async-shell-command cmd)
|
||||
(user-error "Couldn't find love project")))
|
||||
|
@@ -19,7 +19,7 @@
|
||||
"TODO"
|
||||
(interactive)
|
||||
(require 'org-attach)
|
||||
(if-let (dir (org-attach-dir))
|
||||
(if-let* ((dir (org-attach-dir)))
|
||||
(pop-to-buffer
|
||||
;; Rather than opening dired *and* image-dired windows, suppress them
|
||||
;; both and open only the image-dired window.
|
||||
|
@@ -341,7 +341,7 @@ exist, and `org-link' otherwise."
|
||||
"Interpret LINK as an URL to an image file."
|
||||
(when (and (image-type-from-file-name link)
|
||||
(not (eq org-display-remote-inline-images 'skip)))
|
||||
(if-let (buf (url-retrieve-synchronously (concat protocol ":" link)))
|
||||
(if-let* ((buf (url-retrieve-synchronously (concat protocol ":" link))))
|
||||
(with-current-buffer buf
|
||||
(goto-char (point-min))
|
||||
(re-search-forward "\r?\n\r?\n" nil t)
|
||||
|
@@ -133,7 +133,7 @@ EXAMPLES:
|
||||
;; Tangling doesn't expand #+INCLUDE directives, so we do it
|
||||
;; ourselves, since includes are so useful for literate configs!
|
||||
(org-export-expand-include-keyword)
|
||||
(if-let ((results (reverse (org-babel-tangle nil nil lang))))
|
||||
(if-let* ((results (reverse (org-babel-tangle nil nil lang))))
|
||||
(dolist (file results)
|
||||
(if (not quiet?)
|
||||
(print-group!
|
||||
|
@@ -794,7 +794,7 @@ these buffers they'll see a gimped, half-broken org buffer, so to avoid that,
|
||||
install a hook to restart `org-mode' when they're switched to so they can grow
|
||||
up to be fully-fledged org-mode buffers."
|
||||
:around #'org-get-agenda-file-buffer
|
||||
(if-let (buf (org-find-base-buffer-visiting file))
|
||||
(if-let* ((buf (org-find-base-buffer-visiting file)))
|
||||
buf
|
||||
(let ((recentf-exclude '(always))
|
||||
(doom-inhibit-large-file-detection t)
|
||||
@@ -1124,7 +1124,7 @@ between the two."
|
||||
(defadvice! +org-eldoc--display-link-at-point-a (&rest _)
|
||||
"Display help for doom-*: links in minibuffer when cursor/mouse is over it."
|
||||
:before-until #'org-eldoc-documentation-function
|
||||
(if-let ((url (thing-at-point 'url t)))
|
||||
(if-let* ((url (thing-at-point 'url t)))
|
||||
(format "LINK: %s" url)
|
||||
(and (eq (get-text-property (point) 'help-echo)
|
||||
#'+org-link-doom--help-echo-from-textprop)
|
||||
|
@@ -63,8 +63,8 @@
|
||||
;; terminals. Requires the `input-decode-map' entry in
|
||||
;; lisp/doom-keybinds.el.
|
||||
(define-key! key-translation-map
|
||||
[?\C-i] (cmd! (if-let (((kkp--terminal-has-active-kkp-p))
|
||||
(keys (this-single-command-raw-keys))
|
||||
((> (length keys) 2))
|
||||
((equal (cl-subseq keys -3) [27 91 49])))
|
||||
[?\C-i] (cmd! (if-let* (((kkp--terminal-has-active-kkp-p))
|
||||
(keys (this-single-command-raw-keys))
|
||||
((> (length keys) 2))
|
||||
((equal (cl-subseq keys -3) [27 91 49])))
|
||||
[C-i] [?\C-i]))))
|
||||
|
@@ -98,7 +98,7 @@
|
||||
(with-current-buffer eshell-buffer
|
||||
(fundamental-mode)
|
||||
(erase-buffer))))
|
||||
(if-let (win (get-buffer-window eshell-buffer))
|
||||
(if-let* ((win (get-buffer-window eshell-buffer)))
|
||||
(let (confirm-kill-processes)
|
||||
(delete-window win)
|
||||
(ignore-errors (kill-buffer eshell-buffer)))
|
||||
|
@@ -68,7 +68,7 @@ If popup is focused, kill it."
|
||||
(safe-persp-name (get-current-persp))
|
||||
"main"))))
|
||||
(dir default-directory))
|
||||
(if-let (win (get-buffer-window buffer))
|
||||
(if-let* ((win (get-buffer-window buffer)))
|
||||
(let (confirm-kill-processes)
|
||||
(set-process-query-on-exit-flag (get-buffer-process buffer) nil)
|
||||
(delete-window win)
|
||||
|
@@ -27,7 +27,7 @@ Returns the vterm buffer."
|
||||
(kill-buffer buffer))
|
||||
(when (window-live-p window)
|
||||
(delete-window window))))
|
||||
(if-let (win (get-buffer-window buffer-name))
|
||||
(if-let* ((win (get-buffer-window buffer-name)))
|
||||
(delete-window win)
|
||||
(let ((buffer (or (cl-loop for buf in (doom-buffers-in-mode 'vterm-mode)
|
||||
if (equal (buffer-local-value '+vterm--id buf)
|
||||
|
@@ -58,7 +58,7 @@
|
||||
;; Realgud doesn't generate its autoloads properly so we do it ourselves
|
||||
(dolist (debugger +debugger--realgud-alist)
|
||||
(autoload (car debugger)
|
||||
(if-let (sym (plist-get (cdr debugger) :package))
|
||||
(if-let* ((sym (plist-get (cdr debugger) :package)))
|
||||
(symbol-name sym)
|
||||
"realgud")
|
||||
nil t))
|
||||
|
@@ -92,14 +92,14 @@ of the buffer instead."
|
||||
#'+eval/send-region-to-repl)
|
||||
beg end))
|
||||
((let (lang)
|
||||
(if-let ((runner
|
||||
(or (alist-get runner-major-mode +eval-runners)
|
||||
(and (require 'quickrun nil t)
|
||||
(equal (setq
|
||||
lang (quickrun--command-key
|
||||
(buffer-file-name (buffer-base-buffer))))
|
||||
"emacs")
|
||||
(alist-get 'emacs-lisp-mode +eval-runners)))))
|
||||
(if-let* ((runner
|
||||
(or (alist-get runner-major-mode +eval-runners)
|
||||
(and (require 'quickrun nil t)
|
||||
(equal (setq
|
||||
lang (quickrun--command-key
|
||||
(buffer-file-name (buffer-base-buffer))))
|
||||
"emacs")
|
||||
(alist-get 'emacs-lisp-mode +eval-runners)))))
|
||||
(funcall runner beg end)
|
||||
(let ((quickrun-option-cmdkey lang))
|
||||
(quickrun-region beg end))))))))
|
||||
@@ -126,7 +126,7 @@ of the buffer instead."
|
||||
(buffer-file-name (buffer-base-buffer))))
|
||||
"emacs")
|
||||
(alist-get 'emacs-lisp-mode +eval-runners)))
|
||||
(if-let ((buffer-handler (plist-get (cdr (alist-get major-mode +eval-repls)) :send-buffer)))
|
||||
(if-let* ((buffer-handler (plist-get (cdr (alist-get major-mode +eval-repls)) :send-buffer)))
|
||||
(funcall buffer-handler)
|
||||
(+eval/region (point-min) (point-max)))
|
||||
(quickrun))))
|
||||
|
@@ -5,7 +5,7 @@
|
||||
(defun set-lsp-priority! (client priority)
|
||||
"Change the PRIORITY of lsp CLIENT."
|
||||
(require 'lsp-mode)
|
||||
(if-let (client (gethash client lsp-clients))
|
||||
(if-let* ((client (gethash client lsp-clients)))
|
||||
(setf (lsp--client-priority client)
|
||||
priority)
|
||||
(error "No LSP client named %S" client)))
|
||||
|
@@ -53,16 +53,16 @@ window that already exists in that direction. It will split otherwise."
|
||||
(let ((direction (or (alist-get 'direction alist)
|
||||
+magit-open-windows-in-direction))
|
||||
(origin-window (selected-window)))
|
||||
(if-let (window (window-in-direction direction))
|
||||
(if-let* ((window (window-in-direction direction)))
|
||||
(unless magit-display-buffer-noselect
|
||||
(select-window window))
|
||||
(if-let (window (and (not (one-window-p))
|
||||
(window-in-direction
|
||||
(pcase direction
|
||||
(`right 'left)
|
||||
(`left 'right)
|
||||
((or `up `above) 'down)
|
||||
((or `down `below) 'up)))))
|
||||
(if-let* ((window (and (not (one-window-p))
|
||||
(window-in-direction
|
||||
(pcase direction
|
||||
(`right 'left)
|
||||
(`left 'right)
|
||||
((or `up `above) 'down)
|
||||
((or `down `below) 'up))))))
|
||||
(unless magit-display-buffer-noselect
|
||||
(select-window window))
|
||||
(let ((window (split-window nil nil direction)))
|
||||
|
@@ -43,7 +43,7 @@ Note that this will keep all ligatures in `+ligatures-prog-mode-list' active, as
|
||||
(push (cons (pop plist) char) results))))
|
||||
(dolist (mode (ensure-list modes))
|
||||
(setf (alist-get mode +ligatures-extra-alist)
|
||||
(if-let (old-results (alist-get mode +ligatures-extra-alist))
|
||||
(if-let* ((old-results (alist-get mode +ligatures-extra-alist)))
|
||||
(dolist (cell results old-results)
|
||||
(setf (alist-get (car cell) old-results) (cdr cell)))
|
||||
results))))))
|
||||
|
@@ -111,7 +111,7 @@ isn't disabled in `+ligatures-extras-in-modes'."
|
||||
(when-let*
|
||||
(((+ligatures--enable-p +ligatures-extras-in-modes))
|
||||
(symbols
|
||||
(if-let ((symbols (assq major-mode +ligatures-extra-alist)))
|
||||
(if-let* ((symbols (assq major-mode +ligatures-extra-alist)))
|
||||
(cdr symbols)
|
||||
(cl-loop for (mode . symbols) in +ligatures-extra-alist
|
||||
if (derived-mode-p mode)
|
||||
|
@@ -129,7 +129,7 @@ Using optionals attributes FACE, HELP-ECHO and VOFFSET."
|
||||
"Set the modeline to NAME.
|
||||
If DEFAULT is non-nil, apply to all future buffers. Modelines are defined with
|
||||
`def-modeline!'."
|
||||
(if-let (format (assq name +modeline-format-alist))
|
||||
(if-let* ((format (assq name +modeline-format-alist)))
|
||||
(cl-destructuring-bind (lhs . rhs) (cdr format)
|
||||
(if default
|
||||
(setq-default +modeline-format-left lhs
|
||||
|
@@ -47,7 +47,7 @@ the buffer is visible, then set another timer and try again later."
|
||||
(let ((buffer (window-buffer window))
|
||||
(inhibit-quit t))
|
||||
(and (or (buffer-file-name buffer)
|
||||
(if-let (base-buffer (buffer-base-buffer buffer))
|
||||
(if-let* ((base-buffer (buffer-base-buffer buffer)))
|
||||
(buffer-file-name base-buffer)))
|
||||
(buffer-modified-p buffer)
|
||||
(let ((autosave (+popup-parameter 'autosave window)))
|
||||
@@ -58,7 +58,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)
|
||||
@@ -351,13 +351,13 @@ Any non-nil value besides the above will be used as the raw value for
|
||||
(defun +popup/other ()
|
||||
"Cycle through popup windows, like `other-window'. Ignores regular windows."
|
||||
(interactive)
|
||||
(if-let (popups (cl-remove-if-not
|
||||
(lambda (w) (or (+popup-window-p w)
|
||||
;; This command should be able to hop between
|
||||
;; windows with a `no-other-window'
|
||||
;; parameter, since `other-window' won't.
|
||||
(window-parameter w 'no-other-window)))
|
||||
(window-list)))
|
||||
(if-let* ((popups (cl-remove-if-not
|
||||
(lambda (w) (or (+popup-window-p w)
|
||||
;; This command should be able to hop between
|
||||
;; windows with a `no-other-window'
|
||||
;; parameter, since `other-window' won't.
|
||||
(window-parameter w 'no-other-window)))
|
||||
(window-list))))
|
||||
(select-window (if (or (+popup-window-p)
|
||||
(window-parameter nil 'no-other-window))
|
||||
(let ((window (selected-window)))
|
||||
@@ -450,12 +450,12 @@ window and return that window."
|
||||
(defun +popup/diagnose ()
|
||||
"Reveal what popup rule will be used for the current buffer."
|
||||
(interactive)
|
||||
(if-let (rule (cl-loop with bname = (buffer-name)
|
||||
for (pred . action) in display-buffer-alist
|
||||
if (and (functionp pred) (funcall pred bname action))
|
||||
return (cons pred action)
|
||||
else if (and (stringp pred) (string-match-p pred bname))
|
||||
return (cons pred action)))
|
||||
(if-let* ((rule (cl-loop with bname = (buffer-name)
|
||||
for (pred . action) in display-buffer-alist
|
||||
if (and (functionp pred) (funcall pred bname action))
|
||||
return (cons pred action)
|
||||
else if (and (stringp pred) (string-match-p pred bname))
|
||||
return (cons pred action))))
|
||||
(message "Rule matches: %s" rule)
|
||||
(message "No popup rule for this buffer")))
|
||||
|
||||
|
Reference in New Issue
Block a user