* define-generic-mode: unexpected handling of comment-end
@ 2004-11-24 9:46 Kai Grossjohann
2004-11-24 14:03 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Kai Grossjohann @ 2004-11-24 9:46 UTC (permalink / raw)
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?
Here's the code:
(define-generic-mode
'baselib-config-mode ;name
'(("# " . nil)) ;comment-list
'("include") ;keyword-list
nil ;font-lock-list
'("\\.cfg\\'") ;auto-mode-list
nil ;function-list
"Mode for editing baselib config files.")
Kai
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: define-generic-mode: unexpected handling of comment-end
2004-11-24 9:46 define-generic-mode: unexpected handling of comment-end Kai Grossjohann
@ 2004-11-24 14:03 ` Stefan Monnier
2004-11-25 9:54 ` Kai Grossjohann
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2004-11-24 14:03 UTC (permalink / raw)
Cc: emacs-devel
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-11-25 9:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-24 9:46 define-generic-mode: unexpected handling of comment-end Kai Grossjohann
2004-11-24 14:03 ` Stefan Monnier
2004-11-25 9:54 ` Kai Grossjohann
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.