2012-12-21 Chong Yidong <cyd@gnu.org>
+ * international/mule-cmds.el (read-char-by-name): Signal an error
+ if the user does not supply a valid character (Bug#13177).
+
* simple.el (transpose-subr-1): Preserve marker positions by
changing the insertion sequence (Bug#13122).
(let ((completion-ignore-case t))
(if (eq action 'metadata)
'(metadata (category . unicode-name))
- (complete-with-action action (ucs-names) string pred)))))))
- (cond
- ((string-match-p "\\`[0-9a-fA-F]+\\'" input)
- (string-to-number input 16))
- ((string-match-p "\\`#" input)
- (read input))
- (t
- (cdr (assoc-string input (ucs-names) t))))))
+ (complete-with-action action (ucs-names) string pred))))))
+ (char
+ (cond
+ ((string-match-p "\\`[0-9a-fA-F]+\\'" input)
+ (string-to-number input 16))
+ ((string-match-p "\\`#" input)
+ (read input))
+ (t
+ (cdr (assoc-string input (ucs-names) t))))))
+ (unless (characterp char)
+ (error "Invalid character"))
+ char))
(define-obsolete-function-alias 'ucs-insert 'insert-char "24.3")
(define-key ctl-x-map "8\r" 'insert-char)
+2012-12-21 Chong Yidong <cyd@gnu.org>
+
+ * editfns.c (Finsert_char): Since read-char-by-name now signals an
+ error for invalid chars, don't check for a nil return value.
+
2012-12-20 Dmitry Antipov <dmantipov@yandex.ru>
Avoid calls to CHAR_TO_BYTE if byte position is known.
}
\f
DEFUN ("insert-char", Finsert_char, Sinsert_char, 1, 3,
- "(list (or (read-char-by-name \"Insert character (Unicode name or hex): \")\
- (error \"You did not specify a valid character\"))\
- (prefix-numeric-value current-prefix-arg)\
- t))",
+ "(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: