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

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

Re: define-key for a major-mode, 'face and external program


From: Stefan Monnier
Subject: Re: define-key for a major-mode, 'face and external program
Date: Tue, 11 Sep 2012 20:45:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

> can you please help me with the following LISP code?

Looks fine.

> (define-derived-mode rct-mode special-mode "rct:main"
>   "Major mode for remote connections
> \\{rct-main-mode-map}."
>   (setq debug-on-error t)

Don't use `setq' in a major-mode since the change will affect
all buffers.  Better use (set (make-local-variable 'debug-on-error) t).

>   (use-local-map rct-mode-map)
>   (run-hooks 'rct-mode-hook)

Don't do that, it's done by `define-derived-mode already.

>   (main-menu))

This shouldn't be in the major-mode function, but in another function
(which will probably call the major-mode function).

>   (switch-to-buffer rct-mode-buffer-name)

You should probably call pop-to-buffer here instead.


        Stefan


reply via email to

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