unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@googlemail.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: "Óscar Fuentes" <ofv@wanadoo.es>,
	"Chong Yidong" <cyd@stupidchicken.com>,
	emacs-devel@gnu.org
Subject: Re: PATCH: Fix IDO interaction with uniquify.el
Date: Wed, 5 May 2010 18:35:09 +0100	[thread overview]
Message-ID: <y2u20a0c1021005051035kb57df381icf4269ee8b0b048f@mail.gmail.com> (raw)
In-Reply-To: <x2hf7ccd24b1005050947p9e29458es149dc129990d1a19@mail.gmail.com>

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

On 5 May 2010 17:47, Juanma Barranquero <lekktu@gmail.com> wrote:
> On Wed, May 5, 2010 at 14:40, Leo <sdl.web@googlemail.com> wrote:
>
>> I take the point. I have included a patch that fix the bug in a more
>> general but still cleaner way. Please let me know if it works for you
>> in both ido and iswitchb too. Thanks.
>
> The ido part is not against the trunk. Could you please resend it?
>
> As for iswitchb, I don't use it; that said, in my very informal and
> brief test, yeah, it works as expected.

As attached with some simplification. Let me know if the ido part works. Thanks.

Leo

[-- Attachment #2: 0001-Back-out-the-patch-from-scar-Fuentes.patch --]
[-- Type: application/octet-stream, Size: 4075 bytes --]

From 32cc0c3d93ac9b73a0a12a538c054292dd8cced8 Mon Sep 17 00:00:00 2001
From: Leo <sdl.web@gmail.com>
Date: Wed, 5 May 2010 18:02:26 +0100
Subject: [PATCH] =?utf-8?q?Back=20out=20the=20patch=20from=20=C3=93scar=20Fuentes?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

---
 lisp/ido.el |   38 ++++++++------------------------------
 1 files changed, 8 insertions(+), 30 deletions(-)

diff --git a/lisp/ido.el b/lisp/ido.el
index f75f029..d921dfa 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1070,11 +1070,11 @@ Only used if `ido-use-virtual-buffers' is non-nil.")
 ;; Stores the current list of items that will be searched through.
 ;; The list is ordered, so that the most interesting item comes first,
 ;; although by default, the files visible in the current frame are put
-;; at the end of the list.
-(defvar ido-cur-list nil)
+;; at the end of the list.  Created by `ido-make-item-list'.
+(defvar ido-cur-list)
 
 ;; Stores the choice list for ido-completing-read
-(defvar ido-choice-list nil)
+(defvar ido-choice-list)
 
 ;; Stores the list of items which are ignored when building
 ;; `ido-cur-list'.  It is in no specific order.
@@ -3400,9 +3400,9 @@ for first matching file."
     (if ido-temp-list
 	(nconc ido-temp-list ido-current-buffers)
       (setq ido-temp-list ido-current-buffers))
-    (when (and default (buffer-live-p (get-buffer default)))
-      (setq ido-temp-list
-	    (cons default (delete default ido-temp-list))))
+    (if default
+        (setq ido-temp-list
+              (cons default (delete default ido-temp-list))))
     (if ido-use-virtual-buffers
 	(ido-add-virtual-buffers-to-list))
     (run-hooks 'ido-make-buffer-list-hook)
@@ -3672,7 +3672,6 @@ This is to make them appear as if they were \"virtual buffers\"."
   ;; Used by `ido-get-buffers-in-frames' to walk through all windows
   (let ((buf (buffer-name (window-buffer win))))
 	(unless (or (member buf ido-bufs-in-frame)
-		    (minibufferp buf)
 		    (member buf ido-ignore-item-temp-list))
 	  ;; Only add buf if it is not already in list.
 	  ;; This prevents same buf in two different windows being
@@ -3913,27 +3912,6 @@ This is to make them appear as if they were \"virtual buffers\"."
 	      ;;(add-hook 'completion-setup-hook 'completion-setup-function)
 	      (display-completion-list completion-list)))))))
 
-(defun ido-kill-buffer-internal (buf)
-  "Kill buffer BUF and rebuild ido's buffer list if needed."
-  (if (not (kill-buffer buf))
-      ;; buffer couldn't be killed.
-      (setq ido-rescan t)
-    ;; else buffer was killed so remove name from list.
-    (setq ido-cur-list (delq buf ido-cur-list))
-    ;; Some packages, like uniquify.el, may rename buffers when one
-    ;; is killed, so we need to test this condition to avoid using
-    ;; an outdated list of buffer names. We don't want to always
-    ;; rebuild the list of buffers, as this alters the previous
-    ;; buffer order that the user was seeing on the prompt. However,
-    ;; when we rebuild the list, we try to keep the previous second
-    ;; buffer as the first one.
-    (catch 'update
-      (dolist (b ido-cur-list)
-	(unless (get-buffer b)
-	  (setq ido-cur-list (ido-make-buffer-list (cadr ido-matches)))
-	  (setq ido-rescan t)
-	  (throw 'update nil))))))
-
 ;;; KILL CURRENT BUFFER
 (defun ido-kill-buffer-at-head ()
   "Kill the buffer at the head of `ido-matches'.
@@ -3944,7 +3922,7 @@ If cursor is not at the end of the user input, delete to end of input."
     (let ((enable-recursive-minibuffers t)
 	  (buf (ido-name (car ido-matches))))
       (when buf
-	(ido-kill-buffer-internal buf)
+	(kill-buffer buf)
 	;; Check if buffer still exists.
 	(if (get-buffer buf)
 	    ;; buffer couldn't be killed.
@@ -3988,7 +3966,7 @@ Record command in `command-history' if optional RECORD is non-nil."
      ((eq method 'kill)
       (if record
 	  (ido-record-command 'kill-buffer buffer))
-      (ido-kill-buffer-internal buffer))
+      (kill-buffer buffer))
 
      ((eq method 'other-window)
       (if record
-- 
1.6.0.2


[-- Attachment #3: 0002-Fix-a-bug-in-both-ido-and-switchb-related-to-killing.patch --]
[-- Type: application/octet-stream, Size: 1986 bytes --]

From 4243e764baddfd57f3c1f90a3f99e976d3088972 Mon Sep 17 00:00:00 2001
From: Leo <sdl.web@gmail.com>
Date: Wed, 5 May 2010 18:03:47 +0100
Subject: [PATCH] Fix a bug in both ido and switchb related to killing buffers

by rebuilding buffer list since packages like uniquify may rename
buffers.
---
 lisp/ido.el      |   12 +++++-------
 lisp/iswitchb.el |    6 ++++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/ido.el b/lisp/ido.el
index d921dfa..34192c0 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -3922,13 +3922,11 @@ If cursor is not at the end of the user input, delete to end of input."
     (let ((enable-recursive-minibuffers t)
 	  (buf (ido-name (car ido-matches))))
       (when buf
-	(kill-buffer buf)
-	;; Check if buffer still exists.
-	(if (get-buffer buf)
-	    ;; buffer couldn't be killed.
-	    (setq ido-rescan t)
-	  ;; else buffer was killed so remove name from list.
-	  (setq ido-cur-list (delq buf ido-cur-list)))))))
+	(if (kill-buffer buf)
+	    ;; `kill-buffer' succeeds so re-make the buffer list taking
+	    ;; into account packages like uniquify may rename buffers.
+	    (setq ido-cur-list (ido-make-buffer-list (cadr ido-matches))))
+	(setq ido-rescan t)))))
 
 ;;; DELETE CURRENT FILE
 (defun ido-delete-file-at-head ()
diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el
index ea4b00d..2509e9f 100644
--- a/lisp/iswitchb.el
+++ b/lisp/iswitchb.el
@@ -1042,8 +1042,10 @@ Return the modified list with the last element prepended to it."
 	  (if (get-buffer buf)
 	      ;; buffer couldn't be killed.
 	      (setq iswitchb-rescan t)
-	    ;; else buffer was killed so remove name from list.
-	    (setq iswitchb-buflist  (delq buf iswitchb-buflist)))))))
+	    ;; else `kill-buffer' succeeds so re-make the buffer list
+	    ;; taking into account packages like uniquify may rename
+	    ;; buffers
+	    (iswitchb-make-buflist iswitchb-default))))))
 
 ;;; VISIT CHOSEN BUFFER
 (defun iswitchb-visit-buffer (buffer)
-- 
1.6.0.2


  reply	other threads:[~2010-05-05 17:35 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-18 10:27 PATCH: Fix IDO interaction with uniquify.el Óscar Fuentes
2010-01-18 10:59 ` Juanma Barranquero
2010-01-18 11:12   ` Juanma Barranquero
2010-01-18 14:13     ` Óscar Fuentes
2010-01-18 14:32       ` Juanma Barranquero
2010-01-18 14:41         ` Óscar Fuentes
2010-01-18 15:44           ` Chong Yidong
2010-01-18 17:35             ` Óscar Fuentes
2010-01-18 17:52               ` Óscar Fuentes
2010-01-18 18:06                 ` Chong Yidong
2010-01-18 19:17                   ` Juanma Barranquero
2010-05-05  8:27                     ` Leo
2010-05-05  9:56                       ` Juanma Barranquero
2010-05-05 12:40                         ` Leo
2010-05-05 16:47                           ` Juanma Barranquero
2010-05-05 17:35                             ` Leo [this message]
2010-05-05 19:12                               ` Leo
2010-05-05 19:48                                 ` Juanma Barranquero
2010-05-06 12:54                               ` Stefan Monnier
2010-05-05 17:56                             ` Leo
2010-05-05 19:25                               ` Juanma Barranquero
2010-05-05 18:14                         ` Stefan Monnier
2010-05-05 19:09                           ` Óscar Fuentes
2010-05-05 19:50                             ` Leo
2010-05-05 19:59                               ` Leo
2010-05-05 20:36                                 ` Óscar Fuentes
2010-05-06 20:43                                 ` Juri Linkov
2010-05-05 20:27                               ` Stefan Monnier
2010-05-05 20:38                                 ` Óscar Fuentes
2010-05-06 16:56                                   ` Kim F. Storm

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=y2u20a0c1021005051035kb57df381icf4269ee8b0b048f@mail.gmail.com \
    --to=sdl.web@googlemail.com \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=ofv@wanadoo.es \
    /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 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).