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

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

[elpa] externals/blist c5aadbce3b: new function to toggle other groups


From: ELPA Syncer
Subject: [elpa] externals/blist c5aadbce3b: new function to toggle other groups
Date: Thu, 1 Sep 2022 02:57:21 -0400 (EDT)

branch: externals/blist
commit c5aadbce3b713a2a9e7dba8c3c0881c43ebb2b4d
Author: JSDurand <mmemmew@gmail.com>
Commit: JSDurand <mmemmew@gmail.com>

    new function to toggle other groups
    
    * blist.el (blist-toggle-other-groups): A new function to toggle the
      visibility of all other groups than the group at which the cursor
      currently sits.
---
 ChangeLog |  6 ++++++
 blist.el  | 24 ++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d1bba764e3..959fab236b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-01  Durand  <mmemmew@gmail.com>
+
+       * blist.el: (blist-toggle-other-groups): New function to toggle
+       the visibility of all other groups than the group at which the
+       cursor is currently.
+
 2021-12-29  Stefan Monnier <monnier@iro.umontreal.ca>
 
        Correct the uses of unnecessary autoload cookies.
diff --git a/blist.el b/blist.el
index ed96ac7472..637c5b9beb 100644
--- a/blist.el
+++ b/blist.el
@@ -4,7 +4,7 @@
 
 ;; Author: Durand <mmemmew@gmail.com>
 ;; Keywords: convenience
-;; Version: 0.1
+;; Version: 0.2
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -646,6 +646,7 @@ used as a `revert-buffer-function'."
   (define-key map (vector 'tab) #'blist-next-group)
   (define-key map (vector 'backtab) #'blist-prev-group)
   (define-key map (vector 'return) #'blist-return)
+  (define-key map (vector 'S-return) #'blist-toggle-other-groups)
   (define-key map (vector ?o) #'blist-open-other-window)
   (define-key map (vector ?v) #'blist-select)
   (define-key map (vector ?r) #'blist-rename)
@@ -1441,7 +1442,26 @@ get unique numeric suffixes \"<2>\", \"<3>\", etc."
    ((ilist-get-index) (blist-open))
    ((user-error "Nothing to do here"))))
 
-;; TODO: Hide all other groups
+;;;; Hide all other groups than the current group
+
+(defun blist-toggle-other-groups ()
+  "Toggle all other groups than the current one."
+  (interactive)
+  (blist-assert-mode)
+  (let ((current-group (ilist-get-group)))
+    (cond
+     (current-group
+      (ilist-map-lines
+       (lambda ()
+         (blist-toggle-group))
+       (lambda ()
+         (let ((group (ilist-get-group)))
+           (and group (not (string= group current-group)))))))
+     ((ilist-get-index)
+      (save-excursion
+        (blist-next-group -1)
+        (blist-toggle-other-groups)))
+     ((user-error "Not at a group header or item")))))
 
 ;;;; Toggle location display
 



reply via email to

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