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

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

[elpa] externals/popper 1312c0f0f6 053/102: Added video demo of buffer h


From: ELPA Syncer
Subject: [elpa] externals/popper 1312c0f0f6 053/102: Added video demo of buffer hiding
Date: Fri, 8 Sep 2023 15:58:53 -0400 (EDT)

branch: externals/popper
commit 1312c0f0f6ef080778da880fc92532c2cd803717
Author: Karthik Chikmagalur <karthikchikmagalur@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmagalur@gmail.com>

    Added video demo of buffer hiding
    
    Tweaks to readme, major-mode identification code
---
 README.org                   |  21 +++++++++++----------
 images/popper-hide-popup.gif | Bin 0 -> 144745 bytes
 popper.el                    |   8 +++-----
 3 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/README.org b/README.org
index 821ad3a854..a44ceadd63 100644
--- a/README.org
+++ b/README.org
@@ -183,19 +183,21 @@ If you already have rules in place for how various 
buffers should be displayed,
 #+end_src
 
 ** Suppressing popups
-Popper can suppress popups when they are first created. The buffer will be 
registered in the list of popups but will not show up on your screen. Instead, 
a message ("Popup suppressed: $buffer-name") will be printed to the echo area. 
You can then raise it using =popper-toggle-latest= or =popper-cycle= at your 
convenience. It will behave like regular popups from that point on.
+Popper can suppress popups when they are first created. The buffer will be 
registered in the list of popups but will not show up on your screen. Instead, 
a message ("Popup suppressed: $buffer-name") will be printed to the echo area. 
You can then raise it using =popper-toggle-latest= or =popper-cycle= at your 
convenience. It behaves as a regular popup from that point on:
+
+[[file:images/popper-hide-popup.gif]]
 
 To specify popups to auto-hide, use a cons cell with the =hide= symbol when 
specifying =popup-reference-buffers=:
 
 #+begin_src emacs-lisp
   (setq popper-reference-buffers
-      '("\\*Messages\\*"
-        ("\\*Async Shell Command\\*" . hide)
+      '(("Output\\*$" . hide)
         (completion-list-mode . hide)
-        occur-mode))
+        occur-mode
+        "\\*Messages\\*"))
 #+end_src
 
-This assignment will suppress async shell command output and the Completions 
buffer. The other entries are treated as normal popups.
+This assignment will suppress all buffers ending in =Output*= and the 
Completions buffer. The other entries are treated as normal popups.
 
 You can combine the hiding feature with predicates for classifying buffers as 
popups:
 
@@ -203,13 +205,12 @@ You can combine the hiding feature with predicates for 
classifying buffers as po
   (defun popper-shell-output-empty-p (buf)
     (and (string-match-p "\\*Async Shell Command\\*" (buffer-name buf))
          (= (buffer-size buf) 0)))
-  
-  (setq popper-reference-buffers
-        '("\\*Messages\\*"
-          (popper-shell-output-empty-p . hide)))
+
+  (add-to-list 'popper-reference-buffers
+               '(popper-shell-output-empty-p . hide))
 #+END_SRC
 
-This assignment will suppress display of the async shell command output buffer 
only when there is no output (stdout). Once it is hidden it will be treated as 
a popup on par with the Messages buffer.
+This assignment will suppress display of the async shell command output buffer 
only when there is no output (stdout). Once it is hidden it will be treated as 
a popup on par with other entries in =popper-reference-buffers=.
 
 * Technical notes
 =popper= uses a buffer local variable (=popper-popup-status=) to identify if a 
given buffer should be treated as a popup. Matching is always by buffer and not 
window, so having two windows of a buffer, one treated as a popup and one as a 
regular window, isn't possible (although you can do this with indirect clones). 
In addition, it maintains an alist of popup windows/buffers for cycling through.
diff --git a/images/popper-hide-popup.gif b/images/popper-hide-popup.gif
new file mode 100644
index 0000000000..c7992b75ba
Binary files /dev/null and b/images/popper-hide-popup.gif differ
diff --git a/popper.el b/popper.el
index bbcc144fab..347c4fc937 100644
--- a/popper.el
+++ b/popper.el
@@ -601,11 +601,9 @@ If BUFFER is not specified act on the current buffer 
instead."
     (pcase elm
       ((pred stringp) 'name)
       ((and (pred symbolp)
-            (guard (or (get elm 'derived-mode-parent)
-                       (get elm 'mode-class)
-                       (not (boundp elm))
-                       (not (fboundp elm))
-                       (commandp elm))))
+            (guard (or (memq 'derived-mode-parent (symbol-plist elm))
+                       (memq 'mode-class (symbol-plist elm))
+                       (string= "-mode" (substring (symbol-name elm) -5)))))
        'mode)
       ((pred functionp) 'pred)
       ((pred consp) 'cons)))



reply via email to

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