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:50:20 +0100	[thread overview]
Message-ID: <87h66o3rar.fsf@daniel-mendler.de> (raw)
In-Reply-To: <87cyhc56wh.fsf@daniel-mendler.de> (Daniel Mendler's message of "Sat, 28 Dec 2024 13:27:58 +0100")

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

Daniel Mendler <mail@daniel-mendler.de> 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


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

From aed32b8dbf8fa0f17acc76ea2e444436bc347e12 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 | 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
   "<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,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


      reply	other threads:[~2024-12-28 12:50 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 ` bug#73047: 31; [PATCH] " Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-28 12:50   ` Daniel Mendler via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]

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=87h66o3rar.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.