unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* keybinding mystery
@ 2007-10-05  8:28 Gordon Beaton
  2007-10-05  9:26 ` Peter Dyballa
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Gordon Beaton @ 2007-10-05  8:28 UTC (permalink / raw)
  To: help-gnu-emacs

I map ctrl-= to a function like this:

 (global-set-key [(ctrl =)] 'gb-match-paren)

This works fine, unless I run "emacs -nw".

However If I run "emacs -nw" (or "emacs -nw -q --no-site-file"), this
key combination inserts "=" into my text. describe-key seems to
confirm that "ctrl" is lost:

 = runs the command self-insert-command

This is emacs 22.1 on Linux. Other commands that use ctrl don't behave
this way.

How should I bind this key to my function so that it works in both
cases?

/gordon

--

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

* Re: keybinding mystery
  2007-10-05  8:28 keybinding mystery Gordon Beaton
@ 2007-10-05  9:26 ` Peter Dyballa
  2007-10-05  9:40 ` Tassilo Horn
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Peter Dyballa @ 2007-10-05  9:26 UTC (permalink / raw)
  To: emacs list


Am 05.10.2007 um 10:28 schrieb Gordon Beaton:

> How should I bind this key to my function so that it works in both
> cases?

X11 obviously understands C-=, the a bit dumb terminal emulation does  
not. You would need to alter the terminal emulation's source code to  
accept C-= as an input invent. Then you'll probably also need to  
change lisp/term/<terminal emulation>.el – or use another terminal  
emulation, one that supports C-=. Finally you can look for another  
key binding that works in both environment, a (modified) function key  
for example.

--
Greetings

   Pete

Bake Pizza not war!

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

* Re: keybinding mystery
  2007-10-05  8:28 keybinding mystery Gordon Beaton
  2007-10-05  9:26 ` Peter Dyballa
@ 2007-10-05  9:40 ` Tassilo Horn
  2007-10-05 10:52   ` Gordon Beaton
       [not found] ` <mailman.1718.1191576401.18990.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Tassilo Horn @ 2007-10-05  9:40 UTC (permalink / raw)
  To: help-gnu-emacs

Gordon Beaton <n.o.t@for.email> writes:

Hi Gordon,

> I map ctrl-= to a function like this:
>
>  (global-set-key [(ctrl =)] 'gb-match-paren)

I'd recommend using (kbd "C-=") instead of [(ctrl =)].  It looks clearer
because it uses the format emacs uses for printing keybindings, too.
But that doesn't have anything to do with your problem, both forms are
equivalent.

> This works fine, unless I run "emacs -nw".
>
> However If I run "emacs -nw" (or "emacs -nw -q --no-site-file"), this
> key combination inserts "=" into my text. describe-key seems to
> confirm that "ctrl" is lost:

Yes, various bindings are not available inside terminals.  It's a
terminal limitation, not an emacs one.

> How should I bind this key to my function so that it works in both
> cases?

Generally speaking, all keys like C-X where X is a alphabetical or
numerical letter should work in both cases.

Bye,
Tassilo

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

* Re: keybinding mystery
       [not found] ` <mailman.1718.1191576401.18990.help-gnu-emacs@gnu.org>
@ 2007-10-05 10:43   ` Gordon Beaton
  0 siblings, 0 replies; 9+ messages in thread
From: Gordon Beaton @ 2007-10-05 10:43 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 5 Oct 2007 11:26:34 +0200, Peter Dyballa wrote:
> Finally you can look for another key binding that works in both
> environment, a (modified) function key for example.

That sounds like the easiest solution, thanks.

/gordon


--

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

* Re: keybinding mystery
  2007-10-05  9:40 ` Tassilo Horn
@ 2007-10-05 10:52   ` Gordon Beaton
  0 siblings, 0 replies; 9+ messages in thread
From: Gordon Beaton @ 2007-10-05 10:52 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 05 Oct 2007 11:40:41 +0200, Tassilo Horn wrote:
> I'd recommend using (kbd "C-=") instead of [(ctrl =)].  It looks clearer
> because it uses the format emacs uses for printing keybindings, too.

Actually I use both variants as well as things like "\C-c\C-o". I
can't say I prefer one method over another, but parts of my .emacs go
back to emacs 18 or 19, so (kbd "C-=") might not always have been an
option.

Maybe it's time to re-read Jari Aalto's keybinding guide, if it's
still being maintained.

> Generally speaking, all keys like C-X where X is a alphabetical or
> numerical letter should work in both cases.

I tried the digits with only mixed success, but will manage find a key
that I'm comfortable with.

Thanks,

/gordon

--

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

* Re: keybinding mystery
  2007-10-05  8:28 keybinding mystery Gordon Beaton
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.1718.1191576401.18990.help-gnu-emacs@gnu.org>
@ 2007-10-05 11:39 ` Michaël Cadilhac
  2007-10-06 12:16   ` Reiner Steib
       [not found] ` <mailman.1725.1191584111.18990.help-gnu-emacs@gnu.org>
  4 siblings, 1 reply; 9+ messages in thread
