GNU bug report logs - #25577
26.0.50; Show Ibuffer and jump to line listing current buffer

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Mon, 30 Jan 2017 11:31:01 UTC

Severity: wishlist

Found in version 26.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25577 in the body.
You can then email your comments to 25577 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25577; Package emacs. (Mon, 30 Jan 2017 11:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 30 Jan 2017 11:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; Show Ibuffer and jump to line listing current buffer
Date: Mon, 30 Jan 2017 20:30:04 +0900
Severity: wishlist

Suppose current buffer is *foo*, then `list-buffers'
list the buffers with point set at the line listing *foo*.

In the case of `ibuffer', if *Ibuffer* already exists,
the effect of this command is pretty much like
(switch-to-buffer "*Ibuffer*")
i.e., the point is preserved.  This is useful, but quite often
i wish the other behaviour:
To show *Ibuffer* and set point at the line listing *foo*.

This is handy when you have customized `ibuffer-saved-filter-groups',
and you have many lived buffers.

We might get this behaviour in several ways:

1) Via prefix argument: we already use a raw prefix to decide if we
   display *Ibuffer* in a new window or in the current one.
   It might be possible to define prefix "C-u C-u" to mean
   show *Ibuffer* with point at the line showing *foo*.
   This would work but not the easiest to type solution, though.

2) Add a new function:
  (defun ibuffer-jump (&optional other-window-p)
    "Call Ibuffer and set point at the line listing the current buffer."
    (interactive "P")
    (let ((name (buffer-name)))
      (ibuffer other-window-p)
      (ignore-errors (ibuffer-jump-to-buffer name))))

3) Add a new option, something like
  `ibuffer-point-at-current-buffer'.
  When this option is not nil, then `ibuffer' set
  point at *foo*.

I prefer 2) over 3) because i can get both behaviours with easy
in the interactive session.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 5630bf7425ed0114cd1bae55f9761f351b951f5f Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Mon, 30 Jan 2017 20:21:14 +0900
Subject: [PATCH] Show Ibuffer and jump to line listing current buffer

* lisp/ibuffer.el (ibuffer-jump): New command (Bug#25577).
* etc/NEWS: Add entry for the new command.
---
 etc/NEWS        | 2 ++
 lisp/ibuffer.el | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 12ff21f39a..b61bbe3b36 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -361,6 +361,8 @@ added: `C-c C-s C-m C-m'.
 ** Ibuffer
 
 ---
+*** New command `ibuffer-jump'.
+---
 *** New filter commands `ibuffer-filter-by-basename',
 `ibuffer-filter-by-file-extension', `ibuffer-filter-by-directory',
 `ibuffer-filter-by-starred-name', `ibuffer-filter-by-modified'
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index c6e5e471a3..8a6040c1aa 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -2490,6 +2490,15 @@ ibuffer
 	(unless ibuffer-expert
 	  (message "Commands: m, u, t, RET, g, k, S, D, Q; q to quit; h for help"))))))
 
+;;;###autoload
+(defun ibuffer-jump (&optional other-window)
+  "Call Ibuffer and set point at the line listing the current buffer.
+If optional arg OTHER-WINDOW is non-nil, then use another window."
+  (interactive "P")
+  (let ((name (buffer-name)))
+    (ibuffer other-window-p)
+    (ignore-errors (ibuffer-jump-to-buffer name))))
+
 (put 'ibuffer-mode 'mode-class 'special)
 (define-derived-mode ibuffer-mode special-mode "IBuffer"
   "A major mode for viewing a list of buffers.
-- 
2.11.0

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.6)
 of 2017-01-29
Repository revision: 8ba236e772b64d0bb021aa691bd7eacf4b7f3ae4




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25577; Package emacs. (Tue, 31 Jan 2017 06:11:02 GMT) Full text and rfc822 format available.

Message #8 received at 25577 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 25577 <at> debbugs.gnu.org
Cc: Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#25577: 26.0.50;
 Show Ibuffer and jump to line listing current buffer
Date: Tue, 31 Jan 2017 15:10:24 +0900
Tino Calancha <tino.calancha <at> gmail.com> writes:

> Suppose current buffer is *foo*, then `list-buffers'
> list the buffers with point set at the line listing *foo*.
>
> In the case of `ibuffer', if *Ibuffer* already exists,
> the effect of this command is pretty much like
> (switch-to-buffer "*Ibuffer*")
> i.e., the point is preserved.  This is useful, but quite often
> i wish the other behaviour:
> To show *Ibuffer* and set point at the line listing *foo*.
>
> This is handy when you have customized `ibuffer-saved-filter-groups',
> and you have many lived buffers.
To see more clear what i mean, try the following:
emacs -Q lisp/subr.el src/data.c

M-x ibuffer RET
M-x ibuffer-set-filter-groups-by-mode RET
j data.c RET RET ; Visiting data.c.
C-x o; Visiting subr.el
M-x ibuffer RET ; point still at data.c.

When you have many live buffers, you might
prefer that `ibuffer' automatically jump to the
line showing the current buffer.




Reply sent to Tino Calancha <tino.calancha <at> gmail.com>:
You have taken responsibility. (Tue, 28 Feb 2017 02:55:02 GMT) Full text and rfc822 format available.

Notification sent to Tino Calancha <tino.calancha <at> gmail.com>:
bug acknowledged by developer. (Tue, 28 Feb 2017 02:55:02 GMT) Full text and rfc822 format available.

Message #13 received at 25577-done <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 25577-done <at> debbugs.gnu.org
Subject: Re: bug#25577: 26.0.50;
 Show Ibuffer and jump to line listing current buffer
Date: Tue, 28 Feb 2017 11:54:33 +0900
Tino Calancha <tino.calancha <at> gmail.com> writes:

>> This is handy when you have customized `ibuffer-saved-filter-groups',
>> and you have many lived buffers.
> To see more clear what i mean, try the following:
> emacs -Q lisp/subr.el src/data.c
>
> M-x ibuffer RET
> M-x ibuffer-set-filter-groups-by-mode RET
> j data.c RET RET ; Visiting data.c.
> C-x o; Visiting subr.el
> M-x ibuffer RET ; point still at data.c.
>
> When you have many live buffers, you might
> prefer that `ibuffer' automatically jump to the
> line showing the current buffer.
Added new command in master branch as commit:
0e355e781616936759cff8e6a46adb01760d4211




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 28 Mar 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 84 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.