unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* What's the meaning of "^A" in emacs?
@ 2015-07-28 13:48 Navy Cheng
  2015-07-28 15:46 ` Drew Adams
  2015-07-28 21:34 ` Emanuel Berg
  0 siblings, 2 replies; 10+ messages in thread
From: Navy Cheng @ 2015-07-28 13:48 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,
What't the meaning of "^-characters" such as ^A, ^_, ^O ? I see this characters
in some files. And How can I input this characters?
Thanks.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: What's the meaning of "^A" in emacs?
  2015-07-28 13:48 What's the meaning of "^A" in emacs? Navy Cheng
@ 2015-07-28 15:46 ` Drew Adams
  2015-07-28 21:34 ` Emanuel Berg
  1 sibling, 0 replies; 10+ messages in thread
From: Drew Adams @ 2015-07-28 15:46 UTC (permalink / raw)
  To: Navy Cheng, help-gnu-emacs

> What't the meaning of "^-characters" such as ^A, ^_, ^O ? I see this
> characters in some files. And How can I input this characters?

See the Emacs manual, node `Text Display'.
http://www.gnu.org/software/emacs/manual/html_node/emacs/Text-Display.html

You can insert any control character by first hitting `C-q' and then
hitting the character (e.g. use "Control + q Control + a" to insert
the Control A character.

For info about `C-q', see the Emacs manual, node `Inserting Text'.
http://www.gnu.org/software/emacs/manual/html_node/emacs/Inserting-Text.html



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: What's the meaning of "^A" in emacs?
  2015-07-28 13:48 What's the meaning of "^A" in emacs? Navy Cheng
  2015-07-28 15:46 ` Drew Adams
@ 2015-07-28 21:34 ` Emanuel Berg
  2015-07-29 14:55   ` Jorge A. Alfaro-Murillo
  1 sibling, 1 reply; 10+ messages in thread
From: Emanuel Berg @ 2015-07-28 21:34 UTC (permalink / raw)
  To: help-gnu-emacs

Navy Cheng <navych@126.com> writes:

> What't the meaning of "^-characters" such as ^A, ^_,
> ^O ? I see this characters in some files. And How
> can I input this characters? Thanks.

^ is the Control key, so ^A is C-a in Emacs'
"human" notation.

\[ is the Meta key, so ^[m is M-m.

When you say "input", do you mean to *insert* them as
chars into a buffer? If so, just hit C-q first.
But I don't think you should do this too often (?).

If you mean input them as keystrokes, just hit the
Control and Meta keys, of course :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: What's the meaning of "^A" in emacs?
  2015-07-28 21:34 ` Emanuel Berg
@ 2015-07-29 14:55   ` Jorge A. Alfaro-Murillo
  2015-07-29 15:11     ` Drew Adams
  2015-07-29 15:35     ` Marcin Borkowski
  0 siblings, 2 replies; 10+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-07-29 14:55 UTC (permalink / raw)
  To: help-gnu-emacs

Emanuel Berg writes:

> Navy Cheng <navych@126.com> writes: 
> 
>> What't the meaning of "^-characters" such as ^A, ^_, ^O ? I see 
>> this characters in some files. And How can I input this 
>> characters? Thanks. 
> 
> When you say "input", do you mean to *insert* them as chars into 
> a buffer? If so, just hit C-q first.  But I don't think you 
> should do this too often (?).

Yes, why would someone use this? The only thing that I use is the 
"form feed" (^L) to divide sections in plain text documents and 
then be able to use C-x [ and C-x ] to move between pages.

Does someone know of any other "control character" use?

Best,
-- 
Jorge.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: What's the meaning of "^A" in emacs?
  2015-07-29 14:55   ` Jorge A. Alfaro-Murillo
@ 2015-07-29 15:11     ` Drew Adams
  2015-07-29 15:16       ` Drew Adams
  2015-07-29 15:23       ` Jorge A. Alfaro-Murillo
  2015-07-29 15:35     ` Marcin Borkowski
  1 sibling, 2 replies; 10+ messages in thread
From: Drew Adams @ 2015-07-29 15:11 UTC (permalink / raw)
  To: jorge.alfaro-murillo, help-gnu-emacs

> > When you say "input", do you mean to *insert* them as chars into
> > a buffer? If so, just hit C-q first.  But I don't think you
> > should do this too often (?).
> 
> Yes, why would someone use this? The only thing that I use is the
> "form feed" (^L) to divide sections in plain text documents and
> then be able to use C-x [ and C-x ] to move between pages.
> 
> Does someone know of any other "control character" use?

It is common to use `C-j' when you interactively enter a regexp
that contains a newline char (Control J).  This is because
(vanilla) Emacs binds `C-j' in the minibuffer to a command other
than self-insertion.

(FWIW - That's a misfeature, but hey, it took a couple decades to
get `SPC' to insert in the minibuffer, and it still does so only
for file-name input.  It will be another decade or several before
newline and `?' earn their rightful place as self-inserters.)

Similarly, if you want to query-replace something that contains
carriage-return (`C-m') chars, then you will use `C-q C-m' (aka
`C-q RET') to pass the `C-m' char to the query string.

Emacs is very general.  The ASCII control chars are, well, just
chars.  You can use them wherever you want, including in strings.
Chars,in strings or otherwise, are not used only for display.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: What's the meaning of "^A" in emacs?
  2015-07-29 15:11     ` Drew Adams
@ 2015-07-29 15:16       ` Drew Adams
  2015-07-29 15:22         ` Drew Adams
  2015-07-29 15:23       ` Jorge A. Alfaro-Murillo
  1 sibling, 1 reply; 10+ messages in thread
From: Drew Adams @ 2015-07-29 15:16 UTC (permalink / raw)
  To: jorge.alfaro-murillo, help-gnu-emacs

> It is common to use `C-j' when you interactively enter a regexp
> that contains a newline char (Control J).

I take that part back; sorry.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: What's the meaning of "^A" in emacs?
  2015-07-29 15:16       ` Drew Adams
@ 2015-07-29 15:22         ` Drew Adams
  0 siblings, 0 replies; 10+ messages in thread
From: Drew Adams @ 2015-07-29 15:22 UTC (permalink / raw)
  To: jorge.alfaro-murillo, help-gnu-emacs

> > It is common to use `C-j' when you interactively enter a regexp
> > that contains a newline char (Control J).
> 
> I take that part back; sorry.

No, I don't.  (Sorry for the noise.  For a second I thought
maybe Emacs had wised up wrt `C-j'.)

The problem is that `C-j' and `C-m' do not self-insert in
the minibuffer keymaps.  So when a command such as
`query-replace' reads a pattern (string of chars) it does
not include any `C-j' or `C-m' (aka `RET') chars that you
hit in the search string.

Instead, it interprets them as commands to enter the other
(self-inserting) chars you have typed so far as the search
string.  So to enter these control chars you need to "quote"
them, using `C-q'.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: What's the meaning of "^A" in emacs?
  2015-07-29 15:11     ` Drew Adams
  2015-07-29 15:16       ` Drew Adams
@ 2015-07-29 15:23       ` Jorge A. Alfaro-Murillo
  2015-07-29 22:39         ` Emanuel Berg
  1 sibling, 1 reply; 10+ messages in thread
From: Jorge A. Alfaro-Murillo @ 2015-07-29 15:23 UTC (permalink / raw)
  To: help-gnu-emacs

Drew Adams writes:

>> > When you say "input", do you mean to *insert* them as chars 
>> > into a buffer? If so, just hit C-q first.  But I don't think 
>> > you should do this too often (?). 
>>  Yes, why would someone use this? The only thing that I use is 
>> the "form feed" (^L) to divide sections in plain text documents 
>> and then be able to use C-x [ and C-x ] to move between pages. 
>> Does someone know of any other "control character" use? 
> 
> It is common to use `C-j' when you interactively enter a regexp 
> that contains a newline char (Control J).  This is because 
> (vanilla) Emacs binds `C-j' in the minibuffer to a command other 
> than self-insertion.

Yes, I had forgotten that one. It is very handy not only in regexp 
but when using command query-replace.

Another use is C-q <space>, for writing a space with ido or when 
auto-fill-mode is on and you want not to break the line.

-- 
Jorge.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: What's the meaning of "^A" in emacs?
  2015-07-29 14:55   ` Jorge A. Alfaro-Murillo
  2015-07-29 15:11     ` Drew Adams
@ 2015-07-29 15:35     ` Marcin Borkowski
  1 sibling, 0 replies; 10+ messages in thread
From: Marcin Borkowski @ 2015-07-29 15:35 UTC (permalink / raw)
  To: help-gnu-emacs


On 2015-07-29, at 16:55, Jorge A. Alfaro-Murillo <jorge.alfaro-murillo@yale.edu> wrote:

> Emanuel Berg writes:
>
>> Navy Cheng <navych@126.com> writes: 
>> 
>>> What't the meaning of "^-characters" such as ^A, ^_, ^O ? I see 
>>> this characters in some files. And How can I input this 
>>> characters? Thanks. 
>> 
>> When you say "input", do you mean to *insert* them as chars into 
>> a buffer? If so, just hit C-q first.  But I don't think you 
>> should do this too often (?).
>
> Yes, why would someone use this? The only thing that I use is the 
> "form feed" (^L) to divide sections in plain text documents and 
> then be able to use C-x [ and C-x ] to move between pages.
>
> Does someone know of any other "control character" use?

Contrived, maybe, but legit.  In (La)TeX you sometimes need a character
you know for sure won't be used anywhere else (at least in a normal
document).  I know at least one LaTeX package which uses ^A, and I used
it myself when implementing a verbatim-like construct as a sort of
"escape" (more precisely, a way to insert a LaTeX command in a place
where most special characters were not special anymore).

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: What's the meaning of "^A" in emacs?
  2015-07-29 15:23       ` Jorge A. Alfaro-Murillo
@ 2015-07-29 22:39         ` Emanuel Berg
  0 siblings, 0 replies; 10+ messages in thread
From: Emanuel Berg @ 2015-07-29 22:39 UTC (permalink / raw)
  To: help-gnu-emacs

jorge.alfaro-murillo@yale.edu (Jorge A.
Alfaro-Murillo) writes:

>> It is common to use `C-j' when you interactively
>> enter a regexp that contains a newline char
>> (Control J). This is because (vanilla) Emacs binds
>> `C-j' in the minibuffer to a command other than
>> self-insertion.
>
> Yes, I had forgotten that one. It is very handy not
> only in regexp but when using command query-replace.

Yeah, good example, only I'd recommend putting the
form into the buffer itself instead and evaluating it
there. More clear, less error prone, easier to edit if
the result isn't bullseye the first invocation.
But for very simple expressions the metabuffer
is fine.

> Another use is C-q <space>, for writing a space with
> ido or when auto-fill-mode is on and you want not to
> break the line.

Very good example! Better than `C-x 8 RET space RET' :)

-- 
underground experts united
http://user.it.uu.se/~embe8573




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-07-29 22:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 13:48 What's the meaning of "^A" in emacs? Navy Cheng
2015-07-28 15:46 ` Drew Adams
2015-07-28 21:34 ` Emanuel Berg
2015-07-29 14:55   ` Jorge A. Alfaro-Murillo
2015-07-29 15:11     ` Drew Adams
2015-07-29 15:16       ` Drew Adams
2015-07-29 15:22         ` Drew Adams
2015-07-29 15:23       ` Jorge A. Alfaro-Murillo
2015-07-29 22:39         ` Emanuel Berg
2015-07-29 15:35     ` Marcin Borkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).