comparison 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
comparison
equal deleted inserted replaced
109396:8b1192833a1e 109397:4e6b8160da4b
781 781
782 Use \\[bookmark-delete] to remove bookmarks (you give it a name and 782 Use \\[bookmark-delete] to remove bookmarks (you give it a name and
783 it removes only the first instance of a bookmark with that name from 783 it removes only the first instance of a bookmark with that name from
784 the list of bookmarks.)" 784 the list of bookmarks.)"
785 (interactive (list nil current-prefix-arg)) 785 (interactive (list nil current-prefix-arg))
786 (let* ((record (bookmark-make-record)) 786 (unwind-protect
787 (default (car record))) 787 (let* ((record (bookmark-make-record))
788 788 (default (car record)))
789 (bookmark-maybe-load-default-file) 789
790 790 (bookmark-maybe-load-default-file)
791 (setq bookmark-yank-point (point)) 791 ;; Don't set `bookmark-yank-point' and `bookmark-current-buffer'
792 (setq bookmark-current-buffer (current-buffer)) 792 ;; if they have been already set in another buffer. (e.g gnus-art).
793 793 (unless (and bookmark-yank-point
794 (let ((str 794 bookmark-current-buffer)
795 (or name 795 (setq bookmark-yank-point (point))
796 (read-from-minibuffer 796 (setq bookmark-current-buffer (current-buffer)))
797 (format "Set bookmark (%s): " default) 797
798 nil 798 (let ((str
799 bookmark-minibuffer-read-name-map 799 (or name
800 nil nil default)))) 800 (read-from-minibuffer
801 (and (string-equal str "") (setq str default)) 801 (format "Set bookmark (%s): " default)
802 (bookmark-store str (cdr record) no-overwrite) 802 nil
803 803 bookmark-minibuffer-read-name-map
804 ;; Ask for an annotation buffer for this bookmark 804 nil nil default))))
805 (when bookmark-use-annotations 805 (and (string-equal str "") (setq str default))
806 (bookmark-edit-annotation str))))) 806 (bookmark-store str (cdr record) no-overwrite)
807
808 ;; Ask for an annotation buffer for this bookmark
809 (when bookmark-use-annotations
810 (bookmark-edit-annotation str))))
811 (setq bookmark-yank-point nil)
812 (setq bookmark-current-buffer nil)))
813
807 814
808 (defun bookmark-kill-line (&optional newline-too) 815 (defun bookmark-kill-line (&optional newline-too)
809 "Kill from point to end of line. 816 "Kill from point to end of line.
810 If optional arg NEWLINE-TOO is non-nil, delete the newline too. 817 If optional arg NEWLINE-TOO is non-nil, delete the newline too.
811 Does not affect the kill ring." 818 Does not affect the kill ring."