help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Meta-Characters, Special Characters


From: Ingo Menger
Subject: Re: Meta-Characters, Special Characters
Date: 31 May 2007 02:25:58 -0700
User-agent: G2/1.0

On 30 Mai, 01:29, x...@xahlee.org wrote:
> Will (aka weber) wrote:
>
> «
> [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) <key> _or_ C-q <key>
> 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!")
> »
>
> None of this complexity is istrinsic.
>
> Will wrote:
>
> «a) <key> _or_ C-q <key>»
>
> 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.
>
> « b) C-q C-[, C-q C-m, C-q C-j, C-q C-i»
>
> 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
> "Carriage return" character, with abbr code CR, and ^M as its 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 Tipshttp://xahlee.org/emacs/emacs_n_unicode.html
> )
>
> « c) \e, \r, \n, \t »
>
> 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.

At least not in yours, it seems. You do not understand, that \n is not
a way to enter the newline character, but is a way to name the newline
character without actually using it right mow.
The difference between using a character and mentioning (i.e. speaking
about) a character did not come to your mind yet, did it?

> 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-

Type Ctrl+V when vi is in input mode and then type the character you
want.
But note that, in most languages, the string literals
  "Xah Lee
           knows not much"
and
  "Xah Lee\n knows not much"
are very different. In fact, some languages will not even recognize
the first one as string literal.
This, again, has to do with the fact, that string literals are a way
to *mention* charachters that the compiled programm will later *use*.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]