I'd like to add a sticker(marker) to a line in the buffer. I wanna do this because I want to mark places which I should not forgive to change during some refactoring process. I want these markers to be seen by me, for example, like gitgutter shows git diff, by adding +, - to the line start. Is there a way to do that?

  • 1
    Please explain what you mean by "sticker". – Dan Jan 16 '18 at 14:24
  • @Dan Well. A visual marker (for example, like git gutter marks the lines + - ~ in the git log) which sticks to a line in the source file and when you change the lines it still stays there. For example, if you place such a mark to line 10 and then remove first 5 lines of files, the marker will be at 5th line. – Victor Polevoy Jan 16 '18 at 14:28
  • Please edit your question to clarify it. A (wild) guess is that (1) by "sticker" you mean a marker of some sort and (2) by "forgive" you mean forget. If so, look into C-SPC (setting the mark) and bookmarks (persistent markers). – Drew Jan 16 '18 at 14:29
  1. You can use Emacs markers to "remember" places in a buffer and return to them. For that, C-SPC sets the mark and C-u C-SPC to move to the last position of the mark. See the Emacs manual, node Mark Ring.

  2. For persistent "marks" you can use bookmarks. C-x r m sets a bookmark. You can then use C-x r b to jump to a bookmark (you are prompted for the name). You can also use C-x r l to get a list of your bookmarks and navigate to any of them. See the Emacs manual, node Bookmarks.

The Emacs manual is your friend. Get to it using C-h r. In the manual, use i to find indexed information.

If you want to have a visual indication of bookmark locations then you can use library Bookmark+. It gives you various ways to highlight bookmarks, including using a mark in the window fringe for that.

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.