all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: Binding a function to control c control space
       [not found]   ` <87y5wii9nt.fsf@Compaq.site>
@ 2011-10-18 21:55     ` jpkotta
  0 siblings, 0 replies; 2+ messages in thread
From: jpkotta @ 2011-10-18 21:55 UTC (permalink / raw)
  To: help-gnu-emacs

On Oct 18, 10:47 am, Cecil Westerhof <Ce...@decebal.nl> wrote:
> Op dinsdag 18 okt 2011 14:25 CEST schreef Stefan Monnier:
>
> >> (global-set-key "\C-c\C-spc"  'delete-trailing-whitespace)
>
> > Better stay away from strings to represent key sequences (these used to
> > work in Emacs-18, but ever since we added support for GUIs, only the
> > vector representation can be used reliably):
>
> > (global-set-key [?\C-c ?\C- ] 'delete-trailing-whitespace)
>
> Works like a charm. Thanks.
>
> With the other definitions I did not have a problem, but I will update
> them anyway. Better safe as sorry.
>
> > Note that the C-SPC combination can not be produced from a tty (when
> > you hit C-SPC, the terminal sends the code of C-@).  This problem is
> > related to the problem of representing C-SPC inside a string.
>
> I almost never work with Emacs in a tty, almost always in the GUI, but
> to be safe again I defined it also. :-D
>
> By the way in the GUI when C-@ is not defined it is redirected to
> 'C- '. When it is defined its definition is used. So be sure to have
> the same definition for both key combinations. ;-}
>
> --
> Cecil Westerhof
> Senior Software Engineer
> LinkedIn:http://www.linkedin.com/in/cecilwesterhof

Here's how I do it.  Use C-h k <keyseq> to get the help for a key
sequence.  Then use the kbd macro with the text representation of key
sequence that C-h k gave.  E.g. when I do C-h k C-c C-SPC, I get a
message saying "C-c C-SPC is undefined" (if it was defined, I'd get a
help buffer with the same text representation of the key sequence).
So I could do (global-set-key (kbd "C-c C-SPC") 'some-command) to
define it.  I can't think of any key sequences that this has not
worked with, and I'm fairly certain that this is the same
representation that ends up in the lossage buffer.


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

* RE: Binding a function to control c control space
       [not found] ` <87ipnmk3lb.fsf@Compaq.site>
@ 2012-03-28 21:03   ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2012-03-28 21:03 UTC (permalink / raw)
  To: 'Cecil Westerhof', help-gnu-emacs

> > I would like to bind 'delete-trailing-whitespace' to 
> > \C-c\C-spc, but I can not manage it.
> 
> By the way I can define it with 'global-set-key ', but that is not a
> long term solution I am afraid. ;-}

(define-key your-keymap (kbd "C-SPC") 'delete-trailing-whitespace)




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

end of thread, other threads:[~2012-03-28 21:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87wrc2k5lj.fsf@Compaq.site>
     [not found] ` <jwvk482jxpz.fsf-monnier+gnu.emacs.help@gnu.org>
     [not found]   ` <87y5wii9nt.fsf@Compaq.site>
2011-10-18 21:55     ` Binding a function to control c control space jpkotta
     [not found] ` <87ipnmk3lb.fsf@Compaq.site>
2012-03-28 21:03   ` Drew Adams

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.