all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Uwe Siart'" <usenet@siart.de>, <help-gnu-emacs@gnu.org>
Subject: RE: bookmark position at end of file
Date: Sat, 27 Feb 2010 08:36:26 -0800	[thread overview]
Message-ID: <9026834416E84253AAEF195795DF6C0B@us.oracle.com> (raw)
In-Reply-To: <87eik6k8fs.fsf@siart.de>

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







  reply	other threads:[~2010-02-27 16:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-27 15:24 bookmark position at end of file Uwe Siart
2010-02-27 16:36 ` Drew Adams [this message]
     [not found] ` <mailman.1996.1267288695.14305.help-gnu-emacs@gnu.org>
2010-02-27 17:10   ` Uwe Siart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9026834416E84253AAEF195795DF6C0B@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=usenet@siart.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.