From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#20152: 24.4: bookmarks display wrong annotation (FIX INCLUDED) Date: Fri, 20 Mar 2015 10:31:36 -0400 Message-ID: References: <550BF8BE.5080105@gmx.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1426861960 14976 80.91.229.3 (20 Mar 2015 14:32:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Mar 2015 14:32:40 +0000 (UTC) Cc: 20152@debbugs.gnu.org To: Boruch Baum Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 20 15:32:28 2015 Return-path: Envelope-to: geb-bug-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 1YYxyG-0003i0-N0 for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Mar 2015 15:32:20 +0100 Original-Received: from localhost ([::1]:44130 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYxyG-0002AI-4W for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Mar 2015 10:32:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40855) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYxy4-0001sB-EC for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 10:32:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYxxy-0003QC-Rn for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 10:32:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYxxy-0003Q6-P8 for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 10:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YYxxy-0007Rz-Km for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 10:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Mar 2015 14:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 20152 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 20152-submit@debbugs.gnu.org id=B20152.142686190828595 (code B ref 20152); Fri, 20 Mar 2015 14:32:02 +0000 Original-Received: (at 20152) by debbugs.gnu.org; 20 Mar 2015 14:31:48 +0000 Original-Received: from localhost ([127.0.0.1]:59224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YYxxg-0007R5-2H for submit@debbugs.gnu.org; Fri, 20 Mar 2015 10:31:47 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:41205) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YYxxa-0007Qt-50 for 20152@debbugs.gnu.org; Fri, 20 Mar 2015 10:31:42 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t2KEVbi7031729; Fri, 20 Mar 2015 10:31:37 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id DA480F63; Fri, 20 Mar 2015 10:31:36 -0400 (EDT) In-Reply-To: <550BF8BE.5080105@gmx.com> (Boruch Baum's message of "Fri, 20 Mar 2015 06:38:54 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5251=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5251> : inlines <2452> : streams <1408631> : uri <1885574> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:100698 Archived-At: Same here, please resend your fix as a patch ("diff -u" or "diff -c"). Stefan >>>>> "Boruch" == Boruch Baum writes: > In the bookmark list buffer, after viewing an annotation for a > bookmark, navigating to another bookmark entry does not kill the > annotation buffer display, leading to confusion about which entry > the still-visible annotation refers. > The atttached bugfix kills the annotation buffer on navigation, > and remaps navigation keys accordingly. > The bugfix also introduces an option to automatically display > annotations as one navigates within the bookmark list buffer. > The bugfix also introduces an option to toggle auto-display of > annotations. > Note that the code has two sets of key-binding definitions: Only > the first, (defvar bookmark-bmenu-mode-map ..., is for the bugfix > to bookmark.el. The second, (eval-after-load "bookmark" ..., or > better, just (progn ..., is included for convenience / testing. > ;------------------------------------------------------------------- > ; bookmark-bmenu-next-line > ; bookmark-bmenu-previous-line > ; bookmark-bmenu-forward-char > ; bookmark-bmenu-backward-char > ; > ; Functions to address bug in which the `*Bookmark Annotation*' buffer > ; is not modified or updated when navigating through the > ; bookmark-bmenu-list. > ; > ; Also provides option to auto-display annotations as one navigates > ; the bmenu-list > (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'.") > (defun bookmark-bmenu-next-line (&optional ARG TRY-VSCROLL) > "Move cursor vertically down ARG lines within the bookmark list. > Refer to function `next-line' for details." > (interactive "^p\np") > (let > ((annotation-buffer > (get-buffer "*Bookmark Annotation*"))) > (when annotation-buffer > (kill-buffer annotation-buffer))) > (next-line ARG TRY-VSCROLL) > (when bookmark-bmenu-auto-display-annotations > (bookmark-bmenu-show-annotation))) > (defun bookmark-bmenu-previous-line (&optional ARG TRY-VSCROLL) > "Move cursor vertically up ARG lines within the bookmark list. > Refer to function `previous-line' for details." > (interactive "^p\np") > (let > ((annotation-buffer > (get-buffer "*Bookmark Annotation*"))) > (when annotation-buffer > (kill-buffer annotation-buffer))) > (previous-line ARG TRY-VSCROLL) > (when bookmark-bmenu-auto-display-annotations > (bookmark-bmenu-show-annotation))) > (defun bookmark-bmenu-forward-char (&optional N) > (interactive "p") > (bookmark-bmenu-backward-forward-char 'forward-char N)) > (defun bookmark-bmenu-backward-char (&optional N) > (interactive "p") > (bookmark-bmenu-backward-forward-char 'backward-char N)) > (defun bookmark-bmenu-backward-forward-char (direction-function N) > (let (annotation-buffer > (initial-line (line-number-at-pos))) > (funcall direction-function N) > (when (/= initial-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))))) > ;------------------------------------------------------------------- > ; > ; ONLY ONE OF THE FOLLOWING TWO OPTIONS ARE NECESSARY ! > ; > ; Either redine the mode map, or just the individual keys > ; > ;------------------------------------------------------------------- > (defvar bookmark-bmenu-mode-map > (let ((map (make-keymap))) > (set-keymap-parent map special-mode-map) > (define-key map "v" 'bookmark-bmenu-select) > (define-key map "w" 'bookmark-bmenu-locate) > (define-key map "2" 'bookmark-bmenu-2-window) > (define-key map "1" 'bookmark-bmenu-1-window) > (define-key map "j" 'bookmark-bmenu-this-window) > (define-key map "\C-c\C-c" 'bookmark-bmenu-this-window) > (define-key map "f" 'bookmark-bmenu-this-window) > (define-key map "\C-m" 'bookmark-bmenu-this-window) > (define-key map "o" 'bookmark-bmenu-other-window) > (define-key map "\C-o" 'bookmark-bmenu-switch-other-window) > (define-key map "s" 'bookmark-bmenu-save) > (define-key map "k" 'bookmark-bmenu-delete) > (define-key map "\C-d" 'bookmark-bmenu-delete-backwards) > (define-key map "x" 'bookmark-bmenu-execute-deletions) > (define-key map "d" 'bookmark-bmenu-delete) > (define-key map " " 'bookmark-bmenu-next-line) > (define-key map "n" 'bookmark-bmenu-next-line) > (define-key map [remap next-line] 'bookmark-bmenu-next-line) > (define-key map "p" 'bookmark-bmenu-previous-line) > (define-key map [remap previous-line] 'bookmark-bmenu-previous-line) > (define-key map "\177" 'bookmark-bmenu-backup-unmark) > (define-key map "u" 'bookmark-bmenu-unmark) > (define-key map "m" 'bookmark-bmenu-mark) > (define-key map "l" 'bookmark-bmenu-load) > (define-key map "r" 'bookmark-bmenu-rename) > (define-key map "R" 'bookmark-bmenu-relocate) > (define-key map "t" 'bookmark-bmenu-toggle-filenames) > (define-key map "a" 'bookmark-bmenu-show-annotation) > (define-key map "A" 'bookmark-bmenu-show-all-annotations) > (define-key map "e" 'bookmark-bmenu-edit-annotation) > (define-key map "/" 'bookmark-bmenu-search) > (define-key map [remap backward-char] 'bookmark-bmenu-backward-char) > (define-key map [remap forward-char] 'bookmark-bmenu-forward-char) > (define-key map [mouse-2] 'bookmark-bmenu-other-window-with-mouse) > map)) > (eval-after-load "bookmark" > (progn > (define-key bookmark-bmenu-mode-map > [remap next-line] 'bookmark-bmenu-next-line) > (define-key bookmark-bmenu-mode-map > [remap previous-line] 'bookmark-bmenu-previous-line) > (define-key bookmark-bmenu-mode-map > (kbd "n") 'bookmark-bmenu-next-line) > (define-key bookmark-bmenu-mode-map > (kbd "SPC") 'bookmark-bmenu-next-line) > (define-key bookmark-bmenu-mode-map > (kbd "p") 'bookmark-bmenu-previous-line) > (define-key bookmark-bmenu-mode-map > [remap backward-char] 'bookmark-bmenu-backward-char) > (define-key bookmark-bmenu-mode-map > [remap forward-char] 'bookmark-bmenu-forward-char) > )) > ;------------------------------------------------------------------- > ;------------------------------------------------------------------- > ; Modification to function `bookmark-bmenu-show-annotation' to allow > ; for toggling whether to autodisplay annotations as one navigates > ; through the bookmark list. > ; > ; Do note that the documentation for function `called-interactively-p' > ; discourages its use in favor of eg. '(not (or executing-kbd-macro > ; noninteractive))'. See there for details. > ; > (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))) > ;------------------------------------------------------------------- > -- > hkp://keys.gnupg.net > CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0