emacs-devel
[Top][All Lists]
Advanced

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

Re: [NonGNU ELPA] New package: Denote-Refs


From: Stefan Monnier
Subject: Re: [NonGNU ELPA] New package: Denote-Refs
Date: Tue, 20 Dec 2022 17:02:25 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

>>> Anyway, do you think it is a good idea to write some text temporarily in
>>> a buffer?

It's useful to clarify your question by mentioning that you're talking
about a file buffer :-)

It's usually not recommended to make the buffer's content different from
the file's content, because it makes things more complicated and comes
with various caveat and rough edges.

But we do that on various occasions nevertheless.

Packages that come to mind are `hexl-mode`, `archive-mode` and
`tar-mode`, for example.  Rmail to some extent as well, I'm sure there
are many more.

>>> My experience suggests no, but if I use overlays then I can't select
>>> and press RET on the links, and I can't scroll if the list is too
>>> long.  WDYT?

Indeed.  In `nhexl-mode` I try to make overlays work a bit like "plain
text" works in `hexl-mode`, but it takes work and the result is
still limited.

> While saving, reverted:

Which mechanism did you use for that?

> (I don't know what happens while auto-saving :( )

If you haven't done anything for that, autosaving will save the
buffer's content as is.

A good way to make the save work correctly both for `save-buffer` and
for auto-save is to use `write-region-annotate-functions`.
That hook doesn't directly let you remove text, but it can `set-buffer`
to a new buffer in which case that other buffer's content will be
written instead.

> Inside 'xref--collect-matches', reverted, otherwise xref doesn't match
> correctly, since the file and buffer lines don't really match.  After
> 'xref--collect-matches', again the text.

Exactly: it comes with a lot of caveats :-(

Another approach is to use *another* buffer than the file buffer.
This is less transparent to the user but tends to come with fewer
dark corners.


        Stefan




reply via email to

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