From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: bookmark position at end of file Date: Sat, 27 Feb 2010 08:36:26 -0800 Message-ID: <9026834416E84253AAEF195795DF6C0B@us.oracle.com> References: <87eik6k8fs.fsf@siart.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1267288747 3728 80.91.229.12 (27 Feb 2010 16:39:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 27 Feb 2010 16:39:07 +0000 (UTC) To: "'Uwe Siart'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Feb 27 17:39:03 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NlPh0-0007h9-BP for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Feb 2010 17:39:02 +0100 Original-Received: from localhost ([127.0.0.1]:49610 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NlPgz-0006HU-OF for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Feb 2010 11:39:01 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NlPgD-0005qg-Sg for help-gnu-emacs@gnu.org; Sat, 27 Feb 2010 11:38:13 -0500 Original-Received: from [140.186.70.92] (port=40259 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NlPgD-0005pW-0a for help-gnu-emacs@gnu.org; Sat, 27 Feb 2010 11:38:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NlPgC-0001JQ-8B for help-gnu-emacs@gnu.org; Sat, 27 Feb 2010 11:38:12 -0500 Original-Received: from acsinet11.oracle.com ([141.146.126.233]:37482) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NlPgC-0001JM-1v for help-gnu-emacs@gnu.org; Sat, 27 Feb 2010 11:38:12 -0500 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by acsinet11.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o1RGc9X5014412 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 27 Feb 2010 16:38:10 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o1RDpgJ7003190; Sat, 27 Feb 2010 16:38:08 GMT Original-Received: from abhmt003.oracle.com by acsmt354.oracle.com with ESMTP id 54282921267288589; Sat, 27 Feb 2010 08:36:29 -0800 Original-Received: from dradamslap1 (/10.175.219.163) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 27 Feb 2010 08:36:28 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87eik6k8fs.fsf@siart.de> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 Thread-Index: Acq3w5WbzkXHSQixTGOwfd5r2R6vYAAA9n9w X-Source-IP: acsmt354.oracle.com [141.146.40.154] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090203.4B894A71.0132:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:72214 Archived-At: > 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.