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:50:20 +0100 Message-ID: <87h66o3rar.fsf@daniel-mendler.de> References: <87tteuglx2.fsf@daniel-mendler.de> <87cyhc56wh.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="10452"; 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:51:27 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 1tRWHv-0002bw-LE for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Dec 2024 13:51:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRWHe-0006NY-05; Sat, 28 Dec 2024 07:51:10 -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 1tRWHX-0006N6-QD for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 07:51:03 -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 1tRWHX-00048v-Hv for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 07:51: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=jnsPVSjr9Q+tOMzefc7wAJTIwgyAoc8gbQM4/5TpLCo=; b=QuuddZ0LHi4wNBr7iI5kc/JF/YxJSQUs46yg6gUnlEVftIAD0y+CdNlrDmHMe4Oe9k+xnBZq3uPXIzSxZ8v7LsgGPAH0xldyDSfSW8dPOggQTynDEm1n4BZIV1w7TFTkotaj7pDhi3RQm7OvKFng9q9a9UfE67EF0uwBWXaO32ho/yXLHQ2UgR1/Zzig/jtPlVon4lNzQgoUYNGCM1xKLi68tbs2/raVHEVG7+aJwhMsYpVO6NszNfVraRcsCVXTk3agBQ3q4DqBuz9FLnBKdzdS1jg8U6a/B09kNQ/VjV+picDhV276n2BRLXufswZoqSg2SbaF9IiLchrPm+bsNw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tRWHW-0003OW-DK for bug-gnu-emacs@gnu.org; Sat, 28 Dec 2024 07:51:02 -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:51:02 +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.173539023113004 (code B ref 73047); Sat, 28 Dec 2024 12:51:02 +0000 Original-Received: (at 73047) by debbugs.gnu.org; 28 Dec 2024 12:50:31 +0000 Original-Received: from localhost ([127.0.0.1]:49719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRWH0-0003Ng-Mu for submit@debbugs.gnu.org; Sat, 28 Dec 2024 07:50:30 -0500 Original-Received: from server.qxqx.de ([49.12.34.165]:53295 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRWGy-0003NM-90 for 73047@debbugs.gnu.org; Sat, 28 Dec 2024 07:50:29 -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=jnsPVSjr9Q+tOMzefc7wAJTIwgyAoc8gbQM4/5TpLCo=; b=VlghZ59ty0bFzziw/y3WUCar7Z W6DnVA3DKy/13LWf+CBIAurhjqNo2GmLZ7Te3+iRPGplxEPKxH+Z/1pf8K42ko0wqv4FB07AzP8jC vGi7PmU0ksMZ1JLsQG8mHkuAIj4Av4YFHfFesu65WaeFn07jNOIY+OMiC6ZEjwJTULnY=; In-Reply-To: <87cyhc56wh.fsf@daniel-mendler.de> (Daniel Mendler's message of "Sat, 28 Dec 2024 13:27:58 +0100") 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:297901 Archived-At: --=-=-= Content-Type: text/plain Daniel Mendler writes: > 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. Please disregard the earlier patch, which was a wrong version. I've attached a better patch to this mail. Thanks. Daniel --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ibuffer-Define-recency-column.patch >From aed32b8dbf8fa0f17acc76ea2e444436bc347e12 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 405fb98d4d4..4f849bed27b 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,13 @@ 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 time)) t t)) + "never")) + (define-ibuffer-column mode (:inline t :header-mouse-map ibuffer-mode-header-map -- 2.45.2 --=-=-=--