emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit d62e8fb8c4 2/2: Use the documented format const


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit d62e8fb8c4 2/2: Use the documented format construct %d instead of %i
Date: Mon, 10 Apr 2023 05:01:49 -0400 (EDT)

branch: elpa/git-commit
commit d62e8fb8c4d34ffdfc71fe9998b61cc0f8c0fa4a
Author: Phil Sainty <phil@catalyst.net.nz>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Use the documented format construct %d instead of %i
    
    For printf compatibility, %i is equivalent[1] to %d -- but only %d
    is documented.
    
    The simple %i cases are being passed directly to `format', or
    indirectly via `magit-confirm'.  The %%i cases are being processed
    by either (format (format ...)) or (magit-confirm (format ...)).
    
    [1] See styled_format() in src/editfns.c, which consistently tests
    conversion == 'd' || conversion == 'i'.
---
 lisp/magit-apply.el     |  4 ++--
 lisp/magit-base.el      |  2 +-
 lisp/magit-blame.el     |  2 +-
 lisp/magit-branch.el    |  6 +++---
 lisp/magit-commit.el    |  2 +-
 lisp/magit-diff.el      |  2 +-
 lisp/magit-git.el       |  4 ++--
 lisp/magit-log.el       |  4 ++--
 lisp/magit-remote.el    |  6 +++---
 lisp/magit-sequence.el  |  2 +-
 lisp/magit-stash.el     |  2 +-
 lisp/magit-submodule.el | 10 +++++-----
 lisp/magit-tag.el       |  6 +++---
 13 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el
