Am 12.02.2014 16:58, schrieb gregrwm:
> i have emacs 24.3.1 and evil-20131220.342.
>
> :e# works at first, but, after using :ls, :e# no longer works.
>
Actually, :e# does not work after any command that opens a (temporary)
buffer (as :ls does). The reason is that the buffer # refers to is the
buffer returned by `other-buffer`. Maybe another rule would be more
appropriate, e.g. the most recent buffer that has an associated file?
The attached patch implements this behaviour. Please check if this comes
closer to the desired behaviour (it will never be the same as in Vim
because Emacs and Vim buffer handling have some fundamental differences).
Best regards,
Frank
diff --git a/evil-ex.el b/evil-ex.el
--- a/evil-ex.el
+++ b/evil-ex.el
@@ -611,8 +611,10 @@
Replaces % by the current file-name,
Replaces # by the alternate file-name in FILE-NAME."
(let ((current-fname (buffer-file-name))
- (alternate-fname (and (other-buffer)
- (buffer-file-name (other-buffer)))))
+ (alternate-fname (cdr (buffer-list))))
+ (while (and alternate-fname
+ (not (buffer-file-name (car alternate-fname))))
+ (pop alternate-fname))
(when current-fname
(setq file-name
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(%\\)"
@@ -621,7 +623,8 @@
(when alternate-fname
(setq file-name
(replace-regexp-in-string "\\(^\\|[^\\\\]\\)\\(#\\)"
- alternate-fname file-name
+ (buffer-file-name (car alternate-fname))
+ file-name
t t 2)))
(setq file-name
(replace-regexp-in-string "\\\\\\([#%]\\)"
_______________________________________________
implementations-list mailing list
[email protected]
https://lists.ourproject.org/cgi-bin/mailman/listinfo/implementations-list