From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "C. Calancha" Newsgroups: gmane.emacs.devel Subject: Ibuffer: Indicate when one buffer is locked Date: Wed, 15 Jun 2016 14:55:42 +0900 (JST) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: ger.gmane.org 1465970242 14851 80.91.229.3 (15 Jun 2016 05:57:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Jun 2016 05:57:22 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 15 07:57:15 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bD3pB-0004Mk-98 for ged-emacs-devel@m.gmane.org; Wed, 15 Jun 2016 07:57:13 +0200 Original-Received: from localhost ([::1]:39835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD3pA-0006lc-1w for ged-emacs-devel@m.gmane.org; Wed, 15 Jun 2016 01:57:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD3nr-0005yT-Dh for emacs-devel@gnu.org; Wed, 15 Jun 2016 01:55:52 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bD3nn-0006DV-9C for emacs-devel@gnu.org; Wed, 15 Jun 2016 01:55:50 -0400 Original-Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]:35860) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bD3nm-0006DN-Tg for emacs-devel@gnu.org; Wed, 15 Jun 2016 01:55:47 -0400 Original-Received: by mail-pf0-x242.google.com with SMTP id 62so978381pfd.3 for ; Tue, 14 Jun 2016 22:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:subject:message-id:user-agent:mime-version; bh=LKPkdnQCDqCaKo0GGubRGeJRZgW8mm76yZRS9pyyzxM=; b=VScc/d35r0YDIleBO1mLTsVrBKlXR4HuVrseAtFqWQ143x6qPiN1n12PpUitteB2+z wZPtob4eVP0tt6rsDOViGpk6jUiaITgVUkHGCd5kfeiuRImCFos7Lq/5ej/XhLNh/ksH x/FE0mT5HKVPI+H3+q0e1o7RG46n9jd4P8DljrmMX6vKHEPgrO3giiCX5vnWAE9ixiin DoGXxOKLx1ms0qprYADr40YRlmmnoOyE2Y3QWKXEyAW7xw6tulA8MB665DfnqdeBcTY5 tFs8qw0d0nJMJhCNW9SEvTolDAXRFzfz/YiEOvzVwsLEG4cvjdYlGKVu8QgYGrwn6sJM XljQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:subject:message-id:user-agent :mime-version; bh=LKPkdnQCDqCaKo0GGubRGeJRZgW8mm76yZRS9pyyzxM=; b=CcEQOFljipP3crDjvoiDdo419cV63ZJ8EQKRiC6hB4PnQniEbRVihswgkxQp2VVE4i M6/AzSzYUHBMN/4IG58rcjcCYtIDrzve37TDQoqCBQ4XdR7L77FqXRKCxeR3Gt+Th/wZ ksdiA4p0tVP9GAJbilH0YGuVklgi69kCX+Ho1T53bQg+Z5fFBvquE5LDnSJFB5JKW2QA CQtBcfT3jH9XEK9H7ylZOg5YmxFlDjiAh/O/y0GKmdjW1YhcYN+P9fLa+1Bsrt2kGZDW +m3lTaA3j3/TVgFB+v3C4uT62H1lk9LR6oGOvVIZFoFURQzBiyXux09O+oY0IPoG05th BK1A== X-Gm-Message-State: ALyK8tJXGiFGjDWlhxrinHVlUKiV9Rn4QbDAcDGW0+/3m5lIP1ZKqCkxPMy262PPzLrP/Q== X-Received: by 10.98.41.133 with SMTP id p127mr1946177pfp.18.1465970145584; Tue, 14 Jun 2016 22:55:45 -0700 (PDT) Original-Received: from calancha-pc (softbank126075177055.bbtec.net. [126.75.177.55]) by smtp.gmail.com with ESMTPSA id q127sm49543088pfb.34.2016.06.14.22.55.44 for (version=TLSv1/SSLv3 cipher=OTHER); Tue, 14 Jun 2016 22:55:45 -0700 (PDT) X-Google-Original-From: "C. Calancha" X-X-Sender: calancha@calancha-pc User-Agent: Alpine 2.20 (DEB 67 2015-01-07) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c00::242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:204374 Archived-At: Hi, The initial columns in Ibuffer are respectively: * mark (indicate the buffer is marked) * modified (indicate the buffer is modified) * read-only (indicate the buffer is read-only) After that is the column with the buffer names. I would like Ibuffer indicate when a buffer is locked as well. I suggest following patch: * First part adds a new column 'locked' right after 'read-only' column; this column displays ?L when the buffer is locked. * Second part of the patch introduce a face to display the locked buffers. Your opinions are very welcome. Tino ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; >From 098fa70e5d4a8346edbbf6878e5fdd970230e3cd Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Wed, 15 Jun 2016 13:40:48 +0900 Subject: [PATCH 1/2] * lisp/ibuffer.el: Add mark for locked buffers --- lisp/ibuffer.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 609524c..f9a11a8 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -71,7 +71,8 @@ ibuffer :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)) @@ -275,6 +276,12 @@ ibuffer-read-only-char :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-marked-char ?> "The character to display for marked buffers." :type 'character @@ -1721,6 +1728,12 @@ read-only (string ibuffer-read-only-char) " ")) +(define-ibuffer-column locked + (:name "L" :inline t) + (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) -- 2.8.1 >From 07fa2ffa954f349b0c9a6f4029c47a048b0e64c1 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Wed, 15 Jun 2016 14:05:56 +0900 Subject: [PATCH 2/2] * lisp/ibuffer.el: Add font for locked buffers --- lisp/ibuffer.el | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index f9a11a8..7bf2e31 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -159,7 +159,8 @@ ibuffer-fontification-alist (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 @@ -1720,6 +1721,15 @@ ibuffer-check-formats (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)) @@ -1729,7 +1739,7 @@ read-only " ")) (define-ibuffer-column locked - (:name "L" :inline t) + (:name "L" :inline t :props ('font-lock-face 'ibuffer-locked-buffer)) (if (and (boundp 'emacs-lock-mode) emacs-lock-mode) (string ibuffer-locked-char) " ")) -- 2.8.1