I have followed these instruction to create a stack of visited position across buffers:
(defvar jedi:goto-stack '()) (defun jedi:jump-to-definition () (interactive) (add-to-list 'jedi:goto-stack (list (buffer-name) (point))) (jedi:goto-definition)) (defun jedi:jump-back () (interactive) (let ((p (pop jedi:goto-stack))) (if p (progn (switch-to-buffer (nth 0 p)) (goto-char (nth 1 p))))))
This worked well in most case, except when you visited files with the same name under different directories.
Example, you have two files
~/b/test.py. When you first visit
~/a/test.py, the emacs buffer name will be
test.py. Now, I used
jedi:jump-to-definition function above to go to
As it intended to do, before switching to
~/b/test.py, it push current buffer name and position to stack
But emacs saw two files have the same name, they uniquify them, make their buffer name to
test.py<b>. Now, I can't use
jedi:jump-back to go to previous buffer
~/a/test.py, because the stack only contains
Can I check when did emacs uniquify the buffer name, and push the new uniquify name to my stack instead of the old one?