Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

emacs Ctrl-h does backspace instead of help [SOLVED]

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
4 posts • Page 1 of 1
Author
Message
Seron
Apprentice
Apprentice
User avatar
Posts: 293
Joined: Tue Dec 31, 2002 11:49 pm
Location: Malmö, Sweden

emacs Ctrl-h does backspace instead of help [SOLVED]

  • Quote

Post by Seron » Fri Feb 13, 2004 7:02 pm

I've read about people having the problem that backspace invokes emacs help, but not the other way arroud, like I have.

Any idea why this is happening?

fwiw, my /etc/inputrc includes this part

Code: Select all

$if mode=emacs

# for linux console and RH/Debian xterm
"\e[1~": beginning-of-line
"\e[4~": end-of-line
#"\e[5~": beginning-of-history
#"\e[6~": end-of-history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word

# for rxvt
"\e[8~": end-of-line

# for non RH/Debian xterm, can't hurt for RH/DEbian xterm
"\eOH": beginning-of-line
"\eOF": end-of-line

# for freebsd console
"\e[H": beginning-of-line
"\e[F": end-of-line
$endif
edit: C-h works if I start emacs without any parameters which makes it start using X or when using outside of X. It's when starting with --no-windows that it doesn't work.
Last edited by Seron on Fri Feb 13, 2004 10:51 pm, edited 1 time in total.
Top
k9
Apprentice
Apprentice
User avatar
Posts: 160
Joined: Sun Sep 28, 2003 3:34 am
Location: Salt Lake City, USA
Contact:
Contact k9
Website

  • Quote

Post by k9 » Fri Feb 13, 2004 10:12 pm

I just avoid the issue by putting this in my .emacs:

Code: Select all

;; make C-h work like backspace
(global-set-key "\C-h" 'delete-backward-char)

;; Change help command to [F1]  (it is usually C-h)
(global-set-key [f1] 'help-command)
Then you can use C+h to for backspace just like you can in almost any other program while still having quick access to help.

I know that this sidesteps your actual question, but I thought this might help.

EDIT: I just noticed that [f1] does not properly work to pull up help remotely (not surprising). M-x help always works for help. :-)
Last edited by k9 on Fri Feb 13, 2004 10:53 pm, edited 1 time in total.
Top
massimo
Veteran
Veteran
User avatar
Posts: 1226
Joined: Sun Jun 22, 2003 5:56 pm

  • Quote

Post by massimo » Fri Feb 13, 2004 10:13 pm

You have to remap your keys in e.g. .emacs, so CTRL-h works in the terminal since it's defined in the ASCII table, that CTRL-h is 'short' for Backspace ;)
Hello 911? How are you?
Top
Seron
Apprentice
Apprentice
User avatar
Posts: 293
Joined: Tue Dec 31, 2002 11:49 pm
Location: Malmö, Sweden

emacs Ctrl-h does backspace instead of help [SOLVED]

  • Quote

Post by Seron » Fri Feb 13, 2004 10:20 pm

Thanks to this excellent guide I found out how this can be fixed: http://www.squish.net/docs/delbs.html
Xterm

Xterm is a normal X application and will receive keycodes just like Netscape does. It will then look up the corresponding keysym and find BackSpace for your backspace key and Delete for your delete key. So, what does xterm send to the remote end? There is no provision in X for translating these codes into ASCII sequences. Xterm has to handle this itself...

Unfortunately xterm comes setup wrong (perhaps from only xfree86 4 onwards). There is a X resource called backarrowKey that specifies whether or not the BackSpace keysym generates a backspace or not. This is set to true by default but it should be false. To fix this add/create the following line in your .Xdefaults file: xterm.*.backarrowKey: false. This will make your backspace key generate the ^? code. The Delete keysym always generates the VT220 delete sequence, so that will be correct.

Emacs

Emacs receives your input via Xterm and expects ^? for delete left and the VT220 delete sequence for delete right. If you have followed the above you will find emacs will work correctly - both locally and remotely. There is no reason at all for altering emacs' configuration files. If you get the help file when you try and delete then xterm is sending the wrong character. If you find your backspace deletes right then this means you've got your keysyms the wrong way around, more than likely this is the cause of following some FAQ that tells you to swap them - don't. The backspace keycode should generate the BackSpace keysym. Do not alter emacs' configuration files to fix keyboard problems!

Other notes

Your stty erase character should be ^?. Type stty -a to see what erase is currently set to, if it is wrong, type stty erase '^?'.
Top
Post Reply

4 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic