annotate lisp/gnus/gnus-ems.el @ 91879:681edb478662

*** empty log message ***
author Eli Zaretskii <eliz@gnu.org>
date Sat, 16 Feb 2008 17:05:24 +0000
parents 107ccd98fa12
children 606f2d163a64 2ca2b5f1a567
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
1 ;;; gnus-ems.el --- functions for making Gnus work under different Emacsen
64754
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
2
fafd692d1e40 Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64085
diff changeset
3 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
79708
1cb31606209f Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 79313
diff changeset
4 ;; 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
5
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 20118
diff changeset
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
7 ;; Keywords: news
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
8
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
10
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
78224
24202b793a08 Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents: 78013
diff changeset
13 ;; the Free Software Foundation; either version 3, or (at your option)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
14 ;; any later version.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
15
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
20
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64085
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 56927
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18a818a2ee7c Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 56927
diff changeset
24 ;; Boston, MA 02110-1301, USA.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
25
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
26 ;;; Commentary:
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
27
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
28 ;;; Code:
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
29
33814
2be7e99127e5 Require ring when compiling.
Dave Love <fx@gnu.org>
parents: 32939
diff changeset
30 (eval-when-compile
2be7e99127e5 Require ring when compiling.
Dave Love <fx@gnu.org>
parents: 32939
diff changeset
31 (require 'cl)
2be7e99127e5 Require ring when compiling.
Dave Love <fx@gnu.org>
parents: 32939
diff changeset
32 (require 'ring))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
33
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
34 ;;; Function aliases later to be redefined for XEmacs usage.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
35
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
36 (defvar gnus-mouse-2 [mouse-2])
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
37 (defvar gnus-down-mouse-3 [down-mouse-3])
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
38 (defvar gnus-down-mouse-2 [down-mouse-2])
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
39 (defvar gnus-widget-button-keymap nil)
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
40 (defvar gnus-mode-line-modified
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
41 (if (featurep 'xemacs)
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
42 '("--**-" . "-----")
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
43 '("**" "--")))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
44
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
45 (eval-and-compile
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
46 (autoload 'gnus-xmas-define "gnus-xmas")
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
47 (autoload 'gnus-xmas-redefine "gnus-xmas")
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
48 (autoload 'gnus-get-buffer-create "gnus")
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
49 (autoload 'nnheader-find-etc-directory "nnheader"))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
50
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
51 (autoload 'smiley-region "smiley")
32920
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
52
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
53 (defun gnus-kill-all-overlays ()
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
54 "Delete all overlays in the current buffer."
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
55 (let* ((overlayss (overlay-lists))
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
56 (buffer-read-only nil)
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
57 (overlays (delq nil (nconc (car overlayss) (cdr overlayss)))))
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
58 (while overlays
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
59 (delete-overlay (pop overlays)))))
31780
d2b5643aab16 (gnus-smiley-display): Autoload from smiley-ems.
Dave Love <fx@gnu.org>
parents: 31767
diff changeset
60
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
61 ;;; Mule functions.
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
62
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
63 (defun gnus-mule-max-width-function (el max-width)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
64 `(let* ((val (eval (, el)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
65 (valstr (if (numberp val)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
66 (int-to-string val) val)))
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
67 (if (> (length valstr) ,max-width)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
68 (truncate-string-to-width valstr ,max-width)
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
69 valstr)))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 20118
diff changeset
70
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
71 (eval-and-compile
32920
5b203c66fa7b 2000-10-08 08:57:13 ShengHuo ZHU <zsh@cs.rochester.edu>
Dave Love <fx@gnu.org>
parents: 32139
diff changeset
72 (if (featurep 'xemacs)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
73 (gnus-xmas-define)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
74 (defvar gnus-mouse-face-prop 'mouse-face
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
75 "Property used for highlighting mouse regions.")))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
76
86154
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
77 (defvar gnus-tmp-unread)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
78 (defvar gnus-tmp-replied)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
79 (defvar gnus-tmp-score-char)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
80 (defvar gnus-tmp-indentation)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
81 (defvar gnus-tmp-opening-bracket)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
82 (defvar gnus-tmp-lines)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
83 (defvar gnus-tmp-name)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
84 (defvar gnus-tmp-closing-bracket)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
85 (defvar gnus-tmp-subject-or-nil)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
86 (defvar gnus-check-before-posting)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
87 (defvar gnus-mouse-face)
1cdfc94602cb * smime.el (from):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85888
diff changeset
88 (defvar gnus-group-buffer)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
89
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
90 (defun gnus-ems-redefine ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
91 (cond
32939
c8119677d63e Use (featurep 'xemacs) instead of the `gnus-xemacs' variable, as the
Miles Bader <miles@gnu.org>
parents: 32920
diff changeset
92 ((featurep 'xemacs)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
93 (gnus-xmas-redefine))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
94
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
95 ((featurep 'mule)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
96 ;; Mule and new Emacs definitions
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
97
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
98 ;; [Note] Now there are three kinds of mule implementations,
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
99 ;; original MULE, XEmacs/mule and Emacs 20+ including
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
100 ;; MULE features. Unfortunately these APIs are different. In
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
101 ;; particular, Emacs (including original Mule) and XEmacs are
44532
b94ae378e07c (gnus-ems-redefine): Fix typo in comment.
Juanma Barranquero <lekktu@gmail.com>
parents: 39483
diff changeset
102 ;; quite different. However, this version of Gnus doesn't support
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
103 ;; anything other than XEmacs 20+ and Emacs 20.3+.
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
104
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
105 ;; Predicates to check are following:
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
106 ;; (boundp 'MULE) is t only if Mule (original; anything older than
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
107 ;; Mule 2.3) is running.
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
108 ;; (featurep 'mule) is t when other mule variants are running.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
109
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
110 ;; It is possible to detect XEmacs/mule by (featurep 'mule) and
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
111 ;; (featurep 'xemacs). In this case, the implementation for
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
112 ;; XEmacs/mule may be shareable between XEmacs and XEmacs/mule.
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
113
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
114 (defvar gnus-summary-display-table nil
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
115 "Display table used in summary mode buffers.")
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
116 (defalias 'gnus-max-width-function 'gnus-mule-max-width-function)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
117
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
118 (when (boundp 'gnus-check-before-posting)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
119 (setq gnus-check-before-posting
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
120 (delq 'long-lines
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
121 (delq 'control-chars gnus-check-before-posting))))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
122
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
123 (defun gnus-summary-line-format-spec ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
124 (insert gnus-tmp-unread gnus-tmp-replied
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
125 gnus-tmp-score-char gnus-tmp-indentation)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
126 (put-text-property
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
127 (point)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
128 (progn
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
129 (insert
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
130 gnus-tmp-opening-bracket
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
131 (format "%4d: %-20s"
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
132 gnus-tmp-lines
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
133 (if (> (length gnus-tmp-name) 20)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
134 (truncate-string-to-width gnus-tmp-name 20)
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
135 gnus-tmp-name))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
136 gnus-tmp-closing-bracket)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
137 (point))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
138 gnus-mouse-face-prop gnus-mouse-face)
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
139 (insert " " gnus-tmp-subject-or-nil "\n")))))
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
140
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
141 ;; Clone of `appt-select-lowest-window' in appt.el.
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
142 (defun gnus-select-lowest-window ()
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
143 "Select the lowest window on the frame."
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
144 (let ((lowest-window (selected-window))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
145 (bottom-edge (nth 3 (window-edges))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
146 (walk-windows (lambda (w)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
147 (let ((next-bottom-edge (nth 3 (window-edges w))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
148 (when (< bottom-edge next-bottom-edge)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
149 (setq bottom-edge next-bottom-edge
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
150 lowest-window w)))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
151 (select-window lowest-window)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
152
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
153 (defun gnus-region-active-p ()
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
154 "Say whether the region is active."
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
155 (and (boundp 'transient-mark-mode)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
156 transient-mark-mode
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
157 (boundp 'mark-active)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
158 mark-active))
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
159
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
160 (defun gnus-mark-active-p ()
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
161 "Non-nil means the mark and region are currently active in this buffer."
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
162 mark-active) ; aliased to region-exists-p in XEmacs.
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
163
87252
a48038ce7d61 (gnus-alive-p): Autoload.
Glenn Morris <rgm@gnu.org>
parents: 86154
diff changeset
164 (autoload 'gnus-alive-p "gnus-util")
19969
5f1ab3dd344d *** empty log message ***
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 17493
diff changeset
165
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 20118
diff changeset
166 (defun gnus-x-splash ()
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 20118
diff changeset
167 "Show a splash screen using a pixmap in the current buffer."
78006
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
168 (interactive)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
169 (unless window-system
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
170 (error "`gnus-x-splash' requires running on the window system"))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
171 (switch-to-buffer (gnus-get-buffer-create (if (or (gnus-alive-p)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
172 (interactive-p))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
173 "*gnus-x-splash*"
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
174 gnus-group-buffer)))
78546
28c0174177f4 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 78224
diff changeset
175 (let ((inhibit-read-only t)
78006
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
176 (file (nnheader-find-etc-directory "images/gnus/x-splash" t))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
177 pixmap fcw fch width height fringes sbars left yoffset top ls)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
178 (erase-buffer)
78013
9db7ff557d0e Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 78006
diff changeset
179 (sit-for 0) ;; Necessary for measuring the window size correctly.
78006
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
180 (when (and file
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
181 (ignore-errors
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
182 (let ((coding-system-for-read 'raw-text)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
183 default-enable-multibyte-characters)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
184 (with-temp-buffer
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
185 (insert-file-contents file)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
186 (goto-char (point-min))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
187 (setq pixmap (read (current-buffer)))))))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
188 (setq fcw (float (frame-char-width))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
189 fch (float (frame-char-height))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
190 width (/ (car pixmap) fcw)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
191 height (/ (cadr pixmap) fch)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
192 fringes (if (fboundp 'window-fringes)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
193 (eval '(window-fringes))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
194 '(10 11 nil))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
195 sbars (frame-parameter nil 'vertical-scroll-bars))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
196 (cond ((eq sbars 'right)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
197 (setq sbars
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
198 (cons 0 (/ (or (frame-parameter nil 'scroll-bar-width) 14)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
199 fcw))))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
200 (sbars
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
201 (setq sbars
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
202 (cons (/ (or (frame-parameter nil 'scroll-bar-width) 14)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
203 fcw)
79313
f4c90d55f00f Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
204 0)))
f4c90d55f00f Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
205 (t
f4c90d55f00f Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
206 (setq sbars '(0 . 0))))
78006
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
207 (setq left (- (* (round (/ (1- (/ (+ (window-width)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
208 (car sbars) (cdr sbars)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
209 (/ (+ (or (car fringes) 0)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
210 (or (cadr fringes) 0))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
211 fcw))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
212 width))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
213 2))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
214 width)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
215 (car sbars)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
216 (/ (or (car fringes) 0) fcw))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
217 yoffset (cadr (window-edges))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
218 top (max 0 (- (* (max (if (and tool-bar-mode
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
219 (not (featurep 'gtk))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
220 (eq (frame-first-window)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
221 (selected-window)))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
222 1 0)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
223 (round (/ (1- (/ (+ (1- (window-height))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
224 (* 2 yoffset))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
225 height))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
226 2)))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
227 height)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
228 yoffset))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
229 ls (/ (or line-spacing 0) fch)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
230 height (max 0 (- height ls)))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
231 (cond ((>= (- top ls) 1)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
232 (insert
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
233 (propertize
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
234 " "
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
235 'display `(space :width 0 :ascent 100))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
236 "\n"
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
237 (propertize
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
238 " "
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
239 'display `(space :width 0 :height ,(- top ls 1) :ascent 100))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
240 "\n"))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
241 ((> (- top ls) 0)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
242 (insert
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
243 (propertize
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
244 " "
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
245 'display `(space :width 0 :height ,(- top ls) :ascent 100))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
246 "\n")))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
247 (if (and (> width 0) (> left 0))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
248 (insert (propertize
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
249 " "
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
250 'display `(space :width ,left :height ,height :ascent 0)))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
251 (setq width (+ width left)))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
252 (when (> width 0)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
253 (insert (propertize
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
254 " "
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
255 'display `(space :width ,width :height ,height :ascent 0)
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
256 'face `(gnus-splash :stipple ,pixmap))))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
257 (goto-char (if (<= (- top ls) 0) (1- (point)) (point-min)))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
258 (redraw-frame (selected-frame))
a8c400af8ac9 Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 75347
diff changeset
259 (sit-for 0))))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 20118
diff changeset
260
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
261 ;;; Image functions.
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
262
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
263 (defun gnus-image-type-available-p (type)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
264 (and (fboundp 'image-type-available-p)
74984
21f28d10d73a Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
265 (image-type-available-p type)
21f28d10d73a Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
266 (if (fboundp 'display-images-p)
21f28d10d73a Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
267 (display-images-p)
21f28d10d73a Merge from gnus--rel--5.10
Miles Bader <miles@gnu.org>
parents: 68633
diff changeset
268 t)))
32139
6d8322cfbf71 Don't turn off compiler warnings in local vars.
Dave Love <fx@gnu.org>
parents: 31802
diff changeset
269
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
270 (defun gnus-create-image (file &optional type data-p &rest props)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
271 (let ((face (plist-get props :face)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
272 (when face
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
273 (setq props (plist-put props :foreground (face-foreground face)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
274 (setq props (plist-put props :background (face-background face))))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
275 (apply 'create-image file type data-p props)))
31716
9968f55ad26e Update to emacs-21-branch of the Gnus CVS repository.
Gerd Moellmann <gerd@gnu.org>
parents: 24357
diff changeset
276
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
277 (defun gnus-put-image (glyph &optional string category)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
278 (let ((point (point)))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
279 (insert-image glyph (or string " "))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
280 (put-text-property point (point) 'gnus-image-category category)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
281 (unless string
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
282 (put-text-property (1- (point)) (point)
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
283 'gnus-image-text-deletable t))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
284 glyph))
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
285
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
286 (defun gnus-remove-image (image &optional category)
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
287 "Remove the image matching IMAGE and CATEGORY found first."
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
288 (let ((start (point-min))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
289 val end)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
290 (while (and (not end)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
291 (or (setq val (get-text-property start 'display))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
292 (and (setq start
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
293 (next-single-property-change start 'display))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
294 (setq val (get-text-property start 'display)))))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
295 (setq end (or (next-single-property-change start 'display)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
296 (point-max)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
297 (if (and (equal val image)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
298 (equal (get-text-property start 'gnus-image-category)
56927
55fd4f77387a Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-523
Miles Bader <miles@gnu.org>
parents: 52401
diff changeset
299 category))
85712
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
300 (progn
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
301 (put-text-property start end 'display nil)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
302 (when (get-text-property start 'gnus-image-text-deletable)
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
303 (delete-region start end)))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
304 (unless (= end (point-max))
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
305 (setq start end
a3c27999decb Update Gnus to No Gnus 0.7 from the Gnus CVS trunk
Miles Bader <miles@gnu.org>
parents: 78546
diff changeset
306 end nil))))))
24357
15fc6acbae7a Upgrading to Gnus 5.7; see ChangeLog
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents: 20118
diff changeset
307
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
308 (provide 'gnus-ems)
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
309
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 45956
diff changeset
310 ;;; arch-tag: e7360b45-14b5-4171-aa39-69a44aed3cdb
17493
e6935c08cf0b Initial revision
Lars Magne Ingebrigtsen <larsi@gnus.org>
parents:
diff changeset
311 ;;; gnus-ems.el ends here