LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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


Reply
  Search this Thread
Old 10-20-2002, 03:09 AM   #1
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Rep: Reputation: 15
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
 
Old 12-31-2002, 04:30 PM   #2
elconde
Member
 
Registered: Sep 2001
Location: Cherry Hill, NJ
Distribution: Gentoo baby!
Posts: 67

Rep: Reputation: 15
The ssh or telnet client you're using should have a "backspace sends delete" option.



HTH,

Robert
 
Old 12-31-2002, 05:09 PM   #3
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
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
 
Old 12-31-2002, 06:30 PM   #4
elconde
Member
 
Registered: Sep 2001
Location: Cherry Hill, NJ
Distribution: Gentoo baby!
Posts: 67

Rep: Reputation: 15
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
 
Old 01-05-2003, 01:04 PM   #5
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
Thanks for the link. Unfortunately, its dead (maybe only for the moment).
 
Old 01-05-2003, 04:10 PM   #6
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
The stty command should start you in the right direction.
 
Old 05-20-2003, 05:00 PM   #7
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 49
tset can also help, read the tset man page. Put the command in your .bashrc or .cshrc, depending on your login shell.
 
Old 05-29-2003, 06:12 PM   #8
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
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.
 
Old 06-02-2003, 12:11 PM   #9
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 49
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.
 
Old 07-12-2003, 11:48 AM   #10
benissimo
LQ Newbie
 
Registered: Jul 2003
Posts: 2

Rep: Reputation: 0
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
 
Old 07-12-2003, 12:10 PM   #11
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
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.
 
Old 07-12-2003, 12:30 PM   #12
benissimo
LQ Newbie
 
Registered: Jul 2003
Posts: 2

Rep: Reputation: 0
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
 
Old 07-12-2003, 12:35 PM   #13
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
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.
 
Old 06-21-2004, 02:33 PM   #14
ewa
LQ Newbie
 
Registered: Jun 2004
Posts: 1

Rep: Reputation: 0
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.
 
Old 07-14-2007, 08:46 AM   #15
superzhangde
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to enable BOTH virtual & local vsftpd logins with PAM? quasidynamic Linux - Software 3 08-12-2010 12:00 PM
backspace in emacs phoenix7 Linux - Software 1 10-01-2005 03:51 AM
Dynamic DNS for remote telnet ssh logins? nadsab Linux - Networking 10 03-27-2004 11:53 AM
Trying to setup remote logins on small network armedguard Linux - Networking 13 12-11-2003 10:26 AM
Redhat 9, Emacs, Backspace, Sucky iketa Linux - Software 0 07-17-2003 12:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration