bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4039: C-x 8 RET with prefix arg doesn't repeat character


From: Juri Linkov
Subject: bug#4039: C-x 8 RET with prefix arg doesn't repeat character
Date: Tue, 04 Aug 2009 22:51:47 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (x86_64-pc-linux-gnu)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]