help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: Bookmark the end of file?


From: Drew Adams
Subject: RE: Bookmark the end of file?
Date: Mon, 6 Apr 2015 16:59:13 -0700 (PDT)

> how to set a bookmark to the end of some file (IOW, (point-max))?  (Of
> course it is possible with Bookmark+, but is there any UI for that
> there?  Is it at all possible with vanilla bookmarks?)
> 
> My use case is a file which I visit (almost) every day to /add/
> something to its end (e.g., a ledger file).  I can imagine other,
> similar uses for that, too.

1. You can use `bookmark-after-jump-hook' with both vanilla
`bookmark.el' and Bookmark+.  Add a function that goes to
`point-max', for instance.

If you don't want to do that for all bookmarks (which I
imagine), you can define a command that binds that hook and
then jumps to a particular bookmark or lets you choose a
bookmark from some particular set of bookmarks.  IOW, create
your own `jump-then-goto-eof' command.

2. Both vanilla bookmarks and Bookmark+ bookmarks save text
before and after point, and then use that text to try to
reposition the location later.  Usually that enables relocation
correctly.

But if the location is at eof/eob and you append new text to
the file then this relocation might fail.

With Bookmark+, you can bookmark the file and then combine
that bookmark with a function bookmark that goes to `point-max'.
That is, create a sequence bookmark of: (1) the bookmark to the
file followed by (2) a function bookmark that goes to eof.

3. With Bookmark+, you can tag a bookmark with tag "bmkp-jump".
The function that is the value of a "bmkp-jump" tag is called
just after standard hook `bookmark-after-jump-hook' is invoked.

Note that this is a case where the tag is not just a string -
it is a cons with car "bmkp-jump" and with cdr the extra jump
function.  IOW, you can use tag "bmkp-jump" to invoke functions
that are specific to individual bookmarks.  In this way,
bookmarks can have their own, extra jump behavior.



reply via email to

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