Markers are awesome

This is probably old news to many. But I discovered yesterday that Elisp markers are useful to more than just navigating around. Namely when generating/editing text they automatically update their position when text are added/deleted. Which is awesome since I’ve just been doing that manually up until yesterday. :sweat_smile:

Here is how I used them in plt-c++-doxygen-block, a small function that insert a doxygen C++ docstring block, properly format it and then place the cursor in the middle:

/**
  |
*/

I played around with Skeletons and yasnippet before this, but Emacs indent the block differently when there is no text. Which was annoying so I just wrote my own little Elisp function to fix it.

Thought I would share in case someone else had missed this too.

2 Likes

I was trying tempo similarly, but came back to minad’s tempel git package.

This might be interesting for you.

1 Like