From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#73047: 31; [PATCH] - add recency column to ibuffer Date: Sat, 28 Dec 2024 13:27:58 +0100 Message-ID: <87cyhc56wh.fsf@daniel-mendler.de> References: <87tteuglx2.fsf@daniel-mendler.de> Reply-To: Daniel Mendler 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="24641"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: JD Smith To: 73047@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 28 13:31:26 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1tRVyX-0006HI-AL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Dec 2024 13:31:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRVyF-0004Ak-3x; Sat, 28 Dec 2024 07:31:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRVyD-0004AR-3D for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 07:31:05 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRVy9-0000Aq-Uy for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 07:31:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=wRTWPQiTn5FrQxNzNnSW1d9V6hFyaYSVU+VKFzHbrbM=; b=Pw6L65HmY3EMVpHRCAbCSgyje1Hwf9Mc9C4JkldIYil4T57iLOVHMRcVQ2tQHaSNexGcBUIaKJKzR1/LVv22x8nwbfMoea1GFafTPoP5gw5VUZFD3zIHUiwAqZ0S+l3CZ1D6xm7eg94i+2g3qL7L+tCHMos8m7uxhYHmTHR+pqXd+j0AFZV1v/pc02TFw0ByIXswKdBLYYlmORKEjgrz0gG4f8eFpCwjnipXZN5shNjV0+Wr37jSOHMMGTd+aPdX95PYdCLFwDhuoNSDGm/nYLKbkw2Quh2Nf+goKixNgicAP63mJF+lfIYcDunij2QAozU/cNCd43wQU5rQ38TRAg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRVy9-0002Ss-Pm for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 07:31:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Dec 2024 12:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73047 X-GNU-PR-Package: emacs Original-Received: via spool by 73047-submit@debbugs.gnu.org id=B73047.17353890199393 (code B ref 73047); Sat, 28 Dec 2024 12:31:01 +0000 Original-Received: (at 73047) by debbugs.gnu.org; 28 Dec 2024 12:30:19 +0000 Original-Received: from localhost ([127.0.0.1]:49675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRVxS-0002RK-La for submit@debbugs.gnu.org; Sat, 28 Dec 2024 07:30:19 -0500 Original-Received: from server.qxqx.de ([49.12.34.165]:35355 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRVxQ-0002LW-8o for 73047@debbugs.gnu.org; Sat, 28 Dec 2024 07:30:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=daniel-mendler.de; s=key; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=wRTWPQiTn5FrQxNzNnSW1d9V6hFyaYSVU+VKFzHbrbM=; b=ubCFbrMEPrs6GdVe/VD64qMo1T sI0cEr0hEh8Nnd9xPJW7iw63btlnBQKhT6U/xqJX2LuhZu4eru7jZkZmjgQrnwE0p+Y3/nS1ypOMd qJPSoJMdu0RQIAx6sMxiSIUOQBpj4er908pij3lC8uiq/HzgqT5k39QpVrH6oIreqmhU=; In-Reply-To: <87tteuglx2.fsf@daniel-mendler.de> (Daniel Mendler's message of "Thu, 05 Sep 2024 17:28:09 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:297897 Archived-At: --=-=-= Content-Type: text/plain I've attached a patch to this mail which adds a recency column to Ibuffer. It uses the `seconds-to-string' function with the READABLE argument. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ibuffer-Define-recency-column.patch >From 33b5a0880cf7fe4e002d1c9f73bc20e79d77317e Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sat, 28 Dec 2024 13:21:46 +0100 Subject: [PATCH] ibuffer: Define recency column Define a column which shows how many seconds ago the respective buffer has been displayed. The time is formatted with the `seconds-to-string' function, with the new arguments READABLE=t and ABBREV=t. * lisp/ibuffer.el (ibuffer-recency-header-map): New keymap. (define-ibuffer-column recency): New column. --- lisp/ibuffer.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 405fb98d4d4..10e26cba589 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -775,6 +775,9 @@ ibuffer-size-header-map (defvar-keymap ibuffer-mode-header-map "" #'ibuffer-do-sort-by-major-mode) +(defvar-keymap ibuffer-recency-header-map + "" #'ibuffer-do-sort-by-recency) + (defvar-keymap ibuffer-mode-filter-group-map "" #'ibuffer-mouse-toggle-mark "" #'ibuffer-mouse-toggle-filter-group @@ -1721,6 +1724,16 @@ size (format "%.0f" total)))) (format "%s" (buffer-size))) +(define-ibuffer-column recency + (:inline t :summarizer ignore :header-mouse-map ibuffer-recency-header-map) + (if-let ((time (buffer-local-value 'buffer-display-time buffer))) + (format "%s ago" (seconds-to-string + (float-time + (time-since + (buffer-local-value 'buffer-display-time buffer))) + t t)) + "never")) + (define-ibuffer-column mode (:inline t :header-mouse-map ibuffer-mode-header-map -- 2.45.2 --=-=-=--