unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] lisp/ido.el: Define ido-bury-buffer-at-head
@ 2014-11-13 11:36 Artur Malabarba
  2014-11-14  5:09 ` Leo Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Artur Malabarba @ 2014-11-13 11:36 UTC (permalink / raw)
  To: emacs-devel

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

Hi all,

I'd like to add the following command to ido, which buries a buffer
with C-S-b analogously to how C-k kills a buffer in ido.
I find burying buffers to be at least as useful as killing them, so it
seems a relevant addition.

Best,

[-- Attachment #2: ido-bury-buffer.patch --]
[-- Type: application/octet-stream, Size: 1587 bytes --]

From 9e15868083f1c45f5274ba3aac698435c6b50c65 Mon Sep 17 00:00:00 2001
From: Artur Malabarba <bruce.connor.am@gmail.com>
Date: Thu, 13 Nov 2014 11:24:07 +0000
Subject: [PATCH] lisp/ido.el: Define ido-bury-buffer-at-head

---
 lisp/ido.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/lisp/ido.el b/lisp/ido.el
index bda2525..5f7637c 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1672,6 +1672,7 @@ This function also adds a hook to the minibuffer."
     (define-key map "\C-x\C-f" 'ido-enter-find-file)
     (define-key map "\C-x\C-b" 'ido-fallback-command)
     (define-key map "\C-k" 'ido-kill-buffer-at-head)
+    (define-key map [?\C-\S-b] 'ido-bury-buffer-at-head)
     (define-key map "\C-o" 'ido-toggle-virtual-buffers)
     (set-keymap-parent map ido-common-completion-map)
     (setq ido-buffer-completion-map map)))
@@ -4026,6 +4027,20 @@ If cursor is not at the end of the user input, delete to end of input."
 	(setq ido-cur-list (delete buf ido-cur-list))
 	(setq ido-rescan t))))))
 
+;;; BURY CURRENT BUFFER
+(defun ido-bury-buffer-at-head ()
+  "Bury the buffer at the head of `ido-matches'."
+  (interactive)
+  (let ((enable-recursive-minibuffers t)
+        (buf (ido-name (car ido-matches)))
+        (nextbuf (cadr ido-matches)))
+    (when (get-buffer buf)
+      (bury-buffer buf)
+      (setq ido-default-item nextbuf
+            ido-text-init ido-text
+            ido-exit 'refresh)
+      (exit-minibuffer))))
+
 ;;; DELETE CURRENT FILE
 (defun ido-delete-file-at-head ()
   "Delete the file at the head of `ido-matches'.
-- 
1.7.12.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] lisp/ido.el: Define ido-bury-buffer-at-head
  2014-11-13 11:36 [PATCH] lisp/ido.el: Define ido-bury-buffer-at-head Artur Malabarba
@ 2014-11-14  5:09 ` Leo Liu
  2014-11-14  5:27   ` Leo Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Leo Liu @ 2014-11-14  5:09 UTC (permalink / raw)
  To: emacs-devel

On 2014-11-13 19:36 +0800, Artur Malabarba wrote:
> I'd like to add the following command to ido, which buries a buffer
> with C-S-b analogously to how C-k kills a buffer in ido.
> I find burying buffers to be at least as useful as killing them, so it
> seems a relevant addition.

Ido has it already, it is called `C-r'.

Leo




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] lisp/ido.el: Define ido-bury-buffer-at-head
  2014-11-14  5:09 ` Leo Liu
@ 2014-11-14  5:27   ` Leo Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Leo Liu @ 2014-11-14  5:27 UTC (permalink / raw)
  To: emacs-devel

On 2014-11-14 13:09 +0800, Leo Liu wrote:
> Ido has it already, it is called `C-r'.

Sorry not entirely the same.

Leo




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-14  5:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-13 11:36 [PATCH] lisp/ido.el: Define ido-bury-buffer-at-head Artur Malabarba
2014-11-14  5:09 ` Leo Liu
2014-11-14  5:27   ` Leo Liu

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).