Gnus development mailing list
 help / color / mirror / Atom feed
From: sigurd@12move.de (Karl Pflästerer)
Subject: Re: Slighty improved regexps for citations
Date: Wed, 26 Feb 2003 18:59:20 +0100	[thread overview]
Message-ID: <m33cmbkked.fsf@hamster.pflaesterer.de> (raw)
In-Reply-To: <v9vfz7atg8.fsf@marauder.physik.uni-ulm.de>

On Wed, 26 Feb 2003, Reiner Steib <- 4.uce.03.r.s@nurfuerspam.de wrote:

> On Wed, Feb 26 2003, Frank Schmitt wrote:

>> sigurd@12move.de (Karl Pflästerer) writes:
>>> I found the reason now and IMO it's worth to discuss again about
>>> it.

[...]

>>> The reason was that people if they /wrote/ a message and a colon was
>>> the first sign in a line gnus thought this line was a quote and so
>>> used the text colour to indicate a citation.

> Ah, `message' is required from `gnus-cite.el' and the function
> `gnus-cite-parse' uses `message-cite-prefix-regexp'.

Yep.

[...]

> What about adding a simpler variable `message-cite-prefix-chars' (or a
> list?) with default value of say `>', `|' and `}' (string ">|}" or a
> list).  Then the user could easily add some chars (with concat,
> add-to-list, ...?). Or add a variable for extra chars (empty by
> default) that is integrated into `message-cite-prefix-regexp' during
> the initialization of this variable.  What do you think?

Here is a version with an alist.  The alist could hold a bunch of values
and the user could select the approbiate one by changing the value of
`message-cite-prefix-regexp-value' (which could be a symbol).  With
`add-to-list' the user could easily add new alist entrys. Or the alist
could be written with `defcustom'.  To add a variable seems to me not
convenient enough and also not very flexible. We would end were we stay
now: a lot of users frob that variable in `.gnus' to fit their
preferences.  For that they have to know a bit about regexps so a
(possible long) alist would be easier to use especially for newbies[a]


(defcustom message-cite-prefix-regexp-value 'full)

(setq message-cite-prefix-regexp-alist
	(list
	 (cons 'full
	       (if (string-match "[[:digit:]]" "1");; support POSIX?
		(concat
		 "\\("
		 "[ \t]*[-_.[:word:]]+>+\\|"
		 "[ \t]*:+[^-]\\|"
		 "[ \t]*[]>|#}+]"
		 "\\)+")

		;; ?-, ?_ or ?. MUST NOT be in syntax entry w.
		(let ((old-table (syntax-table))
		      non-word-constituents)
		  (set-syntax-table text-mode-syntax-table)
		  (setq non-word-constituents
			  (concat
			   (if (string-match "\\w" "-")  "" "-")
			   (if (string-match "\\w" "_")  "" "_")
			   (if (string-match "\\w" ".")  "" ".")))
		  (set-syntax-table old-table)
		  (if (equal non-word-constituents "")
		    (concat
		     "\\("
		     "[ \t]*\\(\\w\\)+>+\\|"
		     "[ \t]*:+[^-]\\|"
		     "[ \t]*[]>|}+]"
		     "\\)+")
		    (concat
		     "\\("
		     "[ \t]*\\(\\w\\|[" non-word-constituents "]\\)+>+\\|"
		     "[ \t]*:+[^-]\\|"
		     "[ \t]*[]>|#}+]"
		     "\\)+")))))
	 (cons 'simple
	       (if (string-match "[[:digit:]]" "1");; support POSIX?
		(concat
		 "\\("
		 "[ \t]*[-_.[:word:]]+>+\\|"
		 "[ \t]*[>|]"
		 "\\)+")

		;; ?-, ?_ or ?. MUST NOT be in syntax entry w.
		(let ((old-table (syntax-table))
		      non-word-constituents)
		  (set-syntax-table text-mode-syntax-table)
		  (setq non-word-constituents
			  (concat
			   (if (string-match "\\w" "-")  "" "-")
			   (if (string-match "\\w" "_")  "" "_")
			   (if (string-match "\\w" ".")  "" ".")))
		  (set-syntax-table old-table)
		  (if (equal non-word-constituents "")
		    (concat
		     "\\("
		     "[ \t]*\\(\\w\\)+>+\\|"
		     "[ \t]*[>|]"
		     "\\)+")
		    (concat
		     "\\("
		     "[ \t]*\\(\\w\\|[" non-word-constituents "]\\)+>+\\|"
		     "[ \t]*[>|]"
		     "\\)+")))))))

(setq message-cite-prefix-regexp
	(cdr (assq message-cite-prefix-regexp-value
	message-cite-prefix-regexp-alist)))


>> For the seldom used ones, Gnus should only mark lines beginning with
>> those as quotes if the are several such lines.

> Nice idea.  It this feasible?  (I don't grok that font-lock stuff.)

But that happens already for *all* citation marks.
,------------------------------------------------------------------------. 
| `gnus-cite-minimum-match-count' is a variable declared in Lisp.         |
|   -- loaded from "gnus-cite"                                            |
|                                                                         |
| Value: 2                                                                |
|                                                                         |
| Documentation:                                                          |
| Minimum number of identical prefixes before we believe it's a citation. |
|                                                                         |
`------------------------------------------------------------------------´ 

bye
   KP

_____
[a] (BTW what's the name for new Gnus users: gnubies? :-) I like it
-- 
And as in uffish thought he stood,
The Jabberwock, with eyes of flame,
Came whiffling through the tulgey wood,
And burbled as it came!                "Lewis Carroll" "Jabberwocky"



  reply	other threads:[~2003-02-26 17:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-25 20:27 Karl Pflästerer
2003-02-25 21:06 ` Karl Pflästerer
     [not found]   ` <hhk7fnrxnc.fsf@blah.pl>
2003-02-26 17:05     ` Karl Pflästerer
2003-02-25 21:19 ` Reiner Steib
2003-02-25 22:05   ` Karl Pflästerer
2003-02-25 22:27   ` Karl Pflästerer
2003-02-25 23:09     ` Frank Schmitt
2003-02-26 16:37       ` Reiner Steib
2003-02-26 17:59         ` Karl Pflästerer [this message]
2003-02-26 22:11           ` Karl Pflästerer
2003-02-25 21:33 ` Raymond Scholz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m33cmbkked.fsf@hamster.pflaesterer.de \
    --to=sigurd@12move.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).