]> git.eshelyaron.com Git - emacs.git/commitdiff
Use %s to format strings instead of splicing them
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 20 Sep 2015 16:40:35 +0000 (09:40 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 20 Sep 2015 16:42:05 +0000 (09:42 -0700)
If FOO might contain quotes that are part of a file or variable
name, the quotes should not be translated when showing FOO’s name
in a diagnostic.  So, for example, (message (concat (FOO ": bar")))
is not quite right, as it would translate FOO’s quotes.
Change it to (message "%s: bar" FOO) instead.
* lisp/allout.el (allout-process-exposed):
* lisp/calc/calc-ext.el (calc-do-prefix-help):
* lisp/calc/calc-store.el (calc-store-into):
* lisp/calendar/todo-mode.el (todo-category-completions):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/org/ob-latex.el (convert-pdf):
* lisp/org/org-crypt.el (org-crypt-check-auto-save):
* lisp/org/ox-latex.el (org-latex-compile):
* lisp/org/ox-man.el (org-man-compile):
* lisp/org/ox-odt.el (org-odt--export-wrap):
* lisp/org/ox-texinfo.el (org-texinfo-compile):
* lisp/progmodes/ruby-mode.el (ruby-in-ppss-context-p):
* lisp/progmodes/verilog-mode.el (verilog-batch-execute-func)
(verilog-signals-combine-bus, verilog-read-defines)
(verilog-getopt-file, verilog-expand-dirnames)
(verilog-modi-lookup, verilog-modi-modport-lookup-one):
* lisp/term/ns-win.el (ns-spi-service-call):
Use %s to avoid translating quotes of file names etc. in diagnostics.

14 files changed:
lisp/allout.el
lisp/calc/calc-ext.el
lisp/calc/calc-store.el
lisp/calendar/todo-mode.el
lisp/cedet/semantic/complete.el
lisp/org/ob-latex.el
lisp/org/org-crypt.el
lisp/org/ox-latex.el
lisp/org/ox-man.el
lisp/org/ox-odt.el
lisp/org/ox-texinfo.el
lisp/progmodes/ruby-mode.el
lisp/progmodes/verilog-mode.el
lisp/term/ns-win.el

index bbd69cd83477c90487001c3a5644f89c630d0d39..5273fe2b4335aa2737460839d8061dede4134d4a 100644 (file)
@@ -5562,9 +5562,8 @@ Defaults:
          ;; Specified but not a buffer -- get it:
          (let ((got (get-buffer frombuf)))
            (if (not got)
-               (error (concat "allout-process-exposed: source buffer "
-                              frombuf
-                              " not found."))
+               (error "allout-process-exposed: source buffer %s not found."
+                      frombuf)
              (setq frombuf got))))
     ;; not specified -- default it:
     (setq frombuf (current-buffer)))
index 83722e761b0f03b9ffc189ef0c6b213ff182de83..933c446875e08026b5ac016db914910222ed34e8 100644 (file)
@@ -1327,9 +1327,8 @@ calc-kill calc-kill-region calc-yank))))
       (setq calc-prefix-help-retry (= chr ??))
       (if bnd
           (call-interactively bnd)
-        (if key
-            (message (concat (key-description (vector key chr))  " is undefined"))
-          (message (concat (key-description (vector chr))  " is undefined")))))))
+        (message "%s is undefined"
+                 (key-description (if key (vector key chr) (vector chr))))))))
 
 ;;;; Commands.
 
index 3d8c865c7bf9c2f5770e5876fa2226f629c02999..21209c6667766ad64766df46bbcf19607fe16426 100644 (file)
@@ -58,8 +58,8 @@
              (let ((msg
                     (calc-store-value var (or calc-given-value (calc-top 1))
                                       "" calc-given-value-flag)))
-               (message (concat "Stored to variable \"%s\"" msg)
-                        (calc-var-name var)))))
+               (message "Stored to variable \"%s\"%s"
+                        (calc-var-name var) msg))))
        (setq var (calc-is-assignments (calc-top 1)))
        (if var
           (while var
@@ -67,8 +67,8 @@
                     (calc-store-value (car (car var)) (cdr (car var))
                                       (if (not (cdr var)) "")
                                       (if (not (cdr var)) 1))))
-               (message (concat "Stored to variable \"%s\"" msg)
-                        (calc-var-name (car (car var)))))
+               (message "Stored to variable \"%s\"%s"
+                        (calc-var-name (car (car var))) msg))
             (setq var (cdr var))))))))
 
 (defun calc-store-plus (&optional var)
                                       (calc-var-name var1)))))
         (if var2
             (let ((msg (calc-store-value var2 value "")))
-               (message (concat "Variable \"%s\" copied to \"%s\"" msg)
-                        (calc-var-name var1) (calc-var-name var2))))))))
+               (message "Variable \"%s\" copied to \"%s\"%s"
+                        (calc-var-name var1) (calc-var-name var2) msg)))))))
 
 (defvar calc-last-edited-variable nil)
 (defun calc-edit-variable (&optional var)
index 527548f78b6f51d51305c4e99dda676d35c3ff07..27ca17b4e4fe1641a2b0eb4915279e8c3718d029 100644 (file)
@@ -5643,9 +5643,10 @@ have been removed."
     (when deleted
       (let ((pl (> (length deleted) 1))
            (names (mapconcat (lambda (f) (concat "\"" f "\"")) deleted ", ")))
-       (message (concat "File" (if pl "s" "") " " names " ha" (if pl "ve" "s")
+       (message (concat "File" (if pl "s" "") " %s ha" (if pl "ve" "s")
                         " been deleted and removed from\n"
-                        "the list of category completion files")))
+                        "the list of category completion files")
+                names))
       (todo-reevaluate-category-completions-files-defcustom)
       (custom-set-default 'todo-category-completions-files
                          (symbol-value 'todo-category-completions-files))
index d32b2c4f001578df4169ea639b1a2f708b329799..9b7882c7acd3d4c66bfbad1524f7d4915cb2c62e 100644 (file)
@@ -156,7 +156,7 @@ Presumably if you call this you will insert something new there."
   "Display the string FMT formatted with ARGS at the end of the minibuffer."
   (if semantic-complete-inline-overlay
       (apply 'message fmt args)
-    (message (concat (buffer-string) (apply #'format-message fmt args)))))
+    (apply 'message (concat "%s" fmt) (buffer-string) args)))
 
 ;;; ------------------------------------------------------------
 ;;; MINIBUFFER: Option Selection harnesses
index d0a413f11727ce969aded31c93850a23a8486fcc..811c9ef92c6ee986ea1b6e0c2650bb30f6b34f18 100644 (file)
@@ -183,7 +183,7 @@ This function is called by `org-babel-execute-src-block'."
   "Generate a file from a pdf file using imagemagick."
   (let ((cmd (concat "convert " im-in-options " " pdffile " "
                     im-out-options " " out-file)))
-    (message (concat "Converting pdffile file " cmd  "..."))
+    (message "Converting pdffile file %s..." cmd)
     (shell-command cmd)))
 
 (defun org-babel-latex-tex-to-pdf (file)
index f527673cbd4d22e68ffb2ea5297aa0e0de3357a3..2b3445e47cd5af1a1f86ef6d92857e2f2097d164 100644 (file)
@@ -133,9 +133,10 @@ See `org-crypt-disable-auto-save'."
        (and
        (eq org-crypt-disable-auto-save 'ask)
        (y-or-n-p "org-decrypt: auto-save-mode may cause leakage.  Disable it for current buffer? ")))
-      (message (concat "org-decrypt: Disabling auto-save-mode for " (or (buffer-file-name) (current-buffer))))
-                                       ; The argument to auto-save-mode has to be "-1", since
-                                       ; giving a "nil" argument toggles instead of disabling.
+      (message "org-decrypt: Disabling auto-save-mode for %s"
+               (or (buffer-file-name) (current-buffer)))
+      ;; The argument to auto-save-mode has to be "-1", since
+      ;; giving a "nil" argument toggles instead of disabling.
       (auto-save-mode -1))
      ((eq org-crypt-disable-auto-save nil)
       (message "org-decrypt: Decrypting entry with auto-save-mode enabled.  This may cause leakage."))
index 91a864eee6e6e7bb24817c8501ca8617ed5f1e12..51f7b17a8bf08114bf38d1fd549390fcd5cd1f33 100644 (file)
@@ -2876,8 +2876,8 @@ Return PDF file name or an error if it couldn't be produced."
        ;; Check for process failure.  Provide collected errors if
        ;; possible.
        (if (not (file-exists-p pdffile))
-           (error (concat (format "PDF file %s wasn't produced" pdffile)
-                          (when errors (concat ": " errors))))
+           (error "PDF file %s wasn't produced%s" pdffile
+                  (if errors (concat ": " errors) ""))
          ;; Else remove log files, when specified, and signal end of
          ;; process to user, along with any error encountered.
          (when (and (not snippet) org-latex-remove-logfiles)
index d7adcd5486db7bbf22518e7a77a011b0996c4a04..09ad1866c0ef815d6af032163f1918a69a7f300d 100644 (file)
@@ -1219,8 +1219,8 @@ Return PDF file name or an error if it couldn't be produced."
        ;; Check for process failure.  Provide collected errors if
        ;; possible.
        (if (not (file-exists-p pdffile))
-           (error (concat (format "PDF file %s wasn't produced" pdffile)
-                          (when errors (concat ": " errors))))
+           (error "PDF file %s wasn't produced%s" pdffile
+                  (if errors (concat ": " errors) ""))
          ;; Else remove log files, when specified, and signal end of
          ;; process to user, along with any error encountered.
          (when org-man-remove-logfiles
index 1ee201ba23f4cb400e608b93647e1512e75cf988..9abda33f59ddae68b5cb69de300cbd90465304ff 100644 (file)
@@ -4089,8 +4089,8 @@ contextual information."
                                         nil standard-output nil (cdr cmd)))))
                    (or (zerop exitcode)
                        (error (concat "Unable to create OpenDocument file."
-                                      (format "  Zip failed with error (%s)"
-                                              err-string)))))
+                                      "  Zip failed with error (%s)")
+                              err-string)))
                  cmds)))
             ;; Move the zip file from temporary work directory to
             ;; user-mandated location.
