unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tino Calancha <tino.calancha@gmail.com>
To: 24880@debbugs.gnu.org
Subject: bug#24880: 26.0.50; buff-menu: Command to unmark all buffers
Date: Sat, 05 Nov 2016 19:04:15 +0900	[thread overview]
Message-ID: <871syqnsyo.fsf@gmail.com> (raw)


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





             reply	other threads:[~2016-11-05 10:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-05 10:04 Tino Calancha [this message]
2016-11-05 10:17 ` bug#24880: 26.0.50; buff-menu: Command to unmark all buffers 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871syqnsyo.fsf@gmail.com \
    --to=tino.calancha@gmail.com \
    --cc=24880@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).