]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove some useless `eval-when-compile`
authorMattias Engdegård <mattiase@acm.org>
Mon, 4 Jul 2022 12:52:50 +0000 (14:52 +0200)
committerMattias Engdegård <mattiase@acm.org>
Mon, 4 Jul 2022 12:56:11 +0000 (14:56 +0200)
* 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.

12 files changed:
lisp/cedet/semantic/java.el
lisp/cedet/semantic/lex.el
lisp/emacs-lisp/cl-indent.el
lisp/emacs-lisp/lisp-mode.el
lisp/emacs-lisp/shorthands.el
lisp/net/socks.el
lisp/progmodes/meta-mode.el
lisp/shell.el
lisp/textmodes/sgml-mode.el
lisp/textmodes/tex-mode.el
lisp/textmodes/tildify.el
lisp/xdg.el

index 9b70afd0a33ba15198d429e0d855bbc0f80b5385..53fd4de2975cd410680965c7e6b36f7b6c660cef 100644 (file)
 ;;; 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.
 
index 885ffbf5a73a3f2211c4bf94ccf71969342115e9..9c64cc9f7e5a6328c07d7bce7e7dd528c6629efe 100644 (file)
@@ -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.
index 213eecf88d43f15ed58f34b8bc959cb11dcf0a51..fe7e4506d7c628f9105bb5209cc4361dfe6d7213 100644 (file)
@@ -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.
index ab572d579525656a2867d462e587738ab63a3ae3..888e3397199b8d1330cd037138aa959b77dccd0b 100644 (file)
   (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.
         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)
index 75cbe5f1923b4fa185bdaceceb57d494af0b0cce..ffd3856db6c9de8608e0e08724f5e174ae4ee40f 100644 (file)
@@ -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
index 8df0773e1d2b06f343c4aae64a692361487d6be6..2ba1c20566f79c627db5938f60fb9cfe1ce0b740 100644 (file)
@@ -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
index 5aaa277431a7d16f1b8b6908388ecaa9905e42b3..34288e0e4fb71393a1e8f510ce34948dd1a5f28c 100644 (file)
             (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
index 8bcc578406ae7818bafeef15915eef582eb8a582..85225b128abf2c8eb281e9e19aee8afc6d6b9afd 100644 (file)
@@ -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.
index ff881377a7e99ca380deeefc9e1ac8b93923d1d5..13ff3dcab6ad2c1efbf49a29d1e06a7bc3c3b144 100644 (file)
@@ -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 ">"))
                  ("<! *--" . "-- *>")
                  ("<" . ">"))))
index 473643bb4837e037a64685589cd8d6c3a7eb2be6..e90d214a1278a34206f3c9752ef2b64be84ba16a 100644 (file)
@@ -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."
index 9dcfb10d6dfdbcdd972221965a5aa61e88654027..2a7ad295ab7d02ddec660847e54700fd97ea62fc 100644 (file)
@@ -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)
index 6a0b1dedd1dcd8b7ea47ca71c62c60c5bfd156e7..c7d9c0e785ebf92dc65e3bc5e3500fec09dd6a90 100644 (file)
@@ -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