emacs-devel
[Top][All Lists]
Advanced

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

Re: define-generic-mode: unexpected handling of comment-end


From: Stefan Monnier
Subject: Re: define-generic-mode: unexpected handling of comment-end
Date: Wed, 24 Nov 2004 09:03:18 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (gnu/linux)

> It seems that it doesn't work to specify ("# " . "") for comments:
> Debugger entered--Lisp error: (args-out-of-range "" 0)
>   generic-mode-set-comments((("# " . "")))
>   generic-mode-internal(baselib-config-mode (("# " . "")) ("include") nil nil)
>   baselib-config-mode()
>   set-auto-mode-0(baselib-config-mode nil)
>   set-auto-mode()
>   normal-mode(t)
>   after-find-file(nil nil t t nil)
>   revert-buffer(t)
>   call-interactively(revert-buffer)

> Specifying ("# " . nil) instead works as I intended ("# " . "") to work.

> Shouldn't the documentation say that comment-end is handled specially?

Well, the documentation suggests that the accepted values are the same as
the ones for comment-end, so the empty string should be accepted.  Does the
following patch fix it for you?


        Stefan


--- generic.el  18 sep 2004 17:24:29 -0400      1.24
+++ generic.el  24 nov 2004 09:01:25 -0500      
@@ -289,13 +289,14 @@
 
     ;; Go through all the comments
     (dolist (start comment-list)
-      (let ((end ?\n) (comstyle ""))
+      (let ((end nil) (comstyle ""))
        ;; Normalize
        (when (consp start)
          (setq end (or (cdr start) end))
          (setq start (car start)))
        (when (char-valid-p start) (setq start (char-to-string start)))
        (when (char-valid-p end)   (setq end (char-to-string end)))
+       (when (zerop (length end)) (setq end "\n"))
 
        ;; Setup the vars for `comment-region'
        (if comment-start
@@ -414,5 +415,5 @@
 
 (provide 'generic)
 
-;;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea
+;; arch-tag: 239c1fc4-1303-48d9-9ac0-657d655669ea
 ;;; generic.el ends here




reply via email to

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