2010-04-14 Katsumi Yamaoka <yamaoka@jpl.org>
authorKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 14 Apr 2010 14:54:28 +0000 (14:54 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 14 Apr 2010 14:54:28 +0000 (14:54 +0000)
 * 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  <monnier@iro.umontreal.ca>
 * 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  <thierry.volpiatto@gmail.com>
 * gnus-sum.el (gnus-summary-bookmark-make-record)
 (gnus-summary-bookmark-jump): New functions.
 (gnus-summary-mode): Setup bookmark support.

lisp/ChangeLog
lisp/gnus-sum.el
lisp/lpath.el

index 58aeee8..fecb1bc 100644 (file)
@@ -1,3 +1,24 @@
+2010-04-14  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * 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  <monnier@iro.umontreal.ca>
+
+       * 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  <thierry.volpiatto@gmail.com>
+
+       * 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  <schwab@linux-m68k.org>
 
        * mm-uu.el (mm-uu-pgp-signed-extract-1): Use buffer-file-coding-system
index 608224e..ba74e3b 100644 (file)
@@ -3017,7 +3017,7 @@ When FORCE, rebuild the tool bar."
 
 
 (declare-function turn-on-gnus-mailing-list-mode "gnus-ml" ())
-
+(defvar bookmark-make-record-function)
 \f
 
 (defun gnus-summary-mode (&optional group)
@@ -3072,6 +3072,8 @@ The following commands are available:
   (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 @@ The resulting hash table is returned, or nil if no Xrefs were found."
   "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 @@ If REVERSE (the prefix), limit to articles that don't match."
     (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 @@ Obeys the standard process/prefix convention."
       (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 @@ If ALL is a number, fetch this number of articles."
          (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 08edc96..971bf7c 100644 (file)
     (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)))
 
   (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