emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Juan Manuel Macías" <maciaschain@posteo.net>
To: Marcin Borkowski <mbork@mbork.pl>
Cc: Samuel Wales <samologist@gmail.com>, orgmode <emacs-orgmode@gnu.org>
Subject: Re: [tip/offtopic] A function to describe the characters of a word at point
Date: Fri, 15 Jul 2022 00:56:41 +0000	[thread overview]
Message-ID: <87o7xrdwhi.fsf@posteo.net> (raw)
In-Reply-To: <87edyn4sal.fsf@mbork.pl> (Marcin Borkowski's message of "Thu, 14 Jul 2022 17:42:08 +0200")

Hi, Marcin and Samuel, thanks for your comments,

Marcin Borkowski writes:

> You might want to extend it and create a minor mode which would display
> data about the current character in the echo area, Eldoc-style, or in
> a tooltip when you hover the mouse pointer over a character.  Depending
> on what exactly you need, these ideas might be more or less useful, of
> course.

I also have written a smaller function to display a quick information of
a single character at point, something much simpler and not as verbose
as describe-char. But it had never occurred to me to do something
eldoc-like with it. In my case, although for those contexts I prefer
quick information (describe-char also has its relaxing moment), I don't
feel such an urgency :-).

In any case, something quick and dirty, just as a proof of concept,
could be this:

(define-minor-mode char-info-at-point-mode
  "TODO"
  :init-value nil
  :lighter ("chinfo")
  (if char-info-at-point-mode
      (add-hook 'post-command-hook #'char-name-at-point nil t)    
    (remove-hook 'post-command-hook #'char-name-at-point 'local)))

(defun char-name-at-point ()
  (interactive)
  (let* ((char-name (get-char-code-property (char-after (point)) 'name))
	 (code (format "#%x" (char-after (point))))
	 (dec (get-char-code-property (char-after (point)) 'decomposition))
	 (info (concat
		char-name
		" / "
		code
		" / descomp: "
		dec
		"\s"
		(mapconcat (lambda (cod)
			     (format "#%x" cod))
			   dec "\s+\s"))))
    (message info)))

Best regards,

Juan Manuel 


      parent reply	other threads:[~2022-07-15  0:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 10:49 [tip/offtopic] A function to describe the characters of a word at point Juan Manuel Macías
2022-07-14 15:42 ` Marcin Borkowski
2022-07-14 22:30   ` Samuel Wales
2022-07-15  0:56   ` Juan Manuel Macías [this message]

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87o7xrdwhi.fsf@posteo.net \
    --to=maciaschain@posteo.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=mbork@mbork.pl \
    --cc=samologist@gmail.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).