From: Boruch Baum <boruch_baum@gmx.com>
To: 20150@debbugs.gnu.org
Subject: bug#20150: 24.4: bookmarks: return from editing annotations (FIX INCLUDED)
Date: Fri, 20 Mar 2015 03:24:04 -0400 [thread overview]
Message-ID: <550BCB14.90005@gmx.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1548 bytes --]
When completing a bookmark annotation edit, the point on the bmenu-list
would move to point-max and the selected window would be wherever the
annotation buffer had been displayed.
The fix restores focus to the bmenu-list window, and restores point to
where it had been prior to editing the annotation.
(defun bookmark-send-edited-annotation ()
"Use buffer contents as annotation for a bookmark.
Lines beginning with `#' are ignored."
(interactive)
(if (not (derived-mode-p 'bookmark-edit-annotation-mode))
(error "Not in bookmark-edit-annotation-mode"))
(goto-char (point-min))
(while (< (point) (point-max))
(if (looking-at "^#")
(bookmark-kill-line t)
(forward-line 1)))
;; Take no chances with text properties.
(let
((annotation (buffer-substring-no-properties (point-min) (point-max)))
(bookmark-name bookmark-annotation-name)
(return-line
(with-current-buffer "*Bookmark List*"
(line-number-at-pos)))
(return-column
(with-current-buffer "*Bookmark List*"
(current-column))))
(bookmark-set-annotation bookmark-name annotation)
(setq bookmark-alist-modification-count
(1+ bookmark-alist-modification-count))
(kill-buffer (current-buffer))
(pop-to-buffer (get-buffer "*Bookmark List*"))
(bookmark-bmenu-list)
(goto-char (point-min))
(forward-line (1- return-line))
(forward-char return-column)))
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
[-- Attachment #1.2: attachment --]
[-- Type: text/plain, Size: 1124 bytes --]
(defun bookmark-send-edited-annotation ()
"Use buffer contents as annotation for a bookmark.
Lines beginning with `#' are ignored."
(interactive)
(if (not (derived-mode-p 'bookmark-edit-annotation-mode))
(error "Not in bookmark-edit-annotation-mode"))
(goto-char (point-min))
(while (< (point) (point-max))
(if (looking-at "^#")
(bookmark-kill-line t)
(forward-line 1)))
;; Take no chances with text properties.
(let
((annotation (buffer-substring-no-properties (point-min) (point-max)))
(bookmark-name bookmark-annotation-name)
(return-line
(with-current-buffer "*Bookmark List*"
(line-number-at-pos)))
(return-column
(with-current-buffer "*Bookmark List*"
(current-column))))
(bookmark-set-annotation bookmark-name annotation)
(setq bookmark-alist-modification-count
(1+ bookmark-alist-modification-count))
(kill-buffer (current-buffer))
(pop-to-buffer (get-buffer "*Bookmark List*"))
(bookmark-bmenu-list)
(goto-char (point-min))
(forward-line (1- return-line))
(forward-char return-column)))
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next reply other threads:[~2015-03-20 7:24 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-20 7:24 Boruch Baum [this message]
2015-03-20 14:28 ` bug#20150: 24.4: bookmarks: return from editing annotations (FIX INCLUDED) Stefan Monnier
2015-03-20 16:22 ` Boruch Baum
2019-07-02 1:54 ` Stefan Kangas
2019-07-02 3:23 ` Stefan Kangas
2019-07-03 20:05 ` Stefan Kangas
2019-07-04 19:20 ` Stefan Kangas
2019-07-04 19:40 ` Stefan Kangas
2019-07-13 7:30 ` Eli Zaretskii
2019-07-13 13:09 ` Stefan Kangas
2019-07-13 13:24 ` Eli Zaretskii
2019-07-13 13:51 ` Stefan Kangas
2019-07-14 1:48 ` Glenn Morris
2019-07-14 6:04 ` Eli Zaretskii
2019-07-14 6:29 ` Eli Zaretskii
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=550BCB14.90005@gmx.com \
--to=boruch_baum@gmx.com \
--cc=20150@debbugs.gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).