Gnus development mailing list
 help / color / mirror / Atom feed
* Citation formatting improvements
@ 2000-10-05 19:06 Emerick Rogul
  2000-10-05 19:27 ` ShengHuo ZHU
  2000-10-06 10:35 ` Kai Großjohann
  0 siblings, 2 replies; 5+ messages in thread
From: Emerick Rogul @ 2000-10-05 19:06 UTC (permalink / raw)


The current citation formatting in message-mode doesn't always do the
right thing (it seems like the paragraph-start and paragraph-end
variables in particular could be improved a lot).  I've been using the
following bit of e-lisp (appears at the end of this message) from
Gareth Rees, and it's been a great improvement, IMO.

Is there any chance of getting some of these changes into CVS?  I
think it would really make filling in message-mode a lot more
pleasant...  :-)

-Emerick

;; Better filling behaviour in Message mode (from Gareth Rees).

(defvar gdr-message-quote-chars "|:>")

(defun gdr-message-mode-vars ()
  (let ((quote-prefix-regexp
	 (concat
	  "[ \t]*"                      ; possible initial space
	  "\\(\\(" (regexp-quote message-yank-prefix) "\\|" ; user's prefix
	  "\\w+>\\|"                    ; supercite-style prefix
	  "[" gdr-message-quote-chars "]" ; standard prefix
	  "\\)[ \t]*\\)+")))            ; possible space after each prefix
    (setq paragraph-start
	  (concat
	   (regexp-quote mail-header-separator) "$\\|"
	   "[ \t]*$\\|"                 ; blank lines
	   "-- $\\|"                    ; signature delimiter
	   "---+$\\|"                   ; delimiters for forwarded messages
	   page-delimiter "$\\|"        ; spoiler warnings
	   ".*wrote:$\\|"               ; attribution lines
	   quote-prefix-regexp "$"))    ; empty lines in quoted text
    (setq paragraph-separate paragraph-start)
    (setq adaptive-fill-regexp
	  (concat quote-prefix-regexp "\\|" adaptive-fill-regexp))
    (setq adaptive-fill-first-line-regexp
	  (concat quote-prefix-regexp "\\|"
		  adaptive-fill-first-line-regexp))))

(add-hook 'message-mode-hook 'gdr-message-mode-vars)

-- 
-------------------------------------------------------------------------
Emerick Rogul         /\/  "i was going to take every drug known to the
emerick@cs.bu.edu     /\/   human race and shag anything that moved."
------------------------------------------------- 'ecstasy', irvine welsh



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Citation formatting improvements
  2000-10-05 19:06 Citation formatting improvements Emerick Rogul
@ 2000-10-05 19:27 ` ShengHuo ZHU
  2000-10-06  4:08   ` Emerick Rogul
  2000-10-06 10:35 ` Kai Großjohann
  1 sibling, 1 reply; 5+ messages in thread
From: ShengHuo ZHU @ 2000-10-05 19:27 UTC (permalink / raw)


Emerick Rogul <emerick@csa.bu.edu> writes:

> Is there any chance of getting some of these changes into CVS?  I
> think it would really make filling in message-mode a lot more
> pleasant...  :-)

You could send a patch here.

ShengHuo



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Citation formatting improvements
  2000-10-05 19:27 ` ShengHuo ZHU
@ 2000-10-06  4:08   ` Emerick Rogul
  2000-10-06 12:49     ` ShengHuo ZHU
  0 siblings, 1 reply; 5+ messages in thread
From: Emerick Rogul @ 2000-10-06  4:08 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

ShengHuo ZHU writes:

: Emerick Rogul <emerick@csa.bu.edu> writes:
:: Is there any chance of getting some of these changes into CVS?  I
:: think it would really make filling in message-mode a lot more
:: pleasant...  :-)

: You could send a patch here.

: ShengHuo

