From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Re: Bookmark the end of file? Date: Tue, 07 Apr 2015 03:03:15 +0200 Message-ID: <87twwshhrg.fsf@wmi.amu.edu.pl> References: <87vbh8hlns.fsf@wmi.amu.edu.pl> <9aacf44d-27ae-4b40-b27a-ae81f5a92216@default> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428368629 6102 80.91.229.3 (7 Apr 2015 01:03:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Apr 2015 01:03:49 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 07 03:03:41 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YfHvY-0001A6-O7 for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Apr 2015 03:03:40 +0200 Original-Received: from localhost ([::1]:42435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfHvX-0000fp-Uv for geh-help-gnu-emacs@m.gmane.org; Mon, 06 Apr 2015 21:03:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfHvN-0000fe-Ig for help-gnu-emacs@gnu.org; Mon, 06 Apr 2015 21:03:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YfHvK-0008AM-Bd for help-gnu-emacs@gnu.org; Mon, 06 Apr 2015 21:03:29 -0400 Original-Received: from msg.wmi.amu.edu.pl ([2001:808:114:2::50]:44359) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YfHvK-00089v-4i for help-gnu-emacs@gnu.org; Mon, 06 Apr 2015 21:03:26 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by msg.wmi.amu.edu.pl (Postfix) with ESMTP id 168B65BAB8 for ; Tue, 7 Apr 2015 03:03:24 +0200 (CEST) Original-Received: from msg.wmi.amu.edu.pl ([127.0.0.1]) by localhost (msg.wmi.amu.edu.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9vAhRGQ0qttm for ; Tue, 7 Apr 2015 03:03:23 +0200 (CEST) Original-Received: from localhost (117-116.echostar.pl [213.156.117.116]) by msg.wmi.amu.edu.pl (Postfix) with ESMTPSA id 985C35BAB5 for ; Tue, 7 Apr 2015 03:03:23 +0200 (CEST) In-reply-to: <9aacf44d-27ae-4b40-b27a-ae81f5a92216@default> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:808:114:2::50 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103553 Archived-At: On 2015-04-07, at 01:59, Drew Adams wrote: >> 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. Thanks - but not really what I'm after (as you pointed out). If I wanted a command, I wouldn't need bookmarks at all. (Though this is not an unreasonable thing to use, either.) > 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. Exactly. > 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. That was more or less what I was thinking about. I was just curious whether Bookmark+ has some UI for that scenario. > 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. And this is probably the cleanest solution, and the one which I'm going to use. Thanks! -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University