emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/auto-dim-other-buffers f712de72d4 67/82: Optimise ‘never


From: ELPA Syncer
Subject: [nongnu] elpa/auto-dim-other-buffers f712de72d4 67/82: Optimise ‘never dim’ check
Date: Mon, 12 Dec 2022 20:58:45 -0500 (EST)

branch: elpa/auto-dim-other-buffers
commit f712de72d4618ce6c5d55ba20c848c83a87c5f32
Author: Michal Nazarewicz <mina86@mina86.com>
Commit: Michal Nazarewicz <mina86@mina86.com>

    Optimise ‘never dim’ check
    
    All minibuffers are hidden buffers (i.e. ones whose name starts with
    a space) so ‘minibufferp’ check in ‘adob--never-dim-p’ function was
    redundont.
    
    Furthermore, the function was never called from a place where the
    argument colud be nil so ‘null’ check was unnecessary as well.
    
    What remains is checking whether buffer’s name starts with a space
    so change ‘adob--never-dim-p’ to do just that.  For good measures,
    inline ‘string-prefix-p’ and call ‘compare-strings’ directly thus
    eliminating a few function calls.
---
 auto-dim-other-buffers.el | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/auto-dim-other-buffers.el b/auto-dim-other-buffers.el
index 6309c3b2be..90972fd23a 100644
--- a/auto-dim-other-buffers.el
+++ b/auto-dim-other-buffers.el
@@ -9,7 +9,7 @@
 ;;     Michal Nazarewicz <mina86@mina86.com>
 ;; Maintainer: Michal Nazarewicz <mina86@mina86.com>
 ;; URL: https://github.com/mina86/auto-dim-other-buffers.el
-;; Version: 1.9.5
+;; Version: 1.9.6
 
 ;; This file is not part of GNU Emacs.
 
@@ -75,10 +75,8 @@
 
 (defun adob--never-dim-p (buffer)
   "Return whether to never dim BUFFER.
-Currently only mini buffer and echo areas are ignored."
-  (or (null buffer)
-      (minibufferp buffer)
-      (string-prefix-p " " (buffer-name buffer))))
+Currently, no hidden buffers (ones whose name starts with a space) are dimmed."
+  (eq t (compare-strings " " 0 1 (buffer-name buffer) 0 1)))
 
 (defvar-local adob--face-mode-remapping nil
   "Current remapping cookie for `auto-dim-other-buffers-mode'.")
@@ -130,7 +128,6 @@ Otherwise, if a new buffer is displayed somewhere, dim it."
 (defun adob--focus-out-hook ()
   "Dim all buffers if `auto-dim-other-buffers-dim-on-focus-out'."
   (when (and auto-dim-other-buffers-dim-on-focus-out
-             adob--last-buffer
              (buffer-live-p adob--last-buffer)
              (not (adob--never-dim-p adob--last-buffer)))
     (with-current-buffer adob--last-buffer



reply via email to

[Prev in Thread] Current Thread [Next in Thread]