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

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

[elpa] externals/popper 2341669327 026/102: Linted in preparation for me


From: ELPA Syncer
Subject: [elpa] externals/popper 2341669327 026/102: Linted in preparation for merge into master
Date: Fri, 8 Sep 2023 15:58:51 -0400 (EDT)

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

    Linted in preparation for merge into master
---
 README.org | 21 +++++++++++++++------
 popper.el  | 48 ++++++++++++++++++++++--------------------------
 2 files changed, 37 insertions(+), 32 deletions(-)

diff --git a/README.org b/README.org
index 9b179a8d4c..a12b019f60 100644
--- a/README.org
+++ b/README.org
@@ -2,6 +2,8 @@
 
 A minor-mode to help with the Emacs window flood. Designate any buffer to 
"popup" status, and it will stay out of your way. Disimss or summon it easily 
with one key. Useful for many things, including toggling display of REPLs, 
documentation, compilation or shell output, etc.
 
+There is a [[https://www.youtube.com/watch?v=E-xUNlZi3rI][detailed demo of 
Popper here]].
+
 popper can place your popups for you, but it works best in conjunction
 with some system to handle window creation and placement, like =shackle.el=.
 This plugin summons windows defined by the user as "popups" by simply calling
@@ -33,18 +35,20 @@ You can also promote a popup to a normal window.
 * Usage
 To designate popups in your init file, see the customization section.
 
-There are three commands of note, you can bind them as convenient:
+There are two primary commands, you can bind them as convenient:
 
 - =popper-toggle-latest=: Show/hide the latest popup. Does more with prefix 
args.
 - =popper-cycle=: Cycle through your popups in sequence. With a prefix arg, 
cycle backwards.
-- =popper-toggle-type=: Turn a regular window into a popup or a popup into a 
regular window.
-  
+
+Additionally, you can turn a regular window into a popup (or vice-versa) with 
=popper-toggle-type=, and kill an open popup buffer with 
=popper-kill-latest-popup=.
+
 * Setup 
