all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Temporary notes in Emacs buffers?
@ 2019-12-27 10:19 Marcin Borkowski
  2019-12-27 10:43 ` Mpho Jele
                   ` (4 more replies)
  0 siblings, 5 replies; 60+ messages in thread
From: Marcin Borkowski @ 2019-12-27 10:19 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

I've been wondering if there is some package which could let me make
"temporary notes" in Emacs buffers, similar to (but different than) the
"yellow notes" in some pdf viewers.

My use case is that I'm making a sweeping change across a pretty large
codebase, and I'd like to make some notes in places I've already visited
/ ones I need to change / etc.

At present, I use normal code comments, however, this is suboptimal,
since I cannot use them in certain modes (occur buffer, JSON).

Ideally, a place with a comment would have that comment highlighted
somehow, and I should be able to go to the next/previous comment, and
list all comments in a file or in the project (think Git repo,
Projectile project or a directory tree).  Also, mass inserting such
comments from an occur/multi-occur/projectile-ag/counsel-rg/etc. buffers
would be great.

What I /don't/ want is modifying the files - the comments might persist
in some /other/, .gitignore-d file, or just disappear on exiting Emacs.

I know bookmark+ has similar features, but I'd prefer something more
lightweight.

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.)

TIA,

--
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2019-12-27 10:19 Temporary notes in Emacs buffers? Marcin Borkowski
@ 2019-12-27 10:43 ` Mpho Jele
  2019-12-27 11:51   ` tomas
  2019-12-27 15:54 ` Drew Adams
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 60+ messages in thread
From: Mpho Jele @ 2019-12-27 10:43 UTC (permalink / raw)
  To: help-gnu-emacs

Check this out: https://github.com/joodland/bm/blob/master/README.md




^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2019-12-27 10:43 ` Mpho Jele
@ 2019-12-27 11:51   ` tomas
  2020-01-01 21:48     ` Marcin Borkowski
  0 siblings, 1 reply; 60+ messages in thread
From: tomas @ 2019-12-27 11:51 UTC (permalink / raw)
  To: Mpho Jele; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 706 bytes --]

On Fri, Dec 27, 2019 at 12:43:46PM +0200, Mpho Jele wrote:
> Check this out: https://github.com/joodland/bm/blob/master/README.md

Throwing "annotate" into the EmacsWiki draws some hits (note:
"annotate" is also a term in version control jargon, where it
has a slightly different meaning, so some filtering is needed):

  https://www.emacswiki.org/emacs/OrgAnnotateFile
  https://www.emacswiki.org/emacs/AnnotationMode
  https://www.emacswiki.org/emacs/org-annotate-file.el
  https://www.emacswiki.org/emacs/Annotate
  https://www.emacswiki.org/emacs/annotate.el

Besides, there's an annotate minor mode in Melpa (M-x list-packages,
in a reasonably recent Emacs) which might cover your needs.

Cheers
-- t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2019-12-27 10:19 Temporary notes in Emacs buffers? Marcin Borkowski
  2019-12-27 10:43 ` Mpho Jele
@ 2019-12-27 15:54 ` Drew Adams
  2020-01-02 17:49   ` Marcin Borkowski
  2020-01-05  2:37   ` Michael Heerdegen
  2019-12-27 17:48 ` Sharon Kimble
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 60+ messages in thread
From: Drew Adams @ 2019-12-27 15:54 UTC (permalink / raw)
  To: Marcin Borkowski, Help Gnu Emacs mailing list

> I've been wondering if there is some package which could let me make
> "temporary notes" in Emacs buffers, similar to (but different than) the
> "yellow notes" in some pdf viewers.
> 
> My use case is that I'm making a sweeping change across a pretty large
> codebase, and I'd like to make some notes in places I've already
> visited
> / ones I need to change / etc.
> 
> At present, I use normal code comments, however, this is suboptimal,
> since I cannot use them in certain modes (occur buffer, JSON).
> 
> Ideally, a place with a comment would have that comment highlighted
> somehow, and I should be able to go to the next/previous comment, and
> list all comments in a file or in the project (think Git repo,
> Projectile project or a directory tree).  Also, mass inserting such
> comments from an occur/multi-occur/projectile-ag/counsel-rg/etc.
> buffers
> would be great.
> 
> What I /don't/ want is modifying the files - the comments might persist
> in some /other/, .gitignore-d file, or just disappear on exiting Emacs.
> 
> I know bookmark+ has similar features, but I'd prefer something more
> lightweight.
> 
> 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.)

Vanilla Emacs bookmarks provide the ability to annotate.
Bookmark+ enhances annotating (e.g. to use Org and
indirection), but the annotation provided by vanilla
Emacs bookmarking does what you requested.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2019-12-27 10:19 Temporary notes in Emacs buffers? Marcin Borkowski
  2019-12-27 10:43 ` Mpho Jele
  2019-12-27 15:54 ` Drew Adams
@ 2019-12-27 17:48 ` Sharon Kimble
  2020-01-01  1:42 ` Michael Heerdegen
  2020-01-09  3:57 ` Michael Heerdegen
  4 siblings, 0 replies; 60+ messages in thread
From: Sharon Kimble @ 2019-12-27 17:48 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

Marcin Borkowski <mbork@mbork.pl> writes:

> Hi all,
>
> I've been wondering if there is some package which could let me make
> "temporary notes" in Emacs buffers, similar to (but different than) the
> "yellow notes" in some pdf viewers.
>
> My use case is that I'm making a sweeping change across a pretty large
> codebase, and I'd like to make some notes in places I've already visited
> / ones I need to change / etc.

Would 'side-notes' from elpa help? Its a buffer that opens up to the
side of your main buffer, in which you can record all sorts of stuff,
its up to you what you use it for. Then you could just put something
like [1] in the file that you are reviewing and a similar [1] in your
side-note with whatever comment you'd like to make. Its your choice.

To save putting a mark in your main file, you could just use
line-numbers, just as an off-the-cuff thought?

Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 10.1, fluxbox 1.3.7, emacs 26.3, org 9.3

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2019-12-27 10:19 Temporary notes in Emacs buffers? Marcin Borkowski
                   ` (2 preceding siblings ...)
  2019-12-27 17:48 ` Sharon Kimble
@ 2020-01-01  1:42 ` Michael Heerdegen
  2020-01-01  4:45   ` Drew Adams
  2020-01-02 17:48   ` Marcin Borkowski
  2020-01-09  3:57 ` Michael Heerdegen
  4 siblings, 2 replies; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-01  1:42 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

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.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-01  1:42 ` Michael Heerdegen
@ 2020-01-01  4:45   ` Drew Adams
  2020-01-01  5:00     ` Michael Heerdegen
  2020-01-02 17:48     ` Marcin Borkowski
  2020-01-02 17:48   ` Marcin Borkowski
  1 sibling, 2 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-01  4:45 UTC (permalink / raw)
  To: Michael Heerdegen, Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

> 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.

FWIW: Marcin said he wasn't interested, but
Bookmark+ really does offer all of that already.

Locations (single position or start+end) of
such "notes" (bookmarks) can be automatically
highlighted.  You can cycle next/previous. You
can hit a key to edit the content (annotation).
Or access any by its name.  (Names can also be
autogenerated.)

[You can also bookmark a multi-region - a set
of zones in a file (or across multiple files).
In that case, you have a single annotation for
the whole set.  (You can have any number of
such sets.)]

Bookmarks are pretty flexible.  You can use
them in lots of different ways.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-01  4:45   ` Drew Adams
@ 2020-01-01  5:00     ` Michael Heerdegen
  2020-01-01  6:25       ` Drew Adams
  2020-01-02 17:48     ` Marcin Borkowski
  1 sibling, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-01  5:00 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> Bookmarks are pretty flexible.  You can use them in lots of different
> ways.

Yeah - probably.  What I dislike I think: if I move a file to a
different location, the relation to the notes is lost, and I have to
manually relocate the file.  That might be annoying.  That's why my
favorite approach would be to save the data in the file itself or at
least in its directory instead of a central place.  Or is there a
solution for that problem using bookmarks, too?

Thanks,

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-01  5:00     ` Michael Heerdegen
@ 2020-01-01  6:25       ` Drew Adams
  2020-01-01 20:34         ` John Yates
                           ` (2 more replies)
  0 siblings, 3 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-01  6:25 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> > Bookmarks are pretty flexible.  You can use
> > them in lots of different ways.
> 
> Yeah - probably.  What I dislike I think: if I move a file to a
> different location, the relation to the notes is lost, and I have to
> manually relocate the file.  That might be annoying.  That's why my
> favorite approach would be to save the data in the file itself or at
> least in its directory instead of a central place.  Or is there a
> solution for that problem using bookmarks, too?

If you move the destination of a bookmark (the
file or the positions in it) then, when you try
to jump to it:

* If the file is available, but the contexts for
  the recorded positions within it can't be
  found, then an attempt is made to relocate -
  searching for the recorded contexts (text
  before & after the positions.

  If that's not successful, because the file has
  changed too much, then you're prompted to
  relocate the positions.

* If the general location (e.g. file) has moved,
  then you're prompted to relocate it.

You can also manually relocate a bookmark's
target any time, of course.

But normally, if the file has not moved, when
you jump to a bookmark the target positions are
automatically updated (well, it's optional):
The recorded positions are used as a starting
point, and then the recorded contexts are found.
If those have moved then the new location is
recorded.

---

There are advantages to saving annotations (e.g.
bookmarks) in a separate file from their targets.
And there are advantages of saving them in the
same file.

An annotation is a kind of metadata - a note
about the file content or a location.  There
are pros and cons for storing metadata and data
together.  This isn't special to file annotations.

---

You can have any number of bookmark files, and
they can be stored anywhere.  You can, as you
mention, store a file of bookmarks in the same
directory as the file or files that they target.

So you can, if you like, easily move both at
the same time, e.g. to another directory.

However, yes, the target file names recorded in
the bookmarks are absolute names.  So you would
want to define a command that not only moves the
bookmark file and its targeted files, together,
to the same new directory, but also updates the
recorded file names in the bookmarks, to reflect
the new target directory.  That wouldn't be hard.

You can also have bookmark lists composed of
bookmark lists.  And mappings between bookmark
files and bookmark lists need not be 1:1.  You
can have a bookmark file for a book you're
writing, and bookmark lists for each of its
chapters.  Or separate bookmark files for the
chapters.

And you can bookmark a bookmark list, e.g.,
switch to a different chapter just by jumping
to a bookmark-list bookmark.

The only requirement is that a bookmark file
be separate from the files targeted by its
bookmarks.  Why?  Because, like a directory,
a bookmark file is a list of a bunch of files
and their metadata.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-01  6:25       ` Drew Adams
@ 2020-01-01 20:34         ` John Yates
  2020-01-01 21:19           ` Drew Adams
  2020-01-01 21:47           ` Marcin Borkowski
  2020-01-02  1:25         ` Michael Heerdegen
  2020-01-11  7:36         ` Michael Heerdegen
  2 siblings, 2 replies; 60+ messages in thread
From: John Yates @ 2020-01-01 20:34 UTC (permalink / raw)
  To: Drew Adams; +Cc: Michael Heerdegen, Help Gnu Emacs mailing list

My sense of why bookmarks of any sort are not
a solution is that the mapping goes the wrong
way.  You open a list of bookmarks and expect
them to take you to the appropriate targets.
Marcin seems to want to open the target and
have it known whether or not there are any
relevant notes.

/john


^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-01 20:34         ` John Yates
@ 2020-01-01 21:19           ` Drew Adams
  2020-01-01 21:47           ` Marcin Borkowski
  1 sibling, 0 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-01 21:19 UTC (permalink / raw)
  To: John Yates; +Cc: Michael Heerdegen, Help Gnu Emacs mailing list

> My sense of why bookmarks of any sort are not
> a solution is that the mapping goes the wrong
> way.  You open a list of bookmarks and expect
> them to take you to the appropriate targets.
> Marcin seems to want to open the target and
> have it known whether or not there are any
> relevant notes.

That's not true of Bookmark+ bookmarks.
As I said, you can automatically highlight
their locations.  As Marcin requested:

  > similar to (but different than) the
  > "yellow notes" in some pdf viewers.

And you can use different kinds of highlighting
for different sets of bookmarks.

You need not ever display a list of bookmarks,
or even a list of a given set/type of bookmarks.
You can access (show/edit) a bookmark at its
point of use (its target).



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-01 20:34         ` John Yates
  2020-01-01 21:19           ` Drew Adams
@ 2020-01-01 21:47           ` Marcin Borkowski
  1 sibling, 0 replies; 60+ messages in thread
From: Marcin Borkowski @ 2020-01-01 21:47 UTC (permalink / raw)
  To: John Yates; +Cc: Michael Heerdegen, Help Gnu Emacs mailing list


On 2020-01-01, at 21:34, John Yates <john@yates-sheets.org> wrote:

> My sense of why bookmarks of any sort are not
> a solution is that the mapping goes the wrong
> way.  You open a list of bookmarks and expect
> them to take you to the appropriate targets.
> Marcin seems to want to open the target and
> have it known whether or not there are any
> relevant notes.

Yes and no.  In the end, I need the list, too.  But this is a very good
point.

Thanks,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2019-12-27 11:51   ` tomas
@ 2020-01-01 21:48     ` Marcin Borkowski
  0 siblings, 0 replies; 60+ messages in thread
From: Marcin Borkowski @ 2020-01-01 21:48 UTC (permalink / raw)
  To: tomas; +Cc: help-gnu-emacs, Mpho Jele


On 2019-12-27, at 12:51, tomas@tuxteam.de wrote:

> On Fri, Dec 27, 2019 at 12:43:46PM +0200, Mpho Jele wrote:
>> Check this out: https://github.com/joodland/bm/blob/master/README.md
>
> Throwing "annotate" into the EmacsWiki draws some hits (note:
> "annotate" is also a term in version control jargon, where it
> has a slightly different meaning, so some filtering is needed):
>
>   https://www.emacswiki.org/emacs/OrgAnnotateFile
>   https://www.emacswiki.org/emacs/AnnotationMode
>   https://www.emacswiki.org/emacs/org-annotate-file.el
>   https://www.emacswiki.org/emacs/Annotate
>   https://www.emacswiki.org/emacs/annotate.el
>
> Besides, there's an annotate minor mode in Melpa (M-x list-packages,
> in a reasonably recent Emacs) which might cover your needs.

Thanks to both of you, I will check these out.

Best,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-01  6:25       ` Drew Adams
  2020-01-01 20:34         ` John Yates
@ 2020-01-02  1:25         ` Michael Heerdegen
  2020-01-02  3:16           ` Drew Adams
  2020-01-11  7:36         ` Michael Heerdegen
  2 siblings, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-02  1:25 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> However, yes, the target file names recorded in
> the bookmarks are absolute names.  So you would
> want to define a command that not only moves the
> bookmark file and its targeted files, together,
> to the same new directory, but also updates the
> recorded file names in the bookmarks, to reflect
> the new target directory.  That wouldn't be hard.

Not hard, but a disadvantage, because I need to remember that I need to
do it.  All the time.  Or hack any possible way to move files in Emacs.
That's a big minus for me.

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-02  1:25         ` Michael Heerdegen
@ 2020-01-02  3:16           ` Drew Adams
  2020-01-02  3:45             ` Michael Heerdegen
  0 siblings, 1 reply; 60+ messages in thread
From: Drew Adams @ 2020-01-02  3:16 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> > However, yes, the target file names recorded in
> > the bookmarks are absolute names.  So you would
> > want to define a command that not only moves the
> > bookmark file and its targeted files, together,
> > to the same new directory, but also updates the
> > recorded file names in the bookmarks, to reflect
> > the new target directory.  That wouldn't be hard.
> 
> Not hard, but a disadvantage, because I need to remember that I need to
> do it.  All the time.  Or hack any possible way to move files in Emacs.
> That's a big minus for me.

Do you really often move files for which you have
associated notes?

If so, then you might consider defining a file
handler, to take care of that automatically (by
its `rename-file' operation).

---

Or yes, not use bookmarks for your annotations.

It's clear that the bookmarks that target a
file are something separate from the file,
linked with it only by that targeting.

This is different from, say, file attributes,
which "stay with the file" when you move it,
because they're managed by the same thing that
does the moving: the file system.

And it is different from, say, storing notes
in the file content in some way.

As I said earlier, there are advantages to
having such metadata as part of the data
(file). There are also disadvantages.  It
depends on the various things you want to do,
and how they're implemented.

Bookmarks aren't the answer to everything. ;-)



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-02  3:16           ` Drew Adams
@ 2020-01-02  3:45             ` Michael Heerdegen
  2020-01-02  5:30               ` Drew Adams
  0 siblings, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-02  3:45 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> 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.

> 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?

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-02  3:45             ` Michael Heerdegen
@ 2020-01-02  5:30               ` Drew Adams
  2020-01-02 15:41                 ` Drew Adams
  2020-01-03  1:07                 ` Michael Heerdegen
  0 siblings, 2 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-02  5:30 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> > 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
above.)

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).]



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-02  5:30               ` Drew Adams
@ 2020-01-02 15:41                 ` Drew Adams
  2020-01-03  1:07                 ` Michael Heerdegen
  1 sibling, 0 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-02 15:41 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> 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.

Let me add this:

If your use case is limited to being in the same
directory as the file targeted by your bookmark(s),
then you can just use `default-directory' in your
handler, as the directory in which to look up the
file name (ignoring any recorded directory).

This could be the case, e.g., if you always accessed
your bookmarks from the file itself (e.g., at their
highlighted locations there).  That's the case we've
been discussing, at least in part.

It's also possible to use `default-directory' if
you want to use a relative file name that includes
more than just the non-directory part.  E.g., if
your file is in a subdir of `default-directory`
(current pwd), then you could look it up using
the relevant part of the recorded absolute file
name.  (Or your new bookmark type could record
only such a relevant part as the target location.)

