1 ;;; article.el --- article treatment functions
2 ;; Copyright (C) 1996 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.
32 (defvar gnus-ignored-headers
33 "^Path:\\|^Posting-Version:\\|^Article-I.D.:\\|^Expires:\\|^Date-Received:\\|^References:\\|^Control:\\|^Xref:\\|^Lines:\\|^Posted:\\|^Relay-Version:\\|^Message-ID:\\|^Nf-ID:\\|^Nf-From:\\|^Approved:\\|^Sender:\\|^Received:\\|^Mail-from:"
34 "*All headers that match this regexp will be hidden.
35 This variable can also be a list of regexps of headers to be ignored.
36 If `article-visible-headers' is non-nil, this variable will be ignored.")
38 (defvar gnus-visible-headers "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^Cc:\\|^Posted-To:\\|^Mail-Copies-To:\\|^Apparently-To:\\|^Gnus-Warning:\\|^Resent-"
39 "*All headers that do not match this regexp will be hidden.
40 This variable can also be a list of regexp of headers to remain visible.
41 If this variable is non-nil, `article-ignored-headers' will be ignored.")
43 (defvar gnus-sorted-header-list
44 '("^From:" "^Subject:" "^Summary:" "^Keywords:" "^Newsgroups:" "^To:"
45 "^Cc:" "^Date:" "^Organization:")
46 "*This variable is a list of regular expressions.
47 If it is non-nil, headers that match the regular expressions will
48 be placed first in the article buffer in the sequence specified by
51 (defvar gnus-boring-article-headers
52 '(empty followup-to reply-to)
53 "*Headers that are only to be displayed if they have interesting data.
54 Possible values in this list are `empty', `newsgroups', `followup-to',
55 `reply-to', and `date'.")
57 (defvar gnus-signature-separator '("^-- $" "^-- *$")
58 "Regexp matching signature separator.
59 This can also be a list of regexps. In that case, it will be checked
60 from head to tail looking for a separator. Searches will be done from
61 the end of the buffer.")
63 (defvar gnus-signature-limit nil
64 "Provide a limit to what is considered a signature.
65 If it is a number, no signature may not be longer (in characters) than
66 that number. If it is a floating point number, no signature may be
67 longer (in lines) than that number. If it is a function, the function
68 will be called without any parameters, and if it returns nil, there is
69 no signature in the buffer. If it is a string, it will be used as a
70 regexp. If it matches, the text in question is not a signature.")
72 (defvar gnus-hidden-properties '(invisible t intangible t)
73 "Property list to use for hiding text.")
75 (defvar gnus-article-x-face-command
76 "{ echo '/* Width=48, Height=48 */'; uncompface; } | icontopbm | xv -quit -"
77 "String or function to be executed to display an X-Face header.
78 If it is a string, the command will be executed in a sub-shell
79 asynchronously. The compressed face will be piped to this command.")
81 (defvar gnus-article-x-face-too-ugly nil
82 "Regexp matching posters whose face shouldn't be shown automatically.")
84 (defvar gnus-emphasis-alist
85 '(("_\\(\\w+\\)_" 0 1 'underline)
86 ("\\W\\(/\\(\\w+\\)/\\)\\W" 1 2 'italic)
87 ("\\(_\\*\\|\\*_\\)\\(\\w+\\)\\(_\\*\\|\\*_\\)" 0 2 'bold-underline)
88 ("\\*\\(\\w+\\)\\*" 0 1 'bold))
89 "Alist that says how to fontify certain phrases.
90 Each item looks like this:
92 (\"_\\\\([[\\w+\\\\)_\" 0 1 'underline)
94 The first element is a regular expression to be matched. The second
95 is a number that says what regular expression grouping used to find
96 the entire emphasized word. The third is a number that says what
97 regexp grouping should be displayed and highlighted. The fourth
98 is the face used for highlighting.")
101 (autoload 'hexl-hex-string-to-integer "hexl")
102 (autoload 'timezone-make-date-arpa-standard "timezone")
103 (autoload 'mail-extract-address-components "mail-extr"))
105 ;;; Internal variables.
107 (defvar gnus-inhibit-hiding nil)
108 (defvar gnus-newsgroup-name)
110 (defsubst article-hide-text (b e props)
111 "Set text PROPS on the B to E region, extending `intangible' 1 past B."
112 (add-text-properties b e props)
113 (when (memq 'intangible props)
115 (max (1- b) (point-min))
116 b 'intangible (cddr (memq 'intangible props)))))
118 (defsubst article-unhide-text (b e)
119 "Remove hidden text properties from region between B and E."
120 (remove-text-properties b e gnus-hidden-properties)
121 (when (memq 'intangible gnus-hidden-properties)
122 (put-text-property (max (1- b) (point-min))
125 (defun article-hide-text-type (b e type)
126 "Hide text of TYPE between B and E."
128 b e (cons 'article-type (cons type gnus-hidden-properties))))
130 (defun article-unhide-text-type (b e type)
131 "Hide text of TYPE between B and E."
132 (remove-text-properties
133 b e (cons 'article-type (cons type gnus-hidden-properties)))
134 (when (memq 'intangible gnus-hidden-properties)
135 (put-text-property (max (1- b) (point-min))
138 (defsubst article-header-rank ()
139 "Give the rank of the string HEADER as given by `article-sorted-header-list'."
140 (let ((list gnus-sorted-header-list)
143 (when (looking-at (car list))
145 (setq list (cdr list))
149 (defun article-hide-headers (&optional arg delete)
150 "Toggle whether to hide unwanted headers and possibly sort them as well.
151 If given a negative prefix, always show; if given a positive prefix,
153 (interactive (article-hidden-arg))
154 (if (article-check-hidden-text 'headers arg)
155 ;; Show boring headers as well.
156 (article-show-hidden-text 'boring-headers)
157 ;; This function might be inhibited.
158 (unless gnus-inhibit-hiding
161 (let ((buffer-read-only nil)
162 (props (nconc (list 'article-type 'headers)
163 gnus-hidden-properties))
164 (max (1+ (length gnus-sorted-header-list)))
165 (ignored (when (not (stringp gnus-visible-headers))
166 (cond ((stringp gnus-ignored-headers)
167 gnus-ignored-headers)
168 ((listp gnus-ignored-headers)
169 (mapconcat 'identity gnus-ignored-headers
172 (cond ((stringp gnus-visible-headers)
173 gnus-visible-headers)
174 ((and gnus-visible-headers
175 (listp gnus-visible-headers))
176 (mapconcat 'identity gnus-visible-headers "\\|"))))
177 (inhibit-point-motion-hooks t)
179 ;; First we narrow to just the headers.
181 (goto-char (point-min))
182 ;; Hide any "From " lines at the beginning of (mail) articles.
183 (while (looking-at "From ")
187 (delete-region (point-min) (point))
188 (article-hide-text (point-min) (point) props)))
189 ;; Then treat the rest of the header lines.
192 (progn (search-forward "\n\n" nil t) (forward-line -1) (point)))
193 ;; Then we use the two regular expressions
194 ;; `gnus-ignored-headers' and `gnus-visible-headers' to
195 ;; select which header lines is to remain visible in the
197 (goto-char (point-min))
198 (while (re-search-forward "^[^ \t]*:" nil t)
200 ;; Mark the rank of the header.
202 (point) (1+ (point)) 'message-rank
203 (if (or (and visible (looking-at visible))
205 (not (looking-at ignored))))
206 (article-header-rank)
209 (message-sort-headers-1)
210 (when (setq beg (text-property-any
211 (point-min) (point-max) 'message-rank (+ 2 max)))
212 ;; We make the unwanted headers invisible.
214 (delete-region beg (point-max))
215 ;; Suggested by Sudish Joseph <joseph@cis.ohio-state.edu>.
216 (article-hide-text-type beg (point-max) 'headers))
217 ;; Work around XEmacs lossage.
218 (put-text-property (point-min) beg 'invisible nil))))))))
220 (defun article-hide-boring-headers (&optional arg)
221 "Toggle hiding of headers that aren't very interesting.
222 If given a negative prefix, always show; if given a positive prefix,
224 (interactive (article-hidden-arg))
225 (unless (article-check-hidden-text 'boring-headers arg)
228 (let ((buffer-read-only nil)
229 (list gnus-boring-article-headers)
230 (inhibit-point-motion-hooks t)
232 (nnheader-narrow-to-headers)
234 (setq elem (pop list))
235 (goto-char (point-min))
237 ;; Hide empty headers.
239 (while (re-search-forward "^[^:]+:[ \t]*\n[^ \t]" nil t)
241 (article-hide-text-type
242 (progn (beginning-of-line) (point))
245 (if (re-search-forward "^[^ \t]" nil t)
249 ;; Hide boring Newsgroups header.
250 ((eq elem 'newsgroups)
251 (when (equal (gnus-fetch-field "newsgroups")
252 (gnus-group-real-name
253 (if (boundp 'gnus-newsgroup-name)
256 (article-hide-header "newsgroups")))
257 ((eq elem 'followup-to)
258 (when (equal (message-fetch-field "followup-to")
259 (message-fetch-field "newsgroups"))
260 (article-hide-header "followup-to")))
262 (let ((from (message-fetch-field "from"))
263 (reply-to (message-fetch-field "reply-to")))
267 (nth 1 (mail-extract-address-components from))
268 (nth 1 (mail-extract-address-components reply-to))))
269 (article-hide-header "reply-to"))))
271 (let ((date (message-fetch-field "date")))
273 (< (gnus-days-between date (current-time-string))
275 (article-hide-header "date")))))))))))
277 (defun article-hide-header (header)
279 (goto-char (point-min))
280 (when (re-search-forward (concat "^" header ":") nil t)
281 (article-hide-text-type
282 (progn (beginning-of-line) (point))
285 (if (re-search-forward "^[^ \t]" nil t)
290 ;; Written by Per Abrahamsen <amanda@iesd.auc.dk>.
291 (defun article-treat-overstrike ()
292 "Translate overstrikes into bold text."
295 (let ((buffer-read-only nil))
296 (while (search-forward "\b" nil t)
297 (let ((next (following-char))
298 (previous (char-after (- (point) 2))))
299 ;; We do the boldification/underlining by hiding the
300 ;; overstrikes and putting the proper text property
304 (article-hide-text-type (- (point) 2) (point) 'overstrike)
305 (put-text-property (point) (1+ (point)) 'face 'bold))
307 (article-hide-text-type (1- (point)) (1+ (point)) 'overstrike)
309 (- (point) 2) (1- (point)) 'face 'underline))
311 (article-hide-text-type (- (point) 2) (point) 'overstrike)
313 (point) (1+ (point)) 'face 'underline))))))))
315 (defun article-fill ()
316 "Format too long lines."
319 (let ((buffer-read-only nil))
321 (goto-char (point-min))
322 (search-forward "\n\n" nil t)
324 (let ((paragraph-start "^[>|#:<;* ]*[ \t]*$")
325 (adaptive-fill-regexp "[ \t]*\\([|#:<;>*]+ *\\)?")
326 (adaptive-fill-mode t))
328 (and (>= (current-column) (min fill-column (window-width)))
329 (/= (preceding-char) ?:)
330 (fill-paragraph nil))
333 (defun article-remove-cr ()
334 "Remove carriage returns from an article."
337 (let ((buffer-read-only nil))
338 (goto-char (point-min))
339 (while (search-forward "\r" nil t)
340 (replace-match "" t t)))))
342 (defun article-remove-trailing-blank-lines ()
343 "Remove all trailing blank lines from the article."
346 (let ((buffer-read-only nil))
347 (goto-char (point-max))
351 (while (looking-at "^[ \t]*$")
356 (defun article-display-x-face (&optional force)
357 "Look for an X-Face header and display it if present."
358 (interactive (list 'force))
360 ;; Delete the old process, if any.
361 (when (process-status "article-x-face")
362 (delete-process "article-x-face"))
363 (let ((inhibit-point-motion-hooks t)
364 (case-fold-search nil)
367 (nnheader-narrow-to-headers)
368 (setq from (message-fetch-field "from"))
369 (goto-char (point-min))
370 (when (and gnus-article-x-face-command
372 ;; Check whether this face is censored.
373 (not gnus-article-x-face-too-ugly)
374 (and gnus-article-x-face-too-ugly from
375 (not (string-match gnus-article-x-face-too-ugly
377 ;; Has to be present.
378 (re-search-forward "^X-Face: " nil t))
379 ;; We now have the area of the buffer where the X-Face is stored.
381 (end (1- (re-search-forward "^\\($\\|[^ \t]\\)" nil t))))
382 ;; We display the face.
383 (if (symbolp gnus-article-x-face-command)
384 ;; The command is a lisp function, so we call it.
385 (if (gnus-functionp gnus-article-x-face-command)
386 (funcall gnus-article-x-face-command beg end)
387 (error "%s is not a function" gnus-article-x-face-command))
388 ;; The command is a string, so we interpret the command
389 ;; as a, well, command, and fork it off.
390 (let ((process-connection-type nil))
391 (process-kill-without-query
393 "article-x-face" nil shell-file-name shell-command-switch
394 gnus-article-x-face-command))
395 (process-send-region "article-x-face" beg end)
396 (process-send-eof "article-x-face")))))))))
398 (defun article-decode-rfc1522 ()
399 "Hack to remove QP encoding from headers."
400 (let ((case-fold-search t)
401 (inhibit-point-motion-hooks t)
402 (buffer-read-only nil)
406 (goto-char (point-min))
407 (or (search-forward "\n\n" nil t) (point-max)))
409 (goto-char (point-min))
410 (while (re-search-forward
411 "=\\?iso-8859-1\\?q\\?\\([^?\t\n]*\\)\\?=" nil t)
412 (setq string (match-string 1))
413 (narrow-to-region (match-beginning 0) (match-end 0))
414 (delete-region (point-min) (point-max))
416 (article-mime-decode-quoted-printable
417 (goto-char (point-min)) (point-max))
418 (subst-char-in-region (point-min) (point-max) ?_ ? )
420 (goto-char (point-min))))))
422 (defun article-de-quoted-unreadable (&optional force)
423 "Do a naive translation of a quoted-printable-encoded article.
424 This is in no way, shape or form meant as a replacement for real MIME
425 processing, but is simply a stop-gap measure until MIME support is
427 If FORCE, decode the article whether it is marked as quoted-printable
429 (interactive (list 'force))
431 (let ((case-fold-search t)
432 (buffer-read-only nil)
433 (type (gnus-fetch-field "content-transfer-encoding")))
434 (article-decode-rfc1522)
436 (and type (string-match "quoted-printable" (downcase type))))
437 (goto-char (point-min))
438 (search-forward "\n\n" nil 'move)
439 (article-mime-decode-quoted-printable (point) (point-max))))))
441 (defun article-mime-decode-quoted-printable (from to)
442 "Decode Quoted-Printable in the region between FROM and TO."
445 (while (search-forward "=" to t)
446 (cond ((eq (following-char) ?\n)
449 ((looking-at "[0-9A-F][0-9A-F]")
450 (subst-char-in-region
451 (1- (point)) (point) ?=
452 (hexl-hex-string-to-integer
453 (buffer-substring (point) (+ 2 (point)))))
457 ((gnus-message 3 "Malformed MIME quoted-printable message")))))
459 (defun article-hide-pgp (&optional arg)
460 "Toggle hiding of any PGP headers and signatures in the current article.
461 If given a negative prefix, always show; if given a positive prefix,
463 (interactive (article-hidden-arg))
464 (unless (article-check-hidden-text 'pgp arg)
466 (let (buffer-read-only beg end)
468 (goto-char (point-min))
469 ;; Hide the "header".
470 (and (search-forward "\n-----BEGIN PGP SIGNED MESSAGE-----\n" nil t)
471 (article-hide-text-type (match-beginning 0) (match-end 0) 'pgp))
473 ;; Hide the actual signature.
474 (and (search-forward "\n-----BEGIN PGP SIGNATURE-----\n" nil t)
475 (setq end (1+ (match-beginning 0)))
476 (article-hide-text-type
478 (if (search-forward "\n-----END PGP SIGNATURE-----\n" nil t)
480 ;; Perhaps we shouldn't hide to the end of the buffer
481 ;; if there is no end to the signature?
484 ;; Hide "- " PGP quotation markers.
486 (narrow-to-region beg end)
487 (goto-char (point-min))
488 (while (re-search-forward "^- " nil t)
489 (article-hide-text-type (match-beginning 0) (match-end 0) 'pgp))
492 (defun article-hide-pem (&optional arg)
493 "Toggle hiding of any PEM headers and signatures in the current article.
494 If given a negative prefix, always show; if given a positive prefix,
496 (interactive (article-hidden-arg))
497 (unless (article-check-hidden-text 'pem arg)
499 (let (buffer-read-only end)
501 (goto-char (point-min))
502 ;; hide the horrendously ugly "header".
503 (and (search-forward "\n-----BEGIN PRIVACY-ENHANCED MESSAGE-----\n"
506 (setq end (1+ (match-beginning 0)))
507 (article-hide-text-type
509 (if (search-forward "\n\n" nil t)
513 ;; hide the trailer as well
514 (and (search-forward "\n-----END PRIVACY-ENHANCED MESSAGE-----\n"
517 (article-hide-text-type
518 (match-beginning 0) (match-end 0) 'pem))))))
520 (defun article-hide-signature (&optional arg)
521 "Hide the signature in the current article.
522 If given a negative prefix, always show; if given a positive prefix,
524 (interactive (article-hidden-arg))
525 (unless (article-check-hidden-text 'signature arg)
528 (let ((buffer-read-only nil))
529 (when (article-narrow-to-signature)
530 (article-hide-text-type (point-min) (point-max) 'signature)))))))
532 (defun article-strip-leading-blank-lines ()
533 "Remove all blank lines from the beginning of the article."
536 (let (buffer-read-only)
537 (goto-char (point-min))
538 (when (search-forward "\n\n" nil t)
539 (while (looking-at "[ \t]$")
540 (gnus-delete-line))))))
542 (defvar mime::preview/content-list)
543 (defvar mime::preview-content-info/point-min)
544 (defun article-narrow-to-signature ()
545 "Narrow to the signature."
547 (when (and (boundp 'mime::preview/content-list)
548 mime::preview/content-list)
549 ;; We have a MIMEish article, so we use the MIME data to narrow.
550 (let ((pcinfo (car (last mime::preview/content-list))))
553 (funcall (intern "mime::preview-content-info/point-min") pcinfo)
557 (when (article-search-signature)
559 ;; Check whether we have some limits to what we consider
560 ;; to be a signature.
561 (let ((limits (if (listp gnus-signature-limit) gnus-signature-limit
562 (list gnus-signature-limit)))
564 (while (setq limit (pop limits))
565 (if (or (and (integerp limit)
566 (< (- (point-max) (point)) limit))
568 (< (count-lines (point) (point-max)) limit))
569 (and (gnus-functionp limit)
572 (not (re-search-forward limit nil t))))
573 () ; This limit did not succeed.
577 (narrow-to-region (point) (point-max))
580 (defun article-search-signature ()
581 "Search the current buffer for the signature separator.
582 Put point at the beginning of the signature separator."
584 (goto-char (point-max))
585 (if (if (stringp gnus-signature-separator)
586 (re-search-backward gnus-signature-separator nil t)
587 (let ((seps gnus-signature-separator))
589 (not (re-search-backward (car seps) nil t)))
596 (defun article-hidden-arg ()
597 "Return the current prefix arg as a number, or 0 if no prefix."
598 (list (if current-prefix-arg
599 (prefix-numeric-value current-prefix-arg)
602 (defun article-check-hidden-text (type arg)
603 "Return nil if hiding is necessary.
604 Arg can be nil or a number. Nil and positive means hide, negative
605 means show, 0 means toggle."
607 (let ((hide (article-hidden-text-p type)))
613 (article-show-hidden-text type))
615 (if (eq hide 'hidden)
616 (article-show-hidden-text type)
619 (defun article-hidden-text-p (type)
620 "Say whether the current buffer contains hidden text of type TYPE."
621 (let ((pos (text-property-any (point-min) (point-max) 'article-type type)))
623 (if (get-text-property pos 'invisible)
627 (defun article-show-hidden-text (type &optional hide)
628 "Show all hidden text of type TYPE.
629 If HIDE, hide the text instead."
631 (let ((buffer-read-only nil)
632 (inhibit-point-motion-hooks t)
634 (while (gnus-goto-char (text-property-any
635 beg (point-max) 'article-type type))
639 (article-hide-text beg (point) gnus-hidden-properties)
640 (article-unhide-text beg (point)))
644 (defvar article-time-units
645 `((year . ,(* 365.25 24 60 60))
646 (week . ,(* 7 24 60 60))
647 (day . ,(* 24 60 60))
651 "Mapping from time units to seconds.")
653 (defun article-date-ut (&optional type highlight header)
654 "Convert DATE date to universal time in the current article.
655 If TYPE is `local', convert to local time; if it is `lapsed', output
656 how much time has lapsed since DATE."
657 (interactive (list 'ut t))
658 (let* ((header (or header (message-fetch-field "date") ""))
659 (date (if (vectorp header) (mail-header-date header)
661 (date-regexp "^Date: \\|^X-Sent: ")
663 (inhibit-point-motion-hooks t)
665 (when (and date (not (string= date "")))
668 (nnheader-narrow-to-headers)
669 (let ((buffer-read-only nil))
670 ;; Delete any old Date headers.
671 (if (re-search-forward date-regexp nil t)
673 (setq bface (get-text-property (gnus-point-at-bol) 'face)
674 eface (get-text-property (1- (gnus-point-at-eol))
676 (message-remove-header date-regexp t)
678 (goto-char (point-max)))
679 (insert (article-make-date-line date type))
682 (when (looking-at "\\([^:]+\\): *\\(.*\\)$")
683 (put-text-property (match-beginning 1) (match-end 1)
685 (put-text-property (match-beginning 2) (match-end 2)
688 (defun article-make-date-line (date type)
689 "Return a DATE line of TYPE."
691 ;; Convert to the local timezone. We have to slap a
692 ;; `condition-case' round the calls to the timezone
693 ;; functions since they aren't particularly resistant to
696 (concat "Date: " (condition-case ()
697 (timezone-make-date-arpa-standard date)
700 ;; Convert to Universal Time.
704 (timezone-make-date-arpa-standard date nil "UT")
707 ;; Get the original date from the article.
709 (concat "Date: " date "\n"))
710 ;; Do an X-Sent lapsed format.
712 ;; If the date is seriously mangled, the timezone
713 ;; functions are liable to bug out, so we condition-case
715 (let* ((now (current-time))
720 (timezone-make-date-arpa-standard
721 (current-time-string now)
722 (current-time-zone now) "UT"))
724 (timezone-make-date-arpa-standard
727 (real-sec (and real-time
728 (+ (* (float (car real-time)) 65536)
730 (sec (and real-time (abs real-sec)))
740 ;; This is a bit convoluted, but basically we go
741 ;; through the time units for years, weeks, etc,
742 ;; and divide things to see whether that results
743 ;; in positive answers.
746 (if (zerop (setq num (ffloor (/ sec (cdr unit)))))
747 ;; The (remaining) seconds are too few to
748 ;; be divided into this time unit.
750 ;; It's big enough, so we output it.
751 (setq sec (- sec (* num (cdr unit))))
753 (concat (if prev ", " "") (int-to-string
755 " " (symbol-name (car unit))
756 (if (> num 1) "s" ""))
758 article-time-units "")
759 ;; If dates are odd, then it might appear like the
760 ;; article was sent in the future.
763 " in the future\n"))))))
765 (error "Unknown conversion type: %s" type))))
767 (defun article-date-local (&optional highlight)
768 "Convert the current article date to the local timezone."
769 (interactive (list t))
770 (article-date-ut 'local highlight))
772 (defun article-date-original (&optional highlight)
773 "Convert the current article date to what it was originally.
774 This is only useful if you have used some other date conversion
775 function and want to see what the date was before converting."
776 (interactive (list t))
777 (article-date-ut 'original highlight))
779 (defun article-date-lapsed (&optional highlight)
780 "Convert the current article date to time lapsed since it was sent."
781 (interactive (list t))
782 (article-date-ut 'lapsed highlight))
784 (defun article-show-all ()
785 "Show all hidden text in the article buffer."
788 (let ((buffer-read-only nil))
789 (article-unhide-text (point-min) (point-max)))))
791 (defun article-emphasize (&optional arg)
792 "Empasize text according to `gnus-emphasis-alist'."
793 (interactive (article-hidden-arg))
794 (unless (article-check-hidden-text 'emphasis arg)
796 (let ((alist gnus-emphasis-alist)
797 (buffer-read-only nil)
798 (props (append '(article-type emphasis)
799 gnus-hidden-properties))
800 regexp elem beg invisible visible face)
801 (goto-char (point-min))
802 (search-forward "\n\n" nil t)
804 (while (setq elem (pop alist))
806 (setq regexp (car elem)
807 invisible (nth 1 elem)
810 (while (re-search-forward regexp nil t)
812 (match-beginning invisible) (match-end invisible) props)
813 (article-unhide-text-type
814 (match-beginning visible) (match-end visible) 'emphasis)
816 (match-beginning visible) (match-end visible)
821 ;;; article.el ends here