all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Mendler via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 73047@debbugs.gnu.org
Cc: JD Smith <jdtsmith@gmail.com>
Subject: bug#73047: 31; [PATCH] - add recency column to ibuffer
Date: Sat, 28 Dec 2024 13:27:58 +0100	[thread overview]
Message-ID: <87cyhc56wh.fsf@daniel-mendler.de> (raw)
In-Reply-To: <87tteuglx2.fsf@daniel-mendler.de> (Daniel Mendler's message of "Thu, 05 Sep 2024 17:28:09 +0200")

[-- Attachment #1: Type: text/plain, Size: 145 bytes --]

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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ibuffer-Define-recency-column.patch --]
[-- Type: text/x-diff, Size: 1719 bytes --]

From 33b5a0880cf7fe4e002d1c9f73bc20e79d77317e Mon Sep 17 00:00:00 2001
From: Daniel Mendler <mail@daniel-mendler.de>
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
   "<mouse-1>"      #'ibuffer-do-sort-by-major-mode)
 
+(defvar-keymap ibuffer-recency-header-map
+  "<mouse-1>"      #'ibuffer-do-sort-by-recency)
+
 (defvar-keymap ibuffer-mode-filter-group-map
   "<mouse-1>"      #'ibuffer-mouse-toggle-mark
   "<mouse-2>"      #'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


  parent reply	other threads:[~2024-12-28 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 15:28 bug#73047: 30.0.90; feature request - add recency column to ibuffer Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-05 16:36 ` JD Smith
2024-09-05 17:00   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-28 12:27 ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-28 12:50   ` bug#73047: 31; [PATCH] " Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cyhc56wh.fsf@daniel-mendler.de \
    --to=bug-gnu-emacs@gnu.org \
    --cc=73047@debbugs.gnu.org \
    --cc=jdtsmith@gmail.com \
    --cc=mail@daniel-mendler.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.