From: Karl Fogel <kfogel@red-bean.com>
To: "Drew Adams" <drew.adams@oracle.com>
Cc: 'Sun Yijiang' <sunyijiang@gmail.com>, emacs-devel@gnu.org
Subject: Re: bookmark.el bug report
Date: Sat, 02 Jan 2010 03:16:41 -0500 [thread overview]
Message-ID: <87ws007wgm.fsf@red-bean.com> (raw)
In-Reply-To: <F0FDFD6B81AC499A8EC8F1635ABF5D82@us.oracle.com> (Drew Adams's message of "Fri, 1 Jan 2010 23:51:07 -0800")
"Drew Adams" <drew.adams@oracle.com> 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
next prev parent reply other threads:[~2010-01-02 8:16 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-28 6:19 bookmark.el bug report Sun Yijiang
2009-12-28 6:48 ` Karl Fogel
2009-12-28 7:41 ` Thierry Volpiatto
2009-12-28 15:58 ` Drew Adams
2009-12-28 21:12 ` Karl Fogel
2009-12-29 18:22 ` Stefan Monnier
2009-12-30 13:37 ` Thierry Volpiatto
2009-12-30 15:28 ` Stefan Monnier
2009-12-30 15:57 ` Drew Adams
2009-12-30 16:26 ` Drew Adams
2009-12-30 17:43 ` Thierry Volpiatto
2009-12-30 18:32 ` Stefan Monnier
2010-01-02 5:05 ` Karl Fogel
2010-01-02 5:15 ` Karl Fogel
2010-01-02 7:03 ` Thierry Volpiatto
2010-01-02 7:26 ` Karl Fogel
2010-01-02 8:15 ` Thierry Volpiatto
2010-01-02 19:17 ` Karl Fogel
2010-01-02 7:51 ` Drew Adams
2010-01-02 8:16 ` Karl Fogel [this message]
2010-01-02 8:42 ` Drew Adams
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=87ws007wgm.fsf@red-bean.com \
--to=kfogel@red-bean.com \
--cc=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
--cc=sunyijiang@gmail.com \
/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.