Mercurial > emacs
comparison lisp/gnus/gnus-sum.el @ 109434:a11596ec5941
Merge from mainline.
author | Katsumi Yamaoka <yamaoka@jpl.org> |
---|---|
date | Wed, 14 Jul 2010 22:46:23 +0000 |
parents | 4e6b8160da4b |
children | cb913a283247 |
comparison
equal
deleted
inserted
replaced
109433:f16404a62b75 | 109434:a11596ec5941 |
---|---|
12619 (gnus-sorted-nunion gnus-newsgroup-unreads new)) | 12619 (gnus-sorted-nunion gnus-newsgroup-unreads new)) |
12620 (gnus-summary-limit (gnus-sorted-nunion old new)))) | 12620 (gnus-summary-limit (gnus-sorted-nunion old new)))) |
12621 (gnus-summary-position-point))) | 12621 (gnus-summary-position-point))) |
12622 | 12622 |
12623 ;;; Bookmark support for Gnus. | 12623 ;;; Bookmark support for Gnus. |
12624 (declare-function bookmark-make-record-default "bookmark" (&optional pos-only)) | 12624 (declare-function bookmark-make-record-default |
12625 "bookmark" (&optional no-file no-context posn)) | |
12625 (declare-function bookmark-prop-get "bookmark" (bookmark prop)) | 12626 (declare-function bookmark-prop-get "bookmark" (bookmark prop)) |
12626 (declare-function bookmark-default-handler "bookmark" (bmk)) | 12627 (declare-function bookmark-default-handler "bookmark" (bmk)) |
12627 (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) | 12628 (declare-function bookmark-get-bookmark-record "bookmark" (bmk)) |
12628 | 12629 |
12629 (defun gnus-summary-bookmark-make-record () | 12630 (defun gnus-summary-bookmark-make-record () |
12630 "Make a bookmark entry for a Gnus summary buffer." | 12631 "Make a bookmark entry for a Gnus summary buffer." |
12631 (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current) | 12632 (let (pos buf) |
12632 (error "Please retry from the Gnus summary buffer")) ;[1] | 12633 (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current) |
12633 (let* ((subject (elt (gnus-summary-article-header) 1)) | 12634 (save-restriction ; FIXME is it necessary to widen? |
12634 (grp (car gnus-article-current)) | 12635 (widen) (setq pos (point))) ; Set position in gnus-article buffer. |
12635 (art (cdr gnus-article-current)) | 12636 (setq buf "art") ; We are recording bookmark from article buffer. |
12636 (head (gnus-summary-article-header art)) | 12637 (setq bookmark-yank-point (point)) |
12637 (id (mail-header-id head))) | 12638 (setq bookmark-current-buffer (current-buffer)) |
12638 `(,subject | 12639 (gnus-article-show-summary)) ; Go back in summary buffer. |
12639 ,@(bookmark-make-record-default 'point-only) | 12640 ;; We are now recording bookmark from summary buffer. |
12640 (location . ,(format "Gnus %s:%d:%s" grp art id)) | 12641 (unless buf (setq buf "sum")) |
12641 (group . ,grp) (article . ,art) | 12642 (let* ((subject (elt (gnus-summary-article-header) 1)) |
12642 (message-id . ,id) (handler . gnus-summary-bookmark-jump)))) | 12643 (grp (car gnus-article-current)) |
12644 (art (cdr gnus-article-current)) | |
12645 (head (gnus-summary-article-header art)) | |
12646 (id (mail-header-id head))) | |
12647 `(,subject | |
12648 ,@(bookmark-make-record-default 'no-file 'no-context pos) | |
12649 (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id)) | |
12650 (group . ,grp) (article . ,art) | |
12651 (message-id . ,id) (handler . gnus-summary-bookmark-jump))))) | |
12643 | 12652 |
12644 ;;;###autoload | 12653 ;;;###autoload |
12645 (defun gnus-summary-bookmark-jump (bookmark) | 12654 (defun gnus-summary-bookmark-jump (bookmark) |
12646 "Handler function for record returned by `gnus-summary-bookmark-make-record'. | 12655 "Handler function for record returned by `gnus-summary-bookmark-make-record'. |
12647 BOOKMARK is a bookmark name or a bookmark record." | 12656 BOOKMARK is a bookmark name or a bookmark record." |
12648 (let ((group (bookmark-prop-get bookmark 'group)) | 12657 (let ((group (bookmark-prop-get bookmark 'group)) |
12649 (article (bookmark-prop-get bookmark 'article)) | 12658 (article (bookmark-prop-get bookmark 'article)) |
12650 (id (bookmark-prop-get bookmark 'message-id))) | 12659 (id (bookmark-prop-get bookmark 'message-id)) |
12660 (buf (car (split-string (bookmark-prop-get bookmark 'location))))) | |
12651 (gnus-fetch-group group (list article)) | 12661 (gnus-fetch-group group (list article)) |
12652 (gnus-summary-insert-cached-articles) | 12662 (gnus-summary-insert-cached-articles) |
12653 (gnus-summary-goto-article id nil 'force) | 12663 (gnus-summary-goto-article id nil 'force) |
12664 ;; FIXME we have to wait article buffer is ready (only large buffer) | |
12665 ;; Is there a better solution to know that? | |
12666 ;; If we don't wait `bookmark-default-handler' will have no chance | |
12667 ;; to set position. However there is no error, just wrong pos. | |
12668 (sit-for 1) | |
12669 (when (string= buf "Gnus-art") | |
12670 (other-window 1)) | |
12654 (bookmark-default-handler | 12671 (bookmark-default-handler |
12655 `("" | 12672 `("" |
12656 (buffer . ,(current-buffer)) | 12673 (buffer . ,(current-buffer)) |
12657 . ,(bookmark-get-bookmark-record bookmark))))) | 12674 . ,(bookmark-get-bookmark-record bookmark))))) |
12658 | 12675 |