Temporary notes in Emacs buffers?

classic Classic list List threaded Threaded
59 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Michael Heerdegen
Marcin Borkowski <[hidden email]> 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?).





Thanks,

Michael.

side-note.el (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Temporary notes in Emacs buffers?

arthur miller
In reply to this post by Michael Heerdegen
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 <[hidden email]>
Datum: 2020-01-09 02:04 (GMT+01:00)
Till: Drew Adams <[hidden email]>
Kopia: Jean-Christophe Helary <[hidden email]>, Help Gnu Emacs mailing list <[hidden email]>
Ämne: Re: Temporary notes in Emacs buffers?

Drew Adams <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Michael Heerdegen
arthur miller <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Emacs - Help mailing list
In reply to this post by arthur miller
arthur miller <[hidden email]> 작성:

> 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

Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Robert Pluim
In reply to this post by Michael Heerdegen
>>>>> On Fri, 10 Jan 2020 05:58:24 +0100, Michael Heerdegen <[hidden email]> said:

    Michael> arthur miller <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Michael Heerdegen
Robert Pluim <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

RE: Temporary notes in Emacs buffers?

Drew Adams
In reply to this post by Robert Pluim
> 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/

Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Michael Heerdegen
In reply to this post by Drew Adams
Drew Adams <[hidden email]> 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.


Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Jean-Christophe Helary-4


> On Jan 11, 2020, at 16:36, Michael Heerdegen <[hidden email]> wrote:
>
> Drew Adams <[hidden email]> 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



Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Michael Heerdegen
Jean-Christophe Helary <[hidden email]>
writes:

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

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

Michael.

Reply | Threaded
Open this post in threaded view
|

RE: Temporary notes in Emacs buffers?

Drew Adams
In reply to this post by Michael Heerdegen
> > 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.

Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

John Yates-4
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 <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

RE: Temporary notes in Emacs buffers?

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

Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Michael Heerdegen
In reply to this post by Drew Adams
Drew Adams <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

RE: Temporary notes in Emacs buffers?

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

Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Michael Heerdegen
Drew Adams <[hidden email]> 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.

Reply | Threaded
Open this post in threaded view
|

RE: Temporary notes in Emacs buffers?

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

Reply | Threaded
Open this post in threaded view
|

Re: Temporary notes in Emacs buffers?

Marcin Borkowski-3
In reply to this post by Michael Heerdegen

On 2020-01-09, at 04:57, Michael Heerdegen <[hidden email]> wrote:

> Marcin Borkowski <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

RE: Temporary notes in Emacs buffers?

Drew Adams
In reply to this post by Drew Adams
> 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.

123