From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Boruch Baum Newsgroups: gmane.emacs.bugs Subject: bug#20152: 24.4: bookmarks display wrong annotation (FIX INCLUDED) Date: Fri, 20 Mar 2015 12:29:17 -0400 Message-ID: <550C4ADD.9050607@gmx.com> References: <550BF8BE.5080105@gmx.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TUA6rVNmqeHOsHQXEvjM4THPaJHd1qSde" X-Trace: ger.gmane.org 1426869147 12379 80.91.229.3 (20 Mar 2015 16:32:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Mar 2015 16:32:27 +0000 (UTC) Cc: 20152@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Mar 20 17:32:13 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 1YYzqD-0004a8-2C for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Mar 2015 17:32:09 +0100 Original-Received: from localhost ([::1]:44759 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYzqC-0003hp-9q for geb-bug-gnu-emacs@m.gmane.org; Fri, 20 Mar 2015 12:32:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42655) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYzpD-0001lw-Sf for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 12:31:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYzp8-00078H-Re for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 12:31:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYzp8-00078A-Oy for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 12:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YYzp8-0001t2-8z for bug-gnu-emacs@gnu.org; Fri, 20 Mar 2015 12:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Boruch Baum Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 20 Mar 2015 16:31: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.14268690187148 (code B ref 20152); Fri, 20 Mar 2015 16:31:02 +0000 Original-Received: (at 20152) by debbugs.gnu.org; 20 Mar 2015 16:30:18 +0000 Original-Received: from localhost ([127.0.0.1]:59311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YYzoO-0001rD-IU for submit@debbugs.gnu.org; Fri, 20 Mar 2015 12:30:17 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:50559) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YYzoJ-0001qu-Mn for 20152@debbugs.gnu.org; Fri, 20 Mar 2015 12:30:14 -0400 Original-Received: from [192.168.1.12] ([96.232.130.59]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0M8ZtH-1ZV6JF27iV-00wBi8; Fri, 20 Mar 2015 17:30:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 In-Reply-To: OpenPGP: url=hkp://keys.gnupg.net X-Provags-ID: V03:K0:cL/gtl9+Z2U6FRd5GRrmZ2shpEsl3k7hZ/fQoeKfZ+aTrxqczAv +YQAXaFFJANAv1QvgiavmALp7AHGVgkCFoQqRwEoFn1pphuiOuEQwZxvjK/4tEbA9e3l+5Q cuHgL5wtYCVdLFv39N02LBRMWgRkTJIgpCEAMdZ6TYWpCFwTlP8BLOd6in2ze29xM2Bdgi8 iPANsn5B5v30TaiEZA26Q== X-UI-Out-Filterresults: notjunk:1; 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:100711 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --TUA6rVNmqeHOsHQXEvjM4THPaJHd1qSde Content-Type: multipart/mixed; boundary="------------070409020804060201040507" This is a multi-part message in MIME format. --------------070409020804060201040507 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 03/20/2015 10:31 AM, Stefan Monnier wrote: > Same here, please resend your fix as a patch ("diff -u" or "diff -c"). I've attached TWO versions of the patch, in order to give you the option to easily choose whether you want the second additional feature mentioned below. >> "Boruch" =3D=3D Boruch Baum writes: >=20 >> 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. >=20 >> The atttached bugfix kills the annotation buffer on navigation, >> and remaps navigation keys accordingly. >=20 >> The bugfix also introduces an option to automatically display >> annotations as one navigates within the bookmark list buffer. This is reflected in file `emacs_bug_20152-a.patch' >> The bugfix also introduces an option to toggle auto-display of >> annotations. This is reflected in file `emacs_bug_20152-b.patch' --=20 hkp://keys.gnupg.net CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0 --------------070409020804060201040507 Content-Type: text/x-patch; name="emacs_bug_20152-a.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="emacs_bug_20152-a.patch" --- bookmark.el 2015-03-20 12:11:20.889491239 -0400 +++ bookmark-new.el 2015-03-20 12:14:45.825484595 -0400 @@ -1487,9 +1487,11 @@ (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 " " 'next-line) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) + (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) @@ -1501,6 +1503,8 @@ (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)) =20 @@ -2068,6 +2072,54 @@ (forward-line 1)) (forward-line 0)) =20 +(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 (/=3D 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))))) =20 =0C ;;; Menu bar stuff. Prefix is "bookmark-menu". --------------070409020804060201040507 Content-Type: text/x-patch; name="emacs_bug_20152-b.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="emacs_bug_20152-b.patch" --- bookmark.el 2015-03-20 12:16:19.485481558 -0400 +++ bookmark-new.el 2015-03-20 12:17:41.241478908 -0400 @@ -1487,9 +1487,11 @@ (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 " " 'next-line) - (define-key map "n" 'next-line) - (define-key map "p" 'previous-line) + (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) @@ -1501,6 +1503,8 @@ (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)) =20 @@ -1901,9 +1905,20 @@ (bookmark-bmenu-other-window)))) =20 =20 +(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))) =20 @@ -2068,6 +2083,54 @@ (forward-line 1)) (forward-line 0)) =20 +(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 (/=3D 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))))) =20 =0C ;;; Menu bar stuff. Prefix is "bookmark-menu". --------------070409020804060201040507-- --TUA6rVNmqeHOsHQXEvjM4THPaJHd1qSde Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVDErdAAoJEDvrUfDmCx9LfFQP/Rpf3jSCq/5jiLgx/JiMEzp5 rHSwRfQvRasT2J202pgQ9Nj6cxNZ+FGpVi/6dscccPwcsrbYo20SBzd57V9t5hDu TwkDSQctxpFg6sJrCg8yuGRoe5tFduRPnGUv2sX7I/MEAIm3bH72WBdKpn0IDLfT qOHDHf5083cdlfj6ogmoyL4HA0TBkYDfs/PpT8K26/Knxv6+P0NPR9F5nkoWq7Re nIvM+wSf8fiSb+rbINiOFndnL20EBfvFgdLkLmVnUAaJTyg71UOho3NmWFgGoCdj KWnJ3YjniHxk4XJ9WVwkGLqSm+7qmaFDFznECiR5eCibHw4wTvU4DmF2fZU6to81 XoxEFhhbSxEFPDrWXj2Twh4Znqdoym5v++/NtWGyqfgRMjvIsqeg4EZH7pn1tc/H wpEqmlagtGEjaibaV7OnfW+2oZ6u3D/9afeKBe6zZ+A6ICJCTb/70lma9D1Mxt8h lYmYg8CO5+TZaC0P3ijbDDeZs7/3AnekJM4/NxF9icbl1NKE5kMNKT/ZONskDC+M yQF58r8yM+2BGWHwjZaTp9pQWj6HVWm7nmv7684hqfetzdwhClX/fvoUJFW3RJ2C AzqT6S4JcHBCrHqta1g9+9dUO+ISbqdotf631HPmNhbXkTkv1tpqfdN7KiAvaFUy jrGs6QoL3cLT7kX0KphM =tGDb -----END PGP SIGNATURE----- --TUA6rVNmqeHOsHQXEvjM4THPaJHd1qSde--