Mercurial > emacs
diff lisp/gnus/gnus-sum.el @ 107837:4ad129f7804d
Summary: Add bookmark support for man, woman and gnus-summary.
* woman.el (woman-bookmark-make-record, woman-bookmark-jump):
New functions.
(woman-mode): Setup bookmark support.
* man.el (man-set-default-bookmark-title, man-bookmark-make-record)
(man-bookmark-jump): New functions.
(Man-mode): Setup bookmark support.
* gnus-sum.el (gnus-summary-bookmark-make-record)
(gnus-summary-bookmark-jump): New functions.
(gnus-summary-mode): Setup bookmark support.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 12 Apr 2010 11:17:29 -0400 |
parents | 0fe940324254 |
children | f50f5478ec53 |
line wrap: on
line diff
--- a/lisp/gnus/gnus-sum.el Mon Apr 12 07:38:42 2010 -0700 +++ b/lisp/gnus/gnus-sum.el Mon Apr 12 11:17:29 2010 -0400 @@ -3072,6 +3072,9 @@ (gnus-run-mode-hooks 'gnus-summary-mode-hook) (turn-on-gnus-mailing-list-mode) (mm-enable-multibyte) + ;; Bookmark support. + (set (make-local-variable 'bookmark-make-record-function) + 'gnus-summary-bookmark-make-record) (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy) (gnus-update-summary-mark-positions)) @@ -12640,6 +12643,38 @@ (gnus-summary-limit (gnus-sorted-nunion old new)))) (gnus-summary-position-point))) +;;; BOOKMARK support for GNUS. + +(defun gnus-summary-bookmark-make-record () + "Make a bookmark entry for a Gnus buffer." + (require 'gnus) + (unless (and (eq major-mode 'gnus-summary-mode) gnus-article-current) + (error "Please retry from the Gnus summary buffer")) ;[1] + (let* ((subject (elt (gnus-summary-article-header) 1)) + (grp (car gnus-article-current)) + (art (cdr gnus-article-current)) + (head (gnus-summary-article-header art)) + (id (mail-header-id head))) + `(,subject + ,@(bookmark-make-record-default 'point-only) + (group . ,grp) (article . ,art) + (message-id . ,id) (handler . gnus-summary-bookmark-jump)))) + + +(defun gnus-summary-bookmark-jump (bookmark) + "Handler function for record returned by `gnus-summary-bookmark-make-record'. +BOOKMARK is a bookmark name or a bookmark record." + (let ((group (bookmark-prop-get bookmark 'group)) + (article (bookmark-prop-get bookmark 'article)) + (id (bookmark-prop-get bookmark 'message-id)) + buf) + (gnus-fetch-group group (list article)) + (gnus-summary-insert-cached-articles) + (gnus-summary-goto-article id nil 'force) + (setq buf (current-buffer)) + (bookmark-default-handler + `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark))))) + (gnus-summary-make-all-marking-commands) (gnus-ems-redefine)