Mercurial > emacs
diff lisp/bookmark.el @ 109397:4e6b8160da4b
Allow C-w when setting a bookmark in a Gnus Article buffer (Bug#5975).
* lisp/bookmark.el (bookmark-set): Don't set `bookmark-yank-point' and
`bookmark-current-buffer' if they have been already set in another
buffer (e.g gnus-art).
* lisp/gnus/gnus-sum.el (gnus-summary-bookmark-make-record): Set
`bookmark-yank-point' and `bookmark-current-buffer' to allow C-w.
author | Karl Fogel <kfogel@red-bean.com> |
---|---|
date | Wed, 14 Jul 2010 12:41:40 -0400 |
parents | fa4400531412 |
children | 3fcc8637a887 |
line wrap: on
line diff
--- a/lisp/bookmark.el Wed Jul 14 12:02:53 2010 -0400 +++ b/lisp/bookmark.el Wed Jul 14 12:41:40 2010 -0400 @@ -783,27 +783,34 @@ it removes only the first instance of a bookmark with that name from the list of bookmarks.)" (interactive (list nil current-prefix-arg)) - (let* ((record (bookmark-make-record)) - (default (car record))) + (unwind-protect + (let* ((record (bookmark-make-record)) + (default (car record))) - (bookmark-maybe-load-default-file) - - (setq bookmark-yank-point (point)) - (setq bookmark-current-buffer (current-buffer)) + (bookmark-maybe-load-default-file) + ;; Don't set `bookmark-yank-point' and `bookmark-current-buffer' + ;; if they have been already set in another buffer. (e.g gnus-art). + (unless (and bookmark-yank-point + bookmark-current-buffer) + (setq bookmark-yank-point (point)) + (setq bookmark-current-buffer (current-buffer))) - (let ((str - (or name - (read-from-minibuffer - (format "Set bookmark (%s): " default) - nil - bookmark-minibuffer-read-name-map - nil nil default)))) - (and (string-equal str "") (setq str default)) - (bookmark-store str (cdr record) no-overwrite) + (let ((str + (or name + (read-from-minibuffer + (format "Set bookmark (%s): " default) + nil + bookmark-minibuffer-read-name-map + nil nil default)))) + (and (string-equal str "") (setq str default)) + (bookmark-store str (cdr record) no-overwrite) - ;; Ask for an annotation buffer for this bookmark - (when bookmark-use-annotations - (bookmark-edit-annotation str))))) + ;; Ask for an annotation buffer for this bookmark + (when bookmark-use-annotations + (bookmark-edit-annotation str)))) + (setq bookmark-yank-point nil) + (setq bookmark-current-buffer nil))) + (defun bookmark-kill-line (&optional newline-too) "Kill from point to end of line.