Changes committed gnus/lisp (ChangeLog gnus-sum.el lpath.el)

"Katsumi Yamaoka" <[email protected]> Wed, 14 Apr 2010 16:54:28 +0200
Newsgroups gmane.emacs.gnus.commits
Message-ID <[email protected]>
Modified: ChangeLog gnus-sum.el lpath.el

2010-04-14  Katsumi Yamaoka  <[email protected]>
 * lpath.el: Fbind bookmark-default-handler,
 bookmark-get-bookmark-record, bookmark-make-record-default,
 bookmark-prop-get for Emacs <23 and XEmacs.

2010-04-12  Stefan Monnier  <[email protected]>
 * gnus-sum.el: Add bookmark declarations to silence the compiler.
 (gnus-mark-xrefs-as-read, gnus-summary-limit-to-bodies):
 Use with-current-buffer to silence the byte-compiler.
 (gnus-summary-bookmark-make-record): Use derived-mode-p and don't
 bother to require `gnus'.
 (gnus-summary-bookmark-jump): Don't forget to autoload.  Simplify.

2010-04-12  Thierry Volpiatto  <[email protected]>
 * gnus-sum.el (gnus-summary-bookmark-make-record)
 (gnus-summary-bookmark-jump): New functions.
 (gnus-summary-mode): Setup bookmark support.


Index: ChangeLog
diff -u gnus/lisp/ChangeLog:7.2082 gnus/lisp/ChangeLog:7.2083
--- ChangeLog:7.2082	Fri Apr  2 01:15:17 2010
+++ ChangeLog	Wed Apr 14 16:54:28 2010
@@ -1,3 +1,24 @@
+2010-04-14  Katsumi Yamaoka  <[email protected]>
+
+	* lpath.el: Fbind bookmark-default-handler,
+	bookmark-get-bookmark-record, bookmark-make-record-default,
+	bookmark-prop-get for Emacs <23 and XEmacs.
+
+2010-04-12  Stefan Monnier  <[email protected]>
+
+	* gnus-sum.el: Add bookmark declarations to silence the compiler.
+	(gnus-mark-xrefs-as-read, gnus-summary-limit-to-bodies):
+	Use with-current-buffer to silence the byte-compiler.
+	(gnus-summary-bookmark-make-record): Use derived-mode-p and don't
+	bother to require `gnus'.
+	(gnus-summary-bookmark-jump): Don't forget to autoload.  Simplify.
+
+2010-04-12  Thierry Volpiatto  <[email protected]>
+
+	* gnus-sum.el (gnus-summary-bookmark-make-record)
+	(gnus-summary-bookmark-jump): New functions.
+	(gnus-summary-mode): Setup bookmark support.
+
 2010-04-01  Andreas Schwab  <[email protected]>
 
 	* mm-uu.el (mm-uu-pgp-signed-extract-1): Use buffer-file-coding-system
Index: gnus-sum.el
diff -u gnus/lisp/gnus-sum.el:7.248 gnus/lisp/gnus-sum.el:7.249
--- gnus-sum.el:7.248	Sat Mar 20 19:52:07 2010
+++ gnus-sum.el	Wed Apr 14 16:54:28 2010
@@ -3017,7 +3017,7 @@
 
 
 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