OK.  I've attached a patch to this message.  It includes the variable
changes as originally suggested by Gareth Rees.  It seems to work
really well, but if people have suggestions for changes/additions,
please feel free to suggest them.

-Emerick


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch for message-mode fill variables --]
[-- Type: text/x-patch, Size: 4328 bytes --]

*** /csa/forum/emerick/gnus/lisp/message.el	Fri Oct  6 00:00:02 2000
--- message.el	Thu Oct  5 23:55:40 2000
***************
*** 1464,1483 ****
  	      (error "Face %s not configured for %s mode" face mode-name)))
  	  "")
  	facemenu-remove-face-function t)
-   (make-local-variable 'paragraph-separate)
-   (make-local-variable 'paragraph-start)
-   ;; `-- ' precedes the signature.  `-----' appears at the start of the
-   ;; lines that delimit forwarded messages.
-   ;; Lines containing just >= 3 dashes, perhaps after whitespace,
-   ;; are also sometimes used and should be separators.
-   (setq paragraph-start
- 	(concat (regexp-quote mail-header-separator)
- 		"$\\|[ \t]*[a-z0-9A-Z]*>+[ \t]*$\\|[ \t]*$\\|"
- 		"-- $\\|---+$\\|"
- 		page-delimiter
- 		;;!!! Uhm... shurely this can't be right?
- 		"[> " (regexp-quote message-yank-prefix) "]+$"))
-   (setq paragraph-separate paragraph-start)
    (make-local-variable 'message-reply-headers)
    (setq message-reply-headers nil)
    (make-local-variable 'message-newsreader)
--- 1464,1469 ----
***************
*** 1486,1491 ****
--- 1472,1478 ----
    (set (make-local-variable 'message-sent-message-via) nil)
    (set (make-local-variable 'message-checksum) nil)
    (set (make-local-variable 'message-mime-part) 0)
+   (message-setup-fill-variables)
    ;;(when (fboundp 'mail-hist-define-keys)
    ;;  (mail-hist-define-keys))
    (if (featurep 'xemacs)
***************
*** 1500,1521 ****
  	(mail-abbrevs-setup)
        (mail-aliases-setup)))
    (message-set-auto-save-file-name)
-   (make-local-variable 'adaptive-fill-regexp)
-   (setq adaptive-fill-regexp
- 	(concat "[ \t]*[-a-z0-9A-Z]*\\(>[ \t]*\\)+[ \t]*\\|" adaptive-fill-regexp))
-   (unless (boundp 'adaptive-fill-first-line-regexp)
-     (setq adaptive-fill-first-line-regexp nil))
-   (make-local-variable 'adaptive-fill-first-line-regexp)
-   (setq adaptive-fill-first-line-regexp
- 	(concat "[ \t]*[-a-z0-9A-Z]*\\(>[ \t]*\\)+[ \t]*\\|"
- 		adaptive-fill-first-line-regexp))
-   (make-local-variable 'auto-fill-inhibit-regexp)
-   (setq auto-fill-inhibit-regexp "^[A-Z][^: \n\t]+:")
    (mm-enable-multibyte)
    (make-local-variable 'indent-tabs-mode) ;Turn off tabs for indentation.
    (setq indent-tabs-mode nil)
    (mml-mode)
    (run-hooks 'text-mode-hook 'message-mode-hook))
  
  \f
  
--- 1487,1530 ----
  	(mail-abbrevs-setup)
        (mail-aliases-setup)))
    (message-set-auto-save-file-name)
    (mm-enable-multibyte)
    (make-local-variable 'indent-tabs-mode) ;Turn off tabs for indentation.
    (setq indent-tabs-mode nil)
    (mml-mode)
    (run-hooks 'text-mode-hook 'message-mode-hook))
+ 
+ (defun message-setup-fill-variables ()
+   "Setup message fill variables."
+   (make-local-variable 'paragraph-separate)
+   (make-local-variable 'paragraph-start)
+   (make-local-variable 'adaptive-fill-regexp)
+   (unless (boundp 'adaptive-fill-first-line-regexp)
+     (setq adaptive-fill-first-line-regexp nil))
+   (make-local-variable 'adaptive-fill-first-line-regexp)
+   (make-local-variable 'auto-fill-inhibit-regexp)
+   (let ((quote-prefix-regexp
+          (concat
+           "[ \t]*"                      ; possible initial space
+           "\\(\\(" (regexp-quote message-yank-prefix) "\\|" ; user's prefix
+           "\\w+>\\|"                    ; supercite-style prefix
+           "[|:>]"                       ; standard prefix
+           "\\)[ \t]*\\)+")))            ; possible space after each prefix
+     (setq paragraph-start
+           (concat
+            (regexp-quote mail-header-separator) "$\\|"
+            "[ \t]*$\\|"                 ; blank lines
+            "-- $\\|"                    ; signature delimiter
+            "---+$\\|"                   ; delimiters for forwarded messages
+            page-delimiter "$\\|"        ; spoiler warnings
+            ".*wrote:$\\|"               ; attribution lines
+            quote-prefix-regexp "$"))    ; empty lines in quoted text
+     (setq paragraph-separate paragraph-start)
+     (setq adaptive-fill-regexp
+           (concat quote-prefix-regexp "\\|" adaptive-fill-regexp))
+     (setq adaptive-fill-first-line-regexp
+           (concat quote-prefix-regexp "\\|"
+                   adaptive-fill-first-line-regexp))
+     (setq auto-fill-inhibit-regexp "^[A-Z][^: \n\t]+:")))
  
  \f
  

[-- Attachment #3: Type: text/plain, Size: 294 bytes --]


-- 
-------------------------------------------------------------------------
Emerick Rogul        /\/  "...i saw your girlfriend and she's eating her
emerick@cs.bu.edu    /\/   fingers like they're just another meal."
------------------------------------------------- 'summer babe', pavement

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Citation formatting improvements
  2000-10-05 19:06 Citation formatting improvements Emerick Rogul
  2000-10-05 19:27 ` ShengHuo ZHU
@ 2000-10-06 10:35 ` Kai Großjohann
  1 sibling, 0 replies; 5+ messages in thread
From: Kai Großjohann @ 2000-10-06 10:35 UTC (permalink / raw)
  Cc: ding

On 05 Oct 2000, Emerick Rogul wrote:

>   (let ((quote-prefix-regexp
> 	 (concat
> 	  "[ \t]*"                      ; possible initial space
> 	  "\\(\\(" (regexp-quote message-yank-prefix) "\\|" ; user's prefix
> 	  "\\w+>\\|"                    ; supercite-style prefix
> 	  "[" gdr-message-quote-chars "]" ; standard prefix
> 	  "\\)[ \t]*\\)+")))            ; possible space after each prefix

I think this is a good chance to unify the citation prefix handling.
Various places in Gnus use various definitions for it, all similar but
subtly different.

Do you think it would be possible to have a single regexp in a single
file that defines this, and to have both Message and Gnus use this
variable? 

kai
-- 
I like BOTH kinds of music.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Citation formatting improvements
  2000-10-06  4:08   ` Emerick Rogul
@ 2000-10-06 12:49     ` ShengHuo ZHU
  0 siblings, 0 replies; 5+ messages in thread
From: ShengHuo ZHU @ 2000-10-06 12:49 UTC (permalink / raw)


Emerick Rogul <emerick@csa.bu.edu> writes:

> OK.  I've attached a patch to this message.  It includes the variable

Installed.

ShengHuo



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-10-06 12:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-05 19:06 Citation formatting improvements Emerick Rogul
2000-10-05 19:27 ` ShengHuo ZHU
2000-10-06  4:08   ` Emerick Rogul
2000-10-06 12:49     ` ShengHuo ZHU
2000-10-06 10:35 ` Kai Großjohann

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