Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
2acfb954
Commit
2acfb954
authored
Jan 18, 2010
by
Óscar Fuentes
Committed by
Juanma Barranquero
Jan 18, 2010
Browse files
ido.el: Consider the possibility of buffer names changing after kill-buffer.
parent
244b023e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
6 deletions
+40
-6
lisp/ChangeLog
lisp/ChangeLog
+12
-0
lisp/ido.el
lisp/ido.el
+28
-6
No files found.
lisp/ChangeLog
View file @
2acfb954
2010-01-18 Óscar Fuentes <ofv@wanadoo.es>
* ido.el (ido-cur-list): Initialize as nil.
Remove obsolete information from commentary.
(ido-choice-list): Initialize as nil.
(ido-get-bufname): Reject minibuffers.
(ido-make-buffer-list): If "default" is a nonexistent
buffer, ignore it, as per the docstring.
(ido-kill-buffer-internal): New function.
(ido-kill-buffer-at-head): Use it.
(ido-visit-buffer): Likewise.
2010-01-18 Chong Yidong <cyd@stupidchicken.com>
* calendar/time-date.el (date-to-time): Doc fix (Bug#5408).
...
...
lisp/ido.el
View file @
2acfb954
...
...
@@ -1042,11 +1042,11 @@ Value is an integer which is number of chars to right of prompt.")
;; 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.
Created by `ido-make-item-list'.
(
defvar
ido-cur-list
)
;; at the end of the list.
(
defvar
ido-cur-list
nil
)
;; Stores the choice list for ido-completing-read
(
defvar
ido-choice-list
)
(
defvar
ido-choice-list
nil
)
;; Stores the list of items which are ignored when building
;; `ido-cur-list'. It is in no specific order.
...
...
@@ -3344,7 +3344,7 @@ for first matching file."
(
if
ido-temp-list
(
nconc
ido-temp-list
ido-current-buffers
)
(
setq
ido-temp-list
ido-current-buffers
))
(
if
default
(
if
(
and
default
(
buffer-live-p
(
get-buffer
default
)))
(
progn
(
setq
ido-temp-list
(
delete
default
ido-temp-list
))
...
...
@@ -3590,6 +3590,7 @@ for first matching file."
;; 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
...
...
@@ -3830,6 +3831,27 @@ for first matching file."
;;(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'.
...
...
@@ -3840,7 +3862,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
(
kill-buffer
buf
)
(
ido-
kill-buffer
-internal
buf
)
;; Check if buffer still exists.
(
if
(
get-buffer
buf
)
;; buffer couldn't be killed.
...
...
@@ -3884,7 +3906,7 @@ Record command in `command-history' if optional RECORD is non-nil."
((
eq
method
'kill
)
(
if
record
(
ido-record-command
'kill-buffer
buffer
))
(
kill-buffer
buffer
))
(
ido-
kill-buffer
-internal
buffer
))
((
eq
method
'other-window
)
(
if
record
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment