From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#25577: 26.0.50; Show Ibuffer and jump to line listing current buffer Date: Mon, 30 Jan 2017 20:30:04 +0900 Message-ID: <87tw8grdj7.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1485775879 7254 195.159.176.226 (30 Jan 2017 11:31:19 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 30 Jan 2017 11:31:19 +0000 (UTC) To: 25577@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jan 30 12:31:13 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYAAw-0001YB-2u for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Jan 2017 12:31:10 +0100 Original-Received: from localhost ([::1]:59722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYAB1-000084-42 for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Jan 2017 06:31:15 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37747) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYAAt-00007y-BQ for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 06:31:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYAAo-0003sj-Cf for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 06:31:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52571) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYAAo-0003sf-9J for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 06:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cYAAo-0002M2-3C for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 06:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Jan 2017 11:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25577 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14857758298999 (code B ref -1); Mon, 30 Jan 2017 11:31:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Jan 2017 11:30:29 +0000 Original-Received: from localhost ([127.0.0.1]:50770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYAAG-0002L4-JD for submit@debbugs.gnu.org; Mon, 30 Jan 2017 06:30:28 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:46648) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cYAAE-0002Kt-Fv for submit@debbugs.gnu.org; Mon, 30 Jan 2017 06:30:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYAA8-0003nI-90 for submit@debbugs.gnu.org; Mon, 30 Jan 2017 06:30:21 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:40078) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cYAA8-0003nE-5L for submit@debbugs.gnu.org; Mon, 30 Jan 2017 06:30:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37618) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cYAA6-00007Y-Tt for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 06:30:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cYAA2-0003mU-1R for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 06:30:18 -0500 Original-Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:35432) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cYAA1-0003lE-R6 for bug-gnu-emacs@gnu.org; Mon, 30 Jan 2017 06:30:13 -0500 Original-Received: by mail-pg0-x241.google.com with SMTP id 204so31313542pge.2 for ; Mon, 30 Jan 2017 03:30:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=IjX8efSVlgaLP+9AiXs2d6PwjF+6UGLbfMzW/KRclLw=; b=jk0g9I91smMYmALwW5ILg4s/+rYzStDEEGa2lgpCcf6/PAYcbe1ouS/oCCGcKkqkU7 jzqYsa9XE950S71w6xBxOJp1RHujrVRNFYoH2i0IJ1lQGPXx10OwiEouN6VaC02ixRkw qwP3UJ1pvYCoLrI+YmaSX2T2HLDXIrZjAAmcDIJrfMXIZ0srM9eyN8WBodPq2cO31TOW IiBezVOHhFNTDWIgkpEUvoF4gEGOJrxg7XAkjV21aXZl0nzEpDJu3dxJssIA3yVv4p2q 85+fGzaGLBYRYVa8qZ2v5WUk8/rPBNYKGRJasEO2QfQQx+37Y/ZrAy0j/4+VoLPPnzrL ARYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=IjX8efSVlgaLP+9AiXs2d6PwjF+6UGLbfMzW/KRclLw=; b=sLzDZavt1IzqHn7jTVx3MBKY+vSzrbYoQPSnjo5xj2hlO8U9fsQXHgHkqUdj8YTfIv NBp5U7UhF1Nn3sipTw/Mu7BJynbbQHSAZTNVEz1SViB/e7dEL0n3qvw33lKCwmwymcSz l82+N25VuQs1PL2Z6LtKiSDYRrjIXvh00wmNTZBvEeXm2iygoVQC+T/5uBw2DK/Tr7dD +e2JSxAcP+u3keamZeW2hcpafHvgDeaDjBiXBJt895gcstCmGsNaNSshNvLVW2rmeqAd m3cUmHykg4B5QkDAtnLWeU6oCIWFadsz4jelvF3HyOcLLRIT3NtlnNQKidkknKZEgPuG VjZQ== X-Gm-Message-State: AIkVDXJeMkEjAsUvexcD27q/wl1Iv8WlRs6Z/PRMJ7j+n7BFHJgPJdIf5Jgql4Jhu/8kYQ== X-Received: by 10.99.144.68 with SMTP id a65mr23759467pge.54.1485775810212; Mon, 30 Jan 2017 03:30:10 -0800 (PST) Original-Received: from calancha-pc (33.94.100.220.dy.bbexcite.jp. [220.100.94.33]) by smtp.gmail.com with ESMTPSA id w76sm31791107pfd.74.2017.01.30.03.30.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jan 2017 03:30:09 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128784 Archived-At: 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 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