/[emacs]/emacs/lisp/gnus/gnus-art.el
ViewVC logotype

Diff of /emacs/lisp/gnus/gnus-art.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.47.4.7 by miles, Thu Nov 4 08:55:29 2004 UTC revision 1.47.4.8 by miles, Fri Nov 12 02:53:00 2004 UTC
# Line 321  advertisements.  For example: Line 321  advertisements.  For example:
321    :version "21.4"    :version "21.4"
322    :group 'gnus-article-washing)    :group 'gnus-article-washing)
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    
352  (defcustom gnus-emphasis-alist  (defcustom gnus-emphasis-alist
353    (let ((format    (let ((types
354           "\\(\\s-\\|^\\|\\=\\|[-\"]\\|\\s(\\)\\(%s\\(\\w+\\(\\s-+\\w+\\)*[.,]?\\)%s\\)\\(\\([-,.;:!?\"]\\|\\s)\\)+\\s-\\|[?!.]\\s-\\|\\s)\\|\\s-\\)")           '(("\\*" "\\*" bold nil 2)
         (types  
          '(("\\*" "\\*" bold)  
355             ("_" "_" underline)             ("_" "_" underline)
356             ("/" "/" italic)             ("/" "/" italic)
357             ("_/" "/_" underline-italic)             ("_/" "/_" underline-italic)
358             ("_\\*" "\\*_" underline-bold)             ("_\\*" "\\*_" underline-bold)
359             ("\\*/" "/\\*" bold-italic)             ("\\*/" "/\\*" bold-italic)
360             ("_\\*/" "/\\*_" underline-bold-italic))))             ("_\\*/" "/\\*_" underline-bold-italic))))
361      `(,@(mapcar      (nconc
362           (lambda (spec)       (gnus-emphasis-custom-with-format
363             (list        (mapcar (lambda (spec)
364              (format format (car spec) (cadr spec))                  (list (format format (car spec) (cadr spec))
365              2 3 (intern (format "gnus-emphasis-%s" (nth 2 spec)))))                        (or (nth 3 spec) 2)
366           types)                        (or (nth 4 spec) 3)
367          ("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)"                        (intern (format "gnus-emphasis-%s" (nth 2 spec)))))
368           2 3 gnus-emphasis-strikethru)                types))
369          ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"       '(("\\(\\s-\\|^\\)\\(-\\(\\(\\w\\|-[^-]\\)+\\)-\\)\\(\\s-\\|[?!.,;]\\)"
370           2 3 gnus-emphasis-underline)))          2 3 gnus-emphasis-strikethru)
371           ("\\(\\s-\\|^\\)\\(_\\(\\(\\w\\|_[^_]\\)+\\)_\\)\\(\\s-\\|[?!.,;]\\)"
372            2 3 gnus-emphasis-underline))))
373    "*Alist that says how to fontify certain phrases.    "*Alist that says how to fontify certain phrases.
374  Each item looks like this:  Each item looks like this:
375    
# Line 352  is a number that says what regular expre Line 380  is a number that says what regular expre
380  the entire emphasized word.  The third is a number that says what  the entire emphasized word.  The third is a number that says what
381  regexp grouping should be displayed and highlighted.  The fourth  regexp grouping should be displayed and highlighted.  The fourth
382  is the face used for highlighting."  is the face used for highlighting."
383    :type '(repeat (list :value ("" 0 0 default)    :type
384                         regexp    '(repeat
385                         (integer :tag "Match group")      (menu-choice
386                         (integer :tag "Emphasize group")       :format "%[Customizing Style%]\n%v"
387                         face))       :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)))
420    :group 'gnus-article-emphasis)    :group 'gnus-article-emphasis)
421    
422  (defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"  (defcustom gnus-emphasize-whitespace-regexp "^[ \t]+\\|[ \t]*\n"

Legend:
Removed from v.1.47.4.7  
changed lines
  Added in v.1.47.4.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26