From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud Newsgroups: gmane.emacs.devel Subject: [Patch] Ibuffer filter display fix Date: Wed, 15 Jun 2022 17:04:34 +0200 Message-ID: <87tu8mt1bx.fsf@elite.giraud> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30701"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (berkeley-unix) To: "emacs-devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 15 17:28:04 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1Uw8-0007ks-2g for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Jun 2022 17:28:04 +0200 Original-Received: from localhost ([::1]:51510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1Uw7-0006HK-16 for ged-emacs-devel@m.gmane-mx.org; Wed, 15 Jun 2022 11:28:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1UZU-0005qZ-Gt for emacs-devel@gnu.org; Wed, 15 Jun 2022 11:04:40 -0400 Original-Received: from ledu-giraud.fr ([51.159.28.247]:48760) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1UZS-0003aD-5y for emacs-devel@gnu.org; Wed, 15 Jun 2022 11:04:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=cRWKemb6czPvgR1l mVJoBDJshKibhkAf/ygwOVVcwvU=; h=date:subject:to:from; d=ledu-giraud.fr; b=Iy1EfTonFN4NzzFWb5K1jZO9F3FYMLSLY7KZKubn5yr3E/JMpC iYbIgOV5Xc9cg1YE0iCkzVGyQxTm6BfJjfeR0ZfoKBr+zS75JCI2lHhnHh9HwUQN8iNCzz TeNTr6hAmEWgw4Ozdmoq3vH4SIB+SdRTTFgLp2rNs18HVWpfrPqIYxwbWlG2ZQAuHevt6B HBtDfRqGNLTaogoW2Lrl53NRgVflGt5YJRzs7Vn1FznM/21Fc/gv3fkTrlyDRp6sC6IBXH rU3bOeQuBeGK5aRDvRQyH2FaX3T3OCMFIFNqRcWpaGaDOvgellC4Ho7xajmW6Ez45uFu2N 2ikR1V8HTp1g== Original-Received: from elite.giraud ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id 137af9bb (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Wed, 15 Jun 2022 17:04:35 +0200 (CEST) Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:291215 Archived-At: --=-=-= Content-Type: text/plain Hi, In ibuffer, when using a filter without parameter (like `ibuffer-filter-by-visiting-file'), the header displays: "IBuffer by recency [visiting a file: nil]" The following patch get rid of the "nil" for filters that do not have a parameter: "IBuffer by recency [visiting a file]" --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Do-not-display-nil-for-0-ary-filter-qualifier.patch >From b141854b7e01520e3b760bf1ce7ff8b7e9a31de5 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Wed, 15 Jun 2022 15:53:09 +0200 Subject: [PATCH] Do not display 'nil for 0-ary filter qualifier * lisp/ibuf-ext.el (ibuffer-format-qualifier-1): do not display nil in header for 0-ary filter qualifier * lisp/ibuf-macs.el (define-ibuffer-filter): also fix the message --- lisp/ibuf-ext.el | 4 +++- lisp/ibuf-macs.el | 12 ++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 30b494f573..822ecbdd99 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -1211,7 +1211,9 @@ ibuffer-format-qualifier-1 (let ((type (assq (car qualifier) ibuffer-filtering-alist))) (unless qualifier (error "Ibuffer: Bad qualifier %s" qualifier)) - (concat " [" (cadr type) ": " (format "%s]" (cdr qualifier))))))) + (if (cdr qualifier) + (format " [%s: %s]" (cadr type) (cdr qualifier)) + (format " [%s]" (cadr type))))))) (defun ibuffer-list-buffer-modes (&optional include-parents) "Create a completion table of buffer modes currently in use. diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index 5d2dd47945..7a519e041a 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el @@ -321,10 +321,14 @@ define-ibuffer-filter (when (cdr qualifier) ; Compose individual filters with `or'. (setq ,filter `(or ,@(mapcar (lambda (m) (cons ',name m)) qualifier)))))) (if (null (ibuffer-push-filter ,filter)) - (message ,(format "Filter by %s already applied: %%s" description) - ,qualifier-str) - (message ,(format "Filter by %s added: %%s" description) - ,qualifier-str) + (if ,qualifier-str + (message ,(format "Filter by %s already applied: %%s" description) + ,qualifier-str) + (message ,(format "Filter by %s already applied" description))) + (if ,qualifier-str + (message ,(format "Filter by %s added: %%s" description) + ,qualifier-str) + (message ,(format "Filter by %s added" description))) (ibuffer-update nil t)))) (push (list ',name ,description (lambda (buf qualifier) -- 2.36.1 --=-=-= Content-Type: text/plain -- Manuel Giraud --=-=-=--