From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Karl Fogel Newsgroups: gmane.emacs.devel Subject: Re: bookmark.el bug report Date: Sat, 02 Jan 2010 03:16:41 -0500 Message-ID: <87ws007wgm.fsf@red-bean.com> References: <5065e2900912272219y3734fc9fsdaee41167ef99ad7@mail.gmail.com> <87r5q99jv9.fsf@red-bean.com> Reply-To: Karl Fogel NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1262420565 6363 80.91.229.12 (2 Jan 2010 08:22:45 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 2 Jan 2010 08:22:45 +0000 (UTC) Cc: 'Sun Yijiang' , emacs-devel@gnu.org To: "Drew Adams" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 02 09:22:37 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1NQzFt-0003UW-Dt for ged-emacs-devel@m.gmane.org; Sat, 02 Jan 2010 09:22:37 +0100 Original-Received: from localhost ([127.0.0.1]:47561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQzFt-0005If-HM for ged-emacs-devel@m.gmane.org; Sat, 02 Jan 2010 03:22:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NQzAH-0003BR-Er for emacs-devel@gnu.org; Sat, 02 Jan 2010 03:16:50 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NQzAC-00038o-9g for emacs-devel@gnu.org; Sat, 02 Jan 2010 03:16:48 -0500 Original-Received: from [199.232.76.173] (port=55539 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NQzAB-00038Q-0V for emacs-devel@gnu.org; Sat, 02 Jan 2010 03:16:43 -0500 Original-Received: from sanpietro.red-bean.com ([66.146.206.141]:49966) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NQzAA-0007FV-Lo for emacs-devel@gnu.org; Sat, 02 Jan 2010 03:16:42 -0500 Original-Received: from localhost ([127.0.0.1]:48401 helo=floss ident=kfogel) by sanpietro.red-bean.com with esmtp (Exim 4.71) (envelope-from ) id 1NQzA9-0006DC-Ok; Sat, 02 Jan 2010 02:16:41 -0600 In-Reply-To: (Drew Adams's message of "Fri, 1 Jan 2010 23:51:07 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:119261 Archived-At: "Drew Adams" writes: >Do as you like, but part of my message was that there is no need to call >`bookmark-bmenu-check-position' here (which you renamed `...ensure...'). > >Since the "check" part of that function doesn't really do anything, all >it really does is move point to the nearest bookmark line. If point is >already on a bookmark line, then it is a no-op. Sure. But when point is *not* on a bookmark line (for example, if it is at the beginning or end of the buffer), then it should be moved to a bookmark line. IMHO, the mode works much more intuitively if it behaves that way. >And the way to tell if point is on a bookmark line is (now) to call >`bookmark-bmenu-bookmark'. So I use this simplified code (FWIW): > >(defun bookmark-bmenu-check-position () > "Move to the beginning of the nearest bookmark line." > (beginning-of-line) > (unless (bookmark-bmenu-bookmark) > (if (and (bolp) (eobp)) > (beginning-of-line 0) > (goto-char (point-min)) > (forward-line bookmarkp-bmenu-header-lines))) > t) ; Vanilla bookmark code depends on non-nil value. > >(defun bookmark-bmenu-bookmark () > "Return the name of the bookmark on this line." > (condition-case nil > (save-excursion > (forward-line 0) > (forward-char (1+ bookmarkp-bmenu-marks-width)) > (get-text-property (point) 'bookmarkp-bookmark-name)) > (error nil))) > >Instead of calling `*-bmenu-bookmark' at the beginning of `ensure' to check for >a no-op, the original code has it backward: it calls `ensure' at the start of >each call to `*-bmenu-bookmark', to ensure that point is on a bookmark >line. But for many calls to `*-bmenu-bookmark', we already know that >point is on a bookmark line. > >If it is not called also within `*-bmenu-bookmark', then `ensure' is >called much less often than `*-bmenu-bookmark'. And the original code >has extra calls to `ensure', besides the one in `*-bmenu-mark'. In >fact, it often calls it both at the beginning and at the end of a >function (e.g. `*-bmenu-delete'). > >`ensure' only needs to be called before some (not all) of the calls to >`*-bmenu-bookmark' - it has no use otherwise. > >That's why I said you can get rid of some of the calls to `ensure'. But >if `ensure' is not called from within `*-bmenu-bookmark' then you need >to protect the eob case (just to inhibit a msg) - hence the >`condition-case'. I believe that most of the calls to `-ensure-' can now be gotten rid of (though probably not all, e.g., in `bookmark-bmenu-mark'). However, I like to move one step at a time -- and the first step was to get rid of the tests, not the calls themselves. I just need to take a separate look regarding the calls. >I don't know what changes you actually made, since I cannot see them here: >http://cvs.savannah.gnu.org/viewvc/emacs/emacs/lisp/ >The last revision of bookmark.el shown there dates from Nov 24. Yeah, CVS has been read-only since we switched to Bazaar some days ago, and will not be receiving any more changes. >Has the URL for the Emacs development source code changed, now that the >repository is on BZR? If so, what is it - how does one get to the >source code via HTTP? And if that URL is no longer valid, then its Web >page should redirect to the proper URL, no? Yes, it has changed. http://www.emacswiki.org/emacs-en/BzrForEmacsDevs has the details. >Personally, I do not intend to access the repository using BZR (just as >I did not use CVS to access it before). I'm looking for a way to >download a revision by just clicking an ordinary web-page link in my >browser, as before. The URL to start at is http://bzr.savannah.gnu.org/lh/emacs/, but unfortunately it's broken right now. There is a ticket filed about fixing it: https://savannah.gnu.org/support/index.php?107142 Fortunately, the version at Launchpad is working just fine: https://code.launchpad.net/~vcs-imports/emacs/trunk And bookmark.el is here: http://bazaar.launchpad.net/~vcs-imports/emacs/trunk/annotate/head%3A/lisp/bookmark.el That should always be up-to-date, give or take a few hours. -Karl