unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Akib Azmain Turja <akib@disroot.org>
Cc: Philip Kaludercic <philipk@posteo.net>,
	 Emacs Developer List <emacs-devel@gnu.org>
Subject: Re: [NonGNU ELPA] New package: Denote-Refs
Date: Tue, 20 Dec 2022 17:02:25 -0500	[thread overview]
Message-ID: <jwvfsd9rbne.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87r0wtn82w.fsf@disroot.org> (Akib Azmain Turja's message of "Wed, 21 Dec 2022 02:17:27 +0600")

>>> 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	other threads:[~2022-12-20 22:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-19 16:31 [NonGNU ELPA] New package: Denote-Refs Akib Azmain Turja
2022-12-19 16:58 ` Philip Kaludercic
2022-12-19 18:00   ` Akib Azmain Turja
2022-12-19 19:19     ` Philip Kaludercic
2022-12-19 20:20       ` [External] : " Drew Adams
2022-12-19 21:08         ` Philip Kaludercic
2022-12-19 21:51           ` Drew Adams
2022-12-20 16:48             ` Philip Kaludercic
2022-12-20 17:39               ` Drew Adams
2022-12-21  0:05                 ` Philip Kaludercic
2022-12-21  5:22                   ` Drew Adams
2022-12-21  9:07                     ` Philip Kaludercic
2022-12-21 15:50                       ` Drew Adams
2022-12-20 15:09       ` Akib Azmain Turja
2022-12-20 16:55         ` Philip Kaludercic
2022-12-20 20:17           ` Akib Azmain Turja
2022-12-20 22:02             ` Stefan Monnier [this message]
2022-12-21 16:03               ` Akib Azmain Turja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvfsd9rbne.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=akib@disroot.org \
    --cc=emacs-devel@gnu.org \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).