This could be the case if you access the bookmarks
from a parent or other directory (relative file
names can include `../' etc.), but you'll know
where you'll access them from, so the handler can
assume that directory - no need to look it up
somewhere.

There are various possibilities, depending on just
what you might want to do.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-01  1:42 ` Michael Heerdegen
  2020-01-01  4:45   ` Drew Adams
@ 2020-01-02 17:48   ` Marcin Borkowski
  1 sibling, 0 replies; 60+ messages in thread
From: Marcin Borkowski @ 2020-01-02 17:48 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list


On 2020-01-01, at 02:42, Michael Heerdegen <michael_heerdegen@web.de> wrote:

> 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?

Yes, I have saved it.

Best,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-01  4:45   ` Drew Adams
  2020-01-01  5:00     ` Michael Heerdegen
@ 2020-01-02 17:48     ` Marcin Borkowski
  1 sibling, 0 replies; 60+ messages in thread
From: Marcin Borkowski @ 2020-01-02 17:48 UTC (permalink / raw)
  To: Drew Adams; +Cc: Michael Heerdegen, Help Gnu Emacs mailing list


On 2020-01-01, at 05:45, Drew Adams <drew.adams@oracle.com> wrote:

>> 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.
>
> FWIW: Marcin said he wasn't interested, but
> Bookmark+ really does offer all of that already.

I know that, but it is very big and thus daunting to me.

Best,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2019-12-27 15:54 ` Drew Adams
@ 2020-01-02 17:49   ` Marcin Borkowski
  2020-01-05  2:37   ` Michael Heerdegen
  1 sibling, 0 replies; 60+ messages in thread
From: Marcin Borkowski @ 2020-01-02 17:49 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list


On 2019-12-27, at 16:54, Drew Adams <drew.adams@oracle.com> wrote:

>> I've been wondering if there is some package which could let me make
>> "temporary notes" in Emacs buffers, similar to (but different than) the
>> "yellow notes" in some pdf viewers.
>> 
>> My use case is that I'm making a sweeping change across a pretty large
>> codebase, and I'd like to make some notes in places I've already
>> visited
>> / ones I need to change / etc.
>> 
>> At present, I use normal code comments, however, this is suboptimal,
>> since I cannot use them in certain modes (occur buffer, JSON).
>> 
>> Ideally, a place with a comment would have that comment highlighted
>> somehow, and I should be able to go to the next/previous comment, and
>> list all comments in a file or in the project (think Git repo,
>> Projectile project or a directory tree).  Also, mass inserting such
>> comments from an occur/multi-occur/projectile-ag/counsel-rg/etc.
>> buffers
>> would be great.
>> 
>> What I /don't/ want is modifying the files - the comments might persist
>> in some /other/, .gitignore-d file, or just disappear on exiting Emacs.
>> 
>> I know bookmark+ has similar features, but I'd prefer something more
>> lightweight.
>> 
>> 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.)
>
> Vanilla Emacs bookmarks provide the ability to annotate.
> Bookmark+ enhances annotating (e.g. to use Org and
> indirection), but the annotation provided by vanilla
> Emacs bookmarking does what you requested.

Thanks, I'll check it out.

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-02  5:30               ` Drew Adams
  2020-01-02 15:41                 ` Drew Adams
@ 2020-01-03  1:07                 ` Michael Heerdegen
  2020-01-03  3:35                   ` John Yates
                                     ` (2 more replies)
  1 sibling, 3 replies; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-03  1:07 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> 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.

Yes.

> > 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
> [...]

Can't I just use a file or directory local variable for that part?  That
would be a trivial solution for the problem.

The problem is that the bookmark file can't know where I may have moved
a file to -- but I'm very unlikely to move the bookmark file very often.
So I would prefer a solution where the file knows where to ask for its
bookmarks and annotations, and the bookmark mechanism has the data and
the mean to deliver it.

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-03  1:07                 ` Michael Heerdegen
@ 2020-01-03  3:35                   ` John Yates
  2020-01-03  6:38                     ` Drew Adams
                                       ` (2 more replies)
  2020-01-03  7:00                   ` Drew Adams
  2020-01-03 13:31                   ` arthur miller
  2 siblings, 3 replies; 60+ messages in thread
From: John Yates @ 2020-01-03  3:35 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

This broaches the question of what is being annotated,
the file as a container (e.g. inode) or its contents:

   1. What happens when one moves the file?
   2. What happens when one copies the file?
   3. What if after the copy one deletes the original?

My sense is that this thread is most concerned with use
case number 1.

An approach not yet mentioned is including some form of
UUID as a file local variable.  In such a setting notes
indirect through a persistent UUID-to-path map.  A file
handler recognizes relevant operations on UUID annotated
and updates the map.  This might also include updating
the new copy's UUID to preserve uniqueness.

/john


^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-03  3:35                   ` John Yates
@ 2020-01-03  6:38                     ` Drew Adams
  2020-01-03  7:06                     ` Drew Adams
  2020-01-04  6:39                     ` Michael Heerdegen
  2 siblings, 0 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-03  6:38 UTC (permalink / raw)
  To: John Yates, Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

 

This broaches the question of what is being annotated,
the file as a container (e.g. inode) or its contents

 

If we're still talking about bookmarks, then either one can be the target. To get to the content you first get to the container. But there's no requirement that you target any of the content. A bookmark can act in any way you like on a file, as container, without having anything to do with the content. A bookmark's handler is just a function.

What happens when one moves the file?
What happens when one copies the file?
What if after the copy one deletes the original?

My sense is that this thread is most concerned with use
case number 1.

An approach not yet mentioned is including some form of
UUID as a file local variable.  In such a setting notes
indirect through a persistent UUID-to-path map.  A file
handler recognizes relevant operations on UUID annotated
and updates the map.  This might also include updating
the new copy's UUID to preserve uniqueness.

If Emacs gives you a way to get to a file by an UUID that doesn't change when you move the file, then you could use that in a bookmark. That might, indeed, be a good answer. I don't know that Emacs provides such a way (how?). (You can get the inode of a file, but can you find a file, given its inode?)


^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-03  1:07                 ` Michael Heerdegen
  2020-01-03  3:35                   ` John Yates
@ 2020-01-03  7:00                   ` Drew Adams
  2020-01-03 13:31                   ` arthur miller
  2 siblings, 0 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-03  7:00 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> > 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 [...]
> 
> Can't I just use a file or directory local variable
> for that part? That would be a trivial solution
> for the problem.

You can.  I think I mentioned that.  You can put
the new location of the file anywhere you like,
for a bookmark to pick up and use.

Is it trivial for you to update a variable value
whenever you move the target file?  If so, then
Bob's your uncle - just use a bookmark handler
that uses the variable value to provide the dir.

The point is that the code that handles a bookmark
has to get that info from somewhere.

Currently it gets it from the bookmark (as an
absolute file name), but it could get it anywhere.

If you're sure to be in the same dir as the target
file when you use a bookmark to it, then you can
have the handler just use `default-directory' - no
need for any variable or whatever.

If not, but if some other rule applies for knowing
the location of the file relative to the place
where you invoke the bookmark, then you can code
that in the handler.

If not - e.g., if you put the new location in a
var or whatever, then the handler can get it there.

There's no miracle.  The bookmark is separate from
the target file.  As a consequence, you need to
provide some connection between the two, which
will remain valid when you move the file - a rule,
a lookup,... - something.

> The problem is that the bookmark file can't know
> where I may have moved a file to

Bookmark, not bookmark file.  It's not about
the bookmark file.  (I may have misspoken and
given the wrong impression about that.)

If the bookmark you invoke can assume that the
target file will always be in some location
relative to where it's invoked (e.g. same dir),
or if the file location can be obtained somehow,
then there's no problem - how to obtain it just
needs to be coded in the bookmark's handler.

If the handler can assume that the file's dir
will always be in some variable, or obtainable
by some function, then it can use that info.

> -- but I'm very unlikely to move the bookmark
> file very often.

It's not about where the bookmark file is.
It's about how the bookmark is accessed (from
where), and how it gets the target location.

> So I would prefer a solution where the file
> knows where to ask for its bookmarks and
> annotations, and the bookmark mechanism has
> the data and the mean to deliver it.

See above.  It's up to you to define that
mechanism - how "the file knows" and "asks".

Various means are available for linking the
bookmark and its target file logically.  But
they do need to be linked, in some way.  How
you do that depends on your use case.  I can
only say that, because the bookmark and its
target file are separate, some linkage is
needed.

---

I suggest that the general discussion of
your and Marcin's questions be continued in
this thread, and that if there's a more
detailed discussion to be had about how to
do what you want using bookmarks we do that
off-list, as it might be a distraction.
Just a suggestion.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-03  3:35                   ` John Yates
  2020-01-03  6:38                     ` Drew Adams
@ 2020-01-03  7:06                     ` Drew Adams
  2020-01-04  6:39                     ` Michael Heerdegen
  2 siblings, 0 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-03  7:06 UTC (permalink / raw)
  To: John Yates, Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

[Sending my reply again, as the HTML reply
made no distinction (that I can see in my
email client) between what you wrote and
what I replied.] 

> This broaches the question of what is being annotated,
> the file as a container (e.g. inode) or its contents

If we're still talking about bookmarks, then
either one can be the target.  To get to the
content you first get to the container.  But
there's no requirement that you target any
of the content.  A bookmark can act in any
way you like on a file, as container, without
having anything to do with the content.
A bookmark's handler is just a function.

