Mercurial > hg > xemacs-beta
changeset 5882:bbe4146603db
Reduce regexp usage, now CL-oriented non-regexp code available, core Lisp
lisp/ChangeLog addition:
2015-04-01 Aidan Kehoe <kehoea@parhasard.net>
When calling #'string-match with a REGEXP without regular
expression special characters, call #'search, #'mismatch, #'find,
etc. instead, making our code less likely to side-effect other
functions' match data and a little faster.
* apropos.el (apropos-command):
* apropos.el (apropos):
Call (position ?\n ...) rather than (string-match "\n" ...) here.
* buff-menu.el:
* buff-menu.el (buffers-menu-omit-invisible-buffers):
Don't fire up the regexp engine just to check if a string starts
with a space.
* buff-menu.el (select-buffers-tab-buffers-by-mode):
Don't fire up the regexp engine just to compare mode basenames.
* buff-menu.el (format-buffers-tab-line):
* buff-menu.el (build-buffers-tab-internal): Moved to being a
label within the following.
* buff-menu.el (buffers-tab-items): Use the label.
* bytecomp.el (byte-compile-log-1):
Don't fire up the regexp engine just to look for a newline.
* cus-edit.el (get):
Ditto.
* cus-edit.el (custom-variable-value-create):
Ditto, but for a colon.
* descr-text.el (describe-text-sexp):
Ditto.
* descr-text.el (describe-char-unicode-data):
Use #'split-string-by-char given that we're just looking for a
semicolon.
* descr-text.el (describe-char):
Don't fire up the regexp engine just to look for a newline.
* disass.el (disassemble-internal):
Ditto.
* files.el (file-name-sans-extension):
Implement this using #'position.
* files.el (file-name-extension):
Correct this function's docstring, implement it in terms of
#'position.
* files.el (insert-directory):
Don't fire up the regexp engine to split a string by space; don't
reverse the list of switches, this is actually a longstand bug as
far as I can see.
* gnuserv.el (gnuserv-process-filter):
Use #'position here, instead of consing inside #'split-string
needlessly.
* gtk-file-dialog.el (gtk-file-dialog-update-dropdown):
Use #'split-string-by-char here, don't fire up #'split-string for
directory-sep-char.
* gtk-font-menu.el (hack-font-truename):
Implement this more cheaply in terms of #'find,
#'split-string-by-char, #'equal, rather than #'string-match,
#'split-string, #'string-equal.
* hyper-apropos.el (hyper-apropos-grok-functions):
* hyper-apropos.el (hyper-apropos-grok-variables):
Look for a newline using #'position rather than #'string-match in
these functions.
* info.el (Info-insert-dir):
* info.el (Info-insert-file-contents):
* info.el (Info-follow-reference):
* info.el (Info-extract-menu-node-name):
* info.el (Info-menu):
Look for fixed strings using #'position or #'search as appropriate
in this file.
* ldap.el (ldap-decode-string):
* ldap.el (ldap-encode-string):
#'encode-coding-string, #'decode-coding-string are always
available, don't check if they're fboundp.
* ldap.el (ldap-decode-address):
* ldap.el (ldap-encode-address):
Use #'split-string-by-char in these functions.
* lisp-mnt.el (lm-creation-date):
* lisp-mnt.el (lm-last-modified-date):
Don't fire up the regexp engine just to look for spaces in this file.
* menubar-items.el (default-menubar):
Use (not (mismatch ...)) rather than #'string-match here, for
simple regexp.
Use (search "beta" ...) rather than (string-match "beta" ...)
* menubar-items.el (sort-buffers-menu-alphabetically):
* menubar-items.el (sort-buffers-menu-by-mode-then-alphabetically):
* menubar-items.el (group-buffers-menu-by-mode-then-alphabetically):
Don't fire up the regexp engine to check if a string starts with
a space or an asterisk.
Use the more fine-grained results of #'compare-strings; compare
case-insensitively for the buffer menu.
* menubar-items.el (list-all-buffers):
* menubar-items.el (tutorials-menu-filter):
Use #'equal rather than #'string-equal, which, in this context,
has the drawback of not having a bytecode, and no redeeming
features.
* minibuf.el:
* minibuf.el (un-substitute-in-file-name):
Use #'count, rather than counting the occurences of $ using the
regexp engine.
* minibuf.el (read-file-name-internal-1):
Don't fire up the regexp engine to search for ?=.
* mouse.el (mouse-eval-sexp):
Check for newline with #'find.
* msw-font-menu.el (mswindows-reset-device-font-menus):
Split a string by newline with #'split-string-by-char.
* mule/japanese.el:
* mule/japanese.el ("Japanese"):
Use #'search rather than #'string-match; canoncase before
comparing; fix a bug I had introduced where I had been making case
insensitive comparisons where the case mattered.
* mule/korea-util.el (default-korean-keyboard):
Look for ?3 using #'find, not #'string-march.
* mule/korea-util.el (quail-hangul-switch-hanja):
Search for a fixed string using #'search.
* mule/mule-cmds.el (set-locale-for-language-environment):
#'position, #'substitute rather than #'string-match,
#'replace-in-string.
* newcomment.el (comment-make-extra-lines):
Use #'search rather than #'string-match for a simple string.
* package-get.el (package-get-remote-filename):
Use #'position when looking for ?@
* process.el (setenv):
* process.el (read-envvar-name):
Use #'position when looking for ?=.
* replace.el (map-query-replace-regexp):
Use #'split-string-by-char instead of using an inline
implementation of it.
* select.el (select-convert-from-cf-text):
* select.el (select-convert-from-cf-unicodetext):
Use #'position rather than #'string-match in these functions.
* setup-paths.el (paths-emacs-data-root-p):
Use #'search when looking for simple string.
* sound.el (load-sound-file):
Use #'split-string-by-char rather than an inline reimplementation
of same.
* startup.el (splash-screen-window-body):
* startup.el (splash-screen-tty-body):
Search for simple strings using #'search.
* version.el (emacs-version):
Ditto.
* x-font-menu.el (hack-font-truename):
Implement this more cheaply in terms of #'find,
#'split-string-by-char, #'equal, rather than #'string-match,
#'split-string, #'string-equal.
* x-font-menu.el (x-reset-device-font-menus-core):
Use #'split-string-by-char here.
* x-init.el (x-initialize-keyboard):
Search for a simple string using #'search.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Wed, 01 Apr 2015 14:28:20 +0100 |
parents | 31dd275fa683 |
children | d93195c2c906 |
files | lisp/ChangeLog lisp/apropos.el lisp/buff-menu.el lisp/bytecomp.el lisp/cus-edit.el lisp/descr-text.el lisp/disass.el lisp/files.el lisp/gnuserv.el lisp/gtk-file-dialog.el lisp/gtk-font-menu.el lisp/hyper-apropos.el lisp/info.el lisp/ldap.el lisp/lisp-mnt.el lisp/menubar-items.el lisp/minibuf.el lisp/mouse.el lisp/msw-font-menu.el lisp/mule/japanese.el lisp/mule/korea-util.el lisp/mule/mule-cmds.el lisp/newcomment.el lisp/package-get.el lisp/process.el lisp/replace.el lisp/select.el lisp/setup-paths.el lisp/sound.el lisp/startup.el lisp/version.el lisp/x-font-menu.el lisp/x-init.el |
diffstat | 33 files changed, 403 insertions(+), 289 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/ChangeLog Wed Apr 01 14:28:20 2015 +0100 @@ -1,3 +1,148 @@ +2015-04-01 Aidan Kehoe <kehoea@parhasard.net> + + When calling #'string-match with a REGEXP without regular + expression special characters, call #'search, #'mismatch, #'find, + etc. instead, making our code less likely to side-effect other + functions' match data and a little faster. + + * apropos.el (apropos-command): + * apropos.el (apropos): + Call (position ?\n ...) rather than (string-match "\n" ...) here. + * buff-menu.el: + * buff-menu.el (buffers-menu-omit-invisible-buffers): + Don't fire up the regexp engine just to check if a string starts + with a space. + * buff-menu.el (select-buffers-tab-buffers-by-mode): + Don't fire up the regexp engine just to compare mode basenames. + * buff-menu.el (format-buffers-tab-line): + * buff-menu.el (build-buffers-tab-internal): Moved to being a + label within the following. + * buff-menu.el (buffers-tab-items): Use the label. + * bytecomp.el (byte-compile-log-1): + Don't fire up the regexp engine just to look for a newline. + * cus-edit.el (get): + Ditto. + * cus-edit.el (custom-variable-value-create): + Ditto, but for a colon. + * descr-text.el (describe-text-sexp): + Ditto. + * descr-text.el (describe-char-unicode-data): + Use #'split-string-by-char given that we're just looking for a + semicolon. + * descr-text.el (describe-char): + Don't fire up the regexp engine just to look for a newline. + * disass.el (disassemble-internal): + Ditto. + * files.el (file-name-sans-extension): + Implement this using #'position. + * files.el (file-name-extension): + Correct this function's docstring, implement it in terms of + #'position. + * files.el (insert-directory): + Don't fire up the regexp engine to split a string by space; don't + reverse the list of switches, this is actually a longstand bug as + far as I can see. + * gnuserv.el (gnuserv-process-filter): + Use #'position here, instead of consing inside #'split-string + needlessly. + * gtk-file-dialog.el (gtk-file-dialog-update-dropdown): + Use #'split-string-by-char here, don't fire up #'split-string for + directory-sep-char. + * gtk-font-menu.el (hack-font-truename): + Implement this more cheaply in terms of #'find, + #'split-string-by-char, #'equal, rather than #'string-match, + #'split-string, #'string-equal. + * hyper-apropos.el (hyper-apropos-grok-functions): + * hyper-apropos.el (hyper-apropos-grok-variables): + Look for a newline using #'position rather than #'string-match in + these functions. + * info.el (Info-insert-dir): + * info.el (Info-insert-file-contents): + * info.el (Info-follow-reference): + * info.el (Info-extract-menu-node-name): + * info.el (Info-menu): + Look for fixed strings using #'position or #'search as appropriate + in this file. + * ldap.el (ldap-decode-string): + * ldap.el (ldap-encode-string): + #'encode-coding-string, #'decode-coding-string are always + available, don't check if they're fboundp. + * ldap.el (ldap-decode-address): + * ldap.el (ldap-encode-address): + Use #'split-string-by-char in these functions. + * lisp-mnt.el (lm-creation-date): + * lisp-mnt.el (lm-last-modified-date): + Don't fire up the regexp engine just to look for spaces in this file. + * menubar-items.el (default-menubar): + Use (not (mismatch ...)) rather than #'string-match here, for + simple regexp. + Use (search "beta" ...) rather than (string-match "beta" ...) + * menubar-items.el (sort-buffers-menu-alphabetically): + * menubar-items.el (sort-buffers-menu-by-mode-then-alphabetically): + * menubar-items.el (group-buffers-menu-by-mode-then-alphabetically): + Don't fire up the regexp engine to check if a string starts with + a space or an asterisk. + Use the more fine-grained results of #'compare-strings; compare + case-insensitively for the buffer menu. + * menubar-items.el (list-all-buffers): + * menubar-items.el (tutorials-menu-filter): + Use #'equal rather than #'string-equal, which, in this context, + has the drawback of not having a bytecode, and no redeeming + features. + * minibuf.el: + * minibuf.el (un-substitute-in-file-name): + Use #'count, rather than counting the occurences of $ using the + regexp engine. + * minibuf.el (read-file-name-internal-1): + Don't fire up the regexp engine to search for ?=. + * mouse.el (mouse-eval-sexp): + Check for newline with #'find. + * msw-font-menu.el (mswindows-reset-device-font-menus): + Split a string by newline with #'split-string-by-char. + * mule/japanese.el: + * mule/japanese.el ("Japanese"): + Use #'search rather than #'string-match; canoncase before + comparing; fix a bug I had introduced where I had been making case + insensitive comparisons where the case mattered. + * mule/korea-util.el (default-korean-keyboard): + Look for ?3 using #'find, not #'string-march. + * mule/korea-util.el (quail-hangul-switch-hanja): + Search for a fixed string using #'search. + * mule/mule-cmds.el (set-locale-for-language-environment): + #'position, #'substitute rather than #'string-match, + #'replace-in-string. + * newcomment.el (comment-make-extra-lines): + Use #'search rather than #'string-match for a simple string. + * package-get.el (package-get-remote-filename): + Use #'position when looking for ?@ + * process.el (setenv): + * process.el (read-envvar-name): + Use #'position when looking for ?=. + * replace.el (map-query-replace-regexp): + Use #'split-string-by-char instead of using an inline + implementation of it. + * select.el (select-convert-from-cf-text): + * select.el (select-convert-from-cf-unicodetext): + Use #'position rather than #'string-match in these functions. + * setup-paths.el (paths-emacs-data-root-p): + Use #'search when looking for simple string. + * sound.el (load-sound-file): + Use #'split-string-by-char rather than an inline reimplementation + of same. + * startup.el (splash-screen-window-body): + * startup.el (splash-screen-tty-body): + Search for simple strings using #'search. + * version.el (emacs-version): + Ditto. + * x-font-menu.el (hack-font-truename): + Implement this more cheaply in terms of #'find, + #'split-string-by-char, #'equal, rather than #'string-match, + #'split-string, #'string-equal. + * x-font-menu.el (x-reset-device-font-menus-core): + Use #'split-string-by-char here. + * x-init.el (x-initialize-keyboard): + Search for a simple string using #'search. + 2015-03-16 Aidan Kehoe <kehoea@parhasard.net> * tty-init.el (make-frame-after-init-entry-point):
--- a/lisp/apropos.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/apropos.el Wed Apr 01 14:28:20 2015 +0100 @@ -177,7 +177,7 @@ (documentation symbol t) (void-function "(aliased to undefined function)") (error "(unexpected error from `documention')")))) - (substring doc 0 (string-match "\n" doc)) + (subseq doc 0 (position ?\n doc)) "(not documented)")) (and do-all (user-variable-p symbol) @@ -188,8 +188,7 @@ (variable-obsoleteness-doc symbol) (documentation-property symbol 'variable-documentation t))) - (substring doc 0 - (string-match "\n" doc)))))) + (subseq doc 0 (position ?\n doc)))))) (setq p (cdr p))))) nil)) @@ -230,7 +229,7 @@ (documentation symbol t) (void-function "(aliased to undefined function)") (error "(unexpected error from `documention')")))) - (substring doc 0 (string-match "\n" doc)) + (subseq doc 0 (position ?\n doc)) "(not documented)")) (if (boundp symbol) (if (setq doc @@ -240,8 +239,7 @@ (variable-obsoleteness-doc symbol) (documentation-property symbol 'variable-documentation t))) - (substring doc 0 - (string-match "\n" doc)) + (subseq doc 0 (position ?\n doc)) "(not documented)")) (if (setq doc (symbol-plist symbol)) (if (eq (/ (length doc) 2) 1) @@ -250,19 +248,16 @@ (if (get symbol 'widget-type) (if (setq doc (documentation-property symbol 'widget-documentation t)) - (substring doc 0 - (string-match "\n" doc)) + (subseq doc 0 (position ?\n doc)) "(not documented)")) (if (find-face symbol) (if (setq doc (face-doc-string symbol)) - (substring doc 0 - (string-match "\n" doc)) + (subseq doc 0 (position ?\n doc)) "(not documented)")) (when (get symbol 'custom-group) (if (setq doc (documentation-property symbol 'group-documentation t)) - (substring doc 0 - (string-match "\n" doc)) + (subseq doc 0 (position ?\n doc)) "(not documented)")))) (setq p (cdr p))))) nil))
--- a/lisp/buff-menu.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/buff-menu.el Wed Apr 01 14:28:20 2015 +0100 @@ -649,10 +649,10 @@ files-only)) buffer)) -(defun buffers-menu-omit-invisible-buffers (buf) +(defun buffers-menu-omit-invisible-buffers (buffer) "For use as a value of `buffers-menu-omit-function'. Omits normally invisible buffers (those whose name begins with a space)." - (not (null (string-match "\\` " (buffer-name buf))))) + (eql ?\ (elt (buffer-name buffer) 0))) ;;; The Buffers tab @@ -788,14 +788,14 @@ (mode2 (symbol-name (symbol-value-in-buffer 'major-mode buffer-to-select))) (modenm1 (symbol-value-in-buffer 'mode-name buf1)) - (modenm2 (symbol-value-in-buffer 'mode-name buffer-to-select))) + (modenm2 (symbol-value-in-buffer 'mode-name buffer-to-select)) + position mismatch) (cond ((or (eq mode1 mode2) (eq modenm1 modenm2) - (and (string-match "^[^-]+-" mode1) - (string-match - (concat "^" (regexp-quote - (substring mode1 0 (match-end 0)))) - mode2)) + (and (setq position (position ?- mode1)) (> position 0) + (prog2 + (setq mismatch (mismatch mode1 mode2 :end1 position)) + (not (or (null mismatch) (eql mismatch position))))) (and buffers-tab-grouping-regexp (find-if #'(lambda (x) (or @@ -810,30 +810,16 @@ (defun format-buffers-tab-line (buffer) "For use as a value of `buffers-tab-format-buffer-line-function'. This just returns the buffer's name, optionally truncated." - (let ((len (specifier-instance buffers-tab-default-buffer-line-length))) - (if (and (> len 0) - (> (length (buffer-name buffer)) len)) - (if (string-match ".*<.>$" (buffer-name buffer)) - (concat (substring (buffer-name buffer) - 0 (- len 6)) "..." - (substring (buffer-name buffer) -3)) - (concat (substring (buffer-name buffer) - 0 (- len 3)) "...")) - (buffer-name buffer)))) - -(defsubst build-buffers-tab-internal (buffers) - (let ((selected t)) - (mapcar - #'(lambda (buffer) - (prog1 - (vector - (funcall buffers-tab-format-buffer-line-function - buffer) - (list buffers-tab-switch-to-buffer-function - (buffer-name buffer)) - :selected selected) - (when selected (setq selected nil)))) - buffers))) + (let* ((len (specifier-instance buffers-tab-default-buffer-line-length)) + (buffer-name (buffer-name buffer)) + (len1 (length buffer-name))) + (if (and (> len 0) (> len1 len)) + (if (and (> len1 3) (eql ?< (aref buffer-name (- len1 3))) + (eql ?> (aref buffer-name (1- len1)))) + (concat (subseq buffer-name 0 (- len 6)) + "..." (subseq buffer-name -3)) + (concat (subseq buffer-name 0 (- len 3)) "...")) + buffer-name))) ;;; #### SJT would like this function to have a sort function list. I ;;; don't see how this could work given that sorting is not @@ -868,16 +854,14 @@ ;; filter buffers (when buffers-tab-filter-functions (setq buffers - (delete-if - #'null - (mapcar #'(lambda (buf) - (let ((tmp-buf buf)) - (mapc #'(lambda (fun) - (unless (funcall fun buf first-buf) - (setq tmp-buf nil))) - buffers-tab-filter-functions) - tmp-buf)) - buffers)))) + (mapcan #'(lambda (buf) + (let ((tmp-buf buf)) + (mapc #'(lambda (fun) + (unless (funcall fun buf first-buf) + (setq tmp-buf nil))) + buffers-tab-filter-functions) + (and tmp-buf (list tmp-buf)))) + buffers))) ;; maybe shorten list of buffers (and (integerp buffers-tab-max-size) (> buffers-tab-max-size 1) @@ -886,9 +870,23 @@ ;; sort buffers in group (default is most-recently-selected) (when buffers-tab-sort-function (setq buffers (funcall buffers-tab-sort-function buffers))) - ;; convert list of buffers to list of structures used by tab widget - (setq buffers (build-buffers-tab-internal buffers)) - buffers))) + (labels + ((build-buffers-tab-internal (buffers) + (let ((selected t)) + (mapcar + #'(lambda (buffer) + (prog1 + (vector + (funcall buffers-tab-format-buffer-line-function + buffer) + (list buffers-tab-switch-to-buffer-function + (buffer-name buffer)) + :selected selected) + (when selected (setq selected nil)))) + buffers)))) + ;; convert list of buffers to list of structures used by tab widget + (setq buffers (build-buffers-tab-internal buffers)) + buffers)))) (provide 'buff-menu)
--- a/lisp/bytecomp.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/bytecomp.el Wed Apr 01 14:28:20 2015 +0100 @@ -1243,7 +1243,7 @@ (insert (current-time-string) "\n")) (when while-compiling-msg (insert while-compiling-msg "\n")) (insert " " string "\n") - (when (and fill (not (string-match "\n" string))) + (when (and fill (not (find ?\n string))) (let ((fill-prefix " ") (fill-column 78)) (fill-paragraph nil)))))
--- a/lisp/cus-edit.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/cus-edit.el Wed Apr 01 14:28:20 2015 +0100 @@ -1340,7 +1340,7 @@ :custom-show (lambda (widget value) ;; This used to call pp-to-string (let ((pp (widget-prettyprint-to-string value))) - (cond ((string-match "\n" pp) + (cond ((find ?\n pp) nil) ((> (length pp) 40) nil) @@ -2119,11 +2119,11 @@ (t ;; Edit mode. (let* ((format (widget-get type :format)) - tag-format value-format) - (while (not (string-match ":" format)) + tag-format value-format position) + (while (not (setq position (position ?: format))) (setq format (signal 'error (list "Bad format" format)))) - (setq tag-format (substring format 0 (match-end 0))) - (setq value-format (substring format (match-end 0))) + (setq tag-format (subseq format 0 (1+ position)) + value-format (subseq format (1+ position))) (push (widget-create-child-and-convert widget 'item :format tag-format
--- a/lisp/descr-text.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/descr-text.el Wed Apr 01 14:28:20 2015 +0100 @@ -760,10 +760,10 @@ last (<= char last)) (setq found t))) (if found - (let ((fields (cdr (nsubst nil "" (split-string + (let ((fields (cdr (nsubst nil "" (split-string-by-char (buffer-substring (line-beginning-position) - (line-end-position)) ";") + (line-end-position)) ?\;) :test 'equal)))) ;; The length depends on whether the last field was empty. (unless (or (eql 13 (length fields)) @@ -1235,8 +1235,7 @@ (if (consp clm) (progn (insert " ") (eval clm)) (when (>= (+ (current-column) - (or (string-match "\n" clm) - (string-width clm)) + (or (position ?\n clm) (string-width clm)) 1) (window-width)) (insert "\n")
--- a/lisp/disass.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/disass.el Wed Apr 01 14:28:20 2015 +0100 @@ -117,9 +117,10 @@ (progn (and (consp obj) (setq obj (cdr obj))) (indent-to indent) (princ " doc: " (current-buffer)) - (let ((frobbed nil)) - (if (string-match "\n" doc) - (setq doc (substring doc 0 (match-beginning 0)) + (let ((frobbed nil) + (position (position ?\n doc))) + (if position + (setq doc (subseq doc 0 position) frobbed t)) (if (> (length doc) 70) (setq doc (substring doc 0 65) frobbed t))
--- a/lisp/files.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/files.el Wed Apr 01 14:28:20 2015 +0100 @@ -2487,31 +2487,29 @@ (defun file-name-sans-extension (filename) "Return FILENAME sans final \"extension\". The extension, in a file name, is the part that follows the last `.'." - (save-match-data - (let ((file (file-name-sans-versions (file-name-nondirectory filename))) - directory) - (if (string-match "\\.[^.]*\\'" file) - (if (setq directory (file-name-directory filename)) - (expand-file-name (substring file 0 (match-beginning 0)) - directory) - (substring file 0 (match-beginning 0))) - filename)))) + (let* ((file (file-name-sans-versions (file-name-nondirectory filename))) + (position (position ?. file :from-end t)) + (directory (and position (file-name-directory filename)))) + (if position + (if directory + (expand-file-name (subseq file 0 position) directory) + (subseq file 0 position)) + filename))) (defun file-name-extension (filename &optional period) "Return FILENAME's final \"extension\". The extension, in a file name, is the part that follows the last `.'. Return nil for extensionless file names such as `foo'. -Return the empty string for file names such as `foo'. +Return the empty string for file names such as `foo.' If PERIOD is non-nil, then the returned value includes the period that delimits the extension, and if FILENAME has no extension, the value is \"\"." - (save-match-data - (let ((file (file-name-sans-versions (file-name-nondirectory filename)))) - (if (string-match "\\.[^.]*\\'" file) - (substring file (+ (match-beginning 0) (if period 0 1))) - (if period - ""))))) + (let* ((file (file-name-sans-versions (file-name-nondirectory filename))) + (position (position ?. file :from-end t))) + (if (and position (not (eql position 0))) + (subseq file (+ position (if period 0 1))) + (if period "")))) (defcustom make-backup-file-name-function nil "A function to use instead of the default `make-backup-file-name'. @@ -4247,25 +4245,13 @@ ;; directory if FILE is a symbolic link. (apply 'call-process insert-directory-program nil t nil - (let (list) - (if (listp switches) - (setq list switches) - (if (not (equal switches "")) - (let ((switches switches)) - ;; Split the switches at any spaces - ;; so we can pass separate options as separate args. - (while (string-match " " switches) - (setq list (cons (substring switches 0 (match-beginning 0)) - list) - switches (substring switches (match-end 0)))) - (setq list (cons switches list))))) - (append list - (list - (if full-directory-p - (concat (file-name-as-directory file) - ;;#### Unix-specific - ".") - file)))))))) + (append (if (listp switches) + switches + (split-string-by-char switches ?\ )) + (list + (if full-directory-p + (concat (file-name-as-directory file) ".") + file))))))) ;; If we got "//DIRED//" in the output, it means we got a real ;; directory listing, even if `ls' returned nonzero. @@ -4294,7 +4280,7 @@ (buffer-string)))) (if (string-match "ls (.*utils) \\([0-9.]*\\)$" version-out) (let* ((version (match-string 1 version-out)) - (split (split-string version "[.]")) + (split (split-string-by-char version ?.)) (numbers (mapcar 'string-to-int split)) (min '(5 2 1)) comparison)
--- a/lisp/gnuserv.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/gnuserv.el Wed Apr 01 14:28:20 2015 +0100 @@ -368,7 +368,8 @@ (signal 'quit nil))) (setq gnuserv-string ""))) (t - (let ((response (car (split-string gnuserv-string "\C-d")))) + (let ((response (subseq gnuserv-string 0 + (position ?\C-d gnuserv-string)))) (setq gnuserv-string "") (error "%s: invalid response from gnuserv" response))))))
--- a/lisp/gtk-file-dialog.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/gtk-file-dialog.el Wed Apr 01 14:28:20 2015 +0100 @@ -103,12 +103,9 @@ (defun gtk-file-dialog-update-dropdown (dialog dir) (let ((combo-box (get dialog 'x-file-dialog-select-list)) - (components (reverse - (delete "" - (split-string dir - (concat "[" (char-to-string directory-sep-char) "]"))))) + (components (nreverse + (delete "" (split-string-by-char dir directory-sep-char)))) (entries nil)) - (while components (push (concat "/" (mapconcat 'identity (reverse components) (char-to-string directory-sep-char)))
--- a/lisp/gtk-font-menu.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/gtk-font-menu.el Wed Apr 01 14:28:20 2015 +0100 @@ -62,17 +62,17 @@ (defun hack-font-truename (fn) ;; #### This is duplicated from x-font-menu.el. "Filter the output of `font-instance-truename' to deal with font sets." - (if (string-match "," (font-instance-truename fn)) - (let ((fpnt (nth 8 (split-string (font-instance-name fn) "-"))) - (flist (split-string (font-instance-truename fn) ",")) - ret) - (while flist - (if (string-equal fpnt (nth 8 (split-string (car flist) "-"))) - (progn (setq ret (car flist)) (setq flist nil)) - (setq flist (cdr flist)) - )) - ret) - (font-instance-truename fn))) + (let ((font-instance-truename (font-instance-truename fn))) + (if (find ?, font-instance-truename) + (let ((fpnt (nth 8 (split-string-by-char (font-instance-name fn) ?-))) + (flist (split-string-by-char font-instance-truename ?,)) + ret) + (while flist + (if (equal fpnt (nth 8 (split-string (car flist) "-"))) + (progn (setq ret (car flist)) (setq flist nil)) + (setq flist (cdr flist)))) + ret) + font-instance-truename))) (defvar gtk-font-regexp-ascii nil "This is used to filter out font families that can't display ASCII text.
--- a/lisp/hyper-apropos.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/hyper-apropos.el Wed Apr 01 14:28:20 2015 +0100 @@ -350,16 +350,13 @@ (string-match "\\`([^\n\t )]+[\t ]*\\([^\n)]+\\)?)\\(:[\t ]*\\|\n?\\'\\)" doc)) - (setq doc (substring doc (match-end 0) - (string-match "\n" doc)))) + (setq doc (subseq doc (match-end 0) (position ?\n doc)))) ;; Skip errant newlines at beginning of doc (if (and doc (string-match "\\`\n+" doc)) (setq doc (substring doc (match-end 0)))) (insert-face (if doc - (concat " - " - (substring doc 0 - (string-match "\n" doc))) + (concat " - " (subseq doc 0 (position ?\n doc))) " - Not documented.") 'hyper-apropos-documentation))) (insert ?\n)))) @@ -383,9 +380,8 @@ (string-match "\\`\n+" doc)) (setq doc (substring doc (match-end 0)))) (insert-face (if doc - (concat " - " (substring - doc (if userp 1 0) - (string-match "\n" doc))) + (concat " - " (subseq doc (if userp 1 0) + (position ?\n doc))) " - Not documented.") 'hyper-apropos-documentation))) (insert ?\n))))
--- a/lisp/info.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/info.el Wed Apr 01 14:28:20 2015 +0100 @@ -913,12 +913,13 @@ (message "Composing main Info directory...")) (set-buffer (or buf (generate-new-buffer - (if (string-match "localdir" file) + (if (search "localdir" file + :test #'equalp) "localdir" "info dir")))) (if (not buf) (insert-file-contents file)) - (if (string-match "localdir" (buffer-name)) + (if (search "localdir" (buffer-name) :test #'equalp) (setq lbuffers (cons (current-buffer) lbuffers)) (setq buffers (cons (current-buffer) buffers))) (if attrs @@ -954,7 +955,7 @@ (while others (let ((other (car others)) (info-buffer (current-buffer))) - (if (string-match "localdir" (buffer-name other)) + (if (search "localdir" (buffer-name other)) (save-excursion (set-buffer info-buffer) (goto-char (point-max)) @@ -1527,7 +1528,7 @@ ))) (setq suff (cdr suff))) (if (stringp (cdr (car suff))) - (let ((command (if (string-match "%s" (cdr (car suff))) + (let ((command (if (search "%s" (cdr (car suff))) (format (cdr (car suff)) file) (concat (cdr (car suff)) " < " file)))) (message "%s..." command) @@ -1958,9 +1959,9 @@ (list default) (list item))) (error "No cross-references in this node")))) - (let (target i (str (concat "\\*" Info-footnote-tag " " - (regexp-quote footnotename)))) - (while (setq i (string-match " " str i)) + (let (target (i 0) (str (concat "\\*" Info-footnote-tag " " + (regexp-quote footnotename)))) + (while (setq i (position ?\ str :start i)) (setq str (concat (substring str 0 i) "\\([ \t\n]+\\)" (substring str (1+ i)))) (setq i (+ i 10))) @@ -2029,8 +2030,7 @@ (defun Info-extract-menu-node-name (&optional errmessage multi-line) (skip-chars-forward " \t\n") - (let ((start (point)) - str i) + (let ((start (point)) str) (skip-chars-forward "^:") (forward-char 1) (setq str @@ -2050,9 +2050,7 @@ ;; Skips sequential dots. "]\\|\\.+[^ \t\n)]\\)+\\)")) (match-string 1))) - (while (setq i (string-match "\n" str i)) - (aset str i ?\ )) - str)) + (substitute ?\ ?\n str))) (defun Info-menu (menu-item) "Go to node for menu item named (or abbreviated) NAME.
--- a/lisp/ldap.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/ldap.el Wed Apr 01 14:28:20 2015 +0100 @@ -403,23 +403,16 @@ (error "Invalid country string: %s" str))) (defun ldap-decode-string (str) - (if (fboundp 'decode-coding-string) - (decode-coding-string str ldap-coding-system))) + (decode-coding-string str ldap-coding-system)) (defun ldap-encode-string (str) - (if (fboundp 'encode-coding-string) - (encode-coding-string str ldap-coding-system))) + (encode-coding-string str ldap-coding-system)) (defun ldap-decode-address (str) - (mapconcat 'ldap-decode-string - (split-string str "\\$") - "\n")) + (mapconcat 'ldap-decode-string (split-string-by-char str ?$) "\n")) (defun ldap-encode-address (str) - (mapconcat 'ldap-encode-string - (split-string str "\n") - "$")) - + (mapconcat 'ldap-encode-string (split-string-by-char str ?\n) "$")) ;; LDAP protocol functions
--- a/lisp/lisp-mnt.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/lisp-mnt.el Wed Apr 01 14:28:20 2015 +0100 @@ -306,11 +306,9 @@ (or (lm-header "created") (let ((date-and-time (lm-header "ORIG-DATE"))) (if date-and-time - (substring date-and-time 0 - (string-match " " date-and-time))))) + (subseq date-and-time 0 (position ?\ date-and-time))))) (if file - (kill-buffer (current-buffer))) - ))) + (kill-buffer (current-buffer)))))) (defun lm-last-modified-date (&optional file) "Return the modify-date given in file FILE, or current buffer if FILE is nil." @@ -333,11 +331,9 @@ ;; XEmacs change (Infodock change? -sb) (let ((date-and-time (lm-header "LAST-MOD"))) (if date-and-time - (substring date-and-time 0 - (string-match " " date-and-time))))) + (subseq date-and-time 0 (position ?\ date-and-time))))) (if file - (kill-buffer (current-buffer))) - ))) + (kill-buffer (current-buffer)))))) (defun lm-version (&optional file) "Return the version listed in file FILE, or current buffer if FILE is nil.
--- a/lisp/menubar-items.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/menubar-items.el Wed Apr 01 14:28:20 2015 +0100 @@ -1439,11 +1439,13 @@ ["Edit I%_nit File" ;; #### there should be something that holds the name that the init ;; file should be created as, when it's not present. - (let ((el-file (or user-init-file "~/.xemacs/init.el")) - el-file-directory) - (if (string-match "\\.elc$" el-file) + (let* ((el-file (or user-init-file "~/.xemacs/init.el")) + (position (position ?. el-file :from-end t)) + el-file-directory) + (if (not (mismatch el-file ".elc" + :start1 (or position (length el-file)))) (setq el-file - (substring user-init-file 0 (1- (length el-file))))) + (subseq user-init-file 0 -1))) (unless (file-directory-p (setq el-file-directory (file-name-directory el-file))) (message "Creating %s... " el-file-directory) @@ -1479,7 +1481,7 @@ ["%_Home Page (www.xemacs.org)" xemacs-www-page :active (fboundp 'browse-url)]) ["B%_eta Info" describe-beta - :included (string-match "beta" emacs-version)] + :included (search "beta" emacs-version)] "-----" ("%_Info (Online Docs)" ["%_Info Contents" (Info-goto-node "(dir)")] @@ -1711,10 +1713,12 @@ with a star at the end of the list." (let* ((nam1 (buffer-name buf1)) (nam2 (buffer-name buf2)) - (inv1p (not (null (string-match "\\` " nam1)))) - (inv2p (not (null (string-match "\\` " nam2)))) - (star1p (not (null (string-match "\\`*" nam1)))) - (star2p (not (null (string-match "\\`*" nam2))))) + (len1 (length nam1)) + (len2 (length nam2)) + (inv1p (eql ?\ (and (> len1 0) (aref nam1 0)))) + (inv2p (eql ?\ (and (> len2 0) (aref nam2 0)))) + (star1p (eql ?* (and (> len1 0) (aref nam1 0)))) + (star2p (eql ?* (and (> len2 0) (aref nam2 0))))) (cond ((not (eq inv1p inv2p)) (not inv1p)) ((not (eq star1p star2p)) @@ -1728,23 +1732,37 @@ beginning with a star at the end of the list." (let* ((nam1 (buffer-name buf1)) (nam2 (buffer-name buf2)) - (inv1p (not (null (string-match "\\` " nam1)))) - (inv2p (not (null (string-match "\\` " nam2)))) - (star1p (not (null (string-match "\\`*" nam1)))) - (star2p (not (null (string-match "\\`*" nam2)))) - (mode1 (symbol-value-in-buffer 'major-mode buf1)) - (mode2 (symbol-value-in-buffer 'major-mode buf2))) + (first1 (elt nam1 0)) + (first2 (elt nam2 0)) + (inv1p (eql ?\ first1)) + (inv2p (eql ?\ first2)) + (star1p (eql ?* first1)) + (star2p (eql ?* first2)) + compare-strings) (cond ((not (eq inv1p inv2p)) (not inv1p)) ((not (eq star1p star2p)) (not star1p)) - ((and star1p star2p (string-lessp nam1 nam2))) - ((string-lessp mode1 mode2) - t) - ((string-lessp mode2 mode1) - nil) - (t - (string-lessp nam1 nam2))))) + ((and star1p star2p (prog2 + (setq compare-strings + (compare-strings nam1 0 nil + nam2 0 nil t)) + (and (fixnump compare-strings) + (minusp compare-strings))))) + ((eq (setq compare-strings + (compare-strings (symbol-name + (symbol-value-in-buffer + 'major-mode buf1)) + 0 nil + (symbol-name + (symbol-value-in-buffer + 'major-mode buf2)) + 0 nil t)) + t) + (setq compare-strings (compare-strings nam1 0 nil + nam2 0 nil t)) + (and (fixnump compare-strings) (minusp compare-strings))) + (t (minusp compare-strings))))) ;; this version is too slow on some machines. ;; (vintage 1990, that is) @@ -1772,14 +1790,18 @@ This groups buffers by major mode. It only really makes sense if `buffers-menu-sorting-function' is `sort-buffers-menu-by-mode-then-alphabetically'." - (cond ((string-match "\\`*" (buffer-name buf1)) - (and (null buf2) "*Misc*")) - ((or (null buf2) - (string-match "\\`*" (buffer-name buf2)) - (not (eq (symbol-value-in-buffer 'major-mode buf1) - (symbol-value-in-buffer 'major-mode buf2)))) - (symbol-value-in-buffer 'mode-name buf1)) - (t nil))) + (let* ((nam1 (buffer-name buf1)) + (nam2 (buffer-name buf2)) + (len1 (length nam1)) + (len2 (length nam2))) + (cond ((eql ?* (and (> len1 0) (aref nam1 0))) + (and (null buf2) "*Misc*")) + ((or (null buf2) + (eql ?* (and (> len2 0) (aref nam2 0))) + (not (eq (symbol-value-in-buffer 'major-mode buf1) + (symbol-value-in-buffer 'major-mode buf2)))) + (symbol-value-in-buffer 'mode-name buf1)) + (t nil)))) (defun buffer-menu-save-buffer (buffer) (save-excursion @@ -1902,7 +1924,7 @@ (defun list-all-buffers () "Display a list of buffers. Calls `list-all-buffers-function'." (interactive) - (funcall (if (fboundp list-all-buffers-function) + (funcall (if (functionp list-all-buffers-function) list-all-buffers-function 'list-buffers))) @@ -1926,10 +1948,10 @@ (mapcan #'(lambda (lang) (let ((tut (assq 'tutorial lang))) (and tut - (not (string= (car lang) "ASCII")) + (not (equal (car lang) "ASCII")) ;; skip current language, since we already ;; included it first - (not (string= (car lang) + (not (equal (car lang) current-language-environment)) ;; Hackish approach; if a language environment ;; doesn't have associated locale information,
--- a/lisp/minibuf.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/minibuf.el Wed Apr 01 14:28:20 2015 +0100 @@ -1483,15 +1483,11 @@ ;; Quote "$" as "$$" to get it past substitute-in-file-name (defun un-substitute-in-file-name (string) - (let ((regexp "\\$") + (let ((n (count ?$ string)) (olen (length string)) - new - n o ch) - (if (not (string-match regexp string)) + new o ch) + (if (eql n 0) string - (setq n 1) - (while (string-match regexp string (match-end 0)) - (setq n (1+ n))) (setq new (make-string (+ olen n) ?$)) (setq n 0 o 0) (while (< o olen) @@ -1503,7 +1499,6 @@ (setq n (1+ n)))) new))) - ;; Wrapper for `directory-files' for use in generating completion lists. ;; Generates output in the same format as `file-name-all-completions'. ;; @@ -1775,9 +1770,7 @@ start)))) (head (substring string 0 (1- start))) (alist #'(lambda () - (mapcar #'(lambda (x) - (cons (substring x 0 (string-match "=" x)) - nil)) + (mapcar #'(lambda (x) (subseq x 0 (position ?= x))) process-environment)))) (cond ((eq action 'lambda)
--- a/lisp/mouse.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/mouse.el Wed Apr 01 14:28:20 2015 +0100 @@ -274,7 +274,7 @@ ;; #### -- need better test (if (and (not force-window) (<= (length result-str) (window-width (selected-window))) - (not (string-match "\n" result-str))) + (not (find ?\n result-str))) (message "%s" result-str) (with-output-to-temp-buffer "*Mouse-Eval*" (loop
--- a/lisp/msw-font-menu.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/msw-font-menu.el Wed Apr 01 14:28:20 2015 +0100 @@ -77,7 +77,7 @@ dev-cache cache families sizes weights) (dolist (name (cond ((null debug) ; debugging kludge (font-list "::::" device)) - ((stringp debug) (split-string debug "\n")) + ((stringp debug) (split-string-by-char debug ?\n)) (t debug))) (when (and (string-match mswindows-font-regexp-ascii name) (string-match mswindows-font-regexp name))
--- a/lisp/mule/japanese.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/mule/japanese.el Wed Apr 01 14:28:20 2015 +0100 @@ -444,36 +444,43 @@ 'native-coding-system ;; first, see if an explicit encoding was given. (lambda (locale) - (let ((case-fold-search t)) - (cond - ;; many unix versions - ((string-match "\\.euc" locale) 'euc-jp) - ((string-match "\\.sjis" locale) 'shift-jis) + (or + (let ((locale (canoncase locale))) + (cond + ;; many unix versions + ((search ".euc" locale) 'euc-jp) + ((search ".sjis" locale) 'shift-jis) - ;; X11R6 (CJKV p. 471) - ((string-match "\\.jis7" locale) 'jis7) - ((string-match "\\.jis8" locale) 'jis8) - ((string-match "\\.mscode" locale) 'shift-jis) - ((string-match "\\.pjis" locale) 'iso-2022-jp) - ((string-match "\\.ujis" locale) 'euc-jp) + ;; X11R6 (CJKV p. 471) + ((search ".jis7" locale) 'jis7) + ((search ".jis8" locale) 'jis8) + ((search ".mscode" locale) 'shift-jis) + ((search ".pjis" locale) 'iso-2022-jp) + ((search ".ujis" locale) 'euc-jp) - ;; other names in X11R6 locale.alias - ((string-match "\\.ajec" locale) 'euc-jp) - ((string-match "-euc" locale) 'euc-jp) - ((string-match "\\.iso-2022-jp" locale) 'iso-2022-jp) - ((string-match "\\.jis" locale) 'jis7) ;; or just jis? - - ;; aix (CJKV p. 465) - ((and (eq system-type 'aix) - (string-match "^Ja_JP" locale)) 'shift-jis) - ((and (eq system-type 'aix) - (string-match "^ja_JP" locale)) 'euc-jp) - - ;; other X11R6 locale.alias - ((string-match "^Jp_JP" locale) 'euc-jp) - ((and (eq system-type 'hpux) (eq locale "japanese")) - 'shift-jis) - ;; fallback - (t 'euc-jp))))) + ;; other names in X11R6 locale.alias + ((search ".ajec" locale) 'euc-jp) + ((search "-euc" locale) 'euc-jp) + ((search ".iso-2022-jp" locale) 'iso-2022-jp) + ((search ".jis" locale) 'jis7))) ;; or just jis? + ;; aix (CJKV p. 465) + (when (eq system-type 'aix) + (cond + ;; Case sensitive! + ((not (mismatch "Ja_JP" locale + :end2 (length "Ja_JP"))) + 'shift-jis) + ((not (mismatch "ja_JP" locale + :end2 (length "ja_JP"))) + 'euc-jp))) + (cond + ;; other X11R6 locale.alias + ((not (mismatch "Jp_JP" locale :end2 (length "Jp_JP"))) + 'euc-jp) + ((and (eq system-type 'hpux) + (equalp locale "japanese")) + 'shift-jis) + ;; fallback + (t 'euc-jp))))) ;;; japanese.el ends here
--- a/lisp/mule/korea-util.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/mule/korea-util.el Wed Apr 01 14:28:20 2015 +0100 @@ -31,7 +31,7 @@ ;;;###autoload (defvar default-korean-keyboard - (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) + (if (find ?3 (getenv "HANGUL_KEYBOARD_TYPE")) "3" "") "*The kind of Korean keyboard for Korean input method. @@ -60,7 +60,7 @@ "Swith to/from Korean hanja package." (interactive "i") (and current-input-method - (if (string-match "korean-hanja" current-input-method) + (if (search "korean-hanja" current-input-method :test #'equalp) (activate-input-method (concat "korean-hangul" default-korean-keyboard)) (activate-input-method (concat "korean-hanja"
--- a/lisp/mule/mule-cmds.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/mule/mule-cmds.el Wed Apr 01 14:28:20 2015 +0100 @@ -1285,9 +1285,10 @@ ;; assume it's DEFAULT or NEUTRAL (or something else ;; without the language in it?) and prepend the ;; language. - (if (string-match "_" (cdr ms-locale)) - (replace-in-string - (replace-match "-" nil nil (cdr ms-locale)) "_" " ") + (if (setq position (position ?_ (cdr ms-locale))) + (substitute ?\ ?_ + (substitute ?- ?_ (cdr ms-locale) + :end (1+ position))) (format "%s-%s" (car ms-locale) (cdr ms-locale)))) ;; ???? huh ???? if failure, just try the language ;; name.
--- a/lisp/newcomment.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/newcomment.el Wed Apr 01 14:28:20 2015 +0100 @@ -736,7 +736,7 @@ (match-beginning 0) lcs 3)) c))) (setq cs (replace-match fill t t s)) (when (and (not (string-match comment-start-skip cs)) - (string-match "a=m" s)) + (search "a=m" s)) ;; The whitespace around CS cannot be ignored: put it back. (setq re "a=m") (setq fill (make-string (- width lcs) c))
--- a/lisp/package-get.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/package-get.el Wed Apr 01 14:28:20 2015 +0100 @@ -1222,7 +1222,7 @@ (let ((dir (cadr search))) (concat (when (car search) (concat - (if (string-match "@" (car search)) + (if (position ?@ (car search)) "/" "/anonymous@") (car search) ":"))
--- a/lisp/process.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/process.el Wed Apr 01 14:28:20 2015 +0100 @@ -637,10 +637,8 @@ Optional second arg MUSTMATCH, if non-nil, means require existing envvar name. If it is also not t, RET does not exit if it does non-null completion." (completing-read prompt - (mapcar (function - (lambda (enventry) - (list (substring enventry 0 - (string-match "=" enventry))))) + (mapcar #'(lambda (variable) + (substring variable 0 (position ?= variable))) process-environment) nil mustmatch nil 'read-envvar-name-history)) @@ -721,7 +719,7 @@ ;; But then right now our find-coding-systems analogue is in packages. - (if (string-match "=" variable) + (if (position ?= variable) (error "Environment variable name `%s' contains `='" variable) (let ((pattern (concat "\\`" (regexp-quote (concat variable "=")))) (case-fold-search nil)
--- a/lisp/replace.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/replace.el Wed Apr 01 14:28:20 2015 +0100 @@ -148,20 +148,10 @@ nil nil nil 'query-replace-history)) (list from to current-prefix-arg))) - (let (replacements) - (if (listp to-strings) - (setq replacements to-strings) - (while (not (eql (length to-strings) 0)) - (if (string-match " " to-strings) - (setq replacements - (append replacements - (list (substring to-strings 0 - (string-match " " to-strings)))) - to-strings (substring to-strings - (1+ (string-match " " to-strings)))) - (setq replacements (append replacements (list to-strings)) - to-strings "")))) - (perform-replace regexp replacements t t nil arg))) + (perform-replace regexp (if (listp to-strings) + to-strings + (split-string-by-char to-strings ?\ )) + t t nil arg)) (defun replace-string (from-string to-string &optional delimited) "Replace occurrences of FROM-STRING with TO-STRING.
--- a/lisp/select.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/select.el Wed Apr 01 14:28:20 2015 +0100 @@ -782,18 +782,16 @@ ;;; CF_xxx conversions (defun select-convert-from-cf-text (selection type value) (if (find-coding-system 'mswindows-multibyte) - (let ((value (decode-coding-string value 'mswindows-multibyte))) - (replace-in-string (if (string-match "\0" value) - (substring value 0 (match-beginning 0)) - value) + (let* ((value (decode-coding-string value 'mswindows-multibyte)) + (position (position ?\x00 value))) + (replace-in-string (subseq value 0 position) "\\(\r\n\\|\n\r\\)" "\n" t)))) (defun select-convert-from-cf-unicodetext (selection type value) (if (find-coding-system 'mswindows-unicode) - (let ((value (decode-coding-string value 'mswindows-unicode))) - (replace-in-string (if (string-match "\0" value) - (substring value 0 (match-beginning 0)) - value) + (let* ((value (decode-coding-string value 'mswindows-unicode)) + (position (position ?\x00 value))) + (replace-in-string (subseq value 0 position) "\\(\r\n\\|\n\r\\)" "\n" t)))) (defun select-convert-to-cf-text (selection type value)
--- a/lisp/setup-paths.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/setup-paths.el Wed Apr 01 14:28:20 2015 +0100 @@ -107,7 +107,7 @@ ;; searching for a package directory (and - (string-match "win32" system-configuration) + (search "win32" system-configuration) (paths-file-readable-directory-p (paths-construct-path (list directory "xemacs-packages"))))))
--- a/lisp/sound.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/sound.el Wed Apr 01 14:28:20 2015 +0100 @@ -159,7 +159,7 @@ (if (file-name-absolute-p filename) (list (file-name-directory filename)) default-sound-directory-list) - (split-string sound-extension-list ":"))) + (split-string-by-char sound-extension-list ?:))) buf data) (unless file (error "Couldn't load sound file %s" filename))
--- a/lisp/startup.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/startup.el Wed Apr 01 14:28:20 2015 +0100 @@ -1301,7 +1301,7 @@ `( (face (blue bold underline) "Useful Help-menu entries:\n\n") - ,@(if (string-match "beta" emacs-version) + ,@(if (search "beta" emacs-version) `((face bold "Beta Info:") (face (red bold) " This is an Experimental version of XEmacs.\n")) @@ -1349,7 +1349,7 @@ (defun splash-screen-tty-body () `( (face italic "[`C-' means the control key, `M-' means the meta key]\n\n") - ,@(if (string-match "beta" emacs-version) + ,@(if (search "beta" emacs-version) `((key describe-beta) ": " (face (red bold) "This is an Experimental version of XEmacs.\n"))
--- a/lisp/version.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/version.el Wed Apr 01 14:28:20 2015 +0100 @@ -89,7 +89,7 @@ (let ((version-string (format "XEmacs %s %s(%s%s) of %s %s on %s" - (substring emacs-version 0 (string-match " XEmacs" emacs-version)) + (subseq emacs-version 0 (search " XEmacs" emacs-version)) "[Lucid] " system-configuration (cond ((or (and (fboundp 'featurep)
--- a/lisp/x-font-menu.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/x-font-menu.el Wed Apr 01 14:28:20 2015 +0100 @@ -85,17 +85,17 @@ ;; #### Is this useful if not configure'd --with-xfs? ;; #### This is duplicated in gtk-font-menu.el. "Filter the output of `font-instance-truename' to deal with font sets." - (if (string-match "," (font-instance-truename fn)) - (let ((fpnt (nth 8 (split-string (font-instance-name fn) "-"))) - (flist (split-string (font-instance-truename fn) ",")) - ret) - (while flist - (if (string-equal fpnt (nth 8 (split-string (car flist) "-"))) - (progn (setq ret (car flist)) (setq flist nil)) - (setq flist (cdr flist)) - )) - ret) - (font-instance-truename fn))) + (let ((font-instance-truename (font-instance-truename fn))) + (if (find ?, font-instance-truename) + (let ((fpnt (nth 8 (split-string-by-char (font-instance-name fn) ?-))) + (flist (split-string-by-char font-instance-truename ?,)) + ret) + (while flist + (if (equal fpnt (nth 8 (split-string-by-char (car flist) ?-))) + (progn (setq ret (car flist)) (setq flist nil)) + (setq flist (cdr flist)))) + ret) + font-instance-truename))) (defvar x-font-regexp-ascii nil "This is used to filter out font families that can't display ASCII text. @@ -187,7 +187,7 @@ (dolist (name (cond ((null debug) ; debugging kludge (font-list "*-*-*-*-*-*-*-*-*-*-*-*-*-*" device font-menu-max-number)) - ((stringp debug) (split-string debug "\n")) + ((stringp debug) (split-string-by-char debug ?\n)) (t debug))) (when (and (string-match x-font-regexp-ascii name) (string-match x-font-regexp name))
--- a/lisp/x-init.el Tue Mar 31 18:42:21 2015 +0100 +++ b/lisp/x-init.el Wed Apr 01 14:28:20 2015 +0100 @@ -147,7 +147,7 @@ ;; APIs to identify the keyboard - those only work on the console. ;; xkeycaps has the same problem when running `remotely'. (let ((vendor (x-server-vendor device))) - (cond ((or (string-match "Sun Microsystems" vendor) + (cond ((or (search "Sun Microsystems" vendor) ;; MIT losingly fails to tell us what hardware the X server ;; is managing, so assume all MIT displays are Suns... HA HA! (string-equal "MIT X Consortium" vendor)