[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117101: Optimize away some compat-cruft in printing
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] trunk r117101: Optimize away some compat-cruft in printing.el |
Date: |
Wed, 14 May 2014 06:35:51 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117101
revision-id: address@hidden
parent: address@hidden
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2014-05-13 23:35:36 -0700
message:
Optimize away some compat-cruft in printing.el
* lisp/printing.el (subst-char-in-string, make-temp-file, pr-get-symbol):
Optimize on Emacs, which has the relevant functions for ages.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/printing.el
printing.el-20091113204419-o5vbwnq5f7feedwu-2550
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-05-13 20:34:12 +0000
+++ b/lisp/ChangeLog 2014-05-14 06:35:36 +0000
@@ -1,3 +1,8 @@
+2014-05-14 Glenn Morris <address@hidden>
+
+ * printing.el (subst-char-in-string, make-temp-file, pr-get-symbol):
+ Optimize on Emacs, which has the relevant functions for ages.
+
2014-05-13 Stefan Monnier <address@hidden>
* simple.el (undo-make-selective-list): Obey undo-no-redo.
=== modified file 'lisp/printing.el'
--- a/lisp/printing.el 2014-05-12 06:59:30 +0000
+++ b/lisp/printing.el 2014-05-14 06:35:36 +0000
@@ -1038,20 +1038,27 @@
;; To avoid compilation gripes
-(or (fboundp 'subst-char-in-string) ; hacked from subr.el
- (defun subst-char-in-string (fromchar tochar string &optional inplace)
- "Replace FROMCHAR with TOCHAR in STRING each time it occurs.
+;; Emacs has this since at least 21.1.
+(when (featurep 'xemacs)
+ (or (fboundp 'subst-char-in-string) ; hacked from subr.el
+ (defun subst-char-in-string (fromchar tochar string &optional inplace)
+ "Replace FROMCHAR with TOCHAR in STRING each time it occurs.
Unless optional argument INPLACE is non-nil, return a new string."
- (let ((i (length string))
- (newstr (if inplace string (copy-sequence string))))
- (while (> (setq i (1- i)) 0)
- (if (eq (aref newstr i) fromchar)
- (aset newstr i tochar)))
- newstr)))
-
-
-(or (fboundp 'make-temp-file) ; hacked from subr.el
- (defun make-temp-file (prefix &optional dir-flag suffix)
+ (let ((i (length string))
+ (newstr (if inplace string (copy-sequence string))))
+ (while (> (setq i (1- i)) 0)
+ (if (eq (aref newstr i) fromchar)
+ (aset newstr i tochar)))
+ newstr))))
+
+
+;; Emacs has this since at least 21.1, but the SUFFIX argument
+;; (which this file uses) only since 22.1. So the fboundp test
+;; wasn't even correct/adequate. Whatever, no-one is using
+;; this file on older Emacs version, so it's irrelevant.
+(when (featurep 'xemacs)
+ (or (fboundp 'make-temp-file) ; hacked from subr.el
+ (defun make-temp-file (prefix &optional dir-flag suffix)
"Create a temporary file.
The returned file name (created by appending some random characters at the end
of PREFIX, and expanding against `temporary-file-directory' if necessary),
@@ -1086,7 +1093,7 @@
nil)
file)
;; Reset the umask.
- (set-default-file-modes umask)))))
+ (set-default-file-modes umask))))))
(eval-when-compile
@@ -3192,9 +3199,10 @@
(defalias 'pr-get-symbol
- (if (fboundp 'easy-menu-intern) ; hacked from easymenu.el
- 'easy-menu-intern
- (lambda (s) (if (stringp s) (intern s) s))))
+ (if (featurep 'emacs) 'easy-menu-intern ; since 22.1
+ (if (fboundp 'easy-menu-intern) ; hacked from easymenu.el
+ 'easy-menu-intern
+ (lambda (s) (if (stringp s) (intern s) s)))))
(defconst pr-menu-spec
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117101: Optimize away some compat-cruft in printing.el,
Glenn Morris <=