all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how to show ascii number of a character
@ 2003-01-12 18:40 Zimmen Gnauh
  2003-01-12 19:19 ` Romain FRANCOISE
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Zimmen Gnauh @ 2003-01-12 18:40 UTC (permalink / raw)



   Is there any emacs function that can show a the ascii number of a
character? i.e. you enter a character, and it shows a number. For
example, enter character D, it will show 68, or in octal, binary or
other forms. 

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

* Re: how to show ascii number of a character
  2003-01-12 18:40 how to show ascii number of a character Zimmen Gnauh
@ 2003-01-12 19:19 ` Romain FRANCOISE
  2003-01-12 22:33   ` Pascal Bourguignon
  2003-01-13  5:52 ` Janusz S. Bień
  2003-01-16  4:55 ` Rikard Bosnjakovic
  2 siblings, 1 reply; 5+ messages in thread
From: Romain FRANCOISE @ 2003-01-12 19:19 UTC (permalink / raw)


Zimmen Gnauh <yah00204052@yahoo.com> writes:

>    Is there any emacs function that can show a the ascii number of a
> character? i.e. you enter a character, and it shows a number. For
> example, enter character D, it will show 68, or in octal, binary or
> other forms. 

Add this to your ~/.emacs:

(defun zg-char-to-ascii ()
  "Show the ASCII number of a character."
  (interactive)
  (message (number-to-string
            (aref (read-from-minibuffer "Type a character: ") 0))))

... and do M-x zg-char-to-ascii.

Cheers,

-- 
Romain FRANCOISE <romain@orebokech.com> | I know, you love the song but
it's a miracle -- http://orebokech.com/ | not the singer.

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

* Re: how to show ascii number of a character
  2003-01-12 19:19 ` Romain FRANCOISE
@ 2003-01-12 22:33   ` Pascal Bourguignon
  0 siblings, 0 replies; 5+ messages in thread
From: Pascal Bourguignon @ 2003-01-12 22:33 UTC (permalink / raw)


Romain FRANCOISE <romain@orebokech.com> writes:

> Zimmen Gnauh <yah00204052@yahoo.com> writes:
> 
> >    Is there any emacs function that can show a the ascii number of a
> > character? i.e. you enter a character, and it shows a number. For
> > example, enter character D, it will show 68, or in octal, binary or
> > other forms. 
> 
> Add this to your ~/.emacs:
> 
> (defun zg-char-to-ascii ()
>   "Show the ASCII number of a character."
>   (interactive)
>   (message (number-to-string
>             (aref (read-from-minibuffer "Type a character: ") 0))))
> 
> ... and do M-x zg-char-to-ascii.
> 
> Cheers,


(defun show-ascii ()
    (interactive)
    (message "The code of the character at point is: %d" (char-after)))

In emacs, a character is an integer. 

If you  place the  point at  an ASCII character,  you'll get  an ASCII
code, but otherwise, it depends  on the encoding currently used in the
buffer.


-- 
__Pascal_Bourguignon__                   http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie

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

* Re: how to show ascii number of a character
  2003-01-12 18:40 how to show ascii number of a character Zimmen Gnauh
  2003-01-12 19:19 ` Romain FRANCOISE
@ 2003-01-13  5:52 ` Janusz S. Bień
  2003-01-16  4:55 ` Rikard Bosnjakovic
  2 siblings, 0 replies; 5+ messages in thread
From: Janusz S. Bień @ 2003-01-13  5:52 UTC (permalink / raw)
  Cc: help-gnu-emacs

On Sun, 12 Jan 2003  Zimmen Gnauh <yah00204052@yahoo.com> wrote:

>    Is there any emacs function that can show a the ascii number of a
> character? i.e. you enter a character, and it shows a number. For
> example, enter character D, it will show 68, or in octal, binary or
> other forms. 

It is not clear for me what your purpose is, but what about C-u C-x =
?

JSB

-- 
                     ,   
dr hab. Janusz S. Bien, prof. UW
Prof. Janusz S. Bien, Warsaw Uniwersity
http://www.orient.uw.edu.pl/~jsbien/

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

* Re: how to show ascii number of a character
  2003-01-12 18:40 how to show ascii number of a character Zimmen Gnauh
  2003-01-12 19:19 ` Romain FRANCOISE
  2003-01-13  5:52 ` Janusz S. Bień
@ 2003-01-16  4:55 ` Rikard Bosnjakovic
  2 siblings, 0 replies; 5+ messages in thread
From: Rikard Bosnjakovic @ 2003-01-16  4:55 UTC (permalink / raw)


>    Is there any emacs function that can show a the ascii number of a
> character? i.e. you enter a character, and it shows a number. For
> example, enter character D, it will show 68, or in octal, binary or
> other forms. 

Put the cursor on the character and type C-x =


-- 
Friendly,

Rikard

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

end of thread, other threads:[~2003-01-16  4:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-12 18:40 how to show ascii number of a character Zimmen Gnauh
2003-01-12 19:19 ` Romain FRANCOISE
2003-01-12 22:33   ` Pascal Bourguignon
2003-01-13  5:52 ` Janusz S. Bień
2003-01-16  4:55 ` Rikard Bosnjakovic

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.