mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -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:
@ -69,10 +69,10 @@
|
||||
(delq nil (mapcar #'doom-gc--repo repos))))))
|
||||
|
||||
(defun doom-gc--eln ()
|
||||
(if-let (dirs
|
||||
(cl-delete (expand-file-name comp-native-version-dir doom-packages--eln-output-path)
|
||||
(directory-files doom-packages--eln-output-path t "^[^.]" t)
|
||||
:test #'file-equal-p))
|
||||
(if-let* ((dirs
|
||||
(cl-delete (expand-file-name comp-native-version-dir doom-packages--eln-output-path)
|
||||
(directory-files doom-packages--eln-output-path t "^[^.]" t)
|
||||
:test #'file-equal-p)))
|
||||
(progn
|
||||
(print! (start "Purging old native bytecode..."))
|
||||
(print-group!
|
||||
|
@ -272,7 +272,7 @@ execution. Can be generated from a `doom-cli-context' with
|
||||
(defun doom-cli-key (cli)
|
||||
"Return CLI's (type . command), used as a table key or unique identifier."
|
||||
(let ((command (doom-cli-command cli)))
|
||||
(if-let (type (doom-cli-type cli))
|
||||
(if-let* ((type (doom-cli-type cli)))
|
||||
(cons type command)
|
||||
command)))
|
||||
|
||||
@ -648,11 +648,11 @@ Throws `doom-cli-invalid-option-error' for illegal values."
|
||||
"A CLI context, containing all state pertinent to the current session."
|
||||
(init-time before-init-time) ; When this context was created
|
||||
;; A session-specific ID of the current context (defaults to number
|
||||
(pid (if-let (pid (getenv "__DOOMPID"))
|
||||
(pid (if-let* ((pid (getenv "__DOOMPID")))
|
||||
(string-to-number pid)
|
||||
(emacs-pid)))
|
||||
;; Number of Emacs processes this context has been processed through
|
||||
(step (if-let (step (getenv "__DOOMSTEP"))
|
||||
(step (if-let* ((step (getenv "__DOOMSTEP")))
|
||||
(string-to-number step)
|
||||
-1))
|
||||
;; The geometry of the terminal window.
|
||||
@ -877,10 +877,10 @@ state tied to switches (\"--foo\" or \"-x\") or arbitrary symbols (state).
|
||||
If KEY is a string, fetch KEY from context's OPTIONS (by switch).
|
||||
If KEY is a symbol, fetch KEY from context's STATE.
|
||||
Return NULL-VALUE if KEY does not exist."
|
||||
(if-let (value
|
||||
(if (stringp key)
|
||||
(assoc key (doom-cli-context-options context))
|
||||
(assq key (doom-cli-context-state context))))
|
||||
(if-let* ((value
|
||||
(if (stringp key)
|
||||
(assoc key (doom-cli-context-options context))
|
||||
(assq key (doom-cli-context-state context)))))
|
||||
(cdr value)
|
||||
null-value))
|
||||
|
||||
@ -1254,7 +1254,7 @@ Emacs' batch library lacks an implementation of the exec system call."
|
||||
|
||||
;; Run a custom action, defined in `doom-cli-exit-commands'.
|
||||
((pred (keywordp))
|
||||
(if-let (fn (alist-get command doom-cli-exit-commands))
|
||||
(if-let* ((fn (alist-get command doom-cli-exit-commands)))
|
||||
(funcall fn args context)
|
||||
(error "Invalid exit command: %s" command)))
|
||||
|
||||
@ -1290,7 +1290,7 @@ Arguments don't have to be switches either."
|
||||
(when omit
|
||||
(while argv
|
||||
(let ((arg (pop argv)))
|
||||
(if-let (n (cdr (assoc arg omit)))
|
||||
(if-let* ((n (cdr (assoc arg omit))))
|
||||
(if (= n -1)
|
||||
(setq argv nil)
|
||||
(dotimes (i n) (pop argv)))
|
||||
@ -1905,7 +1905,7 @@ errors to `doom-cli-error-file')."
|
||||
(setq doom-print-backend nil))
|
||||
(when (doom-cli-context-pipe-p context :in)
|
||||
(with-current-buffer (doom-cli-context-stdin context)
|
||||
(while (if-let (in (ignore-errors (read-from-minibuffer "")))
|
||||
(while (if-let* ((in (ignore-errors (read-from-minibuffer ""))))
|
||||
(insert in "\n")
|
||||
(ignore-errors (delete-char -1))))))
|
||||
(doom-cli--exit
|
||||
@ -1960,9 +1960,9 @@ errors to `doom-cli-error-file')."
|
||||
(doom-cli-invalid-prefix-error
|
||||
(let ((prefix (cadr e)))
|
||||
(print! (red "Error: `run!' called with invalid prefix %S") prefix)
|
||||
(if-let (suggested (cl-loop for cli being the hash-value of doom-cli--table
|
||||
unless (doom-cli-type cli)
|
||||
return (car (doom-cli-command cli))))
|
||||
(if-let* ((suggested (cl-loop for cli being the hash-value of doom-cli--table
|
||||
unless (doom-cli-type cli)
|
||||
return (car (doom-cli-command cli)))))
|
||||
(print! "Did you mean %S?" suggested)
|
||||
(print! "There are no commands defined under %S." prefix)))
|
||||
4)
|
||||
|
@ -43,9 +43,9 @@ TYPE should be a keyword of any of the known doom-*-error errors (e.g. :font,
|
||||
|
||||
(defvar doom-log-level
|
||||
(if init-file-debug
|
||||
(if-let ((level (getenv-internal "DEBUG"))
|
||||
(level (string-to-number level))
|
||||
((not (zerop level))))
|
||||
(if-let* ((level (getenv-internal "DEBUG"))
|
||||
(level (string-to-number level))
|
||||
((not (zerop level))))
|
||||
level
|
||||
2)
|
||||
0)
|
||||
@ -1346,7 +1346,7 @@ NAME is a symbol (e.g. \\='python). FILE is a string that will be appended to
|
||||
the resulting path. If said path doesn't exist, this returns nil, otherwise an
|
||||
absolute path."
|
||||
(let (file-name-handler-alist)
|
||||
(if-let ((path (doom-module-expand-path key file)))
|
||||
(if-let* ((path (doom-module-expand-path key file)))
|
||||
(if (or (null file)
|
||||
(file-exists-p path))
|
||||
path)
|
||||
@ -1463,7 +1463,7 @@ For more about modules and flags, see `doom!'."
|
||||
',(doom-module-context-flags doom-module-context)
|
||||
(backquote ,flags))
|
||||
`(let ((file (file!)))
|
||||
(if-let ((module (doom-module-from-path file)))
|
||||
(if-let* ((module (doom-module-from-path file)))
|
||||
(doom-module--has-flag-p
|
||||
(doom-module (car module) (cdr module) :flags)
|
||||
(backquote ,flags))
|
||||
@ -1670,9 +1670,9 @@ If DEFAULT? is non-nil, an unspecified CAR/CDR will fall bakc to (_default .
|
||||
"Return PROFILE-NAME's PROFILE, otherwise its PROPERTY, otherwise NULL-VALUE."
|
||||
(when (stringp profile-name)
|
||||
(setq profile-name (intern profile-name)))
|
||||
(if-let (profile (assq profile-name (doom-profiles)))
|
||||
(if-let* ((profile (assq profile-name (doom-profiles))))
|
||||
(if property
|
||||
(if-let (propval (assq property (cdr profile)))
|
||||
(if-let* ((propval (assq property (cdr profile))))
|
||||
(cdr propval)
|
||||
null-value)
|
||||
profile)
|
||||
|
12
lisp/doom.el
12
lisp/doom.el
@ -191,9 +191,9 @@
|
||||
;;; Fix $HOME on Windows
|
||||
;; $HOME isn't normally defined on Windows, but many unix tools expect it.
|
||||
(when doom--system-windows-p
|
||||
(when-let (realhome
|
||||
(and (null (getenv-internal "HOME"))
|
||||
(getenv "USERPROFILE")))
|
||||
(when-let* ((realhome
|
||||
(and (null (getenv-internal "HOME"))
|
||||
(getenv "USERPROFILE"))))
|
||||
(setenv "HOME" realhome)
|
||||
(setq abbreviated-home-dir nil)))
|
||||
|
||||
@ -221,7 +221,7 @@
|
||||
"The time it took, in seconds (as a float), for Doom Emacs to start up.")
|
||||
|
||||
(defconst doom-profile
|
||||
(if-let (profile (getenv-internal "DOOMPROFILE"))
|
||||
(if-let* ((profile (getenv-internal "DOOMPROFILE")))
|
||||
(save-match-data
|
||||
(if (string-match "^\\([^@]+\\)@\\(.+\\)$" profile)
|
||||
(cons (match-string 1 profile)
|
||||
@ -244,7 +244,7 @@
|
||||
|
||||
(defvar doom-user-dir
|
||||
(expand-file-name
|
||||
(if-let (doomdir (getenv-internal "DOOMDIR"))
|
||||
(if-let* ((doomdir (getenv-internal "DOOMDIR")))
|
||||
(file-name-as-directory doomdir)
|
||||
(or (let ((xdgdir
|
||||
(file-name-concat
|
||||
@ -280,7 +280,7 @@ slash.")
|
||||
|
||||
;; DEPRECATED: .local will be removed entirely in 3.0
|
||||
(defvar doom-local-dir
|
||||
(if-let (localdir (getenv-internal "DOOMLOCALDIR"))
|
||||
(if-let* ((localdir (getenv-internal "DOOMLOCALDIR")))
|
||||
(expand-file-name (file-name-as-directory localdir))
|
||||
(expand-file-name ".local/" doom-emacs-dir))
|
||||
"Root directory for local storage.
|
||||
|
@ -380,7 +380,7 @@ current project."
|
||||
(defun doom/kill-project-buffers (project &optional interactive)
|
||||
"Kill buffers for the specified PROJECT."
|
||||
(interactive
|
||||
(list (if-let (open-projects (doom-open-projects))
|
||||
(list (if-let* ((open-projects (doom-open-projects)))
|
||||
(completing-read
|
||||
"Kill buffers for project: " open-projects
|
||||
nil t nil nil
|
||||
|
@ -491,7 +491,7 @@ If FORCE-P, overwrite the destination file if it exists, without confirmation."
|
||||
(let ((host (or (file-remote-p file 'host) "localhost")))
|
||||
(concat "/" (when (file-remote-p file)
|
||||
(concat (file-remote-p file 'method) ":"
|
||||
(if-let (user (file-remote-p file 'user))
|
||||
(if-let* ((user (file-remote-p file 'user)))
|
||||
(concat user "@" host)
|
||||
host)
|
||||
"|"))
|
||||
@ -561,7 +561,7 @@ which case it will save it without prompting."
|
||||
"Save this file as root."
|
||||
(interactive)
|
||||
(let ((file (doom--sudo-file-path (buffer-file-name (buffer-base-buffer)))))
|
||||
(if-let (buffer (find-file-noselect file))
|
||||
(if-let* ((buffer (find-file-noselect file)))
|
||||
(let ((origin (current-buffer)))
|
||||
(copy-to-buffer buffer (point-min) (point-max))
|
||||
(unwind-protect
|
||||
|
@ -157,7 +157,7 @@ selection of all minor-modes, active or not."
|
||||
(append (apply #'doom--org-headings files plist)
|
||||
extra-candidates))
|
||||
ivy-sort-functions-alist)
|
||||
(if-let (result (completing-read prompt alist nil nil initial-input))
|
||||
(if-let* ((result (completing-read prompt alist nil nil initial-input)))
|
||||
(cl-destructuring-bind (file &optional location)
|
||||
(cdr (assoc result alist))
|
||||
(if action
|
||||
@ -557,7 +557,7 @@ If prefix arg is present, refresh the cache."
|
||||
(`straight
|
||||
(insert "Straight\n")
|
||||
(package--print-help-section "Pinned")
|
||||
(insert (if-let (pin (plist-get (cdr (assq package doom-packages)) :pin))
|
||||
(insert (if-let* ((pin (plist-get (cdr (assq package doom-packages)) :pin)))
|
||||
pin
|
||||
"unpinned")
|
||||
"\n")
|
||||
@ -642,7 +642,7 @@ If prefix arg is present, refresh the cache."
|
||||
(insert ")\n"))))
|
||||
|
||||
(package--print-help-section "Configs")
|
||||
(if-let ((configs (doom--help-package-configs package)))
|
||||
(if-let* ((configs (doom--help-package-configs package)))
|
||||
(progn
|
||||
(insert "This package is configured in the following locations:")
|
||||
(dolist (location configs)
|
||||
|
@ -246,7 +246,7 @@ processed."
|
||||
(memq (plist-get recipe :host) '(github gitlab bitbucket)))
|
||||
(plist-put recipe :type 'git)
|
||||
recipe))
|
||||
(repo (if-let (local-repo (plist-get recipe :local-repo))
|
||||
(repo (if-let* ((local-repo (plist-get recipe :local-repo)))
|
||||
(directory-file-name local-repo)
|
||||
(ignore-errors (straight-vc-local-repo-name recipe)))))
|
||||
repo
|
||||
@ -452,7 +452,7 @@ also be a list of module keys."
|
||||
("gnu"
|
||||
(format "https://elpa.gnu.org/packages/%s.html" package))
|
||||
(archive
|
||||
(if-let (src (cdr (assoc package package-archives)))
|
||||
(if-let* ((src (cdr (assoc package package-archives))))
|
||||
(format "%s" src)
|
||||
(user-error "%s isn't installed through any known source (%s)"
|
||||
package archive)))))
|
||||
@ -475,7 +475,7 @@ also be a list of module keys."
|
||||
(require 'straight)
|
||||
(doom-plist-merge
|
||||
(plist-get plist :recipe)
|
||||
(if-let (recipe (straight-recipes-retrieve package))
|
||||
(if-let* ((recipe (straight-recipes-retrieve package)))
|
||||
(cdr (if (memq (car recipe) '(quote \`))
|
||||
(eval recipe t)
|
||||
recipe))
|
||||
@ -623,7 +623,7 @@ each package."
|
||||
(ignore-errors (intern (cadr module)))
|
||||
current-prefix-arg)))
|
||||
(mapc (lambda! (key)
|
||||
(if-let (packages-file (doom-module-locate-path key doom-module-packages-file))
|
||||
(if-let* ((packages-file (doom-module-locate-path key doom-module-packages-file)))
|
||||
(with-current-buffer
|
||||
(or (get-file-buffer packages-file)
|
||||
(find-file-noselect packages-file))
|
||||
@ -959,75 +959,77 @@ Must be run from a magit diff buffer."
|
||||
(pinned (doom-package-pinned-alist)))
|
||||
(add-hook 'native-comp-async-cu-done-functions #'doom-packages--native-compile-done-h)
|
||||
(straight--make-build-cache-available)
|
||||
(if-let (built
|
||||
(doom-packages--with-recipes recipes (package local-repo recipe)
|
||||
(let ((repo-dir (straight--repos-dir (or local-repo package)))
|
||||
(build-dir (straight--build-dir package)))
|
||||
(unless force-p
|
||||
;; Ensure packages with outdated files/bytecode are rebuilt
|
||||
(let* ((build (if (plist-member recipe :build)
|
||||
(plist-get recipe :build)
|
||||
t))
|
||||
(want-byte-compile
|
||||
(or (eq build t)
|
||||
(memq 'compile build)))
|
||||
(want-native-compile
|
||||
(or (eq build t)
|
||||
(memq 'native-compile build))))
|
||||
(and (eq (car-safe build) :not)
|
||||
(setq want-byte-compile (not want-byte-compile)
|
||||
want-native-compile (not want-native-compile)))
|
||||
(when (or (not (featurep 'native-compile))
|
||||
(not straight--native-comp-available))
|
||||
(setq want-native-compile nil))
|
||||
(and (or want-byte-compile want-native-compile)
|
||||
(or (file-newer-than-file-p repo-dir build-dir)
|
||||
(file-exists-p (straight--modified-dir package))
|
||||
(cl-loop with outdated = nil
|
||||
for file in (doom-files-in build-dir :match "\\.el$" :full t)
|
||||
if (or (if want-byte-compile (doom-packages--elc-file-outdated-p file))
|
||||
(if want-native-compile (doom-packages--eln-file-outdated-p file)))
|
||||
do (setq outdated t)
|
||||
(when want-native-compile
|
||||
(push file doom-packages--eln-output-expected))
|
||||
finally return outdated))
|
||||
(puthash package t straight--packages-to-rebuild))))
|
||||
(unless (file-directory-p repo-dir)
|
||||
(doom-packages--cli-recipes-update))
|
||||
(condition-case-unless-debug e
|
||||
(let ((straight-vc-git-post-clone-hook
|
||||
(cons (lambda! (&key commit)
|
||||
(print-group!
|
||||
(if-let (pin (cdr (assoc package pinned)))
|
||||
(print! (item "Pinned to %s") pin)
|
||||
(when commit
|
||||
(print! (item "Checked out %s") commit)))))
|
||||
straight-vc-git-post-clone-hook)))
|
||||
(straight-use-package (intern package))
|
||||
(when (file-in-directory-p repo-dir straight-base-dir)
|
||||
;; HACK: Straight can sometimes fail to clone a repo,
|
||||
;; leaving behind an empty directory which, in
|
||||
;; future invocations, it will assume indicates a
|
||||
;; successful clone (causing load errors later).
|
||||
(let ((try 0))
|
||||
(while (not (file-directory-p (doom-path repo-dir ".git")))
|
||||
(when (= try 3)
|
||||
(error "Failed to clone package"))
|
||||
(print! (warn "Failed to clone %S, trying again (attempt #%d)...") package (1+ try))
|
||||
(delete-directory repo-dir t)
|
||||
(delete-directory build-dir t)
|
||||
(straight-use-package (intern package))
|
||||
(cl-incf try)))
|
||||
;; HACK: Line encoding issues can plague repos with
|
||||
;; dirty worktree prompts when updating packages or
|
||||
;; "Local variables entry is missing the suffix"
|
||||
;; errors when installing them (see #2637), so have
|
||||
;; git handle conversion by force.
|
||||
(when doom--system-windows-p
|
||||
(let ((default-directory repo-dir))
|
||||
(straight--process-run "git" "config" "core.autocrlf" "true")))))
|
||||
(error
|
||||
(signal 'doom-package-error (list package e)))))))
|
||||
(if-let* ((built
|
||||
(doom-packages--with-recipes recipes (package local-repo recipe)
|
||||
(let ((repo-dir (straight--repos-dir (or local-repo package)))
|
||||
(build-dir (straight--build-dir package)))
|
||||
(unless force-p
|
||||
;; Ensure packages w/ outdated files/bytecode are rebuilt
|
||||
(let* ((build (if (plist-member recipe :build)
|
||||
(plist-get recipe :build)
|
||||
t))
|
||||
(want-byte-compile
|
||||
(or (eq build t)
|
||||
(memq 'compile build)))
|
||||
(want-native-compile
|
||||
(or (eq build t)
|
||||
(memq 'native-compile build))))
|
||||
(and (eq (car-safe build) :not)
|
||||
(setq want-byte-compile (not want-byte-compile)
|
||||
want-native-compile (not want-native-compile)))
|
||||
(when (or (not (featurep 'native-compile))
|
||||
(not straight--native-comp-available))
|
||||
(setq want-native-compile nil))
|
||||
(and (or want-byte-compile want-native-compile)
|
||||
(or (file-newer-than-file-p repo-dir build-dir)
|
||||
(file-exists-p (straight--modified-dir package))
|
||||
(cl-loop with outdated = nil
|
||||
for file in (doom-files-in build-dir :match "\\.el$" :full t)
|
||||
if (or (if want-byte-compile (doom-packages--elc-file-outdated-p file))
|
||||
(if want-native-compile (doom-packages--eln-file-outdated-p file)))
|
||||
do (setq outdated t)
|
||||
(when want-native-compile
|
||||
(push file doom-packages--eln-output-expected))
|
||||
finally return outdated))
|
||||
(puthash package t straight--packages-to-rebuild))))
|
||||
(unless (file-directory-p repo-dir)
|
||||
(doom-packages--cli-recipes-update))
|
||||
(condition-case-unless-debug e
|
||||
(let ((straight-vc-git-post-clone-hook
|
||||
(cons (lambda! (&key commit)
|
||||
(print-group!
|
||||
(if-let* ((pin (cdr (assoc package pinned))))
|
||||
(print! (item "Pinned to %s") pin)
|
||||
(when commit
|
||||
(print! (item "Checked out %s") commit)))))
|
||||
straight-vc-git-post-clone-hook)))
|
||||
(straight-use-package (intern package))
|
||||
(when (file-in-directory-p repo-dir straight-base-dir)
|
||||
;; HACK: Straight can sometimes fail to clone a
|
||||
;; repo, leaving behind an empty directory which,
|
||||
;; in future invocations, it will assume
|
||||
;; indicates a successful clone (causing load
|
||||
;; errors later).
|
||||
(let ((try 0))
|
||||
(while (not (file-directory-p (doom-path repo-dir ".git")))
|
||||
(when (= try 3)
|
||||
(error "Failed to clone package"))
|
||||
(print! (warn "Failed to clone %S, trying again (attempt #%d)...") package (1+ try))
|
||||
(delete-directory repo-dir t)
|
||||
(delete-directory build-dir t)
|
||||
(straight-use-package (intern package))
|
||||
(cl-incf try)))
|
||||
;; HACK: Line encoding issues can plague repos with
|
||||
;; dirty worktree prompts when updating packages
|
||||
;; or "Local variables entry is missing the
|
||||
;; suffix" errors when installing them (see
|
||||
;; #2637), so have git handle conversion by
|
||||
;; force.
|
||||
(when doom--system-windows-p
|
||||
(let ((default-directory repo-dir))
|
||||
(straight--process-run "git" "config" "core.autocrlf" "true")))))
|
||||
(error
|
||||
(signal 'doom-package-error (list package e))))))))
|
||||
(progn
|
||||
(when (and (featurep 'native-compile)
|
||||
straight--native-comp-available)
|
||||
@ -1279,10 +1281,10 @@ Must be run from a magit diff buffer."
|
||||
e)))))))
|
||||
|
||||
(defun doom-packages--purge-eln ()
|
||||
(if-let (dirs
|
||||
(cl-delete (expand-file-name comp-native-version-dir doom-packages--eln-output-path)
|
||||
(directory-files doom-packages--eln-output-path t "^[^.]" t)
|
||||
:test #'file-equal-p))
|
||||
(if-let* ((dirs
|
||||
(cl-delete (expand-file-name comp-native-version-dir doom-packages--eln-output-path)
|
||||
(directory-files doom-packages--eln-output-path t "^[^.]" t)
|
||||
:test #'file-equal-p)))
|
||||
(progn
|
||||
(print! (start "Purging old native bytecode..."))
|
||||
(print-group!
|
||||
|
@ -10,7 +10,7 @@ Profile directories are in the format {data-profiles-dir}/$NAME/@/$VERSION, for
|
||||
example: '~/.local/share/doom/_/@/0/'")
|
||||
|
||||
(defvar doom-profile-load-path
|
||||
(if-let (path (getenv-internal "DOOMPROFILELOADPATH"))
|
||||
(if-let* ((path (getenv-internal "DOOMPROFILELOADPATH")))
|
||||
(mapcar #'expand-file-name (split-string-and-unquote path path-separator))
|
||||
(list (file-name-concat doom-user-dir "profiles.el")
|
||||
(file-name-concat doom-emacs-dir "profiles.el")
|
||||
@ -114,7 +114,7 @@ run.")
|
||||
`(,val)
|
||||
`(,(abbreviate-file-name path) ,val))))
|
||||
(cons `(user-emacs-directory :path ,@val)
|
||||
(if-let (profile-file (file-exists-p! doom-profile-rcfile path))
|
||||
(if-let* ((profile-file (file-exists-p! doom-profile-rcfile path)))
|
||||
(car (doom-file-read profile-file :by 'read*))
|
||||
(when (file-exists-p (doom-path path subdir "lisp/doom.el"))
|
||||
'((doom-user-dir :path ,@val)))))))
|
||||
|
@ -119,8 +119,8 @@ Returns nil if not in a project."
|
||||
"Return the name of the current project.
|
||||
|
||||
Returns '-' if not in a valid project."
|
||||
(if-let (project-root (or (doom-project-root dir)
|
||||
(if dir (expand-file-name dir))))
|
||||
(if-let* ((project-root (or (doom-project-root dir)
|
||||
(if dir (expand-file-name dir)))))
|
||||
(funcall projectile-project-name-function project-root)
|
||||
"-"))
|
||||
|
||||
|
@ -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