Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Get char at point

1,445 views
Skip to first unread message

TheFlyingDutchman

unread,
Jul 17, 2010, 12:32:59 AM7/17/10
to
Is there a function to get the character at point? I see get-byte,
which would work for an ASCII coded file, but I believe Emacs has some
support for multi-byte character sets.

Harald Hanche-Olsen

unread,
Jul 17, 2010, 4:55:09 AM7/17/10
to
+ TheFlyingDutchman <zzbb...@aol.com>:

> Is there a function to get the character at point? I see get-byte,
> which would work for an ASCII coded file, but I believe Emacs has some
> support for multi-byte character sets.

If you type C-h f char TAB, you will see a bunch of functions whose
names begin with "char". Then you might wildly guess that the first hit,
char-after, is what you are looking for, and if you actually select
that, the wild guess is confirmed.

--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
when there is no ground whatsoever for supposing it is true.
-- Bertrand Russell

Message has been deleted

TheFlyingDutchman

unread,
Jul 17, 2010, 5:45:34 AM7/17/10
to
On Jul 17, 1:55 am, Harald Hanche-Olsen <han...@math.ntnu.no> wrote:
> + TheFlyingDutchman <zzbba...@aol.com>:

Thanks! I believe I did look at the char* functions. If it had been
named char-at I would have gotten it. It should be noted that the help
for "char-after" says
--------------------------------------------------------------------------------
(char-after &optional POS)

Return character in current buffer at position POS.
POS is an integer or a marker and defaults to point.
If POS is out of range, the value is nil.
----------------------------------------------------------------------------
The dubious concept of "point" being between characters, was
unfortunately
followed in naming the function, and then luckily ignored in the help
for the function.

Andreas Politz

unread,
Jul 17, 2010, 5:57:28 AM7/17/10
to
TheFlyingDutchman <zzbb...@aol.com> writes:

> Thanks! I believe I did look at the char* functions. If it had been
> named char-at I would have gotten it.

General functions are generally easier to find in the elisp manual.

---
File: elisp, Node: Top, Next: Introduction, Prev: (dir), Up: (dir)

Emacs Lisp
**********
...
* Text:: Examining and changing text in buffers.
...
---

-> (info "(elisp) Text")

And the first function of the first entry is what you were looking for.

-ap

TheFlyingDutchman

unread,
Jul 17, 2010, 6:48:55 PM7/17/10
to
On Jul 17, 2:57 am, Andreas Politz <poli...@fh-trier.de> wrote:

OK, thanks, I will check that in the future.

0 new messages