From: Michaël Cadilhac @ 2007-10-05 11:39 UTC (permalink / raw)
  To: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 654 bytes --]

Gordon Beaton <n.o.t@for.email> writes:

> /gordon

Hi Gordon,

You've had good answers to your question, so I'm just doing a side
remark : please, if you use a spam mail address, use a proper mail
header to ask people not to include this address when replying (e.g.,
setting the Mail-Followup-To header).

Thanks.

-- 
 |   Michaël `Micha' Cadilhac       |  C'est véritablement un scandale       |
 |   http://michael.cadilhac.name   |    et probablement une contrepèterie.  |
 |   JID/MSN:                       |          -- P. Desproges               |
 `----  michael.cadilhac@gmail.com  |                                   -  --'

[-- Attachment #1.2: Type: application/pgp-signature, Size: 188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 152 bytes --]

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

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

* Re: keybinding mystery
       [not found] ` <mailman.1725.1191584111.18990.help-gnu-emacs@gnu.org>
@ 2007-10-05 12:05   ` Gordon Beaton
  2007-10-05 17:53     ` Sven Joachim
  0 siblings, 1 reply; 9+ messages in thread
From: Gordon Beaton @ 2007-10-05 12:05 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, 05 Oct 2007 13:39:23 +0200, Michaël Cadilhac wrote:
> please, if you use a spam mail address, use a proper mail header to
> ask people not to include this address when replying (e.g., setting
> the Mail-Followup-To header).

I'm posting to Usenet, not a mailing list, and would expect the
NNTP-mail gateway to "do the right thing" here. What is a reasonable
value for Mail-Followup-To?

/gordon

--

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

* Re: keybinding mystery
  2007-10-05 12:05   ` Gordon Beaton
@ 2007-10-05 17:53     ` Sven Joachim
  0 siblings, 0 replies; 9+ messages in thread
From: Sven Joachim @ 2007-10-05 17:53 UTC (permalink / raw)
  To: help-gnu-emacs

Gordon Beaton <n.o.t@for.email> writes:

> On Fri, 05 Oct 2007 13:39:23 +0200, Michaël Cadilhac wrote:
>> please, if you use a spam mail address, use a proper mail header to
>> ask people not to include this address when replying (e.g., setting
>> the Mail-Followup-To header).
>
> I'm posting to Usenet, not a mailing list, and would expect the
> NNTP-mail gateway to "do the right thing" here. What is a reasonable
> value for Mail-Followup-To?

The problem is that the newsgroup is a bidirectional gateway to the
help-gnu-emacs mailing list; some people read the newsgroup, others the
mailing list.  You could set Mail-Followup-To to the list address,
i.e. help-gnu-emacs@gnu.org.

Regards,
        Sven

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

* Re: keybinding mystery
  2007-10-05 11:39 ` Michaël Cadilhac
@ 2007-10-06 12:16   ` Reiner Steib
  0 siblings, 0 replies; 9+ messages in thread
From: Reiner Steib @ 2007-10-06 12:16 UTC (permalink / raw)
  To: help-gnu-emacs

On Fri, Oct 05 2007, Michaël Cadilhac wrote:

> please, if you use a spam mail address, 

Which should be something like "@invalid.invalid" instead of
"@for.email".

> use a proper mail header to ask people not to include this address
> when replying (e.g., setting the Mail-Followup-To header).

Here's some code to warn when composing/sending mail to bogus
addresses.  I don't use it myself, but if it works, we could include
it in Gnus (message.el). 

--8<---------------cut here---------------start------------->8---
(defvar rs-message-spamtrap-regexp "noreply\\|nospam\\|invalid")
(defun rs-message-check-spamtrap ()
  "Warn before composing or sending a mail to an invalid address."
  (let ((to (save-restriction
	      (message-narrow-to-headers)
	      (message-fetch-field "To"))))
    (when (and (stringp to)
	       (setq to (cadr (gnus-extract-address-components to)))
	       (or (not
		    (string-match
		     (concat "\\(" message-valid-fqdn-regexp "\\)\\'") to))
		   (string-match rs-message-spamtrap-regexp to)))
      (unless (y-or-n-p
	       (format "Warning: Address `%s' might be bogus.  Continue? " to))
	(error "Bogus address.")))))

;; Check before composing:
(add-hook 'message-setup-hook 'rs-message-check-spamtrap)
;; Check before sending:
(add-hook 'message-send-mail-hook 'rs-message-check-spamtrap)
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

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

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

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-05  8:28 keybinding mystery Gordon Beaton
2007-10-05  9:26 ` Peter Dyballa
2007-10-05  9:40 ` Tassilo Horn
2007-10-05 10:52   ` Gordon Beaton
     [not found] ` <mailman.1718.1191576401.18990.help-gnu-emacs@gnu.org>
2007-10-05 10:43   ` Gordon Beaton
2007-10-05 11:39 ` Michaël Cadilhac
2007-10-06 12:16   ` Reiner Steib
     [not found] ` <mailman.1725.1191584111.18990.help-gnu-emacs@gnu.org>
2007-10-05 12:05   ` Gordon Beaton
2007-10-05 17:53     ` Sven Joachim

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