2

when i am editing a large file, often need to view other sections of the same buffer only once. But after that I need to go back to the position I was editing at. Is there a key for doing that?

3

@Aaron answered well with the usual way to take care of this in Emacs: set a mark where you are now, then get back to it later using C-u C-SPC.

Another way is to use a bookmark, in particular a temporary bookmark (unless you want to get back to the position in a later Emacs session).

You can easily create (and delete) temporary bookmarks using Bookmark+. You can also automatically highlight them (in various ways), so you can easily see where they are.

You can even automatically create temporary bookmarks as you move around, if you like. They can be created whenever you are idle for a given period of time. User options determine how many such automatic bookmarks to create, and where to create them (e.g. how far apart, minimally).

See also autonamed bookmarks, which can be temporary or persistent.

2

Whenever I make a large jump in a file, I press C-SPC C-SPC first. That sets the mark to the current value of point*, effectively remembering the current cursor position. Then, once I'm done wandering around, I press C-u C-SPC to jump back to that position.

If you know that you're initiating your jump with a command that sets the mark for you (most prominently, M-< or M-> for jumping to the beginning or end of the buffer, respectively), you can also skip explicitly remembering the mark. Commands that have this property will say something like "Push mark at previous position" in their help.

Finally, once you've remembered a position, you might want to toggle back to it briefly without forgetting where you are right now. The key for that is C-x C-x (optionally followed by a C-g to disable the region); that exchanges the current values of point and mark.

(*) Technically, one C-SPC is enough to set the mark; the second deactivates the region so I'm not highlighting things extraneously.

0

I use the package goto-chg, that let you navigate to the point of edits in the buffer, with two functions goto-last-change and goto-last-change-reverse.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.
{"cc_re__cc_re__cc_by_sa_4_0": ["-item\"><a href=\"https://twitter.com/stackoverflow\" class=\"-link js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 32 })\">Twitter</a></li>\r\n                    <li class=\"-item\"><a href=\"https://linkedin.com/company/stack-overflow\" class=\"-link js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 33 })\">LinkedIn</a></li>\r\n                </ul>\r\n\r\n                <p class=\"mt-auto mb24\">\r\nsite design / logo &#169; 2019 Stack Exchange Inc; user contributions licensed under <a href=\"https://creativecommons.org/licenses/by-sa/4.0/\" class=\"js-gps-track\" data-gps-track=\"footer.click({ location: 2, link: 34 })\" rel=\"license\">cc by-sa 4.0</a>\r\n                            with <a href=\"https://stackoverflow.blog/2009/06/25/attribution-required/\"  class=\"js-gps-track\" data-gps-track=\"footer.click({ location: 2, link:35 })\" rel=\"license\">attribution required</a>.\r\n                    <span id=\"svnrev\">rev&nbsp;2019.9.19.34966</span>\r\n                </p>\r\n            </div>\r\n        </div>\r\n\r\n            </footer>\r\n            <script>StackExchange.ready(function () { StackExchange.responsiveness.addSwitcher(); })</scri"], "copyright__copyright__copyright": ["rk.\n\n(*) Technically, one C-SPC is enough to set the mark; the second deactivates the region so I'm not highlighting things extraneously.\n\n0\n\nI use the package goto-chg, that let you navigate to the point of edits in the buffer, with two functions goto-last-change and goto-last-change-reverse.\n\nYour Answer\n\nBy clicking \u201cPost Your Answer\u201d, you agree to our terms of service, privacy policy and cookie policy\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}