1 ;;; gnus-spec.el --- format spec functions for Gnus
3 ;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006, 2007, 2008 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 3, 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., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
32 (unless (fboundp 'declare-function
) (defmacro declare-function
(&rest r
))))
33 (eval-when-compile (require 'cl
))
34 (defvar gnus-newsrc-file-version
)
38 (defcustom gnus-use-correct-string-widths
(featurep 'xemacs
)
39 "*If non-nil, use correct functions for dealing with wide characters."
44 (defcustom gnus-make-format-preserve-properties
(featurep 'xemacs
)
45 "*If non-nil, use a replacement `format' function which preserves
46 text properties. This is only needed on XEmacs, as FSF Emacs does this anyway."
51 ;;; Internal variables.
53 (defvar gnus-summary-mark-positions nil
)
54 (defvar gnus-group-mark-positions nil
)
55 (defvar gnus-group-indentation
"")
57 ;; Format specs. The chunks below are the machine-generated forms
58 ;; that are to be evaled as the result of the default format strings.
59 ;; We write them in here to get them byte-compiled. That way the
60 ;; default actions will be quite fast, while still retaining the full
61 ;; flexibility of the user-defined format specs.
63 ;; First we have lots of dummy defvars to let the compiler know these
64 ;; are really dynamic variables.
66 (defvar gnus-tmp-unread
)
67 (defvar gnus-tmp-replied
)
68 (defvar gnus-tmp-score-char
)
69 (defvar gnus-tmp-indentation
)
70 (defvar gnus-tmp-opening-bracket
)
71 (defvar gnus-tmp-lines
)
72 (defvar gnus-tmp-name
)
73 (defvar gnus-tmp-closing-bracket
)
74 (defvar gnus-tmp-subject-or-nil
)
75 (defvar gnus-tmp-subject
)
76 (defvar gnus-tmp-marked
)
77 (defvar gnus-tmp-marked-mark
)
78 (defvar gnus-tmp-subscribed
)
79 (defvar gnus-tmp-process-marked
)
80 (defvar gnus-tmp-number-of-unread
)
81 (defvar gnus-tmp-group-name
)
82 (defvar gnus-tmp-group
)
83 (defvar gnus-tmp-article-number
)
84 (defvar gnus-tmp-unread-and-unselected
)
85 (defvar gnus-tmp-news-method
)
86 (defvar gnus-tmp-news-server
)
87 (defvar gnus-tmp-article-number
)
88 (defvar gnus-mouse-face
)
89 (defvar gnus-mouse-face-prop
)
90 (defvar gnus-tmp-header
)
91 (defvar gnus-tmp-from
)
93 (declare-function gnus-summary-from-or-to-or-newsgroups
"gnus-sum"
94 (header gnus-tmp-from
))
96 (defun gnus-summary-line-format-spec ()
97 (insert gnus-tmp-unread gnus-tmp-replied
98 gnus-tmp-score-char gnus-tmp-indentation
)
99 (gnus-put-text-property
103 (format "%c%4s: %-23s%c" gnus-tmp-opening-bracket gnus-tmp-lines
106 (gnus-summary-from-or-to-or-newsgroups
107 gnus-tmp-header gnus-tmp-from
))))
108 (if (> (length val
) 23)
111 gnus-tmp-closing-bracket
))
113 gnus-mouse-face-prop gnus-mouse-face
)
114 (insert " " gnus-tmp-subject-or-nil
"\n"))
116 (defvar gnus-summary-line-format-spec
117 (gnus-byte-code 'gnus-summary-line-format-spec
))
119 (defun gnus-summary-dummy-line-format-spec ()
121 (gnus-put-text-property
126 gnus-mouse-face-prop gnus-mouse-face
)
127 (insert " " gnus-tmp-subject
"\n"))
129 (defvar gnus-summary-dummy-line-format-spec
130 (gnus-byte-code 'gnus-summary-dummy-line-format-spec
))
132 (defun gnus-group-line-format-spec ()
133 (insert gnus-tmp-marked-mark gnus-tmp-subscribed
134 gnus-tmp-process-marked
135 gnus-group-indentation
136 (format "%5s: " gnus-tmp-number-of-unread
))
137 (gnus-put-text-property
140 (insert gnus-tmp-group
"\n")
142 gnus-mouse-face-prop gnus-mouse-face
))
143 (defvar gnus-group-line-format-spec
144 (gnus-byte-code 'gnus-group-line-format-spec
))
146 (defvar gnus-format-specs
147 `((version .
,emacs-version
)
148 (gnus-version .
,(gnus-continuum-version))
149 (group "%M\%S\%p\%P\%5y: %(%g%)\n" ,gnus-group-line-format-spec
)
150 (summary-dummy "* %(: :%) %S\n"
151 ,gnus-summary-dummy-line-format-spec
)
152 (summary "%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n"
153 ,gnus-summary-line-format-spec
))
154 "Alist of format specs.")
156 (defvar gnus-default-format-specs gnus-format-specs
)
158 (defvar gnus-article-mode-line-format-spec nil
)
159 (defvar gnus-summary-mode-line-format-spec nil
)
160 (defvar gnus-group-mode-line-format-spec nil
)
162 ;;; Phew. All that gruft is over with, fortunately.
165 (defun gnus-update-format (var)
166 "Update the format specification near point."
171 ;; Find the end of the current word.
172 (re-search-forward "[ \t\n]" nil t
)
174 (when (re-search-backward "\\(gnus-[-a-z]+-line-format\\)" nil t
)
176 (let* ((type (intern (progn (string-match "gnus-\\([-a-z]+\\)-line" var
)
177 (match-string 1 var
))))
178 (entry (assq type gnus-format-specs
))
181 (setq gnus-format-specs
(delq entry gnus-format-specs
)))
183 (intern (format "%s-spec" var
))
184 (gnus-parse-format (setq value
(symbol-value (intern var
)))
185 (symbol-value (intern (format "%s-alist" var
)))
186 (not (string-match "mode" var
))))
187 (setq spec
(symbol-value (intern (format "%s-spec" var
))))
188 (push (list type value spec
) gnus-format-specs
)
190 (pop-to-buffer "*Gnus Format*")
192 (lisp-interaction-mode)
193 (insert (gnus-pp-to-string spec
))))
195 (defun gnus-update-format-specifications (&optional force
&rest types
)
196 "Update all (necessary) format specifications.
197 Return a list of updated types."
198 ;; Make the indentation array.
199 ;; See whether all the stored info needs to be flushed.
201 (not gnus-newsrc-file-version
)
202 (not (equal (gnus-continuum-version)
203 (gnus-continuum-version gnus-newsrc-file-version
)))
204 (not (equal emacs-version
205 (cdr (assq 'version gnus-format-specs
)))))
206 (setq gnus-format-specs nil
))
207 ;; Flush the group format spec cache if there's the grouplens stuff
208 ;; or it doesn't support decoded group names.
209 (when (memq 'group types
)
210 (let* ((spec (assq 'group gnus-format-specs
))
211 (sspec (gnus-prin1-to-string (nth 2 spec
))))
212 (when (or (string-match " gnus-tmp-grouplens[ )]" sspec
)
213 (not (string-match " gnus-tmp-decoded-group[ )]" sspec
)))
214 (setq gnus-format-specs
(delq spec gnus-format-specs
)))))
216 ;; Go through all the formats and see whether they need updating.
217 (let (new-format entry type val updated
)
218 (while (setq type
(pop types
))
219 ;; Jump to the proper buffer to find out the value of the
220 ;; variable, if possible. (It may be buffer-local.)
222 (let ((buffer (intern (format "gnus-%s-buffer" type
))))
223 (when (and (boundp buffer
)
224 (setq val
(symbol-value buffer
))
225 (gnus-buffer-exists-p val
))
227 (setq new-format
(symbol-value
228 (intern (format "gnus-%s-line-format" type
)))))
229 (setq entry
(cdr (assq type gnus-format-specs
)))
231 (equal (car entry
) new-format
))
232 ;; Use the old format.
233 (set (intern (format "gnus-%s-line-format-spec" type
))
235 ;; This is a new format.
237 (if (not (stringp new-format
))
238 ;; This is a function call or something.
240 ;; This is a "real" format.
244 (intern (format "gnus-%s-line-format-alist" type
)))
245 (not (string-match "mode$" (symbol-name type
))))))
246 ;; Enter the new format spec into the list.
249 (setcar (cdr entry
) val
)
250 (setcar entry new-format
))
251 (push (list type new-format val
) gnus-format-specs
))
252 (set (intern (format "gnus-%s-line-format-spec" type
)) val
)
253 (push type updated
))))
255 (unless (assq 'version gnus-format-specs
)
256 (push (cons 'version emacs-version
) gnus-format-specs
))
259 (defvar gnus-mouse-face-0
'highlight
)
260 (defvar gnus-mouse-face-1
'highlight
)
261 (defvar gnus-mouse-face-2
'highlight
)
262 (defvar gnus-mouse-face-3
'highlight
)
263 (defvar gnus-mouse-face-4
'highlight
)
265 (defun gnus-mouse-face-function (form type
)
266 `(gnus-put-text-property
267 (point) (progn ,@form
(point))
271 `(quote ,(symbol-value (intern (format "gnus-mouse-face-%d" type
)))))))
273 (defvar gnus-face-0
'bold
)
274 (defvar gnus-face-1
'italic
)
275 (defvar gnus-face-2
'bold-italic
)
276 (defvar gnus-face-3
'bold
)
277 (defvar gnus-face-4
'bold
)
279 (defun gnus-face-face-function (form type
)
280 `(gnus-add-text-properties
281 (point) (progn ,@form
(point))
282 '(gnus-face t face
,(symbol-value (intern (format "gnus-face-%d" type
))))))
284 (defun gnus-balloon-face-function (form type
)
285 `(gnus-put-text-property
286 (point) (progn ,@form
(point))
287 ,(if (fboundp 'balloon-help-mode
)
290 ,(intern (format "gnus-balloon-face-%d" type
))))
292 (defun gnus-spec-tab (column)
294 `(insert-char ?
(max (- ,column
(current-column)) 0))
295 (let ((column (abs column
)))
296 `(if (> (current-column) ,column
)
298 (if (= (move-to-column ,column
) ,column
)
299 (delete-region (point) end
)
300 (delete-region (1- (point)) end
)
302 (insert-char ?
(max (- ,column
(current-column)) 0))))))
304 (defun gnus-correct-length (string)
305 "Return the correct width of STRING."
306 (apply #'+ (mapcar #'char-width string
)))
308 (defun gnus-correct-substring (string start
&optional end
)
313 (length (length string
))
314 (string (concat string
"\0")))
315 ;; Find the start position.
316 (while (and (< seek length
)
318 (incf wseek
(char-width (aref string seek
)))
321 ;; Find the end position.
322 (while (and (<= seek length
)
325 (incf wseek
(char-width (aref string seek
)))
328 (substring string wstart
(1- wend
))))
330 (defun gnus-string-width-function ()
332 (gnus-use-correct-string-widths
333 'gnus-correct-length
)
334 ((fboundp 'string-width
)
339 (defun gnus-substring-function ()
341 (gnus-use-correct-string-widths
342 'gnus-correct-substring
)
343 ((fboundp 'string-width
)
344 'gnus-correct-substring
)
348 (defun gnus-tilde-max-form (el max-width
)
349 "Return a form that limits EL to MAX-WIDTH."
350 (let ((max (abs max-width
))
351 (length-fun (gnus-string-width-function))
352 (substring-fun (gnus-substring-function)))
354 `(if (> (,length-fun
,el
) ,max
)
356 `(,substring-fun
,el
(- (,length-fun
,el
) ,max
))
357 `(,substring-fun
,el
0 ,max
))
359 `(let ((val (eval ,el
)))
360 (if (> (,length-fun val
) ,max
)
362 `(,substring-fun val
(- (,length-fun val
) ,max
))
363 `(,substring-fun val
0 ,max
))
366 (defun gnus-tilde-cut-form (el cut-width
)
367 "Return a form that cuts CUT-WIDTH off of EL."
368 (let ((cut (abs cut-width
))
369 (length-fun (gnus-string-width-function))
370 (substring-fun (gnus-substring-function)))
372 `(if (> (,length-fun
,el
) ,cut
)
374 `(,substring-fun
,el
0 (- (,length-fun
,el
) ,cut
))
375 `(,substring-fun
,el
,cut
))
377 `(let ((val (eval ,el
)))
378 (if (> (,length-fun val
) ,cut
)
380 `(,substring-fun val
0 (- (,length-fun val
) ,cut
))
381 `(,substring-fun val
,cut
))
384 (defun gnus-tilde-ignore-form (el ignore-value
)
385 "Return a form that is blank when EL is IGNORE-VALUE."
387 `(if (equal ,el
,ignore-value
)
389 `(let ((val (eval ,el
)))
390 (if (equal val
,ignore-value
)
393 (defun gnus-pad-form (el pad-width
)
394 "Return a form that pads EL to PAD-WIDTH accounting for multi-column
395 characters correctly. This is because `format' may pad to columns or to
396 characters when given a pad value."
397 (let ((pad (abs pad-width
))
398 (side (< 0 pad-width
))
399 (length-fun (gnus-string-width-function)))
401 `(let ((need (- ,pad
(,length-fun
,el
))))
403 (concat ,(when side
'(make-string need ?\
))
405 ,(when (not side
) '(make-string need ?\
)))
407 `(let* ((val (eval ,el
))
408 (need (- ,pad
(,length-fun val
))))
410 (concat ,(when side
'(make-string need ?\
))
412 ,(when (not side
) '(make-string need ?\
)))
415 (defun gnus-parse-format (format spec-alist
&optional insert
)
416 ;; This function parses the FORMAT string with the help of the
417 ;; SPEC-ALIST and returns a list that can be eval'ed to return the
418 ;; string. If the FORMAT string contains the specifiers %( and %)
419 ;; the text between them will have the mouse-face text property.
420 ;; If the FORMAT string contains the specifiers %[ and %], the text between
421 ;; them will have the balloon-help text property.
422 (let ((case-fold-search nil
))
424 "\\`\\(.*\\)%[0-9]?[{(«]\\(.*\\)%[0-9]?[»})]\\(.*\n?\\)\\'\\|%[-0-9]*=\\|%[-0-9]*\\*"
426 (gnus-parse-complex-format format spec-alist
)
427 ;; This is a simple format.
428 (gnus-parse-simple-format format spec-alist insert
))))
430 (defun gnus-parse-complex-format (format spec-alist
)
431 (let ((cursor-spec nil
))
433 (gnus-set-work-buffer)
435 (goto-char (point-min))
436 (while (re-search-forward "\"" nil t
)
437 (replace-match "\\\"" nil t
))
438 (goto-char (point-min))
440 ;; Convert all font specs into font spec lists.
441 (while (re-search-forward "%\\([0-9]+\\)?\\([«»{}()]\\)" nil t
)
442 (let ((number (if (match-beginning 1)
443 (match-string 1) "0"))
444 (delim (aref (match-string 2) 0)))
445 (if (or (= delim ?\
()
448 (replace-match (concat "\"("
449 (cond ((= delim ?\
() "mouse")
450 ((= delim ?\
{) "face")
454 (replace-match "\")\""))))
455 (goto-char (point-max))
457 ;; Convert point position commands.
458 (goto-char (point-min))
459 (let ((case-fold-search nil
))
460 (while (re-search-forward "%\\([-0-9]+\\)?\\*" nil t
)
461 (replace-match "\"(point)\"" t t
)
462 (setq cursor-spec t
)))
463 ;; Convert TAB commands.
464 (goto-char (point-min))
465 (while (re-search-forward "%\\([-0-9]+\\)=" nil t
)
466 (replace-match (format "\"(tab %s)\"" (match-string 1)) t t
))
467 ;; Convert the buffer into the spec.
468 (goto-char (point-min))
469 (let ((form (read (current-buffer))))
471 `(let (gnus-position)
472 ,@(gnus-complex-form-to-spec form spec-alist
)
474 (gnus-put-text-property gnus-position
(1+ gnus-position
)
477 ,@(gnus-complex-form-to-spec form spec-alist
)))))))
479 (defun gnus-complex-form-to-spec (form spec-alist
)
485 (gnus-parse-simple-format sform spec-alist t
))
486 ((eq (car sform
) 'point
)
487 '(setq gnus-position
(point)))
488 ((eq (car sform
) 'tab
)
489 (gnus-spec-tab (cadr sform
)))
491 (funcall (intern (format "gnus-%s-face-function" (car sform
)))
492 (gnus-complex-form-to-spec (cddr sform
) spec-alist
)
497 (defun gnus-xmas-format (fstring &rest args
)
498 "A version of `format' which preserves text properties.
500 Required for XEmacs, where the built in `format' function strips all text
501 properties from both the format string and any inserted strings.
503 Only supports the format sequence %s, and %% for inserting
504 literal % characters. A pad width and an optional - (to right pad)
505 are supported for %s."
506 (let ((re "%%\\|%\\(-\\)?\\([1-9][0-9]*\\)?s")
510 (goto-char (point-min))
511 (while (re-search-forward re nil t
)
512 (goto-char (match-end 0))
514 ((string= (match-string 0) "%%")
518 (error 'wrong-number-of-arguments
#'my-format n fstring
))
519 (let* ((minlen (string-to-number (or (match-string 2) "")))
521 (str (if (stringp arg
) arg
(format "%s" arg
)))
522 (lpad (null (match-string 1)))
523 (padlen (max 0 (- minlen
(length str
)))))
525 (if lpad
(insert-char ?\ padlen
))
527 (unless lpad
(insert-char ?\ padlen
))
528 (setq args
(cdr args
))))))
531 (defun gnus-parse-simple-format (format spec-alist
&optional insert
)
532 ;; This function parses the FORMAT string with the help of the
533 ;; SPEC-ALIST and returns a list that can be eval'ed to return a
536 spec flist fstring elem result dontinsert user-defined
537 type value pad-width spec-beg cut-width ignore-value
538 tilde-form tilde elem-type extended-spec
)
540 (gnus-set-work-buffer)
542 (goto-char (point-min))
543 (while (re-search-forward "%" nil t
)
544 (setq user-defined nil
552 (setq spec-beg
(1- (point)))
554 ;; Parse this spec fully.
557 ((looking-at "\\([-.0-9]+\\)\\(,[-0-9]+\\)?")
558 (setq pad-width
(string-to-number (match-string 1)))
559 (when (match-beginning 2)
560 (setq max-width
(string-to-number (buffer-substring
561 (1+ (match-beginning 2))
563 (goto-char (match-end 0)))
566 (setq tilde
(read (current-buffer))
570 ((memq type
'(pad pad-left
))
571 (setq pad-width value
))
572 ((eq type
'pad-right
)
573 (setq pad-width
(- value
)))
574 ((memq type
'(max-right max
))
575 (setq max-width value
))
577 (setq max-width
(- value
)))
578 ((memq type
'(cut cut-left
))
579 (setq cut-width value
))
580 ((eq type
'cut-right
)
581 (setq cut-width
(- value
)))
584 (if (stringp value
) value
(format "%s" value
))))
586 (setq tilde-form value
))
588 (error "Unknown tilde type: %s" tilde
)))
593 ;; User-defined spec -- find the spec name.
594 ((eq (setq spec
(char-after)) ?u
)
596 (when (and (eq (setq user-defined
(char-after)) ?
&)
597 (looking-at "&\\([^;]+\\);"))
598 (setq user-defined
(match-string 1))
599 (goto-char (match-end 1))))
601 ((and (eq spec ?
&) (looking-at "&\\([^;]+\\);"))
602 (setq extended-spec
(intern (match-string 1)))
603 (goto-char (match-end 1))))
605 (delete-region spec-beg
(point))
607 ;; Now we have all the relevant data on this spec, so
608 ;; we start doing stuff.
611 ;; "%%" just results in a "%".
616 (setq elem
(list tilde-form ?s
)))
617 ;; Treat user defined format specifiers specially.
621 (list (intern (format
622 (if (stringp user-defined
)
623 "gnus-user-format-function-%s"
624 "gnus-user-format-function-%c")
628 ;; Find the specification from `spec-alist'.
629 ((setq elem
(cdr (assq (or extended-spec spec
) spec-alist
))))
630 ;; We used to use "%l" for displaying the grouplens score.
632 (setq elem
'("" ?s
)))
634 (setq elem
'("*" ?s
))))
635 (setq elem-type
(cadr elem
))
636 ;; Insert the new format elements.
638 (not (and (featurep 'xemacs
)
639 gnus-use-correct-string-widths
)))
640 (insert (number-to-string pad-width
)))
641 ;; Create the form to be evaled.
642 (if (or max-width cut-width ignore-value
643 (and (featurep 'xemacs
)
644 gnus-use-correct-string-widths
))
647 (let ((el (car elem
)))
648 (cond ((= (cadr elem
) ?c
)
649 (setq el
(list 'char-to-string el
)))
651 (setq el
(list 'int-to-string el
))))
653 (setq el
(gnus-tilde-ignore-form el ignore-value
)))
655 (setq el
(gnus-tilde-cut-form el cut-width
)))
657 (setq el
(gnus-tilde-max-form el max-width
)))
659 (setq el
(gnus-pad-form el pad-width
)))
662 (push (car elem
) flist
))))
663 (setq fstring
(buffer-substring-no-properties (point-min) (point-max))))
665 ;; Do some postprocessing to increase efficiency.
670 ((string= fstring
"")
672 ;; Not a format string.
673 ((not (string-match "%" fstring
))
675 ;; A format string with just a single string spec.
676 ((string= fstring
"%s")
678 ;; A single character.
679 ((string= fstring
"%c")
682 ((string= fstring
"%d")
685 (list `(princ ,(car flist
)))
686 (list `(int-to-string ,(car flist
)))))
687 ;; Just lots of chars and strings.
688 ((string-match "\\`\\(%[cs]\\)+\\'" fstring
)
690 ;; A single string spec at the beginning of the spec.
691 ((string-match "\\`%[sc][^%]+\\'" fstring
)
692 (list (car flist
) (substring fstring
2)))
693 ;; A single string spec in the middle of the spec.
694 ((string-match "\\`\\([^%]+\\)%[sc]\\([^%]+\\)\\'" fstring
)
695 (list (match-string 1 fstring
) (car flist
) (match-string 2 fstring
)))
696 ;; A single string spec in the end of the spec.
697 ((string-match "\\`\\([^%]+\\)%[sc]\\'" fstring
)
698 (list (match-string 1 fstring
) (car flist
)))
699 ;; Only string (and %) specs (XEmacs only!)
700 ((and (featurep 'xemacs
)
701 gnus-make-format-preserve-properties
703 "\\`\\([^%]*\\(%%\\|%-?\\([1-9][0-9]*\\)?s\\)\\)*[^%]*\\'"
705 (list (cons 'gnus-xmas-format
(cons fstring
(nreverse flist
)))))
706 ;; A more complex spec.
708 (list (cons 'format
(cons fstring
(nreverse flist
)))))))
714 (cons 'insert result
)))
715 (cond ((stringp result
)
718 (cons 'concat result
))
721 (defun gnus-eval-format (format &optional alist props
)
722 "Eval the format variable FORMAT, using ALIST.
723 If PROPS, insert the result."
724 (let ((form (gnus-parse-format format alist props
)))
726 (gnus-add-text-properties (point) (progn (eval form
) (point)) props
)
729 (defun gnus-compile ()
730 "Byte-compile the user-defined format specs."
733 (let ((entries gnus-format-specs
)
734 (byte-compile-warnings '(unresolved callargs redefine
))
737 (gnus-message 7 "Compiling format specs...")
740 (setq entry
(pop entries
))
741 (if (memq (car entry
) '(gnus-version version
))
742 (setq gnus-format-specs
(delq entry gnus-format-specs
))
743 (let ((form (caddr entry
)))
744 (when (and (listp form
)
745 ;; Under GNU Emacs, it's (byte-code ...)
746 (not (eq 'byte-code
(car form
)))
747 ;; Under XEmacs, it's (funcall #<compiled-function ...>)
748 (not (and (eq 'funcall
(car form
))
749 (byte-code-function-p (cadr form
)))))
750 (defalias 'gnus-tmp-func
`(lambda () ,form
))
751 (byte-compile 'gnus-tmp-func
)
752 (setcar (cddr entry
) (gnus-byte-code 'gnus-tmp-func
))))))
754 (push (cons 'version emacs-version
) gnus-format-specs
)
755 ;; Mark the .newsrc.eld file as "dirty".
757 (gnus-message 7 "Compiling user specs...done"))))
759 (defun gnus-set-format (type &optional insertable
)
760 (set (intern (format "gnus-%s-line-format-spec" type
))
762 (symbol-value (intern (format "gnus-%s-line-format" type
)))
763 (symbol-value (intern (format "gnus-%s-line-format-alist" type
)))
769 ;; coding: iso-8859-1
772 ;; arch-tag: a4328fa1-1f84-4b09-97ad-4b5767cfd50f
773 ;;; gnus-spec.el ends here