diff options
| author | Karl Fogel | 2010-07-14 12:02:53 -0400 |
|---|---|---|
| committer | Karl Fogel | 2010-07-14 12:02:53 -0400 |
| commit | 33b4848367ec5383a8dd35113c454c85fb3f0ef5 (patch) | |
| tree | dabcf5710f423fcdae7a116c68fefcb886a91244 | |
| parent | e44fa724e4563cfd3f30b85c3c16a2d2dab65ccd (diff) | |
| download | emacs-33b4848367ec5383a8dd35113c454c85fb3f0ef5.tar.gz emacs-33b4848367ec5383a8dd35113c454c85fb3f0ef5.zip | |
Allow bookmarks to be set from Gnus Article buffers (Bug #5975).
Patch applied (with minor tweaks) by Karl Fogel. Note this leaves
C-w still not working correctly from Article buffers; Thierry's
patch to fix that will be applied after this.
* lisp/gnus/gnus-art.el (bookmark-make-record-function): New local variable.
* lisp/gnus/gnus-sum.el (gnus-summary-bookmark-make-record): Allow setting
from article buffer.
(gnus-summary-bookmark-jump): Maybe jump to article buffer.
| -rw-r--r-- | lisp/gnus/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/gnus/gnus-art.el | 2 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 40 |
3 files changed, 42 insertions, 13 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index a32da68da36..cc2a891ab82 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2010-07-13 Thierry Volpiatto <thierry.volpiatto@gmail.com> | ||
| 2 | |||
| 3 | Allow bookmarks to be set from Gnus Article buffers (Bug #5975). | ||
| 4 | Patch applied (with minor tweaks) by Karl Fogel. Note this leaves | ||
| 5 | C-w still not working correctly from Article buffers; Thierry's | ||
| 6 | patch to fix that will be applied after this. | ||
| 7 | |||
| 8 | * gnus-art.el (bookmark-make-record-function): New local variable. | ||
| 9 | |||
| 10 | * gnus-sum.el (gnus-summary-bookmark-make-record): Allow setting | ||
| 11 | from article buffer. | ||
| 12 | (gnus-summary-bookmark-jump): Maybe jump to article buffer. | ||
| 13 | |||
| 1 | 2010-07-13 Karl Fogel <kfogel@red-bean.com> | 14 | 2010-07-13 Karl Fogel <kfogel@red-bean.com> |
| 2 | 15 | ||
| 3 | * gnus/gnus-sum.el (bookmark-make-record-default): Adjust | 16 | * gnus/gnus-sum.el (bookmark-make-record-default): Adjust |
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 6b20fa678d0..51be4517a77 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el | |||
| @@ -4452,6 +4452,8 @@ commands: | |||
| 4452 | (make-local-variable 'gnus-article-image-alist) | 4452 | (make-local-variable 'gnus-article-image-alist) |
| 4453 | (make-local-variable 'gnus-article-charset) | 4453 | (make-local-variable 'gnus-article-charset) |
| 4454 | (make-local-variable 'gnus-article-ignored-charsets) | 4454 | (make-local-variable 'gnus-article-ignored-charsets) |
| 4455 | (set (make-local-variable 'bookmark-make-record-function) | ||
| 4456 | 'gnus-summary-bookmark-make-record) | ||
| 4455 | ;; Prevent Emacs 22 from displaying non-break space with `nobreak-space' | 4457 | ;; Prevent Emacs 22 from displaying non-break space with `nobreak-space' |
| 4456 | ;; face. | 4458 | ;; face. |
| 4457 | (set (make-local-variable 'nobreak-char-display) nil) | 4459 | (set (make-local-variable 'nobreak-char-display) nil) |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index ce945186fbf..2b18221b502 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -12629,18 +12629,24 @@ If ALL is a number, fetch this number of articles." | |||
| 12629 | 12629 | ||
| 12630 | (defun gnus-summary-bookmark-make-record () | 12630 | (defun gnus-summary-bookmark-make-record () |
| 12631 | "Make a bookmark entry for a Gnus summary buffer." | 12631 | "Make a bookmark entry for a Gnus summary buffer." |
| 12632 | (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current) | 12632 | (let (pos buf) |
| 12633 | (error "Please retry from the Gnus summary buffer")) ;[1] | 12633 | (unless (and (derived-mode-p 'gnus-summary-mode) gnus-article-current) |
| 12634 | (let* ((subject (elt (gnus-summary-article-header) 1)) | 12634 | (save-restriction ; FIXME is it necessary to widen? |
| 12635 | (grp (car gnus-article-current)) | 12635 | (widen) (setq pos (point))) ; Set position in gnus-article buffer. |
| 12636 | (art (cdr gnus-article-current)) | 12636 | (setq buf "art") ; We are recording bookmark from article buffer. |
| 12637 | (head (gnus-summary-article-header art)) | 12637 | (gnus-article-show-summary)) ; Go back in summary buffer. |
| 12638 | (id (mail-header-id head))) | 12638 | ;; We are now recording bookmark from summary buffer. |
| 12639 | `(,subject | 12639 | (unless buf (setq buf "sum")) |
| 12640 | ,@(bookmark-make-record-default 'point-only) | 12640 | (let* ((subject (elt (gnus-summary-article-header) 1)) |
| 12641 | (location . ,(format "Gnus %s:%d:%s" grp art id)) | 12641 | (grp (car gnus-article-current)) |
| 12642 | (group . ,grp) (article . ,art) | 12642 | (art (cdr gnus-article-current)) |
| 12643 | (message-id . ,id) (handler . gnus-summary-bookmark-jump)))) | 12643 | (head (gnus-summary-article-header art)) |
| 12644 | (id (mail-header-id head))) | ||
| 12645 | `(,subject | ||
| 12646 | ,@(bookmark-make-record-default 'no-file 'no-context pos) | ||
| 12647 | (location . ,(format "Gnus-%s %s:%d:%s" buf grp art id)) | ||
| 12648 | (group . ,grp) (article . ,art) | ||
| 12649 | (message-id . ,id) (handler . gnus-summary-bookmark-jump))))) | ||
| 12644 | 12650 | ||
| 12645 | ;;;###autoload | 12651 | ;;;###autoload |
| 12646 | (defun gnus-summary-bookmark-jump (bookmark) | 12652 | (defun gnus-summary-bookmark-jump (bookmark) |
| @@ -12648,10 +12654,18 @@ If ALL is a number, fetch this number of articles." | |||
| 12648 | BOOKMARK is a bookmark name or a bookmark record." | 12654 | BOOKMARK is a bookmark name or a bookmark record." |
| 12649 | (let ((group (bookmark-prop-get bookmark 'group)) | 12655 | (let ((group (bookmark-prop-get bookmark 'group)) |
| 12650 | (article (bookmark-prop-get bookmark 'article)) | 12656 | (article (bookmark-prop-get bookmark 'article)) |
| 12651 | (id (bookmark-prop-get bookmark 'message-id))) | 12657 | (id (bookmark-prop-get bookmark 'message-id)) |
| 12658 | (buf (car (split-string (bookmark-prop-get bookmark 'location))))) | ||
| 12652 | (gnus-fetch-group group (list article)) | 12659 | (gnus-fetch-group group (list article)) |
| 12653 | (gnus-summary-insert-cached-articles) | 12660 | (gnus-summary-insert-cached-articles) |
| 12654 | (gnus-summary-goto-article id nil 'force) | 12661 | (gnus-summary-goto-article id nil 'force) |
| 12662 | ;; FIXME we have to wait article buffer is ready (only large buffer) | ||
| 12663 | ;; Is there a better solution to know that? | ||
| 12664 | ;; If we don't wait `bookmark-default-handler' will have no chance | ||
| 12665 | ;; to set position. However there is no error, just wrong pos. | ||
| 12666 | (sit-for 1) | ||
| 12667 | (when (string= buf "Gnus-art") | ||
| 12668 | (other-window 1)) | ||
| 12655 | (bookmark-default-handler | 12669 | (bookmark-default-handler |
| 12656 | `("" | 12670 | `("" |
| 12657 | (buffer . ,(current-buffer)) | 12671 | (buffer . ,(current-buffer)) |