all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bookmark position at end of file
@ 2010-02-27 15:24 Uwe Siart
  2010-02-27 16:36 ` Drew Adams
       [not found] ` <mailman.1996.1267288695.14305.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Siart @ 2010-02-27 15:24 UTC (permalink / raw
  To: help-gnu-emacs

Hy all,

bookmark-set stores the position in the as well as some surrounding
context. This is perfect if one wants to return to exactly that
position. But is it also possible to set bookmark position to point-max
independent of what the context is?

Use case: When I visit a bookmarked log file where data is appended
constantly I would like to end up at the end of the file to see the most
recent entry.

-- 
Uwe


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

* RE: bookmark position at end of file
  2010-02-27 15:24 bookmark position at end of file Uwe Siart
@ 2010-02-27 16:36 ` Drew Adams
       [not found] ` <mailman.1996.1267288695.14305.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Drew Adams @ 2010-02-27 16:36 UTC (permalink / raw
  To: 'Uwe Siart', help-gnu-emacs

> bookmark-set stores the position in the as well as some surrounding
> context. This is perfect if one wants to return to exactly that
> position. But is it also possible to set bookmark position to 
> point-max independent of what the context is?
> 
> Use case: When I visit a bookmarked log file where data is appended
> constantly I would like to end up at the end of the file to 
> see the most recent entry.

1. The easiest way is just to use `bookmark-after-jump-hook'. Add a function to
this hook that goes to the end of the buffer if the buffer is a log. Example:

(add-hook 'bookmark-after-jump-hook 'foo)
(defun foo ()
  (when (string= "log" (file-name-extension (buffer-file-name)))
    (end-of-buffer)))


2. Alternatively, you can define your own bookmark type, in this case a log-file
type, by defining a handler for log files. There are two pieces:

2a. Add `(handler . log-bookmark-jump)' to bookmarks in log files. You do this
by setting variable `bookmark-make-record-function' in your mode (log mode,
which you'll presumably define) to a function that creates the bookmark the way
you want it.

(set (make-local-variable 'bookmark-make-record-function)
       'log-mode-bookmark-make-record)

2b. Define `log-bookmark-jump' to do what you want.

See `Info-bookmark-make-record' and `Info-bookmark-jump' for examples.







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

* Re: bookmark position at end of file
       [not found] ` <mailman.1996.1267288695.14305.help-gnu-emacs@gnu.org>
@ 2010-02-27 17:10   ` Uwe Siart
  0 siblings, 0 replies; 3+ messages in thread
From: Uwe Siart @ 2010-02-27 17:10 UTC (permalink / raw
  To: help-gnu-emacs

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

> [possible solutions]

Many thanks for your suggestions. This sounds all very promising. I'll
try it out.

-- 
Uwe


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

end of thread, other threads:[~2010-02-27 17:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-27 15:24 bookmark position at end of file Uwe Siart
2010-02-27 16:36 ` Drew Adams
     [not found] ` <mailman.1996.1267288695.14305.help-gnu-emacs@gnu.org>
2010-02-27 17:10   ` Uwe Siart

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.