aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/gnus
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/ChangeLog14
-rw-r--r--lisp/gnus/gnus-art.el98
-rw-r--r--lisp/gnus/gnus-msg.el12
3 files changed, 100 insertions, 24 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index d7ebedc53f8..b605875da89 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,17 @@
12004-11-10 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus-art.el (gnus-emphasis-alist): Don't hide asterisks by
4 default; improve customization type.
5 (gnus-emphasis-custom-with-format): New macro.
6 (gnus-emphasis-custom-value-to-external): New function.
7 (gnus-emphasis-custom-value-to-internal): New function.
8
92004-11-07 Katsumi Yamaoka <yamaoka@jpl.org>
10
11 * gnus-msg.el (gnus-configure-posting-styles): Don't cause the
12 "Args out of range" error. Reported by Arnaud Giersch
13 <arnaud.giersch@free.fr>.
14
12004-11-04 Richard M. Stallman <rms@gnu.org> 152004-11-04 Richard M. Stallman <rms@gnu.org>
2 16
3 * spam.el (spam group): Add :version. 17 * spam.el (spam group): Add :version.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index c0266300983..a87348188f9 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -321,27 +321,55 @@ advertisements. For example:
321 :version "21.4" 321 :version "21.4"
322 :group 'gnus-article-washing) 322 :group 'gnus-article-washing)
323 323
324(defmacro gnus-emphasis-custom-with-format (&rest body)
325 `(let ((format "\
326\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\
327\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)"))
328 ,@body))
329
330(defun gnus-emphasis-custom-value-to-external (value)
331 (gnus-emphasis-custom-with-format
332 (if (consp (car value))
333 (list (format format (car (car value)) (cdr (car value)))
334 2
335 (if (nth 1 value) 2 3)
336 (nth 2 value))
337 value)))
338
339(defun gnus-emphasis-custom-value-to-internal (value)
340 (gnus-emphasis-custom-with-format
341 (let ((regexp (concat "\\`"
342 (format (regexp-quote format)
343 "\\([^()]+\\)" "\\([^()]+\\)")
344 "\\'"))
345 pattern)
346 (if (string-match regexp (setq pattern (car value)))
347 (list (cons (match-string 1 pattern) (match-string 2 pattern))
348 (= (nth 2 value) 2)
349 (nth 3 value))
350 value))))
351
324(defcustom gnus-emphasis-alist 352(defcustom gnus-emphasis-alist
325 (let ((format 353 (let ((types
326 "\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)") 354 '(("\\*" "\\*" bold nil 2)
327 (types
328 '(("\\*" "\\*" bold)
329 ("_" "_" underline) 355 ("_" "_" underline)
330 ("/" "/" italic) 356 ("/" "/" italic)
331 ("_/" "/_" underline-italic) 357 ("_/" "/_" underline-italic)
332 ("_\\*" "\\*_" underline-bold) 358 ("_\\*" "\\*_" underline-bold)
333 ("\\*/" "/\\*" bold-italic) 359 ("\\*/" "/\\*" bold-italic)
334 ("_\\*/" "/\\*_" underline-bold-italic)))) 360 ("_\\*/" "/\\*_" underline-bold-italic))))
335 `(,@(mapcar 361 (nconc
336 (lambda (spec) 362 (gnus-emphasis-custom-with-format
337 (list 363 (mapcar (lambda (spec)
338 (format format (car spec) (cadr spec)) 364 (list (format format (car spec) (cadr spec))
339 2 3 (intern (format "gnus-emphasis-%s" (nth 2 spec))))) 365 (or (nth 3 spec) 2)
340 types) 366 (or (nth 4 spec) 3)
341 ("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)" 367 (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
342 2 3 gnus-emphasis-strikethru) 368 types))
343 ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)" 369 '(("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)"
344 2 3 gnus-emphasis-underline))) 370 2 3 gnus-emphasis-strikethru)
371 ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
372 2 3 gnus-emphasis-underline))))
345 "*Alist that says how to fontify certain phrases. 373 "*Alist that says how to fontify certain phrases.
346Each item looks like this: 374Each item looks like this:
347 375
@@ -352,11 +380,43 @@ is a number that says what regular expression grouping used to find
352the entire emphasized word. The third is a number that says what 380the entire emphasized word. The third is a number that says what
353regexp grouping should be displayed and highlighted. The fourth 381regexp grouping should be displayed and highlighted. The fourth
354is the face used for highlighting." 382is the face used for highlighting."
355 :type '(repeat (list :value ("" 0 0 default) 383 :type
356 regexp 384 '(repeat
357 (integer :tag "Match group") 385 (menu-choice
358 (integer :tag "Emphasize group") 386 :format "%[Customizing Style%]\n%v"
359 face)) 387 :indent 2
388 (group :tag "Default"
389 :value ("" 0 0 default)
390 :value-create
391 (lambda (widget)
392 (let ((value (widget-get
393 (cadr (widget-get (widget-get widget :parent)
394 :args))
395 :value)))
396 (if (not (eq (nth 2 value) 'default))
397 (widget-put
398 widget
399 :value
400 (gnus-emphasis-custom-value-to-external value))))
401 (widget-group-value-create widget))
402 (regexp :format "%t: %v\n" :size 1)
403 (integer :format "Match group: %v\n" :size 0)
404 (integer :format "Emphasize group: %v\n" :size 0)
405 face)
406 (group :tag "Simple"
407 :value (("_" . "_") nil default)
408 (cons :format "%v"
409 (regexp :format "Start regexp: %v\n" :size 0)
410 (regexp :format "End regexp: %v\n" :size 0))
411 (boolean :format "Show start and end patterns: %[%v%]\n"
412 :on " On " :off " Off ")
413 face)))
414 :get (lambda (symbol)
415 (mapcar 'gnus-emphasis-custom-value-to-internal
416 (default-value symbol)))
417 :set (lambda (symbol value)
418 (set-default symbol (mapcar 'gnus-emphasis-custom-value-to-external
419 value)))
360 :group 'gnus-article-emphasis) 420 :group 'gnus-article-emphasis)
361 421
362(defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n" 422(defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index 6b093480940..7948efc2572 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1871,11 +1871,13 @@ this is a reply."
1871 (when (and filep v) 1871 (when (and filep v)
1872 (setq v (with-temp-buffer 1872 (setq v (with-temp-buffer
1873 (insert-file-contents v) 1873 (insert-file-contents v)
1874 (goto-char (point-max)) 1874 (buffer-substring
1875 (skip-chars-backward "\n") 1875 (point-min)
1876 (delete-region (+ (point) (if (bolp) 0 1)) 1876 (progn
1877 (point-max)) 1877 (goto-char (point-max))
1878 (buffer-string)))) 1878 (if (zerop (skip-chars-backward "\n"))
1879 (point)
1880 (1+ (point))))))))
1879 (setq results (delq (assoc element results) results)) 1881 (setq results (delq (assoc element results) results))
1880 (push (cons element v) results)))) 1882 (push (cons element v) results))))
1881 ;; Now we have all the styles, so we insert them. 1883 ;; Now we have all the styles, so we insert them.