]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix some uses of `%s` for non-strings/names
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 14 Feb 2025 16:25:52 +0000 (11:25 -0500)
committerEshel Yaron <me@eshelyaron.com>
Sat, 15 Feb 2025 19:31:04 +0000 (20:31 +0100)
* lisp/files.el (normal-mode, set-auto-mode--apply-alist):
* lisp/gnus/nnimap.el (nnimap-command):
* lisp/emacs-lisp/bytecomp.el (bytecomp--check-cus-type):
Prefer %S over %s for arbitrary sexps and lists.

(cherry picked from commit 300bae4f7c75291c1d1af0eced102ce9b1c44000)

lisp/emacs-lisp/bytecomp.el
lisp/files.el
lisp/gnus/nnimap.el
lisp/vc/diff-mode.el

index 3d90e8e7d2e1e7a97ca5cdb4507c9f0a98bd6c82..e9c55494e3e3ced6960590fdf498832f763f59cc 100644 (file)
@@ -5295,11 +5295,11 @@ FORM is used to provide location, `bytecomp--cus-function' and
                    (and tl
                         (progn
                           (bytecomp--cus-warn
-                           tl "misplaced %s keyword in `%s' type" (car tl) head)
+                           tl "misplaced %S keyword in `%S' type" (car tl) head)
                           t))))))
          ((memq head '(choice radio))
           (unless tail
-            (bytecomp--cus-warn type "`%s' without any types inside" head))
+            (bytecomp--cus-warn type "`%S' without any types inside" head))
           (let ((clauses tail)
                 (constants nil)
                 (tags nil))
@@ -5307,7 +5307,7 @@ FORM is used to provide location, `bytecomp--cus-function' and
               (let* ((ty (car clauses))
                      (ty-head (car-safe ty)))
                 (when (and (eq ty-head 'other) (cdr clauses))
-                  (bytecomp--cus-warn ty "`other' not last in `%s'" head))
+                  (bytecomp--cus-warn ty "`other' not last in `%S'" head))
                 (when (memq ty-head '(const other))
                   (let ((ty-tail (cdr ty))
                         (val nil))
@@ -5319,13 +5319,13 @@ FORM is used to provide location, `bytecomp--cus-function' and
                       (setq val (car ty-tail)))
                     (when (member val constants)
                       (bytecomp--cus-warn
-                       ty "duplicated value in `%s': `%S'" head val))
+                       ty "duplicated value in `%S': `%S'" head val))
                     (push val constants)))
                 (let ((tag (and (consp ty) (plist-get (cdr ty) :tag))))
                   (when (stringp tag)
                     (when (member tag tags)
                       (bytecomp--cus-warn
-                       ty "duplicated :tag string in `%s': %S" head tag))
+                       ty "duplicated :tag string in `%S': %S" head tag))
                     (push tag tags)))
                 (bytecomp--check-cus-type ty))
               (setq clauses (cdr clauses)))))
@@ -5337,7 +5337,7 @@ FORM is used to provide location, `bytecomp--cus-function' and
             (bytecomp--check-cus-type ty)))
          ((memq head '(list group vector set repeat))
           (unless tail
-            (bytecomp--cus-warn type "`%s' without type specs" head))
+            (bytecomp--cus-warn type "`%S' without type specs" head))
           (dolist (ty tail)
             (bytecomp--check-cus-type ty)))
          ((memq head '(alist plist))
@@ -5353,21 +5353,21 @@ FORM is used to provide location, `bytecomp--cus-function' and
                  (val (car tail)))
             (cond
              ((or (> n 1) (and value-tag tail))
-              (bytecomp--cus-warn type "`%s' with too many values" head))
+              (bytecomp--cus-warn type "`%S' with too many values" head))
              (value-tag
               (setq val (cadr value-tag)))
              ;; ;; This is a useful check but it results in perhaps
              ;; ;; a bit too many complaints.
              ;; ((null tail)
              ;;  (bytecomp--cus-warn
-             ;;   type "`%s' without value is implicitly nil" head))
+             ;;   type "`%S' without value is implicitly nil" head))
              )
             (when (memq (car-safe val) '(quote function))
-              (bytecomp--cus-warn type "`%s' with quoted value: %S" head val))))
+              (bytecomp--cus-warn type "`%S' with quoted value: %S" head val))))
          ((eq head 'quote)
-          (bytecomp--cus-warn type "type should not be quoted: %s" (cadr type)))
+          (bytecomp--cus-warn type "type should not be quoted: %S" (cadr type)))
          ((memq head invalid-types)
-          (bytecomp--cus-warn type "`%s' is not a valid type" head))
+          (bytecomp--cus-warn type "`%S' is not a valid type" head))
          ((or (not (symbolp head)) (keywordp head))
           (bytecomp--cus-warn type "irregular type `%S'" head))
          )))
@@ -5375,9 +5375,9 @@ FORM is used to provide location, `bytecomp--cus-function' and
       (bytecomp--cus-warn type "irregular type `%S'" type))
      ((memq type '( list cons group vector choice radio const other
                     function-item variable-item set repeat restricted-sexp))
-      (bytecomp--cus-warn type "`%s' without arguments" type))
+      (bytecomp--cus-warn type "`%S' without arguments" type))
      ((memq type invalid-types)
-      (bytecomp--cus-warn type "`%s' is not a valid type" type))
+      (bytecomp--cus-warn type "`%S' is not a valid type" type))
      )))
 
 (defun bytecomp--check-cus-face-spec (spec)
index e3f23231f5b2c8a9bccaa4aea564bebbf16f92ac..31159de824a4729e9129e5abbe784e6002afc59a 100644 (file)
@@ -3019,13 +3019,13 @@ the local variables spec."
   (let ((enable-local-variables (or (not find-file) enable-local-variables)))
     ;; FIXME this is less efficient than it could be, since both
     ;; s-a-m and h-l-v may parse the same regions, looking for "mode:".
-    (with-demoted-errors "File mode specification error: %s"
+    (with-demoted-errors "File mode specification error: %S"
       (set-auto-mode))
     ;; `delay-mode-hooks' being non-nil will have prevented the major
     ;; mode's call to `run-mode-hooks' from calling
     ;; `hack-local-variables'.  In that case, call it now.
     (when delay-mode-hooks
-      (with-demoted-errors "File local-variables error: %s"
+      (with-demoted-errors "File local-variables error: %S"
         (hack-local-variables 'no-mode))))
   ;; Turn font lock off and on, to make sure it takes account of
   ;; whatever file local variables are relevant to it.
@@ -3564,7 +3564,7 @@ extra checks should be done."
                     alist name case-insensitive-p))
         (when (and dir-local mode
                    (not (set-auto-mode--dir-local-valid-p mode)))
-          (message "Ignoring invalid mode `%s'" mode)
+          (message "Ignoring invalid mode `%S'" mode)
           (setq mode nil))
         (when mode
           (set-auto-mode-0 mode keep-mode-if-same)
index f63138300b1faf727d81fa63ffe961bfd994137f..4965e66503acaabe92bfd749da4bcfe5d5a6bc3d 100644 (file)
@@ -2004,7 +2004,7 @@ Return the server's response to the SELECT or EXAMINE command."
        (cons t response)
       (nnheader-report 'nnimap "%s"
                       (mapconcat (lambda (a)
-                                   (format "%s" a))
+                                   (format "%S" a))
                                  (car response) " "))
       nil)))
 
index bb1f8068d489a512db95e3410c6620512c5eb458..ac2448934f6ae8165c89dfeca2e765b9195c2d1e 100644 (file)
@@ -1549,6 +1549,9 @@ else cover the whole buffer."
 (defvar whitespace-style)
 (defvar whitespace-trailing-regexp)
 
+;; Prevent applying `view-read-only' to diff-mode buffers (bug#75993).
+;; We don't derive from `special-mode' because that would inhibit the
+;; `self-insert-command' binding of normal keys.
 (put 'diff-mode 'mode-class 'special)
 ;;;###autoload
 (define-derived-mode diff-mode fundamental-mode "Diff"