-
+(defvar bookmark-make-record-function)
 
 
 (defun gnus-summary-mode (&optional group)
@@ -3072,6 +3072,8 @@
   (gnus-run-mode-hooks 'gnus-summary-mode-hook)
   (turn-on-gnus-mailing-list-mode)
   (mm-enable-multibyte)
+  (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))
 
@@ -6090,8 +6092,7 @@
   "Look through all the headers and mark the Xrefs as read."
   (let ((virtual (gnus-virtual-group-p from-newsgroup))
 	name info xref-hashtb idlist method nth4)
-    (save-excursion
-      (set-buffer gnus-group-buffer)
+    (with-current-buffer gnus-group-buffer
       (when (setq xref-hashtb
 		  (gnus-create-xref-hashtb from-newsgroup headers unreads))
 	(mapatoms
@@ -8341,8 +8342,7 @@
     (dolist (data gnus-newsgroup-data)
       (let (gnus-mark-article-hook)
 	(gnus-summary-select-article t t nil (gnus-data-number data)))
-      (save-excursion
-	(set-buffer gnus-article-buffer)
+      (with-current-buffer gnus-article-buffer
 	(article-goto-body)
 	(let* ((case-fold-search t)
 	       (found (if headersp
@@ -9026,7 +9026,7 @@
       (setq group (format "%s-%d" gnus-newsgroup-name article))
       (gnus-summary-remove-process-mark article)
       (when (gnus-summary-display-article article)
-	(save-excursion
+	(save-excursion ;;What for?
 	  (with-temp-buffer
 	    (insert-buffer-substring gnus-original-article-buffer)
 	    ;; Remove some headers that may lead nndoc to make
@@ -12640,6 +12640,41 @@
 	  (gnus-summary-limit (gnus-sorted-nunion old new))))
     (gnus-summary-position-point)))
 
+;;; Bookmark support for Gnus.
+(declare-function bookmark-make-record-default "bookmark" (&optional pos-only))
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
+(declare-function bookmark-get-bookmark-record "bookmark" (bmk))
+
+(defun gnus-summary-bookmark-make-record ()
+  "Make a bookmark entry for a Gnus summary buffer."
+  (unless (and (derived-mode-p '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))))
+
+;;;###autoload
+(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)))
+    (gnus-fetch-group group (list article))
+    (gnus-summary-insert-cached-articles)
+    (gnus-summary-goto-article id nil 'force)
+    (bookmark-default-handler
+     `(""
+       (buffer . ,(current-buffer))
+       . ,(bookmark-get-bookmark-record bookmark)))))
+
 (gnus-summary-make-all-marking-commands)
 
 (gnus-ems-redefine)
Index: lpath.el
diff -u gnus/lisp/lpath.el:7.59 gnus/lisp/lpath.el:7.60
--- lpath.el:7.59	Tue Mar 23 09:23:42 2010
+++ lpath.el	Wed Apr 14 16:54:28 2010
@@ -29,11 +29,12 @@
     (defun nnkiboze-score-file (a))
     (maybe-fbind
      '(Info-index
-       Info-index-next Info-menu bbdb-complete-name display-time-event-handler
-       epg-check-configuration find-coding-system frame-device
-       recenter-top-bottom rmail-swap-buffers-maybe w3-do-setup
-       w3-prepare-buffer w3-region w32-focus-frame w3m-detect-meta-charset
-       w3m-region))
+       Info-index-next Info-menu bbdb-complete-name bookmark-default-handler
+       bookmark-get-bookmark-record bookmark-make-record-default
+       bookmark-prop-get display-time-event-handler epg-check-configuration
+       find-coding-system frame-device recenter-top-bottom
+       rmail-swap-buffers-maybe w3-do-setup w3-prepare-buffer w3-region
+       w32-focus-frame w3m-detect-meta-charset w3m-region))
     (maybe-bind
      '(w3m-link-map)))
 
@@ -77,10 +78,12 @@
   (eval-after-load "rmail"
     '(defun rmail-toggle-header (&optional arg)))
   (maybe-fbind
-   '(clear-string
-     codepage-setup coding-system-from-name cp-supported-codepages create-image
-     detect-coding-string display-time-event-handler epg-check-configuration
-     event-click-count event-end event-start find-coding-systems-for-charsets
+   '(bookmark-default-handler
+     bookmark-get-bookmark-record bookmark-make-record-default
+     bookmark-prop-get clear-string codepage-setup coding-system-from-name
+     cp-supported-codepages create-image detect-coding-string
+     display-time-event-handler epg-check-configuration event-click-count
+     event-end event-start find-coding-systems-for-charsets
      find-coding-systems-region find-coding-systems-string find-image
      float-time help-buffer image-size image-type-available-p insert-image
      mail-abbrevs-setup make-mode-line-mouse-map make-network-process