diff options
author | Mattias EngdegÄrd <mattiase@acm.org> | 2022-07-04 14:52:50 +0200 |
---|---|---|
committer | Mattias EngdegÄrd <mattiase@acm.org> | 2022-07-04 14:56:11 +0200 |
commit | 1268902db17501862e5efbd51a41108ffc5105f3 (patch) | |
tree | 0cdb05b09404c0f63f7ce78c3ab2c643bf62d0af | |
parent | 544361d37f3877b2f10c362936a283f4a0b2fa71 (diff) | |
download | emacs-1268902db17501862e5efbd51a41108ffc5105f3.tar.gz |
Remove some useless `eval-when-compile`
* lisp/cedet/semantic/java.el (semantic-java-number-regexp):
* lisp/cedet/semantic/lex.el (semantic-lex-number-expression):
* lisp/emacs-lisp/cl-indent.el (common-lisp-indent-function-1):
* lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression)
(lisp--el-match-keyword, lisp-string-in-doc-position-p):
* lisp/emacs-lisp/shorthands.el (shorthands-font-lock-shorthands):
* lisp/net/socks.el (socks-send-command):
* lisp/progmodes/meta-mode.el (meta-font-lock-keywords):
* lisp/shell.el (shell--parse-pcomplete-arguments):
* lisp/textmodes/sgml-mode.el (sgml-mode):
* lisp/textmodes/tex-mode.el (tex--guess-mode)
(tex-common-initialization, tex-input-files-re):
* lisp/textmodes/tildify.el (tildify-mode):
* lisp/xdg.el (xdg-line-regexp):
Eliminate `eval-when-compile` when the argument would be evaluated by
the compiler anyway.
-rw-r--r-- | lisp/cedet/semantic/java.el | 37 | ||||
-rw-r--r-- | lisp/cedet/semantic/lex.el | 37 | ||||
-rw-r--r-- | lisp/emacs-lisp/cl-indent.el | 7 | ||||
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 96 | ||||
-rw-r--r-- | lisp/emacs-lisp/shorthands.el | 3 | ||||
-rw-r--r-- | lisp/net/socks.el | 9 | ||||
-rw-r--r-- | lisp/progmodes/meta-mode.el | 41 | ||||
-rw-r--r-- | lisp/shell.el | 11 | ||||
-rw-r--r-- | lisp/textmodes/sgml-mode.el | 11 | ||||
-rw-r--r-- | lisp/textmodes/tex-mode.el | 33 | ||||
-rw-r--r-- | lisp/textmodes/tildify.el | 5 | ||||
-rw-r--r-- | lisp/xdg.el | 13 |
12 files changed, 141 insertions, 162 deletions
diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el index 9b70afd0a33..53fd4de2975 100644 --- a/lisp/cedet/semantic/java.el +++ b/lisp/cedet/semantic/java.el @@ -37,25 +37,24 @@ ;;; Lexical analysis ;; (defconst semantic-java-number-regexp - (eval-when-compile - (concat "\\(" - "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" - "\\|" - "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" - "\\|" - "\\<[0-9]+[.][fFdD]\\>" - "\\|" - "\\<[0-9]+[.]" - "\\|" - "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" - "\\|" - "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" - "\\|" - "\\<0[xX][[:xdigit:]]+[lL]?\\>" - "\\|" - "\\<[0-9]+[lLfFdD]?\\>" - "\\)" - )) + (concat "\\(" + "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][fFdD]\\>" + "\\|" + "\\<[0-9]+[.]" + "\\|" + "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<0[xX][[:xdigit:]]+[lL]?\\>" + "\\|" + "\\<[0-9]+[lLfFdD]?\\>" + "\\)" + ) "Lexer regexp to match Java number terminals. Following is the specification of Java number literals. diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el index 885ffbf5a73..9c64cc9f7e5 100644 --- a/lisp/cedet/semantic/lex.el +++ b/lisp/cedet/semantic/lex.el @@ -574,25 +574,24 @@ may need to be overridden for some special languages.") (defvar-local semantic-lex-number-expression ;; This expression was written by David Ponce for Java, and copied ;; here for C and any other similar language. - (eval-when-compile - (concat "\\(" - "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" - "\\|" - "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" - "\\|" - "\\<[0-9]+[.][fFdD]\\>" - "\\|" - "\\<[0-9]+[.]" - "\\|" - "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" - "\\|" - "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" - "\\|" - "\\<0[xX][[:xdigit:]]+[lL]?\\>" - "\\|" - "\\<[0-9]+[lLfFdD]?\\>" - "\\)" - )) + (concat "\\(" + "\\<[0-9]+[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<[0-9]+[.][fFdD]\\>" + "\\|" + "\\<[0-9]+[.]" + "\\|" + "[.][0-9]+\\([eE][-+]?[0-9]+\\)?[fFdD]?\\>" + "\\|" + "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>" + "\\|" + "\\<0[xX][[:xdigit:]]+[lL]?\\>" + "\\|" + "\\<[0-9]+[lLfFdD]?\\>" + "\\)" + ) "Regular expression for matching a number. If this value is nil, no number extraction is done during lex. This expression tries to match C and Java like numbers. diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el index 213eecf88d4..fe7e4506d7c 100644 --- a/lisp/emacs-lisp/cl-indent.el +++ b/lisp/emacs-lisp/cl-indent.el @@ -378,10 +378,9 @@ instead." function) (setq tentative-defun t)) ((string-match - (eval-when-compile - (concat "\\`\\(" - (regexp-opt '("with" "without" "do")) - "\\)-")) + (concat "\\`\\(" + (regexp-opt '("with" "without" "do")) + "\\)-") function) (setq method '(&lambda &body)))))) ;; backwards compatibility. Bletch. diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index ab572d57952..888e3397199 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -100,48 +100,45 @@ (list (list nil (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '("defun" "defmacro" - ;; Elisp. - "defun*" "defsubst" "define-inline" - "define-advice" "defadvice" "define-skeleton" - "define-compilation-mode" "define-minor-mode" - "define-global-minor-mode" - "define-globalized-minor-mode" - "define-derived-mode" "define-generic-mode" - "ert-deftest" - "cl-defun" "cl-defsubst" "cl-defmacro" - "cl-define-compiler-macro" "cl-defgeneric" - "cl-defmethod" - ;; CL. - "define-compiler-macro" "define-modify-macro" - "defsetf" "define-setf-expander" - "define-method-combination" - ;; CLOS and EIEIO - "defgeneric" "defmethod") - t)) + (regexp-opt + '("defun" "defmacro" + ;; Elisp. + "defun*" "defsubst" "define-inline" + "define-advice" "defadvice" "define-skeleton" + "define-compilation-mode" "define-minor-mode" + "define-global-minor-mode" + "define-globalized-minor-mode" + "define-derived-mode" "define-generic-mode" + "ert-deftest" + "cl-defun" "cl-defsubst" "cl-defmacro" + "cl-define-compiler-macro" "cl-defgeneric" + "cl-defmethod" + ;; CL. + "define-compiler-macro" "define-modify-macro" + "defsetf" "define-setf-expander" + "define-method-combination" + ;; CLOS and EIEIO + "defgeneric" "defmethod") + t) "\\s-+\\(" (rx lisp-mode-symbol) "\\)")) 2) ;; Like the previous, but uses a quoted symbol as the name. (list nil (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '("defalias" "define-obsolete-function-alias") - t)) + (regexp-opt + '("defalias" "define-obsolete-function-alias") + t) "\\s-+'\\(" (rx lisp-mode-symbol) "\\)")) 2) (list (purecopy "Variables") (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '(;; Elisp - "defconst" "defcustom" - ;; CL - "defconstant" - "defparameter" "define-symbol-macro") - t)) + (regexp-opt + '(;; Elisp + "defconst" "defcustom" + ;; CL + "defconstant" + "defparameter" "define-symbol-macro") + t) "\\s-+\\(" (rx lisp-mode-symbol) "\\)")) 2) ;; For `defvar'/`defvar-local', we ignore (defvar FOO) constructs. @@ -152,18 +149,17 @@ 1) (list (purecopy "Types") (purecopy (concat "^\\s-*(" - (eval-when-compile - (regexp-opt - '(;; Elisp - "defgroup" "deftheme" - "define-widget" "define-error" - "defface" "cl-deftype" "cl-defstruct" - ;; CL - "deftype" "defstruct" - "define-condition" "defpackage" - ;; CLOS and EIEIO - "defclass") - t)) + (regexp-opt + '(;; Elisp + "defgroup" "deftheme" + "define-widget" "define-error" + "defface" "cl-deftype" "cl-defstruct" + ;; CL + "deftype" "defstruct" + "define-condition" "defpackage" + ;; CLOS and EIEIO + "defclass") + t) "\\s-+'?\\(" (rx lisp-mode-symbol) "\\)")) 2)) @@ -273,8 +269,7 @@ to a package-local <package>-loaddefs.el file.") ;; FIXME: Move to elisp-mode.el. (catch 'found (while (re-search-forward - (eval-when-compile - (concat "(\\(" (rx lisp-mode-symbol) "\\)\\_>")) + (concat "(\\(" (rx lisp-mode-symbol) "\\)\\_>") limit t) (let ((sym (intern-soft (match-string 1)))) (when (and (or (special-form-p sym) (macrop sym)) @@ -591,16 +586,15 @@ This will generate compile-time constants from BINDINGS." "Gaudy highlighting from Emacs Lisp mode used in Backtrace mode.") (defun lisp-string-in-doc-position-p (listbeg startpos) - "Return non-nil if a doc string may occur at STARTPOS inside a list. + "Return non-nil if a doc string may occur at STARTPOS inside a list. LISTBEG is the position of the start of the innermost list containing STARTPOS." (let* ((firstsym (and listbeg (save-excursion (goto-char listbeg) (and (looking-at - (eval-when-compile - (concat "([ \t\n]*\\(" - (rx lisp-mode-symbol) "\\)"))) + (concat "([ \t\n]*\\(" + (rx lisp-mode-symbol) "\\)")) (match-string 1))))) (docelt (and firstsym (function-get (intern-soft firstsym) diff --git a/lisp/emacs-lisp/shorthands.el b/lisp/emacs-lisp/shorthands.el index 75cbe5f1923..ffd3856db6c 100644 --- a/lisp/emacs-lisp/shorthands.el +++ b/lisp/emacs-lisp/shorthands.el @@ -61,8 +61,7 @@ (defun shorthands-font-lock-shorthands (limit) (when read-symbol-shorthands (while (re-search-forward - (eval-when-compile - (concat "\\_<\\(" (rx lisp-mode-symbol) "\\)\\_>")) + (concat "\\_<\\(" (rx lisp-mode-symbol) "\\)\\_>") limit t) (let* ((existing (get-text-property (match-beginning 1) 'face)) (probe (and (not (memq existing '(font-lock-comment-face diff --git a/lisp/net/socks.el b/lisp/net/socks.el index 8df0773e1d2..2ba1c20566f 100644 --- a/lisp/net/socks.el +++ b/lisp/net/socks.el @@ -407,11 +407,10 @@ When ATYPE indicates an IP, param ADDRESS must be given as raw bytes." (setq version (process-get proc 'socks-server-protocol)) (cond ((equal version 'http) - (setq request (format (eval-when-compile - (concat - "CONNECT %s:%d HTTP/1.0\r\n" - "User-Agent: Emacs/SOCKS v1.0\r\n" - "\r\n")) + (setq request (format (concat + "CONNECT %s:%d HTTP/1.0\r\n" + "User-Agent: Emacs/SOCKS v1.0\r\n" + "\r\n") (cond ((equal atype socks-address-type-name) address) (t diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el index 5aaa277431a..34288e0e4fb 100644 --- a/lisp/progmodes/meta-mode.el +++ b/lisp/progmodes/meta-mode.el @@ -108,30 +108,27 @@ (macro-keywords-2 "\\(primarydef\\|secondarydef\\|tertiarydef\\)") (args-keywords - (eval-when-compile - (regexp-opt - '("expr" "suffix" "text" "primary" "secondary" "tertiary") - t))) + (regexp-opt + '("expr" "suffix" "text" "primary" "secondary" "tertiary") + t)) (type-keywords - (eval-when-compile - (regexp-opt - '("boolean" "color" "numeric" "pair" "path" "pen" "picture" - "string" "transform" "newinternal") - t))) + (regexp-opt + '("boolean" "color" "numeric" "pair" "path" "pen" "picture" + "string" "transform" "newinternal") + t)) (syntactic-keywords - (eval-when-compile - (regexp-opt - '("for" "forever" "forsuffixes" "endfor" - "step" "until" "upto" "downto" "thru" "within" - "iff" "if" "elseif" "else" "fi" "exitif" "exitunless" - "let" "def" "vardef" "enddef" "mode_def" - "true" "false" "known" "unknown" "and" "or" "not" - "save" "interim" "inner" "outer" "relax" - "begingroup" "endgroup" "expandafter" "scantokens" - "generate" "input" "endinput" "end" "bye" - "message" "errmessage" "errhelp" "special" "numspecial" - "readstring" "readfrom" "write") - t))) + (regexp-opt + '("for" "forever" "forsuffixes" "endfor" + "step" "until" "upto" "downto" "thru" "within" + "iff" "if" "elseif" "else" "fi" "exitif" "exitunless" + "let" "def" "vardef" "enddef" "mode_def" + "true" "false" "known" "unknown" "and" "or" "not" + "save" "interim" "inner" "outer" "relax" + "begingroup" "endgroup" "expandafter" "scantokens" + "generate" "input" "endinput" "end" "bye" + "message" "errmessage" "errhelp" "special" "numspecial" + "readstring" "readfrom" "write") + t)) ) (list ;; embedded TeX code in btex ... etex diff --git a/lisp/shell.el b/lisp/shell.el index 8bcc578406a..85225b128ab 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -440,12 +440,11 @@ Useful for shells like zsh that has this feature." (push (point) begins) (let ((arg ())) (while (looking-at - (eval-when-compile - (concat - "\\(?:[^\s\t\n\\\"';]+" - "\\|'\\([^']*\\)'?" - "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?" - "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)"))) + (concat + "\\(?:[^\s\t\n\\\"';]+" + "\\|'\\([^']*\\)'?" + "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?" + "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")) (goto-char (match-end 0)) (cond ((match-beginning 3) ;Backslash escape. diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index ff881377a7e..13ff3dcab6a 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -600,12 +600,11 @@ Do \\[describe-key] on the following bindings to discover what they do. (setq-local tildify-foreach-region-function (apply-partially 'tildify-foreach-ignore-environments - `((,(eval-when-compile - (concat - "<\\(" - (regexp-opt '("pre" "dfn" "code" "samp" "kbd" "var" - "PRE" "DFN" "CODE" "SAMP" "KBD" "VAR")) - "\\)\\>[^>]*>")) + `((,(concat + "<\\(" + (regexp-opt '("pre" "dfn" "code" "samp" "kbd" "var" + "PRE" "DFN" "CODE" "SAMP" "KBD" "VAR")) + "\\)\\>[^>]*>") . ("</" 1 ">")) ("<! *--" . "-- *>") ("<" . ">")))) diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 473643bb483..e90d214a127 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -983,14 +983,13 @@ Inherits `shell-mode-map' with a few additions.") (when (and slash (not comment)) (setq mode (if (looking-at - (eval-when-compile - (concat - (regexp-opt '("documentstyle" "documentclass" - "begin" "subsection" "section" - "part" "chapter" "newcommand" - "renewcommand" "RequirePackage") - 'words) - "\\|NeedsTeXFormat{LaTeX"))) + (concat + (regexp-opt '("documentstyle" "documentclass" + "begin" "subsection" "section" + "part" "chapter" "newcommand" + "renewcommand" "RequirePackage") + 'words) + "\\|NeedsTeXFormat{LaTeX")) (if (and (looking-at "document\\(style\\|class\\)\\(\\[.*\\]\\)?{slides}") ;; SliTeX is almost never used any more nowadays. @@ -1242,11 +1241,10 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook (apply-partially #'tildify-foreach-ignore-environments `(("\\\\\\\\" . "") ; do not remove this - (,(eval-when-compile - (concat "\\\\begin{\\(" - (regexp-opt '("verbatim" "math" "displaymath" - "equation" "eqnarray" "eqnarray*")) - "\\)}")) + (,(concat "\\\\begin{\\(" + (regexp-opt '("verbatim" "math" "displaymath" + "equation" "eqnarray" "eqnarray*")) + "\\)}") . ("\\\\end{" 1 "}")) ("\\\\verb\\*?\\(.\\)" . (1)) ("\\$\\$?" . (0)) @@ -2126,11 +2124,10 @@ If NOT-ALL is non-nil, save the `.dvi' file." (defvar tex-compile-history nil) (defvar tex-input-files-re - (eval-when-compile - (concat "\\." (regexp-opt '("tex" "texi" "texinfo" - "bbl" "ind" "sty" "cls") t) - ;; Include files with no dots (for directories). - "\\'\\|\\`[^.]+\\'"))) + (concat "\\." (regexp-opt '("tex" "texi" "texinfo" + "bbl" "ind" "sty" "cls") t) + ;; Include files with no dots (for directories). + "\\'\\|\\`[^.]+\\'")) (defcustom tex-use-reftex t "If non-nil, use RefTeX's list of files to determine what command to use." diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el index 9dcfb10d6df..2a7ad295ab7 100644 --- a/lisp/textmodes/tildify.el +++ b/lisp/textmodes/tildify.el @@ -494,9 +494,8 @@ variable will be set to the representation." (if (not (string-equal " " (or space tildify-space-string))) (when space (setq tildify-space-string space)) - (message (eval-when-compile - (concat "Hard space is a single space character, tildify-" - "mode won't have any effect, disabling."))) + (message (concat "Hard space is a single space character, tildify-" + "mode won't have any effect, disabling.")) (setq tildify-mode nil)))) (if tildify-mode (add-hook 'post-self-insert-hook #'tildify-space nil t) diff --git a/lisp/xdg.el b/lisp/xdg.el index 6a0b1dedd1d..c7d9c0e785e 100644 --- a/lisp/xdg.el +++ b/lisp/xdg.el @@ -171,13 +171,12 @@ file:///foo/bar.jpg" ;; https://www.freedesktop.org/wiki/Software/xdg-user-dirs/ (defconst xdg-line-regexp - (eval-when-compile - (rx "XDG_" - (group-n 1 (or "DESKTOP" "DOWNLOAD" "TEMPLATES" "PUBLICSHARE" - "DOCUMENTS" "MUSIC" "PICTURES" "VIDEOS")) - "_DIR=\"" - (group-n 2 (or "/" "$HOME/") (*? (or (not (any "\"")) "\\\""))) - "\"")) + (rx "XDG_" + (group-n 1 (or "DESKTOP" "DOWNLOAD" "TEMPLATES" "PUBLICSHARE" + "DOCUMENTS" "MUSIC" "PICTURES" "VIDEOS")) + "_DIR=\"" + (group-n 2 (or "/" "$HOME/") (*? (or (not (any "\"")) "\\\""))) + "\"") "Regexp matching non-comment lines in `xdg-user-dirs' config files.") (defvar xdg-user-dirs nil |