[Top][All Lists]

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

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

From: pascal chenevas
Subject: Re: define-key for a major-mode, 'face and external program
Date: Wed, 12 Sep 2012 11:10:39 +0200


Thank you so much for your answer!

I have corrected my code and now my keys are set !
But now my main menu is not displayed anymore and the hook cannot be added too.

(defcustom rct-mode-hook nil
       "Normal hook run when entering rct mode and many related modes."
       :type 'hook
       :options '(font-lock-mode t)
       :group 'rct)

Actualy I don't know if it's usefull to add the property :options. I get an error:

Debugger entered--Lisp error: (void-function add-hooks)

(define-derived-mode rct-mode special-mode "rct:main"
    (add-hooks 'rct-mode-hook)

(defun main()

Thank you,


2012/9/12 Stefan Monnier <>
> 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.


reply via email to

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