Fix obsolete (when|if)-let messages in Emacs 26

This commit is contained in:
Henrik Lissner 2017-12-10 14:49:52 -05:00
parent e168118243
commit 76a4ae459d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
40 changed files with 110 additions and 103 deletions

View file

@ -53,7 +53,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/"
If no project is active, return all buffers."
(let ((buffers (doom-buffer-list)))
(if-let (project-root (if (doom-project-p) (doom-project-root)))
(if-let* ((project-root (if (doom-project-p) (doom-project-root))))
(cl-loop for buf in buffers
if (projectile-project-buffer-p buf project-root)
collect buf)
@ -148,7 +148,7 @@ real buffer is:
c) is not a special buffer (its name isn't something like *Help*)
If BUFFER-OR-NAME is omitted or nil, the current buffer is tested."
(when-let (buf (ignore-errors (window-normalize-buffer buffer-or-name)))
(when-let* ((buf (ignore-errors (window-normalize-buffer buffer-or-name))))
(or (buffer-local-value 'doom-real-buffer-p buf)
(run-hook-with-args-until-success 'doom-real-buffer-functions buf)
(not (or (doom-popup-p buf)

View file

@ -60,14 +60,14 @@ selection of all minor-modes, active or not."
(interactive)
(unless (string-match-p "\\_<GNUTLS\\_>" system-configuration-features)
(warn "gnutls support isn't built into Emacs, there may be problems"))
(if-let (bad-hosts
(cl-loop for bad
in '("https://wrong.host.badssl.com/"
"https://self-signed.badssl.com/")
if (condition-case _e
(url-retrieve bad (lambda (_retrieved) t))
(error nil))
collect bad))
(if-let* ((bad-hosts
(cl-loop for bad
in '("https://wrong.host.badssl.com/"
"https://self-signed.badssl.com/")
if (condition-case _e
(url-retrieve bad (lambda (_retrieved) t))
(error nil))
collect bad)))
(error (format "tls seems to be misconfigured (it got %s)."
bad-hosts))
(url-retrieve "https://badssl.com"

View file

@ -12,7 +12,7 @@ PROMPT (a string) and COMMAND (a list of command plists; see `def-menu!').")
(completing-read prompt (mapcar #'car commands)))
(defun doom--menu-read (prompt commands)
(if-let (choice (funcall doom-menu-display-fn prompt commands))
(if-let* ((choice (funcall doom-menu-display-fn prompt commands)))
(cdr (assoc choice commands))
(user-error "Aborted")))

View file

@ -48,7 +48,7 @@ list, whose car is NAME, and cdr the current version list and latest version
list of the package."
(cl-assert (symbolp name) t)
(doom-initialize-packages)
(when-let (desc (cadr (assq name package-alist)))
(when-let* ((desc (cadr (assq name package-alist))))
(let* ((old-version (package-desc-version desc))
(new-version
(pcase (doom-package-backend name)
@ -57,7 +57,7 @@ list of the package."
(dir (expand-file-name (symbol-name name) quelpa-build-dir))
(inhibit-message (not doom-debug-mode))
(quelpa-upgrade-p t))
(if-let (ver (quelpa-checkout recipe dir))
(if-let* ((ver (quelpa-checkout recipe dir)))
(version-to-list ver)
old-version)))
('elpa
@ -115,7 +115,7 @@ If INSTALLED-ONLY-P, only return packages that are installed."
(defun doom-get-depending-on (name)
"Return a list of packages that depend on the package named NAME."
(doom-initialize)
(when-let (desc (cadr (assq name package-alist)))
(when-let* ((desc (cadr (assq name package-alist))))
(mapcar #'package-desc-name (package--used-elsewhere-p desc nil t))))
;;;###autoload
@ -291,7 +291,7 @@ package.el as appropriate."
(package-compute-transaction () (list (list archive))))))
(package-download-transaction packages))))
(unless (doom-package-outdated-p name)
(when-let (old-dir (package-desc-dir desc))
(when-let* ((old-dir (package-desc-dir desc)))
(when (file-directory-p old-dir)
(delete-directory old-dir t)))
t))))
@ -498,7 +498,7 @@ calls."
(user-error "All packages are up to date"))))
(list (cdr (assq (car (assoc package package-alist)) packages)))))
(cl-destructuring-bind (package old-version new-version) pkg
(if-let (desc (doom-package-outdated-p package))
(if-let* ((desc (doom-package-outdated-p package)))
(let ((old-v-str (package-version-join old-version))
(new-v-str (package-version-join new-version)))
(if (y-or-n-p (format "%s will be updated from %s to %s. Update?"

View file

@ -4,7 +4,7 @@
(defun doom-popup-p (&optional target)
"Return t if TARGET (a window or buffer) is a popup. Uses current window if
omitted."
(when-let (target (or target (selected-window)))
(when-let* ((target (or target (selected-window))))
(cond ((bufferp target)
(and (buffer-live-p target)
(buffer-local-value 'doom-popup-mode target)))
@ -31,7 +31,7 @@ this popup, just the specified properties. Returns the new popup window."
(defun doom-popup-switch-to-buffer (buffer)
"Switch the current (or closest) pop-up window to BUFFER."
(unless (doom-popup-p)
(if-let (popups (doom-popup-windows))
(if-let* ((popups (doom-popup-windows)))
(select-window (car popups))
(error "No popups to switch to")))
(set-window-dedicated-p nil nil)
@ -113,7 +113,7 @@ window parameter."
((or 'above 'below) (window-height window))))
(defun doom--popup-data (window)
(when-let (buffer (window-buffer window))
(when-let* ((buffer (window-buffer window)))
`(,(buffer-name buffer)
:file ,(buffer-file-name buffer)
:rules ,(window-parameter window 'popup)
@ -167,7 +167,7 @@ Returns t if popups were restored, nil otherwise."
(size (plist-get (cdr spec) :size)))
(when (and (not buffer) file)
(setq buffer
(if-let (buf (get-file-buffer file))
(if-let* ((buf (get-file-buffer file)))
(clone-indirect-buffer (buffer-name buf) nil t)
(find-file-noselect file t))))
(when size
@ -212,7 +212,7 @@ If FORCE-P is non-nil (or this function is called interactively), ignore popups'
:autoclose property. This command will never close :static popups."
(interactive
(list (called-interactively-p 'interactive)))
(when-let (popups (doom-popup-windows t))
(when-let* ((popups (doom-popup-windows t)))
(let (success doom-popup-remember-history)
(setq doom-popup-history (delq nil (mapcar #'doom--popup-data popups)))
(dolist (window popups success)
@ -225,7 +225,7 @@ If FORCE-P is non-nil (or this function is called interactively), ignore popups'
"Like `doom/popup-close-all', but kill *all* popups, including :static ones,
without leaving any trace behind (muahaha)."
(interactive)
(when-let (popups (doom-popup-windows))
(when-let* ((popups (doom-popup-windows)))
(let (doom-popup-remember-history)
(setq doom-popup-history nil)
(mapc #'delete-window popups))))
@ -251,7 +251,7 @@ without leaving any trace behind (muahaha)."
(defun doom/popup-toggle-messages ()
"Toggle *Messages* buffer."
(interactive)
(if-let (win (get-buffer-window "*Messages*"))
(if-let* ((win (get-buffer-window "*Messages*")))
(doom/popup-close win)
(doom-popup-buffer (get-buffer "*Messages*"))))
@ -259,10 +259,10 @@ without leaving any trace behind (muahaha)."
(defun doom/other-popup (count)
"Cycle through popup windows. Like `other-window', but for popups."
(interactive "p")
(if-let (popups (if (doom-popup-p)
(cdr (memq (selected-window) doom-popup-windows))
(setq doom-popup-other-window (selected-window))
doom-popup-windows))
(if-let* ((popups (if (doom-popup-p)
(cdr (memq (selected-window) doom-popup-windows))
(setq doom-popup-other-window (selected-window))
doom-popup-windows)))
(ignore-errors (select-window (nth (mod (1- count) (length popups)) popups)))
(unless (eq (selected-window) doom-popup-other-window)
(when doom-popup-other-window
@ -419,6 +419,6 @@ properties."
(with-selected-window window
(doom-popup-mode -1)
(when autokill-p
(when-let (process (get-buffer-process (current-buffer)))
(when-let* ((process (get-buffer-process (current-buffer))))
(set-process-query-on-exit-flag process nil))
(kill-buffer (current-buffer)))))))

View file

@ -269,7 +269,7 @@ Example
(dolist (keymap doom--keymaps)
(when (memq 'global states)
(push `(define-key ,keymap ,key ,def) forms))
(when-let (states (delq 'global states))
(when-let* ((states (delq 'global states)))
(push `(,(if doom--defer 'evil-define-key 'evil-define-key*)
',states ,keymap ,key ,def)
forms))))

View file

@ -6,6 +6,12 @@
(load "persistent-soft-autoloads" nil t)
(dolist (sym '(json-read json-read-file json-read-from-string json-encode))
(autoload sym "json"))
(eval-and-compile
(when (version< emacs-version "26")
(with-no-warnings
(defalias 'if-let* #'if-let)
(defalias 'when-let* #'when-let))))
;;
;; Helpers
@ -96,7 +102,7 @@ See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers."
(file-relative-name parent)))))
("s"
(if (featurep 'evil)
(when-let (args (evil-delimited-arguments (substring flag 1) 2))
(when-let* ((args (evil-delimited-arguments (substring flag 1) 2)))
(let ((pattern (evil-transform-vim-style-regexp (car args)))
(replace (cadr args)))
(replace-regexp-in-string

View file

@ -247,9 +247,10 @@ This aggressively reloads core autoload files."
(defun doom-module-from-path (path)
"Get module cons cell (MODULE . SUBMODULE) for PATH, if possible."
(when (string-match (concat doom-modules-dir "\\([^/]+\\)/\\([^/]+\\)/") path)
(cons (intern (concat ":" (match-string 1 path)))
(intern (match-string 2 path)))))
(when-let* ((path (file-relative-name (file-truename path) (file-truename doom-modules-dir))))
(let ((segments (split-string path "/")))
(cons (intern (concat ":" (car segments)))
(intern (cadr segments))))))
(defun doom-module-paths (&optional append-file)
"Returns a list of absolute file paths to activated modules, with APPEND-FILE
@ -463,7 +464,7 @@ Accepts the following properties:
(when pkg-pin
(plist-put plist :pin nil)))
(dolist (prop '(:ignore :freeze))
(when-let (val (plist-get plist prop))
(when-let* ((val (plist-get plist prop)))
(plist-put plist prop (eval val))))
`(progn
(when ,(and pkg-pin t)

View file

@ -414,7 +414,7 @@ that `doom*popup-save' won't break it."
(defun doom*persp-mode-restore-popups (&rest _)
"Restore popup windows when loading a perspective from file."
(dolist (window (window-list))
(when-let (plist (doom-popup-properties window))
(when-let* ((plist (doom-popup-properties window)))
(with-selected-window window
(unless doom-popup-mode
(setq-local doom-popup-rules plist)

View file

@ -147,7 +147,7 @@ local value, whether or not it's permanent-local. Therefore, we cycle
;; like diminish, but for major-modes. [pedantry intensifies]
(defun doom|set-mode-name ()
"Set the major mode's `mode-name', as dictated by `doom-major-mode-names'."
(when-let (name (cdr (assq major-mode doom-major-mode-names)))
(when-let* ((name (cdr (assq major-mode doom-major-mode-names))))
(setq mode-name
(cond ((functionp name) (funcall name))
((stringp name) name)
@ -475,7 +475,7 @@ error if it doesn't exist."
(defun doom-set-modeline (key &optional default)
"Set the modeline format. Does nothing if the modeline KEY doesn't exist. If
DEFAULT is non-nil, set the default mode-line for all buffers."
(when-let (modeline (doom-modeline key))
(when-let* ((modeline (doom-modeline key)))
(setf (if default
(default-value 'mode-line-format)
(buffer-local-value 'mode-line-format (current-buffer)))

View file

@ -31,7 +31,7 @@ DEFAULT-P is a boolean. If non-nil, it marks that email account as the
default/fallback account."
`(after! mu4e
(let ((account-vars ,letvars))
(when-let (address (cdr (assq 'user-mail-address account-vars)))
(when-let* ((address (cdr (assq 'user-mail-address account-vars))))
(cl-pushnew address mu4e-user-mail-address-list :test #'equal))
(let ((context (make-mu4e-context
:name ,label

View file

@ -88,7 +88,7 @@ playback.")
(defun +irc*circe-truncate-nicks ()
"Truncate long nicknames in chat output non-destructively."
(when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick))
(when-let* ((beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick)))
(goto-char beg)
(let ((end (next-single-property-change beg 'lui-format-argument))
(nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords)

View file

@ -261,7 +261,7 @@ __DATA__
(overlay-put ov 'category '+regex))
(cl-incf i)
(dotimes (i 10)
(when-let (text (match-string i))
(when-let* ((text (match-string i)))
(save-match-data
(with-current-buffer +regex--groups-buffer
(goto-char (point-max))

View file

@ -11,7 +11,7 @@
(interactive)
(doom-kill-matching-buffers "^\\*elfeed")
(dolist (file +rss-elfeed-files)
(when-let (buf (get-file-buffer (expand-file-name file +rss-org-dir)))
(when-let* ((buf (get-file-buffer (expand-file-name file +rss-org-dir))))
(kill-buffer buf))))
;;;###autoload

View file

@ -73,9 +73,9 @@ If ARG (universal argument), open selection in other-window."
(task-tags (mapcar #'car +ivy-task-tags))
(cmd
(format "%s -H -S --no-heading -- %s %s"
(or (when-let (bin (executable-find "rg"))
(or (when-let* ((bin (executable-find "rg")))
(concat bin " --line-number"))
(when-let (bin (executable-find "ag"))
(when-let* ((bin (executable-find "ag")))
(concat bin " --numbers"))
(error "ripgrep & the_silver_searcher are unavailable"))
(shell-quote-argument

View file

@ -13,7 +13,7 @@
"Evaluate a region between BEG and END and display the output."
(interactive "r")
(let ((load-file-name buffer-file-name))
(if-let (runner (cdr (assq major-mode +eval-runners)))
(if-let* ((runner (cdr (assq major-mode +eval-runners))))
(funcall runner beg end)
(quickrun-region beg end))))

View file

@ -7,7 +7,7 @@
(or (eq (current-buffer) +eval-repl-buffer)
(progn
(if (and +eval-repl-buffer (buffer-live-p +eval-repl-buffer))
(if-let (win (get-buffer-window +eval-repl-buffer))
(if-let* ((win (get-buffer-window +eval-repl-buffer)))
(select-window win)
(doom-popup-buffer +eval-repl-buffer))
(when command
@ -29,7 +29,7 @@
"Opens (or reopens) the REPL associated with the current major-mode and place
the cursor at the prompt."
(interactive)
(when-let (command (cdr (assq major-mode +eval-repls)))
(when-let* ((command (cdr (assq major-mode +eval-repls))))
(when (+eval--ensure-in-repl-buffer command)
(when (bound-and-true-p evil-mode)
(call-interactively #'evil-append-line))

View file

@ -74,7 +74,7 @@ function that creates and returns the REPL buffer."
(defun +eval*quickrun-auto-close (&rest _)
"Allows us to silently re-run quickrun from within the quickrun buffer."
(when-let (win (get-buffer-window quickrun--buffer-name))
(when-let* ((win (get-buffer-window quickrun--buffer-name)))
(let ((inhibit-message t))
(quickrun--kill-running-process)
(message ""))

View file

@ -77,7 +77,7 @@ overwrite the destination file if it exists, without confirmation."
(pcase (catch 'status
(let ((old-path (buffer-file-name))
(new-path (expand-file-name new-path)))
(when-let (dest (+evil--copy-file old-path new-path force-p))
(when-let* ((dest (+evil--copy-file old-path new-path force-p)))
(delete-file old-path)
(kill-this-buffer)
(find-file new-path)
@ -95,7 +95,7 @@ overwrite the destination file if it exists, without confirmation."
:repeat nil
(interactive "<f><!>")
(pcase (catch 'status
(when-let (dest (+evil--copy-file (buffer-file-name) new-path force-p))
(when-let* ((dest (+evil--copy-file (buffer-file-name) new-path force-p)))
(message "File successfully copied to %s" dest)))
('overwrite-self (error "Cannot overwrite self"))
('aborted (message "Aborted"))

View file

@ -180,11 +180,11 @@ across windows."
(evil-embrace-enable-evil-surround-integration)
(defun +evil--embrace-get-pair (char)
(if-let (pair (cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist)))
(if-let* ((pair (cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist))))
pair
(if-let (pair (assoc-default char embrace--pairs-list))
(if-let (real-pair (and (functionp (embrace-pair-struct-read-function pair))
(funcall (embrace-pair-struct-read-function pair))))
(if-let* ((pair (assoc-default char embrace--pairs-list)))
(if-let* ((real-pair (and (functionp (embrace-pair-struct-read-function pair))
(funcall (embrace-pair-struct-read-function pair)))))
real-pair
(cons (embrace-pair-struct-left pair) (embrace-pair-struct-right pair)))
(cons char char))))

View file

@ -70,8 +70,8 @@ properties:
(defun +jump|init ()
"Initialize `+jump-current-functions', used by `+jump/definition',
`+jump/references' and `+jump/documentation'."
(when-let (plist (cdr (assq major-mode +jump-function-alist)))
(when-let (backend (plist-get plist :xref-backend))
(when-let* ((plist (cdr (assq major-mode +jump-function-alist))))
(when-let* ((backend (plist-get plist :xref-backend)))
(make-variable-buffer-local 'xref-backend-functions)
(cl-pushnew backend xref-backend-functions :test #'eq))
(setq-local +jump-current-functions plist)))

View file

@ -11,7 +11,7 @@ and switches to insert mode if there are editable fields."
(cl-letf (((symbol-function 'region-beginning) (lambda () evil-visual-beginning))
((symbol-function 'region-end) (lambda () evil-visual-end)))
(yas-insert-snippet))
(when-let (snippet (car-safe (yas-active-snippets)))
(when-let* ((snippet (car-safe (yas-active-snippets))))
(let ((fields (yas--snippet-fields snippet)))
(evil-insert-state +1)
(unless fields (evil-change-state 'normal)))))

View file

@ -27,7 +27,7 @@ repository root."
(defun +vcs/git-browse-issues ()
"Open the github issues page for current repo."
(interactive)
(if-let (root (+vcs-root))
(if-let* ((root (+vcs-root)))
(browse-url (concat root "/issues"))
(user-error "No git root found!")))

View file

@ -53,7 +53,7 @@
;;;###autoload
(defun +workspace-get (name &optional noerror)
"Returns a workspace (perspective hash table) named NAME."
(when-let (persp (persp-get-by-name name))
(when-let* ((persp (persp-get-by-name name)))
(cond ((+workspace-p persp) persp)
((not noerror) (error "'%s' is an invalid workspace" name)))))

View file

@ -35,9 +35,9 @@ compilation database is present in the project.")
(or (file-exists-p (expand-file-name
(concat (file-name-sans-extension buffer-file-name)
".cpp")))
(when-let (file (car-safe (projectile-get-other-files
buffer-file-name
(projectile-current-project-files))))
(when-let* ((file (car-safe (projectile-get-other-files
buffer-file-name
(projectile-current-project-files)))))
(equal (file-name-extension file) "cpp")))))
(defun +cc-objc-header-file-p ()

View file

@ -10,14 +10,14 @@ ignore the cache."
(or (and (not refresh-p)
(gethash project-root +javascript-npm-conf))
(let ((package-file (expand-file-name "package.json" project-root)))
(when-let (json (and (file-exists-p package-file)
(json-read-file package-file)))
(when-let* ((json (and (file-exists-p package-file)
(json-read-file package-file))))
(puthash project-root json +javascript-npm-conf))))))
;;;###autoload
(defun +javascript-npm-dep-p (packages &optional project-root refresh-p)
(when-let (data (and (bound-and-true-p +javascript-npm-mode)
(+javascript-npm-conf project-root refresh-p)))
(when-let* ((data (and (bound-and-true-p +javascript-npm-mode)
(+javascript-npm-conf project-root refresh-p))))
(let ((deps (append (cdr (assq 'dependencies data))
(cdr (assq 'devDependencies data)))))
(cond ((listp packages)

View file

@ -27,8 +27,8 @@
(defun +javascript|init-flycheck-eslint ()
"Favor local eslint over global installs and configure flycheck for eslint."
(when (derived-mode-p 'js-mode)
(when-let ((exec-path (list (doom-project-expand "node_modules/.bin")))
(eslint (executable-find "eslint")))
(when-let* (((exec-path (list (doom-project-expand "node_modules/.bin")))
(eslint (executable-find "eslint"))))
(setq-local flycheck-javascript-eslint-executable eslint))
(when (flycheck-find-checker-executable 'javascript-eslint)
;; Flycheck has it's own trailing command and semicolon warning that was

View file

@ -35,8 +35,8 @@
;; (goto-char (point-min))
;; (while (progn (org-next-link) (not org-link-search-failed))
;; (setq element (org-element-context))
;; (when-let (file (and (eq (org-element-type element) 'link)
;; (expand-file-name (org-element-property :path element))))
;; (when-let* (file (and (eq (org-element-type element) 'link)
;; (expand-file-name (org-element-property :path element))))
;; (when (and (string= (org-element-property :type element) "file")
;; (string= (concat (file-name-base (directory-file-name (file-name-directory file))) "/")
;; org-attach-directory)

View file

@ -18,12 +18,12 @@
Uses the capture template specified by KEY. Otherwise, prompts you for one."
(interactive)
(let ((key (or key "n")))
(if-let (string (cond ((not (equal string ""))
string)
((region-active-p)
(buffer-substring-no-properties
(region-beginning)
(region-end)))))
(if-let* ((string (cond ((not (equal string ""))
string)
((region-active-p)
(buffer-substring-no-properties
(region-beginning)
(region-end))))))
(org-capture-string string key)
(org-capture nil key))))

View file

@ -4,7 +4,7 @@
"The directory where org files are kept.")
;; Ensure ELPA org is prioritized above built-in org.
(when-let (path (locate-library "org" nil doom--package-load-path))
(when-let* ((path (locate-library "org" nil doom--package-load-path)))
(setq load-path (delete path load-path))
(push (file-name-directory path) load-path))

View file

@ -9,6 +9,6 @@ ignore the cache."
(let ((project-root (or project-root (doom-project-root))))
(or (and (not refresh-p) (gethash project-root +php-composer-conf))
(let ((package-file (expand-file-name "composer.json" project-root)))
(when-let (data (and (file-exists-p package-file)
(json-read-file package-file)))
(when-let* ((data (and (file-exists-p package-file)
(json-read-file package-file))))
(puthash project-root data +php-composer-conf))))))

View file

@ -55,7 +55,7 @@ is loaded.")
(defun +python|detect-pyenv-version ()
"Detect the pyenv version for the current project and set the relevant
environment variables."
(when-let (version-str (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2"))
(when-let* ((version-str (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2")))
(setq version-str (string-trim version-str)
+python-current-version version-str)
(let ((pyenv-current-path (concat +python-pyenv-root "/versions/" version-str)))

View file

@ -43,7 +43,7 @@
(defun +ruby|detect-rbenv-version ()
"Detect the rbenv version for the current project and set the relevant
environment variables."
(when-let (version-str (shell-command-to-string "ruby --version 2>&1 | cut -d' ' -f2"))
(when-let* ((version-str (shell-command-to-string "ruby --version 2>&1 | cut -d' ' -f2")))
(setq version-str (string-trim version-str)
+ruby-current-version version-str)
(when (member version-str +ruby-rbenv-versions)

View file

@ -12,7 +12,7 @@ private/hlissner/snippets."
(defun +hlissner/yank-buffer-filename ()
"Copy the current buffer's path to the kill ring."
(interactive)
(if-let (filename (or buffer-file-name (bound-and-true-p list-buffers-directory)))
(if-let* ((filename (or buffer-file-name (bound-and-true-p list-buffers-directory))))
(message (kill-new (abbreviate-file-name filename)))
(error "Couldn't find filename in current buffer")))

View file

@ -41,8 +41,8 @@ module to be loaded."
(user-error ":feature workspaces is required, but disabled"))
(unless (+workspace-get "eshell" t)
(+workspace/new "eshell"))
(if-let (buf (cl-find-if (lambda (it) (string-match-p "^\\*doom:eshell" (buffer-name (window-buffer it))))
(doom-visible-windows)))
(if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*doom:eshell" (buffer-name (window-buffer it))))
(doom-visible-windows))))
(select-window (get-buffer-window buf))
(+eshell/open))
(doom/workspace-display)

View file

@ -4,7 +4,7 @@
(defun +gist/open-current ()
(interactive)
(gist-fetch-current)
(when-let (win (get-buffer-window "*github:gists*"))
(when-let* ((win (get-buffer-window "*github:gists*")))
(doom/popup-close win)))
;;;###autoload

View file

@ -21,7 +21,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)
@ -32,7 +32,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))
@ -43,7 +43,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)

View file

@ -13,7 +13,7 @@
;;;###autoload
(defun +pass-get-field (entry fields)
(unless noninteractive
(if-let (data (if (listp entry) entry (auth-pass-parse-entry entry)))
(if-let* ((data (if (listp entry) entry (auth-pass-parse-entry entry))))
(cl-loop for key in (doom-enlist fields)
when (assoc key data)
return (cdr it))
@ -28,7 +28,7 @@
(+pass-get-field entry 'secret))
(defun +pass-ivy-action--open-url (entry)
(if-let (url (+pass-get-field entry +pass-url-fields))
(if-let* ((url (+pass-get-field entry +pass-url-fields)))
(and (or (string-match-p "https?://" url)
(error "Field for %s doesn't look like an url" item))
(browse-url url))
@ -48,7 +48,7 @@
(error "Couldn't find entry: %s" item))))
(defun +pass-ivy-action--copy-username (entry)
(if-let (user (+pass-get-field entry +pass-user-fields))
(if-let* ((user (+pass-get-field entry +pass-user-fields)))
(progn (password-store-clear)
(message "Copied username to the kill ring.")
(kill-new user))

View file

@ -108,11 +108,11 @@ but do not execute them."
;;;###autoload
(defun +tmux-list-windows (&optional session)
(if-let (lines
(+tmux (format "list-windows %s -F '#{window_id};#{session_id};#{window_active};#{window_name};#{window_activity_flag}'"
(if session
(concat "-t " (car session))
"-a"))))
(if-let* ((lines
(+tmux (format "list-windows %s -F '#{window_id};#{session_id};#{window_active};#{window_name};#{window_activity_flag}'"
(if session
(concat "-t " (car session))
"-a")))))
(cl-loop for line in (string-split lines "\n" t)
collect (let ((window (string-split line ";")))
(list (nth 0 window)
@ -124,13 +124,13 @@ but do not execute them."
;;;###autoload
(defun +tmux-list-panes (&optional sess-or-win)
(if-let (lines
(+tmux (format "list-panes %s -F '#{pane_id};#{window_id};#{session_id};#{pane_active};#{pane_title};#{pane_current_path}'"
(if sess-or-win
(concat (if (string-prefix-p "$" (car sess-or-win)) "-s ")
"-t "
(car sess-or-win))
"-a"))))
(if-let* ((lines
(+tmux (format "list-panes %s -F '#{pane_id};#{window_id};#{session_id};#{pane_active};#{pane_title};#{pane_current_path}'"
(if sess-or-win
(concat (if (string-prefix-p "$" (car sess-or-win)) "-s ")
"-t "
(car sess-or-win))
"-a")))))
(cl-loop for line in (string-split lines "\n" t)
collect (let ((pane (split-string line ";")))
(list (nth 0 pane)

View file

@ -50,7 +50,7 @@
(defvar +doom-modeline-current-window (frame-selected-window))
(defun +doom-modeline|set-selected-window (&rest _)
"Sets `+doom-modeline-current-window' appropriately"
(when-let (win (frame-selected-window))
(when-let* ((win (frame-selected-window)))
(unless (minibuffer-window-active-p win)
(setq +doom-modeline-current-window win))))