I am switching to emacs and in the process of configuring my emacs environment, I am stuck with implementing a functionality which I used to have in eclipse and IntelliJ. Move back and forth in code with alt left/right keys.
I want it to be able to work across all major modes and across all buffers(not just for java or any specific language). For example,
say I'm at beginning of file1.txt(say p1
). I search for some text and go to line 10(p2
) in file1.txt
. Then I open another file, file2.txt
and repeat the same , start at line 1(p3
) and then go to line 10(p4
). Upon Alt + Left
and Alt + right
(or any other similar keybinding), I should be able to cycle between positions p1 <-> p2 <-> p3 <-> p4
I am aware of the following.
- ctags/etags specific approach of generating tags, jumping to functions and then back. But I want it to be applicable to text files and a lot of files for which ctags cant be generated or not worth generating as I use them rarely e.g Makefiles generated from cmake builds etc.
- Questions, answers and comments in https://superuser.com/questions/241939/how-to-jump-back-to-the-last-position-of-the-cursor-in-emacs , In Emacs, how to go back to previous line position after using semantic Jump to Symbol? where answers are mentioned about using mark ring and registers for storing mark. But after trying such approach initially, I found that once if I go forward, then backward, I pop stuff from the register. I need it to be there forever(:D )
- I read really bad things about icicles and bit hesitant to try it.
Any other approach that I have missed ? Any plugin or anything ? Implementing this is a bit complex. I hoping this is a common problem and hoping some piece of elisp code exists for solving this problem.