Skip to content

Commit

Permalink
Use if-let*/when-let*
Browse files Browse the repository at this point in the history
if-let and when-let are obsolete since Emacs 31
  • Loading branch information
condy0919 committed Nov 1, 2024
1 parent 97f69c0 commit 44be0cf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lisp/init-shell.el
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

(defun term-mode-set-sentinel ()
"Close buffer after exit."
(when-let ((proc (ignore-errors (get-buffer-process (current-buffer)))))
(when-let* ((proc (ignore-errors (get-buffer-process (current-buffer)))))
(set-process-sentinel proc #'shell-self-destroy-sentinel))))

;; The Emacs shell & friends
Expand Down Expand Up @@ -122,14 +122,14 @@ current directory."
If popup is visible but unselected, select it.
If popup is focused, kill it."
(interactive)
(if-let ((win (get-buffer-window "*shell-popup*")))
(if-let* ((win (get-buffer-window "*shell-popup*")))
(if (eq (selected-window) win)
;; If users attempt to delete the sole ordinary window, silence it.
(shell-delete-window)
(select-window win))
(let ((display-comint-buffer-action '(display-buffer-at-bottom
(inhibit-same-window . nil))))
(when-let ((proc (ignore-errors (get-buffer-process (shell "*shell-popup*")))))
(when-let* ((proc (ignore-errors (get-buffer-process (shell "*shell-popup*")))))
(set-process-sentinel proc #'shell-self-destroy-sentinel)))))

;; Correct indentation for `ls'
Expand All @@ -152,7 +152,7 @@ If popup is focused, kill it."
If popup is visible but unselected, select it.
If popup is focused, kill it."
(interactive)
(if-let ((win (get-buffer-window "*eshell-popup*")))
(if-let* ((win (get-buffer-window "*eshell-popup*")))
(if (eq (selected-window) win)
;; If users attempt to delete the sole ordinary window. silence it.
(shell-delete-window)
Expand Down

0 comments on commit 44be0cf

Please sign in to comment.