all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Boruch Baum <boruch_baum@gmx.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: 20152@debbugs.gnu.org
Subject: bug#20152: 24.4: bookmarks display wrong annotation (FIX INCLUDED)
Date: Fri, 20 Mar 2015 14:46:33 -0400	[thread overview]
Message-ID: <550C6B09.3010208@gmx.com> (raw)
In-Reply-To: <550C67C2.9020208@gmx.com>


[-- Attachment #1.1: Type: text/plain, Size: 877 bytes --]

And this, replaces `emacs_bug_20152-b.patch'.

Now I'm really signing off.


On 03/20/2015 02:32 PM, Boruch Baum wrote:
> Stefan,
> 
> I noticed that my solution, while good, was partial, in that it didn't
> cover ALL the possible navigation commands.
> 
> Attached is a more elegant, smaller, and more thorough fix, especially
> appropriate or a buffer such as bookmark-bmenu, as so many of the
> keystrokes within the buffer will be navigation commands.
> 
> This patch replaces `emacs_bug_20152-a.patch'.
> 
> Signing off for Shabbat,
> 
> Boruch.
> 
> On 03/20/2015 10:31 AM, Stefan Monnier wrote:
>> Same here, please resend your fix as a patch ("diff -u" or "diff -c").-- 
> 
> 
> hkp://keys.gnupg.net
> CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0
> 


-- 
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1  7286 0036 9E45 1595 8BC0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: emacs_bug_20152-b2.patch --]
[-- Type: text/x-patch; name="emacs_bug_20152-b2.patch", Size: 2238 bytes --]

--- bookmark.el	2015-03-20 14:25:37.325230039 -0400
+++ bookmark-new.el	2015-03-20 14:40:51.425200402 -0400
@@ -1901,9 +1901,20 @@
       (bookmark-bmenu-other-window))))
 
 
+(defvar bookmark-bmenu-toggle-auto-display-annotations nil
+"When not `nil', function `bookmark-bmenu-show-annotation' (by
+default, bound to `a`), toggles whether to automatically display
+a bookmark's annotation as one navigates through the bookmark
+list. Default is `nil'.")
+
 (defun bookmark-bmenu-show-annotation ()
   "Show the annotation for the current bookmark in another window."
   (interactive)
+  (when (and (called-interactively-p "any")
+             bookmark-bmenu-toggle-auto-display-annotations)
+    (if bookmark-bmenu-auto-display-annotations
+      (setq bookmark-bmenu-auto-display-annotations nil)
+     (setq bookmark-bmenu-auto-display-annotations t)))
   (let ((bookmark (bookmark-bmenu-bookmark)))
     (bookmark-show-annotation bookmark)))
 
@@ -2068,6 +2079,31 @@
     (forward-line 1))
   (forward-line 0))
 
+(defvar bookmark-bmenu-auto-display-annotations nil
+"Whether to automatically display a bookmark's annotation as one
+navigates through the bookmark list. `t' for yes. Default is
+`nil'.")
+
+(defvar bookmark-bmenu-last-post-command-line 1
+"The line number at point, within the bookmark list buffer, after
+the last command had been run in that buffer.")
+
+(defun bookmark-bmenu-motion-hook-function ()
+"This function is added to the `post-command-hook' locally for
+bookmark list buffers, in order to update any visible annotations
+as one navigates within the buffer."
+  (let ((annotation-buffer))
+    (when (/= bookmark-bmenu-last-post-command-line (line-number-at-pos))
+      (when (setq annotation-buffer (get-buffer "*Bookmark Annotation*"))
+        (kill-buffer annotation-buffer))
+      (when bookmark-bmenu-auto-display-annotations
+        (bookmark-bmenu-show-annotation)))))
+
+(defun bookmark-bmenu-post-command-hook-function ()
+  (add-hook 'post-command-hook 'bookmark-bmenu-motion-hook-function t t))
+
+(add-hook 'bookmark-bmenu-mode-hook 'bookmark-bmenu-post-command-hook-function)
+
 
 \f
 ;;; Menu bar stuff.  Prefix is "bookmark-menu".

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-03-20 18:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 10:38 bug#20152: 24.4: bookmarks display wrong annotation (FIX INCLUDED) Boruch Baum
2015-03-20 14:31 ` Stefan Monnier
2015-03-20 16:29   ` Boruch Baum
2015-03-20 18:32   ` Boruch Baum
2015-03-20 18:46     ` Boruch Baum [this message]
2015-03-26  1:41       ` Stefan Monnier
2021-12-02 10:17         ` Lars Ingebrigtsen
2021-12-03  6:31           ` Boruch Baum
2021-12-05  0:55             ` Lars Ingebrigtsen

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=550C6B09.3010208@gmx.com \
    --to=boruch_baum@gmx.com \
    --cc=20152@debbugs.gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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.