bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20150: 24.4: bookmarks: return from editing annotations (FIX INCLUDE


From: Boruch Baum
Subject: bug#20150: 24.4: bookmarks: return from editing annotations (FIX INCLUDED)
Date: Fri, 20 Mar 2015 03:24:04 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0

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: attachment
Description: Text document

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]