> 1. What happens when one moves the file?
> 2. What happens when one copies the file?
> 3. What if after the copy one deletes the original?
>
> My sense is that this thread is most concerned
> with use case number 1.
> 
> An approach not yet mentioned is including some
> form of UUID as a file local variable.  In such
> a setting notes indirect through a persistent
> UUID-to-path map.  A file handler recognizes
> relevant operations on UUID annotated and
> updates the map.  This might also include
> updating the new copy's UUID to preserve
> uniqueness.

If Emacs gives you a way to get to a file
by an UUID that doesn't change when you
move the file, then you could use that in
a bookmark. That might, indeed, be a good
answer. I don't know that Emacs provides
such a way (how?). (You can get the inode
of a file, but can you find a file, given
its inode?)



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-03  1:07                 ` Michael Heerdegen
  2020-01-03  3:35                   ` John Yates
  2020-01-03  7:00                   ` Drew Adams
@ 2020-01-03 13:31                   ` arthur miller
  2020-01-05  2:18                     ` Michael Heerdegen
  2 siblings, 1 reply; 60+ messages in thread
From: arthur miller @ 2020-01-03 13:31 UTC (permalink / raw)
  To: Michael Heerdegen, Drew Adams; +Cc: Help Gnu Emacs mailing list

Interesting discussion.

To me it is clear that any solution to a file format, such as plain ascii text, is going to be external to annotated file itself. Whatever you use, Drew's bookmarks+, file- or dir-local, or some other custom. An external solution implies that you will have your annotation in different place then file itself which you will have to take care off with backups, moving etc. You could automate that by implementing some kind of file handler as Drew suggested some day ago. You can implement something in Emacs as a hook to file save and/or dired machinery or if you are on Gnu/linux you could use inotify.

Otherwise there is Org, you can use org mode (or something similar) and implement your annotations as references or hyperlinks or something else. That would turn your text file into org text file.

There is also some org annotation mode that won't change your original text fil:

https://www.emacswiki.org/emacs/OrgAnnotateFile

 but with same problem of having annotation separated from the original file.

Skickat från min Samsung Galaxy-smartphone.



-------- Originalmeddelande --------
Från: Michael Heerdegen <michael_heerdegen@web.de>
Datum: 2020-01-03 02:08 (GMT+01:00)
Till: Drew Adams <drew.adams@oracle.com>
Kopia: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Ämne: Re: Temporary notes in Emacs buffers?

Drew Adams <drew.adams@oracle.com> writes:

> 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.

Yes.

> > 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
> [...]

Can't I just use a file or directory local variable for that part?  That
would be a trivial solution for the problem.

The problem is that the bookmark file can't know where I may have moved
a file to -- but I'm very unlikely to move the bookmark file very often.
So I would prefer a solution where the file knows where to ask for its
bookmarks and annotations, and the bookmark mechanism has the data and
the mean to deliver it.

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-03  3:35                   ` John Yates
  2020-01-03  6:38                     ` Drew Adams
  2020-01-03  7:06                     ` Drew Adams
@ 2020-01-04  6:39                     ` Michael Heerdegen
  2020-01-04 16:04                       ` Drew Adams
  2 siblings, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-04  6:39 UTC (permalink / raw)
  To: John Yates; +Cc: Help Gnu Emacs mailing list

John Yates <john@yates-sheets.org> writes:

> An approach not yet mentioned is including some form of
> UUID as a file local variable.  In such a setting notes
> indirect through a persistent UUID-to-path map.  A file
> handler recognizes relevant operations on UUID annotated
> and updates the map.  This might also include updating
> the new copy's UUID to preserve uniqueness.

But Emacs would have to prompt, because if the copy is meant as backup,
the UUID shouldn't be changed.  And if I happen to not use Emacs (but
e.g. rsync) those handlers would not run, right?

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-04  6:39                     ` Michael Heerdegen
@ 2020-01-04 16:04                       ` Drew Adams
  2020-01-06 14:18                         ` John Yates
  0 siblings, 1 reply; 60+ messages in thread
From: Drew Adams @ 2020-01-04 16:04 UTC (permalink / raw)
  To: Michael Heerdegen, John Yates; +Cc: Help Gnu Emacs mailing list

> > An approach not yet mentioned is including some form of
> > UUID as a file local variable.  In such a setting notes
> > indirect through a persistent UUID-to-path map.  A file
> > handler recognizes relevant operations on UUID annotated
> > and updates the map.  This might also include updating
> > the new copy's UUID to preserve uniqueness.
> 
> But Emacs would have to prompt, because if the copy is meant as backup,
> the UUID shouldn't be changed.  And if I happen to not use Emacs (but
> e.g. rsync) those handlers would not run, right?

My question about this is (still) how do you use
`find-file' (or something else) to open a file
for editing, given just the inode/UUID?

Such a thing could be recorded in a bookmark,
but how to use it, to get to the file, with
Emacs?



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-03 13:31                   ` arthur miller
@ 2020-01-05  2:18                     ` Michael Heerdegen
  0 siblings, 0 replies; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-05  2:18 UTC (permalink / raw)
  To: arthur miller; +Cc: Help Gnu Emacs mailing list

arthur miller <arthur.miller@live.com> writes:

> There is also some org annotation mode that won't change your original
> text fil:
>
> https://www.emacswiki.org/emacs/OrgAnnotateFile
>
>  but with same problem of having annotation separated from the
> original file.

Does that package offer to attach the notes to a certain position in a
file?  Seems not to be the case.  But it's still nice.


Thanks,

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2019-12-27 15:54 ` Drew Adams
  2020-01-02 17:49   ` Marcin Borkowski
@ 2020-01-05  2:37   ` Michael Heerdegen
  2020-01-05 17:54     ` Drew Adams
  1 sibling, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-05  2:37 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> Vanilla Emacs bookmarks provide the ability to annotate.
> Bookmark+ enhances annotating (e.g. to use Org and
> indirection), but the annotation provided by vanilla
> Emacs bookmarking does what you requested.

Do Vanilla bookmarks really recognize automatically when a bookmarked
position has changed because the user has inserted some preceding text?
I mean, I know bookmarks save surrounding text to work around that
problem but that works only by luck most of the time.  Same question for
highlighting bookmarked positions: I thought such features were only
added by "bookmark+"?

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-05  2:37   ` Michael Heerdegen
@ 2020-01-05 17:54     ` Drew Adams
  2020-01-06  5:18       ` Jean-Christophe Helary
  0 siblings, 1 reply; 60+ messages in thread
From: Drew Adams @ 2020-01-05 17:54 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> > Vanilla Emacs bookmarks provide the ability to annotate.
> > Bookmark+ enhances annotating (e.g. to use Org and
> > indirection), but the annotation provided by vanilla
> > Emacs bookmarking does what you requested.

(Note: That statement is only about annotating.
Your response is about automatic relocation and
highlighting.)

> Do Vanilla bookmarks really recognize automatically
> when a bookmarked position has changed because the
> user has inserted some preceding text?  I mean, I
> know bookmarks save surrounding text to work around that
> problem but that works only by luck most of the time.

Yes.  I don't think it works only by luck most of
the time.  I think it works well most of the time.

Of course, if there are large edits before the
next time you jump to a bookmark, then, yes, it
might not be possible to relocate it automatically
(in which case you're prompted to relocate it
manually).

But edits between jumps to a bookmark are, I think,
typically not so large as to prevent automatic
relocating.

Also, the automatic relocation of Bookmark+ is
better than that of vanilla Emacs.

> Same question for highlighting bookmarked positions:
> I thought such features were only added by "bookmark+"?

Correct.  That is added by Bookmark+.  It's not
available with vanilla bookmark handling.

If you use Bookmark+ then the highlighting is
available also for bookmarks created with vanilla
Emacs.  But the highlighting is not available
without Bookmark+.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-05 17:54     ` Drew Adams
@ 2020-01-06  5:18       ` Jean-Christophe Helary
  2020-01-06 15:12         ` Drew Adams
  0 siblings, 1 reply; 60+ messages in thread
From: Jean-Christophe Helary @ 2020-01-06  5:18 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list



> On Jan 6, 2020, at 2:54, Drew Adams <drew.adams@oracle.com> wrote:
> 
> If you use Bookmark+ then the highlighting is
> available also for bookmarks created with vanilla
> Emacs.  But the highlighting is not available
> without Bookmark+.

I am not seeing Bookmark+ in Melpa, is it only on EmacsWiki ?

Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-04 16:04                       ` Drew Adams
@ 2020-01-06 14:18                         ` John Yates
  2020-01-06 14:34                           ` tomas
  0 siblings, 1 reply; 60+ messages in thread
From: John Yates @ 2020-01-06 14:18 UTC (permalink / raw)
  To: Drew Adams; +Cc: Michael Heerdegen, Help Gnu Emacs mailing list

On Sat, Jan 4, 2020 at 11:05 AM Drew Adams <drew.adams@oracle.com> wrote:
> > An approach not yet mentioned is including some form of
> > UUID as a file local variable.  In such a setting notes
> > indirect through a persistent UUID-to-path map.  A file
> > handler recognizes relevant operations on UUID annotated
> > and updates the map.  This might also include updating
> > the new copy's UUID to preserve uniqueness.
>
> My question about this is (still) how do you use
> `find-file' (or something else) to open a file
> for editing, given just the inode/UUID?
>
> Such a thing could be recorded in a bookmark,
> but how to use it, to get to the file, with
> Emacs?