-=popper= is not part of any package archive, so you will need to ensure it's 
on the Emacs =load-path= somewhere.
+=popper= is available in MELPA, so you can install it with =M-x 
package-install RET popper RET= after adding MELPA to your package archives 
list.
+
 ** With =use-package=
 #+BEGIN_SRC emacs-lisp
   (use-package popper
-    :load-path "/path/to/popper/"                                   
+    :ensure t
     :bind (("C-`"   . popper-toggle-latest)
            ("M-`"   . popper-cycle)
            ("C-M-`" . popper-toggle-type))
@@ -58,7 +62,7 @@ There are three commands of note, you can bind them as 
convenient:
 #+END_SRC
 See [[*Customization][Customization]] for details on specifying buffer types 
as popups.
 
-** General
+** Without =use-package=
 #+BEGIN_SRC emacs-lisp
   (require 'popper)
   (setq popper-reference-buffers
@@ -93,6 +97,11 @@ To get started, customize this variable:
 
   There are other customization options, check the =popper= group.
 
+** Grouping popups by context
+Popper can group popups by "context", so that the popups available for display 
are limited to those that are relevant to the context in which 
=popper-toggle-latest= or =popper-cycle= is called. For example, when cycling 
popups from a project buffer, you may only want to see the popups (REPLs, help 
buffers and compilation output, say) that were spawned from buffers in that 
project. This is intended to approximate DWIM behavior, so that the most 
relevant popup in any context is never more  [...]
+
+Built in contexts include projects as defined in Emacs' built in =project.el= 
and =projectile=, as well as the default directory of a buffer. To set this, 
customize =popper-group-function=. You can also provide a custom function that 
takes no arguments, is executed in the context of a popup buffer and returns a 
string or symbol that represents the group/context it belongs to.
+
 **  Managing window placement
 In keeping with the principle of least surprise, all popups are shown in the 
same location: At the bottom of the frame. However this means you can't have 
more than one popup open at a time. You may also want more control over where 
individual popups appear. For example, you may want an IDE-like set-up, with 
all help windows open on the right, REPLs on top and compilation windows at the 
bottom. This is best done by customizing Emacs' =display-buffer-alist=. Since 
this is a [[https://www.g [...]
 
diff --git a/popper.el b/popper.el
index a1869b83e9..5e4f7a0720 100644
--- a/popper.el
+++ b/popper.el
@@ -130,14 +130,7 @@ Display Action Alists\") for details on the alist."
   :group 'popper
   :type 'function)
 
-;; (defcustom popper-group-function nil
-;;   "When non-nil, group popups by context.
-
-;; Contexts are determined by the value of `popper-popup-identifier' (which 
see). A context is any user-defined property (such as project root, directory, 
minor mode etc) that a group of popups share. This setting restricts the 
available popups in a context to those created in that context. For instance, 
only popups associated with a project are available to cycle when in a project 
buffer."
-;;   :group 'popper
-;;   :type 'boolean)
-
-(defcustom popper-group-function 'popper-popup-identifier-project
+(defcustom popper-group-function nil
   "Function that returns a popup context.
 
 When set to nil popups are not grouped by context.
@@ -150,15 +143,15 @@ from a regular buffer is restricted to its associated 
group.
 
 Built-in choices include
 
-`popper-popup-identifier-directory': Return project root or default directory.
-`popper-popup-identifier-project': Return project root using project.el.
-`popper-popup-identifier-projectile': Return project root using projectile."
+`popper-group-by-directory': Return project root or default directory.
+`popper-group-by-project': Return project root using project.el.
+`popper-group-by-projectile': Return project root using projectile."
   :group 'popper
   :type '(choice
           (const :tag "Don't group popups" nil)
-          (const :tag "Group by project (project.el)" 
popper-popup-identifier-project)
-          (const :tag "Group by project (projectile)" 
popper-popup-identifier-projectile)
-          (const :tag "Group by directory" popper-popup-identifier-directory)
+          (const :tag "Group by project (project.el)" popper-group-by-project)
+          (const :tag "Group by project (projectile)" 
popper-group-by-projectile)
+          (const :tag "Group by directory" popper-group-by-directory)
           (function :tag "Custom function")))
 
 (defvar popper-reference-names nil
@@ -215,7 +208,7 @@ This is intended to be used in `display-buffer-alist'."
       ('t (with-current-buffer buffer
             (memq popper-popup-status '(popup user-popup)))))))
 
-(defun popper-popup-identifier-directory ()
+(defun popper-group-by-directory ()
   "Return an identifier (default directory) to group popups.
 
 The project root is used if found by project, with the default
@@ -224,7 +217,7 @@ directory as a fall back."
            (project-root (project-current)))
       (expand-file-name default-directory)))
 
-(defun popper-popup-identifier-project ()
+(defun popper-group-by-project ()
   "Return an identifier (project root) to group popups."
   (unless (fboundp 'project-root)
     (user-error "Cannot find project directory to group popups.
@@ -232,7 +225,7 @@ directory as a fall back."
   `popper-group-function'"))
   (project-root (project-current)))
 
-(defun popper-popup-identifier-projectile ()
+(defun popper-group-by-projectile ()
   "Return an identifier to group popups.
 
 This returns the project root found using the projectile package."
@@ -287,10 +280,10 @@ Each element of the alist is a cons cell of the form 
(window . buffer)."
                             (funcall popper-group-function))
                           popper-buried-popup-alist
                           nil nil 'equal)
-                         (push (cons win buf)
-                               (cl-remove (cons win buf)
-                                          identifier-popups
-                                          :key 'cdr)))))
+                         (append (list (cons win buf))
+                                 (cl-remove (cons win buf)
+                                            identifier-popups
+                                            :key 'cdr)))))
            (setf (alist-get nil popper-buried-popup-alist)
                  (append closed-popups
                          (cl-set-difference (cdr (assoc nil 
popper-buried-popup-alist))
@@ -376,11 +369,14 @@ a popup buffer to open."
                                              (default-value 
'mode-line-format)))))))
 
 (defun popper-restore-mode-lines (win-buf-alist)
-  "Restore the default value of `mode-line-format' in
-popup-buffers in the list WIN-BUF-ALIST."
-  (dolist (winbuf win-buf-alist)
-    (with-current-buffer (cdr winbuf)
-      (setq mode-line-format (default-value 'mode-line-format)))))
+  "Restore the default value of `mode-line-format'.
+
+This applies to popup-buffers in the list WIN-BUF-ALIST."
+  (dolist (buf (mapcar 'cdr win-buf-alist))
+    (when (buffer-live-p buf)
+      (with-current-buffer buf
+        (setq mode-line-format (default-value 'mode-line-format))
+        (force-mode-line-update)))))
 
 (defun popper-bury-all ()
   "Bury all open popups."



reply via email to

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