Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
swapping [] and () in elisp
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marco Baringer  
View profile  
 More options Sep 17 2002, 3:00 pm
Newsgroups: gnu.emacs.help
From: Marco Baringer <e...@bese.it>
Date: 17 Sep 2002 20:58:06 +0200
Local: Tues, Sep 17 2002 2:58 pm
Subject: swapping [] and () in elisp

i am trying to find a way in elisp to swap the [] and () keys.

all i have to do is:

1) get the old definition from the local-map, or if none exists, from
   the global map.

2) redefine the keys so that they call the swapped definition. setup
   last-command-char and use call-interactively so that everything
   works as it should.

so, to make (kbd "[") act like (kbd "(") here's what i do: (assuming
MODE-MAP is the key map to switch)

(let ((orig-open-square (or (lookup-key mode-map "[")
                            (lookup-key global-map "["))))
    (define-key mode-map "("
      (lambda ()
        (interactive)
        (setq last-command-char ?\[)
        (call-interactively orig-open-square [?\[]))))

my problem is how to deal with ORIG-OPEN-SQUARE. by the time the (kbd
"(") key gets pressed the definition of orig-open-sqaure is gone. if i
make orig-open-square buffer-local then i get infiinte loops as i end
up setting the key to something which calls itself. i'd like a
mode-local variable or something of a way to say "this keymap has
already been modified, don't do it again."

p.s. - please do not mention the xmodmap/registry manipulation. 1)
they don't work on my powerbook. 2) i can't modify other the registry
on other people's machines, but i can modify the .emacs.

--
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stefan Monnier <foo@acm.com>  
View profile  
 More options Sep 17 2002, 3:15 pm
Newsgroups: gnu.emacs.help
From: "Stefan Monnier <f...@acm.com>" <monnier+gnu.emacs.help/ne...@flint.cs.yale.edu>
Date: 17 Sep 2002 15:12:30 -0400
Local: Tues, Sep 17 2002 3:12 pm
Subject: Re: swapping [] and () in elisp

>>>>> "Marco" == Marco Baringer <e...@bese.it> writes:
> i am trying to find a way in elisp to swap the [] and () keys.

Check out keyboard-translate.

        Stefan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marco Baringer  
View profile  
 More options Sep 17 2002, 3:40 pm
Newsgroups: gnu.emacs.help
From: Marco Baringer <e...@bese.it>
Date: 17 Sep 2002 21:37:25 +0200
Local: Tues, Sep 17 2002 3:37 pm
Subject: Re: swapping [] and () in elisp
"Stefan Monnier <f...@acm.com>" <monnier+gnu.emacs.help/ne...@flint.cs.yale.edu> writes:

> >>>>> "Marco" == Marco Baringer <e...@bese.it> writes:
> > i am trying to find a way in elisp to swap the [] and () keys.

> Check out keyboard-translate.

that would work too :)

thanks.
--
-Marco
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
     -Leonard Cohen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »