1 ;;; gnus-xmas.el --- Gnus functions for XEmacs
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000
4 ;; Free Software Foundation, Inc.
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
9 ;; This file is part of GNU Emacs.
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; GNU Emacs is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 ;; Boston, MA 02111-1307, USA.
31 (defvar menu-bar-mode (featurep 'menubar))
32 (require 'messagexmas)
35 (defgroup gnus-xmas nil
36 "XEmacsoid support for Gnus"
39 (defcustom gnus-xmas-glyph-directory nil
40 "Directory where Gnus logos and icons are located.
41 If this variable is nil, Gnus will try to locate the directory
43 :type '(choice (const :tag "autodetect" nil)
47 ;;(format "%02x%02x%02x" 114 66 20) "724214"
49 (defvar gnus-xmas-logo-color-alist
50 '((flame "#cc3300" "#ff2200")
51 (pine "#c0cc93" "#f8ffb8")
52 (moss "#a1cc93" "#d2ffb8")
53 (irish "#04cc90" "#05ff97")
54 (sky "#049acc" "#05deff")
55 (tin "#6886cc" "#82b6ff")
56 (velvet "#7c68cc" "#8c82ff")
57 (grape "#b264cc" "#cf7df")
58 (labia "#cc64c2" "#fd7dff")
59 (berry "#cc6485" "#ff7db5")
60 (dino "#724214" "#1e3f03")
61 (neutral "#b4b4b4" "#878787")
62 (september "#bf9900" "#ffcc00"))
63 "Color alist used for the Gnus logo.")
65 (defcustom gnus-xmas-logo-color-style 'dino
66 "*Color styles used for the Gnus logo."
67 :type '(choice (const flame) (const pine) (const moss)
68 (const irish) (const sky) (const tin)
69 (const velvet) (const grape) (const labia)
70 (const berry) (const neutral) (const september)
74 (defvar gnus-xmas-logo-colors
75 (cdr (assq gnus-xmas-logo-color-style gnus-xmas-logo-color-alist))
76 "Colors used for the Gnus logo.")
78 (defcustom gnus-article-x-face-command
79 (if (or (featurep 'xface)
81 'gnus-xmas-article-display-xface
82 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | ee -")
83 "*String or function to be executed to display an X-Face header.
84 If it is a string, the command will be executed in a sub-shell
85 asynchronously. The compressed face will be piped to this command."
86 :type '(choice string function))
88 ;;; Internal variables.
90 ;; Don't warn about these undefined variables.
92 (defvar gnus-group-mode-hook)
93 (defvar gnus-summary-mode-hook)
94 (defvar gnus-article-mode-hook)
97 (defvar gnus-active-hashtb)
98 (defvar gnus-article-buffer)
99 (defvar gnus-auto-center-summary)
100 (defvar gnus-current-headers)
101 (defvar gnus-level-killed)
102 (defvar gnus-level-zombie)
103 (defvar gnus-newsgroup-bookmarks)
104 (defvar gnus-newsgroup-dependencies)
105 (defvar gnus-newsgroup-selected-overlay)
106 (defvar gnus-newsrc-hashtb)
107 (defvar gnus-read-mark)
108 (defvar gnus-refer-article-method)
109 (defvar gnus-reffed-article-number)
110 (defvar gnus-unread-mark)
111 (defvar gnus-version)
112 (defvar gnus-view-pseudos)
113 (defvar gnus-view-pseudos-separately)
115 (defvar gnus-zombie-list)
116 ;;defined in gnus-msg.el
117 (defvar gnus-article-copy)
118 (defvar gnus-check-before-posting)
119 ;;defined in gnus-vis.el
120 (defvar gnus-article-button-face)
121 (defvar gnus-article-mouse-face)
122 (defvar gnus-summary-selected-face)
123 (defvar gnus-group-reading-menu)
124 (defvar gnus-group-group-menu)
125 (defvar gnus-group-misc-menu)
126 (defvar gnus-summary-article-menu)
127 (defvar gnus-summary-thread-menu)
128 (defvar gnus-summary-misc-menu)
129 (defvar gnus-summary-post-menu)
130 (defvar gnus-summary-kill-menu)
131 (defvar gnus-article-article-menu)
132 (defvar gnus-article-treatment-menu)
133 (defvar gnus-mouse-2)
134 (defvar standard-display-table)
135 (defvar gnus-tree-minimize-window)
137 (defun gnus-xmas-set-text-properties (start end props &optional buffer)
138 "You should NEVER use this function. It is ideologically blasphemous.
139 It is provided only to ease porting of broken FSF Emacs programs."
142 (map-extents (lambda (extent ignored)
143 (remove-text-properties
145 (list (extent-property extent 'text-prop) nil)
148 buffer start end nil nil 'text-prop)
149 (gnus-add-text-properties start end props buffer)))
151 (defun gnus-xmas-highlight-selected-summary ()
152 ;; Highlight selected article in summary buffer
153 (when gnus-summary-selected-face
154 (when gnus-newsgroup-selected-overlay
155 (delete-extent gnus-newsgroup-selected-overlay))
156 (setq gnus-newsgroup-selected-overlay
157 (make-extent (gnus-point-at-bol) (gnus-point-at-eol)))
158 (set-extent-face gnus-newsgroup-selected-overlay
159 gnus-summary-selected-face)))
161 (defcustom gnus-xmas-force-redisplay nil
162 "*If non-nil, force a redisplay before recentering the summary buffer.
163 This is ugly, but it works around a bug in `window-displayed-height'."
167 (defun gnus-xmas-switch-horizontal-scrollbar-off ()
168 (when (featurep 'scrollbar)
169 (set-specifier scrollbar-height (cons (current-buffer) 0))))
171 (defun gnus-xmas-summary-recenter ()
172 "\"Center\" point in the summary window.
173 If `gnus-auto-center-summary' is nil, or the article buffer isn't
174 displayed, no centering will be performed."
175 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
176 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
177 ;; Force redisplay to get properly computed window height.
178 (when gnus-xmas-force-redisplay
180 (when gnus-auto-center-summary
181 (let* ((height (if (fboundp 'window-displayed-height)
182 (window-displayed-height)
183 (- (window-height) 2)))
184 (top (cond ((< height 4) 0)
186 (t (if (numberp gnus-auto-center-summary)
187 gnus-auto-center-summary
189 (bottom (save-excursion (goto-char (point-max))
190 (forward-line (- height))
192 (window (get-buffer-window (current-buffer))))
193 (when (get-buffer-window gnus-article-buffer)
194 ;; Only do recentering when the article buffer is displayed,
195 ;; Set the window start to either `bottom', which is the biggest
196 ;; possible valid number, or the second line from the top,
197 ;; whichever is the least.
198 ;; NOFORCE parameter suggested by Daniel Pittman <daniel@danann.net>.
200 window (min bottom (save-excursion (forward-line (- top)) (point)))
202 ;; Do horizontal recentering while we're at it.
203 (when (and (get-buffer-window (current-buffer) t)
204 (not (eq gnus-auto-center-summary 'vertical)))
205 (let ((selected (selected-window)))
206 (select-window (get-buffer-window (current-buffer) t))
207 (gnus-summary-position-point)
208 (gnus-horizontal-recenter)
209 (select-window selected))))))
211 (defun gnus-xmas-summary-set-display-table ()
212 ;; Setup the display table -- like `gnus-summary-setup-display-table',
213 ;; but done in an XEmacsish way.
214 (let ((table (make-display-table))
216 ;; Nix out all the control chars...
217 (while (>= (setq i (1- i)) 0)
219 ;; ... but not newline and cr, of course. (cr is necessary for the
220 ;; selective display).
223 ;; We keep TAB as well.
225 ;; We nix out any glyphs over 126 below ctl-arrow.
226 (let ((i (if (integerp ctl-arrow) ctl-arrow 160)))
227 (while (>= (setq i (1- i)) 127)
228 (unless (aref table i)
229 (aset table i [??]))))
230 ;; Can't use `set-specifier' because of a bug in 19.14 and earlier
231 (add-spec-to-specifier current-display-table table (current-buffer) nil)))
233 (defun gnus-xmas-add-text-properties (start end props &optional object)
234 (add-text-properties start end props object)
235 (put-text-property start end 'start-closed nil object))
237 (defun gnus-xmas-put-text-property (start end prop value &optional object)
238 (put-text-property start end prop value object)
239 (put-text-property start end 'start-closed nil object))
241 (defun gnus-xmas-extent-start-open (point)
242 (map-extents (lambda (extent arg)
243 (set-extent-property extent 'start-open t))
244 nil point (min (1+ (point)) (point-max))))
246 (defun gnus-xmas-article-push-button (event)
247 "Check text under the mouse pointer for a callback function.
248 If the text under the mouse pointer has a `gnus-callback' property,
249 call it with the value of the `gnus-data' text property."
251 (set-buffer (window-buffer (event-window event)))
252 (let* ((pos (event-closest-point event))
253 (data (get-text-property pos 'gnus-data))
254 (fun (get-text-property pos 'gnus-callback)))
257 (funcall fun data))))
259 (defun gnus-xmas-move-overlay (extent start end &optional buffer)
260 (set-extent-endpoints extent start end buffer))
262 (defun gnus-xmas-kill-all-overlays ()
263 "Delete all extents in the current buffer."
264 (map-extents (lambda (extent ignore)
265 (delete-extent extent)
268 (defun gnus-xmas-window-top-edge (&optional window)
269 (nth 1 (window-pixel-edges window)))
271 (defun gnus-xmas-tree-minimize ()
272 (when (and gnus-tree-minimize-window
273 (not (one-window-p)))
274 (let* ((window-min-height 2)
275 (height (1+ (count-lines (point-min) (point-max))))
276 (min (max (1- window-min-height) height))
277 (tot (if (numberp gnus-tree-minimize-window)
278 (min gnus-tree-minimize-window min)
280 (win (get-buffer-window (current-buffer)))
281 (wh (and win (1- (window-height win)))))
284 (let ((selected (selected-window)))
286 (enlarge-window (- tot wh))
287 (select-window selected))))))
289 ;; Select the lowest window on the frame.
290 (defun gnus-xmas-appt-select-lowest-window ()
291 (let* ((lowest-window (selected-window))
292 (bottom-edge (car (cdr (cdr (cdr (window-pixel-edges))))))
293 (last-window (previous-window))
296 (let* ((this-window (next-window))
297 (next-bottom-edge (car (cdr (cdr (cdr
300 (when (< bottom-edge next-bottom-edge)
301 (setq bottom-edge next-bottom-edge)
302 (setq lowest-window this-window))
304 (select-window this-window)
305 (when (eq last-window this-window)
306 (select-window lowest-window)
307 (setq window-search nil))))))
309 (defmacro gnus-xmas-menu-add (type &rest menus)
310 `(gnus-xmas-menu-add-1 ',type ',menus))
311 (put 'gnus-xmas-menu-add 'lisp-indent-function 1)
313 (defun gnus-xmas-menu-add-1 (type menus)
314 (when (and menu-bar-mode
315 (gnus-visual-p (intern (format "%s-menu" type)) 'menu))
317 (easy-menu-add (symbol-value (pop menus))))))
319 (defun gnus-xmas-group-menu-add ()
320 (gnus-xmas-menu-add group
321 gnus-group-reading-menu gnus-group-group-menu gnus-group-misc-menu))
323 (defun gnus-xmas-summary-menu-add ()
324 (gnus-xmas-menu-add summary
325 gnus-summary-misc-menu gnus-summary-kill-menu
326 gnus-summary-article-menu gnus-summary-thread-menu
327 gnus-summary-post-menu ))
329 (defun gnus-xmas-article-menu-add ()
330 (gnus-xmas-menu-add article
331 gnus-article-article-menu gnus-article-treatment-menu))
333 (defun gnus-xmas-score-menu-add ()
334 (gnus-xmas-menu-add score
337 (defun gnus-xmas-pick-menu-add ()
338 (gnus-xmas-menu-add pick
341 (defun gnus-xmas-topic-menu-add ()
342 (gnus-xmas-menu-add topic
345 (defun gnus-xmas-binary-menu-add ()
346 (gnus-xmas-menu-add binary
349 (defun gnus-xmas-agent-summary-menu-add ()
350 (gnus-xmas-menu-add agent-summary
351 gnus-agent-summary-menu))
353 (defun gnus-xmas-agent-group-menu-add ()
354 (gnus-xmas-menu-add agent-group
355 gnus-agent-group-menu))
357 (defun gnus-xmas-agent-server-menu-add ()
358 (gnus-xmas-menu-add agent-server
359 gnus-agent-server-menu))
361 (defun gnus-xmas-tree-menu-add ()
362 (gnus-xmas-menu-add tree
365 (defun gnus-xmas-draft-menu-add ()
366 (gnus-xmas-menu-add draft
369 (defun gnus-xmas-server-menu-add ()
370 (gnus-xmas-menu-add menu
371 gnus-server-server-menu gnus-server-connections-menu))
373 (defun gnus-xmas-browse-menu-add ()
374 (gnus-xmas-menu-add browse
377 (defun gnus-xmas-grouplens-menu-add ()
378 (gnus-xmas-menu-add grouplens
379 gnus-grouplens-menu))
381 (defun gnus-xmas-read-event-char ()
382 "Get the next event."
383 (let ((event (next-command-event)))
385 ;; We junk all non-key events. Is this naughty?
386 (while (not (or (key-press-event-p event)
387 (button-press-event-p event)))
388 (dispatch-event event)
389 (setq event (next-command-event)))
390 (cons (and (key-press-event-p event)
391 (event-to-character event))
394 (defun gnus-xmas-define ()
395 (setq gnus-mouse-2 [button2])
396 (setq gnus-mouse-3 [button3])
397 (setq gnus-widget-button-keymap widget-button-keymap)
399 (unless (memq 'underline (face-list))
400 (and (fboundp 'make-face)
401 (funcall (intern "make-face") 'underline)))
402 ;; Must avoid calling set-face-underline-p directly, because it
403 ;; is a defsubst in emacs19, and will make the .elc files non
405 (unless (face-differs-from-default-p 'underline)
406 (funcall (intern "set-face-underline-p") 'underline t))
409 ((fboundp 'char-or-char-int-p)
410 ;; Handle both types of marks for XEmacs-20.x.
411 (defalias 'gnus-characterp 'char-or-char-int-p))
412 ;; V19 of XEmacs, probably.
414 (defalias 'gnus-characterp 'characterp)))
416 (defalias 'gnus-make-overlay 'make-extent)
417 (defalias 'gnus-delete-overlay 'delete-extent)
418 (defalias 'gnus-overlay-put 'set-extent-property)
419 (defalias 'gnus-move-overlay 'gnus-xmas-move-overlay)
420 (defalias 'gnus-overlay-buffer 'extent-object)
421 (defalias 'gnus-overlay-start 'extent-start-position)
422 (defalias 'gnus-overlay-end 'extent-end-position)
423 (defalias 'gnus-kill-all-overlays 'gnus-xmas-kill-all-overlays)
424 (defalias 'gnus-extent-detached-p 'extent-detached-p)
425 (defalias 'gnus-add-text-properties 'gnus-xmas-add-text-properties)
426 (defalias 'gnus-put-text-property 'gnus-xmas-put-text-property)
427 (defalias 'gnus-deactivate-mark 'ignore)
428 (defalias 'gnus-window-edges 'window-pixel-edges)
430 (if (and (<= emacs-major-version 19)
431 (< emacs-minor-version 14))
432 (defalias 'gnus-set-text-properties 'gnus-xmas-set-text-properties))
434 (when (fboundp 'turn-off-scroll-in-place)
435 (add-hook 'gnus-article-mode-hook 'turn-off-scroll-in-place))
437 (unless (boundp 'standard-display-table)
438 (setq standard-display-table nil))
440 (defvar gnus-mouse-face-prop 'highlight)
442 (defun gnus-byte-code (func)
443 "Return a form that can be `eval'ed based on FUNC."
444 (let ((fval (indirect-function func)))
445 (if (compiled-function-p fval)
447 (cons 'progn (cdr (cdr fval))))))
449 (unless (fboundp 'match-string-no-properties)
450 (defalias 'match-string-no-properties 'match-string))
452 (defalias 'gnus-x-color-values
453 (if (fboundp 'x-color-values)
456 (color-instance-rgb-components
457 (make-color-instance color))))))
459 (defun gnus-xmas-redefine ()
460 "Redefine lots of Gnus functions for XEmacs."
461 (defalias 'gnus-summary-set-display-table 'gnus-xmas-summary-set-display-table)
462 (defalias 'gnus-visual-turn-off-edit-menu 'identity)
463 (defalias 'gnus-summary-recenter 'gnus-xmas-summary-recenter)
464 (defalias 'gnus-extent-start-open 'gnus-xmas-extent-start-open)
465 (defalias 'gnus-article-push-button 'gnus-xmas-article-push-button)
466 (defalias 'gnus-window-top-edge 'gnus-xmas-window-top-edge)
467 (defalias 'gnus-read-event-char 'gnus-xmas-read-event-char)
468 (defalias 'gnus-group-startup-message 'gnus-xmas-group-startup-message)
469 (defalias 'gnus-tree-minimize 'gnus-xmas-tree-minimize)
470 (defalias 'gnus-appt-select-lowest-window
471 'gnus-xmas-appt-select-lowest-window)
472 (defalias 'gnus-mail-strip-quoted-names 'gnus-xmas-mail-strip-quoted-names)
473 (defalias 'gnus-character-to-event 'character-to-event)
474 (defalias 'gnus-mode-line-buffer-identification
475 'gnus-xmas-mode-line-buffer-identification)
476 (defalias 'gnus-key-press-event-p 'key-press-event-p)
477 (defalias 'gnus-region-active-p 'region-active-p)
478 (defalias 'gnus-annotation-in-region-p 'gnus-xmas-annotation-in-region-p)
479 (defalias 'gnus-mime-button-menu 'gnus-xmas-mime-button-menu)
481 (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
482 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
483 (add-hook 'gnus-article-mode-hook 'gnus-xmas-article-menu-add)
484 (add-hook 'gnus-score-mode-hook 'gnus-xmas-score-menu-add)
486 (add-hook 'gnus-pick-mode-hook 'gnus-xmas-pick-menu-add)
487 (add-hook 'gnus-topic-mode-hook 'gnus-xmas-topic-menu-add)
488 (add-hook 'gnus-tree-mode-hook 'gnus-xmas-tree-menu-add)
489 (add-hook 'gnus-binary-mode-hook 'gnus-xmas-binary-menu-add)
490 (add-hook 'gnus-grouplens-mode-hook 'gnus-xmas-grouplens-menu-add)
491 (add-hook 'gnus-server-mode-hook 'gnus-xmas-server-menu-add)
492 (add-hook 'gnus-browse-mode-hook 'gnus-xmas-browse-menu-add)
494 (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar)
495 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
497 (add-hook 'gnus-agent-summary-mode-hook 'gnus-xmas-agent-summary-menu-add)
498 (add-hook 'gnus-agent-group-mode-hook 'gnus-xmas-agent-group-menu-add)
499 (add-hook 'gnus-agent-server-mode-hook 'gnus-xmas-agent-server-menu-add)
501 (add-hook 'gnus-draft-mode-hook 'gnus-xmas-draft-menu-add)
502 (add-hook 'gnus-summary-mode-hook
503 'gnus-xmas-switch-horizontal-scrollbar-off)
504 (add-hook 'gnus-tree-mode-hook 'gnus-xmas-switch-horizontal-scrollbar-off))
507 ;;; XEmacs logo and toolbar.
509 (defun gnus-xmas-group-startup-message (&optional x y)
510 "Insert startup message in current buffer."
511 ;; Insert the message.
512 (setq gnus-xmas-glyph-directory (message-xmas-find-glyph-directory "gnus"))
515 ((and (console-on-window-system-p)
518 (let* ((logo-xpm (expand-file-name "gnus.xpm" gnus-xmas-glyph-directory))
519 (logo-xbm (expand-file-name "gnus.xbm" gnus-xmas-glyph-directory))
521 (cond ((featurep 'xpm)
525 (("thing" . ,(car gnus-xmas-logo-colors))
526 ("shadow" . ,(cadr gnus-xmas-logo-colors))
527 ("background" . ,(face-background 'default)))])
529 `[xbm :file ,logo-xbm])
532 (set-extent-begin-glyph (make-extent (point) (point)) glyph)
533 (goto-char (point-min))
535 (insert (make-string (/ (max (- (window-width) (or x 35)) 0) 2)
538 (setq gnus-simple-splash nil))
539 (goto-char (point-min))
540 (let* ((pheight (+ 20 (count-lines (point-min) (point-max))))
541 (wheight (window-height))
542 (rest (- wheight pheight)))
543 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n))))
548 _ ___ __ ___ __ _ ___
568 (gnus-indent-rigidly (point-min) (point-max)
569 (/ (max (- (window-width) (or x 46)) 0) 2))
570 (goto-char (point-min))
572 (let* ((pheight (count-lines (point-min) (point-max)))
573 (wheight (window-height))
574 (rest (- wheight pheight)))
575 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n)))
577 (put-text-property (point-min) (point-max) 'face 'gnus-splash-face)))
578 (setq modeline-buffer-identification
579 (list (concat gnus-version ": *Group*")))
580 (set-buffer-modified-p t))
585 (defcustom gnus-use-toolbar (if (featurep 'toolbar)
588 "*If nil, do not use a toolbar.
589 If it is non-nil, it must be a toolbar. The five valid values are
590 `default-toolbar', `top-toolbar', `bottom-toolbar',
591 `right-toolbar', and `left-toolbar'."
592 :type '(choice (const default-toolbar)
593 (const top-toolbar) (const bottom-toolbar)
594 (const left-toolbar) (const right-toolbar)
595 (const :tag "no toolbar" nil))
598 (defvar gnus-group-toolbar
599 '([gnus-group-get-new-news gnus-group-get-new-news t "Get new news"]
600 [gnus-group-get-new-news-this-group
601 gnus-group-get-new-news-this-group t "Get new news in this group"]
602 [gnus-group-catchup-current
603 gnus-group-catchup-current t "Catchup group"]
604 [gnus-group-describe-group
605 gnus-group-describe-group t "Describe group"]
606 [gnus-group-unsubscribe gnus-group-unsubscribe t "Unsubscribe group"]
607 [gnus-group-subscribe gnus-group-subscribe t "Subscribe group"]
608 [gnus-group-kill-group gnus-group-kill-group t "Kill group"]
609 [gnus-group-exit gnus-group-exit t "Exit Gnus"])
610 "The group buffer toolbar.")
612 (defvar gnus-summary-toolbar
613 '([gnus-summary-prev-unread
614 gnus-summary-prev-page-or-article t "Page up"]
615 [gnus-summary-next-unread
616 gnus-summary-next-page t "Page down"]
617 [gnus-summary-post-news
618 gnus-summary-post-news t "Post an article"]
619 [gnus-summary-followup-with-original
620 gnus-summary-followup-with-original t
621 "Post a followup and yank the original"]
622 [gnus-summary-followup
623 gnus-summary-followup t "Post a followup"]
624 [gnus-summary-reply-with-original
625 gnus-summary-reply-with-original t "Mail a reply and yank the original"]
627 gnus-summary-reply t "Mail a reply"]
628 [gnus-summary-caesar-message
629 gnus-summary-caesar-message t "Rot 13"]
631 gnus-uu-decode-uu t "Decode uuencoded articles"]
632 [gnus-summary-save-article-file
633 gnus-summary-save-article-file t "Save article in file"]
634 [gnus-summary-save-article
635 gnus-summary-save-article t "Save article"]
637 gnus-uu-post-news t "Post a uuencoded article"]
638 [gnus-summary-cancel-article
639 gnus-summary-cancel-article t "Cancel article"]
640 [gnus-summary-catchup
641 gnus-summary-catchup t "Catchup"]
642 [gnus-summary-catchup-and-exit
643 gnus-summary-catchup-and-exit t "Catchup and exit"]
644 [gnus-summary-exit gnus-summary-exit t "Exit this summary"])
645 "The summary buffer toolbar.")
647 (defvar gnus-summary-mail-toolbar
649 [gnus-summary-prev-unread
650 gnus-summary-prev-unread-article t "Prev unread article"]
651 [gnus-summary-next-unread
652 gnus-summary-next-unread-article t "Next unread article"]
653 [gnus-summary-mail-reply gnus-summary-reply t "Reply"]
654 [gnus-summary-mail-originate gnus-summary-post-news t "Originate"]
655 [gnus-summary-mail-save gnus-summary-save-article t "Save"]
656 [gnus-summary-mail-copy gnus-summary-copy-article t "Copy message"]
657 [gnus-summary-mail-forward gnus-summary-mail-forward t "Forward message"]
658 [gnus-summary-caesar-message
659 gnus-summary-caesar-message t "Rot 13"]
661 gnus-uu-decode-uu t "Decode uuencoded articles"]
662 [gnus-summary-save-article-file
663 gnus-summary-save-article-file t "Save article in file"]
664 [gnus-summary-save-article
665 gnus-summary-save-article t "Save article"]
666 [gnus-summary-catchup
667 gnus-summary-catchup t "Catchup"]
668 [gnus-summary-catchup-and-exit
669 gnus-summary-catchup-and-exit t "Catchup and exit"]
670 [gnus-summary-exit gnus-summary-exit t "Exit this summary"])
671 "The summary buffer mail toolbar.")
673 (defun gnus-xmas-setup-group-toolbar ()
674 (and gnus-use-toolbar
675 (message-xmas-setup-toolbar gnus-group-toolbar nil "gnus")
676 (set-specifier (symbol-value gnus-use-toolbar)
677 (cons (current-buffer) gnus-group-toolbar))))
679 (defun gnus-xmas-setup-summary-toolbar ()
680 (let ((bar (if (gnus-news-group-p gnus-newsgroup-name)
681 gnus-summary-toolbar gnus-summary-mail-toolbar)))
682 (and gnus-use-toolbar
683 (message-xmas-setup-toolbar bar nil "gnus")
684 (set-specifier (symbol-value gnus-use-toolbar)
685 (cons (current-buffer) bar)))))
687 (defun gnus-xmas-mail-strip-quoted-names (address)
688 "Protect mail-strip-quoted-names from NIL input.
689 XEmacs compatibility workaround."
692 (mail-strip-quoted-names address)))
694 (defun gnus-xmas-call-region (command &rest args)
696 'call-process-region (point-min) (point-max) command t '(t nil) nil
699 (defface gnus-x-face '((t (:foreground "black" :background "white")))
700 "Face to show X face"
703 (defun gnus-xmas-article-display-xface (beg end)
704 "Display any XFace headers in the current article."
709 (make-glyph (vector 'xface :data
711 (buffer-substring beg end)))))
713 (let ((cur (current-buffer)))
715 (gnus-set-work-buffer)
716 (insert-buffer-substring cur beg end)
717 (gnus-xmas-call-region "uncompface")
718 (goto-char (point-min))
719 (insert "/* Width=48, Height=48 */\n")
720 (gnus-xmas-call-region "icontopbm")
721 (gnus-xmas-call-region "ppmtoxpm")
723 (vector 'xpm :data (buffer-string))))))
725 (make-glyph [nothing]))))
726 (ext (make-extent (progn
727 (goto-char (point-min))
728 (re-search-forward "^From:" nil t)
731 (set-glyph-face xface-glyph 'gnus-x-face)
732 (set-extent-begin-glyph ext xface-glyph)
733 (set-extent-property ext 'duplicable t))))
735 (defvar gnus-xmas-modeline-left-extent
736 (let ((ext (copy-extent modeline-buffer-id-left-extent)))
739 (defvar gnus-xmas-modeline-right-extent
740 (let ((ext (copy-extent modeline-buffer-id-right-extent)))
743 (defvar gnus-xmas-modeline-glyph
745 (setq gnus-xmas-glyph-directory (message-xmas-find-glyph-directory "gnus"))
746 (let* ((file-xpm (expand-file-name "gnus-pointer.xpm"
747 gnus-xmas-glyph-directory))
748 (file-xbm (expand-file-name "gnus-pointer.xbm"
749 gnus-xmas-glyph-directory))
752 (cond ((featurep 'xpm)
753 ;; Let's try a nifty XPM
754 `[xpm :file ,file-xpm])
756 ;; Then a not-so-nifty XBM
757 `[xbm :file ,file-xbm])
758 ;; Then the simple string
759 (t [string :data "Gnus:"])))))
760 (set-glyph-face glyph 'modeline-buffer-id)
763 (defun gnus-xmas-mode-line-buffer-identification (line)
764 (let ((line (car line))
767 ;; This is some weird type of id.
768 ((not (stringp line))
770 ;; This is non-standard, so we just pass it through.
771 ((not (string-match "^Gnus:" line))
773 ;; We have a standard line, so we colorize and glyphize it a bit.
775 (setq chop (match-end 0))
777 (if gnus-xmas-modeline-glyph
778 (cons gnus-xmas-modeline-left-extent gnus-xmas-modeline-glyph)
779 (cons gnus-xmas-modeline-left-extent (substring line 0 chop)))
780 (cons gnus-xmas-modeline-right-extent (substring line chop)))))))
782 (defun gnus-xmas-splash ()
783 (when (eq (device-type) 'x)
786 (defun gnus-xmas-annotation-in-region-p (b e)
787 (or (map-extents (lambda (e u) t) nil b e nil nil 'mm t)
789 (eq (cadr (memq 'gnus-undeletable (text-properties-at b))) t)
790 (text-property-any b e 'gnus-undeletable t))))
792 (defun gnus-xmas-mime-button-menu (event)
793 "Construct a context-sensitive menu of MIME commands."
795 (let ((response (get-popup-menu-response
797 ,@(mapcar (lambda (c) `[,(caddr c) ,(car c) t])
798 gnus-mime-button-commands)))))
799 (set-buffer (event-buffer event))
800 (goto-char (event-point event))
801 (funcall (event-function response) (event-object response))))
803 (defun gnus-group-add-icon ()
804 "Add an icon to the current line according to `gnus-group-icon-list'."
806 (end (progn (end-of-line) (point)))
807 ;; now find out where the line starts and leave point there.
808 (beg (progn (beginning-of-line) (point))))
810 (narrow-to-region beg end)
812 (when (search-forward "==&&==" nil t)
813 (let* ((group (gnus-group-group-name))
814 (entry (gnus-group-entry group))
815 (unread (if (numberp (car entry)) (car entry) 0))
816 (active (gnus-active group))
817 (total (if active (1+ (- (cdr active) (car active))) 0))
819 (method (gnus-server-get-method group (gnus-info-method info)))
820 (marked (gnus-info-marks info))
821 (mailp (memq 'mail (assoc (symbol-name
822 (car (or method gnus-select-method)))
823 gnus-valid-select-methods)))
824 (level (or (gnus-info-level info) gnus-level-killed))
825 (score (or (gnus-info-score info) 0))
826 (ticked (gnus-range-length (cdr (assq 'tick marked))))
827 (group-age (gnus-group-timestamp-delta group))
828 (inhibit-read-only t)
829 (list gnus-group-icon-list)
830 (mystart (match-beginning 0))
831 (myend (match-end 0)))
832 (goto-char (point-min))
834 (not (eval (caar list))))
835 (setq list (cdr list)))
837 (let* ((file (cdar list))
838 (glyph (gnus-group-icon-create-glyph
839 (buffer-substring mystart myend)
843 (mapcar 'delete-annotation (annotations-at myend))
844 (let ((ext (make-extent mystart myend))
845 (ant (make-annotation glyph myend 'text)))
846 ;; set text extent params
847 (set-extent-property ext 'end-open t)
848 (set-extent-property ext 'start-open t)
849 (set-extent-property ext 'invisible t)))
850 (delete-region mystart myend)))
851 (delete-region mystart myend))))
855 (defun gnus-group-icon-create-glyph (substring pixmap)
856 "Create a glyph for insertion into a group line."
858 (cdr-safe (assoc pixmap gnus-group-icon-cache))
859 (let* ((glyph (make-glyph
862 (expand-file-name pixmap gnus-xmas-glyph-directory))
864 (expand-file-name pixmap gnus-xmas-glyph-directory))
865 (cons 'tty substring)))))
866 (setq gnus-group-icon-cache
867 (cons (cons pixmap glyph) gnus-group-icon-cache))
868 (set-glyph-face glyph 'default)
871 (defun gnus-xmas-mailing-list-menu-add ()
872 (gnus-xmas-menu-add mailing-list
873 gnus-mailing-list-menu))
875 (add-hook 'gnus-mailing-list-mode-hook 'gnus-xmas-mailing-list-menu-add)
879 ;;; gnus-xmas.el ends here