;;; Code:
+(require 'custom)
(require 'nnheader)
(require 'gnus-util)
(require 'message)
-(require 'custom)
(defgroup article nil
"Article display."
:group 'article)
(defcustom 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-")
+ "^From:\\|^Newsgroups:\\|^Subject:\\|^Date:\\|^Followup-To:\\|^Reply-To:\\|^Organization:\\|^Summary:\\|^Keywords:\\|^To:\\|^Cc:\\|^Posted-To:\\|^Mail-Copies-To:\\|^Apparently-To:\\|^Gnus-Warning:\\|^Resent-"
"All headers that do not match this regexp will be hidden.
This variable can also be a list of regexp of headers to remain visible.
If this variable is non-nil, `gnus-ignored-headers' will be ignored."
- :type '(choice :custom-show nil
- (repeat regexp)
+ :type '(repeat :value-to-internal (lambda (widget value)
+ (custom-split-regexp-maybe value))
+ :match (lambda (widget value)
+ (or (stringp value)
+ (widget-editable-list-match widget value)))
regexp)
:group 'article)
:group 'article)
(defcustom gnus-emphasis-alist
- '(("_\\(\\w+\\)_" 0 1 underline)
- ("\\W\\(/\\(\\w+\\)/\\)\\W" 1 2 italic)
- ("\\(_\\*\\|\\*_\\)\\(\\w+\\)\\(_\\*\\|\\*_\\)" 0 2 bold-underline)
- ("\\*\\(\\w+\\)\\*" 0 1 bold))
+ (let ((format
+ "\\(\\s-\\|^\\|[\"\(]\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*\\)%s\\)\\(\\s-\\|[?!.,;:\"\)]\\)")
+ (types
+ '(("_" "_" underline)
+ ("/" "/" italic)
+ ("\\*" "\\*" bold)
+ ("_/" "/_" underline-italic)
+ ("_\\*" "\\*_" underline-bold)
+ ("\\*/" "/\\*" bold-italic)
+ ("_\\*/" "/\\*_" underline-bold-italic))))
+ `(("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
+ 2 3 gnus-emphasis-underline)
+ ,@(mapcar
+ (lambda (spec)
+ (list
+ (format format (car spec) (cadr spec))
+ 2 3 (intern (format "gnus-emphasis-%s" (caddr spec)))))
+ types)))
"Alist that says how to fontify certain phrases.
Each item looks like this:
- (\"_\\\\([[\\w+\\\\)_\" 0 1 'underline)
+ (\"_\\\\(\\\\w+\\\\)_\" 0 1 'underline)
The first element is a regular expression to be matched. The second
is a number that says what regular expression grouping used to find
face))
:group 'article)
+(defface gnus-emphasis-bold '((t (:bold t)))
+ "Face used for displaying strong emphasized text (*word*)."
+ :group 'article)
+
+(defface gnus-emphasis-italic '((t (:italic t)))
+ "Face used for displaying italic emphasized text (/word/)."
+ :group 'article)
+
+(defface gnus-emphasis-underline '((t (:underline t)))
+ "Face used for displaying underlined emphasized text (_word_)."
+ :group 'article)
+
+(defface gnus-emphasis-underline-bold '((t (:bold t :underline t)))
+ "Face used for displaying underlined bold emphasized text (_*word*_)."
+ :group 'article)
+
+(defface gnus-emphasis-underline-italic '((t (:italic t :underline t)))
+ "Face used for displaying underlined italic emphasized text (_*word*_)."
+ :group 'article)
+
+(defface gnus-emphasis-bold-italic '((t (:bold t :italic t)))
+ "Face used for displaying bold italic emphasized text (/*word*/)."
+ :group 'article)
+
+(defface gnus-emphasis-underline-bold-italic
+ '((t (:bold t :italic t :underline t)))
+ "Face used for displaying underlined bold italic emphasized text (_/*word*/_)."
+ :group 'article)
+
(eval-and-compile
(autoload 'hexl-hex-string-to-integer "hexl")
(autoload 'timezone-make-date-arpa-standard "timezone")
(delete-region
(point)
(progn
- (while (looking-at "^[ \t]*$")
+ (while (and (not (bobp))
+ (looking-at "^[ \t]*$"))
(forward-line -1))
(forward-line 1)
(point))))))
(narrow-to-region (match-beginning 0) (match-end 0))
(delete-region (point-min) (point-max))
(insert string)
- (article-mime-decode-quoted-printable (goto-char (point-min))
- (point-max))
+ (article-mime-decode-quoted-printable
+ (goto-char (point-min)) (point-max))
(subst-char-in-region (point-min) (point-max) ?_ ? )
(goto-char (point-max)))
(when (looking-at "\\([ \t\n]+\\)=\\?")
"Remove all blank lines from the beginning of the article."
(interactive)
(save-excursion
- (let (buffer-read-only)
+ (let ((inhibit-point-motion-hooks t)
+ buffer-read-only)
(goto-char (point-min))
(when (search-forward "\n\n" nil t)
- (while (looking-at "[ \t]$")
+ (while (and (not (eobp))
+ (looking-at "[ \t]*$"))
(gnus-delete-line))))))
(defun article-strip-multiple-blank-lines ()
mime::preview/content-list)
;; We have a MIMEish article, so we use the MIME data to narrow.
(let ((pcinfo (car (last mime::preview/content-list))))
- (condition-case ()
- (narrow-to-region
- (funcall (intern "mime::preview-content-info/point-min") pcinfo)
- (point-max))
- (error nil))))
+ (ignore-errors
+ (narrow-to-region
+ (funcall (intern "mime::preview-content-info/point-min") pcinfo)
+ (point-max)))))
(when (article-search-signature)
(forward-line 1)
(concat "Date: " date "\n"))
;; Do an X-Sent lapsed format.
((eq type 'lapsed)
- ;; If the date is seriously mangled, the timezone
- ;; functions are liable to bug out, so we condition-case
- ;; the entire thing.
+ ;; If the date is seriously mangled, the timezone functions are
+ ;; liable to bug out, so we ignore all errors.
(let* ((now (current-time))
(real-time
- (condition-case ()
- (gnus-time-minus
- (gnus-encode-date
- (timezone-make-date-arpa-standard
- (current-time-string now)
- (current-time-zone now) "UT"))
- (gnus-encode-date
- (timezone-make-date-arpa-standard
- date nil "UT")))
- (error nil)))
+ (ignore-errors
+ (gnus-time-minus
+ (gnus-encode-date
+ (timezone-make-date-arpa-standard
+ (current-time-string now)
+ (current-time-zone now) "UT"))
+ (gnus-encode-date
+ (timezone-make-date-arpa-standard
+ date nil "UT")))))
(real-sec (and real-time
(+ (* (float (car real-time)) 65536)
(cadr real-time))))
visible (nth 2 elem)
face (nth 3 elem))
(while (re-search-forward regexp nil t)
- (article-hide-text
- (match-beginning invisible) (match-end invisible) props)
- (article-unhide-text-type
- (match-beginning visible) (match-end visible) 'emphasis)
- (put-text-property
- (match-beginning visible) (match-end visible)
- 'face face)))))))
+ (when (and (match-beginning visible) (match-beginning invisible))
+ (article-hide-text
+ (match-beginning invisible) (match-end invisible) props)
+ (article-unhide-text-type
+ (match-beginning visible) (match-end visible) 'emphasis)
+ (put-text-property
+ (match-beginning visible) (match-end visible) 'face face)
+ (goto-char (match-end invisible)))))))))
(provide 'article)