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:05:28 +0100	[thread overview]
Message-ID: <m3el5vkmqa.fsf@hamster.pflaesterer.de> (raw)
In-Reply-To: <hhk7fnrxnc.fsf@blah.pl>

On Wed, 26 Feb 2003, Maciej Matysiak <- phoner.ding@blah.pl wrote:

> would it be possible to make gnus recongnize ':' as citation prefix,
> but not ':)', ':-)' and other smiley mutations? that'd be prolly quite
> ugly regexp i think, but at the moment i have to remove the colon from
> m-c-p-r (or have hilighted every second line in some mails :( ).

It is possible and the regexp would not be too ugly (well for some
approbiate values of ugly). If we accept that the second char of a
smiley is a dash (if you look at the value of `smiley-regexp-alist'
at the moment that's true).
Then we could write (I rewrote the definition a bit so it is easier to
read):

(setq message-cite-prefix-regexp
	(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]*[]>|#}+]"
	       "\\)+")))))

Here a some lines to test if it works:
> should be a citation
> also
: and here
: and there
:- but here not

The best way would be IMO to use the keys of `smiley-regexp-alist'. They
could be retrieved like that:

(let ((smileyreg))
  (dolist (entry smiley-regexp-alist)
    (setq smileyreg (concat smileyreg (and smileyreg "\\|") (car entry))))
  smileyreg)

but the problem is, there are some constructions which are not allowed
in between square brackets.


bye
   KP

-- 
Der wahre Weltuntergang ist die Vernichtung des Geistes, der andere hängt von
dem gleichgiltigen Versuch ab, ob nach der Vernichtung des Geistes noch eine
Welt bestehen kann.
                   Karl Kraus 'Untergang der Welt durch schwarze Magie'



  parent reply	other threads:[~2003-02-26 17:05 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 [this message]
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
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=m3el5vkmqa.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).