unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Find all the name and alias corresponding to a codepoint in Emacs.
Date: Sat, 12 Mar 2022 05:00:45 +0100	[thread overview]
Message-ID: <87pmmrn7ki.fsf@zoho.eu> (raw)
In-Reply-To: CAGP6POLRS4BK4Dz9O7p_3mUiKLB8yPkNbp86ON0BmrNHKUGYEA@mail.gmail.com

Hongyi Zhao wrote:

> Say, for back-tick or grave accent ( ` ) symbol, I want to
> let Emacs give me all of its name and alias, but the `M-x
> describe-char ` can only give the following information:
>
>   name: GRAVE ACCENT
>   old-name: SPACING GRAVE

I'd say use `backquote' in Lisp settings (indeed, even an
Elisp function) ... for everything else, use the (new) name.

> So, I want to know if it's possible to find all the name and
> alias corresponding to a codepoint in Emacs.

Uhm, what other aliases would that be? And if any, where are
they stored in Emacs?

BTW, check this out:

;; -*- 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 (old: %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 "%s (at point: %d)" msg-dc position) ))))))

;; (what-char)                  ; "space"
;; (what-char 754)              ; "right parenthesis (old: closing parenthesis)"
;; C-u 754 M-x what-char RET    ; same, but also killed
;; C-u M-x what-char RET* (C-y) ; asterisk is yanked
;; M-x what-char RET            ; line feed (lf) (at point: 1034)


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




  reply	other threads:[~2022-03-12  4:00 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-12  2:54 Find all the name and alias corresponding to a codepoint in Emacs Hongyi Zhao
2022-03-12  4:00 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2022-03-12  6:30 ` Eli Zaretskii
2022-03-12  8:43   ` Hongyi Zhao
2022-03-12  8:55     ` Hongyi Zhao
2022-03-12  9:35       ` Eli Zaretskii
2022-03-12 11:20         ` Hongyi Zhao
2022-03-12 11:40           ` Eli Zaretskii
2022-03-12 11:57             ` Hongyi Zhao
2022-03-20 16:01             ` Felix Dietrich
2022-03-20 16:55               ` tomas
2022-03-21  1:12               ` Hongyi Zhao
2022-03-21  1:33                 ` Emanuel Berg via Users list for the GNU Emacs text editor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmmrn7ki.fsf@zoho.eu \
    --to=help-gnu-emacs@gnu.org \
    --cc=moasenwood@zoho.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).