unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: jsbien@mimuw.edu.pl (Janusz S. Bień)
To: Eli Zaretskii <eliz@gnu.org>
Cc: 32599@debbugs.gnu.org
Subject: bug#32599: 25.2; Feature request: input PUA characters by name
Date: Wed, 30 Dec 2020 18:49:26 +0100	[thread overview]
Message-ID: <87o8ibchg9.fsf@mimuw.edu.pl> (raw)
In-Reply-To: <86k1ebdtn9.fsf@mimuw.edu.pl> ("Janusz S. \=\?utf-8\?Q\?Bie\=C5\=84\?\= \=\?utf-8\?Q\?\=22's\?\= message of "Tue, 28 May 2019 07:39:54 +0200")


Let me to approach the problem from another angle.

Input of Unicode characters by name is done by "insert-char" defined in
editfns.c. The code is quite short:

--8<---------------cut here---------------start------------->8---
DEFUN ("insert-char", Finsert_char, Sinsert_char, 1, 3,
       "(list (read-char-by-name \"Insert character (Unicode name or hex): \")\
              (prefix-numeric-value current-prefix-arg)\
              t))",
       doc: /* Insert COUNT copies of CHARACTER.
Interactively, prompt for CHARACTER.  You can specify CHARACTER in one
of these ways:

 - As its Unicode character name, e.g. \"LATIN SMALL LETTER A\".
   Completion is available; if you type a substring of the name
   preceded by an asterisk `*', Emacs shows all names which include
   that substring, not necessarily at the beginning of the name.

[...]


The optional third argument INHERIT, if non-nil, says to inherit text
properties from adjoining text, if those properties are sticky.  If
called interactively, INHERIT is t.  */)
  (Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
{
  int i, stringlen;
  register ptrdiff_t n;
  int c, len;
  unsigned char str[MAX_MULTIBYTE_LENGTH];
  char string[4000];

  CHECK_CHARACTER (character);
  if (NILP (count))
    XSETFASTINT (count, 1);
  else
    CHECK_FIXNUM (count);
  c = XFIXNAT (character);

  if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
    len = CHAR_STRING (c, str);
  else
    str[0] = c, len = 1;
  if (XFIXNUM (count) <= 0)
    return Qnil;
  if (BUF_BYTES_MAX / len < XFIXNUM (count))
    buffer_overflow ();
  n = XFIXNUM (count) * len;
  stringlen = min (n, sizeof string - sizeof string % len);
  for (i = 0; i < stringlen; i++)
    string[i] = str[i % len];
  while (n > stringlen)
    {
      maybe_quit ();
      if (!NILP (inherit))
	insert_and_inherit (string, stringlen);
      else
	insert (string, stringlen);
      n -= stringlen;
    }
  if (!NILP (inherit))
    insert_and_inherit (string, n);
  else
    insert (string, n);
  return Qnil;
}
--8<---------------cut here---------------end--------------->8---

Which part of the code is responsible for prompting, name input and
consulting the character names list?

Best regards

Janusz

-- 
             ,   
Janusz S. Bien
emeryt (emeritus)
https://sites.google.com/view/jsbien





  reply	other threads:[~2020-12-30 17:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <86sh30fg4q.fsf@mimuw.edu.pl>
2018-08-31  6:05 ` bug#32599: 25.2; Feature request: input PUA characters by name Janusz S. Bień
2018-08-31  8:05   ` Robert Pluim
2018-08-31  9:09     ` Janusz S. Bień
2018-08-31 12:34       ` Robert Pluim
2018-08-31 12:54         ` Janusz S. Bień
2019-05-26  8:10           ` Janusz S. Bień
2019-05-26 14:45             ` Eli Zaretskii
2019-05-26 15:18               ` Janusz S. Bień
2019-05-26 15:48                 ` Janusz S. Bień
2019-05-26 16:51                   ` Eli Zaretskii
2019-05-26 16:56                 ` Eli Zaretskii
2019-05-26 17:33                   ` Janusz S. Bień
2019-05-26 18:52                     ` Eli Zaretskii
2019-05-27  5:48                       ` Janusz S. Bień
2019-05-27 17:11                         ` Eli Zaretskii
2019-05-27 17:39                           ` Janusz S. Bień
2019-05-27 18:45                             ` Eli Zaretskii
2019-05-28  5:18                               ` Janusz S. Bień
2019-05-28  5:34                                 ` Eli Zaretskii
2019-05-28  5:39                                   ` Janusz S. Bień
2020-12-30 17:49                                     ` Janusz S. Bień [this message]
2020-12-30 20:52                                       ` Eli Zaretskii
2020-12-31  6:39                                         ` Janusz S. Bień
2020-12-31  7:49                                           ` Eli Zaretskii
2020-12-31  8:14                                             ` Janusz S. Bień
2020-12-31  9:06                                               ` Eli Zaretskii
2020-12-31  9:31                                                 ` Janusz S. Bień
2020-12-31 10:31                                                   ` Eli Zaretskii
2022-04-26 13:09       ` Lars Ingebrigtsen
2022-04-26 13:30         ` Janusz S. Bień
2022-04-26 13:37           ` Lars Ingebrigtsen
2022-04-26 13:44             ` Janusz S. Bień
2022-04-26 13:45               ` Lars Ingebrigtsen
2022-04-26 15:33                 ` Janusz S. Bień
2022-04-26 15:49                   ` Robert Pluim
2022-04-26 16:09                     ` Janusz S. Bień
2022-04-26 16:44                       ` Eli Zaretskii
2022-04-26 18:22                         ` Janusz S. Bień
2022-04-27 11:51                   ` Lars Ingebrigtsen

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=87o8ibchg9.fsf@mimuw.edu.pl \
    --to=jsbien@mimuw.edu.pl \
    --cc=32599@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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.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).