This is rather half baked.  It combined ideas from Gnu arch and
Apollo Computer's distributed file system.  The common thread is
the idea of a UUID.

The Gnu arch DVCS embedded the UUID in the text of a file being
managed (essentially an elisp file local variable).  This was
crucial to supporting renaming.

An Apollo UUID contained the equivalent of the MAC address for
the node which first handed out that UUID.  UUIDs were used in
many ways and many APIs.  In particular the UUID replaced an
inode index.  This made the ID of a file container universal
rather than file system relative.  The equivalent of the inode
table was a persistent hash table indexed by UUID.

File lookup by UUID was not only supported but fundamental:
directories were mapping from names to UUIDs.

Simplified file open by UUID:

  First: attempt local open:
  * Probe local file system's hash table using UUID as key
  * If found return a local file connection

  Fallback: attempt remote open:
  * Extract MAC address from UUID
  * If self then return file-not-found
  * Use MAC address to talk to node that issued that UUID
  * Ask that node to open a file by UUID
  * Remote node performs only the local half of file open
  * If found return a cross-network remote file connection

  Otherwise return file-not-found

The above works up until one allows UUID identified objects to
migrate across nodes.  To support such use cases Apollo added a
redirection service.  The idea was that any node that allowed a
UUID containing its own MAC address to be exposed on another node
was responsible for tracking that UUID.  Persisting a foreign
UUID involved first obtaining permission from the source node's
redirection service.  This allowed the source node to record
whither its UUID had migrated.  With the redirection service in
place prior to probing the local file system's hash table for a
local UUID one would ask the redirection service whether the
presented UUID had been migrated.  If so the result was a
redirect status identifying the node now hosting that UUID.

If any of that makes sense then perhaps some of the ideas can
be turned into a design using a persistent UUID-to-path map to
associate notes to files identified by an embedded UUID.

/john



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-06 14:18                         ` John Yates
@ 2020-01-06 14:34                           ` tomas
  2020-01-06 15:19                             ` John Yates
  0 siblings, 1 reply; 60+ messages in thread
From: tomas @ 2020-01-06 14:34 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

On Mon, Jan 06, 2020 at 09:18:56AM -0500, John Yates wrote:

[...]

> An Apollo UUID contained the equivalent of the MAC address for
[...]

Thanks for this enjoyable history lesson!

I didn't know that this MAC-in-UUID thing originated in
Apollo  (and din't know why it was there: now it makes
sense). I just took it for one of those typical Microsoft
messups.

The MAC-in-UUID is now mostly gone, for privacy reasons,
and perhaps even obsolete, with mobile devices rolling
their dice each time they need an UUID.

But yes, tracking files around is an iteresting problem
in itself, digging up even more interesting philosophical
questions (and technical, of course).

Cheers
-- tomás

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-06  5:18       ` Jean-Christophe Helary
@ 2020-01-06 15:12         ` Drew Adams
  2020-01-09  1:03           ` Michael Heerdegen
  0 siblings, 1 reply; 60+ messages in thread
From: Drew Adams @ 2020-01-06 15:12 UTC (permalink / raw)
  To: Jean-Christophe Helary, Help Gnu Emacs mailing list

> I am not seeing Bookmark+ in Melpa, is it only on EmacsWiki ?

Yes.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-06 14:34                           ` tomas
@ 2020-01-06 15:19                             ` John Yates
  2020-01-06 15:31                               ` tomas
  2020-01-06 16:28                               ` arthur miller
  0 siblings, 2 replies; 60+ messages in thread
From: John Yates @ 2020-01-06 15:19 UTC (permalink / raw)
  To: tomas; +Cc: Help Gnu Emacs mailing list

Tomás,

Paul Leach was responsible for the UUID's importance in Apollo's
architecture.  (Back
then it was called simply a UID.)  Paul was an early PhD student under
future von
Neumann medal and Turing award winner Barbara Liskov.  He was the most visionary
of the Apollo architects.  When Apollo got steamrolled by Sun Bill
Gates personally
recruited Paul to move to Microsoft.

You can learn more about Apollo's architecture here:

http://bitsavers.trailing-edge.com/pdf/apollo/Apollo_DOMAIN_Architecture_Feb81.pdf
http://bitsavers.trailing-edge.com/pdf/apollo/AEGIS_Overview_1985.pdf
http://bitsavers.trailing-edge.com/pdf/apollo/AEGIS_Internals_and_Data_Structures_Jan86.pdf

/john



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-06 15:19                             ` John Yates
@ 2020-01-06 15:31                               ` tomas
  2020-01-06 16:28                               ` arthur miller
  1 sibling, 0 replies; 60+ messages in thread
From: tomas @ 2020-01-06 15:31 UTC (permalink / raw)
  To: John Yates; +Cc: Help Gnu Emacs mailing list

[-- Attachment #1: Type: text/plain, Size: 108 bytes --]

On Mon, Jan 06, 2020 at 10:19:41AM -0500, John Yates wrote:
> Tomás,

Wow -- thanks :)

Cheers
-- t

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-06 15:19                             ` John Yates
  2020-01-06 15:31                               ` tomas
@ 2020-01-06 16:28                               ` arthur miller
  1 sibling, 0 replies; 60+ messages in thread
From: arthur miller @ 2020-01-06 16:28 UTC (permalink / raw)
  To: John Yates; +Cc: Help Gnu Emacs mailing list

John Yates <john@yates-sheets.org> writes:

> Tomás,
>
> Paul Leach was responsible for the UUID's importance in Apollo's
> architecture.  (Back
> then it was called simply a UID.)  Paul was an early PhD student under
> future von
> Neumann medal and Turing award winner Barbara Liskov.  He was the most visionary
> of the Apollo architects.  When Apollo got steamrolled by Sun Bill
> Gates personally
> recruited Paul to move to Microsoft.
>
> You can learn more about Apollo's architecture here:
>
> http://bitsavers.trailing-edge.com/pdf/apollo/Apollo_DOMAIN_Architecture_Feb81.pdf
> http://bitsavers.trailing-edge.com/pdf/apollo/AEGIS_Overview_1985.pdf
> http://bitsavers.trailing-edge.com/pdf/apollo/AEGIS_Internals_and_Data_Structures_Jan86.pdf
>
> /john

Wow, thanks for the writings about Apollo and links! 

^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-06 15:12         ` Drew Adams
@ 2020-01-09  1:03           ` Michael Heerdegen
  2020-01-09 23:35             ` arthur miller
  0 siblings, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-09  1:03 UTC (permalink / raw)
  To: Drew Adams; +Cc: Jean-Christophe Helary, Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> > I am not seeing Bookmark+ in Melpa, is it only on EmacsWiki ?
>
> Yes.

And AFAIK, Melpa can't fetch from Emacs wiki, AFAIR that's the
underlying problem.

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2019-12-27 10:19 Temporary notes in Emacs buffers? Marcin Borkowski
                   ` (3 preceding siblings ...)
  2020-01-01  1:42 ` Michael Heerdegen
@ 2020-01-09  3:57 ` Michael Heerdegen
  2020-01-15 18:43   ` Marcin Borkowski
  4 siblings, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-09  3:57 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

Marcin Borkowski <mbork@mbork.pl> writes:

> I've been wondering if there is some package which could let me make
> "temporary notes" in Emacs buffers, similar to (but different than) the
> "yellow notes" in some pdf viewers.

Just for fun I've created a template for how the least common multiple
of our expectations could look like.  I guess there are many different
expectations of how contents, visualizations and ways of saving for
notes could look like, so I made it so that all of that is changeable
and extensible.

I'm not yet sure what would have to be done to support mass annotation
from occur buffers since I don't use them a lot.

I'm also not sure where in the implementation I could rely on existing
code - especially for saving (eieio-persistent maybe?).



[-- Attachment #2: side-note.el --]
[-- Type: application/emacs-lisp, Size: 3957 bytes --]

[-- Attachment #3: Type: text/plain, Size: 20 bytes --]



Thanks,

Michael.

^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-09  1:03           ` Michael Heerdegen
@ 2020-01-09 23:35             ` arthur miller
  2020-01-10  4:58               ` Michael Heerdegen
  2020-01-10  9:10               ` Unknown
  0 siblings, 2 replies; 60+ messages in thread
From: arthur miller @ 2020-01-09 23:35 UTC (permalink / raw)
  To: Michael Heerdegen, Drew Adams
  Cc: Jean-Christophe Helary, Help Gnu Emacs mailing list

You will have to either get it from wiki page or to search on github. There was someone who mirrored entire Emacs wiki source on github, so you could use quelpa to fetch it from github directly.

Skickat från min Samsung Galaxy-smartphone.



-------- Originalmeddelande --------
Från: Michael Heerdegen <michael_heerdegen@web.de>
Datum: 2020-01-09 02:04 (GMT+01:00)
Till: Drew Adams <drew.adams@oracle.com>
Kopia: Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org>, Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Ämne: Re: Temporary notes in Emacs buffers?

Drew Adams <drew.adams@oracle.com> writes:

> > I am not seeing Bookmark+ in Melpa, is it only on EmacsWiki ?
>
> Yes.

And AFAIK, Melpa can't fetch from Emacs wiki, AFAIR that's the
underlying problem.

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-09 23:35             ` arthur miller
@ 2020-01-10  4:58               ` Michael Heerdegen
  2020-01-10  9:30                 ` Robert Pluim
  2020-01-10  9:10               ` Unknown
  1 sibling, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-10  4:58 UTC (permalink / raw)
  To: arthur miller; +Cc: Jean-Christophe Helary, Help Gnu Emacs mailing list

arthur miller <arthur.miller@live.com> writes:

> You will have to either get it from wiki page or to search on
> github. There was someone who mirrored entire Emacs wiki source on
> github, so you could use quelpa to fetch it from github directly.

Can that be done with a Melpa recipe?  Then bookmark+ could be added
to Melpa, right?

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-09 23:35             ` arthur miller
  2020-01-10  4:58               ` Michael Heerdegen
@ 2020-01-10  9:10               ` Unknown
  1 sibling, 0 replies; 60+ messages in thread
From: Unknown @ 2020-01-10  9:10 UTC (permalink / raw)
  To: arthur miller
  Cc: Michael Heerdegen, Drew Adams, Jean-Christophe Helary,
	Help Gnu Emacs mailing list

arthur miller <arthur.miller@live.com> 작성:

> You will have to either get it from wiki page or to search on github.  
> There was someone who mirrored entire Emacs wiki source on github, so you  
> could use quelpa to fetch it from github directly.

Emacsmirror[0], right?
Bookmarks+[1] is also included (as said).

[0] https://emacsmirror.net
[1] https://github.com/emacsmirror/bookmark-plus



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-10  4:58               ` Michael Heerdegen
@ 2020-01-10  9:30                 ` Robert Pluim
  2020-01-10 10:01                   ` Michael Heerdegen
  2020-01-10 17:04                   ` Drew Adams
  0 siblings, 2 replies; 60+ messages in thread
From: Robert Pluim @ 2020-01-10  9:30 UTC (permalink / raw)
  To: Michael Heerdegen
  Cc: Jean-Christophe Helary, Help Gnu Emacs mailing list,
	arthur miller

>>>>> On Fri, 10 Jan 2020 05:58:24 +0100, Michael Heerdegen <michael_heerdegen@web.de> said:

    Michael> arthur miller <arthur.miller@live.com> writes:
    >> You will have to either get it from wiki page or to search on
    >> github. There was someone who mirrored entire Emacs wiki source on
    >> github, so you could use quelpa to fetch it from github directly.

    Michael> Can that be done with a Melpa recipe?  Then bookmark+ could be added
    Michael> to Melpa, right?

Thereʼs a reason emacswiki packages are not on Melpa:

https://github.com/melpa/melpa/pull/5008

Robert




^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-10  9:30                 ` Robert Pluim
@ 2020-01-10 10:01                   ` Michael Heerdegen
  2020-01-10 17:04                   ` Drew Adams
  1 sibling, 0 replies; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-10 10:01 UTC (permalink / raw)
  To: Robert Pluim
  Cc: Jean-Christophe Helary, Help Gnu Emacs mailing list,
	arthur miller

Robert Pluim <rpluim@gmail.com> writes:

> Thereʼs a reason emacswiki packages are not on Melpa:
>
> https://github.com/melpa/melpa/pull/5008

Ok, so this all has already been discussed exhaustively.  Thanks for
letting me know.  Still not a satisfactory situation...

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-10  9:30                 ` Robert Pluim
  2020-01-10 10:01                   ` Michael Heerdegen
@ 2020-01-10 17:04                   ` Drew Adams
  1 sibling, 0 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-10 17:04 UTC (permalink / raw)
  To: Robert Pluim, Michael Heerdegen
  Cc: Jean-Christophe Helary, Help Gnu Emacs mailing list,
	arthur miller

> Thereʼs a reason emacswiki packages are not on Melpa:
> 
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__github.com_melpa_melpa_pull_5008&d=DwIFaQ&c=RoP1YumCXCgaWHvlZYR8PZh
> 8Bv7qIrMUB65eapI_JnE&r=kI3P6ljGv6CTHIKju0jqInF6AOwMCYRDQUmqX22rJ98&m=F_
> LRuPuqPOescCuSziNAEhnqnWbws77YInvK3aDdmsI&s=gtzorV_OAn6x8NV08diPZOZFuP9
> e0uSaG3M7V_jDcYs&e=

For those interested:

https://www.reddit.com/r/emacs/comments/7vocqa/update_on_melpa_removing_emacswiki_packages_they/dtuhzmt/



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-01  6:25       ` Drew Adams
  2020-01-01 20:34         ` John Yates
  2020-01-02  1:25         ` Michael Heerdegen
@ 2020-01-11  7:36         ` Michael Heerdegen
  2020-01-11 10:00           ` Jean-Christophe Helary
  2020-01-11 16:00           ` Drew Adams
  2 siblings, 2 replies; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-11  7:36 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> You can have any number of bookmark files, and they can be stored
> anywhere.

For vanilla Emacs bookmarks (I guess you spoke of bookmark+ bookmarks),
this is not true: I tried to use `bookmark-file' as a file local
variable - this has no effect.  Then I tried with
`bookmark-default-file' as file local variable - this is also ignored
unless you bind `bookmark-bookmarks-timestamp' to nil in addition.
While this finally worked and I could use a file-local bookmark file, my
real bookmark file got erased in the process...

I learned that authors of the vanilla bookmark code didn't intend to
support using multiple bookmark files like this.


Michael.




^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-11  7:36         ` Michael Heerdegen
@ 2020-01-11 10:00           ` Jean-Christophe Helary
  2020-01-11 11:38             ` Michael Heerdegen
  2020-01-11 16:00           ` Drew Adams
  1 sibling, 1 reply; 60+ messages in thread
From: Jean-Christophe Helary @ 2020-01-11 10:00 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list



> On Jan 11, 2020, at 16:36, Michael Heerdegen <michael_heerdegen@web.de> wrote:
> 
> Drew Adams <drew.adams@oracle.com> writes:
> 
>> You can have any number of bookmark files, and they can be stored
>> anywhere.
> 
> For vanilla Emacs bookmarks (I guess you spoke of bookmark+ bookmarks),
> this is not true: I tried to use `bookmark-file' as a file local
> variable - this has no effect.  Then I tried with
> `bookmark-default-file' as file local variable - this is also ignored
> unless you bind `bookmark-bookmarks-timestamp' to nil in addition.
> While this finally worked and I could use a file-local bookmark file, my
> real bookmark file got erased in the process...
> 
> I learned that authors of the vanilla bookmark code didn't intend to
> support using multiple bookmark files like this.

Isn't it possible to contribute modifications to the bookmark code ?


Jean-Christophe Helary
-----------------------------------------------
http://mac4translators.blogspot.com @brandelune





^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-11 10:00           ` Jean-Christophe Helary
@ 2020-01-11 11:38             ` Michael Heerdegen
  0 siblings, 0 replies; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-11 11:38 UTC (permalink / raw)
  To: Jean-Christophe Helary; +Cc: Help Gnu Emacs mailing list

Jean-Christophe Helary <jean.christophe.helary@traduction-libre.org>
writes:

> Isn't it possible to contribute modifications to the bookmark code ?

Sure.  It's just not on *my* agenda currently.

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-11  7:36         ` Michael Heerdegen
  2020-01-11 10:00           ` Jean-Christophe Helary
@ 2020-01-11 16:00           ` Drew Adams
  2020-01-11 23:46             ` John Yates
  2020-01-12  7:31             ` Michael Heerdegen
  1 sibling, 2 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-11 16:00 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> > You can have any number of bookmark files, and they can be stored
> > anywhere.
> 
> For vanilla Emacs bookmarks (I guess you spoke of bookmark+ bookmarks),
> this is not true

It is true also for vanilla Emacs.  A bookmark file
can be anywhere, and you can have any number of them.

Even vanilla Emacs has command `bookmark-load', and
that lets you load a bookmark file (located anywhere),
either (1) replacing the existing set of current
bookmarks or (2) adding to that existing set.

