all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to completely redefine effects of define-derived-mode
@ 2008-11-22 14:47 Xah Lee
  2008-11-22 15:09 ` Xah Lee
  0 siblings, 1 reply; 2+ messages in thread
From: Xah Lee @ 2008-11-22 14:47 UTC (permalink / raw)
  To: help-gnu-emacs

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)

  Xah
∑ http://xahlee.org/^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: how to completely redefine effects of define-derived-mode
  2008-11-22 14:47 how to completely redefine effects of define-derived-mode Xah Lee
@ 2008-11-22 15:09 ` Xah Lee
  0 siblings, 0 replies; 2+ messages in thread
From: Xah Lee @ 2008-11-22 15:09 UTC (permalink / raw)
  To: help-gnu-emacs

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/^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-22 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-22 14:47 how to completely redefine effects of define-derived-mode Xah Lee
2008-11-22 15:09 ` Xah Lee

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.