From owner-freebsd-questions@FreeBSD.ORG Sun Oct 29 01:00:55 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5143E16A40F for ; Sun, 29 Oct 2006 01:00:55 +0000 (UTC) (envelope-from malcolm.kay@internode.on.net) Received: from ipmail01.adl2.internode.on.net (ipmail01.adl2.internode.on.net [203.16.214.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF96943D53 for ; Sun, 29 Oct 2006 01:00:54 +0000 (GMT) (envelope-from malcolm.kay@internode.on.net) Received: from ppp66-14.lns3.adl2.internode.on.net (HELO alpha.home) ([121.44.66.14]) by ipmail01.adl2.internode.on.net with ESMTP; 29 Oct 2006 11:30:52 +1030 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAKeYQ0V5LEIO/2dsb2JhbACBTA X-IronPort-AV: i="4.09,368,1157293800"; d="scan'208"; a="37404171:sNHT42196154" From: Malcolm Kay Organization: at home To: freebsd-questions@freebsd.org Date: Sun, 29 Oct 2006 11:30:45 +1030 User-Agent: KMail/1.8 References: <45425D61.6030209@enabled.com> <20061028003929.GA99333@gizmo.acns.msu.edu> <4542C704.70309@enabled.com> In-Reply-To: <4542C704.70309@enabled.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610291130.46023.malcolm.kay@internode.on.net> Cc: Jerry McAllister , "Peter A. Giessel" , Noah Subject: Re: replacing ^M with emacs 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: Sun, 29 Oct 2006 01:00:55 -0000 On Sat, 28 Oct 2006 12:27 pm, Noah wrote: > well I am pressing control-J for return not control-M so I > dont understand your rationale. > There seems to be considerable confusion in this thread between keystrokes and the codes they produce. Most modern keyboards report some form of scan code for each key pressed whether or not it is one of the modifier or special keys. At this stage there is no connection between the key or key combination pressed and an ASCII code. What an application sees in terms of codes depends on the OS and anything else that may get in between. We mostly think of keys and key combinations as being connected to the the codes seen by an ordinary console application, but this can vary according to the OS. With a standard setup running X applications with a graphics interface are able to see all keys translated to some form of symbol code (some sort of a super set of ASCII including codes for special keys) which can be customised with xmodmap. Character mode programs under X through some terminal emulation window will see codes (usually ASCII) as further translated by that terminal emulator. I find that by default xterm reports ^M on pressing the "enter/return" key but this can further customised through XTerm or .Xdefaults. A basic key is generally combined with the currently active modifier keys(shift,ctrl,alt, etc) to produce the code reported to the application. Other keys such as function keys might be reported as a sequence of codes. Utilities and applications may manage codes differently when they recognise the source as the keyboard so for example Ctrl-J, Ctrl-M and "enter" from the keyboard are all reported by "cat" as ^J. Malcolm > Jerry McAllister wrote: > >> Thanks Peter, > >> > >> where is the logic here? What is control-q for and what is > >> control-j for? I am trying to figure out how I could have > >> figured that out. > > > > They are ASCII characters. For example, the ^M you wanted > > to get rid of is CTRL-M. There are ASCII tables in > > various places. A quick search should turn up a few. The > > assignment of the characters are ancient and traditional and > > somewhat weird by how things are currently used, but will > > probably continue to stay that way. > > > > Line-Feed, for example - which is that character that marks > > the end of a line in text files, means it causes the printer > > to move the paper up one line - in old line printers and > > teletypes. CTRL-M or ^M is a RETURN (also ENTER nowdays) > > and that caused the print head to return to the beginning of > > the line. By the time UNIX came along, it wasn't necessary > > to use both characters to move the paper and print head > > because those were virtual. So, they just used one > > character - the line feed. But, MS-DOS and some others > > continued to use the pair to mean a new line for some reason > > - maybe the original association with IBM, although they > > didn't use ASCII, but EBCDIC - another animal. > > > > So, look up an ASCII chart with explanations and you can > > make an educated guess on the meanings. > > > > ////jerry > > > >> also is there a better page than the one I am using below > >> to figure all these keystrokes out? > >> > >> http://www.math.uh.edu/~bgb/emacs_keys.html > >> > >> Cheers, > >> > >> Noah > >> > >> Peter A. Giessel wrote: > >>> On 2006/10/27 15:20, Noah seems to have typed: > >>>> this is the best answer. Hits it right on the head of > >>>> what I want. What if I want the character to replace the > >>>> ^M with a new line what do I enter in the replace field? > >>> > >>> control-q control-j > >> > >> _______________________________________________ > >> freebsd-questions@freebsd.org mailing list > >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions > >> To unsubscribe, send any mail to > >> "freebsd-questions-unsubscribe@freebsd.org" > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org"