diff lisp/gnus/gnus-sum.el @ 107838:f50f5478ec53

Clean up last bookmark changes for man/woman/gnus-summary. * 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. * woman.el: Add bookmark declarations to silence the compiler. (bookmark-prop-get): Use `man-args' rather than `filename' as a first step to compatibility between man and woman bookmarks. Adjust for Man-default-bookmark-title renaming. (woman-bookmark-jump): Adjust accordingly. Don't forget to autoload. * man.el: Add bookmark declarations to silence the compiler. (Man-name-local-regexp): Make it match NAME as well. (Man-getpage-in-background): Return the buffer. (Man-notify-when-ready): Use `case'. (man-set-default-bookmark-title): Rename to Man-default-bookmark-title. Don't hardcode "NAME". Simplify. (Man-bookmark-make-record): Use Man-arguments rather than buffer-name. Rename from Man-bookmark-make-record. (Man-bookmark-jump): Rename from man-bookmark-jump. Simplify now that we have the actual man-args. Use Man-getpage-in-background rather than `man' since the arg is already processed. Let bookmark.el do the window handling. Only wait for the relevant process. Don't forget to autoload. * bookmark.el (bookmark-default-file): Use locate-user-emacs-file.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 12 Apr 2010 12:09:47 -0400
parents 4ad129f7804d
children d9895f87d758
line wrap: on
line diff
--- a/lisp/gnus/gnus-sum.el	Mon Apr 12 11:17:29 2010 -0400
+++ b/lisp/gnus/gnus-sum.el	Mon Apr 12 12:09:47 2010 -0400
@@ -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,7 +3072,6 @@
   (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)
@@ -6093,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
@@ -8344,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
@@ -9029,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
@@ -12643,12 +12640,15 @@
 	  (gnus-summary-limit (gnus-sorted-nunion old new))))
     (gnus-summary-position-point)))
 
-;;; BOOKMARK support for GNUS.
+;;; 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 buffer."
-  (require 'gnus)
-  (unless (and (eq major-mode 'gnus-summary-mode) gnus-article-current)
+  "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))
@@ -12660,20 +12660,20 @@
         (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))
-        buf)
+        (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)
-    (setq buf (current-buffer))
     (bookmark-default-handler
-     `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bookmark)))))
+     `(""
+       (buffer . ,(current-buffer))
+       . ,(bookmark-get-bookmark-record bookmark)))))
 
 (gnus-summary-make-all-marking-commands)