From: pascal chenevas <pch.netz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: define-key for a major-mode, 'face and external program
Date: Wed, 12 Sep 2012 11:10:39 +0200 [thread overview]
Message-ID: <CA+vYbk4YMf=DOhSYBFZ9_aaoQLRZXjvyiAVC_MRm0He2RgB36A@mail.gmail.com> (raw)
In-Reply-To: <jwvoblcgjir.fsf-monnier+gnu.emacs.help@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]
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
>
[-- Attachment #2: Type: text/html, Size: 2154 bytes --]
next prev parent reply other threads:[~2012-09-12 9:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-08 22:38 define-key for a major-mode, 'face and external program pascal chenevas
2012-09-11 15:18 ` pascal chenevas
[not found] ` <mailman.8626.1347376754.855.help-gnu-emacs@gnu.org>
2012-09-12 0:45 ` Stefan Monnier
2012-09-12 9:10 ` pascal chenevas [this message]
[not found] ` <mailman.8702.1347441052.855.help-gnu-emacs@gnu.org>
2012-09-13 3:46 ` Stefan Monnier
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CA+vYbk4YMf=DOhSYBFZ9_aaoQLRZXjvyiAVC_MRm0He2RgB36A@mail.gmail.com' \
--to=pch.netz@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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).