[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Temporary notes in Emacs buffers?
From: |
Michael Heerdegen |
Subject: |
Re: Temporary notes in Emacs buffers? |
Date: |
Wed, 01 Jan 2020 02:42:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Marcin Borkowski <mbork@mbork.pl> writes:
> At present, I use normal code comments, however, this is suboptimal,
> since I cannot use them in certain modes (occur buffer, JSON).
Is that occur buffer saved to a file? Because, if it's a dynamically
created buffer, how could notes attached to it be durable at all?
> Does there exist something like that? Am I the only one interested in
> such a feature? (I'd be happy to code it myself, though it would take
> time, of course.)
I also considered to implement something like that several times.
We could use overlays to assign the positions and overlay properties to
store note texts and metadata. When a buffer is edited, the overlay
begin and end marker positions are updated by Emacs on the fly. I would
use after-save-hook or so to make Emacs save that stuff automatically
for every file save. Where it is saved would be (file locally)
configurable: in a file local variable, in a directory local variable,
or in a configurable central place.
When you open a file, a minor-mode-hook would arrange that everything is
restored.
There would also be a variant for dired buffers to attach notes to whole
files.
Michael.