bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#23680: 25.1.50; ibuffer: unmark all buffers without confirmation


From: Tino Calancha
Subject: bug#23680: 25.1.50; ibuffer: unmark all buffers without confirmation
Date: Thu, 2 Jun 2016 23:41:39 +0900 (JST)
User-agent: Alpine 2.20 (LRH 67 2015-01-07)


It is a nuisance to be asked for confirmation whenever
an user wants to unmark all buffers.

I)
The patch follow same approach as Dired: introduce a new
command which unmark all buffers without confirmation.

II)
It is easier to remember if Ibuffer use the same bindings as
the Dired analog commands.  This patch rebind 'U' to the new
command introduced in I); for 'ibuffer-do-replace-regexp',
originally bound to 'U', prefers 'r'.

In GNU Emacs 25.1.50 (x86_64-pc-linux-gnu, GTK+ Version 3.20.5)
Repository revision: 6b985764f07ae164d8142ba64774f2beb2856ca8


From e3414a65e775a1de542e81fbb3c2b80dd381c446 Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Thu, 2 Jun 2016 23:13:54 +0900
Subject: [PATCH 1/2] Ibuffer: unmark all buffers without confirmation

* lisp/ibuffer.el (ibuffer-unmark-all-marks): New command.
(ibuffer-mouse-popup-menu, ibuffer-mode): Use it.
(ibuffer-mode-map): Bind it to '**' and 'M-DEL'.
---
 lisp/ibuffer.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index dd2687c..20b224c 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -469,8 +469,8 @@ ibuffer-mode-map
     (define-key map (kbd "M-s a M-C-s") 'ibuffer-do-isearch-regexp)
     (define-key map (kbd "M-s a C-o") 'ibuffer-do-occur)
     (define-key map (kbd "DEL") 'ibuffer-unmark-backward)
-    (define-key map (kbd "M-DEL") 'ibuffer-unmark-all)
-    (define-key map (kbd "* *") 'ibuffer-unmark-all)
+    (define-key map (kbd "M-DEL") 'ibuffer-unmark-all-marks)
+    (define-key map (kbd "* *") 'ibuffer-unmark-all-marks)
     (define-key map (kbd "* M") 'ibuffer-mark-by-mode)
     (define-key map (kbd "* m") 'ibuffer-mark-modified-buffers)
     (define-key map (kbd "* u") 'ibuffer-mark-unsaved-buffers)
@@ -749,8 +749,8 @@ ibuffer-mode-map
     (define-key-after map [menu-bar mark mark-old-buffers]
       '(menu-item "Mark old buffers" ibuffer-mark-old-buffers
         :help "Mark buffers which have not been viewed recently"))
-    (define-key-after map [menu-bar mark unmark-all]
-      '(menu-item "Unmark All" ibuffer-unmark-all))
+    (define-key-after map [menu-bar mark unmark-all-marks]
+      '(menu-item "Unmark All buffers" ibuffer-unmark-all-marks))

     (define-key-after map [menu-bar mark dashes]
       '("--"))
@@ -967,8 +967,7 @@ ibuffer-mouse-popup-menu
              (popup-menu ibuffer-mode-groups-popup))
          (let ((inhibit-read-only t))
            (ibuffer-save-marks
-             ;; hm.  we could probably do this in a better fashion
-             (ibuffer-unmark-all ?\r)
+             (ibuffer-unmark-all-marks)
              (save-excursion
                (goto-char eventpt)
                (ibuffer-set-mark ibuffer-marked-char))
@@ -1329,6 +1328,12 @@ ibuffer-unmark-all
         t)))))
   (ibuffer-redisplay t))

+(defun ibuffer-unmark-all-marks ()
+  "Remove all marks from all marked buffers in Ibuffer."
+  (interactive)
+  ;; hm.  we could probably do this in a better fashion
+  (ibuffer-unmark-all ?\r))
+
 (defun ibuffer-toggle-marks (&optional group)
   "Toggle which buffers are marked.
 In other words, unmarked buffers become marked, and marked buffers
@@ -2419,7 +2424,7 @@ ibuffer-mode
   `\\[ibuffer-unmark-forward]' - Unmark the buffer at point.
   `\\[ibuffer-unmark-backward]' - Unmark the buffer at point, and move to the
           previous line.
-  `\\[ibuffer-unmark-all]' - Unmark all marked buffers.
+  `\\[ibuffer-unmark-all-marks]' - Unmark all marked buffers.
   `\\[ibuffer-mark-by-mode]' - Mark buffers by major mode.
   `\\[ibuffer-mark-unsaved-buffers]' - Mark all \"unsaved\" buffers.
           This means that the buffer is modified, and has an associated file.
--
2.8.1

From a494c157111c3146c891a77e6b6d860b6bf2c702 Mon Sep 17 00:00:00 2001
From: Tino Calancha <address@hidden>
Date: Thu, 2 Jun 2016 23:14:31 +0900
Subject: [PATCH 2/2] Bind ibuffer-unmark-all-marks to U

* lisp/ibuffer.el (ibuffer-mode-map):
Rebind 'ibuffer-do-replace-regexp' to 'r'.
---
 lisp/ibuffer.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 20b224c..95b9b8e 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -470,6 +470,7 @@ ibuffer-mode-map
     (define-key map (kbd "M-s a C-o") 'ibuffer-do-occur)
     (define-key map (kbd "DEL") 'ibuffer-unmark-backward)
     (define-key map (kbd "M-DEL") 'ibuffer-unmark-all-marks)
+    (define-key map (kbd "U") 'ibuffer-unmark-all-marks)
     (define-key map (kbd "* *") 'ibuffer-unmark-all-marks)
     (define-key map (kbd "* M") 'ibuffer-mark-by-mode)
     (define-key map (kbd "* m") 'ibuffer-mark-modified-buffers)
@@ -566,7 +567,7 @@ ibuffer-mode-map
     (define-key map (kbd "R") 'ibuffer-do-rename-uniquely)
     (define-key map (kbd "S") 'ibuffer-do-save)
     (define-key map (kbd "T") 'ibuffer-do-toggle-read-only)
-    (define-key map (kbd "U") 'ibuffer-do-replace-regexp)
+    (define-key map (kbd "r") 'ibuffer-do-replace-regexp)
     (define-key map (kbd "V") 'ibuffer-do-revert)
     (define-key map (kbd "W") 'ibuffer-do-view-and-eval)
     (define-key map (kbd "X") 'ibuffer-do-shell-command-pipe)
--
2.8.1






reply via email to

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