tminor / jsonnet-mode

Emacs major mode for editing Jsonnet files.
GNU General Public License v3.0
46 stars 17 forks source link

Keep the cursor in the same place when reformatting #14

Closed russell closed 5 years ago

russell commented 5 years ago

When reformatting buffers, the cursor always ends up at the end of the buffer.

Description

Save the position of the window and the point, then restore both after replacing the buffer contents.

Motivation and Context

it's very annoying if you use this function in large files, because it always move the cursor to the end of the file.

How Has This Been Tested?

I use it daily, and i have shared it with other members of my team.

Types of changes

Checklist:

seh commented 5 years ago

Note that #12 achieves the same result. For some reason, we haven't seen any feedback from the maintainers for that one.

russell commented 5 years ago

Sweet as, I'm going to switch to your branch locally and try it. Your change looks like it also addresses the problem where the buffer is entirely replaced by an error message. I'll try it and get back to you next week

russell commented 5 years ago

closed in favour of #12