unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* add to keymap
@ 2003-01-19 20:50 matt
  2003-01-19 21:14 ` Ehud Karni
       [not found] ` <mailman.558.1043010919.21513.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: matt @ 2003-01-19 20:50 UTC (permalink / raw)


Hi all,

How do I add to an existing keymap automatically upon entering a mode. I 
want to extend the html-mode-map with a few of my own.

TIA -- Matt
-- 
Remove the X's to reply directly.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: add to keymap
  2003-01-19 20:50 add to keymap matt
@ 2003-01-19 21:14 ` Ehud Karni
       [not found] ` <mailman.558.1043010919.21513.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Ehud Karni @ 2003-01-19 21:14 UTC (permalink / raw)
  Cc: help-gnu-emacs

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, 19 Jan 2003 20:50:01 GMT, matt <nwzmattXX@XXnetscape.net> wrote:
> 
> How do I add to an existing keymap automatically upon entering a mode. I 
> want to extend the html-mode-map with a few of my own.

If you'll run help on `html-mode' function you'll see in it the lines:
    To work around that, do:
       (eval-after-load "sgml-mode" '(aset sgml-char-names ?' nil))
So, obviously, one of the options is to put all you code within such 
form:   (eval-after-load "sgml-mode" <your code>)

Another, (better ?) option is to put you code in a function that will
be called EACH time you enter `html-mode'. The above help will show you
that `html-mode' is defined in "sgml-mode.el". A quick look at the 
definition will discover that `html-mode' run some hooks as its last
action:  (run-hooks 'text-mode-hook 'sgml-mode-hook 'html-mode-hook))
so you can add your function to any of these hooks. Put it (use the
`add-hook') on the most appropriate one.

Ehud.


- -- 
 Ehud Karni           Tel: +972-3-7966-561  /"\
 Mivtach - Simon      Fax: +972-3-7966-667  \ /  ASCII Ribbon Campaign
 Insurance agencies   (USA) voice mail and   X   Against   HTML   Mail
 http://www.mvs.co.il  FAX:  1-815-5509341  / \
 mailto:ehud@unix.mvs.co.il                  Better  Safe  Than  Sorry
-----BEGIN PGP SIGNATURE-----
Comment: use http://www.keyserver.net/ to get my key (and others)

iD8DBQE+KxU0LFvTvpjqOY0RAmrKAJ0f3cnizlALBY9MeSmOpyA2XSVWpACfWE70
O/CcXVIndXqMgSSzIL72I5g=
=cthF
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: add to keymap
       [not found] ` <mailman.558.1043010919.21513.help-gnu-emacs@gnu.org>
@ 2003-01-19 21:51   ` matt
  0 siblings, 0 replies; 3+ messages in thread
From: matt @ 2003-01-19 21:51 UTC (permalink / raw)




Ehud Karni wrote:
> A quick look at the 
> definition will discover that `html-mode' run some hooks as its last
> action:  (run-hooks 'text-mode-hook 'sgml-mode-hook 'html-mode-hook))
> so you can add your function to any of these hooks. Put it (use the
> `add-hook') on the most appropriate one.
> 

That's just what I needed. Thanks.

-- Matt

-- 
Remove the X's to reply directly.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-01-19 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-19 20:50 add to keymap matt
2003-01-19 21:14 ` Ehud Karni
     [not found] ` <mailman.558.1043010919.21513.help-gnu-emacs@gnu.org>
2003-01-19 21:51   ` matt

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).