Fedora Linux Support Community & Resources Center
  #1  
Old 16th February 2011, 11:05 PM
gfenton Offline
Registered User
 
Join Date: Apr 2007
Posts: 8
linuxfirefox
keyboard mapping

Hello,

My basic problem is this: I want to map the "Print" and "Pause" keys to emacs' save-buffer and save-buffer-kill-emacs commands, respectively, within xterm windows. I want to do this by providing the following "portable" entries in my .emacs file, which look like

(global-set-key [Print] 'save-buffer)
(global-set-key [Pause] 'save-buffer-kill-emacs)

I installed Fedora 14 a couple of months ago and have been fighting with it to do this ever since (sporadically, admittedly).

Under F14 with gnome, the "Print" key (Print Scr) takes a screen shot, which is a reasonable mapping. However, I never take screen shots. I was able to disable this key association by setting /etc/inittab to run state 3 (thereby disabling the gnome window manager altogether -- which I also disabled because I prefer fvwm -- why would one not want to provide a window manager where you can switch between desktops simply by rolling over to them using your mouse?). Without gnome, both the Print and the Pause keys seem to send nothing, at least according to emacs' "quoted-insert" command.

If I set the following in my .Xdefaults file

XTerm*vt100.translations: #override \
Shift <Key>Print: string("\033[50~") \n\
<Key>Print: string("\033[40~") \n\
Shift <Key>Pause: string("\033[51~") \n\
<Key>Pause: string("\033[41~")

and load it using

xrdb -load $HOME/.Xdefaults

I then find that these two keys do properly send the above sequences. Unfortunately, the above sequences do not seem to correspond to emac's idea of what "Print" and "Pause" mean.

How can I figure out what "Print" and "Pause" mean to emacs? I.e. what string should I associated with "Pause" and "Print" so that emacs will then properly associate [Print] and [Pause] to "save-buffer" and "save-buffer-kill-emacs"?

Note: for keycode 107, which I think is normally associated with "Print" or "Print Scr", I get the following results (all under the X-server provided by F14);

xev reports that keycode 107 has keysym 0xff61,

xmodmap -pke reports
keycode 107 = Print Sys_Req Print Sys_Req

emacs quoted-insert reports nothing

dumpkeys reports
keycode 107 = Select

Last edited by gfenton; 16th February 2011 at 11:39 PM. Reason: grammatical errors in the above
Reply With Quote
  #2  
Old 5th March 2011, 08:53 PM
gfenton Offline
Registered User
 
Join Date: Apr 2007
Posts: 8
linuxfedorafirefox
Re: keyboard mapping

Well, I can't find a way to make it portable. What I did was map Print and Pause to various escape sequences via .Xdefaults and then map them to what I want in emacs via .emacs. Most of the function keys can be mapped to commands in .emacs via statements like

(global-set-key [S-f1] 'rerun-prev-command);; [shift-F1]
(global-set-key [f1] 'undo)

(it seems to me that it might be important to define the shifted version first...)
but the the Print, Pause, and Keypad keys have to be first mapped to something else. Here is what I put in my .Xdefaults file;

!------------------------------- .Xdefaults ----------------------------------
! The following need to be set on Fedora 14 in order to map these keys in
! emacs to the functions I usually like.

XTerm*vt100.translations: #override \
Shift <Key>Print: string("\033[50~") \n\
<Key>Print: string("\033[40~") \n\
Shift <Key>Pause: string("\033[51~") \n\
<Key>Pause: string("\033[41~") \n\
<Key>KP_0: string("\033O20~") \n\
<Key>KP_1: string("\033O21~") \n\
<Key>KP_2: string("\033O22~") \n\
<Key>KP_3: string("\033O23~") \n\
<Key>KP_4: string("\033O24~") \n\
<Key>KP_5: string("\033O25~") \n\
<Key>KP_6: string("\033O26~") \n\
<Key>KP_7: string("\033O27~") \n\
<Key>KP_8: string("\033O28~") \n\
<Key>KP_9: string("\033O29~") \n\
<Key>KP_Decimal: string("\033O30~") \n\
<Key>KP_Enter: string("\033O31~")
----------------------------------------------------------------

and here are the corresponding entries in my .emacs file. Everything works now

---------------------------- .emacs ---------------------------
(global-set-key "\e[50~" 'kill-buffer) ;; [S-Print]
(global-set-key "\e[40~" 'save-buffer) ;; [Print]
(global-set-key "\e[51~" 'kill-buffer) ;; [S-Pause]
(global-set-key "\e[41~" 'save-buffers-kill-terminal);; [Pause]

(global-set-key [kp-subtract] 're-search-backward) ;; [KP_Minus]
(global-set-key "\eO20~" 'overwrite-mode) ;; [KP_0]
(global-set-key "\eO21~" 'end-of-line) ;; [KP_1]
(global-set-key "\eO22~" 'what-cursor-position) ;; [KP_2]
(global-set-key "\eO23~" 'goto-line) ;; [KP_3]
(global-set-key "\eO24~" 'copy-to-register) ;; [KP_4]
(global-set-key "\eO25~" 'recenter) ;; [KP_5]
(global-set-key "\eO26~" 'what-line) ;; [KP_6]
(global-set-key "\eO27~" 'beginning-of-line) ;; [KP_7]
(global-set-key "\eO28~" 'quoted-insert) ;; [KP_8]
(global-set-key "\eO29~" 'exchange-point-and-mark);; [KP_9]
(global-set-key "\eO30~" 'kill-line) ;; [KP_Del]
(global-set-key "\eO31~" 'yank) ;; [KP_Enter]
Reply With Quote
Reply

Tags
keyboard, mapping

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard Mapping mrHappyPants Guides & Solutions (No Questions) 0 24th November 2009 08:12 AM
Keyboard mapping eliashickman Using Fedora 3 8th September 2009 03:17 PM
Keyboard mapping P.o.D Using Fedora 4 4th September 2009 11:13 PM
Keyboard mapping plrsmith Hardware & Laptops 0 12th June 2009 10:26 AM
Keyboard mapping in FC2 paulec EOL (End Of Life) Versions 5 2nd September 2004 12:27 AM


Current GMT-time: 09:52 (Wednesday, 23-07-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat