aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-03-07 09:02:15 -0800
committerPaul Eggert2019-03-07 09:05:56 -0800
commit3739d51ef3b935b30e40ba4534fe362bc685865f (patch)
treeada093c6c9464828035b59a9f56f90a367b57d3a
parent953cbce77be9a8da1cbf0ca5ee6442923478e186 (diff)
downloademacs-3739d51ef3b935b30e40ba4534fe362bc685865f.tar.gz
emacs-3739d51ef3b935b30e40ba4534fe362bc685865f.zip
Be safer about "%" in message formats
* lisp/calc/calc-store.el (calc-copy-special-constant): * lisp/net/rcirc.el (rcirc-handler-PART, rcirc-handler-KICK): * lisp/org/org-agenda.el (org-agenda): * lisp/org/org-clock.el (org-clock-out, org-clock-display): * lisp/org/org.el (org-refile): * lisp/progmodes/ada-xref.el (ada-goto-declaration): * lisp/progmodes/idlwave.el (idlwave-scan-library-catalogs): Don’t trust arbitrary strings to not contain "%" or "`" in (message (concat STRING1 STRING2 ...)).
-rw-r--r--lisp/calc/calc-store.el4
-rw-r--r--lisp/net/rcirc.el4
-rw-r--r--lisp/org/org-agenda.el13
-rw-r--r--lisp/org/org-clock.el22
-rw-r--r--lisp/org/org.el3
-rw-r--r--lisp/progmodes/ada-xref.el3
-rw-r--r--lisp/progmodes/idlwave.el7
7 files changed, 28 insertions, 28 deletions
diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el
index 589a776c413..3987c129c23 100644
--- a/lisp/calc/calc-store.el
+++ b/lisp/calc/calc-store.el
@@ -405,8 +405,8 @@
405 sconst)))) 405 sconst))))
406 (if var 406 (if var
407 (let ((msg (calc-store-value var value ""))) 407 (let ((msg (calc-store-value var value "")))
408 (message (concat "Special constant \"%s\" copied to \"%s\"" msg) 408 (message "Special constant \"%s\" copied to \"%s\"%s"
409 sconst (calc-var-name var))))))))) 409 sconst (calc-var-name var) msg))))))))
410 410
411(defun calc-copy-variable (&optional var1 var2) 411(defun calc-copy-variable (&optional var1 var2)
412 (interactive) 412 (interactive)
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index b1a6c1ce8d2..9d53cd4436b 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -2685,7 +2685,7 @@ the only argument."
2685(defun rcirc-handler-PART (process sender args _text) 2685(defun rcirc-handler-PART (process sender args _text)
2686 (let* ((channel (car args)) 2686 (let* ((channel (car args))
2687 (reason (cadr args)) 2687 (reason (cadr args))
2688 (message (concat channel " " reason))) 2688 (message "%s %s" channel reason))
2689 (rcirc-print process sender "PART" channel message) 2689 (rcirc-print process sender "PART" channel message)
2690 ;; print in private chat buffer if it exists 2690 ;; print in private chat buffer if it exists
2691 (when (rcirc-get-buffer (rcirc-buffer-process) sender) 2691 (when (rcirc-get-buffer (rcirc-buffer-process) sender)
@@ -2697,7 +2697,7 @@ the only argument."
2697 (let* ((channel (car args)) 2697 (let* ((channel (car args))
2698 (nick (cadr args)) 2698 (nick (cadr args))
2699 (reason (nth 2 args)) 2699 (reason (nth 2 args))
2700 (message (concat nick " " channel " " reason))) 2700 (message "%s %s %s" nick channel reason))
2701 (rcirc-print process sender "KICK" channel message t) 2701 (rcirc-print process sender "KICK" channel message t)
2702 ;; print in private chat buffer if it exists 2702 ;; print in private chat buffer if it exists
2703 (when (rcirc-get-buffer (rcirc-buffer-process) nick) 2703 (when (rcirc-get-buffer (rcirc-buffer-process) nick)
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index e416f5f062a..23ee8d71e66 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -2882,13 +2882,12 @@ Pressing `<' twice means to restrict to the current subtree or region
2882 (let* ((m (org-agenda-get-any-marker)) 2882 (let* ((m (org-agenda-get-any-marker))
2883 (note (and m (org-entry-get m "THEFLAGGINGNOTE")))) 2883 (note (and m (org-entry-get m "THEFLAGGINGNOTE"))))
2884 (when note 2884 (when note
2885 (message (concat 2885 (message "FLAGGING-NOTE ([?] for more info): %s"
2886 "FLAGGING-NOTE ([?] for more info): " 2886 (org-add-props
2887 (org-add-props 2887 (replace-regexp-in-string
2888 (replace-regexp-in-string 2888 "\\\\n" "//"
2889 "\\\\n" "//" 2889 (copy-sequence note))
2890 (copy-sequence note)) 2890 nil 'face 'org-warning))))))
2891 nil 'face 'org-warning)))))))
2892 t t)) 2891 t t))
2893 ((equal org-keys "#") (call-interactively 'org-agenda-list-stuck-projects)) 2892 ((equal org-keys "#") (call-interactively 'org-agenda-list-stuck-projects))
2894 ((equal org-keys "/") (call-interactively 'org-occur-in-agenda-files)) 2893 ((equal org-keys "/") (call-interactively 'org-occur-in-agenda-files))
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 34b694d4879..62c7cd92d12 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -1622,9 +1622,10 @@ to, overriding the existing value of `org-clock-out-switch-to-state'."
1622 "\\>")))) 1622 "\\>"))))
1623 (org-todo org-clock-out-switch-to-state)))))) 1623 (org-todo org-clock-out-switch-to-state))))))
1624 (force-mode-line-update) 1624 (force-mode-line-update)
1625 (message (concat "Clock stopped at %s after " 1625 (message (if remove
1626 (org-duration-from-minutes (+ (* 60 h) m)) "%s") 1626 "Clock stopped at %s after %s => LINE REMOVED"
1627 te (if remove " => LINE REMOVED" "")) 1627 "Clock stopped at %s after %s")
1628 te (org-duration-from-minutes (+ (* 60 h) m)))
1628 (run-hooks 'org-clock-out-hook) 1629 (run-hooks 'org-clock-out-hook)
1629 (unless (org-clocking-p) 1630 (unless (org-clocking-p)
1630 (setq org-clock-current-task nil))))))) 1631 (setq org-clock-current-task nil)))))))
@@ -1925,13 +1926,14 @@ Use `\\[org-clock-remove-overlays]' to remove the subtree times."
1925 nil 'local)))) 1926 nil 'local))))
1926 (let* ((h (/ org-clock-file-total-minutes 60)) 1927 (let* ((h (/ org-clock-file-total-minutes 60))
1927 (m (- org-clock-file-total-minutes (* 60 h)))) 1928 (m (- org-clock-file-total-minutes (* 60 h))))
1928 (message (concat (format "Total file time%s: " 1929 (message (cond
1929 (cond (todayp " for today") 1930 (todayp
1930 (customp " (custom)") 1931 "Total file time for today: %s (%d hours and %d minutes)")
1931 (t ""))) 1932 (customp
1932 (org-duration-from-minutes 1933 "Total file time (custom): %s (%d hours and %d minutes)")
1933 org-clock-file-total-minutes) 1934 (t
1934 " (%d hours and %d minutes)") 1935 "Total file time: %s (%d hours and %d minutes)"))
1936 (org-duration-from-minutes org-clock-file-total-minutes)
1935 h m)))) 1937 h m))))
1936 1938
1937(defvar-local org-clock-overlays nil) 1939(defvar-local org-clock-overlays nil)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 3a434d12dfd..e3c78ae90d4 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -11878,7 +11878,8 @@ prefix argument (`C-u C-u C-u C-c C-w')."
11878 (when (featurep 'org-inlinetask) 11878 (when (featurep 'org-inlinetask)
11879 (org-inlinetask-remove-END-maybe)) 11879 (org-inlinetask-remove-END-maybe))
11880 (setq org-markers-to-move nil) 11880 (setq org-markers-to-move nil)
11881 (message (concat actionmsg " to \"%s\" in file %s: done") (car it) file))))))) 11881 (message "%s to \"%s\" in file %s: done" actionmsg
11882 (car it) file)))))))
11882 11883
11883(defun org-refile-goto-last-stored () 11884(defun org-refile-goto-last-stored ()
11884 "Go to the location where the last refile was stored." 11885 "Go to the location where the last refile was stored."
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 28c52b0653b..c9c923e1d69 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -1133,8 +1133,7 @@ If OTHER-FRAME is non-nil, display the cross-reference in another frame."
1133 (ada-find-in-ali identlist other-frame) 1133 (ada-find-in-ali identlist other-frame)
1134 ;; File not found: print explicit error message 1134 ;; File not found: print explicit error message
1135 (ada-error-file-not-found 1135 (ada-error-file-not-found
1136 (message (concat (error-message-string err) 1136 (message "%s%s" (error-message-string err) (nthcdr 1 err)))
1137 (nthcdr 1 err))))
1138 1137
1139 (error 1138 (error
1140 (let ((ali-file (ada-get-ali-file-name (ada-file-of identlist)))) 1139 (let ((ali-file (ada-get-ali-file-name (ada-file-of identlist))))
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 476d935e8ae..25bc788ffc4 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -5588,7 +5588,7 @@ be set to nil to disable library catalog scanning."
5588 (mapcar 'car idlwave-path-alist))) 5588 (mapcar 'car idlwave-path-alist)))
5589 (old-libname "") 5589 (old-libname "")
5590 dir-entry dir catalog all-routines) 5590 dir-entry dir catalog all-routines)
5591 (if message-base (message message-base)) 5591 (if message-base (message "%s" message-base))
5592 (while (setq dir (pop dirs)) 5592 (while (setq dir (pop dirs))
5593 (catch 'continue 5593 (catch 'continue
5594 (when (file-readable-p 5594 (when (file-readable-p
@@ -5603,8 +5603,7 @@ be set to nil to disable library catalog scanning."
5603 message-base 5603 message-base
5604 (not (string= idlwave-library-catalog-libname 5604 (not (string= idlwave-library-catalog-libname
5605 old-libname))) 5605 old-libname)))
5606 (message "%s" (concat message-base 5606 (message "%s%s" message-base idlwave-library-catalog-libname)
5607 idlwave-library-catalog-libname))
5608 (setq old-libname idlwave-library-catalog-libname)) 5607 (setq old-libname idlwave-library-catalog-libname))
5609 (when idlwave-library-catalog-routines 5608 (when idlwave-library-catalog-routines
5610 (setq all-routines 5609 (setq all-routines
@@ -5618,7 +5617,7 @@ be set to nil to disable library catalog scanning."
5618 (setq dir-entry (assoc dir idlwave-path-alist))) 5617 (setq dir-entry (assoc dir idlwave-path-alist)))
5619 (idlwave-path-alist-add-flag dir-entry 'lib))))) 5618 (idlwave-path-alist-add-flag dir-entry 'lib)))))
5620 (unless no-load (setq idlwave-library-catalog-routines all-routines)) 5619 (unless no-load (setq idlwave-library-catalog-routines all-routines))
5621 (if message-base (message (concat message-base "done")))))) 5620 (if message-base (message "%sdone" message-base)))))
5622 5621
5623;;----- Communicating with the Shell ------------------- 5622;;----- Communicating with the Shell -------------------
5624 5623