From: Katsumi Yamaoka Date: Thu, 14 May 2015 04:38:28 +0000 (+0000) Subject: format-spec.el: Work for XEmacs X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=commitdiff_plain;h=af97f404faa7a7276ab61e97ca203cc373cc6014 format-spec.el: Work for XEmacs (format-spec, format-spec-make): Use (char-to-int c) instead of (+ c 0) that the byte compiler optimizes into just c. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3bb64645e..0d5d32d64 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2015-05-14 Katsumi Yamaoka + + * format-spec.el (format-spec, format-spec-make): Work for XEmacs. + Use (char-to-int c) instead of (+ c 0) that the byte compiler optimizes + into just c. + 2015-05-11 Katsumi Yamaoka * format-spec.el (format-spec, format-spec-make): Work for XEmacs. diff --git a/lisp/format-spec.el b/lisp/format-spec.el index a27539382..bf096bf7f 100644 --- a/lisp/format-spec.el +++ b/lisp/format-spec.el @@ -43,7 +43,9 @@ the text that it generates." ;; Valid format spec. ((looking-at "\\([-0-9.]*\\)\\([a-zA-Z]\\)") (let* ((num (match-string 1)) - (spec (+ (string-to-char (match-string 2)) 0)) + (spec (if (featurep 'xemacs) + (char-to-int (string-to-char (match-string 2))) + (string-to-char (match-string 2)))) (val (assq spec specification))) (unless val (error "Invalid format character: `%%%c'" spec)) @@ -70,7 +72,13 @@ starting with a character." (while pairs (unless (cdr pairs) (error "Invalid list of pairs")) - (push (cons (+ (car pairs) 0) (cadr pairs)) alist) + (push (cons (if (featurep 'xemacs) + (if (characterp (car pairs)) + (char-to-int (car pairs)) + (car pairs)) + (car pairs)) + (cadr pairs)) + alist) (setq pairs (cddr pairs))) (nreverse alist)))