[Top][All Lists]

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

RE: Temporary notes in Emacs buffers?

From: Drew Adams
Subject: RE: Temporary notes in Emacs buffers?
Date: Wed, 1 Jan 2020 21:30:25 -0800 (PST)

> > Do you really often move files for which you have associated notes?
> I don't know yet.  But the bookmarks should at least survive making
> backups, and remain visible when viewing them at that other place, or
> after moving the containing folder for archiving or so.  I would say:
> often enough that it matters, yes.

I guess you mean just what you said before: You
want to be able to move a file, and some bookmarks
that target it, to a different directory, and have
the bookmarks continue to work there.

> > Or yes, not use bookmarks for your annotations.
> Well, they mostly fit, if they would not force me to use absolute file
> names.  You are sure that there is no predefined way to use relative
> names?

You can define a bookmark handler for any type of
bookmark.  The handler could ignore the directory
part of the recorded file name, and get the needed
directory from somewhere else, e.g., from a global
variable or a function.  (It has to come from
somewhere.)  E.g., a variable could have an alist
value with keys for your different whatevers (even
nondir-filename keys) and with dirs as the values.

But then you'd have to update the variable value
when you move the targeted files.  As I said before,
you can write code that does something like that
(my earlier suggestion was code that changes the
target-file names in the bookmarks, but that's not
great) - e.g. code that's kicked off by a bespoke
file-move command.  (But then you have to remember
to use that command to move such files...)

However you look at it, the target file is separate
from bookmarks that refer to it - that's the nature
of the thing.  Something has to let either the
bookmarks themselves or the bookmark-handling code
know where you moved the target file.

(You can also define new types of bookmarks.  E.g.,
you could define one that records a target location
that's just the nondirectory part of a file name.
But this isn't really necessary - the dir part of
an absolute file name could just be ignored - see

Other than that (you define a handler), this kind
of handling (look up the dir somewhere) could be
added as a general (optional) feature.  The use
case hadn't occurred to me.

Maybe give it a try (define a handler that looks
up the dir somewhere), and let me know how useful
you find it.  (Add your new handler to the value
of variable `bmkp-file-bookmark-handlers', so the
bookmarks will satisfy `bmkp-file-bookmark-p'.) 

Or if you don't get around to that then maybe I'll
do something.  But it's less likely that whatever
I might come up with will fit what you need as well
as what you might come up with.  And maybe by
experimenting a bit you'll find that bookmarks are
really not the way you want to go...


[Bookmark+ has "autofile" bookmarks, whose bookmark
names are the nondirectory parts of the full file
names.  You can have multiple bookmarks with the
same name, which is a relative file name in this
case.  But the target file recorded in the bookmark
is an absolute name (so far).]

reply via email to

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