1 ;;; gnus-xmas.el --- Gnus functions for XEmacs
2 ;; Copyright (C) 1995,96,97 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
29 (defvar menu-bar-mode (featurep 'menubar))
30 (require 'messagexmas)
32 (defvar gnus-xmas-glyph-directory nil
33 "*Directory where Gnus logos and icons are located.
34 If this variable is nil, Gnus will try to locate the directory
37 (defvar gnus-xmas-logo-color-alist
38 '((flame "#cc3300" "#ff2200")
39 (pine "#c0cc93" "#f8ffb8")
40 (moss "#a1cc93" "#d2ffb8")
41 (irish "#04cc90" "#05ff97")
42 (sky "#049acc" "#05deff")
43 (tin "#6886cc" "#82b6ff")
44 (velvet "#7c68cc" "#8c82ff")
45 (grape "#b264cc" "#cf7df")
46 (labia "#cc64c2" "#fd7dff")
47 (berry "#cc6485" "#ff7db5")
48 (neutral "#b4b4b4" "#878787")
49 (september "#bf9900" "#ffcc00"))
50 "Color alist used for the Gnus logo.")
52 (defvar gnus-xmas-logo-color-style 'flame
53 "Color styles used for the Gnus logo.")
55 (defvar gnus-xmas-logo-colors
56 (cdr (assq gnus-xmas-logo-color-style gnus-xmas-logo-color-alist))
57 "Colors used for the Gnus logo.")
59 (defvar gnus-article-x-face-command
61 'gnus-xmas-article-display-xface
62 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | xv -quit -")
63 "String or function to be executed to display an X-Face header.
64 If it is a string, the command will be executed in a sub-shell
65 asynchronously. The compressed face will be piped to this command.")
67 ;;; Internal variables.
69 ;; Don't warn about these undefined variables.
71 (defvar gnus-group-mode-hook)
72 (defvar gnus-summary-mode-hook)
73 (defvar gnus-article-mode-hook)
76 (defvar gnus-active-hashtb)
77 (defvar gnus-article-buffer)
78 (defvar gnus-auto-center-summary)
79 (defvar gnus-buffer-list)
80 (defvar gnus-current-headers)
81 (defvar gnus-level-killed)
82 (defvar gnus-level-zombie)
83 (defvar gnus-newsgroup-bookmarks)
84 (defvar gnus-newsgroup-dependencies)
85 (defvar gnus-newsgroup-selected-overlay)
86 (defvar gnus-newsrc-hashtb)
87 (defvar gnus-read-mark)
88 (defvar gnus-refer-article-method)
89 (defvar gnus-reffed-article-number)
90 (defvar gnus-unread-mark)
92 (defvar gnus-view-pseudos)
93 (defvar gnus-view-pseudos-separately)
95 (defvar gnus-zombie-list)
96 ;;defined in gnus-msg.el
97 (defvar gnus-article-copy)
98 (defvar gnus-check-before-posting)
99 ;;defined in gnus-vis.el
100 (defvar gnus-article-button-face)
101 (defvar gnus-article-mouse-face)
102 (defvar gnus-summary-selected-face)
103 (defvar gnus-group-reading-menu)
104 (defvar gnus-group-group-menu)
105 (defvar gnus-group-misc-menu)
106 (defvar gnus-summary-article-menu)
107 (defvar gnus-summary-thread-menu)
108 (defvar gnus-summary-misc-menu)
109 (defvar gnus-summary-post-menu)
110 (defvar gnus-summary-kill-menu)
111 (defvar gnus-article-article-menu)
112 (defvar gnus-article-treatment-menu)
113 (defvar gnus-mouse-2)
114 (defvar standard-display-table)
115 (defvar gnus-tree-minimize-window)
117 (defun gnus-xmas-set-text-properties (start end props &optional buffer)
118 "You should NEVER use this function. It is ideologically blasphemous.
119 It is provided only to ease porting of broken FSF Emacs programs."
122 (map-extents (lambda (extent ignored)
123 (remove-text-properties
125 (list (extent-property extent 'text-prop) nil)
127 buffer start end nil nil 'text-prop)
128 (gnus-add-text-properties start end props buffer)))
130 (defun gnus-xmas-highlight-selected-summary ()
131 ;; Highlight selected article in summary buffer
132 (when gnus-summary-selected-face
133 (when gnus-newsgroup-selected-overlay
134 (delete-extent gnus-newsgroup-selected-overlay))
135 (setq gnus-newsgroup-selected-overlay
136 (make-extent (gnus-point-at-bol) (gnus-point-at-eol)))
137 (set-extent-face gnus-newsgroup-selected-overlay
138 gnus-summary-selected-face)))
140 (defvar gnus-xmas-force-redisplay nil
141 "If non-nil, force a redisplay before recentering the summary buffer.
142 This is ugly, but it works around a bug in `window-displayed-height'.")
144 (defun gnus-xmas-switch-horizontal-scrollbar-off ()
145 (when (featurep 'scrollbar)
146 (set-specifier scrollbar-height (cons (current-buffer) 0))))
148 (defun gnus-xmas-summary-recenter ()
149 "\"Center\" point in the summary window.
150 If `gnus-auto-center-summary' is nil, or the article buffer isn't
151 displayed, no centering will be performed."
152 ;; Suggested by earle@mahendo.JPL.NASA.GOV (Greg Earle).
153 ;; Recenter only when requested. Suggested by popovich@park.cs.columbia.edu.
154 ;; Force redisplay to get properly computed window height.
155 (when gnus-xmas-force-redisplay
157 (when gnus-auto-center-summary
158 (let* ((height (if (fboundp 'window-displayed-height)
159 (window-displayed-height)
160 (- (window-height) 2)))
161 (top (cond ((< height 4) 0)
164 (bottom (save-excursion (goto-char (point-max))
165 (forward-line (- height))
167 (window (get-buffer-window (current-buffer))))
168 (when (get-buffer-window gnus-article-buffer)
169 ;; Only do recentering when the article buffer is displayed,
170 ;; Set the window start to either `bottom', which is the biggest
171 ;; possible valid number, or the second line from the top,
172 ;; whichever is the least.
174 window (min bottom (save-excursion (forward-line (- top)) (point)))))
175 ;; Do horizontal recentering while we're at it.
176 (when (and (get-buffer-window (current-buffer) t)
177 (not (eq gnus-auto-center-summary 'vertical)))
178 (let ((selected (selected-window)))
179 (select-window (get-buffer-window (current-buffer) t))
180 (gnus-summary-position-point)
181 (gnus-horizontal-recenter)
182 (select-window selected))))))
184 (defun gnus-xmas-summary-set-display-table ()
185 ;; Setup the display table -- like gnus-summary-setup-display-table,
186 ;; but done in an XEmacsish way.
187 (let ((table (make-display-table))
189 ;; Nix out all the control chars...
190 (while (>= (setq i (1- i)) 0)
192 ;; ... but not newline and cr, of course. (cr is necessary for the
193 ;; selective display).
196 ;; We nix out any glyphs over 126 that are not set already.
198 (while (>= (setq i (1- i)) 127)
199 ;; Only modify if the entry is nil.
200 (unless (aref table i)
201 (aset table i [??]))))
202 (add-spec-to-specifier current-display-table table (current-buffer) nil)))
204 (defun gnus-xmas-add-hook (hook function &optional append local)
205 (add-hook hook function))
207 (defun gnus-xmas-add-text-properties (start end props &optional object)
208 (add-text-properties start end props object)
209 (put-text-property start end 'start-closed nil object))
211 (defun gnus-xmas-put-text-property (start end prop value &optional object)
212 (put-text-property start end prop value object)
213 (put-text-property start end 'start-closed nil object))
215 (defun gnus-xmas-extent-start-open (point)
216 (map-extents (lambda (extent arg)
217 (set-extent-property extent 'start-open t))
218 nil point (min (1+ (point)) (point-max))))
220 (defun gnus-xmas-article-push-button (event)
221 "Check text under the mouse pointer for a callback function.
222 If the text under the mouse pointer has a `gnus-callback' property,
223 call it with the value of the `gnus-data' text property."
225 (set-buffer (window-buffer (event-window event)))
226 (let* ((pos (event-closest-point event))
227 (data (get-text-property pos 'gnus-data))
228 (fun (get-text-property pos 'gnus-callback)))
230 (funcall fun data))))
232 (defun gnus-xmas-move-overlay (extent start end &optional buffer)
233 (set-extent-endpoints extent start end))
235 ;; Fixed by Christopher Davis <ckd@loiosh.kei.com>.
236 (defun gnus-xmas-article-add-button (from to fun &optional data)
237 "Create a button between FROM and TO with callback FUN and data DATA."
238 (when gnus-article-button-face
239 (gnus-overlay-put (gnus-make-overlay from to)
240 'face gnus-article-button-face))
241 (gnus-add-text-properties
244 (and gnus-article-mouse-face
245 (list 'mouse-face gnus-article-mouse-face))
246 (list 'gnus-callback fun)
247 (and data (list 'gnus-data data))
248 (list 'highlight t))))
250 (defun gnus-xmas-window-top-edge (&optional window)
251 (nth 1 (window-pixel-edges window)))
253 (defun gnus-xmas-tree-minimize ()
254 (when (and gnus-tree-minimize-window
255 (not (one-window-p)))
256 (let* ((window-min-height 2)
257 (height (1+ (count-lines (point-min) (point-max))))
258 (min (max (1- window-min-height) height))
259 (tot (if (numberp gnus-tree-minimize-window)
260 (min gnus-tree-minimize-window min)
262 (win (get-buffer-window (current-buffer)))
263 (wh (and win (1- (window-height win)))))
266 (let ((selected (selected-window)))
268 (enlarge-window (- tot wh))
269 (select-window selected))))))
271 ;; Select the lowest window on the frame.
272 (defun gnus-xmas-appt-select-lowest-window ()
273 (let* ((lowest-window (selected-window))
274 (bottom-edge (car (cdr (cdr (cdr (window-pixel-edges))))))
275 (last-window (previous-window))
278 (let* ((this-window (next-window))
279 (next-bottom-edge (car (cdr (cdr (cdr
282 (when (< bottom-edge next-bottom-edge)
283 (setq bottom-edge next-bottom-edge)
284 (setq lowest-window this-window))
286 (select-window this-window)
287 (when (eq last-window this-window)
288 (select-window lowest-window)
289 (setq window-search nil))))))
291 (defmacro gnus-xmas-menu-add (type &rest menus)
292 `(gnus-xmas-menu-add-1 ',type ',menus))
293 (put 'gnus-xmas-menu-add 'lisp-indent-function 1)
295 (defun gnus-xmas-menu-add-1 (type menus)
296 (when (and menu-bar-mode
297 (gnus-visual-p (intern (format "%s-menu" type)) 'menu))
299 (easy-menu-add (symbol-value (pop menus))))))
301 (defun gnus-xmas-group-menu-add ()
302 (gnus-xmas-menu-add group
303 gnus-group-reading-menu gnus-group-group-menu gnus-group-misc-menu))
305 (defun gnus-xmas-summary-menu-add ()
306 (gnus-xmas-menu-add summary
307 gnus-summary-misc-menu gnus-summary-kill-menu
308 gnus-summary-article-menu gnus-summary-thread-menu
309 gnus-summary-post-menu ))
311 (defun gnus-xmas-article-menu-add ()
312 (gnus-xmas-menu-add article
313 gnus-article-article-menu gnus-article-treatment-menu))
315 (defun gnus-xmas-score-menu-add ()
316 (gnus-xmas-menu-add score
319 (defun gnus-xmas-pick-menu-add ()
320 (gnus-xmas-menu-add pick
323 (defun gnus-xmas-topic-menu-add ()
324 (gnus-xmas-menu-add topic
327 (defun gnus-xmas-binary-menu-add ()
328 (gnus-xmas-menu-add binary
331 (defun gnus-xmas-tree-menu-add ()
332 (gnus-xmas-menu-add tree
335 (defun gnus-xmas-server-menu-add ()
336 (gnus-xmas-menu-add menu
337 gnus-server-server-menu gnus-server-connections-menu))
339 (defun gnus-xmas-browse-menu-add ()
340 (gnus-xmas-menu-add browse
343 (defun gnus-xmas-grouplens-menu-add ()
344 (gnus-xmas-menu-add grouplens
345 gnus-grouplens-menu))
347 (defun gnus-xmas-read-event-char ()
348 "Get the next event."
349 (let ((event (next-command-event)))
351 ;; We junk all non-key events. Is this naughty?
352 (while (not (or (key-press-event-p event)
353 (button-press-event-p event)))
354 (dispatch-event event)
355 (setq event (next-command-event)))
356 (cons (and (key-press-event-p event)
357 (event-to-character event))
360 (defun gnus-xmas-group-remove-excess-properties ()
362 (beg (progn (forward-line -1) (point))))
363 (remove-text-properties (1+ beg) end '(gnus-group nil))
364 (remove-text-properties
366 '(gnus-topic nil gnus-topic-level nil gnus-topic-visible nil))
370 (set-extent-property e 'start-closed t))
371 (current-buffer) beg end)))
373 (defun gnus-xmas-topic-remove-excess-properties ()
375 (beg (progn (forward-line -1) (point))))
376 (remove-text-properties beg end '(gnus-group nil gnus-unread nil))
377 (remove-text-properties (1+ beg) end '(gnus-topic nil))
380 (defun gnus-xmas-seconds-since-epoch (date)
381 "Return a floating point number that says how many seconds have lapsed between Jan 1 12:00:00 1970 and DATE."
382 (let* ((tdate (mapcar (lambda (ti) (and ti (string-to-int ti)))
383 (timezone-parse-date date)))
384 (ttime (mapcar (lambda (ti) (and ti (string-to-int ti)))
386 (aref (timezone-parse-date date) 3))))
387 (edate (mapcar (lambda (ti) (and ti (string-to-int ti)))
388 (timezone-parse-date "Jan 1 12:00:00 1970")))
389 (tday (- (timezone-absolute-from-gregorian
390 (nth 1 tdate) (nth 2 tdate) (nth 0 tdate))
391 (timezone-absolute-from-gregorian
392 (nth 1 edate) (nth 2 edate) (nth 0 edate)))))
395 (* (float (nth 0 ttime)) 60 60)
396 (* (float tday) 60 60 24))))
398 (defun gnus-xmas-define ()
399 (setq gnus-mouse-2 [button2])
401 (unless (memq 'underline (face-list))
402 (and (fboundp 'make-face)
403 (funcall (intern "make-face") 'underline)))
404 ;; Must avoid calling set-face-underline-p directly, because it
405 ;; is a defsubst in emacs19, and will make the .elc files non
407 (unless (face-differs-from-default-p 'underline)
408 (funcall (intern "set-face-underline-p") 'underline t))
411 ((fboundp 'char-or-char-int-p)
412 ;; Handle both types of marks for XEmacs-20.x.
413 (fset 'gnus-characterp 'char-or-char-int-p))
414 ;; V19 of XEmacs, probably.
416 (fset 'gnus-characterp 'characterp)))
418 (fset 'gnus-make-overlay 'make-extent)
419 (fset 'gnus-overlay-put 'set-extent-property)
420 (fset 'gnus-move-overlay 'gnus-xmas-move-overlay)
421 (fset 'gnus-overlay-end 'extent-end-position)
422 (fset 'gnus-extent-detached-p 'extent-detached-p)
423 (fset 'gnus-add-text-properties 'gnus-xmas-add-text-properties)
424 (fset 'gnus-put-text-property 'gnus-xmas-put-text-property)
426 (require 'text-props)
427 (if (and (<= emacs-major-version 19)
428 (< emacs-minor-version 14))
429 (fset 'gnus-set-text-properties 'gnus-xmas-set-text-properties))
431 (when (fboundp 'turn-off-scroll-in-place)
432 (add-hook 'gnus-article-mode-hook 'turn-off-scroll-in-place))
434 (unless (boundp 'standard-display-table)
435 (setq standard-display-table nil))
437 (defvar gnus-mouse-face-prop 'highlight)
439 (unless (fboundp 'encode-time)
440 (defun encode-time (sec minute hour day month year &optional zone)
442 (gnus-xmas-seconds-since-epoch
443 (timezone-make-arpa-date
444 year month day (timezone-make-time-string hour minute sec)
446 (list (floor (/ seconds (expt 2 16)))
447 (round (mod seconds (expt 2 16)))))))
449 (defun gnus-byte-code (func)
450 "Return a form that can be `eval'ed based on FUNC."
451 (let ((fval (symbol-function func)))
452 (if (compiled-function-p fval)
454 (cons 'progn (cdr (cdr fval))))))
456 (fset 'gnus-x-color-values
457 (if (fboundp 'x-color-values)
460 (color-instance-rgb-components
461 (make-color-instance color))))))
463 (defun gnus-xmas-redefine ()
464 "Redefine lots of Gnus functions for XEmacs."
465 (fset 'gnus-summary-set-display-table 'gnus-xmas-summary-set-display-table)
466 (fset 'gnus-visual-turn-off-edit-menu 'identity)
467 (fset 'gnus-summary-recenter 'gnus-xmas-summary-recenter)
468 (fset 'gnus-extent-start-open 'gnus-xmas-extent-start-open)
469 (fset 'gnus-article-push-button 'gnus-xmas-article-push-button)
470 (fset 'gnus-article-add-button 'gnus-xmas-article-add-button)
471 (fset 'gnus-window-top-edge 'gnus-xmas-window-top-edge)
472 (fset 'gnus-read-event-char 'gnus-xmas-read-event-char)
473 (fset 'gnus-group-startup-message 'gnus-xmas-group-startup-message)
474 (fset 'gnus-tree-minimize 'gnus-xmas-tree-minimize)
475 (fset 'gnus-appt-select-lowest-window
476 'gnus-xmas-appt-select-lowest-window)
477 (fset 'gnus-mail-strip-quoted-names 'gnus-xmas-mail-strip-quoted-names)
478 (fset 'gnus-add-hook 'gnus-xmas-add-hook)
479 (fset 'gnus-character-to-event 'character-to-event)
480 (fset 'gnus-mode-line-buffer-identification
481 'gnus-xmas-mode-line-buffer-identification)
482 (fset 'gnus-key-press-event-p 'key-press-event-p)
483 (fset 'gnus-region-active-p 'region-active-p)
485 (add-hook 'gnus-group-mode-hook 'gnus-xmas-group-menu-add)
486 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-summary-menu-add)
487 (add-hook 'gnus-article-mode-hook 'gnus-xmas-article-menu-add)
488 (add-hook 'gnus-score-mode-hook 'gnus-xmas-score-menu-add)
490 (add-hook 'gnus-pick-mode-hook 'gnus-xmas-pick-menu-add)
491 (add-hook 'gnus-topic-mode-hook 'gnus-xmas-topic-menu-add)
492 (add-hook 'gnus-tree-mode-hook 'gnus-xmas-tree-menu-add)
493 (add-hook 'gnus-binary-mode-hook 'gnus-xmas-binary-menu-add)
494 (add-hook 'gnus-grouplens-mode-hook 'gnus-xmas-grouplens-menu-add)
495 (add-hook 'gnus-server-mode-hook 'gnus-xmas-server-menu-add)
496 (add-hook 'gnus-browse-mode-hook 'gnus-xmas-browse-menu-add)
498 (add-hook 'gnus-group-mode-hook 'gnus-xmas-setup-group-toolbar)
499 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-setup-summary-toolbar)
501 (add-hook 'gnus-summary-mode-hook 'gnus-xmas-switch-horizontal-scrollbar-off)
503 (when (and (<= emacs-major-version 19)
504 (<= emacs-minor-version 13))
505 (setq gnus-article-x-face-too-ugly (when (eq (device-type) 'tty)
507 (fset 'gnus-highlight-selected-summary
508 'gnus-xmas-highlight-selected-summary)
509 (fset 'gnus-group-remove-excess-properties
510 'gnus-xmas-group-remove-excess-properties)
511 (fset 'gnus-topic-remove-excess-properties
512 'gnus-xmas-topic-remove-excess-properties)
513 (fset 'gnus-mode-line-buffer-identification 'identity)
514 (unless (boundp 'shell-command-switch)
515 (setq shell-command-switch "-c"))))
518 ;;; XEmacs logo and toolbar.
520 (defun gnus-xmas-group-startup-message (&optional x y)
521 "Insert startup message in current buffer."
522 ;; Insert the message.
523 (setq gnus-xmas-glyph-directory (message-xmas-find-glyph-directory "gnus"))
525 (let ((logo (and gnus-xmas-glyph-directory
527 (file-name-as-directory gnus-xmas-glyph-directory)
529 (if (featurep 'xpm) "xpm" "xbm"))))
532 (append `(("thing" ,(car gnus-xmas-logo-colors))
533 ("shadow" ,(cadr gnus-xmas-logo-colors)))
534 xpm-color-symbols))))
535 (if (and (featurep 'xpm)
536 (not (equal (device-type) 'tty))
538 (file-exists-p logo))
540 (setq logo (make-glyph logo))
542 (set-extent-begin-glyph (make-extent (point) (point)) logo)
543 (goto-char (point-min))
545 (insert (make-string (/ (max (- (window-width) (or x 35)) 0) 2)
548 (goto-char (point-min))
549 (let* ((pheight (+ 20 (count-lines (point-min) (point-max))))
550 (wheight (window-height))
551 (rest (- wheight pheight)))
552 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n))))
557 _ ___ __ ___ __ _ ___
577 (gnus-indent-rigidly (point-min) (point-max)
578 (/ (max (- (window-width) (or x 46)) 0) 2))
579 (goto-char (point-min))
581 (let* ((pheight (count-lines (point-min) (point-max)))
582 (wheight (window-height))
583 (rest (- wheight pheight)))
584 (insert (make-string (max 0 (* 2 (/ rest 3))) ?\n))))
586 (goto-char (point-min))
587 (put-text-property (point-min) (point-max) 'face 'gnus-splash-face)
588 (goto-char (point-min))
589 (setq modeline-buffer-identification
590 (list (concat gnus-version ": *Group*")))
591 (set-buffer-modified-p t)))
596 (defvar gnus-use-toolbar (if (featurep 'toolbar)
599 "*If nil, do not use a toolbar.
600 If it is non-nil, it must be a toolbar. The five legal values are
601 `default-toolbar', `top-toolbar', `bottom-toolbar',
602 `right-toolbar', and `left-toolbar'.")
604 (defvar gnus-group-toolbar
605 '([gnus-group-get-new-news gnus-group-get-new-news t "Get new news"]
606 [gnus-group-get-new-news-this-group
607 gnus-group-get-new-news-this-group t "Get new news in this group"]
608 [gnus-group-catchup-current
609 gnus-group-catchup-current t "Catchup group"]
610 [gnus-group-describe-group
611 gnus-group-describe-group t "Describe group"]
612 [gnus-group-unsubscribe gnus-group-unsubscribe t "Unsubscribe group"]
613 [gnus-group-subscribe gnus-group-subscribe t "Subscribe group"]
614 [gnus-group-kill-group gnus-group-kill-group t "Kill group"]
615 [gnus-group-exit gnus-group-exit t "Exit Gnus"]
617 "The group buffer toolbar.")
619 (defvar gnus-summary-toolbar
620 '([gnus-summary-prev-unread
621 gnus-summary-prev-page-or-article t "Page up"]
622 [gnus-summary-next-unread
623 gnus-summary-next-page t "Page down"]
624 [gnus-summary-post-news
625 gnus-summary-post-news t "Post an article"]
626 [gnus-summary-followup-with-original
627 gnus-summary-followup-with-original t
628 "Post a followup and yank the original"]
629 [gnus-summary-followup
630 gnus-summary-followup t "Post a followup"]
631 [gnus-summary-reply-with-original
632 gnus-summary-reply-with-original t "Mail a reply and yank the original"]
634 gnus-summary-reply t "Mail a reply"]
635 [gnus-summary-caesar-message
636 gnus-summary-caesar-message t "Rot 13"]
638 gnus-uu-decode-uu t "Decode uuencoded articles"]
639 [gnus-summary-save-article-file
640 gnus-summary-save-article-file t "Save article in file"]
641 [gnus-summary-save-article
642 gnus-summary-save-article t "Save article"]
644 gnus-uu-post-news t "Post an uuencoded article"]
645 [gnus-summary-cancel-article
646 gnus-summary-cancel-article t "Cancel article"]
647 [gnus-summary-catchup
648 gnus-summary-catchup t "Catchup"]
649 [gnus-summary-catchup-and-exit
650 gnus-summary-catchup-and-exit t "Catchup and exit"]
651 [gnus-summary-exit gnus-summary-exit t "Exit this summary"]
653 "The summary buffer toolbar.")
655 (defvar gnus-summary-mail-toolbar
657 [gnus-summary-prev-unread
658 gnus-summary-prev-unread-article t "Prev unread article"]
659 [gnus-summary-next-unread
660 gnus-summary-next-unread-article t "Next unread article"]
661 [gnus-summary-mail-reply gnus-summary-reply t "Reply"]
662 ; [gnus-summary-mail-get gnus-mail-get t "Message get"]
663 [gnus-summary-mail-originate gnus-summary-post-news t "Originate"]
664 [gnus-summary-mail-save gnus-summary-save-article t "Save"]
665 [gnus-summary-mail-copy gnus-summary-copy-article t "Copy message"]
666 ; [gnus-summary-mail-delete gnus-summary-delete-article t "Delete message"]
667 [gnus-summary-mail-forward gnus-summary-mail-forward t "Forward message"]
668 ; [gnus-summary-mail-spell gnus-mail-spell t "Spell"]
669 ; [gnus-summary-mail-help gnus-mail-help t "Message help"]
670 [gnus-summary-caesar-message
671 gnus-summary-caesar-message t "Rot 13"]
673 gnus-uu-decode-uu t "Decode uuencoded articles"]
674 [gnus-summary-save-article-file
675 gnus-summary-save-article-file t "Save article in file"]
676 [gnus-summary-save-article
677 gnus-summary-save-article t "Save article"]
678 [gnus-summary-catchup
679 gnus-summary-catchup t "Catchup"]
680 [gnus-summary-catchup-and-exit
681 gnus-summary-catchup-and-exit t "Catchup and exit"]
682 [gnus-summary-exit gnus-summary-exit t "Exit this summary"]
684 "The summary buffer mail toolbar.")
686 (defun gnus-xmas-setup-group-toolbar ()
687 (and gnus-use-toolbar
688 (message-xmas-setup-toolbar gnus-group-toolbar nil "gnus")
689 (set-specifier (symbol-value gnus-use-toolbar)
690 (cons (current-buffer) gnus-group-toolbar))))
692 (defun gnus-xmas-setup-summary-toolbar ()
693 (let ((bar (if (gnus-news-group-p gnus-newsgroup-name)
694 gnus-summary-toolbar gnus-summary-mail-toolbar)))
695 (and gnus-use-toolbar
696 (message-xmas-setup-toolbar bar nil "gnus")
697 (set-specifier (symbol-value gnus-use-toolbar)
698 (cons (current-buffer) bar)))))
700 (defun gnus-xmas-mail-strip-quoted-names (address)
701 "Protect mail-strip-quoted-names from NIL input.
702 XEmacs compatibility workaround."
705 (mail-strip-quoted-names address)))
707 (defun gnus-xmas-call-region (command &rest args)
709 'call-process-region (point-min) (point-max) command t '(t nil) nil
712 (unless (find-face 'gnus-x-face)
713 (copy-face 'default 'gnus-x-face)
714 (set-face-foreground 'gnus-x-face "black")
715 (set-face-background 'gnus-x-face "white"))
717 (defun gnus-xmas-article-display-xface (beg end)
718 "Display any XFace headers in the current article."
721 (if (featurep 'xface)
723 (make-glyph (vector 'xface :data
725 (buffer-substring beg end)))))
726 (let ((cur (current-buffer)))
728 (gnus-set-work-buffer)
729 (insert (format "%s" (buffer-substring beg end cur)))
730 (gnus-xmas-call-region "uncompface")
731 (goto-char (point-min))
732 (insert "/* Width=48, Height=48 */\n")
733 (gnus-xmas-call-region "icontopbm")
734 (gnus-xmas-call-region "ppmtoxpm")
737 (vector 'xpm :data (buffer-string )))))))
738 (set-glyph-face xface-glyph 'gnus-x-face)
739 (goto-char (point-min))
740 (re-search-forward "^From:" nil t)
741 (set-extent-begin-glyph
742 (make-extent (point) (1+ (point))) xface-glyph))))
744 (defvar gnus-xmas-pointer-glyph
746 (setq gnus-xmas-glyph-directory (message-xmas-find-glyph-directory "gnus"))
747 (make-pointer-glyph (concat gnus-xmas-glyph-directory "gnus-pointer."
748 (if (featurep 'xpm) "xpm" "xbm")))))
750 (defvar gnus-xmas-modeline-left-extent
751 (let ((ext (copy-extent modeline-buffer-id-left-extent)))
752 ;(set-extent-property ext 'pointer gnus-xmas-pointer-glyph)
755 (defvar gnus-xmas-modeline-right-extent
756 (let ((ext (copy-extent modeline-buffer-id-right-extent)))
757 ;(set-extent-property ext 'pointer gnus-xmas-pointer-glyph)
760 (defvar gnus-xmas-modeline-glyph
762 (setq gnus-xmas-glyph-directory (message-xmas-find-glyph-directory "gnus"))
763 (let* ((file (concat gnus-xmas-glyph-directory "gnus-pointer."
764 (if (featurep 'xpm) "xpm" "xbm")))
765 (glyph (make-glyph file)))
766 (when (and (featurep 'x)
767 (file-exists-p file))
768 (set-glyph-face glyph 'modeline-buffer-id)
769 (set-glyph-property glyph 'image (cons 'tty "Gnus:"))
772 (defun gnus-xmas-mode-line-buffer-identification (line)
773 (let ((line (car line))
776 ;; This is some weird type of id.
777 ((not (stringp line))
779 ;; This is non-standard, so we just pass it through.
780 ((not (string-match "^Gnus:" line))
782 ;; We have a standard line, so we colorize and glyphize it a bit.
784 (setq chop (match-end 0))
786 (if gnus-xmas-modeline-glyph
787 (cons gnus-xmas-modeline-left-extent gnus-xmas-modeline-glyph)
788 (cons gnus-xmas-modeline-left-extent (substring line 0 chop)))
789 (cons gnus-xmas-modeline-right-extent (substring line chop)))))))
791 (defun gnus-xmas-splash ()
792 (when (eq (device-type) 'x)
797 ;;; gnus-xmas.el ends here