Gnus development mailing list
 help / color / mirror / Atom feed
* message-cite-prefix-regexp
@ 2000-11-15 10:17 dme
  0 siblings, 0 replies; only message in thread
From: dme @ 2000-11-15 10:17 UTC (permalink / raw)


Another round of proposed changes for comment please.

Since last time:
      * incorporate Vladimir's comments on the regexp, then apply some
        more changes.
      * use message-cite-prefix-regexp in message-mode highlighting.
      * anchor the regexp better in some searches.

I'm particularly interested to know where:
    * message-newline-and-reformat does the wrong thing,
    * highlighting is annoying (I'm not convinced that it will ever be
      possible to get it exactly right).

The new regexp is slightly more greedy than the old one, but it seems
to be getting good hits more of the time for me.  It will now
correctly support a prefix such as:

> foo> | bar> This the text that is cited and it...
> foo> | bar> continues on the next line.

which didn't work before.  I would expect to get some false hits as a
result of this, but it's difficult to know how bad they are from just
my mailbox.


Index: lisp/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v
retrieving revision 6.91
diff -u -r6.91 ChangeLog
--- lisp/ChangeLog	2000/11/10 11:06:52	6.91
+++ lisp/ChangeLog	2000/11/15 09:07:17
@@ -1,3 +1,20 @@
+2000-11-12  David Edmondson  <dme@dme.org>
+
+	* message.el (message-font-lock-keywords): use
+	message-cite-prefix-regexp.
+
+2000-11-12  David Edmondson  <dme@dme.org>
+
+	* message.el (message-cite-prefix-regexp): moved from gnus-cite.el
+	and replace `.' with `\w' to allow for different syntax tables
+	(from Vladimir Volovich).
+	* message.el (message-newline-and-reformat): use
+	`message-cite-prefix-regexp'.
+	* gnus-cite.el (gnus-supercite-regexp): use
+	`message-cite-prefix-regexp'.
+	* gnus-cite.el (gnus-cite-parse): use
+	`message-cite-prefix-regexp'.
+
 2000-11-07  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 
 	* gnus-sum.el (gnus-move-split-methods): Say that
Index: lisp/gnus-cite.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-cite.el,v
retrieving revision 6.0
diff -u -r6.0 gnus-cite.el
--- lisp/gnus-cite.el	2000/10/27 23:11:23	6.0
+++ lisp/gnus-cite.el	2000/11/15 09:07:21
@@ -26,6 +26,7 @@
 (require 'gnus)
 (require 'gnus-art)
 (require 'gnus-range)
+(require 'message)	; for message-cite-prefix-regexp
 
 ;;; Customization:
 
@@ -74,19 +75,13 @@
   :type '(choice (const :tag "all" nil)
 		 integer))
 
-(defcustom gnus-cite-prefix-regexp
-  "^[]>»|:}+ ]*[]>»|:}+]\\(.*>»\\)?\\|^.*>"
-  "*Regexp matching the longest possible citation prefix on a line."
-  :group 'gnus-cite
-  :type 'regexp)
-
 (defcustom gnus-cite-max-prefix 20
   "Maximum possible length for a citation prefix."
   :group 'gnus-cite
   :type 'integer)
 
 (defcustom gnus-supercite-regexp
-  (concat "^\\(" gnus-cite-prefix-regexp "\\)? *"
+  (concat "^\\(" message-cite-prefix-regexp "\\)? *"
 	  ">>>>> +\"\\([^\"\n]+\\)\" +==")
   "*Regexp matching normal Supercite attribution lines.
 The first grouping must match prefixes added by other packages."
@@ -306,7 +301,7 @@
 corresponding citation merged with `gnus-cite-attribution-face'.
 
 Text is considered cited if at least `gnus-cite-minimum-match-count'
-lines matches `gnus-cite-prefix-regexp' with the same prefix.
+lines matches `message-cite-prefix-regexp' with the same prefix.
 
 Lines matching `gnus-cite-attribution-suffix' and perhaps
 `gnus-cite-attribution-prefix' are considered attribution lines."
@@ -679,7 +674,7 @@
       ;; Ignore very long prefixes.
       (when (> end (+ (point) gnus-cite-max-prefix))
 	(setq end (+ (point) gnus-cite-max-prefix)))
-      (while (re-search-forward gnus-cite-prefix-regexp (1- end) t)
+      (while (re-search-forward message-cite-prefix-regexp (1- end) t)
 	;; Each prefix.
 	(setq end (match-end 0)
 	      prefix (buffer-substring begin end))
Index: lisp/message.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v
retrieving revision 6.7
diff -u -r6.7 message.el
--- lisp/message.el	2000/11/04 17:13:56	6.7
+++ lisp/message.el	2000/11/15 09:07:45
@@ -331,6 +331,12 @@
   :group 'message-insertion
   :type 'regexp)
 
+(defcustom message-cite-prefix-regexp
+  "[ \t]*\\(\\(\\w\\|[_-\\.]\\)+>+[ \t]*\\|[]>»|:}+ ]*[]>»|:}+][ \t]*\\)+"
+ "*Regexp matching the longest possible citation prefix on a line."
+  :group 'message-insertion
+  :type 'regexp)
+
 (defcustom message-cancel-message "I am canceling my own article.\n"
   "Message to be inserted in the cancel message."
   :group 'message-interface
@@ -820,9 +826,7 @@
   :group 'message-faces)
 
 (defvar message-font-lock-keywords
-  (let* ((cite-prefix "A-Za-z")
-	 (cite-suffix (concat cite-prefix "0-9_.@-"))
-	 (content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?"))
+  (let ((content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?"))
     `((,(concat "^\\([Tt]o:\\)" content)
        (1 'message-header-name-face)
        (2 'message-header-to-face nil t))
@@ -846,9 +850,7 @@
 	    `((,(concat "^\\(" (regexp-quote mail-header-separator) "\\)$")
 	       1 'message-separator-face))
 	  nil)
-      (,(concat "^[ \t]*"
-		"\\([" cite-prefix "]+[" cite-suffix "]*\\)?"
-		"[:>|}].*")
+      (,(concat "^\\(" message-cite-prefix-regexp "\\).*")
        (0 'message-cited-text-face))
       ("<#/?\\(multipart\\|part\\|external\\|mml\\).*>"
        (0 'message-mml-face))))
@@ -1711,15 +1713,12 @@
 (defun message-newline-and-reformat ()
   "Insert four newlines, and then reformat if inside quoted text."
   (interactive)
-  (let ((prefix "[]>»|:}+ \t]*")
-	(supercite-thing "[-._a-zA-Z0-9]*[>]+[ \t]*")
-	quoted point)
+  (let (quoted point)
     (unless (bolp)
       (save-excursion
-	(beginning-of-line)
-	(when (looking-at (concat prefix "\\|"
-				  supercite-thing))
-	  (setq quoted (match-string 0))))
+        (beginning-of-line)
+	(when (looking-at message-cite-prefix-regexp)
+          (setq quoted (match-string 0))))
       (insert "\n"))
     (setq point (point))
     (insert "\n\n\n")
Index: texi/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/ChangeLog,v
retrieving revision 6.8
diff -u -r6.8 ChangeLog
--- texi/ChangeLog	2000/11/10 11:06:46	6.8
+++ texi/ChangeLog	2000/11/15 09:07:53
@@ -1,3 +1,9 @@
+2000-11-12  David Edmondson  <dme@dme.org>
+
+	* gnus.texi: remove `gnus-cite-prefix-regexp'.
+	* message.texi (Insertion): move `gnus-cite-prefix-regexp' from
+	gnus.texi to here and rename to `message-cite-prefix-regexp'.
+
 2000-11-07  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 
 	* gnus.texi (Mail Group Commands): `gnus-move-split-methods' uses
Index: texi/gnus.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/gnus.texi,v
retrieving revision 6.10
diff -u -r6.10 gnus.texi
--- texi/gnus.texi	2000/11/10 11:06:42	6.10
+++ texi/gnus.texi	2000/11/15 09:09:43
@@ -6995,10 +6995,6 @@
 If the article size if bigger than this variable (which is 25000 by
 default), no citation highlighting will be performed.
 
-@item gnus-cite-prefix-regexp
-@vindex gnus-cite-prefix-regexp
-Regexp matching the longest possible citation prefix on a line.
-
 @item gnus-cite-max-prefix
 @vindex gnus-cite-max-prefix
 Maximum possible length for a citation prefix (default 20).
Index: texi/message.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/message.texi,v
retrieving revision 6.0
diff -u -r6.0 message.texi
--- texi/message.texi	2000/10/27 23:12:30	6.0
+++ texi/message.texi	2000/11/15 09:09:49
@@ -464,6 +464,10 @@
 messages.  The default is @samp{.}, which means that all headers will be
 removed.
 
+@item message-cite-prefix-regexp
+@vindex message-cite-prefix-regexp
+Regexp matching the longest possible citation prefix on a line.
+
 @item message-citation-line-function
 @vindex message-citation-line-function
 Function called to insert the citation line.  The default is

dme.



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-11-15 10:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-15 10:17 message-cite-prefix-regexp dme

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).