all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to bind the keyboard 'C-;'
@ 2007-03-13 23:12 Vols
  2007-03-14  0:49 ` John Paul Wallington
  0 siblings, 1 reply; 4+ messages in thread
From: Vols @ 2007-03-13 23:12 UTC (permalink / raw)
  To: help-gnu-emacs

Hi, group

I want the keyboard binding 'Control  ;' , for example, I tried:
(global-set-key  "\C-;" 'kill-this-buffe)
It doesn't work and comes with a "invalid modifier in string" error.

Actually i want to use 'C-;' to comment current line. (M-; add comment
at the end of the line). I used :

(global-set-key  "\C-;" 'my-comment-current-line)
(defun my-comment-current-line ()
  (interactive)
  (comment-region (line-beginning-position) (line-end-position)))

Thanks.
Vol.

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

* Re: How to bind the keyboard 'C-;'
  2007-03-13 23:12 How to bind the keyboard 'C-;' Vols
@ 2007-03-14  0:49 ` John Paul Wallington
  2007-03-16  7:00   ` Kevin Rodgers
       [not found]   ` <mailman.994.1174028547.7795.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: John Paul Wallington @ 2007-03-14  0:49 UTC (permalink / raw)
  To: help-gnu-emacs

"Vols" <volunteers@gmail.com> writes:

> I want the keyboard binding 'Control  ;' , for example, I tried:
> (global-set-key  "\C-;" 'kill-this-buffe)

You must avoid the string syntax when binding non-ASCII characters.
(kbd "C-;") and [(control \;)] should work.

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

* Re: How to bind the keyboard 'C-;'
  2007-03-14  0:49 ` John Paul Wallington
@ 2007-03-16  7:00   ` Kevin Rodgers
       [not found]   ` <mailman.994.1174028547.7795.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2007-03-16  7:00 UTC (permalink / raw)
  To: help-gnu-emacs

John Paul Wallington wrote:
> "Vols" <volunteers@gmail.com> writes:
> 
>> I want the keyboard binding 'Control  ;' , for example, I tried:
>> (global-set-key  "\C-;" 'kill-this-buffe)
> 
> You must avoid the string syntax when binding non-ASCII characters.
> (kbd "C-;") and [(control \;)] should work.

and [?\C-;]

Can anyone explain why the semicolon does not need to be backslashed
there?

-- 
Kevin Rodgers
Denver, Colorado, USA

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

* Re: How to bind the keyboard 'C-;'
       [not found]   ` <mailman.994.1174028547.7795.help-gnu-emacs@gnu.org>
@ 2007-03-16 14:06     ` Stefan Monnier
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2007-03-16 14:06 UTC (permalink / raw)
  To: help-gnu-emacs

> and [?\C-;]
> Can anyone explain why the semicolon does not need to be backslashed
> there?

Well, it kind of does: the `read' function will not need a backslash because
when it sees "?\C-" is knows that what follows can't be a comment (because
"?\C-" on its own is not a valid lexeme).

But emacs-lisp-mode doesn't understand this (because it doesn't use the full
builtin lisp parser), so font-lock and syntax-based navigation (e.g. C-M-f)
will not treat it correctly if the ; is not escaped.


        Stefan

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-13 23:12 How to bind the keyboard 'C-;' Vols
2007-03-14  0:49 ` John Paul Wallington
2007-03-16  7:00   ` Kevin Rodgers
     [not found]   ` <mailman.994.1174028547.7795.help-gnu-emacs@gnu.org>
2007-03-16 14:06     ` Stefan Monnier

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.