emacs-devel
[Top][All Lists]
Advanced

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

Re: A feature to go to last edit locations


From: Juri Linkov
Subject: Re: A feature to go to last edit locations
Date: Mon, 13 Feb 2023 09:50:51 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> Daniel Martín <mardani29@yahoo.es> writes:
>> I see that Evil uses the NonGNU ELPA package goto-chg
>> (https://elpa.nongnu.org/nongnu/goto-chg.html) to implement that
>> functionality.
>
> I use that package outside Evil all the time. Any mode that clobbers the
> shortcut I assigned to it (C-.) blocks my productivity a lot. That’s the
> main reason why I don’t have flyspell active while writing emails.

You can unbind this key:

```
(with-eval-after-load 'flyspell
  (keymap-unset flyspell-mode-map "C-."))
```

> It only works inside buffers, but with ido for changing buffers and
> dumb-jump/xref support for jumping back after cross-file navigation, I
> don’t need more. This jumping back after an explicit cross-file
> navigation command is actually closer to what I need than what intellij
> offers. I don’t want to go back to the buffer I selected via
> switch-buffer, but if "find reference" takes me to another file, I need
> a way to jump back.

Something like this will get the most recently used buffer with undo,
then the logic from goto-chg can navigate to the last undo entry:

```
(seq-sort (lambda (b1 b2)
            (time-less-p
             (with-current-buffer b2 buffer-display-time)
             (with-current-buffer b1 buffer-display-time)))
          (seq-remove (lambda (b)
                        (with-current-buffer b
                          (or (not buffer-undo-list)
                              (eq buffer-undo-list t)
                              buffer-read-only
                              (not buffer-display-time)
                              (string-match-p "\\` " (buffer-name b)))))
                      (buffer-list)))
```



reply via email to

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