From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: xah@xahlee.org Newsgroups: gmane.emacs.help Subject: Re: Meta-Characters, Special Characters Date: 29 May 2007 16:29:33 -0700 Organization: http://groups.google.com Message-ID: <1180481373.651591.253210@i38g2000prf.googlegroups.com> References: <5c2mbdF2ung8hU1@mid.individual.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1180507535 12510 80.91.229.12 (30 May 2007 06:45:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 30 May 2007 06:45:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 30 08:45:34 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HtHw5-0005fF-G3 for geh-help-gnu-emacs@m.gmane.org; Wed, 30 May 2007 08:45:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HtHw4-00006i-7y for geh-help-gnu-emacs@m.gmane.org; Wed, 30 May 2007 02:45:32 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!i38g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help, comp.emacs, comp.lang.perl.misc, comp.lang.java.programmer, comp.lang.lisp Original-Lines: 154 Original-NNTP-Posting-Host: 69.236.73.43 Original-X-Trace: posting.google.com 1180481389 23650 127.0.0.1 (29 May 2007 23:29:49 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 29 May 2007 23:29:49 +0000 (UTC) In-Reply-To: <5c2mbdF2ung8hU1@mid.individual.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: i38g2000prf.googlegroups.com; posting-host=69.236.73.43; posting-account=OIaTGwwAAABntbwd95_ohTn1wTSa5sqo Original-Xref: shelby.stanford.edu gnu.emacs.help:148950 comp.emacs:94393 comp.lang.perl.misc:609669 comp.lang.java.programmer:785325 comp.lang.lisp:221371 X-Mailman-Approved-At: Wed, 30 May 2007 02:45:15 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:44541 Archived-At: Will (aka weber) wrote: =C2=AB [about the various ways to input or represent keystrokes and or non- printable characters in Emacs] As far as I can see in all those situations entering meta-characters is addressed in a different way which I find confusing, e.g.: a) _or_ C-q b) C-q C-[, C-q C-m, C-q C-j, C-q C-i c) \e, \r, \n, \t d) (define-key [(meta c) (control c) (tab c)] "This is confusing!") =C2=BB None of this complexity is istrinsic. Will wrote: =C2=ABa) _or_ C-q =C2=BB The C-q (or, pressing the Control key down then type q) is the keyboard shortcut to invoke the command quoted-insert. It is a general a way to allow you to input any non-printable characters. This facility usually don't exist in other text editors. In popular text editor such as Microsoft Word or Mac's Application, you usally bring up a window showing all the special characters, then press a button to insert the char you want. =C2=AB b) C-q C-[, C-q C-m, C-q C-j, C-q C-i=C2=BB In this, the C-q is the keyboard shortcut to invoke the command quoted- insert, which will insert a literal character of whatever character you can type on your keyboard. So, for example, C-q followed by the tab key will insert a the non-printable character tab. When speaking of non-printable characters, the context is a character set standard. Implicitly, we are talking about ASCII, and this applies to emacs. Now, in ASCII, there are about 30 non-printable characters. Each of these is given a standard abbreviation, and several representations for different purposes. For example, ASCII 13 is the =E2=80=9CCarriage return=E2=80=9D character, with abbr code CR, and ^M as i= ts control- key-input representation. (M being the 13th of the English alphabet) For the full detail, look at the table here: http://en.wikipedia.org/wiki/Ascii (Note: Emacs also have a general way to input non-printable characters of the unicode standard. See Emacs and Unicode Tips http://xahlee.org/emacs/emacs_n_unicode.html ) =C2=AB c) \e, \r, \n, \t =C2=BB This is a ad-hoc set of input and display representation for a few non- printable characters. This set is started by the motherfucking unix tech geeking morons, and by its free and speedy nature as cigarette given to children, today has spread to many languages (Perl, Java, C+ +, C#, Python, JavaScript ...) and is a de facto standard. The damage is to such a degree that the general concept of unprintable characters, their representation, and their method of input, all treated in one systematic, simple way, are not in the consciousness of average industrial programers. I do not know the history of these display representations. (hopefully someone will) It is my guess, that part of the reason for these, is that the unix text editor vi, doesn't have a general way to input non- printable chars. =C2=AB d) (define-key [(meta c) (control c) (tab c)] "This is confusing!") =C2=BB This is the only part of complexity in our context that we can blame emacs's design. Emacs has several ways to represent keystrokes for defining shortcuts. The varieties mostly came from historical reasons, combined the the influence of unix mentality =E2=80=9CWhy Change when it ai= n't broken=E2=80=9D. Note here, that keystroke combination and sequence, is not the same and cannot be mapped to character's input/representation in a character set such as ASCII. For example, the F1 key in vast majority of keyboards, isn't a character. So, this means, when you have a editor with a language such as emacs, that allows users to define arbitrary key stroke sequences, you necessarily have to come up with a system to represent keystrokes. So, this complexity is a intrinsic complexity. (Side note: A easy way to understand what's intrinsic vs extraneous complexity is to think: =E2=80=9CMy god, why is math so complex? God must h= ave fucked up in its design.=E2=80=9D. The gist is that, certain things, are inherently complex by nature, while others, are extraneous complexity that are artificially created by lousy design or evolution. As a concrete example in computing, languages like Lisp, is in general very well designed. Due to its simplity and almost no artificial complexity, programers are immediately exposed to many of the intrinsic complexity of computing. While languages like C and its litters such as C++, Java, C#, Perl etc created by the unix motherfuckers, are filled to the brim with artificial complexity due to tremendous laziness, ignorance, and lies. ) For various ways to represent keyboard shortcuts, see http://xahlee.org/emacs/keyboard_shortcuts.html For the unix mentality =E2=80=9CWhy Change when it ain't broken=E2=80=9D, s= ee http://xahlee.org/UnixResource_dir/writ/aint_broken.html We, as software creators, must not have unix's =E2=80=9Cwhy change when it ain't broken=E2=80=9D attitude. Emacs itself, although far more well thought out than majority of software, nevertheless aquired many baggages in its 30 or so years of old age. I would recommend that we start a effort to eliminate some of these outdated baggages. Please see: =E2=80=9CThe Modernization of Emacs=E2=80=9D http://xahlee.org/emacs/modernization.html Xah xah@xahlee.org =E2=88=91 http://xahlee.org/ On May 29, 5:58=C2=A0am, Will wrote: > Hi, > > how can I find the an overview on how to enter meta-characters > (e.g. esc, return, linefeed, tab, ...) > a) in a regular buffer > b) in the minibuffer when using standard search/replace-functions > c) in the minibuffer when using search/replace-functions using regular > expressions > d) in the .emacs file when defining keybindings > > As far as I can see in all those situations entering meta-characters is > addressed in a different way which I find confusing, e.g.: > a) _or_ C-q > b) C-q C-[, C-q C-m, C-q C-j, C-q C-i > c) \e, \r, \n, \t > d) (define-key [(meta c) (control c) (tab c)] "This is confusing!") > > Furthermore, they are displayed in a different way,e.g. > - actual, visible layout > - ^E, ^M, ^L, ^I > - Octals > > I would be happy about pages summarizing such information. > Any references available? > > Thanks in advance, > > Will