comparison lisp/gnus/gnus-art.el @ 28:1917ad0d78d7 r19-15b97

Import from CVS: tag r19-15b97
author cvs
date Mon, 13 Aug 2007 08:51:55 +0200
parents 4103f0995bd7
children ec9a17fef872
comparison
equal deleted inserted replaced
27:0a3286277d9b 28:1917ad0d78d7
1081 seps)) 1081 seps))
1082 t 1082 t
1083 (goto-char cur) 1083 (goto-char cur)
1084 nil))) 1084 nil)))
1085 1085
1086 (eval-and-compile
1087 (autoload 'w3-parse-buffer "w3-parse"))
1088
1089 (defun gnus-article-treat-html ()
1090 "Render HTML."
1091 (interactive)
1092 (let ((cbuf (current-buffer)))
1093 (set-buffer gnus-article-buffer)
1094 (let (buf buffer-read-only b e)
1095 (goto-char (point-min))
1096 (narrow-to-region
1097 (if (search-forward "\n\n" nil t)
1098 (setq b (point))
1099 (point-max))
1100 (setq e (point-max)))
1101 (nnheader-temp-write nil
1102 (insert-buffer-substring gnus-article-buffer b e)
1103 (save-window-excursion
1104 (setq buf (car (w3-parse-buffer (current-buffer))))))
1105 (when buf
1106 (delete-region (point-min) (point-max))
1107 (insert-buffer-substring buf)
1108 (kill-buffer buf))
1109 (widen)
1110 (goto-char (point-min))
1111 (set-window-start (get-buffer-window (current-buffer)) (point-min))
1112 (set-buffer cbuf))))
1113
1086 (defun gnus-article-hidden-arg () 1114 (defun gnus-article-hidden-arg ()
1087 "Return the current prefix arg as a number, or 0 if no prefix." 1115 "Return the current prefix arg as a number, or 0 if no prefix."
1088 (list (if current-prefix-arg 1116 (list (if current-prefix-arg
1089 (prefix-numeric-value current-prefix-arg) 1117 (prefix-numeric-value current-prefix-arg)
1090 0))) 1118 0)))
1203 ;; Get the original date from the article. 1231 ;; Get the original date from the article.
1204 ((eq type 'original) 1232 ((eq type 'original)
1205 (concat "Date: " date "\n")) 1233 (concat "Date: " date "\n"))
1206 ;; Let the user define the format. 1234 ;; Let the user define the format.
1207 ((eq type 'user) 1235 ((eq type 'user)
1208 (concat 1236 (concat
1237 "Date: "
1209 (format-time-string gnus-article-time-format 1238 (format-time-string gnus-article-time-format
1210 (ignore-errors 1239 (ignore-errors
1211 (gnus-encode-date 1240 (gnus-encode-date
1212 (timezone-make-date-arpa-standard 1241 (timezone-make-date-arpa-standard
1213 date nil "UT")))) 1242 date nil "UT"))))
1283 "Convert the current article date to time lapsed since it was sent." 1312 "Convert the current article date to time lapsed since it was sent."
1284 (interactive (list t)) 1313 (interactive (list t))
1285 (article-date-ut 'lapsed highlight)) 1314 (article-date-ut 'lapsed highlight))
1286 1315
1287 (defun article-date-user (&optional highlight) 1316 (defun article-date-user (&optional highlight)
1288 "Convert the current article date to the user-defined format." 1317 "Convert the current article date to the user-defined format.
1318 This format is defined by the `gnus-article-time-format' variable."
1289 (interactive (list t)) 1319 (interactive (list t))
1290 (article-date-ut 'user highlight)) 1320 (article-date-ut 'user highlight))
1291 1321
1292 (defun article-show-all () 1322 (defun article-show-all ()
1293 "Show all hidden text in the article buffer." 1323 "Show all hidden text in the article buffer."
1747 (unless (assq 'gnus-show-mime minor-mode-alist) 1777 (unless (assq 'gnus-show-mime minor-mode-alist)
1748 (push (list 'gnus-show-mime " MIME") minor-mode-alist)) 1778 (push (list 'gnus-show-mime " MIME") minor-mode-alist))
1749 (use-local-map gnus-article-mode-map) 1779 (use-local-map gnus-article-mode-map)
1750 (gnus-update-format-specifications nil 'article-mode) 1780 (gnus-update-format-specifications nil 'article-mode)
1751 (set (make-local-variable 'page-delimiter) gnus-page-delimiter) 1781 (set (make-local-variable 'page-delimiter) gnus-page-delimiter)
1782 (set (make-local-variable 'gnus-button-marker-list) nil)
1752 (gnus-set-default-directory) 1783 (gnus-set-default-directory)
1753 (buffer-disable-undo (current-buffer)) 1784 (buffer-disable-undo (current-buffer))
1754 (setq buffer-read-only t) 1785 (setq buffer-read-only t)
1755 (set-syntax-table gnus-article-mode-syntax-table) 1786 (set-syntax-table gnus-article-mode-syntax-table)
1756 (run-hooks 'gnus-article-mode-hook)) 1787 (run-hooks 'gnus-article-mode-hook))
2687 specified by `gnus-button-alist'." 2718 specified by `gnus-button-alist'."
2688 (interactive (list 'force)) 2719 (interactive (list 'force))
2689 (save-excursion 2720 (save-excursion
2690 (set-buffer gnus-article-buffer) 2721 (set-buffer gnus-article-buffer)
2691 ;; Remove all old markers. 2722 ;; Remove all old markers.
2692 (while gnus-button-marker-list 2723 (let (marker entry)
2693 (set-marker (pop gnus-button-marker-list) nil)) 2724 (while (setq marker (pop gnus-button-marker-list))
2725 (goto-char marker)
2726 (when (setq entry (gnus-button-entry))
2727 (put-text-property (match-beginning (nth 1 entry))
2728 (match-end (nth 1 entry))
2729 'gnus-callback nil))
2730 (set-marker marker nil)))
2694 (let ((buffer-read-only nil) 2731 (let ((buffer-read-only nil)
2695 (inhibit-point-motion-hooks t) 2732 (inhibit-point-motion-hooks t)
2696 (case-fold-search t) 2733 (case-fold-search t)
2697 (alist gnus-button-alist) 2734 (alist gnus-button-alist)
2698 beg entry regexp) 2735 beg entry regexp)
2708 (let* ((start (and entry (match-beginning (nth 1 entry)))) 2745 (let* ((start (and entry (match-beginning (nth 1 entry))))
2709 (end (and entry (match-end (nth 1 entry)))) 2746 (end (and entry (match-end (nth 1 entry))))
2710 (from (match-beginning 0))) 2747 (from (match-beginning 0)))
2711 (when (and (or (eq t (nth 1 entry)) 2748 (when (and (or (eq t (nth 1 entry))
2712 (eval (nth 1 entry))) 2749 (eval (nth 1 entry)))
2713 (not (gnus-button-in-region-p from end 'gnus-callback))) 2750 (not (gnus-button-in-region-p
2751 start end 'gnus-callback)))
2714 ;; That optional form returned non-nil, so we add the 2752 ;; That optional form returned non-nil, so we add the
2715 ;; button. 2753 ;; button.
2716 (gnus-article-add-button 2754 (gnus-article-add-button
2717 start end 'gnus-button-push 2755 start end 'gnus-button-push
2718 (car (push (set-marker (make-marker) from) 2756 (car (push (set-marker (make-marker) from)
2719 gnus-button-marker-list)))))))))) 2757 gnus-button-marker-list))))))))))
2720 2758