unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: emacs-pretest-bug@gnu.org
Subject: bug#4039: C-x 8 RET with prefix arg doesn't repeat character
Date: Tue, 04 Aug 2009 22:51:47 +0300	[thread overview]
Message-ID: <87prbbfjcc.fsf@mail.jurta.org> (raw)

Typing

  C-u 5 C-x 8 ' a

is supposed to insert 5 characters of á in a row
(modulo the reported bug#4037).

However, typing

  C-u 5 C-x 8 RET E1 RET

inserts just 1 character (`E1' is the code point of á).

I propose to fix `ucs-insert' to accept the same arguments
as `insert-char', i.e. `character', `count' and `inherit':

Index: lisp/international/mule-cmds.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/international/mule-cmds.el,v
retrieving revision 1.362
diff -c -r1.362 mule-cmds.el
*** lisp/international/mule-cmds.el	15 Jul 2009 12:28:09 -0000	1.362
--- lisp/international/mule-cmds.el	4 Aug 2009 19:50:42 -0000
***************
*** 2941,2959 ****
       (t
        (cdr (assoc-string input (ucs-names) t))))))
  
! (defun ucs-insert (arg)
!   "Insert a character of the given Unicode code point.
  Interactively, prompts for a Unicode character name or a hex number
! using `read-char-by-name'."
!   (interactive (list (read-char-by-name "Unicode (name or hex): ")))
!   (if (stringp arg)
!       (setq arg (string-to-number arg 16)))
    (cond
!    ((not (integerp arg))
!     (error "Not a Unicode character code: %S" arg))
!    ((or (< arg 0) (> arg #x10FFFF))
!     (error "Not a Unicode character code: 0x%X" arg)))
!   (insert-and-inherit arg))
  
  (define-key ctl-x-map "8\r" 'ucs-insert)
  
--- 2941,2968 ----
       (t
        (cdr (assoc-string input (ucs-names) t))))))
  
! (defun ucs-insert (character &optional count inherit)
!   "Insert COUNT copies of CHARACTER of the given Unicode code point.
  Interactively, prompts for a Unicode character name or a hex number
! using `read-char-by-name'.
! The optional third arg INHERIT (non-nil when called interactively),
! says to inherit text properties from adjoining text, if those
! properties are sticky."
!   (interactive
!    (list (read-char-by-name "Unicode (name or hex): ")
! 	 (prefix-numeric-value current-prefix-arg)
! 	 t))
!   (unless count (setq count 1))
!   (if (stringp character)
!       (setq character (string-to-number character 16)))
    (cond
!    ((not (integerp character))
!     (error "Not a Unicode character code: %S" character))
!    ((or (< character 0) (> character #x10FFFF))
!     (error "Not a Unicode character code: 0x%X" character)))
!   (if inherit
!       (dotimes (i count) (insert-and-inherit character))
!     (dotimes (i count) (insert character))))
  
  (define-key ctl-x-map "8\r" 'ucs-insert)

-- 
Juri Linkov
http://www.jurta.org/emacs/





             reply	other threads:[~2009-08-04 19:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87d470lq21.fsf@mail.jurta.org>
2009-08-04 19:51 ` Juri Linkov [this message]
2009-08-12 20:50   ` bug#4039: marked as done (C-x 8 RET with prefix arg doesn't repeat character) Emacs bug Tracking System

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=87prbbfjcc.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=4039@emacsbugs.donarmstrong.com \
    --cc=emacs-pretest-bug@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).