aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2004-11-11 21:19:49 +0000
committerMiles Bader2004-11-11 21:19:49 +0000
commitae465fa737e2e3866795e96d30d692033d0d521a (patch)
treea98f2efb0663ae3f8471b0f690b989d307986054
parent13643b5f1787dc35035969dcb4d8c08649087f80 (diff)
downloademacs-ae465fa737e2e3866795e96d30d692033d0d521a.tar.gz
emacs-ae465fa737e2e3866795e96d30d692033d0d521a.zip
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689
Merge from gnus--rel--5.10 Patches applied: * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71 Update from CVS 2004-11-10 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/gnus-art.el (gnus-emphasis-alist): Don't hide asterisks by default; improve customization type. (gnus-emphasis-custom-with-format): New macro. (gnus-emphasis-custom-value-to-external): New function. (gnus-emphasis-custom-value-to-internal): New function.
-rw-r--r--lisp/gnus/ChangeLog8
-rw-r--r--lisp/gnus/gnus-art.el98
2 files changed, 87 insertions, 19 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 2dbe85b2aac..b605875da89 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,11 @@
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
12004-11-07 Katsumi Yamaoka <yamaoka@jpl.org> 92004-11-07 Katsumi Yamaoka <yamaoka@jpl.org>
2 10
3 * gnus-msg.el (gnus-configure-posting-styles): Don't cause the 11 * gnus-msg.el (gnus-configure-posting-styles): Don't cause the
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"