From 69e3f08d5b67c1f49ab964fc845871d68bf77822 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Mon, 13 Aug 2018 22:03:57 +0800 Subject: [PATCH] Fix when-let* for Emacs 25. --- doom-modeline.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doom-modeline.el b/doom-modeline.el index 5df81fa..f7c7845 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -63,6 +63,12 @@ (require 'shrink-path) +(unless (>= emacs-major-version 26) + (with-no-warnings + ;; if-let and when-let are deprecated in Emacs 26+ in favor of their + ;; if-let* variants, so we alias them for 25 users. + (defalias 'when-let* #'when-let))) + ;; ;; Variables ;; @@ -277,7 +283,7 @@ Example: "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." - (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))) @@ -353,7 +359,7 @@ If STRICT-P, return nil if no project was found, otherwise return (defvar doom-modeline-current-window (frame-selected-window)) (defun doom-modeline-set-selected-window (&rest _) "Set `doom-modeline-current-window' appropriately." - (let ((win (frame-selected-window))) + (when-let* ((win (frame-selected-window))) (unless (minibuffer-window-active-p win) (setq doom-modeline-current-window win) (force-mode-line-update))))