APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1498686095 -3600
# Wed Jun 28 22:41:35 2017 +0100
# Node ID 97140cfdeca785747a13192343cf357ea21a3dc1
# Parent b803128e420963ce405b3ac51c7f9a80183c496b
Move #'char-width to C, implement it in terms of ichar_columns().
src/ChangeLog addition:
2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
* text.c (Fchar_width):
* text.c (syms_of_text):
Move #'char-width to C, to allow it to be implemented in terms of
ichar_columns(), since with unicode-internal (charset-width
(char-charset X)) can now error.
lisp/ChangeLog addition:
2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
* subr.el (char-width): Move this to C, necessary as part of the
unicode-internal support.
diff -r b803128e4209 -r 97140cfdeca7 lisp/ChangeLog
--- a/lisp/ChangeLog Tue May 30 20:30:25 2017 +0100
+++ b/lisp/ChangeLog Wed Jun 28 22:41:35 2017 +0100
@@ -1,3 +1,8 @@
+2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * subr.el (char-width): Move this to C, necessary as part of the
+ unicode-internal support.
+
2017-05-30 Aidan Kehoe <kehoea(a)parhasard.net>
* about.el (about-xemacs):
diff -r b803128e4209 -r 97140cfdeca7 lisp/subr.el
--- a/lisp/subr.el Tue May 30 20:30:25 2017 +0100
+++ b/lisp/subr.el Wed Jun 28 22:41:35 2017 +0100
@@ -1076,10 +1076,6 @@
simply returns the length of the string."
(reduce #'+ (the string string) :initial-value 0 :key #'char-width))
-(defun char-width (character)
- "Return number of columns a CHARACTER occupies when displayed."
- (charset-width (char-charset character)))
-
;; The following several functions are useful in GNU Emacs 20 because
;; of the multibyte "characters" the internal representation of which
;; leaks into Lisp. In XEmacs/Mule they are trivial and unnecessary.
diff -r b803128e4209 -r 97140cfdeca7 src/ChangeLog
--- a/src/ChangeLog Tue May 30 20:30:25 2017 +0100
+++ b/src/ChangeLog Wed Jun 28 22:41:35 2017 +0100
@@ -1,3 +1,11 @@
+2017-06-28 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * text.c (Fchar_width):
+ * text.c (syms_of_text):
+ Move #'char-width to C, to allow it to be implemented in terms of
+ ichar_columns(), since with unicode-internal (charset-width
+ (char-charset X)) can now error.
+
2017-05-30 Aidan Kehoe <kehoea(a)parhasard.net>
* emacs.c (vars_of_emacs):
diff -r b803128e4209 -r 97140cfdeca7 src/text.c
--- a/src/text.c Tue May 30 20:30:25 2017 +0100
+++ b/src/text.c Wed Jun 28 22:41:35 2017 +0100
@@ -5950,6 +5950,17 @@
return list2 (XCHARSET_NAME (charset), make_fixnum (c1));
}
+DEFUN ("char-width", Fchar_width, 1, 1, 0, /*
+Return number of columns a CHARACTER occupies when displayed.
+*/
+ (character))
+{
+ CHECK_CHAR_COERCE_INT (character);
+
+ /* #### Consider having this take a graphical context--a buffer or frame or
+ #### whatever. Ditto with #'string-width. */
+ return make_fixnum (ichar_columns (XCHAR (character)));
+}
/************************************************************************/
/* composite character functions */
@@ -6057,6 +6068,7 @@
DEFSUBR (Fchar_charset);
DEFSUBR (Fchar_octet);
DEFSUBR (Fsplit_char);
+ DEFSUBR (Fchar_width);
/* Qfail, Qsubstitute, Qsucceed in general.c */
DEFSYMBOL (Qsubstitute_negated); /* #### what's this used for? */
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)