emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 0e8d344 2/2: Merge branch 'master' of git.sv.gnu.or


From: Michael Albinus
Subject: [Emacs-diffs] master 0e8d344 2/2: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Thu, 7 Jul 2016 16:51:18 +0000 (UTC)

branch: master
commit 0e8d3445a73bc190b0203b2571999ea5f5116ef2
Merge: 7f8e742 44517b2
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 etc/NEWS         |    9 +++++++++
 lisp/ibuf-ext.el |   18 ++++++++++++++++++
 lisp/ibuffer.el  |   33 +++++++++++++++++++++++++++++++--
 3 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 87ffb43..deb1889 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -199,6 +199,15 @@ same as in modes where the character is not whitespace.
 ** Ibuffer
 
 ---
+*** A new command 'ibuffer-mark-by-locked' to mark
+all locked buffers;  bound to '% L'.
+
+---
+*** A new option 'ibuffer-locked-char' to indicate
+locked buffers; Ibuffer shows a new column displaying
+'ibuffer-locked-char' for locked buffers.
+
+---
 *** A new command 'ibuffer-unmark-all-marks' to unmark
 all buffers without asking confirmation;  bound to
 'U'; 'ibuffer-do-replace-regexp' bound to 'r'.
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 72fa862..2444dac 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1484,6 +1484,24 @@ You can then feed the file name(s) to other commands 
with \\[yank]."
    #'(lambda (buf)
        (string-match regexp (buffer-name buf)))))
 
+(defun ibuffer-locked-buffer-p (&optional buf)
+  "Return non-nil if BUF is locked.
+When BUF nil, default to the buffer at current line."
+  (let ((_buffer (or buf (ibuffer-current-buffer)))
+        char)
+    (when _buffer
+      (with-current-buffer _buffer
+        (and (boundp 'emacs-lock-mode) emacs-lock-mode)))))
+
+;;;###autoload
+(defun ibuffer-mark-by-locked ()
+  "Mark all locked buffers."
+  (interactive)
+  (when (featurep 'emacs-lock)
+    (ibuffer-mark-on-buffer
+     (lambda (buf)
+       (ibuffer-locked-buffer-p buf)))))
+
 ;;;###autoload
 (defun ibuffer-mark-by-mode-regexp (regexp)
   "Mark all buffers whose major mode matches REGEXP."
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index ae22bd7..d67f95f 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -71,7 +71,8 @@ and filter displayed buffers by various criteria."
   :version "22.1"
   :group 'convenience)
 
-(defcustom ibuffer-formats '((mark modified read-only " " (name 18 18 :left 
:elide)
+(defcustom ibuffer-formats '((mark modified read-only locked
+                                   " " (name 18 18 :left :elide)
                                   " " (size 9 -1 :right)
                                   " " (mode 16 16 :left :elide) " " 
filename-and-process)
                             (mark " " (name 16 -1) " " filename))
@@ -137,6 +138,7 @@ value for this variable would be
 
 Using \\[ibuffer-switch-format], you can rotate the display between
 the specified formats in the list."
+  :version "25.2"
   :type '(repeat sexp)
   :group 'ibuffer)
 
@@ -158,7 +160,8 @@ elisp byte-compiler."
             (null buffer-file-name))
        italic)
     (30 (memq major-mode ibuffer-help-buffer-modes) font-lock-comment-face)
-    (35 (derived-mode-p 'dired-mode) font-lock-function-name-face))
+    (35 (derived-mode-p 'dired-mode) font-lock-function-name-face)
+    (40 (and (boundp 'emacs-lock-mode) emacs-lock-mode) ibuffer-locked-buffer))
   "An alist describing how to fontify buffers.
 Each element should be of the form (PRIORITY FORM FACE), where
 PRIORITY is an integer, FORM is an arbitrary form to evaluate in the
@@ -280,6 +283,12 @@ Note that this specialized filtering occurs before real 
filtering."
   :type 'character
   :group 'ibuffer)
 
+(defcustom ibuffer-locked-char ?L
+  "The character to display for locked buffers."
+  :version "25.2"
+  :type 'character
+  :group 'ibuffer)
+
 (defcustom ibuffer-deletion-char ?D
   "The character to display for buffers marked for deletion."
   :type 'character
@@ -547,6 +556,7 @@ directory, like `default-directory'."
     (define-key map (kbd "% m") 'ibuffer-mark-by-mode-regexp)
     (define-key map (kbd "% f") 'ibuffer-mark-by-file-name-regexp)
     (define-key map (kbd "% g") 'ibuffer-mark-by-content-regexp)
+    (define-key map (kbd "% L") 'ibuffer-mark-by-locked)
 
     (define-key map (kbd "C-t") 'ibuffer-visit-tags-table)
 
@@ -773,6 +783,9 @@ directory, like `default-directory'."
       '(menu-item "Mark by content (regexp)..."
         ibuffer-mark-by-content-regexp
         :help "Mark buffers whose content matches a regexp"))
+    (define-key-after map [menu-bar mark mark-by-locked]
+      '(menu-item "Mark by locked buffers..." ibuffer-mark-by-locked
+        :help "Mark all locked buffers"))
 
     map))
 
@@ -1725,6 +1738,15 @@ If point is on a group name, this function operates on 
that group."
 
 (defvar ibuffer-inline-columns nil)
 
+(defface ibuffer-locked-buffer
+  '((((background dark)) (:foreground "RosyBrown"))
+    (t (:foreground "brown4")))
+  "*Face used for locked buffers in Ibuffer."
+  :version "25.2"
+  :group 'ibuffer
+  :group 'font-lock-highlighting-faces)
+(defvar ibuffer-locked-buffer 'ibuffer-locked-buffer)
+
 (define-ibuffer-column mark (:name " " :inline t)
   (string mark))
 
@@ -1733,6 +1755,12 @@ If point is on a group name, this function operates on 
that group."
       (string ibuffer-read-only-char)
     " "))
 
+(define-ibuffer-column locked
+  (:name "L" :inline t :props ('font-lock-face 'ibuffer-locked-buffer))
+  (if (and (boundp 'emacs-lock-mode) emacs-lock-mode)
+      (string ibuffer-locked-char)
+    " "))
+
 (define-ibuffer-column modified (:name "M" :inline t)
   (if (buffer-modified-p)
       (string ibuffer-modified-char)
@@ -2452,6 +2480,7 @@ Marking commands:
   `\\[ibuffer-mark-by-mode-regexp]' - Mark buffers by their major mode, using 
a regexp.
   `\\[ibuffer-mark-by-file-name-regexp]' - Mark buffers by their filename, 
using a regexp.
   `\\[ibuffer-mark-by-content-regexp]' - Mark buffers by their content, using 
a regexp.
+  `\\[ibuffer-mark-by-locked]' - Mark all locked buffers.
 
 Filtering commands:
 



reply via email to

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