From owner-freebsd-questions@FreeBSD.ORG Sun Oct 29 01:12:19 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 C995E16A412 for ; Sun, 29 Oct 2006 01:12:19 +0000 (UTC) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (gizmo.acns.msu.edu [35.8.1.43]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B22743D55 for ; Sun, 29 Oct 2006 01:12:19 +0000 (GMT) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (localhost [127.0.0.1]) by gizmo.acns.msu.edu (8.13.6/8.13.6) with ESMTP id k9T19E3I005254; Sat, 28 Oct 2006 21:09:14 -0400 (EDT) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: (from jerrymc@localhost) by gizmo.acns.msu.edu (8.13.6/8.13.6/Submit) id k9T19EMY005253; Sat, 28 Oct 2006 21:09:14 -0400 (EDT) (envelope-from jerrymc) Date: Sat, 28 Oct 2006 21:09:14 -0400 From: Jerry McAllister To: Malcolm Kay Message-ID: <20061029010813.GB5166@gizmo.acns.msu.edu> References: <45425D61.6030209@enabled.com> <20061028003929.GA99333@gizmo.acns.msu.edu> <4542C704.70309@enabled.com> <200610291130.46023.malcolm.kay@internode.on.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200610291130.46023.malcolm.kay@internode.on.net> User-Agent: Mutt/1.4.2.2i Cc: "Peter A. Giessel" , freebsd-questions@freebsd.org, 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:12:19 -0000 On Sun, Oct 29, 2006 at 11:30:45AM +1030, Malcolm Kay wrote: > 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. The original post talked about the characters in a text file - most particularly the ^M and I responded to that and not to anything about keyboard codes. Generally, regardless of what scan codes the machine generates with keypresses, a text editor still puts certain codes in the text file, essentially according to the ASCII character set. Now a wordprocessor file or a WYSIWYG or a GUI system uses a much more extended set of character codes and representations and action codes. But, that wasn't the orginal post topic. ////jerry > > 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"