diff options
| author | Reiner Steib | 2006-04-17 18:26:22 +0000 |
|---|---|---|
| committer | Reiner Steib | 2006-04-17 18:26:22 +0000 |
| commit | 18c06a99aa65121a4c09138403a7b494b7d41d37 (patch) | |
| tree | 4fa2d379f15453f644fdae208f0f9dc8509f01d0 | |
| parent | 43c50d22bc75543e5577f036fcd957162daf7086 (diff) | |
| download | emacs-18c06a99aa65121a4c09138403a7b494b7d41d37.tar.gz emacs-18c06a99aa65121a4c09138403a7b494b7d41d37.zip | |
[ Merge Gnome tool bars from Gnus trunk ]
* message.el (message-tool-bar-zap-list, message-tool-bar)
(message-tool-bar-gnome, message-tool-bar-retro): New variables.
(message-tool-bar-local-item-from-menu): Remove.
(message-tool-bar-map): Replace by `message-make-tool-bar'.
(message-make-tool-bar): New function.
(message-mode): Use `message-make-tool-bar'.
* gnus-sum.el (gnus-summary-tool-bar)
(gnus-summary-tool-bar-gnome, gnus-summary-tool-bar-retro)
(gnus-summary-tool-bar-zap-list): New variables.
(gnus-summary-make-tool-bar): Complete rewrite using
`gmm-tool-bar-from-list'.
* gnus-group.el (gnus-group-tool-bar, gnus-group-tool-bar-gnome)
(gnus-group-tool-bar-retro, gnus-group-tool-bar-zap-list): New
variables.
(gnus-group-make-tool-bar): Complete rewrite using
`gmm-tool-bar-from-list'.
(gnus-group-tool-bar-update): New function.
* gmm-utils.el: New file.
| -rw-r--r-- | lisp/gnus/ChangeLog | 24 | ||||
| -rw-r--r-- | lisp/gnus/gmm-utils.el | 413 | ||||
| -rw-r--r-- | lisp/gnus/gnus-group.el | 172 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 197 | ||||
| -rw-r--r-- | lisp/gnus/message.el | 161 |
5 files changed, 851 insertions, 116 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 991d91a1112..50a7262e1a3 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,27 @@ | |||
| 1 | 2006-04-17 Reiner Steib <Reiner.Steib@gmx.de> | ||
| 2 | |||
| 3 | * message.el (message-tool-bar-zap-list, message-tool-bar) | ||
| 4 | (message-tool-bar-gnome, message-tool-bar-retro): New variables. | ||
| 5 | (message-tool-bar-local-item-from-menu): Remove. | ||
| 6 | (message-tool-bar-map): Replace by `message-make-tool-bar'. | ||
| 7 | (message-make-tool-bar): New function. | ||
| 8 | (message-mode): Use `message-make-tool-bar'. | ||
| 9 | |||
| 10 | * gnus-sum.el (gnus-summary-tool-bar) | ||
| 11 | (gnus-summary-tool-bar-gnome, gnus-summary-tool-bar-retro) | ||
| 12 | (gnus-summary-tool-bar-zap-list): New variables. | ||
| 13 | (gnus-summary-make-tool-bar): Complete rewrite using | ||
| 14 | `gmm-tool-bar-from-list'. | ||
| 15 | |||
| 16 | * gnus-group.el (gnus-group-tool-bar, gnus-group-tool-bar-gnome) | ||
| 17 | (gnus-group-tool-bar-retro, gnus-group-tool-bar-zap-list): New | ||
| 18 | variables. | ||
| 19 | (gnus-group-make-tool-bar): Complete rewrite using | ||
| 20 | `gmm-tool-bar-from-list'. | ||
| 21 | (gnus-group-tool-bar-update): New function. | ||
| 22 | |||
| 23 | * gmm-utils.el: New file. | ||
| 24 | |||
| 1 | 2006-04-12 Ralf Angeli <angeli@iwi.uni-sb.de> | 25 | 2006-04-12 Ralf Angeli <angeli@iwi.uni-sb.de> |
| 2 | 26 | ||
| 3 | * flow-fill.el (fill-flowed): Remove trailing space from blank | 27 | * flow-fill.el (fill-flowed): Remove trailing space from blank |
diff --git a/lisp/gnus/gmm-utils.el b/lisp/gnus/gmm-utils.el new file mode 100644 index 00000000000..4db811053ec --- /dev/null +++ b/lisp/gnus/gmm-utils.el | |||
| @@ -0,0 +1,413 @@ | |||
| 1 | ;;; gmm-utils.el --- Utility functions for Gnus, Message and MML | ||
| 2 | |||
| 3 | ;; Copyright (C) 2006 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Reiner Steib <reiner.steib@gmx.de> | ||
| 6 | ;; Keywords: news | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 13 | ;; any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 22 | ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| 23 | ;; Boston, MA 02110-1301, USA. | ||
| 24 | |||
| 25 | ;;; Commentary: | ||
| 26 | |||
| 27 | ;; This library provides self-contained utility functions. The functions are | ||
| 28 | ;; used in Gnus, Message and MML, but within this library there are no | ||
| 29 | ;; dependencies on Gnus, Message, or MML or Gnus. | ||
| 30 | |||
| 31 | ;;; Code: | ||
| 32 | |||
| 33 | ;; (require 'wid-edit) | ||
| 34 | |||
| 35 | (defgroup gmm nil | ||
| 36 | "Utility functions for Gnus, Message and MML" | ||
| 37 | :prefix "gmm-" | ||
| 38 | :version "23.0" ;; No Gnus | ||
| 39 | :group 'lisp) | ||
| 40 | |||
| 41 | ;; Helper functions from `gnus-utils.el': gmm-verbose, gmm-message, gmm-error | ||
| 42 | |||
| 43 | (defcustom gmm-verbose 7 | ||
| 44 | "Integer that says how verbose gmm should be. | ||
| 45 | The higher the number, the more messages will flash to say what | ||
| 46 | it done. At zero, it will be totally mute; at five, it will | ||
| 47 | display most important messages; and at ten, it will keep on | ||
| 48 | jabbering all the time." | ||
| 49 | :type 'integer | ||
| 50 | :group 'gmm) | ||
| 51 | |||
| 52 | ;;;###autoload | ||
| 53 | (defun gmm-message (level &rest args) | ||
| 54 | "If LEVEL is lower than `gmm-verbose' print ARGS using `message'. | ||
| 55 | |||
| 56 | Guideline for numbers: | ||
| 57 | 1 - error messages, 3 - non-serious error messages, 5 - messages for things | ||
| 58 | that take a long time, 7 - not very important messages on stuff, 9 - messages | ||
| 59 | inside loops." | ||
| 60 | (if (<= level gmm-verbose) | ||
| 61 | (apply 'message args) | ||
| 62 | ;; We have to do this format thingy here even if the result isn't | ||
| 63 | ;; shown - the return value has to be the same as the return value | ||
| 64 | ;; from `message'. | ||
| 65 | (apply 'format args))) | ||
| 66 | |||
| 67 | ;;;###autoload | ||
| 68 | (defun gmm-error (level &rest args) | ||
| 69 | "Beep an error if LEVEL is equal to or less than `gmm-verbose'. | ||
| 70 | ARGS are passed to `message'." | ||
| 71 | (when (<= (floor level) gmm-verbose) | ||
| 72 | (apply 'message args) | ||
| 73 | (ding) | ||
| 74 | (let (duration) | ||
| 75 | (when (and (floatp level) | ||
| 76 | (not (zerop (setq duration (* 10 (- level (floor level))))))) | ||
| 77 | (sit-for duration)))) | ||
| 78 | nil) | ||
| 79 | |||
| 80 | ;;;###autoload | ||
| 81 | (defun gmm-widget-p (symbol) | ||
| 82 | "Non-nil iff SYMBOL is a widget." | ||
| 83 | (get symbol 'widget-type)) | ||
| 84 | |||
| 85 | ;; Copy of the `nnmail-lazy' code from `nnmail.el': | ||
| 86 | (define-widget 'gmm-lazy 'default | ||
| 87 | "Base widget for recursive datastructures. | ||
| 88 | |||
| 89 | This is copy of the `lazy' widget in Emacs 22.1 provided for compatibility." | ||
| 90 | :format "%{%t%}: %v" | ||
| 91 | :convert-widget 'widget-value-convert-widget | ||
| 92 | :value-create (lambda (widget) | ||
| 93 | (let ((value (widget-get widget :value)) | ||
| 94 | (type (widget-get widget :type))) | ||
| 95 | (widget-put widget :children | ||
| 96 | (list (widget-create-child-value | ||
| 97 | widget (widget-convert type) value))))) | ||
| 98 | :value-delete 'widget-children-value-delete | ||
| 99 | :value-get (lambda (widget) | ||
| 100 | (widget-value (car (widget-get widget :children)))) | ||
| 101 | :value-inline (lambda (widget) | ||
| 102 | (widget-apply (car (widget-get widget :children)) | ||
| 103 | :value-inline)) | ||
| 104 | :default-get (lambda (widget) | ||
| 105 | (widget-default-get | ||
| 106 | (widget-convert (widget-get widget :type)))) | ||
| 107 | :match (lambda (widget value) | ||
| 108 | (widget-apply (widget-convert (widget-get widget :type)) | ||
| 109 | :match value)) | ||
| 110 | :validate (lambda (widget) | ||
| 111 | (widget-apply (car (widget-get widget :children)) :validate))) | ||
| 112 | |||
| 113 | ;; Note: The format of `gmm-tool-bar-item' may change if some future Emacs | ||
| 114 | ;; version will provide customizable tool bar buttons using a different | ||
| 115 | ;; interface. | ||
| 116 | |||
| 117 | ;; TODO: Extend API so that the "Command" entry can be a function or a plist. | ||
| 118 | ;; In case of a list it should have the format... | ||
| 119 | ;; | ||
| 120 | ;; (:none command-without-modifier | ||
| 121 | ;; :shift command-with-shift-pressed | ||
| 122 | ;; :control command-with-ctrl-pressed | ||
| 123 | ;; :control-shift command-with-control-and-shift-pressed | ||
| 124 | ;; ;; mouse-2 and mouse-3 can't be used in Emacs yet. | ||
| 125 | ;; :mouse-2 command-on-mouse-2-press | ||
| 126 | ;; :mouse-3 command-on-mouse-3-press) ;; typically a menu of related commands | ||
| 127 | ;; | ||
| 128 | ;; Combinations of mouse-[23] plus shift and/or controll might be overkill. | ||
| 129 | ;; | ||
| 130 | ;; Then use (plist-get rs-command :none), (plist-get rs-command :shift) | ||
| 131 | |||
| 132 | (define-widget 'gmm-tool-bar-item (if (gmm-widget-p 'lazy) 'lazy 'gmm-lazy) | ||
| 133 | "Tool bar list item." | ||
| 134 | :tag "Tool bar item" | ||
| 135 | :type '(choice | ||
| 136 | (list :tag "Command and Icon" | ||
| 137 | (function :tag "Command") | ||
| 138 | (string :tag "Icon file") | ||
| 139 | (choice | ||
| 140 | (const :tag "Default map" nil) | ||
| 141 | ;; Note: Usually we need non-nil attributes if map is t. | ||
| 142 | (const :tag "No menu" t) | ||
| 143 | (sexp :tag "Other map")) | ||
| 144 | (plist :inline t :tag "Properties")) | ||
| 145 | (list :tag "Separator" | ||
| 146 | (const :tag "No command" gmm-ignore) | ||
| 147 | (string :tag "Icon file") | ||
| 148 | (const :tag "No map") | ||
| 149 | (plist :inline t :tag "Properties")))) | ||
| 150 | |||
| 151 | (define-widget 'gmm-tool-bar-zap-list (if (gmm-widget-p 'lazy) 'lazy 'gmm-lazy) | ||
| 152 | "Tool bar zap list." | ||
| 153 | :tag "Tool bar zap list" | ||
| 154 | :type '(choice (const :tag "Zap all" t) | ||
| 155 | (const :tag "Keep all" nil) | ||
| 156 | (list | ||
| 157 | ;; :value | ||
| 158 | ;; Work around (bug in customize?), see | ||
| 159 | ;; <news:v9is48jrj1.fsf@marauder.physik.uni-ulm.de> | ||
| 160 | ;; (new-file open-file dired kill-buffer write-file | ||
| 161 | ;; print-buffer customize help) | ||
| 162 | (set :inline t | ||
| 163 | (const new-file) | ||
| 164 | (const open-file) | ||
| 165 | (const dired) | ||
| 166 | (const kill-buffer) | ||
| 167 | (const save-buffer) | ||
| 168 | (const write-file) | ||
| 169 | (const undo) | ||
| 170 | (const cut) | ||
| 171 | (const copy) | ||
| 172 | (const paste) | ||
| 173 | (const search-forward) | ||
| 174 | (const print-buffer) | ||
| 175 | (const customize) | ||
| 176 | (const help)) | ||
| 177 | (repeat :inline t | ||
| 178 | :tag "Other" | ||
| 179 | (symbol :tag "Icon item"))))) | ||
| 180 | |||
| 181 | ;; (defun gmm-color-cells (&optional display) | ||
| 182 | ;; "Return the number of color cells supported by DISPLAY. | ||
| 183 | ;; Compatibility function." | ||
| 184 | ;; ;; `display-color-cells' doesn't return more than 256 even if color depth is | ||
| 185 | ;; ;; > 8 in Emacs 21. | ||
| 186 | ;; ;; | ||
| 187 | ;; ;; Feel free to add proper XEmacs support. | ||
| 188 | ;; (let* ((cells (and (fboundp 'display-color-cells) | ||
| 189 | ;; (display-color-cells display))) | ||
| 190 | ;; (plane (and (fboundp 'x-display-planes) | ||
| 191 | ;; (ash 1 (x-display-planes)))) | ||
| 192 | ;; (none -1)) | ||
| 193 | ;; (max (if (integerp cells) cells none) | ||
| 194 | ;; (if (integerp plane) plane none)))) | ||
| 195 | |||
| 196 | (defcustom gmm-tool-bar-style | ||
| 197 | (if (and (boundp 'tool-bar-mode) | ||
| 198 | tool-bar-mode | ||
| 199 | (and (fboundp 'display-visual-class) | ||
| 200 | (not (memq (display-visual-class) | ||
| 201 | (list 'static-gray 'gray-scale | ||
| 202 | 'static-color 'pseudo-color))))) | ||
| 203 | 'gnome | ||
| 204 | 'retro) | ||
| 205 | "Prefered tool bar style." | ||
| 206 | :type '(choice (const :tag "GNOME style" 'gnome) | ||
| 207 | (const :tag "Retro look" 'retro)) | ||
| 208 | :group 'gmm) | ||
| 209 | |||
| 210 | (defvar tool-bar-map) | ||
| 211 | |||
| 212 | ;;;###autoload | ||
| 213 | (defun gmm-tool-bar-from-list (icon-list zap-list default-map) | ||
| 214 | "Make a tool bar from ICON-LIST. | ||
| 215 | |||
| 216 | Within each entry of ICON-LIST, the first element is a menu | ||
| 217 | command, the second element is an icon file name and the third | ||
| 218 | element is a test function. You can use \\[describe-key] | ||
| 219 | <menu-entry> to find out the name of a menu command. The fourth | ||
| 220 | and all following elements are passed a the PROPS argument to the | ||
| 221 | function `tool-bar-local-item'. | ||
| 222 | |||
| 223 | If ZAP-LIST is a list, remove those item from the default | ||
| 224 | `tool-bar-map'. If it is t, start with a new sparse map. You | ||
| 225 | can use \\[describe-key] <icon> to find out the name of an icon | ||
| 226 | item. When \\[describe-key] <icon> shows \"<tool-bar> <new-file> | ||
| 227 | runs the command find-file\", then use `new-file' in ZAP-LIST. | ||
| 228 | |||
| 229 | DEFAULT-MAP specifies the default key map for ICON-LIST." | ||
| 230 | (let (;; For Emacs 21, we must let-bind `tool-bar-map'. In Emacs 22, we | ||
| 231 | ;; could use some other local variable. | ||
| 232 | (tool-bar-map (if (eq zap-list t) | ||
| 233 | (make-sparse-keymap) | ||
| 234 | (copy-keymap tool-bar-map)))) | ||
| 235 | (when (listp zap-list) | ||
| 236 | ;; Zap some items which aren't relevant for this mode and take up space. | ||
| 237 | (dolist (key zap-list) | ||
| 238 | (define-key tool-bar-map (vector key) nil))) | ||
| 239 | (mapc (lambda (el) | ||
| 240 | (let ((command (car el)) | ||
| 241 | (icon (nth 1 el)) | ||
| 242 | (fmap (or (nth 2 el) default-map)) | ||
| 243 | (props (cdr (cdr (cdr el)))) ) | ||
| 244 | ;; command may stem from different from-maps: | ||
| 245 | (cond ((eq command 'gmm-ignore) | ||
| 246 | ;; The dummy `gmm-ignore', see `gmm-tool-bar-item' | ||
| 247 | ;; widget. Suppress tooltip by adding `:enable nil'. | ||
| 248 | (if (fboundp 'tool-bar-local-item) | ||
| 249 | (apply 'tool-bar-local-item icon nil nil | ||
| 250 | tool-bar-map :enable nil props) | ||
| 251 | ;; (tool-bar-local-item ICON DEF KEY MAP &rest PROPS) | ||
| 252 | ;; (tool-bar-add-item ICON DEF KEY &rest PROPS) | ||
| 253 | (apply 'tool-bar-add-item icon nil nil :enable nil props))) | ||
| 254 | ((equal fmap t) ;; Not a menu command | ||
| 255 | (if (fboundp 'tool-bar-local-item) | ||
| 256 | (apply 'tool-bar-local-item | ||
| 257 | icon command | ||
| 258 | (intern icon) ;; reuse icon or fmap here? | ||
| 259 | tool-bar-map props) | ||
| 260 | ;; Emacs 21 compatibility: | ||
| 261 | (apply 'tool-bar-add-item | ||
| 262 | icon command | ||
| 263 | (intern icon) | ||
| 264 | props))) | ||
| 265 | (t ;; A menu command | ||
| 266 | (if (fboundp 'tool-bar-local-item-from-menu) | ||
| 267 | (apply 'tool-bar-local-item-from-menu | ||
| 268 | ;; (apply 'tool-bar-local-item icon def key | ||
| 269 | ;; tool-bar-map props) | ||
| 270 | command icon tool-bar-map (symbol-value fmap) | ||
| 271 | props) | ||
| 272 | ;; Emacs 21 compatibility: | ||
| 273 | (apply 'tool-bar-add-item-from-menu | ||
| 274 | command icon (symbol-value fmap) | ||
| 275 | props)))) | ||
| 276 | t)) | ||
| 277 | (if (symbolp icon-list) | ||
| 278 | (eval icon-list) | ||
| 279 | icon-list)) | ||
| 280 | tool-bar-map)) | ||
| 281 | |||
| 282 | ;; WARNING: The following is subject to change. Don't rely on it yet. | ||
| 283 | |||
| 284 | ;; From MH-E without modifications: | ||
| 285 | |||
| 286 | (defmacro gmm-defun-compat (name function arg-list &rest body) | ||
| 287 | "Create function NAME. | ||
| 288 | If FUNCTION exists, then NAME becomes an alias for FUNCTION. | ||
| 289 | Otherwise, create function NAME with ARG-LIST and BODY." | ||
| 290 | (let ((defined-p (fboundp function))) | ||
| 291 | (if defined-p | ||
| 292 | `(defalias ',name ',function) | ||
| 293 | `(defun ,name ,arg-list ,@body)))) | ||
| 294 | |||
| 295 | (gmm-defun-compat gmm-image-search-load-path | ||
| 296 | image-search-load-path (file &optional path) | ||
| 297 | "Emacs 21 and XEmacs don't have `image-search-load-path'. | ||
| 298 | This function returns nil on those systems." | ||
| 299 | nil) | ||
| 300 | |||
| 301 | ;; From MH-E with modifications: | ||
| 302 | |||
| 303 | ;; Don't use `gmm-defun-compat' until API changes in | ||
| 304 | ;; `image-load-path-for-library' in Emacs CVS are completed. | ||
| 305 | |||
| 306 | (defun gmm-image-load-path-for-library (library image &optional path no-error) | ||
| 307 | "Return a suitable search path for images relative to LIBRARY. | ||
| 308 | |||
| 309 | First it searches for IMAGE in `image-load-path' (excluding | ||
| 310 | \"`data-directory'/images\") and `load-path', followed by a path | ||
| 311 | suitable for LIBRARY, which includes \"../../etc/images\" and | ||
| 312 | \"../etc/images\" relative to the library file itself, and then | ||
| 313 | in \"`data-directory'/images\". | ||
| 314 | |||
| 315 | Then this function returns a list of directories which contains | ||
| 316 | first the directory in which IMAGE was found, followed by the | ||
| 317 | value of `load-path'. If PATH is given, it is used instead of | ||
| 318 | `load-path'. | ||
| 319 | |||
| 320 | If NO-ERROR is non-nil and a suitable path can't be found, don't | ||
| 321 | signal an error. Instead, return a list of directories as before, | ||
| 322 | except that nil appears in place of the image directory. | ||
| 323 | |||
| 324 | Here is an example that uses a common idiom to provide | ||
| 325 | compatibility with versions of Emacs that lack the variable | ||
| 326 | `image-load-path': | ||
| 327 | |||
| 328 | ;; Shush compiler. | ||
| 329 | (defvar image-load-path) | ||
| 330 | |||
| 331 | (let* ((load-path (image-load-path-for-library \"mh-e\" \"mh-logo.xpm\")) | ||
| 332 | (image-load-path (cons (car load-path) | ||
| 333 | (when (boundp 'image-load-path) | ||
| 334 | image-load-path)))) | ||
| 335 | (mh-tool-bar-folder-buttons-init))" | ||
| 336 | (unless library (error "No library specified")) | ||
| 337 | (unless image (error "No image specified")) | ||
| 338 | (let (image-directory image-directory-load-path) | ||
| 339 | ;; Check for images in image-load-path or load-path. | ||
| 340 | (let ((img image) | ||
| 341 | (dir (or | ||
| 342 | ;; Images in image-load-path. | ||
| 343 | (gmm-image-search-load-path image) ;; "gmm-" prefix! | ||
| 344 | ;; Images in load-path. | ||
| 345 | (locate-library image))) | ||
| 346 | parent) | ||
| 347 | ;; Since the image might be in a nested directory (for | ||
| 348 | ;; example, mail/attach.pbm), adjust `image-directory' | ||
| 349 | ;; accordingly. | ||
| 350 | (when dir | ||
| 351 | (setq dir (file-name-directory dir)) | ||
| 352 | (while (setq parent (file-name-directory img)) | ||
| 353 | (setq img (directory-file-name parent) | ||
| 354 | dir (expand-file-name "../" dir)))) | ||
| 355 | (setq image-directory-load-path dir)) | ||
| 356 | |||
| 357 | ;; If `image-directory-load-path' isn't Emacs' image directory, | ||
| 358 | ;; it's probably a user preference, so use it. Then use a | ||
| 359 | ;; relative setting if possible; otherwise, use | ||
| 360 | ;; `image-directory-load-path'. | ||
| 361 | (cond | ||
| 362 | ;; User-modified image-load-path? | ||
| 363 | ((and image-directory-load-path | ||
| 364 | (not (equal image-directory-load-path | ||
| 365 | (file-name-as-directory | ||
| 366 | (expand-file-name "images" data-directory))))) | ||
| 367 | (setq image-directory image-directory-load-path)) | ||
| 368 | ;; Try relative setting. | ||
| 369 | ((let (library-name d1ei d2ei) | ||
| 370 | ;; First, find library in the load-path. | ||
| 371 | (setq library-name (locate-library library)) | ||
| 372 | (if (not library-name) | ||
| 373 | (error "Cannot find library %s in load-path" library)) | ||
| 374 | ;; And then set image-directory relative to that. | ||
| 375 | (setq | ||
| 376 | ;; Go down 2 levels. | ||
| 377 | d2ei (file-name-as-directory | ||
| 378 | (expand-file-name | ||
| 379 | (concat (file-name-directory library-name) "../../etc/images"))) | ||
| 380 | ;; Go down 1 level. | ||
| 381 | d1ei (file-name-as-directory | ||
| 382 | (expand-file-name | ||
| 383 | (concat (file-name-directory library-name) "../etc/images")))) | ||
| 384 | (setq image-directory | ||
| 385 | ;; Set it to nil if image is not found. | ||
| 386 | (cond ((file-exists-p (expand-file-name image d2ei)) d2ei) | ||
| 387 | ((file-exists-p (expand-file-name image d1ei)) d1ei))))) | ||
| 388 | ;; Use Emacs' image directory. | ||
| 389 | (image-directory-load-path | ||
| 390 | (setq image-directory image-directory-load-path)) | ||
| 391 | (no-error | ||
| 392 | (message "Could not find image %s for library %s" image library)) | ||
| 393 | (t | ||
| 394 | (error "Could not find image %s for library %s" image library))) | ||
| 395 | |||
| 396 | ;; Return an augmented `path' or `load-path'. | ||
| 397 | (nconc (list image-directory) | ||
| 398 | (delete image-directory (copy-sequence (or path load-path)))))) | ||
| 399 | |||
| 400 | (defun gmm-customize-mode (&optional mode) | ||
| 401 | "Customize customization group for MODE. | ||
| 402 | If mode is nil, use `major-mode' of the curent buffer." | ||
| 403 | (interactive) | ||
| 404 | (customize-group | ||
| 405 | (or mode | ||
| 406 | (intern (let ((mode (symbol-name major-mode))) | ||
| 407 | (string-match "^\\(.+\\)-mode$" mode) | ||
| 408 | (match-string 1 mode)))))) | ||
| 409 | |||
| 410 | (provide 'gmm-utils) | ||
| 411 | |||
| 412 | ;; arch-tag: e0b60920-2ce6-40c1-bfc0-cadbbe26b602 | ||
| 413 | ;;; gmm-utils.el ends here | ||
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 24e4df14712..b47839bad4a 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | (require 'gnus-range) | 39 | (require 'gnus-range) |
| 40 | (require 'gnus-win) | 40 | (require 'gnus-win) |
| 41 | (require 'gnus-undo) | 41 | (require 'gnus-undo) |
| 42 | (require 'gmm-utils) | ||
| 42 | (require 'time-date) | 43 | (require 'time-date) |
| 43 | (require 'gnus-ems) | 44 | (require 'gnus-ems) |
| 44 | 45 | ||
| @@ -979,36 +980,135 @@ simple manner.") | |||
| 979 | 980 | ||
| 980 | (gnus-run-hooks 'gnus-group-menu-hook))) | 981 | (gnus-run-hooks 'gnus-group-menu-hook))) |
| 981 | 982 | ||
| 982 | (defvar gnus-group-toolbar-map nil) | 983 | |
| 983 | 984 | (defvar gnus-group-tool-bar-map nil) | |
| 984 | ;; Emacs 21 tool bar. Should be no-op otherwise. | 985 | |
| 985 | (defun gnus-group-make-tool-bar () | 986 | (defun gnus-group-tool-bar-update (&optional symbol value) |
| 986 | (if (and | 987 | "Update group buffer toolbar. |
| 987 | (condition-case nil (require 'tool-bar) (error nil)) | 988 | Setter function for custom variables." |
| 988 | (fboundp 'tool-bar-add-item-from-menu) | 989 | (when symbol |
| 989 | (default-value 'tool-bar-mode) | 990 | (set-default symbol value)) |
| 990 | (not gnus-group-toolbar-map)) | 991 | ;; (setq-default gnus-group-tool-bar-map nil) |
| 991 | (setq gnus-group-toolbar-map | 992 | ;; (use-local-map gnus-group-mode-map) |
| 992 | (let ((tool-bar-map (make-sparse-keymap)) | 993 | (when (gnus-alive-p) |
| 993 | (load-path (mm-image-load-path))) | 994 | (with-current-buffer gnus-group-buffer |
| 994 | (tool-bar-add-item-from-menu | 995 | (gnus-group-make-tool-bar t)))) |
| 995 | 'gnus-group-get-new-news "get-news" gnus-group-mode-map) | 996 | |
| 996 | (tool-bar-add-item-from-menu | 997 | (defcustom gnus-group-tool-bar (if (eq gmm-tool-bar-style 'gnome) |
| 997 | 'gnus-group-get-new-news-this-group "gnntg" gnus-group-mode-map) | 998 | 'gnus-group-tool-bar-gnome |
| 998 | (tool-bar-add-item-from-menu | 999 | 'gnus-group-tool-bar-retro) |
| 999 | 'gnus-group-catchup-current "catchup" gnus-group-mode-map) | 1000 | "Specifies the Gnus group tool bar. |
| 1000 | (tool-bar-add-item-from-menu | 1001 | |
| 1001 | 'gnus-group-describe-group "describe-group" gnus-group-mode-map) | 1002 | It can be either a list or a symbol refering to a list. See |
| 1002 | (tool-bar-add-item "subscribe" 'gnus-group-subscribe 'subscribe | 1003 | `gmm-tool-bar-from-list' for the format of the list. The |
| 1003 | :help "Subscribe to the current group") | 1004 | default key map is `gnus-group-mode-map'. |
| 1004 | (tool-bar-add-item "unsubscribe" 'gnus-group-unsubscribe | 1005 | |
| 1005 | 'unsubscribe | 1006 | Pre-defined symbols include `gnus-group-tool-bar-gnome' and |
| 1006 | :help "Unsubscribe from the current group") | 1007 | `gnus-group-tool-bar-retro'." |
| 1007 | (tool-bar-add-item-from-menu | 1008 | :type '(choice (const :tag "GNOME style" gnus-group-tool-bar-gnome) |
| 1008 | 'gnus-group-exit "exit-gnus" gnus-group-mode-map) | 1009 | (const :tag "Retro look" gnus-group-tool-bar-retro) |
| 1009 | tool-bar-map))) | 1010 | (repeat :tag "User defined list" gmm-tool-bar-item) |
| 1010 | (if gnus-group-toolbar-map | 1011 | (symbol)) |
| 1011 | (set (make-local-variable 'tool-bar-map) gnus-group-toolbar-map))) | 1012 | :version "23.0" ;; No Gnus |
| 1013 | :initialize 'custom-initialize-default | ||
| 1014 | :set 'gnus-group-tool-bar-update | ||
| 1015 | :group 'gnus-group) | ||
| 1016 | |||
| 1017 | (defcustom gnus-group-tool-bar-gnome | ||
| 1018 | '((gnus-group-post-news "mail/compose") | ||
| 1019 | ;; Some useful agent icons? I don't use the agent so agent users should | ||
| 1020 | ;; suggest useful commands: | ||
| 1021 | (gnus-agent-toggle-plugged "connect" t | ||
| 1022 | :visible (and gnus-agent (not gnus-plugged))) | ||
| 1023 | (gnus-agent-toggle-plugged "disconnect" t | ||
| 1024 | :visible (and gnus-agent gnus-plugged)) | ||
| 1025 | ;; FIXME: gnus-agent-toggle-plugged (in gnus-agent-group-make-menu-bar) | ||
| 1026 | ;; should have a better help text. | ||
| 1027 | (gnus-group-send-queue "mail/outbox" t | ||
| 1028 | :visible (and gnus-agent gnus-plugged) | ||
| 1029 | :help "Send articles from the queue group") | ||
| 1030 | (gnus-group-get-new-news "mail/inbox" nil | ||
| 1031 | :visible (or (not gnus-agent) | ||
| 1032 | gnus-plugged)) | ||
| 1033 | ;; FIXME: gnus-*-read-group should have a better help text. | ||
| 1034 | (gnus-topic-read-group "open" nil | ||
| 1035 | :visible (and (boundp 'gnus-topic-mode) | ||
| 1036 | gnus-topic-mode)) | ||
| 1037 | (gnus-group-read-group "open" nil | ||
| 1038 | :visible (not (and (boundp 'gnus-topic-mode) | ||
| 1039 | gnus-topic-mode))) | ||
| 1040 | ;; (gnus-group-find-new-groups "???" nil) | ||
| 1041 | (gnus-group-save-newsrc "save") | ||
| 1042 | (gnus-group-describe-group "describe") | ||
| 1043 | (gnus-group-unsubscribe-current-group "gnus/toggle-subscription") | ||
| 1044 | (gnus-group-prev-unread-group "left-arrow") | ||
| 1045 | (gnus-group-next-unread-group "right-arrow") | ||
| 1046 | (gnus-group-exit "exit") | ||
| 1047 | (gmm-customize-mode "preferences" t :help "Edit mode preferences") | ||
| 1048 | (gnus-info-find-node "help")) | ||
| 1049 | "List of functions for the group tool bar (GNOME style). | ||
| 1050 | |||
| 1051 | See `gmm-tool-bar-from-list' for the format of the list." | ||
| 1052 | :type '(repeat gmm-tool-bar-item) | ||
| 1053 | :version "23.0" ;; No Gnus | ||
| 1054 | :initialize 'custom-initialize-default | ||
| 1055 | :set 'gnus-group-tool-bar-update | ||
| 1056 | :group 'gnus-group) | ||
| 1057 | |||
| 1058 | (defcustom gnus-group-tool-bar-retro | ||
| 1059 | '((gnus-group-get-new-news "gnus/get-news") | ||
| 1060 | (gnus-group-get-new-news-this-group "gnus/gnntg") | ||
| 1061 | (gnus-group-catchup-current "gnus/catchup") | ||
| 1062 | (gnus-group-describe-group "gnus/describe-group") | ||
| 1063 | (gnus-group-subscribe "gnus/subscribe" t | ||
| 1064 | :help "Subscribe to the current group") | ||
| 1065 | (gnus-group-unsubscribe "gnus/unsubscribe" t | ||
| 1066 | :help "Unsubscribe from the current group") | ||
| 1067 | (gnus-group-exit "gnus/exit-gnus" gnus-group-mode-map)) | ||
| 1068 | "List of functions for the group tool bar (retro look). | ||
| 1069 | |||
| 1070 | See `gmm-tool-bar-from-list' for the format of the list." | ||
| 1071 | :type '(repeat gmm-tool-bar-item) | ||
| 1072 | :version "23.0" ;; No Gnus | ||
| 1073 | :initialize 'custom-initialize-default | ||
| 1074 | :set 'gnus-group-tool-bar-update | ||
| 1075 | :group 'gnus-group) | ||
| 1076 | |||
| 1077 | (defcustom gnus-group-tool-bar-zap-list t | ||
| 1078 | "List of icon items from the global tool bar. | ||
| 1079 | These items are not displayed in the Gnus group mode tool bar. | ||
| 1080 | |||
| 1081 | See `gmm-tool-bar-from-list' for the format of the list." | ||
| 1082 | :type 'gmm-tool-bar-zap-list | ||
| 1083 | :version "23.0" ;; No Gnus | ||
| 1084 | :initialize 'custom-initialize-default | ||
| 1085 | :set 'gnus-group-tool-bar-update | ||
| 1086 | :group 'gnus-group) | ||
| 1087 | |||
| 1088 | (defvar image-load-path) | ||
| 1089 | |||
| 1090 | (defun gnus-group-make-tool-bar (&optional force) | ||
| 1091 | "Make a group mode tool bar from `gnus-group-tool-bar'. | ||
| 1092 | When FORCE, rebuild the tool bar." | ||
| 1093 | (when (and (not (featurep 'xemacs)) | ||
| 1094 | (boundp 'tool-bar-mode) | ||
| 1095 | tool-bar-mode | ||
| 1096 | ;; The Gnus 5.10.6 code checked (default-value 'tool-bar-mode). | ||
| 1097 | ;; Why? --rsteib | ||
| 1098 | (or (not gnus-group-tool-bar-map) force)) | ||
| 1099 | (let* ((load-path | ||
| 1100 | (gmm-image-load-path-for-library "gnus" | ||
| 1101 | "gnus/toggle-subscription.xpm" | ||
| 1102 | nil t)) | ||
| 1103 | (image-load-path (cons (car load-path) | ||
| 1104 | (when (boundp 'image-load-path) | ||
| 1105 | image-load-path))) | ||
| 1106 | (map (gmm-tool-bar-from-list gnus-group-tool-bar | ||
| 1107 | gnus-group-tool-bar-zap-list | ||
| 1108 | 'gnus-group-mode-map))) | ||
| 1109 | (if map | ||
| 1110 | (set (make-local-variable 'tool-bar-map) map)))) | ||
| 1111 | gnus-group-tool-bar-map) | ||
| 1012 | 1112 | ||
| 1013 | (defun gnus-group-mode () | 1113 | (defun gnus-group-mode () |
| 1014 | "Major mode for reading news. | 1114 | "Major mode for reading news. |
| @@ -1379,6 +1479,18 @@ if it is a string, only list groups matching REGEXP." | |||
| 1379 | (gnus-range-difference (list active) (gnus-info-read info)) | 1479 | (gnus-range-difference (list active) (gnus-info-read info)) |
| 1380 | seen)))))) | 1480 | seen)))))) |
| 1381 | 1481 | ||
| 1482 | ;; Moving through the Group buffer (in topic mode) e.g. with C-n doesn't | ||
| 1483 | ;; update the state (enabled/disabled) of the icon | ||
| 1484 | ;; `gnus-group-describe-group'. After `C-l' the state is correct. See the | ||
| 1485 | ;; following report on emacs-devel | ||
| 1486 | ;; <http://thread.gmane.org/v9acdmrcse.fsf@marauder.physik.uni-ulm.de>: | ||
| 1487 | |||
| 1488 | ;; From: Reiner Steib | ||
| 1489 | ;; Subject: tool bar icons not updated according to :active condition | ||
| 1490 | ;; Newsgroups: gmane.emacs.devel | ||
| 1491 | ;; Date: Mon, 23 Jan 2006 19:59:13 +0100 | ||
| 1492 | ;; Message-ID: <v9acdmrcse.fsf@marauder.physik.uni-ulm.de> | ||
| 1493 | |||
| 1382 | (defcustom gnus-group-update-tool-bar | 1494 | (defcustom gnus-group-update-tool-bar |
| 1383 | (and (not (featurep 'xemacs)) | 1495 | (and (not (featurep 'xemacs)) |
| 1384 | (boundp 'tool-bar-mode) | 1496 | (boundp 'tool-bar-mode) |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index bea7cb2445e..9873c766758 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | (require 'gnus-int) | 38 | (require 'gnus-int) |
| 39 | (require 'gnus-undo) | 39 | (require 'gnus-undo) |
| 40 | (require 'gnus-util) | 40 | (require 'gnus-util) |
| 41 | (require 'gmm-utils) | ||
| 41 | (require 'mm-decode) | 42 | (require 'mm-decode) |
| 42 | (require 'nnoo) | 43 | (require 'nnoo) |
| 43 | 44 | ||
| @@ -2546,47 +2547,161 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs)))) | |||
| 2546 | 2547 | ||
| 2547 | (defvar gnus-summary-tool-bar-map nil) | 2548 | (defvar gnus-summary-tool-bar-map nil) |
| 2548 | 2549 | ||
| 2549 | ;; Emacs 21 tool bar. Should be no-op otherwise. | 2550 | ;; Note: The :set function in the `gnus-summary-tool-bar*' variables will only |
| 2550 | (defun gnus-summary-make-tool-bar () | 2551 | ;; affect _new_ message buffers. We might add a function that walks thru all |
| 2551 | (if (and (fboundp 'tool-bar-add-item-from-menu) | 2552 | ;; summary-mode buffers and force the update. |
| 2552 | (default-value 'tool-bar-mode) | 2553 | (defun gnus-summary-tool-bar-update (&optional symbol value) |
| 2553 | (not gnus-summary-tool-bar-map)) | 2554 | "Update summary mode toolbar. |
| 2554 | (setq gnus-summary-tool-bar-map | 2555 | Setter function for custom variables." |
| 2555 | (let ((tool-bar-map (make-sparse-keymap)) | 2556 | (setq-default gnus-summary-tool-bar-map nil) |
| 2556 | (load-path (mm-image-load-path))) | 2557 | (when symbol |
| 2557 | (tool-bar-add-item-from-menu | 2558 | ;; When used as ":set" function: |
| 2558 | 'gnus-summary-prev-unread "prev-ur" gnus-summary-mode-map) | 2559 | (set-default symbol value)) |
| 2559 | (tool-bar-add-item-from-menu | 2560 | (when (gnus-buffer-live-p gnus-summary-buffer) |
| 2560 | 'gnus-summary-next-unread "next-ur" gnus-summary-mode-map) | 2561 | (with-current-buffer gnus-summary-buffer |
| 2561 | (tool-bar-add-item-from-menu | 2562 | (gnus-summary-make-tool-bar)))) |
| 2562 | 'gnus-summary-post-news "post" gnus-summary-mode-map) | 2563 | |
| 2563 | (tool-bar-add-item-from-menu | 2564 | (defcustom gnus-summary-tool-bar (if (eq gmm-tool-bar-style 'gnome) |
| 2564 | 'gnus-summary-followup-with-original "fuwo" gnus-summary-mode-map) | 2565 | 'gnus-summary-tool-bar-gnome |
| 2565 | (tool-bar-add-item-from-menu | 2566 | 'gnus-summary-tool-bar-retro) |
| 2566 | 'gnus-summary-followup "followup" gnus-summary-mode-map) | 2567 | "Specifies the Gnus summary tool bar. |
| 2567 | (tool-bar-add-item-from-menu | 2568 | |
| 2568 | 'gnus-summary-reply-with-original "reply-wo" gnus-summary-mode-map) | 2569 | It can be either a list or a symbol refering to a list. See |
| 2569 | (tool-bar-add-item-from-menu | 2570 | `gmm-tool-bar-from-list' for the format of the list. The |
| 2570 | 'gnus-summary-reply "reply" gnus-summary-mode-map) | 2571 | default key map is `gnus-summary-mode-map'. |
| 2571 | (tool-bar-add-item-from-menu | 2572 | |
| 2572 | 'gnus-summary-caesar-message "rot13" gnus-summary-mode-map) | 2573 | Pre-defined symbols include `gnus-summary-tool-bar-gnome' and |
| 2573 | (tool-bar-add-item-from-menu | 2574 | `gnus-summary-tool-bar-retro'." |
| 2574 | 'gnus-uu-decode-uu "uu-decode" gnus-summary-mode-map) | 2575 | :type '(choice (const :tag "GNOME style" gnus-summary-tool-bar-gnome) |
| 2575 | (tool-bar-add-item-from-menu | 2576 | (const :tag "Retro look" gnus-summary-tool-bar-retro) |
| 2576 | 'gnus-summary-save-article-file "save-aif" gnus-summary-mode-map) | 2577 | (repeat :tag "User defined list" gmm-tool-bar-item) |
| 2577 | (tool-bar-add-item-from-menu | 2578 | (symbol)) |
| 2578 | 'gnus-summary-save-article "save-art" gnus-summary-mode-map) | 2579 | :version "23.0" ;; No Gnus |
| 2579 | (tool-bar-add-item-from-menu | 2580 | :initialize 'custom-initialize-default |
| 2580 | 'gnus-uu-post-news "uu-post" gnus-summary-mode-map) | 2581 | :set 'gnus-summary-tool-bar-update |
| 2581 | (tool-bar-add-item-from-menu | 2582 | :group 'gnus-summary) |
| 2582 | 'gnus-summary-catchup "catchup" gnus-summary-mode-map) | 2583 | |
| 2583 | (tool-bar-add-item-from-menu | 2584 | (defcustom gnus-summary-tool-bar-gnome |
| 2584 | 'gnus-summary-catchup-and-exit "cu-exit" gnus-summary-mode-map) | 2585 | '((gnus-summary-post-news "mail/compose" nil) |
| 2585 | (tool-bar-add-item-from-menu | 2586 | (gnus-summary-insert-new-articles "mail/inbox" nil |
| 2586 | 'gnus-summary-exit "exit-summ" gnus-summary-mode-map) | 2587 | :visible (or (not gnus-agent) |
| 2587 | tool-bar-map))) | 2588 | gnus-plugged)) |
| 2588 | (if gnus-summary-tool-bar-map | 2589 | (gnus-summary-reply-with-original "mail/reply") |
| 2589 | (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map))) | 2590 | (gnus-summary-reply "mail/reply" nil :visible nil) |
| 2591 | (gnus-summary-followup-with-original "mail/reply-all") | ||
| 2592 | (gnus-summary-followup "mail/reply-all" nil :visible nil) | ||
| 2593 | (gnus-summary-mail-forward "mail/forward") | ||
| 2594 | (gnus-summary-save-article "mail/save") | ||
| 2595 | (gnus-summary-search-article-forward "search" nil :visible nil) | ||
| 2596 | (gnus-summary-print-article "print") | ||
| 2597 | (gnus-summary-tick-article-forward "flag-followup" nil :visible nil) | ||
| 2598 | ;; Some new commands that may need more suitable icons: | ||
| 2599 | (gnus-summary-save-newsrc "save" nil :visible nil) | ||
| 2600 | ;; (gnus-summary-show-article "stock_message-display" nil :visible nil) | ||
| 2601 | (gnus-summary-prev-article "left-arrow") | ||
| 2602 | (gnus-summary-next-article "right-arrow") | ||
| 2603 | (gnus-summary-next-page "next-page") | ||
| 2604 | ;; (gnus-summary-enter-digest-group "right_arrow" nil :visible nil) | ||
| 2605 | ;; | ||
| 2606 | ;; Maybe some sort-by-... could be added: | ||
| 2607 | ;; (gnus-summary-sort-by-author "sort-a-z" nil :visible nil) | ||
| 2608 | ;; (gnus-summary-sort-by-date "sort-1-9" nil :visible nil) | ||
| 2609 | (gnus-summary-mark-as-expirable | ||
| 2610 | "delete" nil | ||
| 2611 | :visible (gnus-check-backend-function 'request-expire-articles | ||
| 2612 | gnus-newsgroup-name)) | ||
| 2613 | (gnus-summary-mark-as-spam | ||
| 2614 | "mail/spam" t | ||
| 2615 | :visible (and (fboundp 'spam-group-ham-contents-p) | ||
| 2616 | (spam-group-ham-contents-p gnus-newsgroup-name)) | ||
| 2617 | :help "Mark as spam") | ||
| 2618 | (gnus-summary-mark-as-read-forward | ||
| 2619 | "mail/not-spam" nil | ||
| 2620 | :visible (and (fboundp 'spam-group-spam-contents-p) | ||
| 2621 | (spam-group-spam-contents-p gnus-newsgroup-name))) | ||
| 2622 | ;; | ||
| 2623 | (gnus-summary-exit "exit") | ||
| 2624 | (gmm-customize-mode "preferences" t :help "Edit mode preferences") | ||
| 2625 | (gnus-info-find-node "help")) | ||
| 2626 | "List of functions for the summary tool bar (GNOME style). | ||
| 2627 | |||
| 2628 | See `gmm-tool-bar-from-list' for the format of the list." | ||
| 2629 | :type '(repeat gmm-tool-bar-item) | ||
| 2630 | :version "23.0" ;; No Gnus | ||
| 2631 | :initialize 'custom-initialize-default | ||
| 2632 | :set 'gnus-summary-tool-bar-update | ||
| 2633 | :group 'gnus-summary) | ||
| 2634 | |||
| 2635 | (defcustom gnus-summary-tool-bar-retro | ||
| 2636 | '((gnus-summary-prev-unread-article "gnus/prev-ur") | ||
| 2637 | (gnus-summary-next-unread-article "gnus/next-ur") | ||
| 2638 | (gnus-summary-post-news "gnus/post") | ||
| 2639 | (gnus-summary-followup-with-original "gnus/fuwo") | ||
| 2640 | (gnus-summary-followup "gnus/followup") | ||
| 2641 | (gnus-summary-reply-with-original "gnus/reply-wo") | ||
| 2642 | (gnus-summary-reply "gnus/reply") | ||
| 2643 | (gnus-summary-caesar-message "gnus/rot13") | ||
| 2644 | (gnus-uu-decode-uu "gnus/uu-decode") | ||
| 2645 | (gnus-summary-save-article-file "gnus/save-aif") | ||
| 2646 | (gnus-summary-save-article "gnus/save-art") | ||
| 2647 | (gnus-uu-post-news "gnus/uu-post") | ||
| 2648 | (gnus-summary-catchup "gnus/catchup") | ||
| 2649 | (gnus-summary-catchup-and-exit "gnus/cu-exit") | ||
| 2650 | (gnus-summary-exit "gnus/exit-summ") | ||
| 2651 | ;; Some new command that may need more suitable icons: | ||
| 2652 | (gnus-summary-print-article "gnus/print" nil :visible nil) | ||
| 2653 | (gnus-summary-mark-as-expirable "gnus/close" nil :visible nil) | ||
| 2654 | (gnus-summary-save-newsrc "gnus/save" nil :visible nil) | ||
| 2655 | ;; (gnus-summary-enter-digest-group "gnus/right_arrow" nil :visible nil) | ||
| 2656 | (gnus-summary-search-article-forward "gnus/search" nil :visible nil) | ||
| 2657 | ;; (gnus-summary-insert-new-articles "gnus/paste" nil :visible nil) | ||
| 2658 | ;; (gnus-summary-toggle-threads "gnus/open" nil :visible nil) | ||
| 2659 | ;; | ||
| 2660 | (gnus-info-find-node "gnus/help" nil :visible nil)) | ||
| 2661 | "List of functions for the summary tool bar (retro look). | ||
| 2662 | |||
| 2663 | See `gmm-tool-bar-from-list' for the format of the list." | ||
| 2664 | :type '(repeat gmm-tool-bar-item) | ||
| 2665 | :version "23.0" ;; No Gnus | ||
| 2666 | :initialize 'custom-initialize-default | ||
| 2667 | :set 'gnus-summary-tool-bar-update | ||
| 2668 | :group 'gnus-summary) | ||
| 2669 | |||
| 2670 | (defcustom gnus-summary-tool-bar-zap-list t | ||
| 2671 | "List of icon items from the global tool bar. | ||
| 2672 | These items are not displayed in the Gnus summary mode tool bar. | ||
| 2673 | |||
| 2674 | See `gmm-tool-bar-from-list' for the format of the list." | ||
| 2675 | :type 'gmm-tool-bar-zap-list | ||
| 2676 | :version "23.0" ;; No Gnus | ||
| 2677 | :initialize 'custom-initialize-default | ||
| 2678 | :set 'gnus-summary-tool-bar-update | ||
| 2679 | :group 'gnus-summary) | ||
| 2680 | |||
| 2681 | (defvar image-load-path) | ||
| 2682 | |||
| 2683 | (defun gnus-summary-make-tool-bar (&optional force) | ||
| 2684 | "Make a summary mode tool bar from `gnus-summary-tool-bar'. | ||
| 2685 | When FORCE, rebuild the tool bar." | ||
| 2686 | (when (and (not (featurep 'xemacs)) | ||
| 2687 | (boundp 'tool-bar-mode) | ||
| 2688 | tool-bar-mode | ||
| 2689 | (or (not gnus-summary-tool-bar-map) force)) | ||
| 2690 | (let* ((load-path | ||
| 2691 | (gmm-image-load-path-for-library "gnus" | ||
| 2692 | "mail/save.xpm" | ||
| 2693 | nil t)) | ||
| 2694 | (image-load-path (cons (car load-path) | ||
| 2695 | (when (boundp 'image-load-path) | ||
| 2696 | image-load-path))) | ||
| 2697 | (map (gmm-tool-bar-from-list gnus-summary-tool-bar | ||
| 2698 | gnus-summary-tool-bar-zap-list | ||
| 2699 | 'gnus-summary-mode-map))) | ||
| 2700 | (when map | ||
| 2701 | ;; Need to set `gnus-summary-tool-bar-map' because `gnus-article-mode' | ||
| 2702 | ;; uses it's value. | ||
| 2703 | (setq gnus-summary-tool-bar-map map)))) | ||
| 2704 | (set (make-local-variable 'tool-bar-map) gnus-summary-tool-bar-map)) | ||
| 2590 | 2705 | ||
| 2591 | (defun gnus-score-set-default (var value) | 2706 | (defun gnus-score-set-default (var value) |
| 2592 | "A version of set that updates the GNU Emacs menu-bar." | 2707 | "A version of set that updates the GNU Emacs menu-bar." |
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 741b193f779..472eb2468dd 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | (defvar gnus-list-identifiers)) ; gnus-sum is required where necessary | 37 | (defvar gnus-list-identifiers)) ; gnus-sum is required where necessary |
| 38 | (require 'canlock) | 38 | (require 'canlock) |
| 39 | (require 'mailheader) | 39 | (require 'mailheader) |
| 40 | (require 'gmm-utils) | ||
| 40 | (require 'nnheader) | 41 | (require 'nnheader) |
| 41 | ;; This is apparently necessary even though things are autoloaded. | 42 | ;; This is apparently necessary even though things are autoloaded. |
| 42 | ;; Because we dynamically bind mail-abbrev-mode-regexp, we'd better | 43 | ;; Because we dynamically bind mail-abbrev-mode-regexp, we'd better |
| @@ -2529,7 +2530,7 @@ M-RET `message-newline-and-reformat' (break the line and reformat)." | |||
| 2529 | (set (make-local-variable 'font-lock-defaults) | 2530 | (set (make-local-variable 'font-lock-defaults) |
| 2530 | '(message-font-lock-keywords t)) | 2531 | '(message-font-lock-keywords t)) |
| 2531 | (if (boundp 'tool-bar-map) | 2532 | (if (boundp 'tool-bar-map) |
| 2532 | (set (make-local-variable 'tool-bar-map) (message-tool-bar-map)))) | 2533 | (set (make-local-variable 'tool-bar-map) (message-make-tool-bar)))) |
| 2533 | (easy-menu-add message-mode-menu message-mode-map) | 2534 | (easy-menu-add message-mode-menu message-mode-map) |
| 2534 | (easy-menu-add message-mode-field-menu message-mode-map) | 2535 | (easy-menu-add message-mode-field-menu message-mode-map) |
| 2535 | (gnus-make-local-hook 'after-change-functions) | 2536 | (gnus-make-local-hook 'after-change-functions) |
| @@ -6586,53 +6587,123 @@ which specify the range to operate on." | |||
| 6586 | 6587 | ||
| 6587 | ;; Support for toolbar | 6588 | ;; Support for toolbar |
| 6588 | (eval-when-compile | 6589 | (eval-when-compile |
| 6589 | (defvar tool-bar-map) | ||
| 6590 | (defvar tool-bar-mode)) | 6590 | (defvar tool-bar-mode)) |
| 6591 | 6591 | ||
| 6592 | (defun message-tool-bar-local-item-from-menu (command icon in-map &optional from-map &rest props) | 6592 | ;; Note: The :set function in the `message-tool-bar*' variables will only |
| 6593 | ;; We need to make tool bar entries in local keymaps with | 6593 | ;; affect _new_ message buffers. We might add a function that walks thru all |
| 6594 | ;; `tool-bar-local-item-from-menu' in Emacs >= 22 | 6594 | ;; message-mode buffers and force the update. |
| 6595 | (if (fboundp 'tool-bar-local-item-from-menu) | 6595 | (defun message-tool-bar-update (&optional symbol value) |
| 6596 | (tool-bar-local-item-from-menu command icon in-map from-map props) | 6596 | "Update message mode toolbar. |
| 6597 | (tool-bar-add-item-from-menu command icon from-map props))) | 6597 | Setter function for custom variables." |
| 6598 | 6598 | (setq-default message-tool-bar-map nil) | |
| 6599 | (defun message-tool-bar-map () | 6599 | (when symbol |
| 6600 | (or message-tool-bar-map | 6600 | ;; When used as ":set" function: |
| 6601 | (setq message-tool-bar-map | 6601 | (set-default symbol value))) |
| 6602 | (and | 6602 | |
| 6603 | (condition-case nil (require 'tool-bar) (error nil)) | 6603 | (defcustom message-tool-bar (if (eq gmm-tool-bar-style 'gnome) |
| 6604 | (fboundp 'tool-bar-add-item-from-menu) | 6604 | 'message-tool-bar-gnome |
| 6605 | 'message-tool-bar-retro) | ||
| 6606 | "Specifies the message mode tool bar. | ||
| 6607 | |||
| 6608 | It can be either a list or a symbol refering to a list. See | ||
| 6609 | `gmm-tool-bar-from-list' for the format of the list. The | ||
| 6610 | default key map is `message-mode-map'. | ||
| 6611 | |||
| 6612 | Pre-defined symbols include `message-tool-bar-gnome' and | ||
| 6613 | `message-tool-bar-retro'." | ||
| 6614 | :type '(repeat gmm-tool-bar-list-item) | ||
| 6615 | :type '(choice (const :tag "GNOME style" message-tool-bar-gnome) | ||
| 6616 | (const :tag "Retro look" message-tool-bar-retro) | ||
| 6617 | (repeat :tag "User defined list" gmm-tool-bar-item) | ||
| 6618 | (symbol)) | ||
| 6619 | :version "22.1" ;; Gnus 5.10.9 | ||
| 6620 | :initialize 'custom-initialize-default | ||
| 6621 | :set 'message-tool-bar-update | ||
| 6622 | :group 'message) | ||
| 6623 | |||
| 6624 | (defcustom message-tool-bar-gnome | ||
| 6625 | '((ispell-message "spell" nil | ||
| 6626 | :visible (or (not (boundp 'flyspell-mode)) | ||
| 6627 | (not flyspell-mode))) | ||
| 6628 | (flyspell-buffer "spell" t | ||
| 6629 | :visible (and (boundp 'flyspell-mode) | ||
| 6630 | flyspell-mode) | ||
| 6631 | :help "Flyspell whole buffer") | ||
| 6632 | (gmm-ignore "separator") | ||
| 6633 | (message-send-and-exit "mail/send") | ||
| 6634 | (message-dont-send "mail/save-draft") | ||
| 6635 | (message-kill-buffer "close") ;; stock_cancel | ||
| 6636 | (mml-attach-file "attach" mml-mode-map) | ||
| 6637 | (mml-preview "mail/preview" mml-mode-map) | ||
| 6638 | ;; (mml-secure-message-sign-encrypt "lock" mml-mode-map :visible nil) | ||
| 6639 | (message-insert-importance-high "important" nil :visible nil) | ||
| 6640 | (message-insert-importance-low "unimportant" nil :visible nil) | ||
| 6641 | (message-insert-disposition-notification-to "receipt" nil :visible nil) | ||
| 6642 | (gmm-customize-mode "preferences" t :help "Edit mode preferences") | ||
| 6643 | (message-info "help" t :help "Message manual")) | ||
| 6644 | "List of items for the message tool bar (GNOME style). | ||
| 6645 | |||
| 6646 | See `gmm-tool-bar-from-list' for details on the format of the list." | ||
| 6647 | :type '(repeat gmm-tool-bar-item) | ||
| 6648 | :version "22.1" ;; Gnus 5.10.9 | ||
| 6649 | :initialize 'custom-initialize-default | ||
| 6650 | :set 'message-tool-bar-update | ||
| 6651 | :group 'message) | ||
| 6652 | |||
| 6653 | (defcustom message-tool-bar-retro | ||
| 6654 | '(;; Old Emacs 21 icon for consistency. | ||
| 6655 | (message-send-and-exit "gnus/mail_send") | ||
| 6656 | (message-kill-buffer "close") | ||
| 6657 | (message-dont-send "cancel") | ||
| 6658 | (mml-attach-file "attach" mml-mode-map) | ||
| 6659 | (ispell-message "spell") | ||
| 6660 | (mml-preview "preview" mml-mode-map) | ||
| 6661 | (message-insert-importance-high "gnus/important") | ||
| 6662 | (message-insert-importance-low "gnus/unimportant") | ||
| 6663 | (message-insert-disposition-notification-to "gnus/receipt")) | ||
| 6664 | "List of items for the message tool bar (retro style). | ||
| 6665 | |||
| 6666 | See `gmm-tool-bar-from-list' for details on the format of the list." | ||
| 6667 | :type '(repeat gmm-tool-bar-item) | ||
| 6668 | :version "22.1" ;; Gnus 5.10.9 | ||
| 6669 | :initialize 'custom-initialize-default | ||
| 6670 | :set 'message-tool-bar-update | ||
| 6671 | :group 'message) | ||
| 6672 | |||
| 6673 | (defcustom message-tool-bar-zap-list | ||
| 6674 | '(new-file open-file dired kill-buffer write-file | ||
| 6675 | print-buffer customize help) | ||
| 6676 | "List of icon items from the global tool bar. | ||
| 6677 | These items are not displayed on the message mode tool bar. | ||
| 6678 | |||
| 6679 | See `gmm-tool-bar-from-list' for the format of the list." | ||
| 6680 | :type 'gmm-tool-bar-zap-list | ||
| 6681 | :version "22.1" ;; Gnus 5.10.9 | ||
| 6682 | :initialize 'custom-initialize-default | ||
| 6683 | :set 'message-tool-bar-update | ||
| 6684 | :group 'message) | ||
| 6685 | |||
| 6686 | (defvar image-load-path) | ||
| 6687 | |||
| 6688 | (defun message-make-tool-bar (&optional force) | ||
| 6689 | "Make a message mode tool bar from `message-tool-bar-list'. | ||
| 6690 | When FORCE, rebuild the tool bar." | ||
| 6691 | (when (and (not (featurep 'xemacs)) | ||
| 6692 | (boundp 'tool-bar-mode) | ||
| 6605 | tool-bar-mode | 6693 | tool-bar-mode |
| 6606 | (let ((tool-bar-map (copy-keymap tool-bar-map)) | 6694 | (or (not message-tool-bar-map) force)) |
| 6607 | (load-path (mm-image-load-path))) | 6695 | (setq message-tool-bar-map |
| 6608 | ;; Zap some items which aren't so relevant and take | 6696 | (let* ((load-path |
| 6609 | ;; up space. | 6697 | (gmm-image-load-path-for-library "message" |
| 6610 | (dolist (key '(print-buffer kill-buffer save-buffer | 6698 | "mail/save-draft.xpm" |
| 6611 | write-file dired open-file)) | 6699 | nil t)) |
| 6612 | (define-key tool-bar-map (vector key) nil)) | 6700 | (image-load-path (cons (car load-path) |
| 6613 | (message-tool-bar-local-item-from-menu | 6701 | (when (boundp 'image-load-path) |
| 6614 | 'message-send-and-exit "mail/send" tool-bar-map message-mode-map) | 6702 | image-load-path)))) |
| 6615 | (message-tool-bar-local-item-from-menu | 6703 | (gmm-tool-bar-from-list message-tool-bar |
| 6616 | 'message-kill-buffer "close" tool-bar-map message-mode-map) | 6704 | message-tool-bar-zap-list |
| 6617 | (message-tool-bar-local-item-from-menu | 6705 | 'message-mode-map)))) |
| 6618 | 'message-dont-send "cancel" tool-bar-map message-mode-map) | 6706 | message-tool-bar-map) |
| 6619 | (message-tool-bar-local-item-from-menu | ||
| 6620 | 'mml-attach-file "attach" tool-bar-map mml-mode-map) | ||
| 6621 | (message-tool-bar-local-item-from-menu | ||
| 6622 | 'ispell-message "spell" tool-bar-map message-mode-map) | ||
| 6623 | (message-tool-bar-local-item-from-menu | ||
| 6624 | 'mml-preview "preview" | ||
| 6625 | tool-bar-map mml-mode-map) | ||
| 6626 | (message-tool-bar-local-item-from-menu | ||
| 6627 | 'message-insert-importance-high "important" | ||
| 6628 | tool-bar-map message-mode-map) | ||
| 6629 | (message-tool-bar-local-item-from-menu | ||
| 6630 | 'message-insert-importance-low "unimportant" | ||
| 6631 | tool-bar-map message-mode-map) | ||
| 6632 | (message-tool-bar-local-item-from-menu | ||
| 6633 | 'message-insert-disposition-notification-to "receipt" | ||
| 6634 | tool-bar-map message-mode-map) | ||
| 6635 | tool-bar-map))))) | ||
| 6636 | 6707 | ||
| 6637 | ;;; Group name completion. | 6708 | ;;; Group name completion. |
| 6638 | 6709 | ||