unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Toggle Keybinding
@ 2006-07-30  9:32 Paulo J. Matos
  2006-07-31 15:17 ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: Paulo J. Matos @ 2006-07-30  9:32 UTC (permalink / raw)


Hi,
I'm setting in .emacs (cvs-emacs) the following:
(add-hook 'c++-mode-hook 'hs-minor-mode)

(add-hook 'c++-mode-hook
	  (lambda ()
	    (local-set-key "M-+" 'hs-toggle-hiding)))

For some reason the keybinding is not working. But if I do
local-set-key in emacs everything seems to go fine! :-)

Any ideas? Should the + in "M-+" be escaped somehow?

-- 
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group

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

* Re: Toggle Keybinding
       [not found] <mailman.4656.1154251955.9609.help-gnu-emacs@gnu.org>
@ 2006-07-30 10:33 ` wenbinye
  2006-07-30 11:00 ` Harald Hanche-Olsen
  1 sibling, 0 replies; 6+ messages in thread
From: wenbinye @ 2006-07-30 10:33 UTC (permalink / raw)


The key binding syntax is not right, use "\M-+" instead.
It is better to use c++-mode-map:

(add-hook 'c++-mode-hook
          (lambda ()
            (define-key c++-mode-map "\M-+" 'hs-toggle-hiding)))

Paulo J. Matos wrote:
> Hi,
> I'm setting in .emacs (cvs-emacs) the following:
> (add-hook 'c++-mode-hook 'hs-minor-mode)
>
> (add-hook 'c++-mode-hook
> 	  (lambda ()
> 	    (local-set-key "M-+" 'hs-toggle-hiding)))
>
> For some reason the keybinding is not working. But if I do
> local-set-key in emacs everything seems to go fine! :-)
>
> Any ideas? Should the + in "M-+" be escaped somehow?
>
> --
> Paulo Jorge Matos - pocm at sat inesc-id pt
> Web: http://sat.inesc-id.pt/~pocm
> Computer and Software Engineering
> INESC-ID - SAT Group

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

* Re: Toggle Keybinding
       [not found] <mailman.4656.1154251955.9609.help-gnu-emacs@gnu.org>
  2006-07-30 10:33 ` wenbinye
@ 2006-07-30 11:00 ` Harald Hanche-Olsen
  1 sibling, 0 replies; 6+ messages in thread
From: Harald Hanche-Olsen @ 2006-07-30 11:00 UTC (permalink / raw)


+ "Paulo J. Matos" <pocmatos@gmail.com>:

| (add-hook 'c++-mode-hook
| 	  (lambda ()
| 	    (local-set-key "M-+" 'hs-toggle-hiding)))
|
| For some reason the keybinding is not working.

It probably does, but you may have a hard time typing a capital M in
the buffer, since M is now a prefix.

| Any ideas? Should the + in "M-+" be escaped somehow?

No, the M should, in order to be interpreted as meta:

"\M-+" should do the trick.
You can also use a vector: [?\M-+].

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell

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

* Re: Toggle Keybinding
  2006-07-30  9:32 Toggle Keybinding Paulo J. Matos
@ 2006-07-31 15:17 ` Kevin Rodgers
  2006-07-31 22:28   ` Paulo J. Matos
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2006-07-31 15:17 UTC (permalink / raw)


Paulo J. Matos wrote:
> I'm setting in .emacs (cvs-emacs) the following:
> (add-hook 'c++-mode-hook 'hs-minor-mode)

Just a minor point: hs-minor-mode toggles, so what you really mean is:

(add-hook 'c++-mode-hook (lambda () (hs-minor-mode 1)))

-- 
Kevin

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

* Re: Toggle Keybinding
  2006-07-31 15:17 ` Kevin Rodgers
@ 2006-07-31 22:28   ` Paulo J. Matos
  2006-08-01 15:22     ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: Paulo J. Matos @ 2006-07-31 22:28 UTC (permalink / raw)


On 31/07/06, Kevin Rodgers <ihs_4664@yahoo.com> wrote:
> Paulo J. Matos wrote:
> > I'm setting in .emacs (cvs-emacs) the following:
> > (add-hook 'c++-mode-hook 'hs-minor-mode)
>
> Just a minor point: hs-minor-mode toggles, so what you really mean is:
>
> (add-hook 'c++-mode-hook (lambda () (hs-minor-mode 1)))
>

Thanks for sharing this precious detail.

> --
> Kevin
>
>
>
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs
>


-- 
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group

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

* Re: Toggle Keybinding
  2006-07-31 22:28   ` Paulo J. Matos
@ 2006-08-01 15:22     ` Kevin Rodgers
  0 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2006-08-01 15:22 UTC (permalink / raw)


Paulo J. Matos wrote:
> On 31/07/06, Kevin Rodgers <ihs_4664@yahoo.com> wrote:
>> Paulo J. Matos wrote:
>> > I'm setting in .emacs (cvs-emacs) the following:
>> > (add-hook 'c++-mode-hook 'hs-minor-mode)
>>
>> Just a minor point: hs-minor-mode toggles, so what you really mean is:
>>
>> (add-hook 'c++-mode-hook (lambda () (hs-minor-mode 1)))
> 
> Thanks for sharing this precious detail.

You're welcome.

-- 
Kevin

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

end of thread, other threads:[~2006-08-01 15:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-30  9:32 Toggle Keybinding Paulo J. Matos
2006-07-31 15:17 ` Kevin Rodgers
2006-07-31 22:28   ` Paulo J. Matos
2006-08-01 15:22     ` Kevin Rodgers
     [not found] <mailman.4656.1154251955.9609.help-gnu-emacs@gnu.org>
2006-07-30 10:33 ` wenbinye
2006-07-30 11:00 ` Harald Hanche-Olsen

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