comparison lisp/ChangeLog @ 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 f9e59cd39a9a
children 5a93f519accc
comparison
equal deleted inserted replaced
5881:31dd275fa683 5882:bbe4146603db
1 2015-04-01 Aidan Kehoe <kehoea@parhasard.net>
2
3 When calling #'string-match with a REGEXP without regular
4 expression special characters, call #'search, #'mismatch, #'find,
5 etc. instead, making our code less likely to side-effect other
6 functions' match data and a little faster.
7
8 * apropos.el (apropos-command):
9 * apropos.el (apropos):
10 Call (position ?\n ...) rather than (string-match "\n" ...) here.
11 * buff-menu.el:
12 * buff-menu.el (buffers-menu-omit-invisible-buffers):
13 Don't fire up the regexp engine just to check if a string starts
14 with a space.
15 * buff-menu.el (select-buffers-tab-buffers-by-mode):
16 Don't fire up the regexp engine just to compare mode basenames.
17 * buff-menu.el (format-buffers-tab-line):
18 * buff-menu.el (build-buffers-tab-internal): Moved to being a
19 label within the following.
20 * buff-menu.el (buffers-tab-items): Use the label.
21 * bytecomp.el (byte-compile-log-1):
22 Don't fire up the regexp engine just to look for a newline.
23 * cus-edit.el (get):
24 Ditto.
25 * cus-edit.el (custom-variable-value-create):
26 Ditto, but for a colon.
27 * descr-text.el (describe-text-sexp):
28 Ditto.
29 * descr-text.el (describe-char-unicode-data):
30 Use #'split-string-by-char given that we're just looking for a
31 semicolon.
32 * descr-text.el (describe-char):
33 Don't fire up the regexp engine just to look for a newline.
34 * disass.el (disassemble-internal):
35 Ditto.
36 * files.el (file-name-sans-extension):
37 Implement this using #'position.
38 * files.el (file-name-extension):
39 Correct this function's docstring, implement it in terms of
40 #'position.
41 * files.el (insert-directory):
42 Don't fire up the regexp engine to split a string by space; don't
43 reverse the list of switches, this is actually a longstand bug as
44 far as I can see.
45 * gnuserv.el (gnuserv-process-filter):
46 Use #'position here, instead of consing inside #'split-string
47 needlessly.
48 * gtk-file-dialog.el (gtk-file-dialog-update-dropdown):
49 Use #'split-string-by-char here, don't fire up #'split-string for
50 directory-sep-char.
51 * gtk-font-menu.el (hack-font-truename):
52 Implement this more cheaply in terms of #'find,
53 #'split-string-by-char, #'equal, rather than #'string-match,
54 #'split-string, #'string-equal.
55 * hyper-apropos.el (hyper-apropos-grok-functions):
56 * hyper-apropos.el (hyper-apropos-grok-variables):
57 Look for a newline using #'position rather than #'string-match in
58 these functions.
59 * info.el (Info-insert-dir):
60 * info.el (Info-insert-file-contents):
61 * info.el (Info-follow-reference):
62 * info.el (Info-extract-menu-node-name):
63 * info.el (Info-menu):
64 Look for fixed strings using #'position or #'search as appropriate
65 in this file.
66 * ldap.el (ldap-decode-string):
67 * ldap.el (ldap-encode-string):
68 #'encode-coding-string, #'decode-coding-string are always
69 available, don't check if they're fboundp.
70 * ldap.el (ldap-decode-address):
71 * ldap.el (ldap-encode-address):
72 Use #'split-string-by-char in these functions.
73 * lisp-mnt.el (lm-creation-date):
74 * lisp-mnt.el (lm-last-modified-date):
75 Don't fire up the regexp engine just to look for spaces in this file.
76 * menubar-items.el (default-menubar):
77 Use (not (mismatch ...)) rather than #'string-match here, for
78 simple regexp.
79 Use (search "beta" ...) rather than (string-match "beta" ...)
80 * menubar-items.el (sort-buffers-menu-alphabetically):
81 * menubar-items.el (sort-buffers-menu-by-mode-then-alphabetically):
82 * menubar-items.el (group-buffers-menu-by-mode-then-alphabetically):
83 Don't fire up the regexp engine to check if a string starts with
84 a space or an asterisk.
85 Use the more fine-grained results of #'compare-strings; compare
86 case-insensitively for the buffer menu.
87 * menubar-items.el (list-all-buffers):
88 * menubar-items.el (tutorials-menu-filter):
89 Use #'equal rather than #'string-equal, which, in this context,
90 has the drawback of not having a bytecode, and no redeeming
91 features.
92 * minibuf.el:
93 * minibuf.el (un-substitute-in-file-name):
94 Use #'count, rather than counting the occurences of $ using the
95 regexp engine.
96 * minibuf.el (read-file-name-internal-1):
97 Don't fire up the regexp engine to search for ?=.
98 * mouse.el (mouse-eval-sexp):
99 Check for newline with #'find.
100 * msw-font-menu.el (mswindows-reset-device-font-menus):
101 Split a string by newline with #'split-string-by-char.
102 * mule/japanese.el:
103 * mule/japanese.el ("Japanese"):
104 Use #'search rather than #'string-match; canoncase before
105 comparing; fix a bug I had introduced where I had been making case
106 insensitive comparisons where the case mattered.
107 * mule/korea-util.el (default-korean-keyboard):
108 Look for ?3 using #'find, not #'string-march.
109 * mule/korea-util.el (quail-hangul-switch-hanja):
110 Search for a fixed string using #'search.
111 * mule/mule-cmds.el (set-locale-for-language-environment):
112 #'position, #'substitute rather than #'string-match,
113 #'replace-in-string.
114 * newcomment.el (comment-make-extra-lines):
115 Use #'search rather than #'string-match for a simple string.
116 * package-get.el (package-get-remote-filename):
117 Use #'position when looking for ?@
118 * process.el (setenv):
119 * process.el (read-envvar-name):
120 Use #'position when looking for ?=.
121 * replace.el (map-query-replace-regexp):
122 Use #'split-string-by-char instead of using an inline
123 implementation of it.
124 * select.el (select-convert-from-cf-text):
125 * select.el (select-convert-from-cf-unicodetext):
126 Use #'position rather than #'string-match in these functions.
127 * setup-paths.el (paths-emacs-data-root-p):
128 Use #'search when looking for simple string.
129 * sound.el (load-sound-file):
130 Use #'split-string-by-char rather than an inline reimplementation
131 of same.
132 * startup.el (splash-screen-window-body):
133 * startup.el (splash-screen-tty-body):
134 Search for simple strings using #'search.
135 * version.el (emacs-version):
136 Ditto.
137 * x-font-menu.el (hack-font-truename):
138 Implement this more cheaply in terms of #'find,
139 #'split-string-by-char, #'equal, rather than #'string-match,
140 #'split-string, #'string-equal.
141 * x-font-menu.el (x-reset-device-font-menus-core):
142 Use #'split-string-by-char here.
143 * x-init.el (x-initialize-keyboard):
144 Search for a simple string using #'search.
145
1 2015-03-16 Aidan Kehoe <kehoea@parhasard.net> 146 2015-03-16 Aidan Kehoe <kehoea@parhasard.net>
2 147
3 * tty-init.el (make-frame-after-init-entry-point): 148 * tty-init.el (make-frame-after-init-entry-point):
4 Some parentheses were placed badly here with the last change, 149 Some parentheses were placed badly here with the last change,
5 thank you Mats for pointing it out; in passing, change to a 150 thank you Mats for pointing it out; in passing, change to a