> I tried to use `bookmark-file' as a file local
> variable - this has no effect.

`C-h v bookmark-file' tells you that it is "Old name
for `bookmark-default-file'."  The latter's name and
doc string tell you that its value is just the
_default_ location for a bookmark file, e.g. for
prompting when you save or load:

  "File in which to save bookmarks by default."

> Then I tried with
> `bookmark-default-file' as file local variable -
> this is also ignored unless you bind
> `bookmark-bookmarks-timestamp' to nil in addition.
> While this finally worked and I could use a
> file-local bookmark file, my real bookmark file
> got erased in the process...

I don't understand what you're trying to do; sorry.
You can have your own variables, file-local or not,
to do anything, including to point to bookmark files,
which can be anywhere.

I think maybe you are confusing the default
bookmark-file location with the location of a given
bookmark file.  But it's not clear to me just what
you want to do.

> I learned that authors of the vanilla bookmark code didn't intend to
> support using multiple bookmark files like this.

Dunno what "like this" means here.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-11 16:00           ` Drew Adams
@ 2020-01-11 23:46             ` John Yates
  2020-01-12  2:47               ` Drew Adams
  2020-01-12  7:31             ` Michael Heerdegen
  1 sibling, 1 reply; 60+ messages in thread
From: John Yates @ 2020-01-11 23:46 UTC (permalink / raw)
  To: Drew Adams; +Cc: Michael Heerdegen, Help Gnu Emacs mailing list

My read is that bookmarks share the same deficiency as tag tables.
That is once loaded it is the user's responsibility to manage.

/john

On Sat, Jan 11, 2020 at 11:02 AM Drew Adams <drew.adams@oracle.com> wrote:
>
> > > You can have any number of bookmark files, and they can be stored
> > > anywhere.
> >
> > For vanilla Emacs bookmarks (I guess you spoke of bookmark+ bookmarks),
> > this is not true
>
> It is true also for vanilla Emacs.  A bookmark file
> can be anywhere, and you can have any number of them.
>
> Even vanilla Emacs has command `bookmark-load', and
> that lets you load a bookmark file (located anywhere),
> either (1) replacing the existing set of current
> bookmarks or (2) adding to that existing set.
>
> > I tried to use `bookmark-file' as a file local
> > variable - this has no effect.
>
> `C-h v bookmark-file' tells you that it is "Old name
> for `bookmark-default-file'."  The latter's name and
> doc string tell you that its value is just the
> _default_ location for a bookmark file, e.g. for
> prompting when you save or load:
>
>   "File in which to save bookmarks by default."
>
> > Then I tried with
> > `bookmark-default-file' as file local variable -
> > this is also ignored unless you bind
> > `bookmark-bookmarks-timestamp' to nil in addition.
> > While this finally worked and I could use a
> > file-local bookmark file, my real bookmark file
> > got erased in the process...
>
> I don't understand what you're trying to do; sorry.
> You can have your own variables, file-local or not,
> to do anything, including to point to bookmark files,
> which can be anywhere.
>
> I think maybe you are confusing the default
> bookmark-file location with the location of a given
> bookmark file.  But it's not clear to me just what
> you want to do.
>
> > I learned that authors of the vanilla bookmark code didn't intend to
> > support using multiple bookmark files like this.
>
> Dunno what "like this" means here.
>


-- 
John Yates
505 Tremont St, #803
Boston, MA 02116



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-11 23:46             ` John Yates
@ 2020-01-12  2:47               ` Drew Adams
  0 siblings, 0 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-12  2:47 UTC (permalink / raw)
  To: John Yates; +Cc: Michael Heerdegen, Help Gnu Emacs mailing list

> My read is that bookmarks share the same
> deficiency as tag tables.  That is once
> loaded it is the user's responsibility
> to manage.

Dunno what that means.  Could you elaborate?

Like bookmark files, you can have any number
of tag tables.  And like bookmark files, you
you can switch among tag files whenever you
want.

So yes, there are such similarities.  And?
That just means users can control their use.
How is such control a "deficiency" or a
"management responsibility"?

And "once loaded" seems irrelevant.  What
management is forced on you by loading a tag
file or a bookmark file?

The same is true of any file you load, whether
a file of customizations, function definitions,
key bindings, synonyms, or anything else: once
loaded, you can use the file content.

Likewise, a mode.  Once turned on, you can use
its features, key bindings, etc.  And you can
turn it off or switch to another mode anytime.

Likewise, a flash drive: Once inserted, you
can use its files.  And you can switch to a
different drive anytime.  Etc.

What "deficiencies" are we talking about here?



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-11 16:00           ` Drew Adams
  2020-01-11 23:46             ` John Yates
@ 2020-01-12  7:31             ` Michael Heerdegen
  2020-01-12 16:37               ` Drew Adams
  1 sibling, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-12  7:31 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> I don't understand what you're trying to do; sorry.
> You can have your own variables, file-local or not,
> to do anything, including to point to bookmark files,
> which can be anywhere.

I tried to make a file use a separate bookmark file (for only this
file's bookmarks) and specify the location of that bookmark file as a
file local variable, somehow.  How would you do that with vanilla
bookmarks?

Regards,

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-12  7:31             ` Michael Heerdegen
@ 2020-01-12 16:37               ` Drew Adams
  2020-01-14  7:08                 ` Michael Heerdegen
  0 siblings, 1 reply; 60+ messages in thread
From: Drew Adams @ 2020-01-12 16:37 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> I tried to make a file use a separate bookmark file (for only this
> file's bookmarks) and specify the location of that bookmark file as a
> file local variable, somehow.  How would you do that with vanilla
> bookmarks?

I'm no expert on file-local variables.  Looking at
the doc for them, and throwing something together
quickly, does this help?

(defun create-bmk-file-for-file (bookmark-file target-file)
  "Create a new, empty BOOKMARK-FILE for TARGET-FILE."
  (interactive "FCreate bookmark file: \nFTarget file: ")
  (require 'bookmark)
  (let ((bookmark-alist  ()))
    (let ((baud-rate  0)) (bookmark-write-file bookmark-file))
    (with-current-buffer (find-file-noselect target-file)
      (add-file-local-variable 'local-bookmark-file bookmark-file)
      (save-buffer))))

(defun switch-to-local-bookmark-file ()
  "Switch to local bookmark file for current file."
  (interactive)
  (hack-local-variables)
  (let ((bfile  local-bookmark-file))
    (bookmark-load bfile 'SWITCH)))

`create-*' creates a new, empty BOOKMARK-FILE, and
it adds its name to the file-local variables of the
TARGET-FILE.

`switch-*' should be used when visiting TARGET-FILE.
It switches the current bookmark file to BOOKMARK-FILE.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-12 16:37               ` Drew Adams
@ 2020-01-14  7:08                 ` Michael Heerdegen
  2020-01-14 17:32                   ` Drew Adams
  0 siblings, 1 reply; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-14  7:08 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help Gnu Emacs mailing list

Drew Adams <drew.adams@oracle.com> writes:

> `create-*' creates a new, empty BOOKMARK-FILE, and
> it adds its name to the file-local variables of the
> TARGET-FILE.
>
> `switch-*' should be used when visiting TARGET-FILE.
> It switches the current bookmark file to BOOKMARK-FILE.

Thanks, that approach would probably work for what I have in mind.

The second part would be saving: when I want to save back the file's
"local bookmarks", how would I do that?  I guess I would have to
separate those bookmarks from the other bookmarks that were already
loaded before the file had been visited.  I obviously don't want to
duplicate all the bookmarks from the default bookmark file.  It would be
good if the bookmark objects would know by themselves what their
individual corresponding save place is.


Thanks,

Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-14  7:08                 ` Michael Heerdegen
@ 2020-01-14 17:32                   ` Drew Adams
  2020-01-15 23:10                     ` Drew Adams
  0 siblings, 1 reply; 60+ messages in thread
From: Drew Adams @ 2020-01-14 17:32 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> Thanks, that approach would probably work for what I have in mind.
> 
> The second part would be saving: when I want to save back the file's
> "local bookmarks", how would I do that?  I guess I would have to
> separate those bookmarks from the other bookmarks that were already
> loaded before the file had been visited.  I obviously don't want to
> duplicate all the bookmarks from the default bookmark file.  It would
> be good if the bookmark objects would know by themselves what their
> individual corresponding save place is.

I don't quite follow (and I think this is maybe
getting into the weeds now, for a general Emacs
help list).

What I suggested is switching to a bookmark file
that has _only_ bookmarks for the target file,
as opposed to just loading such a bookmark file
to add to the already loaded bookmarks for targets
elsewhere.

You save those bookmarks by saving the bookmark
file, i.e., by saving the current `bookmark-alist',
i.e., by using `bookmark-save':

  bookmark-save is an interactive compiled Lisp function in
  'bookmark+-1.el'.

  It is bound to C-x p s, menu-bar search bookmark save.

  (bookmark-save &optional PARG FILE)

  Save currently defined bookmarks.
  Save by default in the file named by variable
  'bmkp-current-bookmark-file'.  With a prefix arg, you are prompted for
  the file to save to.

  If 'bmkp-last-as-first-bookmark-file' is non-nil, update its value to
  the file being saved.

  To load bookmarks from a specific file, use 'C-x p l'
  ('bookmark-load').

  If called from Lisp:
   With nil PARG and nil FILE, use file 'bmkp-current-bookmark-file'.
   With non-nil FILE, use file FILE.
   With non-nil PARG, prompt the user for the file to use.

But there are other, i.e., additional, ways to group
bookmarks, besides a bookmark file.  As the doc says:

  Unlike the other ways of organizing bookmarks into sets (tags,
  bookmark-list bookmarks, etc.) bookmark files represent
  physical, not logical, groupings of bookmarks.

Bookmarks themselves can be saved in any bookmark
file, and in any number of different bookmark files.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-09  3:57 ` Michael Heerdegen
@ 2020-01-15 18:43   ` Marcin Borkowski
  2020-01-20 12:40     ` Michael Heerdegen
  0 siblings, 1 reply; 60+ messages in thread
From: Marcin Borkowski @ 2020-01-15 18:43 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list


On 2020-01-09, at 04:57, Michael Heerdegen <michael_heerdegen@web.de> wrote:

> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> I've been wondering if there is some package which could let me make
>> "temporary notes" in Emacs buffers, similar to (but different than) the
>> "yellow notes" in some pdf viewers.
>
> Just for fun I've created a template for how the least common multiple
> of our expectations could look like.  I guess there are many different
> expectations of how contents, visualizations and ways of saving for
> notes could look like, so I made it so that all of that is changeable
> and extensible.
>
> I'm not yet sure what would have to be done to support mass annotation
> from occur buffers since I don't use them a lot.
>
> I'm also not sure where in the implementation I could rely on existing
> code - especially for saving (eieio-persistent maybe?).

Hi Michael,

and thanks for this.  (Unfortunately, I could no longer follow the
discussion, because life & time, but I'd really like to catch up.)

This looks quite interesting.  Things I'd probably change would be:
highlighting the region instead of the character at point, jumping to
previous/next note, a list of notes, and an overlay showing the text of
the note even without hovering on it.  Of course, this would be a major
effort, but I like your PoC.

I'd really like to work on it, but realistically, I won't be able for at
least several months:-(...

Best,

-- 
Marcin Borkowski
http://mbork.pl



^ permalink raw reply	[flat|nested] 60+ messages in thread

* RE: Temporary notes in Emacs buffers?
  2020-01-14 17:32                   ` Drew Adams
@ 2020-01-15 23:10                     ` Drew Adams
  0 siblings, 0 replies; 60+ messages in thread
From: Drew Adams @ 2020-01-15 23:10 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: Help Gnu Emacs mailing list

> What I suggested is switching to a bookmark file
> that has _only_ bookmarks for the target file,
> as opposed to just loading such a bookmark file
> to add to the already loaded bookmarks for targets
> elsewhere.
...
> But there are other, i.e., additional, ways to group
> bookmarks, besides a bookmark file.  As the doc says:
> 
>   Unlike the other ways of organizing bookmarks into sets (tags,
>   bookmark-list bookmarks, etc.) bookmark files represent
>   physical, not logical, groupings of bookmarks.
> 
> Bookmarks themselves can be saved in any bookmark
> file, and in any number of different bookmark files.

It occurred to me that this info might also help Michael (dunno).

Instead of having a different bookmark file for each target file,
to hold all bookmarks for it, you can use a filtered bookmark-list
display that shows only those bookmarks.  This is a logical
grouping, not a physical grouping, as mentioned above.

In the bookmark-list display (buffer `*Bookmark List*'), you can
use `= f S' to show only bookmarks that target a given file (it
prompts you for the file name).

(Similarly, `= b S' shows only bookmarks that target a given
non-file buffer.)

Using different bookmark-list displays for organizing bookmarks
is in many ways more flexible than using different bookmark files.
Among other things, it lets you mark bookmarks and then act on
them in various ways.  (The Bookmark+ bookmark-list UI is much
like Dired's.)

---

Now let's suppose that you've done that, so `*Bookmark List*'
shows all bookmarks for file `foo.nada', and no other bookmarks.
That may well be all you need.

But let's also suppose that you decide that, for some reason,
you actually do want those bookmarks grouped physically, in their
own bookmark file, so that `foo.nada' has its own, dedicated
bookmark file.

All you need to do for that is this:

1. Mark the bookmarks in `*Bookmark List*' (e.g. after filtering
   so it shows only bookmarks for `foo.nada').

2. Use `Y > 0', to create a new bookmark file for just the marked
   bookmarks.

   Or use `C-u Y > 0' to do that plus create a bookmark to that
   bookmark file.  Using this bookmark automatically loads that
   bookmark file

   (`C-x j y' anywhere, or `J y' in `*Bookmark List*', jumps to
   a bookmark-file bookmark, and with a prefix arg it switches
   to that bookmark file, instead of just adding its bookmarks.)

You don't need to these remember key bindings.  You can use the
`Bookmark+' menu in buffer `*Bookmark List*'.  In submenu
`Bookmark File' you find most of the commands for using bookmark
files: creating, copying or moving bookmarks among them,
bookmarking them, etc.  And in submenu `Jump To' you find item
`Bookmark File' (`J y'). 

In `Bookmark+' > `Bookmark File' you find these menu items, along
with their keys.

 Revert to Saved Bookmark File...           C-u g
 Switch to Bookmark File...                 L
 Add Bookmarks from File...                 l
 Load Bookmark File, Mark Loaded...
 Load Bookmark File, Mark Only Loaded...
 Load Marked Bookmark-File Bookmarks...     M-l
 ------------------------------------------------
 Move Marked to Bookmark File...            Y > -
 Copy Marked to Bookmark File...            Y > +
 Copy Marked to New Bookmark File...        Y > 0
 Set Bookmark-File Bookmark from Marked...  C-u Y > 0
 Empty Bookmark File...                     C-x p 0

(`Switch to Bookmark File' also has global binding `C-x p L'.

Menus are good for discovering operations and reminding about
their key bindings.



^ permalink raw reply	[flat|nested] 60+ messages in thread

* Re: Temporary notes in Emacs buffers?
  2020-01-15 18:43   ` Marcin Borkowski
@ 2020-01-20 12:40     ` Michael Heerdegen
  0 siblings, 0 replies; 60+ messages in thread
From: Michael Heerdegen @ 2020-01-20 12:40 UTC (permalink / raw)
  To: Marcin Borkowski; +Cc: Help Gnu Emacs mailing list

Marcin Borkowski <mbork@mbork.pl> writes:

> This looks quite interesting.  Things I'd probably change would be:
> highlighting the region instead of the character at point, jumping to
> previous/next note, a list of notes, and an overlay showing the text of
> the note even without hovering on it.  Of course, this would be a major
> effort, but I like your PoC.

I'm going to add all of this, step by step.

> I'd really like to work on it, but realistically, I won't be able for
> at least several months:-(...

I hope the approach is so that it's easy for others to join.  For now
I'll work on it when I feel like it.  I'll keep you posted.


Michael.



^ permalink raw reply	[flat|nested] 60+ messages in thread

end of thread, other threads:[~2020-01-20 12:40 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-27 10:19 Temporary notes in Emacs buffers? Marcin Borkowski
2019-12-27 10:43 ` Mpho Jele
2019-12-27 11:51   ` tomas
2020-01-01 21:48     ` Marcin Borkowski
2019-12-27 15:54 ` Drew Adams
2020-01-02 17:49   ` Marcin Borkowski
2020-01-05  2:37   ` Michael Heerdegen
2020-01-05 17:54     ` Drew Adams
2020-01-06  5:18       ` Jean-Christophe Helary
2020-01-06 15:12         ` Drew Adams
2020-01-09  1:03           ` Michael Heerdegen
2020-01-09 23:35             ` arthur miller
2020-01-10  4:58               ` Michael Heerdegen
2020-01-10  9:30                 ` Robert Pluim
2020-01-10 10:01                   ` Michael Heerdegen
2020-01-10 17:04                   ` Drew Adams
2020-01-10  9:10               ` Unknown
2019-12-27 17:48 ` Sharon Kimble
2020-01-01  1:42 ` Michael Heerdegen
2020-01-01  4:45   ` Drew Adams
2020-01-01  5:00     ` Michael Heerdegen
2020-01-01  6:25       ` Drew Adams
2020-01-01 20:34         ` John Yates
2020-01-01 21:19           ` Drew Adams
2020-01-01 21:47           ` Marcin Borkowski
2020-01-02  1:25         ` Michael Heerdegen
2020-01-02  3:16           ` Drew Adams
2020-01-02  3:45             ` Michael Heerdegen
2020-01-02  5:30               ` Drew Adams
2020-01-02 15:41                 ` Drew Adams
2020-01-03  1:07                 ` Michael Heerdegen
2020-01-03  3:35                   ` John Yates
2020-01-03  6:38                     ` Drew Adams
2020-01-03  7:06                     ` Drew Adams
2020-01-04  6:39                     ` Michael Heerdegen
2020-01-04 16:04                       ` Drew Adams
2020-01-06 14:18                         ` John Yates
2020-01-06 14:34                           ` tomas
2020-01-06 15:19                             ` John Yates
2020-01-06 15:31                               ` tomas
2020-01-06 16:28                               ` arthur miller
2020-01-03  7:00                   ` Drew Adams
2020-01-03 13:31                   ` arthur miller
2020-01-05  2:18                     ` Michael Heerdegen
2020-01-11  7:36         ` Michael Heerdegen
2020-01-11 10:00           ` Jean-Christophe Helary
2020-01-11 11:38             ` Michael Heerdegen
2020-01-11 16:00           ` Drew Adams
2020-01-11 23:46             ` John Yates
2020-01-12  2:47               ` Drew Adams
2020-01-12  7:31             ` Michael Heerdegen
2020-01-12 16:37               ` Drew Adams
2020-01-14  7:08                 ` Michael Heerdegen
2020-01-14 17:32                   ` Drew Adams
2020-01-15 23:10                     ` Drew Adams
2020-01-02 17:48     ` Marcin Borkowski
2020-01-02 17:48   ` Marcin Borkowski
2020-01-09  3:57 ` Michael Heerdegen
2020-01-15 18:43   ` Marcin Borkowski
2020-01-20 12:40     ` Michael Heerdegen

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.