(message-tool-bar-gnome): Check if `flyspell-mode' is
[gnus] / lisp / gnus-sum.el
index 5a61b3d..0a3a6ce 100644 (file)
@@ -2650,8 +2650,9 @@ Setter function for custom variables."
     (with-current-buffer gnus-summary-buffer
       (gnus-summary-make-tool-bar))))
 
-;; The default will be changed when the new icons have been checked in:
-(defcustom gnus-summary-tool-bar 'gnus-summary-tool-bar-retro
+(defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome)
+                                    'gnus-summary-tool-bar-gnome
+                                  'gnus-summary-tool-bar-retro)
   "Specifies the Gnus summary tool bar.
 
 It can be either a list or a symbol refering to a list.  See
@@ -2670,42 +2671,46 @@ Pre-defined symbols include `gnus-summary-tool-bar-gnome' and
   :group 'gnus-summary)
 
 (defcustom gnus-summary-tool-bar-gnome
-  '((gnus-summary-post-news "compose" nil)
-    (gnus-summary-reply-with-original "reply-author")
-    (gnus-summary-reply "reply-author" nil :visible nil)
-    (gnus-summary-followup-with-original "reply-all")
-    (gnus-summary-followup "reply-all" nil :visible nil)
-    (gnus-summary-mail-forward "forward")
-    (gnus-summary-save-article "save") ;;  stock_mail-copy
-    (gnus-summary-search-article-forward "search")
+  '((gnus-summary-post-news "mail/compose" nil)
+    (gnus-summary-insert-new-articles "mail/inbox" nil
+                                     :visible (or (not gnus-agent)
+                                                  gnus-plugged))
+    (gnus-summary-reply-with-original "mail/reply")
+    (gnus-summary-reply "mail/reply" nil :visible nil)
+    (gnus-summary-followup-with-original "mail/reply-all")
+    (gnus-summary-followup "mail/reply-all" nil :visible nil)
+    (gnus-summary-mail-forward "mail/forward")
+    (gnus-summary-save-article "mail/save")
+    (gnus-summary-search-article-forward "search" nil :visible nil)
     (gnus-summary-print-article "print")
+    (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
+    ;; Some new commands that may need more suitable icons:
+    (gnus-summary-save-newsrc "save" nil :visible nil)
+    ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
+    (gnus-summary-prev-article "left-arrow")
+    (gnus-summary-next-article "right-arrow")
+    (gnus-summary-next-page "next-page")
+    ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
+    ;;
+    ;; Maybe some sort-by-... could be added:
+    ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
+    ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
     (gnus-summary-mark-as-expirable
      "delete" nil
      :visible (gnus-check-backend-function 'request-expire-articles
                                           gnus-newsgroup-name))
-    (gnus-summary-tick-article-forward "flag-followup" nil :visible nil)
     (gnus-summary-mark-as-spam
-     "spam" t :visible (spam-group-ham-contents-p gnus-newsgroup-name)
+     "mail/spam" t
+     :visible (and (fboundp 'spam-group-ham-contents-p)
+                  (spam-group-ham-contents-p gnus-newsgroup-name))
      :help "Mark as spam")
     (gnus-summary-mark-as-read-forward
-     "not-spam" nil :visible (spam-group-spam-contents-p gnus-newsgroup-name))
-    ;; Some new commands that may need more suitable icons:
-    (gnus-summary-save-newsrc "save" nil :visible nil)
-    ;; (gnus-summary-show-article "stock_message-display" nil :visible nil)
-    (gnus-summary-prev-article "left-arrow" nil :visible nil)  ;; Emacs 22
-    (gnus-summary-next-article "right-arrow" nil :visible nil) ;; Emacs 22
-    (gnus-summary-prev-unread-article "prev-node") ;; Emacs 22
-    (gnus-summary-next-unread-article "next-node") ;; Emacs 22
-    (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
-    ;;
-    ;; Maybe some sort-by-... could be added:
-    (gnus-summary-sort-by-author "sort-a-z" nil :visible nil)
-    (gnus-summary-sort-by-date "sort-1-9" nil :visible nil)
-    ;;
-    (gnus-summary-insert-new-articles "inbox")
-    ;;
-    (gnus-summary-exit "exit-mode")
+     "mail/not-spam" nil
+     :visible (and (fboundp 'spam-group-spam-contents-p)
+                  (spam-group-spam-contents-p gnus-newsgroup-name)))
     ;;
+    (gnus-summary-exit "exit")
+    (gmm-customize-mode "preferences" t :help "Edit mode preferences")
     (gnus-info-find-node "help"))
   "List of functions for the summary tool bar (GNOME style).
 
@@ -2717,31 +2722,31 @@ See `gmm-tool-bar-from-list' for the format of the list."
   :group 'gnus-summary)
 
 (defcustom gnus-summary-tool-bar-retro
-  '((gnus-summary-prev-unread-article "prev-ur")
-    (gnus-summary-next-unread-article "next-ur")
-    (gnus-summary-post-news "post")
-    (gnus-summary-followup-with-original "fuwo")
-    (gnus-summary-followup "followup")
-    (gnus-summary-reply-with-original "reply-wo")
-    (gnus-summary-reply "reply")
-    (gnus-summary-caesar-message "rot13")
-    (gnus-uu-decode-uu "uu-decode")
-    (gnus-summary-save-article-file "save-aif")
-    (gnus-summary-save-article "save-art")
-    (gnus-uu-post-news "uu-post")
-    (gnus-summary-catchup "catchup")
-    (gnus-summary-catchup-and-exit "cu-exit")
-    (gnus-summary-exit "exit-summ")
+  '((gnus-summary-prev-unread-article "gnus/prev-ur")
+    (gnus-summary-next-unread-article "gnus/next-ur")
+    (gnus-summary-post-news "gnus/post")
+    (gnus-summary-followup-with-original "gnus/fuwo")
+    (gnus-summary-followup "gnus/followup")
+    (gnus-summary-reply-with-original "gnus/reply-wo")
+    (gnus-summary-reply "gnus/reply")
+    (gnus-summary-caesar-message "gnus/rot13")
+    (gnus-uu-decode-uu "gnus/uu-decode")
+    (gnus-summary-save-article-file "gnus/save-aif")
+    (gnus-summary-save-article "gnus/save-art")
+    (gnus-uu-post-news "gnus/uu-post")
+    (gnus-summary-catchup "gnus/catchup")
+    (gnus-summary-catchup-and-exit "gnus/cu-exit")
+    (gnus-summary-exit "gnus/exit-summ")
     ;; Some new command that may need more suitable icons:
-    (gnus-summary-print-article "print" nil :visible nil)
-    (gnus-summary-mark-as-expirable "close" nil :visible nil)
-    (gnus-summary-save-newsrc "save" nil :visible nil)
-    ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil)
-    (gnus-summary-search-article-forward "search" nil :visible nil)
-    ;; (gnus-summary-insert-new-articles "paste" nil :visible nil)
-    ;; (gnus-summary-toggle-threads "open" nil :visible nil)
+    (gnus-summary-print-article "gnus/print" nil :visible nil)
+    (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil)
+    (gnus-summary-save-newsrc "gnus/save" nil :visible nil)
+    ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil)
+    (gnus-summary-search-article-forward "gnus/search" nil :visible nil)
+    ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil)
+    ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil)
     ;;
-    (gnus-info-find-node "help" nil :visible nil))
+    (gnus-info-find-node "gnus/help" nil :visible nil))
   "List of functions for the summary tool bar (retro look).
 
 See `gmm-tool-bar-from-list' for the format of the list."
@@ -2762,6 +2767,8 @@ See `gmm-tool-bar-from-list' for the format of the list."
   :set 'gnus-summary-tool-bar-update
   :group 'gnus-summary)
 
+(defvar image-load-path)
+
 (defun gnus-summary-make-tool-bar (&optional force)
   "Make a summary mode tool bar from `gnus-summary-tool-bar'.
 When FORCE, rebuild the tool bar."
@@ -2769,11 +2776,16 @@ When FORCE, rebuild the tool bar."
             (boundp 'tool-bar-mode)
             tool-bar-mode
             (or (not gnus-summary-tool-bar-map) force))
-    (let ((map (when (default-value 'tool-bar-mode)
-                (let ((load-path (mm-image-load-path)))
-                  (gmm-tool-bar-from-list gnus-summary-tool-bar
-                                              gnus-summary-tool-bar-zap-list
-                                              'gnus-summary-mode-map)))))
+    (let* ((load-path
+           (gmm-image-load-path-for-library "gnus"
+                                            "mail/save.xpm"
+                                            nil t))
+           (image-load-path (cons (car load-path)
+                                  (when (boundp 'image-load-path)
+                                    image-load-path)))
+          (map (gmm-tool-bar-from-list gnus-summary-tool-bar
+                                       gnus-summary-tool-bar-zap-list
+                                       'gnus-summary-mode-map)))
       (when map
        ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode'
        ;; uses it's value.
@@ -3290,8 +3302,11 @@ display only a single character."
     (aset table ?\r nil)
     ;; We keep TAB as well.
     (aset table ?\t nil)
-    ;; We nix out any glyphs over 126 that are not set already.
-    (let ((i 256))
+    ;; We nix out any glyphs 127 through 255, or 127 through 159 in
+    ;; Emacs 23 (unicode), that are not set already.
+    (let ((i (if (ignore-errors (= (make-char 'latin-iso8859-1 160) 160))
+                160
+              256)))
       (while (>= (setq i (1- i)) 127)
        ;; Only modify if the entry is nil.
        (unless (aref table i)
@@ -3507,7 +3522,13 @@ buffer that was in action when the last article was fetched."
                      (inline
                        (gnus-summary-extract-address-component
                         (funcall gnus-decode-encoded-word-function to)))))
-            ((setq newsgroups (cdr (assq 'Newsgroups extra-headers)))
+            ((setq newsgroups
+                   (or
+                    (cdr (assq 'Newsgroups extra-headers))
+                    (and
+                      (eq (car (gnus-find-method-for-group
+                                gnus-newsgroup-name)) 'nntp)
+                     (gnus-group-real-name gnus-newsgroup-name))))
              (concat gnus-summary-newsgroup-prefix newsgroups)))))
      (inline (gnus-summary-extract-address-component gnus-tmp-from)))))
 
@@ -6647,10 +6668,12 @@ displayed, no centering will be performed."
          (setq nlast (if (atom (cadr read)) (cadr read) (caadr read)))
          (setq read (cdr read)))))
     ;; And add the last unread articles.
-    (cond ((< first last)
-           (push (cons first last) unread))
-          ((= first last)
-           (push first unread)))
+    (cond ((not (and first last))
+          nil)
+         ((< first last)
+          (push (cons first last) unread))
+         ((= first last)
+          (push first unread)))
     ;; Return the sequence of unread articles.
     (delq 0 (nreverse unread))))
 
@@ -10891,7 +10914,9 @@ Returns nil if no thread was there to be shown."
 (defun gnus-map-articles (predicate articles)
   "Map PREDICATE over ARTICLES and return non-nil if any predicate is non-nil."
   (apply 'gnus-or (mapcar predicate
-                         (mapcar 'gnus-summary-article-header articles))))
+                         (mapcar (lambda (number)
+                                   (gnus-summary-article-header number))
+                                 articles))))
 
 (defun gnus-summary-hide-all-threads (&optional predicate)
   "Hide all thread subtrees.