index 5130329d4b4b0b0e76e8d8e0c0557784c568f6c0..67daf6f979ed853d11e738651ec3ea97f23197e9 100644 (file)
@@ -1534,8 +1534,8 @@ Return INFO file name or an error if it couldn't be produced."
        ;; Check for process failure.  Provide collected errors if
        ;; possible.
        (if (not (file-exists-p infofile))
-           (error (concat (format "INFO file %s wasn't produced" infofile)
-                          (when errors (concat ": " errors))))
+           (error "INFO file %s wasn't produced%s" infofile
+                  (if errors (concat ": " errors) ""))
          ;; Else remove log files, when specified, and signal end of
          ;; process to user, along with any error encountered.
          (when org-texinfo-remove-logfiles
index a5efb934a22da804aa142d2e246b22ec78641f2a..09338860c7520cb7bfa489e09d1012a1f7ce8296 100644 (file)
@@ -2007,7 +2007,8 @@ It will be properly highlighted even when the call omits parens.")
          (t
           (error (concat
                   "Internal error on `ruby-in-ppss-context-p': "
-                  "context name `" (symbol-name context) "' is unknown"))))
+                  "context name `%s' is unknown")
+                 context)))
         t)))
 
 (defvar ruby-font-lock-syntax-table
index 85733e161905bf9ea2599d9c1c84b5320e015324..489094b2e4fdbf6ed683a094178d11cae61ab3ef 100644 (file)
@@ -5301,8 +5301,8 @@ Save the result unless optional NO-SAVE is t."
                 (save-excursion
                   (if (not (file-exists-p (buffer-file-name buf)))
                       (error
-                       (concat "File not found: " (buffer-file-name buf))))
-                  (message (concat "Processing " (buffer-file-name buf)))
+                       "File not found: %s" (buffer-file-name buf)))
+                  (message "Processing %s" (buffer-file-name buf))
                   (set-buffer buf)
                   (funcall funref)
                   (when (and (not no-save)
@@ -8074,9 +8074,9 @@ Duplicate signals are also removed.  For example A[2] and A[1] become A[2:1]."
             (when (and sv-busstring
                        (not (equal sv-busstring (verilog-sig-bits sig))))
                (when nil  ; Debugging
-                (message (concat "Warning, can't merge into single bus "
-                                 sv-name bus
-                                 ", the AUTOs may be wrong")))
+                (message (concat "Warning, can't merge into single bus %s%s"
+                                 ", the AUTOs may be wrong")
+                         sv-name bus))
               (setq buswarn ", Couldn't Merge"))
             (if (verilog-sig-comment sig) (setq combo ", ..."))
             (setq sv-memory (or sv-memory (verilog-sig-memory sig))
@@ -9325,8 +9325,8 @@ warning message, you need to add to your init file:
        (let ((fns (verilog-library-filenames filename (buffer-file-name))))
          (if fns
              (set-buffer (find-file-noselect (car fns)))
-           (error (concat (verilog-point-text)
-                          ": Can't find verilog-read-defines file: " filename)))))
+           (error "%s: Can't find verilog-read-defines file: %s"
+                  (verilog-point-text) filename))))
       (when recurse
        (goto-char (point-min))
        (while (re-search-forward "^\\s-*`include\\s-+\\([^ \t\n\f]+\\)" nil t)
@@ -9507,8 +9507,8 @@ Some macros and such are also found and included.  For dinotrace.el."
          line)
       (if fns
          (set-buffer (find-file-noselect (car fns)))
-       (error (concat (verilog-point-text)
-                      ": Can't find verilog-getopt-file -f file: " filename)))
+       (error "%s: Can't find verilog-getopt-file -f file: %s"
+              (verilog-point-text) filename))
       (goto-char (point-min))
       (while (not (eobp))
        (setq line (buffer-substring (point) (point-at-eol)))
@@ -9710,7 +9710,8 @@ Or, just the existing dirnames themselves if there are no wildcards."
   ;; Note this function is performance critical.
   ;; Do not call anything that requires disk access that cannot be cached.
   (interactive)
-  (unless dirnames (error "`verilog-library-directories' should include at least '.'"))
+  (unless dirnames
+    (error "`verilog-library-directories' should include at least `.'"))
   (setq dirnames (reverse dirnames))   ; not nreverse
   (let ((dirlist nil)
        pattern dirfile dirfiles dirname root filename rest basefile)
@@ -9889,17 +9890,18 @@ Return modi if successful, else print message unless IGNORE-ERROR is true."
                 (if (not (setq mif (verilog-module-inside-filename-p realname (car filenames))))
                     (setq filenames (cdr filenames))))
               ;; mif has correct form to become later elements of modi
-              (cond (mif (setq modi mif))
-                    (t (setq modi nil)
-                       (or ignore-error
-                           (error (concat (verilog-point-text)
-                                          ": Can't locate " module " module definition"
-                                          (if (not (equal module realname))
-                                              (concat " (Expanded macro to " realname ")")
-                                            "")
-                                          "\n    Check the verilog-library-directories variable."
-                                          "\n    I looked in (if not listed, doesn't exist):\n\t"
-                                          (mapconcat 'concat orig-filenames "\n\t"))))))
+              (setq modi mif)
+              (or mif ignore-error
+                  (error
+                   (concat
+                    "%s: Can't locate %s module definition%s"
+                    "\n    Check the verilog-library-directories variable."
+                    "\n    I looked in (if not listed, doesn't exist):\n\t%s")
+                   (verilog-point-text) module
+                   (if (not (equal module realname))
+                       (concat " (Expanded macro to " realname ")")
+                     "")
+                   (mapconcat 'concat orig-filenames "\n\t")))
               (when (eval-when-compile (fboundp 'make-hash-table))
                 (unless verilog-modi-lookup-cache
                   (setq verilog-modi-lookup-cache
@@ -10001,11 +10003,11 @@ Report errors unless optional IGNORE-ERROR."
   (let* ((realname (verilog-symbol-detick name t))
         (modport (assoc name (verilog-decls-get-modports (verilog-modi-get-decls modi)))))
     (or modport ignore-error
-       (error (concat (verilog-point-text)
-                      ": Can't locate " name " modport definition"
-                      (if (not (equal name realname))
-                          (concat " (Expanded macro to " realname ")")
-                        ""))))
+       (error "%s: Can't locate %s modport definition%s"
+               (verilog-point-text) name
+               (if (not (equal name realname))
+                   (concat " (Expanded macro to " realname ")")
+                 "")))
     (let* ((decls (verilog-modport-decls modport))
           (clks (verilog-modport-clockings modport)))
       ;; Now expand any clocking's
index a21c105fb982fe97154e1557b1c7a67bba806562..373f81238a273384b8441877de2b949a5fa47cef 100644 (file)
@@ -243,7 +243,7 @@ The properties returned may include `top', `left', `height', and `width'."
         (insert ns-input-spi-arg))
        ((string-equal ns-input-spi-name "mail-to")
         (compose-mail ns-input-spi-arg))
-       (t (error (concat "Service " ns-input-spi-name " not recognized")))))
+       (t (error "Service %s not recognized" ns-input-spi-name))))
 
 
 ;; Composed key sequence handling for Nextstep system input methods.