[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A feature to go to last edit locations

From: Daniel Martín
Subject: A feature to go to last edit locations
Date: Sun, 12 Feb 2023 18:41:20 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)

Some IDEs and text editors provide a feature to go to the position of
the last edit location across all buffers.  For example, in Eclipse or
IntelliJ IDEA, this feature is under Navigate, Last Edit Location.  In
Vim, this feature is called a "change list jump" [1], but it seems to
work in a per-buffer basis.

The closest thing in Emacs is pop-global-mark, but it's not quite the
same feature. The global mark ring requires that the user sets the mark
in advance, and most editing commands do not set the mark.  Information
about last edit locations is already kept in buffer-undo-list, but this
list is per-buffer and does not contain timestamps, so generating a
"global" list for all buffers out of this data structure does not seem
very possible or efficient at the moment; it may need a new data
structure, perhaps at the C level.

My question is: Is there any interest on this new feature?  If so, I
have some questions about how it may fit in Emacs:

- When popping entries from this new "last edit locations ring", should
  we give users the option to skip some changes?  For example, to not go
  to changes in the minibuffer (which will probably be inactive), or to
  other kinds of buffers.

- Should this feature restore killed buffers from files, if possible?
  pop-global-mark does not do that, but the Last Edit Location feature
  in IDEs tries to do that, AFAIK.

- Should this feature be linked to undo information?  That is, if undo
  is disabled for a buffer, should the edit change locations in that
  buffer be preserved?

- I think there should be a configurable threshold to skip adding
  entries that are close to each other.  For instance, an editing
  session that goes like

     Hello, world! M-<backspace> World!

  would generate 3 last edit location entries which are probably
  uninteresting to users.  We should give them an option to skip
  recording some changes (perhaps those that are in the same line, or
  less than a number of character positions apart from another entry in
  the ring).

What do you think?  Third-party packages like goto-last-change.el [2] or
session.el [3] (see session-jump-to-last-change) implement this feature
in a per-buffer basis, but I wonder if we could do better and implement
something that works across buffers.

[1]: https://vimhelp.org/motion.txt.html#changelist
[2]: https://www.emacswiki.org/emacs/goto-last-change.el
[3]: https://www.emacswiki.org/emacs/session.el

reply via email to

[Prev in Thread] Current Thread [Next in Thread]