unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* what-char
@ 2022-02-05  8:13 Emanuel Berg via Users list for the GNU Emacs text editor
  2022-02-05  8:37 ` what-char Emanuel Berg via Users list for the GNU Emacs text editor
  2022-02-05 17:24 ` [External] : what-char Drew Adams
  0 siblings, 2 replies; 4+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-05  8:13 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-devel

New interesting code from uXu!

Have the echo area display the name and old-name (if
available) of the char at point.

Watch out for the argument pos! From Lisp, it means
position. Interactively, it means don't just echo, also kill
the data. But even from Lisp it can be omitted, and point
is used ...

If used interactively, the point number is also echoed, but
not returned or killed.

Tricky? Have no fear - "I" is here.

;; -*- lexical-binding: t -*-
;;
;; this file:
;;   https://dataswamp.org/~incal/emacs-init/char.el

(defun what-char (&optional pos)
  (interactive "P")
  (let*((position (or (and (numberp pos) pos)
                      (point) ))
        (kill pos)
        (char (char-after position)) )
    (when char
      (let*((name     (get-char-code-property char 'name))
            (old-name (get-char-code-property char 'old-name))
            (msg (if (and name old-name)
                     (format "%s (%s)" name old-name)
                   (or name old-name) ))
            (msg-dc (when (stringp msg) (downcase msg))) )
        (when msg-dc
          (prog1 msg-dc
            (when kill (kill-new msg-dc))
            (message "%d: %s" position msg-dc) ))))))

;; (what-char)                     ; "space"
;; (what-char (point-min))         ; "semicolon"
;; (what-char 692)                 ; "left parenthesis (opening parenthesis)"
;; C-u M-x what-char RET* then C-y ; asterisk is inserted
;; M-x what-char RET               ; 1016: line feed (lf)

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: what-char
  2022-02-05  8:13 what-char Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-05  8:37 ` Emanuel Berg via Users list for the GNU Emacs text editor
  2022-02-05 17:24 ` [External] : what-char Drew Adams
  1 sibling, 0 replies; 4+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-02-05  8:37 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: emacs-devel

Indeed, there are _five_ ways to invoke that function:

;; (what-char)                     ; "space"
;; (what-char 692)                 ; "left parenthesis (opening parenthesis)"
;; C-u 692 M-x what-char RET       ; same, but also killed
;; C-u M-x what-char RET* then C-y ; asterisk is yanked
;; M-x what-char RET               ; 1028: line feed (lf)

Straight Mona Lispa!

-- 
underground experts united
https://dataswamp.org/~incal




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

* RE: [External] : what-char
  2022-02-05  8:13 what-char Emanuel Berg via Users list for the GNU Emacs text editor
  2022-02-05  8:37 ` what-char Emanuel Berg via Users list for the GNU Emacs text editor
@ 2022-02-05 17:24 ` Drew Adams
  2022-02-06  4:16   ` Richard Stallman
  1 sibling, 1 reply; 4+ messages in thread
From: Drew Adams @ 2022-02-05 17:24 UTC (permalink / raw)
  To: Emanuel Berg
  Cc: 'Help-Gnu-Emacs (help-gnu-emacs@gnu.org)',
	emacs-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 497 bytes --]

> Have the echo area display the name and old-name
> (if available) of the char at point.

Or see the char and its Unicode code point it in the
mode-line, always (in a single buffer or in all).

* Click mouse-1 there to see the full *Help* (what
  `describe-char' shows).

* Click mouse-2 there to set the secondary selection
  to the char.

* Click mouse-3 there to show the char enlarged in
  a tooltip (:height 400).

https://www.emacswiki.org/emacs/ModeLineCharacterInfo




[-- Attachment #2: winmail.dat --]
[-- Type: application/ms-tnef, Size: 13495 bytes --]

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

* Re: [External] : what-char
  2022-02-05 17:24 ` [External] : what-char Drew Adams
@ 2022-02-06  4:16   ` Richard Stallman
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Stallman @ 2022-02-06  4:16 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs, moasenwood, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

Could you please post a full self-contained description of the change
you're proposing?

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)





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

end of thread, other threads:[~2022-02-06  4:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-05  8:13 what-char Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-05  8:37 ` what-char Emanuel Berg via Users list for the GNU Emacs text editor
2022-02-05 17:24 ` [External] : what-char Drew Adams
2022-02-06  4:16   ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

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