all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to completely redefine effects of define-derived-mode
Date: Sat, 22 Nov 2008 07:09:41 -0800 (PST)	[thread overview]
Message-ID: <f7fa70c0-d43e-4d58-945f-e6c9ec319679@o40g2000prn.googlegroups.com> (raw)
In-Reply-To: 7f3fd105-c8b2-439f-8d33-43ca63ea3f7f@t26g2000prh.googlegroups.com

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	other threads:[~2008-11-22 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-22 14:47 how to completely redefine effects of define-derived-mode Xah Lee
2008-11-22 15:09 ` Xah Lee [this message]

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

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

  git send-email \
    --in-reply-to=f7fa70c0-d43e-4d58-945f-e6c9ec319679@o40g2000prn.googlegroups.com \
    --to=xahlee@gmail.com \
    --cc=help-gnu-emacs@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 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.