index 4f1848d76f..62e7dfd83b 100644
--- a/lisp/magit-apply.el
+++ b/lisp/magit-apply.el
@@ -583,7 +583,7 @@ of a side, then keep that side without prompting."
 (defun magit-discard-files--resolve (files)
   (if-let ((arg (and (cdr files)
                      (magit-read-char-case
-                         (format "For these %i files\n%s\ncheckout:\n"
+                         (format "For these %d files\n%s\ncheckout:\n"
                                  (length files)
                                  (mapconcat (lambda (file)
                                               (concat "  " file))
@@ -630,7 +630,7 @@ of a side, then keep that side without prompting."
              (magit-call-git "rm" "--cached" "--force" "--" file))))))
 
 (defun magit-discard-files--rename (files status)
-  (magit-confirm 'rename "Undo rename %s" "Undo %i renames" nil
+  (magit-confirm 'rename "Undo rename %s" "Undo %d renames" nil
     (mapcar (lambda (file)
               (setq file (assoc file status))
               (format "%s -> %s" (cadr file) (car file)))
diff --git a/lisp/magit-base.el b/lisp/magit-base.el
index c6aa15a451..384b42008a 100644
--- a/lisp/magit-base.el
+++ b/lisp/magit-base.el
@@ -791,7 +791,7 @@ ACTION is a member of option `magit-slow-confirm'."
       (setq prompt (magit-confirm-make-prompt action)))
     (magit-confirm action
       (concat prompt " %s")
-      (concat prompt " %i files")
+      (concat prompt " %d files")
       nil files)))
 
 (defun magit-confirm-make-prompt (action)
diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el
index 9048c71a05..65bb9e416e 100644
--- a/lisp/magit-blame.el
+++ b/lisp/magit-blame.el
@@ -259,7 +259,7 @@ Also see option `magit-blame-styles'."
                  (file (and (not (derived-mode-p 'dired-mode))
                             (magit-file-relative-name
                              nil (not magit-buffer-file-name))))
-                 (line (format "%i,+1" (line-number-at-pos))))
+                 (line (format "%d,+1" (line-number-at-pos))))
              (cond (file (with-temp-buffer
                            (magit-with-toplevel
                              (magit-git-insert
diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el
index f810f2eb45..a39a426191 100644
--- a/lisp/magit-branch.el
+++ b/lisp/magit-branch.el
@@ -560,7 +560,7 @@ prompt is confusing."
    (let ((branches (magit-region-values 'branch t))
          (force current-prefix-arg))
      (if (length> branches 1)
-         (magit-confirm t nil "Delete %i branches" nil branches)
+         (magit-confirm t nil "Delete %d branches" nil branches)
        (setq branches
              (list (magit-read-branch-prefer-other
                     (if force "Force delete branch" "Delete branch")))))
@@ -568,7 +568,7 @@ prompt is confusing."
        (when-let ((unmerged (-remove #'magit-branch-merged-p branches)))
          (if (magit-confirm 'delete-unmerged-branch
                "Delete unmerged branch %s"
-               "Delete %i unmerged branches"
+               "Delete %d unmerged branches"
                'noabort unmerged)
              (setq force branches)
            (or (setq branches (-difference branches unmerged))
@@ -596,7 +596,7 @@ prompt is confusing."
             (format "Deleting local %s.  Also delete on %s"
                     (magit-ref-fullname (car branches))
                     remote)
-            (format "Deleting %i local refs.  Also delete on %s"
+            (format "Deleting %d local refs.  Also delete on %s"
                     (length refs)
                     remote)
             'noabort refs)
diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el
index d22c39eb23..3b6f226f51 100644
--- a/lisp/magit-commit.el
+++ b/lisp/magit-commit.el
@@ -345,7 +345,7 @@ depending on the value of option 
`magit-commit-squash-confirm'."
           (m2 ".\nDo you really want to modify it"))
       (magit-confirm 'amend-published
         (concat m1 "%s" m2)
-        (concat m1 "%i public branches" m2)
+        (concat m1 "%d public branches" m2)
         nil it))))
 
 (defun magit-commit-assert (args &optional strict)
diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el
index 5dc58f80ac..0568100d83 100644
--- a/lisp/magit-diff.el
+++ b/lisp/magit-diff.el
@@ -1476,7 +1476,7 @@ instead."
          (num (--if-let (and arg (match-string 1 arg)) (string-to-number it) 
def))
          (val (delete arg val))
          (num (funcall fn num))
-         (arg (and num (not (= num def)) (format "-U%i" num)))
+         (arg (and num (not (= num def)) (format "-U%d" num)))
          (val (if arg (cons arg val) val)))
     (setq magit-buffer-diff-args val))
   (magit-refresh))
diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index ddecdb7c8a..b7fc1c0ce7 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -1651,7 +1651,7 @@ The amount of time spent searching is limited by
         (i 1) prev)
     (while (if (> (- (float-time) t0) magit-get-previous-branch-timeout)
                (setq prev nil) ;; Timed out.
-             (and (setq prev (magit-rev-verify (format "@{-%i}" i)))
+             (and (setq prev (magit-rev-verify (format "@{-%d}" i)))
                   (or (not (setq prev (magit-rev-branch prev)))
                       (equal prev current))))
       (cl-incf i))
@@ -2812,7 +2812,7 @@ out.  Only existing branches can be selected."
         (unless modules
           (user-error "No modules satisfying %s selected" predicate))))
     (if (length> modules 1)
-        (magit-confirm t nil (format "%s %%i modules" verb) nil modules)
+        (magit-confirm t nil (format "%s %%d modules" verb) nil modules)
       (list (magit-read-module-path (format "%s module" verb) predicate)))))
 
 ;;; _
diff --git a/lisp/magit-log.el b/lisp/magit-log.el
index bbf1972b29..21c41d37a5 100644
--- a/lisp/magit-log.el
+++ b/lisp/magit-log.el
@@ -884,7 +884,7 @@ limit.  Otherwise set it to 256."
     (setq val (remove arg val))
     (setq magit-buffer-log-args
           (if (and num (> num 0))
-              (cons (format "-n%i" num) val)
+              (cons (format "-n%d" num) val)
             val)))
   (magit-refresh))
 
@@ -1541,7 +1541,7 @@ The shortstat style is experimental and rather slow."
                    (seconds-to-time (string-to-number date)))
                 (pcase-let* ((abbr (eq style 'age-abbreviated))
                              (`(,cnt ,unit) (magit--age date abbr)))
-                  (format (format (if abbr "%%2i%%-%ic" "%%2i %%-%is")
+                  (format (format (if abbr "%%2d%%-%dc" "%%2d %%-%ds")
                                   (- width (if details (1+ details-width) 0)))
                           cnt unit)))
               'magit-log-date))
diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el
index 75958c4dfa..b35d8f1076 100644
--- a/lisp/magit-remote.el
+++ b/lisp/magit-remote.el
@@ -207,10 +207,10 @@ the now stale refspecs.  Other stale branches are not 
removed."
                 (pcase-let ((`(,refspec . ,refs) (car stale)))
                   (magit-confirm 'prune-stale-refspecs
                     (format "Prune stale refspec %s and branch %%s" refspec)
-                    (format "Prune stale refspec %s and %%i branches" refspec)
+                    (format "Prune stale refspec %s and %%d branches" refspec)
                     nil refs))
               (magit-confirm 'prune-stale-refspecs nil
-                (format "Prune %%i stale refspecs and %i branches"
+                (format "Prune %%d stale refspecs and %d branches"
                         (length (cl-mapcan (lambda (s) (copy-sequence (cdr s)))
                                            stale)))
                 nil
@@ -224,7 +224,7 @@ the now stale refspecs.  Other stale branches are not 
removed."
                               (regexp-quote refspec))
               (magit--log-action
                (lambda (refs)
-                 (format "Deleting %i branches" (length refs)))
+                 (format "Deleting %d branches" (length refs)))
                (lambda (ref)
                  (format "Deleting branch %s (was %s)" ref
                          (magit-rev-parse "--short" ref)))
diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el
index 14520f8c5d..d02e68127e 100644
--- a/lisp/magit-sequence.el
+++ b/lisp/magit-sequence.el
@@ -726,7 +726,7 @@ START has to be selected from a list of recent commits."
             (m2 ".\nDo you really want to modify them"))
         (magit-confirm (or magit--rebase-published-symbol 'rebase-published)
           (concat m1 "%s" m2)
-          (concat m1 "%i public branches" m2)
+          (concat m1 "%d public branches" m2)
           nil branches))
       (push (magit-toplevel) magit--rebase-public-edit-confirmed)))
   (if (and (magit-git-lines "rev-list" "--merges" (concat since "..HEAD"))
diff --git a/lisp/magit-stash.el b/lisp/magit-stash.el
index 150e740c3a..f471e27f41 100644
--- a/lisp/magit-stash.el
+++ b/lisp/magit-stash.el
@@ -261,7 +261,7 @@ and forgo removing the stash."
 When the region is active offer to drop all contained stashes."
   (interactive
    (list (--if-let (magit-region-values 'stash)
-             (magit-confirm 'drop-stashes nil "Drop %i stashes" nil it)
+             (magit-confirm 'drop-stashes nil "Drop %d stashes" nil it)
            (magit-read-stash "Drop stash"))))
   (dolist (stash (if (listp stash)
                      (nreverse (prog1 stash (setq stash (car stash))))
diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el
index 33240c0d43..69105eefa6 100644
--- a/lisp/magit-submodule.el
+++ b/lisp/magit-submodule.el
@@ -377,7 +377,7 @@ are additional safety precautions in place, so you might be 
able
 to recover from making a mistake here, but don't count on it."
   (interactive
    (list (if-let ((modules (magit-region-values 'magit-module-section t)))
-             (magit-confirm 'remove-modules nil "Remove %i modules" nil 
modules)
+             (magit-confirm 'remove-modules nil "Remove %d modules" nil 
modules)
            (list (magit-read-module-path "Remove module")))
          (magit-submodule-arguments "--force")
          current-prefix-arg))
@@ -397,7 +397,7 @@ to recover from making a mistake here, but don't count on 
it."
       (if (member "--force" args)
           (if (magit-confirm 'remove-dirty-modules
                 "Remove dirty module %s"
-                "Remove %i dirty modules"
+                "Remove %d dirty modules"
                 t modified)
               (dolist (module modified)
                 (let ((default-directory (file-name-as-directory
@@ -424,7 +424,7 @@ to recover from making a mistake here, but don't count on 
it."
         (when (and trash-gitdirs
                    (magit-confirm 'trash-module-gitdirs
                      "Trash gitdir of module %s"
-                     "Trash gitdirs of %i modules"
+                     "Trash gitdirs of %d modules"
                      t modules))
           (dolist (module modules)
             (if-let ((name (cadr (assoc module alist))))
@@ -481,10 +481,10 @@ or, failing that, the abbreviated HEAD commit hash."
 (defun magit--insert-modules-overview (&optional _section)
   (magit-with-toplevel
     (let* ((modules (magit-list-module-paths))
-           (path-format (format "%%-%is "
+           (path-format (format "%%-%ds "
                                 (min (apply #'max (mapcar #'length modules))
                                      (/ (window-width) 2))))
-           (branch-format (format "%%-%is " (min 25 (/ (window-width) 3)))))
+           (branch-format (format "%%-%ds " (min 25 (/ (window-width) 3)))))
       (dolist (module modules)
         (let ((default-directory
                (expand-file-name (file-name-as-directory module))))
diff --git a/lisp/magit-tag.el b/lisp/magit-tag.el
index 951c591e07..a1b004cc7f 100644
--- a/lisp/magit-tag.el
+++ b/lisp/magit-tag.el
@@ -81,7 +81,7 @@ to delete those, otherwise prompt for a single tag to be 
deleted,
 defaulting to the tag at point.
 \n(git tag -d TAGS)"
   (interactive (list (--if-let (magit-region-values 'tag)
-                         (magit-confirm t nil "Delete %i tags" nil it)
+                         (magit-confirm t nil "Delete %d tags" nil it)
                        (let ((helm-comp-read-use-marked t))
                          (magit-read-tag "Delete tag" t)))))
   (magit-run-git "tag" "-d" tags))
@@ -101,12 +101,12 @@ defaulting to the tag at point.
        (message "Same tags exist locally and remotely"))
      (unless (magit-confirm t
                "Delete %s locally"
-               "Delete %i tags locally"
+               "Delete %d tags locally"
                'noabort ltags)
        (setq ltags nil))
      (unless (magit-confirm t
                "Delete %s from remote"
-               "Delete %i tags from remote"
+               "Delete %d tags from remote"
                'noabort rtags)
        (setq rtags nil))
      (list ltags rtags remote)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]