emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

2 minor bugs with filling and comments in mail mode


From: Markus Rost
Subject: 2 minor bugs with filling and comments in mail mode
Date: Tue, 5 Aug 2003 16:31:57 -0400 (EDT)

Evaluate

(progn
  (setq mail-yank-prefix ">")
  (compose-mail)
  (mail-text)
  (set-mark-command nil)
  (insert
   "Text Text Text Text Text Text Text Text Text Text <URL:http://www.gnu.org/> 
?

Text Text Text Text Text Text Text Text Text Text <URL:http://www.gnu.org/> ?
")

  (previous-line 2)
  ;; this is called to run comment-normalize-vars
  (comment-region (region-beginning) (region-end))
  (forward-line 1)

  (fill-paragraph nil)
  )

Or just evaluate (setq mail-yank-prefix ">") and perform the other
lines of the progn by hand.  You end up with a mess:

===Buffer *mail*============================================

[-- mail header section snipped --]

> Text Text Text Text Text Text Text Text Text Text <URL:http://www.gnu.org/> ?

Text Text Text Text Text Text Text Text Text Text
                                                                          > 
<URL:http://www.gnu.org/>
                                                                          > ?
============================================================

I think the reason is that comment-normalize-vars computes
comment-start-skip if not set:

    ;; comment-skip regexps
    (unless (and comment-start-skip
                 ;; In case comment-start has changed since last time.
                 (string-match comment-start-skip comment-start))
      (set (make-local-variable 'comment-start-skip)
           (concat "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(\\s<+\\|"
                   (regexp-quote (comment-string-strip comment-start t t))
                   ;; Let's not allow any \s- but only [ \t] since \n
                   ;; might be both a comment-end marker and \s-.
                   "+\\)[ \t]*")))

>From this it seems that a major mode should set comment-start-skip if
necessary.  mail-mode computes comment-start from mail-yank-prefix,
but does not set comment-start-skip.

I am not sure however whether one should fix mail-mode or
comment-normalize-vars here.

==================

Here is another problem:  Start a new Emacs and evaluate

(progn
  (compose-mail)
  (mail-text)
  (set-mark-command nil)
  (insert
   "Text Text Text Text Text Text Text Text Text Text
")
  )

Then do

M-x comment-region

You get a query:

No comment syntax is defined.  Use: 

Hit RET.  You get an error:

comment-region: Wrong type argument: stringp, nil

OK, you think that's because you did not give a comment syntax.  So
you try again in order to provide a comment syntax:

M-x comment-region

But instead of a new query, you get now immediately an error:

comment-region: Wrong type argument: stringp, nil

==================

GNU Emacs 21.3.50.34 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 
2003-08-05

GNU Emacs 21.3.50.15 (sparc-sun-solaris2.9, X toolkit, Xaw3d scroll bars) of 
2003-08-05




reply via email to

[Prev in Thread] Current Thread [Next in Thread]