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: pascal chenevas
Subject: Re: define-key for a major-mode, 'face and external program
Date: Wed, 12 Sep 2012 11:10:39 +0200

Stefan,

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()
   (main-menu)
   (rct-mode)
  )

Thank you,

Pascal




2012/9/12 Stefan Monnier <monnier@iro.umontreal.ca>
> 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]