semi problem setting paragraph-start

Katsumi Yamaoka yamaoka @ jpl.org
2007年 4月 16日 (月) 11:13:29 JST


>>>>> In [emacs-mime-ja : No.02144] John Owens wrote:

> Greetings, I've been getting strange errors in filladapt for quite
> some time now and we think we've tracked down the problem to SEMI.

> Here's the thread:

> http://thread.gmane.org/gmane.emacs.devel/68275

> The code is in semi.el (I'm using the latest version, in Carbon
> Emacs):

It's in mime-edit.el.

> (defun turn-on-mime-edit ()
>     ...
>     (setq paragraph-start
> 	  (regexp-or mime-edit-single-part-tag-regexp
> 		     paragraph-start))

> The problem is that paragraph-start is set here many times so it
> becomes very very long. 307 nested groups.

That's obviously a bug.  In addition, there's also the same
problem about `paragraph-separate'.

> One of the commenters in that thread noted that "turn-on-mime-edit"
> must have been called repeatedly. The folks on emacs.devel suggest
> that it's necessary to "call make-local-variable on paragraph-start."

> Does this seem like a problem? What else can I do to help track it
> down?

It's not necessarily a problem if FOO-mail-mode, which runs
`turn-on-mime-edit', makes `paragraph-start' buffer-local or is
derived from a mode which does it.  For example, it's not a
problem in Semi-gnus.  Otherwise, since the code does

NEW_VALUE <= OLD_VALUE + `mime-edit-single-part-tag-regexp'

, a user might be required implicitly to set `OLD_VALUE' with a
proper one for a mail mode before calling `turn-on-mime-edit'.
However, these don't seem to be general and `turn-on-mime-edit'
should have a default value for `OLD_VALUE' anyway, I think.  I
have two ideas but I leave them to the maintainer and the
developers.

Regards,

1. Use the defalut values of `paragraph-start' and
   `paragraph-separate'.

--- mime-edit.el~	2006-12-03 21:51:39 +0000
+++ mime-edit.el	2007-04-16 01:57:17 +0000
@@ -1068,12 +1068,12 @@
     (enable-invisible)
 
     ;; I don't care about saving these.
-    (setq paragraph-start
-	  (regexp-or mime-edit-single-part-tag-regexp
-		     paragraph-start))
-    (setq paragraph-separate
-	  (regexp-or mime-edit-single-part-tag-regexp
-		     paragraph-separate))
+    (set (make-local-variable 'paragraph-start)
+	 (regexp-or mime-edit-single-part-tag-regexp
+		    (default-value 'paragraph-start)))
+    (set (make-local-variable 'paragraph-separate)
+	 (regexp-or mime-edit-single-part-tag-regexp
+		    (default-value 'paragraph-separate)))
     (run-hooks 'mime-edit-mode-hook)
     (message
      "%s"

2. Enable a user to customize the value.  This version uses the
   same value for `paragraph-start' and `paragraph-separate' as
   message.el does.

--- mime-edit.el~	2006-12-03 21:51:39 +0000
+++ mime-edit.el	2007-04-16 01:57:17 +0000
@@ -634,6 +634,13 @@
 (defvar mime-tag-format-with-encoding "
-------------- next part --------------
   "*Control-string making a MIME tag with encoding.")
 
+(defcustom mime-edit-paragraph-separator (default-value 'paragraph-separate)
+  "Regexp used as `paragraph-start' and `paragraph-separate' in MIME-Edit mode.
+The value of `mime-edit-single-part-tag-regexp' will be added to this
+value."
+  :group 'mime-edit
+  :type 'regexp)
+
 
 ;;; @@ multipart boundary
 ;;;
@@ -1068,12 +1075,10 @@
     (enable-invisible)
 
     ;; I don't care about saving these.
-    (setq paragraph-start
-	  (regexp-or mime-edit-single-part-tag-regexp
-		     paragraph-start))
-    (setq paragraph-separate
-	  (regexp-or mime-edit-single-part-tag-regexp
-		     paragraph-separate))
+    (set (make-local-variable 'paragraph-start)
+	 (regexp-or mime-edit-single-part-tag-regexp
+		    mime-edit-paragraph-separator))
+    (set (make-local-variable 'paragraph-separate) paragraph-start)
     (run-hooks 'mime-edit-mode-hook)
     (message
      "%s"


More information about the Emacs-mime-ja mailing list