help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: how to completely redefine effects of define-derived-mode


From: Xah Lee
Subject: Re: how to completely redefine effects of define-derived-mode
Date: Sat, 22 Nov 2008 07:09:41 -0800 (PST)
User-agent: G2/1.0

On Nov 22, 6:47 am, Xah Lee <xah...@gmail.com> wrote:
> i'm experimenting and learing the use of define-derived-mode to define
> various styled comment syntax, and i don't want to restart emacs each
> time. Is there a way to do it?
>
> for example, i evaluate:
>
> (define-derived-mode xx-mode fundamental-mode
> "xx"
> "xx-mode does this and that."
>
>   ;; bash style comment: “# ...”
>   (modify-syntax-entry ?# "< b" xx-mode-syntax-table)
>   (modify-syntax-entry ?\n "> b" xx-mode-syntax-table)
>
> ;;   ;; c style comment “// comment”
> ;;   (modify-syntax-entry ?\/ ". 12b" xx-mode-syntax-table)
> ;;   (modify-syntax-entry ?\n "> b" xx-mode-syntax-table)
>
> )
>
> and after i tested it, i want to comment out the perl styled syntax
> entry i made, and try a different style such as “// ...” or “/* ...
> */” or “(* ... *)” style.
>
> However, it won't work because the char “#” already got a defined as
> comment start. (it won't go away unless i explicitly redefine that
> char. To redefine them is somewhat more work than restarting emacs)
>
> I tried to add (unintern xx-mode-syntax-table) before the define-
> derived-mode, and eval the buffer again, but that doesn't work. I also
> tried (setq xx-mode-syntax-table nil) that also didn't work. I tried
> (setq xx-mode nil) in the beginning but that didn't work neither.
>
> is there a way that i can re-eval this and try different settings of
> syntax table? (as opposed to restarting emacs each time)

oops, adding
(unintern 'xx-mode-syntax-table)
in the beginning works. I forgot the damn quote.

  Xah
∑ http://xahlee.org/

reply via email to

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