unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: define-generic-mode: unexpected handling of comment-end
Date: Wed, 24 Nov 2004 09:03:18 -0500	[thread overview]
Message-ID: <jwv4qjfe4e8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <86u0rfk2aa.fsf@ketchup.de.uu.net> (Kai Grossjohann's message of "Wed, 24 Nov 2004 10:46:21 +0100")

> 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	other threads:[~2004-11-24 14:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-24  9:46 define-generic-mode: unexpected handling of comment-end Kai Grossjohann
2004-11-24 14:03 ` Stefan Monnier [this message]
2004-11-25  9:54   ` Kai Grossjohann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv4qjfe4e8.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).