all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Trying to global-set-key
@ 2003-06-03 18:53 Harshdeep S Jawanda
  2003-06-03 21:18 ` Harshdeep S Jawanda
  0 siblings, 1 reply; 5+ messages in thread
From: Harshdeep S Jawanda @ 2003-06-03 18:53 UTC (permalink / raw)


I want to global-set-key C-u 1 C-v (scroll-up) to C-down in my .emacs 
file. How do I do that?

As a starting point I tried: (global-set-key [C-down] 'scroll-up), but 
that doesn't seem to do even a simple scroll-up.  When I do C-h a for 
scroll-up, the keybinding shows up, but it doesn't seem to work.

Thanks.

-- 
Harshdeep

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

* Re: Trying to global-set-key
       [not found] <mailman.7223.1054666197.21513.help-gnu-emacs@gnu.org>
@ 2003-06-03 21:07 ` Kevin Rodgers
  2003-06-03 21:53   ` Harshdeep S Jawanda
       [not found]   ` <mailman.7232.1054677270.21513.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Kevin Rodgers @ 2003-06-03 21:07 UTC (permalink / raw)


Harshdeep S Jawanda wrote:

> I want to global-set-key C-u 1 C-v (scroll-up) to C-down in my .emacs 
> file. How do I do that?


You can't, exactly: that would mean that `C-u 1' is a prefix key, but `C-u'
is already bound to universal-argument (which is a binding you want to retain
-- trust me).  But if you mean that you want to be able to type C-down instead
of `C-u 1 C-v', then the simplest thing is to define a keyboard macro:

(global-set-key [C-down] (kbd "C-u 1 C-v"))


> As a starting point I tried: (global-set-key [C-down] 'scroll-up), but 
> that doesn't seem to do even a simple scroll-up.  When I do C-h a for 
> scroll-up, the keybinding shows up, but it doesn't seem to work.

That ought to work, but perhaps a local key binding is shadowing the global
binding.  What happens if you type `C-h k' followed by C-down?  What does
`C-h l' show immediately after that?

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

* Re: Trying to global-set-key
  2003-06-03 18:53 Harshdeep S Jawanda
@ 2003-06-03 21:18 ` Harshdeep S Jawanda
  0 siblings, 0 replies; 5+ messages in thread
From: Harshdeep S Jawanda @ 2003-06-03 21:18 UTC (permalink / raw)


If I write this as (global-set-key "\C-cd" '"\C-u1\C-v"), then it works. 
Why doesn't it work with the down arrow key?

Harshdeep S Jawanda wrote:

> I want to global-set-key C-u 1 C-v (scroll-up) to C-down in my .emacs 
> file. How do I do that?
>
> As a starting point I tried: (global-set-key [C-down] 'scroll-up), but 
> that doesn't seem to do even a simple scroll-up.  When I do C-h a for 
> scroll-up, the keybinding shows up, but it doesn't seem to work.
>
> Thanks. 

-- 
Harshdeep S Jawanda

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

* Re: Trying to global-set-key
  2003-06-03 21:07 ` Trying to global-set-key Kevin Rodgers
@ 2003-06-03 21:53   ` Harshdeep S Jawanda
       [not found]   ` <mailman.7232.1054677270.21513.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Harshdeep S Jawanda @ 2003-06-03 21:53 UTC (permalink / raw)
  Cc: ihs_4664

Kevin Rodgers wrote:

> But if you mean that you want to be able to type C-down instead
> of `C-u 1 C-v',

Yes, that is exactly what I mean to say.

> then the simplest thing is to define a keyboard macro:
>
> (global-set-key [C-down] (kbd "C-u 1 C-v")) 

I tried this: doesn't work.  Basically, I think the problem is that 
Emacs is not recognizing the Ctrl key as a modifier when used with the 
down arrow key.

> That ought to work, but perhaps a local key binding is shadowing the 
> global
> binding.  What happens if you type `C-h k' followed by C-down?

It only says "<down> runs the command next-line". It doesn't recognize 
that the Ctrl key has also been pressed. When I write (global-set-key 
[next] '"\C-u1\C-v"), it works fine. I just need to tell Emacs to modify 
behavior only when Ctrl key is pressed.

> What does `C-h l' show immediately after that?

Well, if you really want to know:

C-x b RET ESC [ A ESC [ A ESC [ A ESC [ B ESC [ B ESC
[ B C-h k ESC [ B C-h l

I personally can't make head or tail of it :-).  Thanks for your help, 
though.  I have near-zero knowledge of elisp -- I am only trying out the 
things I can glean from the info files :-).

-- 
Harshdeep S Jawanda

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

* Re: Trying to global-set-key
       [not found]   ` <mailman.7232.1054677270.21513.help-gnu-emacs@gnu.org>
@ 2003-06-03 23:16     ` Stefan Monnier
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2003-06-03 23:16 UTC (permalink / raw)


>>>>> "Harshdeep" == Harshdeep S Jawanda <hjawanda@cs.unm.edu> writes:
> C-x b RET ESC [ A ESC [ A ESC [ A ESC [ B ESC [ B ESC
> [ B C-h k ESC [ B C-h l

Your terminal sends the same key sequence when you hit `C-down' as when you
hit `down', so Emacs just can't do what you want.
You'll first have to configure your terminal to send different key
sequences for those two cases.  As for how to do that, it completely
depends on the particular text terminal you're using (it might be
impossible without using another text-terminal).


        Stefan

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

end of thread, other threads:[~2003-06-03 23:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.7223.1054666197.21513.help-gnu-emacs@gnu.org>
2003-06-03 21:07 ` Trying to global-set-key Kevin Rodgers
2003-06-03 21:53   ` Harshdeep S Jawanda
     [not found]   ` <mailman.7232.1054677270.21513.help-gnu-emacs@gnu.org>
2003-06-03 23:16     ` Stefan Monnier
2003-06-03 18:53 Harshdeep S Jawanda
2003-06-03 21:18 ` Harshdeep S Jawanda

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.