Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
10-20-2002, 03:09 AM
|
#1
|
|
Member
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136
Rep:
|
How do I enable emacs Backspace on remote logins?
Whenever I telnet or ssh to other computers on my lan, the backspace (left delete) key no longer works in emacs. Does anyone have any idea how I fix this?
Thanks
|
|
|
|
12-31-2002, 04:30 PM
|
#2
|
|
Member
Registered: Sep 2001
Location: Cherry Hill, NJ
Distribution: Gentoo baby!
Posts: 67
Rep:
|
The ssh or telnet client you're using should have a "backspace sends delete" option.
HTH,
Robert
|
|
|
|
12-31-2002, 05:09 PM
|
#3
|
|
Member
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136
Original Poster
Rep:
|
I'm using OpenSSH_3.4p1 from the command line (protocols 1.5/2.0). I don't find any option which changes the mapping of the backspace key to anything in either the man pages, the info pages, or anywhere else I've looked. Anyway - it works from the commandline. Its only emacs which loses the backspace key across the ssh connection.
-Jeff
|
|
|
|
12-31-2002, 06:30 PM
|
#4
|
|
Member
Registered: Sep 2001
Location: Cherry Hill, NJ
Distribution: Gentoo baby!
Posts: 67
Rep:
|
I used to have this problem. The backspace key would bring up emacs help. I learned to stop using backspace.
That was rash. There's better advice here:
http://linux.umbc.edu/lug-mailing-li.../msg00361.html
HTH,
R
|
|
|
|
01-05-2003, 01:04 PM
|
#5
|
|
Member
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136
Original Poster
Rep:
|
Thanks for the link. Unfortunately, its dead (maybe only for the moment).
|
|
|
|
01-05-2003, 04:10 PM
|
#6
|
|
Senior Member
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552
Rep:
|
The stty command should start you in the right direction.
|
|
|
|
05-20-2003, 05:00 PM
|
#7
|
|
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
|
tset can also help, read the tset man page. Put the command in your .bashrc or .cshrc, depending on your login shell.
|
|
|
|
05-29-2003, 06:12 PM
|
#8
|
|
Member
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136
Original Poster
Rep:
|
Thanks, I didn't know that one. But the terminal backspace is correct. Or at least, works correctly when operating the shell across ssh. What doesn't work right is the Backspace in Emacs operated across ssh on a remote machine. I don't see anything in the man pages which would remedy that.
|
|
|
|
06-02-2003, 12:11 PM
|
#9
|
|
Senior Member
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152
Rep:
|
Right, the terminal accepts two commands as a "backspace", ^H or ^?. Emacs only accepts one. You can check which one emacs uses by hitting Ctrl-H or Ctrl-? while in emacs. One of them should act as a backspace. Use tset to set that command to be the backspace while you are logged in to the remote machine (that is, on the remote machine, run, for example, "tset -e ^H" ).
I had a similar problem where Perl would not accept the ^H (which is what the backspace key sends) as an erase character, but I could use the backspace key normally for most other uses. Using "tset -e ^H" solved that.
|
|
|
|
07-12-2003, 11:48 AM
|
#10
|
|
LQ Newbie
Registered: Jul 2003
Posts: 2
Rep:
|
fix via .emacs
i had the same problem (backspace key works for the terminal session but not for emacs) and the tset -e fix didn't work for me, but I found a different workaround.
Adding this line to my .emacs, backspace does what it should w/in emacs:
(global-set-key "\C-h" 'backward-delete-char)
Anyway, hope that helps if there's anyone out there who ran into the same problem.
If, as mentioned in the post above, your backspace key is sending Ctl-?, rewrite the line as:
(global-set-key "\C-?" 'backward-delete-char)
Ciao 
|
|
|
|
07-12-2003, 12:10 PM
|
#11
|
|
Member
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136
Original Poster
Rep:
|
That might work. But the problem is with the Backspace key, not C-h. How do you designate the Backspace key in the lisp syntax? I tried [backspace] but it doesn't seem to like that.
|
|
|
|
07-12-2003, 12:30 PM
|
#12
|
|
LQ Newbie
Registered: Jul 2003
Posts: 2
Rep:
|
i found that every time i used the backspace in emacs it brought up a help dialog saying "you've just hit control-h, etc." thus, i knew that in my case emacs was receiving backspace as control-h and so i just mapped backward-delete-char to that combination.
see what emacs says when you type backspace within it; that should give a clue to how your terminal is set up. whatever combination of keys emacs "receives" when you hit backspace (in my case control-h), map that to backward-delete-char and from then on backspace will behave properly in emacs.
the backspace key doesn't send a primitive "backspace", it send some combination of keystrokes that, for example, the terminal correctly interprets as "the command for backspace". if emacs isn't doing the same, that's probably because it's mapping the combination to some other command, like the worthless help dialog....
the nice thing about modifying your .emacs as a fix is you avoid introducing any weird side-effects outside of emacs. on the other hand it can seem kind of janky to use such a workaround. maybe fiddling w/ your terminal settings would be the cleaner solution. still, if you're impatient like me, the .emacs fix is very quick...
cheers
|
|
|
|
07-12-2003, 12:35 PM
|
#13
|
|
Member
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136
Original Poster
Rep:
|
Thanks. I agree with sentiments about the solution being better localized to emacs. I'll give it a shot when I have access to the problem machine on monday. I don't have the problem here at home.
|
|
|
|
06-21-2004, 02:33 PM
|
#14
|
|
LQ Newbie
Registered: Jun 2004
Posts: 1
Rep:
|
Slightly more sophisticated .emacs change
Here's what I use:
Code:
(defun fix-backspace ()
"Map control-h to work as backspace"
(interactive)
(keyboard-translate ?\C-h ?\C-?)
(global-set-key [(hyper h)] 'help-command))
This maps C-h to whatever C-? was already mapped to, so it plays nice with other customizations, and it gives you a new binding for help. Since some terminals give me trouble and some don't, I like having this as a callable command, rather than making it automatic.
Std. disclaimer: I don't think this was originally my idea, but I don't know where I got it from.
|
|
|
|
07-14-2007, 08:46 AM
|
#15
|
|
LQ Newbie
Registered: Jul 2007
Posts: 2
Rep:
|
It happened to me a few days before. I use SecureCRT to SSH the server, but I found I chose Xterm in
Session Option > Terminal > Emulation. When I change it to VT100 and rerun it , it works normally.
I hope it's helpful.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:02 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|