From owner-freebsd-questions@FreeBSD.ORG Fri Mar 25 12:47:50 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 30DF7106566C for ; Fri, 25 Mar 2011 12:47:50 +0000 (UTC) (envelope-from atcs.matthew@gmail.com) Received: from mail-yi0-f54.google.com (mail-yi0-f54.google.com [209.85.218.54]) by mx1.freebsd.org (Postfix) with ESMTP id D9D588FC08 for ; Fri, 25 Mar 2011 12:47:49 +0000 (UTC) Received: by yie12 with SMTP id 12so476957yie.13 for ; Fri, 25 Mar 2011 05:47:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=TxRXwoaUQwro/1gNgwTHuCBd98pQAkgvpxZoX/6xX4Y=; b=sJk/tSXzBjJkl6q7hV6mhF7QzvA/Dmb4rcDNE7fao1cm6tR/juqlSSXx2qVDOA6jfJ 8gmSYfqPD9QKXBtTiC0dlfnjH5WwwJ+TNe8xvkuylDLgnYhToTq8t9m7w3rI5z+/6DX4 mOkDpBSCi8JcjPY1aDEISPDIzDgGGeKFYPj20= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; b=cF2YMzDDIlKIhv37uYIaBRvoBL58eGJIEgHvXYvC+MgZP788Gy6+PlV9p4zLkBW382 tPowbFtUyHwpcdnqLn5AZAA2PJEK0qKguUz1BvCnulmJLHRxy6XayD8UraaV9/hOKQvK 4kOyuJ1vSNmxQqVtO67Cu6gTGmzqxnfXjxRO4= Received: by 10.101.115.18 with SMTP id s18mr570038anm.103.1301057268931; Fri, 25 Mar 2011 05:47:48 -0700 (PDT) Received: from [192.168.1.145] (97-82-152-60.dhcp.hckr.nc.charter.com [97.82.152.60]) by mx.google.com with ESMTPS id t23sm1017167ano.51.2011.03.25.05.47.44 (version=SSLv3 cipher=OTHER); Fri, 25 Mar 2011 05:47:45 -0700 (PDT) Message-ID: <4D8C8EEF.6070706@gmail.com> Date: Fri, 25 Mar 2011 08:47:43 -0400 From: Matthew Morgan User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4D8BB0F9.4080601@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: emacs backspace question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Mar 2011 12:47:50 -0000 On 03/24/2011 05:55 PM, Nerius Landys wrote: >> I've read a lot on the internet regarding the use of the backspace key in >> emacs, but the proposed solutions don't seem to be working for me. >> >> I just installed FreeBSD 8.1 in Virtualbox and installed emacs 23.2.1 by >> means of the package installer. Everything in emacs works great except the >> backspace key, which deletes forward instead of back like it should. I've >> found a lot of different things on the internet about it: >> >> * switched to bash instead of csh - didn't fix it, but I like bash better >> * M-x normal-erase-is-backspace-mode -toggling it once makes my backspace >> bring up the "help" command; toggling it again changes it back >> * different keymaps >> - I started out using us.iso.kbd (which exhibits the backspace issue, but >> other keys are right) >> - I tried us.emacs.kbd - backspace works right, but many other keys are >> mapped wrong (even letters and numbers) >> - I tried us.unix.kbd - backspace doesn't work right and neither do my >> control keys >> >> I also just noticed that when on the command line itself (outside of emacs) >> backspace deletes backward as it should, but so does delete! >> >> Is this something weird with virtualbox, or am I doing something wrong? > You have just discovered what is in my opinion a can of worms with no > clear solution. I have struggled with issues such as these before, > and I've managed to solve them more or less. > > Are you using emacs in a terminal window? (As opposed to with an X > server.) I'm assuming yes. In a terminal window, yes. I don't have X installed yet. > Are you accessing your computer directly through the console or > through an xterm and SSH, for example? Questions such as those are > important to fully diagnose and fix the problem. You want to do an > "echo $TERM" before you start diagnosing problems such as these. If I ssh in, I don't have a problem. The only time I have a problem is when I'm logging in directly; in that instance, my $TERM is "cons25". > If you are using bash, you can do a "man bash" and look at the part > that describes ~/.inputrc and/or READLINE. You may want to create an > ~/.inputrc file and add stuff to it to resolve the backspace/delete > issues that you are having. For example, I have the following in my > ~/.inputrc because I do use bash occasionally: > > $if term=cons25 > "\x7f": delete-char > $else > $if term=xterm > "\x1b\x5b\x35\x43": forward-word > "\x1b\x5b\x31\x3b\x35\x43": forward-word > "\x1b\x5b\x35\x44": backward-word > "\x1b\x5b\x31\x3b\x35\x44": backward-word > $endif > $endif I tried these values, but they didn't work for me. I'm installing vim as we speak so I can use xxd as you indicated below to check what my keys are putting out; I'll post back with my findings. > "cons25" is the native FreeBSD console (like when you're physically at > the computer console) and xterm is of course xterm. (Side note: Why > in the heck on my 9.0-CURRENT system the system console says the TERM > is xterm?) That is odd indeed! It must have come in the xterm-nox11 port. ;) > As far as how I came up with the strings such as "\x1b\x5b\x35\x43", > you can use a command such as "xxd" which comes with the vim > package/port to tell you what bytes are being sent when you press a > certain key. > > If you want to fix your csh shell too, you may consider editing your > ~/.cshrc file. Here is my complete ~/.cshrc, and note the stuff at > the bottom with the key bindings: > > setenv EDITOR vi > setenv PAGER less > if ($?prompt) then > # An interactive shell -- set some stuff up > set prompt = "`whoami`@`/bin/hostname -s`> " > set filec > set history = 2000 > set savehist = 2000 > set mail = (/var/mail/$USER) > if ( $?tcsh ) then > bindkey "^W" backward-delete-word > bindkey -k up history-search-backward > bindkey -k down history-search-forward > if ("$TERM" == "cons25") then > bindkey "^?" delete-char > else if ("$TERM" == "linux") then > bindkey "^[[3~" delete-char > else if ("$TERM" == "xterm") then > bindkey "^[[3~" delete-char > bindkey "^[[5C" forward-word > bindkey "^[[1;5C" forward-word > bindkey "^[[5D" backward-word > bindkey "^[[1;5D" backward-word > bindkey "\303\277" backward-delete-word > endif > endif > endif > > > By the way I have a 9.0 CURRENT box here at my desk, and I've compiled > emacs-nox11 port, and I'm at the system console (meaning I'm > physically at the console). I am using /bin/tcsh as my shell. I have > no modifications to any of my dotfiles, they are all stock. In emacs, > I'm able to use Backspace and Delete just as expected. > > Maybe you should try setting your default shell to /bin/tcsh, if it > isn't already. If you're on a mission critical system you want your > default shell to be part of the base system (as opposed to being a > port), and the only clear choice for that is /bin/tcsh. Besides it's > the default root shell too. I tried /bin/tcsh to no avail, sadly. > Also, if you are looking for a superior shell from ports you might try > zsh. It's the best in my opinion. I might give that a look!