all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24880: 26.0.50; buff-menu: Command to unmark all buffers
@ 2016-11-05 10:04 Tino Calancha
  2016-11-05 10:17 ` Eli Zaretskii
  2016-11-22  6:30 ` Tino Calancha
  0 siblings, 2 replies; 12+ messages in thread
From: Tino Calancha @ 2016-11-05 10:04 UTC (permalink / raw)
  To: 24880


I miss in this package a command to unmark all buffers bound to 'U'.
How about the following?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 1b7ff2820bd9e342a9f27c645fe961c06afaefc8 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Sat, 5 Nov 2016 18:58:33 +0900
Subject: [PATCH] buff-menu: Command to unmark all buffers

* lisp/emacs-lisp/tabulated-list.el (tabulated-list-header-overlay-p):
New predicate; return non-nil if tabulated-list has a fake header.
* lisp/buff-menu.el (Buffer-menu-unmark-all):
New command; cancel all requested operations on buffers.  Bind it
to 'U'.
---
 lisp/buff-menu.el                 | 13 +++++++++++++
 lisp/emacs-lisp/tabulated-list.el |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 4742628..e920382 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -121,6 +121,7 @@ Buffer-menu-mode-map
     (define-key map "\177" 'Buffer-menu-backup-unmark)
     (define-key map "~" 'Buffer-menu-not-modified)
     (define-key map "u" 'Buffer-menu-unmark)
+    (define-key map "U" 'Buffer-menu-unmark-all)
     (define-key map "m" 'Buffer-menu-mark)
     (define-key map "t" 'Buffer-menu-visit-tags-table)
     (define-key map "%" 'Buffer-menu-toggle-read-only)
@@ -356,6 +357,18 @@ Buffer-menu-unmark
   (Buffer-menu--unmark)
   (forward-line (if backup -1 1)))
 
+(defun Buffer-menu-unmark-all ()
+  "Cancel all requested operations on buffers."
+  (interactive)
+  (save-excursion
+    (goto-char (point-min))
+    (when (tabulated-list-header-overlay-p)
+      (forward-line))
+    (while (not (eobp))
+      (unless (string= "." (aref (tabulated-list-get-entry) 0))
+        (tabulated-list-set-col 0 " " t))
+      (forward-line))))
+
 (defun Buffer-menu-backup-unmark ()
   "Move up and cancel all requested operations on buffer on line above."
   (interactive)
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index 00b029d..2757feb 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -257,6 +257,12 @@ tabulated-list-print-fake-header
                     (make-overlay (point-min) (point))))
       (overlay-put tabulated-list--header-overlay 'face 'underline))))
 
+(defsubst tabulated-list-header-overlay-p (&optional pos)
+  "Return non-nil if there is a fake header.
+Optional arg POS is a buffer position where to look for a fake header;
+defaults to `point-min'."
+  (overlays-at (or pos (point-min))))
+
 (defun tabulated-list-revert (&rest ignored)
   "The `revert-buffer-function' for `tabulated-list-mode'.
 It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'."
-- 
2.10.1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.2)
 of 2016-11-05 built on calancha-pc
Repository revision: f95bf3cd1f55cf8f99b88c7318c21c967b11dfd1





^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2016-11-22  6:30 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-05 10:04 bug#24880: 26.0.50; buff-menu: Command to unmark all buffers Tino Calancha
2016-11-05 10:17 ` Eli Zaretskii
2016-11-06 12:21   ` Tino Calancha
2016-11-06 17:22     ` Drew Adams
2016-11-14 10:29       ` Tino Calancha
2016-11-15 16:03         ` Eli Zaretskii
2016-11-16 10:09           ` Tino Calancha
2016-11-18 10:09             ` Eli Zaretskii
2016-11-18 10:17               ` Tino Calancha
2016-11-18 11:05                 ` Eli Zaretskii
2016-11-07 18:38     ` Eli Zaretskii
2016-11-22  6:30 ` Tino Calancha

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.