set-key <> define-key

set-key <> define-key

Post by Florian Lindne » Fri, 15 Mar 2002 22:08:01



Hello,
what's the difference between:

(add-hook 'LaTeX-mode-hook
   (lambda ()
     (local-set-key (kbd "RET") 'reindent-then-newline-and-indent)))

And

(add-hook 'LaTeX-mode-hook
  (lambda ()
    (define-key LaTeX-mode-map "\r" 'reindent-then-newline-and-indent)))

Thx,
Florian

 
 
 

set-key <> define-key

Post by David Kastru » Fri, 15 Mar 2002 22:24:09



> Hello,
> what's the difference between:

> (add-hook 'LaTeX-mode-hook
>    (lambda ()
>      (local-set-key (kbd "RET") 'reindent-then-newline-and-indent)))

> And

> (add-hook 'LaTeX-mode-hook
>   (lambda ()
>     (define-key LaTeX-mode-map "\r" 'reindent-then-newline-and-indent)))

Those are two different questions.

First the difference between (kbd "RET") and "\r": in systems where
the key "RET" does not produce "\r", there is a difference.  I don't
think there are any such systems, however.

As to the second question: why don't you ask Emacs yourself? C-h f
describes a function.  Version two relies on knowledge of the keymap
name in use.

--
David Kastrup, Kriemhildstr. 15, 44793 Bochum


 
 
 

set-key <> define-key

Post by Kai Gro?joha » Sat, 16 Mar 2002 22:10:31



> First the difference between (kbd "RET") and "\r": in systems where
> the key "RET" does not produce "\r", there is a difference.  I don't
> think there are any such systems, however.

M-: tells me that (kbd "RET") and "\r" eval to the same thing.  So
the two variants function the same, they differ only in readability.

Note that (kbd "<return>") is not the same thing as (kbd "RET").

kai
--
Silence is foo!

 
 
 

1. mapping <ALT> key to act as <META> key

Hello,
   I am looking for a way to map the <ALT> key on a PC keyboard to act as the
<META> key (i.e. I would like to press ALT-x instead of ESC-x, ALT-% instead of
ESC-%, etc.). The obvious way (and time consuming) would be to go over all
commands bound to <META>-sth. and add a global-set-key for the same function
bound to <ATL>-sth. (the same "sth." as for the <META>). Is there a better way?

Thank you,
Lyor G.

---

2. Problems on IMail & IMAP

3. define-key vs. *-set-key

4. Is my DAT tape compressing....and how much?

5. >>>>parenthesis highlighting problem<<<<<

6. OS/2 Monthly: New Applications

7. define-key global-map vs. global-set-key?

8. MIRC Trojan and Windows 2000 Pro

9. global-key-set and define-key in demacs

10. <ALT-L> as <META> key

11. Using an <alt> key instead of an <esc> prefix.

12. Shortcut keys>>>>>>>>>