diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2025-07-25 09:50:34 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2025-07-25 09:50:34 +0200 |
| commit | b377adb68c8d124d6d6ef1cba21ac7862c6cb1c3 (patch) | |
| tree | c10a17d20c74335ded82ad0ea09009c46d57dc4e /lisp | |
| parent | eda5d3682ab8af3961232d0d026c3a4b12adf3c2 (diff) | |
Use shorthand match-str instead of match-string-no-properties
Almost always would it be better to use `match-string-no-properties'
instead of `match-string', but because the name of the former is
excruciatingly long for a function that one often wants to use in
tight spaces and because it usually "does not really matter", I
usually went for the latter.
The problem is, it does matter. For example, even strings that are
usually only used by code may end up obfuscating debug statements.
So let's start doing the right thing, even though there surely will
be people frowning at the use of a shorthand.
The fake ("match-string" "match-string") shorthand is necessary to
protect literal `match-string' and `match-string-no-properties' from
being corrupted by interpreted as shorthand for the non-existent
`match-stringing' and `match-string-no-propertiesing'.
Unfortunately the shorthands have to be specified in each library
individually. Using "dir-locals.el" only works if the libraries
are compiled. At least this additional noise is neatly tucked away
at the end of the files.
It might turn out that out of the more than two hundred instances
where this replaces `match-string' with `match-string-no-properties'
we should have stuck with the former in an instance or two. That's
the price of progress and can be fixed once such regressions are
reported.
Diffstat (limited to 'lisp')
47 files changed, 404 insertions, 169 deletions
diff --git a/lisp/git-commit.el b/lisp/git-commit.el index 45b1eb8..6c5975f 100644 --- a/lisp/git-commit.el +++ b/lisp/git-commit.el @@ -718,15 +718,15 @@ conventions are checked." (save-excursion (goto-char (point-min)) (re-search-forward (git-commit-summary-regexp) nil t) - (if (equal (match-string 1) "") + (if (equal (match-str 1) "") t ; Just try; we don't know whether --allow-empty-message was used. (and (or (not (memq 'overlong-summary-line git-commit-style-convention-checks)) - (equal (match-string 2) "") + (equal (match-str 2) "") (y-or-n-p "Summary line is too long. Commit anyway? ")) (or (not (memq 'non-empty-second-line git-commit-style-convention-checks)) - (not (match-string 3)) + (not (match-str 3)) (y-or-n-p "Second line is not empty. Commit anyway? "))))))) (defun git-commit-cancel-message () @@ -950,8 +950,8 @@ completion candidates. The input must have the form \"NAME <EMAIL>\"." nil nil nil 'git-commit-read-ident-history))) (save-match-data (if (string-match "\\`\\([^<]+\\) *<\\([^>]+\\)>\\'" str) - (list (save-match-data (string-trim (match-string 1 str))) - (string-trim (match-string 2 str))) + (list (save-match-data (string-trim (match-str 1 str))) + (string-trim (match-str 2 str))) (user-error "Invalid input"))))) (defun git-commit--insert-ident-trailer (trailer name email) @@ -1218,4 +1218,9 @@ Elisp doc-strings, including this one. Unlike in doc-strings, "git-commit 4.0.0") (provide 'git-commit) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; git-commit.el ends here diff --git a/lisp/git-rebase.el b/lisp/git-rebase.el index dbcb853..098a29e 100644 --- a/lisp/git-rebase.el +++ b/lisp/git-rebase.el @@ -372,13 +372,13 @@ BATCH also ignores commented lines." git-rebase-line-regexps))) (git-rebase-action :action-type type - :action (and-let* ((action (match-string-no-properties 1))) + :action (and-let* ((action (match-str 1))) (or (cdr (assoc action git-rebase-short-options)) action)) - :action-options (match-string-no-properties 2) - :target (match-string-no-properties 3) - :trailer (match-string-no-properties 5) - :comment-p (and (match-string 99) t)) + :action-options (match-str 2) + :target (match-str 3) + :trailer (match-str 5) + :comment-p (and (match-str 99) t)) (and (not batch) ;; Use empty object rather than nil to ease handling. (git-rebase-action))))) @@ -591,7 +591,7 @@ remove the label on the current line, if any." (save-excursion (goto-char (point-min)) (while (re-search-forward "^\\(?:l\\|label\\) \\([^ \n]+\\)" nil t) - (push (match-string-no-properties 1) labels))) + (push (match-str 1) labels))) (nreverse labels))) (defun git-rebase-reset (arg) @@ -871,11 +871,11 @@ except for the \"pick\" command." (line (concat git-rebase-comment-re "\\(?:\\( \\.? *\\)\\|" "\\( +\\)\\([^\n,],\\) \\([^\n ]+\\) \\)"))) (while (re-search-forward line nil t) - (if (match-string 1) + (if (match-str 1) (if (assq cmd git-rebase-fixup-descriptions) (delete-line) (replace-match (make-string 10 ?\s) t t nil 1)) - (setq cmd (intern (concat "git-rebase-" (match-string 4)))) + (setq cmd (intern (concat "git-rebase-" (match-str 4)))) (cond ((not (fboundp cmd)) (delete-line)) @@ -944,4 +944,9 @@ is used as a value for `imenu-extract-index-name-function'." ;;; _ (provide 'git-rebase) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; git-rebase.el ends here diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el index 9a52cc4..7728b27 100644 --- a/lisp/magit-apply.el +++ b/lisp/magit-apply.el @@ -161,15 +161,15 @@ and only the second and third are to be applied, they would be adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7 @@\"." (let* ((first-hunk (car hunks)) (offset (if (string-match diff-hunk-header-re-unified first-hunk) - (- (string-to-number (match-string 3 first-hunk)) - (string-to-number (match-string 1 first-hunk))) + (- (string-to-number (match-str 3 first-hunk)) + (string-to-number (match-str 1 first-hunk))) (error "Header hunks have to be applied individually")))) (if (= offset 0) hunks (mapcar (lambda (hunk) (if (string-match diff-hunk-header-re-unified hunk) (replace-match (number-to-string - (- (string-to-number (match-string 3 hunk)) + (- (string-to-number (match-str 3 hunk)) offset)) t t hunk 3) (error "Hunk does not have expected header"))) @@ -218,7 +218,7 @@ adjusted as \"@@ -10,6 +10,7 @@\" and \"@@ -18,6 +19,7 @@\"." (mapcar (##oref % value) section:s))) (command (symbol-name this-command)) (command (if (and command (string-match "^magit-\\([^-]+\\)" command)) - (match-string 1 command) + (match-str 1 command) "apply")) (context (magit-diff-get-context)) (ignore-context (magit-diff-ignore-any-space-p))) @@ -637,7 +637,7 @@ of a side, then keep that side without prompting." (?M (let ((temp (magit-git-string "checkout-index" "--temp" file))) (string-match (format "\\(.+?\\)\t%s" (regexp-quote file)) temp) - (rename-file (match-string 1 temp) + (rename-file (match-str 1 temp) (setq temp (concat file ".~{index}~"))) (delete-file temp t)) (magit-call-git "rm" "--cached" "--force" "--" file)) @@ -831,4 +831,9 @@ a separate commit. A typical workflow would be: ;;; _ (provide 'magit-apply) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-apply.el ends here diff --git a/lisp/magit-autorevert.el b/lisp/magit-autorevert.el index 3579bf2..6d2f799 100644 --- a/lisp/magit-autorevert.el +++ b/lisp/magit-autorevert.el @@ -268,4 +268,9 @@ defaults to nil) for any BUFFER." ;;; _ (provide 'magit-autorevert) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-autorevert.el ends here diff --git a/lisp/magit-base.el b/lisp/magit-base.el index ed33038..9c1f9a3 100644 --- a/lisp/magit-base.el +++ b/lisp/magit-base.el @@ -899,7 +899,7 @@ as STRING." (mapcan (lambda (sym) (cl-incf i) (and (not (eq (aref (symbol-name sym) 0) ?_)) - (list (list sym (list 'match-string i s))))) + (list (list sym (list 'match-str i s))))) varlist)) ,@body)))) @@ -948,8 +948,8 @@ Pad the left side of STRING so that it aligns with the text area." (delete-char 1)) ;; Valid format spec. ((looking-at "\\([-0-9.]*\\)\\([a-zA-Z]\\)") - (let* ((num (match-string 1)) - (spec (string-to-char (match-string 2))) + (let* ((num (match-str 1)) + (spec (string-to-char (match-str 2))) (val (assq spec specification))) (unless val (error "Invalid format character: `%%%c'" spec)) @@ -1087,9 +1087,9 @@ the value in the symbol's `saved-value' property if any, or (pcase magit-view-git-manual-method ('info (funcall fn fork)) ('man (require 'man) - (man (match-string 1 node))) + (man (match-str 1 node))) ('woman (require 'woman) - (woman (match-string 1 node))) + (woman (match-str 1 node))) (_ (user-error "Invalid value for `magit-view-git-manual-method'"))) (funcall fn fork)))) @@ -1193,4 +1193,9 @@ Like `message', except that `message-log-max' is bound to nil." ;;; _ (provide 'magit-base) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-base.el ends here diff --git a/lisp/magit-bisect.el b/lisp/magit-bisect.el index 8c737c1..baf1428 100644 --- a/lisp/magit-bisect.el +++ b/lisp/magit-bisect.el @@ -258,7 +258,7 @@ bisect run'." (pop lines)) (seq-find (##string-match done-re %) lines)))) (magit-insert-section ((eval (if bad-line 'commit 'bisect-output)) - (and bad-line (match-string 1 bad-line))) + (and bad-line (match-str 1 bad-line))) (magit-insert-heading (propertize (or bad-line (pop lines)) 'font-lock-face 'magit-section-heading)) @@ -291,7 +291,7 @@ bisect run'." (while (progn (setq beg (point-marker)) (re-search-forward "^\\(\\(?:git bisect\\|# status:\\) [^\n]+\n\\)" nil t)) - (if (string-prefix-p "# status:" (match-string 1)) + (if (string-prefix-p "# status:" (match-str 1)) (magit-delete-match) (magit-bind-match-strings (heading) nil (magit-delete-match) @@ -315,4 +315,9 @@ bisect run'." ;;; _ (provide 'magit-bisect) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-bisect.el ends here diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el index f6a3e33..aa0af7c 100644 --- a/lisp/magit-blame.el +++ b/lisp/magit-blame.el @@ -495,22 +495,22 @@ modes is toggled, then this mode also gets toggled automatically. (buffer-substring-no-properties (point) (line-end-position)))) (with-slots (orig-rev orig-file prev-rev prev-file) (setq chunk (magit-blame-chunk - :orig-rev (match-string 1) - :orig-line (string-to-number (match-string 2)) - :final-line (string-to-number (match-string 3)) - :num-lines (string-to-number (match-string 4)))) + :orig-rev (match-str 1) + :orig-line (string-to-number (match-str 2)) + :final-line (string-to-number (match-str 3)) + :num-lines (string-to-number (match-str 4)))) (forward-line) (let (done) (while (not done) (cond ((looking-at "^filename \\(.+\\)") (setq done t) - (setf orig-file (magit-decode-git-path (match-string 1)))) + (setf orig-file (magit-decode-git-path (match-str 1)))) ((looking-at "^previous \\(.\\{40,\\}\\) \\(.+\\)") - (setf prev-rev (match-string 1)) - (setf prev-file (magit-decode-git-path (match-string 2)))) + (setf prev-rev (match-str 1)) + (setf prev-file (magit-decode-git-path (match-str 2)))) ((looking-at "^\\([^ ]+\\) \\(.+\\)") - (push (cons (match-string 1) - (match-string 2)) + (push (cons (match-str 1) + (match-str 2)) revinfo))) (forward-line))) (when (and (eq type 'removal) prev-rev) @@ -996,4 +996,9 @@ instead of the hash, like `kill-ring-save' would." ;;; _ (provide 'magit-blame) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-blame.el ends here diff --git a/lisp/magit-bookmark.el b/lisp/magit-bookmark.el index bbb1215..5bb1020 100644 --- a/lisp/magit-bookmark.el +++ b/lisp/magit-bookmark.el @@ -156,4 +156,9 @@ ;;; _ (provide 'magit-bookmark) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-bookmark.el ends here diff --git a/lisp/magit-branch.el b/lisp/magit-branch.el index 2c84d47..ae4779a 100644 --- a/lisp/magit-branch.el +++ b/lisp/magit-branch.el @@ -263,12 +263,12 @@ changes. (interactive (list (magit-read-other-branch-or-commit "Checkout") (magit-branch-arguments))) (when (string-match "\\`heads/\\(.+\\)" commit) - (setq commit (match-string 1 commit))) + (setq commit (match-str 1 commit))) (magit-run-git-async "checkout" args commit)) (defun magit--checkout (rev &optional args) (when (string-match "\\`heads/\\(.+\\)" rev) - (setq rev (match-string 1 rev))) + (setq rev (match-str 1 rev))) (magit-call-git "checkout" args rev)) ;;;###autoload @@ -319,7 +319,7 @@ does." (and (not (magit-commit-p arg)) (magit-read-starting-point "Create and checkout branch" arg))))) (when (string-match "\\`heads/\\(.+\\)" arg) - (setq arg (match-string 1 arg))) + (setq arg (match-str 1 arg))) (if start-point (with-suppressed-warnings ((interactive-only magit-branch-and-checkout)) (magit-branch-and-checkout arg start-point)) @@ -622,7 +622,7 @@ prompt is confusing." (format "%s of these names are" len)))))) (cond ((string-match "^refs/remotes/\\([^/]+\\)" (car refs)) - (let* ((remote (match-string 1 (car refs))) + (let* ((remote (match-str 1 (car refs))) (offset (1+ (length remote)))) (cond ((magit-confirm 'delete-branch-on-remote @@ -766,7 +766,7 @@ the remote." nil 'magit-revision-history) current-prefix-arg))) (when (string-match "\\`heads/\\(.+\\)" old) - (setq old (match-string 1 old))) + (setq old (match-str 1 old))) (when (equal old new) (user-error "Old and new branch names are the same")) (magit-call-git "branch" (if force "-M" "-m") old new) @@ -979,4 +979,9 @@ Also rename the respective reflog file." ;;; _ (provide 'magit-branch) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-branch.el ends here diff --git a/lisp/magit-bundle.el b/lisp/magit-bundle.el index 1cd98d5..6e0ae81 100644 --- a/lisp/magit-bundle.el +++ b/lisp/magit-bundle.el @@ -136,4 +136,9 @@ ;;; _ (provide 'magit-bundle) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-bundle.el ends here diff --git a/lisp/magit-clone.el b/lisp/magit-clone.el index 42187eb..80ef7b0 100644 --- a/lisp/magit-clone.el +++ b/lisp/magit-clone.el @@ -314,13 +314,13 @@ Then show the status buffer for the new repository." (defun magit-clone--url-to-name (url) (and (string-match "\\([^/:]+?\\)\\(/?\\.git\\)?$" url) - (match-string 1 url))) + (match-str 1 url))) (defun magit-clone--name-to-url (name) (or (seq-some (pcase-lambda (`(,re ,host ,user)) (and (string-match re name) - (let ((repo (match-string 1 name))) + (let ((repo (match-str 1 name))) (magit-clone--format-url host user repo)))) magit-clone-name-alist) (user-error "Not an url and no matching entry in `%s'" @@ -348,4 +348,9 @@ Then show the status buffer for the new repository." ;;; _ (provide 'magit-clone) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-clone.el ends here diff --git a/lisp/magit-commit.el b/lisp/magit-commit.el index e8b8438..7aab4f3 100644 --- a/lisp/magit-commit.el +++ b/lisp/magit-commit.el @@ -784,7 +784,7 @@ actually insert the entry." (narrow-to-region (point-min) (point)) (cond ((re-search-backward (format "* %s\\(?: (\\([^)]+\\))\\)?: " file) nil t) - (when (equal (match-string 1) defun) + (when (equal (match-str 1) defun) (setq defun nil)) (re-search-forward ": ")) (t @@ -813,4 +813,9 @@ actually insert the entry." ;;; _ (provide 'magit-commit) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-commit.el ends here diff --git a/lisp/magit-core.el b/lisp/magit-core.el index a7ff47e..dd95228 100644 --- a/lisp/magit-core.el +++ b/lisp/magit-core.el @@ -120,4 +120,9 @@ Each of these options falls into one or more of these categories: ;;; _ (provide 'magit-core) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-core.el ends here diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index 72a2eed..cda4d8e 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -1482,7 +1482,7 @@ Change \"revA..revB\" to \"revA...revB\", or vice versa." (derived-mode-p 'magit-diff-mode) (string-match magit-range-re magit-buffer-range)) (setq magit-buffer-range - (replace-match (if (string= (match-string 2 magit-buffer-range) "..") + (replace-match (if (string= (match-str 2 magit-buffer-range) "..") "..." "..") t t magit-buffer-range 2)) @@ -1498,9 +1498,9 @@ Change \"revA..revB\" to \"revB..revA\"." (string-match magit-range-re magit-buffer-range)) (progn (setq magit-buffer-range - (concat (match-string 3 magit-buffer-range) - (match-string 2 magit-buffer-range) - (match-string 1 magit-buffer-range))) + (concat (match-str 3 magit-buffer-range) + (match-str 2 magit-buffer-range) + (match-str 1 magit-buffer-range))) (magit-refresh)) (user-error "No range to swap"))) @@ -1553,7 +1553,7 @@ instead." 3)) (val magit-buffer-diff-args) (arg (seq-find (##string-match "^-U\\([0-9]+\\)?$" %) val)) - (num (if-let ((str (and arg (match-string 1 arg)))) + (num (if-let ((str (and arg (match-str 1 arg)))) (string-to-number str) def)) (val (delete arg val)) @@ -1566,7 +1566,7 @@ instead." (defun magit-diff-get-context () (string-to-number (or (seq-some (##and (string-match "\\`-U\\([0-9]+\\)?\\'" %) - (match-string 1 %)) + (match-str 1 %)) magit-buffer-diff-args) (magit-get "diff.context") "3"))) @@ -1885,9 +1885,9 @@ the Magit-Status buffer for DIRECTORY." (while (re-search-forward "^@@ -\\([0-9]+\\),\\([0-9]+\\) \\+\\([0-9]+\\),\\([0-9]+\\) @@.*\n" nil t) - (let ((from-beg (string-to-number (match-string 1))) - (from-len (string-to-number (match-string 2))) - ( to-len (string-to-number (match-string 4)))) + (let ((from-beg (string-to-number (match-str 1))) + (from-len (string-to-number (match-str 2))) + ( to-len (string-to-number (match-str 4)))) (if (<= from-beg line) (if (< (+ from-beg from-len) line) (cl-incf offset (- to-len from-len)) @@ -2365,7 +2365,7 @@ keymap is the parent of their keymaps." (defun magit-diff-wash-diffstat () (let (heading (beg (point))) (when (re-search-forward "^ ?\\([0-9]+ +files? change[^\n]*\n\\)" nil t) - (setq heading (match-string 1)) + (setq heading (match-str 1)) (magit-delete-match) (goto-char beg) (magit-insert-section (diffstat) @@ -2374,10 +2374,10 @@ keymap is the parent of their keymaps." (let (files) (while (looking-at "^[-0-9]+\t[-0-9]+\t\\(.+\\)$") (push (magit-decode-git-path - (let ((f (match-string 1))) + (let ((f (match-str 1))) (cond ((string-match "{.* => \\(.*\\)}" f) - (replace-match (match-string 1 f) nil t f)) + (replace-match (match-str 1 f) nil t f)) ((string-match " => " f) (substring f (match-end 0))) (t f)))) @@ -2388,7 +2388,7 @@ keymap is the parent of their keymaps." (magit-bind-match-strings (file sep cnt add del) nil (magit-delete-line) (when (string-match " +$" file) - (setq sep (concat (match-string 0 file) sep)) + (setq sep (concat (match-str 0 file) sep)) (setq file (substring file 0 (match-beginning 0)))) (let ((le (length file)) ld) (setq file (magit-decode-git-path file)) @@ -2415,7 +2415,7 @@ keymap is the parent of their keymaps." ((looking-at "^Submodule") (magit-diff-wash-submodule)) ((looking-at "^\\* Unmerged path \\(.*\\)") - (let ((file (magit-decode-git-path (match-string 1)))) + (let ((file (magit-decode-git-path (match-str 1)))) (magit-delete-line) (unless (and (derived-mode-p 'magit-status-mode) (not (member "--cached" args))) @@ -2434,7 +2434,7 @@ keymap is the parent of their keymaps." (insert ?\n)))) t) ((looking-at magit-diff-conflict-headline-re) - (let ((long-status (match-string 0)) + (let ((long-status (match-str 0)) (status "BUG") file orig base) (if (equal long-status "merged") @@ -2467,11 +2467,11 @@ keymap is the parent of their keymaps." ((looking-at "^diff --\ \\(?:\\(?1:git\\) \\(?:\\(?2:.+?\\) \\2\\)?\ \\|\\(?:cc\\|combined\\) \\(?3:.+\\)\\)") - (let ((status (cond ((equal (match-string 1) "git") "modified") + (let ((status (cond ((equal (match-str 1) "git") "modified") ((derived-mode-p 'magit-revision-mode) "resolved") (t "unmerged"))) (orig nil) - (file (or (match-string 2) (match-string 3))) + (file (or (match-str 2) (match-str 3))) (header (list (buffer-substring-no-properties (line-beginning-position) (1+ (line-end-position))))) (modes nil) @@ -2481,29 +2481,29 @@ keymap is the parent of their keymaps." (while (not (or (eobp) (looking-at magit-diff-headline-re))) (cond ((looking-at "old mode \\(?:[^\n]+\\)\nnew mode \\(?:[^\n]+\\)\n") - (setq modes (match-string 0))) + (setq modes (match-str 0))) ((looking-at "deleted file .+\n") (setq status "deleted")) ((looking-at "new file .+\n") (setq status "new file")) ((looking-at "rename from \\(.+\\)\nrename to \\(.+\\)\n") - (setq rename (match-string 0)) - (setq orig (match-string 1)) - (setq file (match-string 2)) + (setq rename (match-str 0)) + (setq orig (match-str 1)) + (setq file (match-str 2)) (setq status "renamed")) ((looking-at "copy from \\(.+\\)\ncopy to \\(.+\\)\n") - (setq orig (match-string 1)) - (setq file (match-string 2)) + (setq orig (match-str 1)) + (setq file (match-str 2)) (setq status "new file")) ((looking-at "similarity index .+\n")) ((looking-at "dissimilarity index .+\n")) ((looking-at "index .+\n")) ((looking-at "--- \\(.+?\\)\t?\n") - (unless (equal (match-string 1) "/dev/null") - (setq orig (match-string 1)))) + (unless (equal (match-str 1) "/dev/null") + (setq orig (match-str 1)))) ((looking-at "\\+\\+\\+ \\(.+?\\)\t?\n") - (unless (equal (match-string 1) "/dev/null") - (setq file (match-string 1)))) + (unless (equal (match-str 1) "/dev/null") + (setq file (match-str 1)))) ((looking-at "Binary files .+ and .+ differ\n") (setq binary t)) ((looking-at "Binary files differ\n") @@ -2513,9 +2513,9 @@ keymap is the parent of their keymaps." ((error "BUG: Unknown extended header: %S" (buffer-substring (point) (line-end-position))))) ;; These headers are treated as some sort of special hunk. - (unless (or (string-prefix-p "old mode" (match-string 0)) - (string-prefix-p "rename" (match-string 0))) - (push (match-string 0) header)) + (unless (or (string-prefix-p "old mode" (match-str 0)) + (string-prefix-p "rename" (match-str 0))) + (push (match-str 0) header)) (magit-delete-match)) (when orig (setq orig (magit-decode-git-path orig))) @@ -2531,7 +2531,7 @@ keymap is the parent of their keymaps." (setq header (list (save-excursion (string-match "diff [^ ]+" (car header)) (format "%s %s %s\n" - (match-string 0 (car header)) + (match-str 0 (car header)) (or orig file) (or file orig))) (format "--- %s\n" (or orig "/dev/null")) @@ -2613,7 +2613,7 @@ function errors." (defun magit-diff-wash-submodule () ;; See `show_submodule_summary' in submodule.c and "this" commit. (when (looking-at "^Submodule \\([^ ]+\\)") - (let ((module (match-string 1)) + (let ((module (match-str 1)) untracked modified) (when (looking-at "^Submodule [^ ]+ contains untracked content$") (magit-delete-line) @@ -2623,7 +2623,7 @@ function errors." (setq modified t)) (cond ((and (looking-at "^Submodule \\([^ ]+\\) \\([^ :]+\\)\\( (rewind)\\)?:$") - (equal (match-string 1) module)) + (equal (match-str 1) module)) (magit-bind-match-strings (_module range rewind) nil (magit-delete-line) (while (looking-at "^ \\([<>]\\) \\(.*\\)$") @@ -2654,7 +2654,7 @@ function errors." "log" "--oneline" "--left-right" range) (delete-char -1)))))) ((and (looking-at "^Submodule \\([^ ]+\\) \\([^ ]+\\) (\\([^)]+\\))$") - (equal (match-string 1) module)) + (equal (match-str 1) module)) (magit-bind-match-strings (_module _range msg) nil (magit-delete-line) (magit-insert-section (module module) @@ -2675,7 +2675,7 @@ function errors." (defun magit-diff-wash-hunk () (when (looking-at "^@\\{2,\\} \\(.+?\\) @\\{2,\\}\\(?: \\(.*\\)\\)?") - (let* ((heading (match-string 0)) + (let* ((heading (match-str 0)) (ranges (mapcar (lambda (str) (let ((range @@ -2685,8 +2685,8 @@ function errors." (if (length= range 1) (nconc range (list 1)) range))) - (split-string (match-string 1)))) - (about (match-string 2)) + (split-string (match-str 1)))) + (about (match-str 2)) (combined (length= ranges 3)) (value (cons about ranges))) (magit-delete-line) @@ -2804,8 +2804,8 @@ or a ref which is not a branch, then it inserts nothing." (delete-region beg (point))) (looking-at "^tagger \\([^<]+\\) <\\([^>]+\\)") (let ((heading (format "Tagger: %s <%s>" - (match-string 1) - (match-string 2)))) + (match-str 1) + (match-str 2)))) (magit-delete-line) (magit-insert-heading (propertize heading 'font-lock-face @@ -3051,7 +3051,7 @@ Refer to user option `magit-revision-insert-related-refs-display-alist'." (goto-char beg) (when-let (((re-search-forward regexp nil t)) (window (get-buffer-window))) - (let* ((column (length (match-string 0))) + (let* ((column (length (match-str 0))) (font-obj (query-font (font-at (point) window))) (size (* 2 (+ (aref font-obj 4) (aref font-obj 5)))) @@ -3365,7 +3365,7 @@ actually a `diff' but a `diffstat' section." (point) (1+ (line-end-position)) 'font-lock-face (cond ((looking-at "^\\+\\+?\\([<=|>]\\)\\{7\\}") - (setq stage (pcase (list (match-string 1) highlight) + (setq stage (pcase (list (match-str 1) highlight) ('("<" nil) 'magit-diff-our) ('("<" t) 'magit-diff-our-highlight) ('("|" nil) 'magit-diff-base) @@ -3642,12 +3642,12 @@ last (visual) lines of the region." (goto-char sbeg) (while (< (point) send) (looking-at "\\(.\\)\\([^\n]*\n\\)") - (cond ((or (string-match-p "[@ ]" (match-string-no-properties 1)) + (cond ((or (string-match-p "[@ ]" (match-str 1)) (and (>= (point) rbeg) (<= (point) rend))) - (push (match-string-no-properties 0) patch)) - ((equal op (match-string-no-properties 1)) - (push (concat " " (match-string-no-properties 2)) patch))) + (push (match-str 0) patch)) + ((equal op (match-str 1)) + (push (concat " " (match-str 2)) patch))) (forward-line))) (let ((buffer-list-update-hook nil)) ; #3759 (with-temp-buffer @@ -3658,4 +3658,9 @@ last (visual) lines of the region." ;;; _ (provide 'magit-diff) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-diff.el ends here diff --git a/lisp/magit-dired.el b/lisp/magit-dired.el index 5e361ac..087499b 100644 --- a/lisp/magit-dired.el +++ b/lisp/magit-dired.el @@ -106,4 +106,9 @@ Interactively, open the file at point." ;;; _ (provide 'magit-dired) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-dired.el ends here diff --git a/lisp/magit-ediff.el b/lisp/magit-ediff.el index 16e38b7..10d632c 100644 --- a/lisp/magit-ediff.el +++ b/lisp/magit-ediff.el @@ -602,4 +602,9 @@ stash that were staged." ;;; _ (provide 'magit-ediff) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-ediff.el ends here diff --git a/lisp/magit-extras.el b/lisp/magit-extras.el index b4dbcd0..d95661f 100644 --- a/lisp/magit-extras.el +++ b/lisp/magit-extras.el @@ -614,7 +614,7 @@ the minibuffer too." (save-excursion (if (re-search-backward idx-format nil t) (number-to-string - (1+ (string-to-number (match-string 1)))) + (1+ (string-to-number (match-str 1)))) "1")))) pnt-args eob-args) (when (listp pnt-format) @@ -743,7 +743,7 @@ abbreviated revision to the `kill-ring' and the (magit-diff-mode (if (string-match "\\.\\.\\.?\\(.+\\)" magit-buffer-range) - (match-string 1 magit-buffer-range) + (match-str 1 magit-buffer-range) magit-buffer-range)) (magit-status-mode "HEAD"))))) (when (magit-commit-p rev) @@ -832,4 +832,9 @@ In Magit diffs, also skip over - and + at the beginning of the line." ;;; _ (provide 'magit-extras) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-extras.el ends here diff --git a/lisp/magit-fetch.el b/lisp/magit-fetch.el index 7ef4504..7e56849 100644 --- a/lisp/magit-fetch.el +++ b/lisp/magit-fetch.el @@ -183,4 +183,9 @@ with a prefix argument." ;;; _ (provide 'magit-fetch) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-fetch.el ends here diff --git a/lisp/magit-files.el b/lisp/magit-files.el index 0ee5888..5d5fefc 100644 --- a/lisp/magit-files.el +++ b/lisp/magit-files.el @@ -611,4 +611,9 @@ If DEFAULT is non-nil, use this as the default value instead of 'magit-file-unstage "Magit 4.3.2") (provide 'magit-files) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-files.el ends here diff --git a/lisp/magit-git.el b/lisp/magit-git.el index baca51f..b7a6422 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -516,7 +516,7 @@ insert the run command and stderr into the process buffer." (goto-char (point-max)) (and (run-hook-wrapped 'magit-process-error-message-regexps (##re-search-backward % nil t)) - (match-string-no-properties 1))) + (match-str 1))) (defun magit-git-string (&rest args) "Execute Git with ARGS, returning the first line of its output. @@ -652,7 +652,7 @@ using `magit-debug-git-executable'.") output))) ((save-match-data (and (string-match magit--git-version-regexp output) - (let ((version (match-string 1 output))) + (let ((version (match-str 1 output))) (push (cons host version) magit--host-git-version-cache) version)))) @@ -696,7 +696,7 @@ values of `magit-remote-git-executable' and `exec-path'.\n")) (cond ((not (zerop status)) output) ((save-match-data (and (string-match magit--git-version-regexp output) - (match-string 1 output)))) + (match-str 1 output)))) (t output))))) (defun magit-debug-git-executable () @@ -1135,7 +1135,7 @@ See also `magit-untracked-files'." (defun magit-binary-files (&rest args) (mapcan (##and (string-match "^-\t-\t\\(.+\\)" %) - (list (match-string 1 %))) + (list (match-str 1 %))) (apply #'magit-git-items "diff" "-z" "--numstat" "--ignore-submodules" args))) @@ -1214,8 +1214,8 @@ or if no rename is detected." (cl-sort (mapcar (lambda (mount) (if (string-match "^\\(.*\\) on \\(.*\\) type" mount) - (cons (file-name-as-directory (match-string 2 mount)) - (file-name-as-directory (match-string 1 mount))) + (cons (file-name-as-directory (match-str 2 mount)) + (file-name-as-directory (match-str 1 mount))) (lwarn '(magit) :error "Failed to parse Cygwin mount: %S" mount))) ;; If --exec-path is not a native Windows path, @@ -1463,7 +1463,7 @@ Git." (and (string-match "\\`\\(squash!\\|fixup!\\|amend!\\) \\(.+\\)" msg) (magit-rev-format "%h" (format "%s^{/^%s}" rev - (magit--ext-regexp-quote (match-string 2 msg)))))))) + (magit--ext-regexp-quote (match-str 2 msg)))))))) (defun magit-get-shortname (rev) (let* ((fn (apply-partially #'magit-rev-name rev)) @@ -1473,9 +1473,9 @@ Git." (cond ((not name) (magit-rev-parse "--short" rev)) ((string-match "^\\(?:tags\\|remotes\\)/\\(.+\\)" name) - (if (magit-ref-ambiguous-p (match-string 1 name)) + (if (magit-ref-ambiguous-p (match-str 1 name)) name - (match-string 1 name))) + (match-str 1 name))) ((magit-ref-maybe-qualify name))))) (defun magit-name-branch (rev &optional lax) @@ -1513,7 +1513,7 @@ If REFNAME is ambiguous, return nil." (defun magit-ref-ambiguous-p (refname) (save-match-data (if (string-match "\\`\\([^^~]+\\)\\(.*\\)" refname) - (not (magit-ref-fullname (match-string 1 refname))) + (not (magit-ref-fullname (match-str 1 refname))) (error "%S has an unrecognized format" refname)))) (defun magit-ref-maybe-qualify (refname &optional prefix) @@ -1907,15 +1907,15 @@ the name of a remote and REF is the ref local to the remote." (seq-some (lambda (line) (and (string-match "\ \\`remote\\.\\([^.]+\\)\\.fetch=\\+?\\([^:]+\\):\\(.+\\)" line) - (let ((rmt (match-string 1 line)) - (src (match-string 2 line)) - (dst (match-string 3 line))) + (let ((rmt (match-str 1 line)) + (src (match-str 2 line)) + (dst (match-str 3 line))) (and (string-match (format "\\`%s\\'" (string-replace "*" "\\(.+\\)" dst)) ref) (cons rmt (string-replace - "*" (match-string 1 ref) src)))))) + "*" (match-str 1 ref) src)))))) (magit-git-lines "config" "--local" "--list"))))) (defun magit-split-branch-name (branch) @@ -1926,8 +1926,8 @@ the name of a remote and REF is the ref local to the remote." (and (string-match (format "\\`\\(%s\\)/\\(.+\\)\\'" remote) branch) - (cons (match-string 1 branch) - (match-string 2 branch)))) + (cons (match-str 1 branch) + (match-str 2 branch)))) (magit-list-remotes)) (error "Invalid branch name %s" branch))))) @@ -1946,10 +1946,10 @@ uncommitted changes, nil otherwise." (string-match "\\(.+\\)-\\(?:0[0-9]*\\|\\([0-9]+\\)\\)-g[0-9a-z]+\\(-dirty\\)?$" str) (if with-distance - `(,(match-string 1 str) - ,(string-to-number (or (match-string 2 str) "0")) - ,@(and (match-string 3 str) (list t))) - (match-string 1 str))))) + `(,(match-str 1 str) + ,(string-to-number (or (match-str 2 str) "0")) + ,@(and (match-str 3 str) (list t))) + (match-str 1 str))))) (defun magit-get-next-tag (&optional rev with-distance) "Return the closest tag from which REV is reachable. @@ -1962,7 +1962,7 @@ where COMMITS is the number of commits in TAG but not in REV." (and-let* ((str (magit-git-str "describe" "--contains" (or rev "HEAD")))) (save-match-data (when (string-match "^[^^~]+" str) - (setq str (match-string 0 str)) + (setq str (match-str 0 str)) (unless (equal str (magit-get-current-tag rev)) (if with-distance (list str (car (magit-rev-diff-count str rev))) @@ -2034,7 +2034,7 @@ When nil, use `magit-list-refs-sortby'. If both are nil, use (let ((re (format "\\`%s refs/\\(heads\\|remotes\\)/\\(.*\\)\\'" (magit-rev-verify rev)))) (seq-keep (##and (string-match re %) - (let ((name (match-string 2 %))) + (let ((name (match-str 2 %))) (and (not (string-suffix-p "HEAD" name)) name))) (magit-git-lines "show-ref")))) @@ -2062,7 +2062,7 @@ When nil, use `magit-list-refs-sortby'. If both are nil, use (if (and remote relative) (let ((regexp (format "^refs/remotes/%s/\\(.+\\)" remote))) (mapcan (##when (string-match regexp %) - (list (match-string 1 %))) + (list (match-str 1 %))) (magit-list-remote-branches remote))) (magit-list-refnames (concat "refs/remotes/" remote)))) @@ -2112,17 +2112,17 @@ When nil, use `magit-list-refs-sortby'. If both are nil, use (##string-match "\\`ref: refs/heads/\\([^\s\t]+\\)[\s\t]HEAD\\'" %) (magit-git-lines "ls-remote" "--symref" remote "HEAD")))) - (match-string 1 line))) + (match-str 1 line))) (defun magit-list-modified-modules () (seq-keep (##and (string-match "\\`\\+\\([^ ]+\\) \\(.+\\) (.+)\\'" %) - (match-string 2 %)) + (match-str 2 %)) (magit-git-lines "submodule" "status"))) (defun magit-list-module-paths () (magit-with-toplevel (mapcan (##and (string-match "^160000 [0-9a-z]\\{40,\\} 0\t\\(.+\\)$" %) - (list (match-string 1 %))) + (list (match-str 1 %))) (magit-git-items "ls-files" "-z" "--stage")))) (defun magit-list-module-names () @@ -2374,7 +2374,7 @@ and this option only controls what face is used.") (dolist (ref refs) (let* ((face (cdr (seq-find (##string-match (car %) ref) magit-ref-namespaces))) - (name (match-string 1 ref)) + (name (match-str 1 ref)) (name (if (and name (not (string-prefix-p "refs/tags/" ref)) (magit-rev-verify (concat "refs/tags/" name))) @@ -2394,8 +2394,8 @@ and this option only controls what face is used.") (seq-keep (lambda (name) (if (string-match "\\`\\([^/]*\\)/\\(.*\\)\\'" name) - (let ((r (match-string 1 name)) - (b (match-string 2 name))) + (let ((r (match-str 1 name)) + (b (match-str 2 name))) (and (not (equal b "HEAD")) (if (equal (concat "refs/remotes/" name) (magit-git-string @@ -2515,28 +2515,28 @@ and this option only controls what face is used.") (and sep (let ((beg (or beg "HEAD")) (end (or end "HEAD"))) - (if (string-equal (match-string 2 range) "...") + (if (string-equal (match-str 2 range) "...") (and-let* ((base (magit-git-string "merge-base" beg end))) (cons base end)) (cons beg end)))))) (defun magit--split-range-raw (range) (and (string-match magit-range-re range) - (let ((beg (match-string 1 range)) - (end (match-string 3 range))) + (let ((beg (match-str 1 range)) + (end (match-str 3 range))) (and (or beg end) - (list beg end (match-string 2 range)))))) + (list beg end (match-str 2 range)))))) (defun magit-hash-range (range) (if (string-match magit-range-re range) - (let ((beg (match-string 1 range)) - (end (match-string 3 range))) + (let ((beg (match-str 1 range)) + (end (match-str 3 range))) (and (or beg end) - (let ((beg-hash (and beg (magit-rev-hash (match-string 1 range)))) - (end-hash (and end (magit-rev-hash (match-string 3 range))))) + (let ((beg-hash (and beg (magit-rev-hash (match-str 1 range)))) + (end-hash (and end (magit-rev-hash (match-str 3 range))))) (and (or (not beg) beg-hash) (or (not end) end-hash) - (concat beg-hash (match-string 2 range) end-hash))))) + (concat beg-hash (match-str 2 range) end-hash))))) (magit-rev-hash range))) (defvar magit-revision-faces @@ -2855,7 +2855,7 @@ out. Only existing branches can be selected." (car choices)))) (and choice (string-match "^\\([^ ]+\\) \\(.+\\)" choice) - (substring-no-properties (match-string 1 choice))))) + (substring-no-properties (match-str 1 choice))))) (defun magit-read-remote (prompt &optional default use-only) (let ((remotes (magit-list-remotes))) @@ -2907,4 +2907,9 @@ out. Only existing branches can be selected." ;;; _ (provide 'magit-git) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-git.el ends here diff --git a/lisp/magit-gitignore.el b/lisp/magit-gitignore.el index 0ee63df..4f8baf9 100644 --- a/lisp/magit-gitignore.el +++ b/lisp/magit-gitignore.el @@ -192,4 +192,9 @@ Rules that are defined in that file affect all local repositories." ;;; _ (provide 'magit-gitignore) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-gitignore.el ends here diff --git a/lisp/magit-log.el b/lisp/magit-log.el index c4cb1de..66b30a3 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -893,7 +893,7 @@ limit. Otherwise set it to 256." (defun magit-log-set-commit-limit (fn) (let* ((val magit-buffer-log-args) (arg (seq-find (##string-match "^-n\\([0-9]+\\)?$" %) val)) - (num (and arg (string-to-number (match-string 1 arg)))) + (num (and arg (string-to-number (match-str 1 arg)))) (num (if num (funcall fn num 2) 256))) (setq val (remove arg val)) (setq magit-buffer-log-args @@ -905,7 +905,7 @@ limit. Otherwise set it to 256." (defun magit-log-get-commit-limit (&optional args) (and-let* ((str (seq-find (##string-match "^-n\\([0-9]+\\)?$" %) (or args magit-buffer-log-args)))) - (string-to-number (match-string 1 str)))) + (string-to-number (match-str 1 str)))) ;;;; Mode Commands @@ -1249,7 +1249,7 @@ Do not add this to a hook variable." (progn (when-let ((order (seq-find (##string-match "^\\+\\+order=\\(.+\\)$" %) args))) - (setq args (cons (format "--%s-order" (match-string 1 order)) + (setq args (cons (format "--%s-order" (match-str 1 order)) (remove order args)))) (when (member "--decorate" args) (setq args (cons "--decorate=full" (remove "--decorate" args)))) @@ -1456,9 +1456,9 @@ Do not add this to a hook variable." (goto-char (line-beginning-position)) (when (and refsub (string-match "\\`\\([^ ]\\) \\+\\(..\\)\\(..\\)" date)) - (setq date (+ (string-to-number (match-string 1 date)) - (* (string-to-number (match-string 2 date)) 60 60) - (* (string-to-number (match-string 3 date)) 60)))) + (setq date (+ (string-to-number (match-str 1 date)) + (* (string-to-number (match-str 2 date)) 60 60) + (* (string-to-number (match-str 3 date)) 60)))) (magit-log-format-margin hash author date)) (when (and (eq style 'cherry) (magit-buffer-margin-p)) @@ -1502,7 +1502,7 @@ Do not add this to a hook variable." (save-excursion (forward-line -1) (looking-at "[-_/|\\*o<>. ]*")) - (setq graph (match-string 0)) + (setq graph (match-str 0)) (unless (string-match-p "[/\\.]" graph) (insert graph ?\n)))))))) t) @@ -2055,4 +2055,9 @@ all others with \"-\"." ;;; _ (provide 'magit-log) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-log.el ends here diff --git a/lisp/magit-margin.el b/lisp/magit-margin.el index b710fbd..eff1a98 100644 --- a/lisp/magit-margin.el +++ b/lisp/magit-margin.el @@ -250,4 +250,9 @@ English.") ;;; _ (provide 'magit-margin) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-margin.el ends here diff --git a/lisp/magit-merge.el b/lisp/magit-merge.el index 4dc003f..28a702c 100644 --- a/lisp/magit-merge.el +++ b/lisp/magit-merge.el @@ -312,4 +312,9 @@ If no merge is in progress, do nothing." ;;; _ (provide 'magit-merge) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-merge.el ends here diff --git a/lisp/magit-mode.el b/lisp/magit-mode.el index d5ebee7..e6b2aad 100644 --- a/lisp/magit-mode.el +++ b/lisp/magit-mode.el @@ -1583,4 +1583,9 @@ line. Avoid including the line after the end of the file." ;;; _ (provide 'magit-mode) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-mode.el ends here diff --git a/lisp/magit-notes.el b/lisp/magit-notes.el index 0b26215..b53e7cb 100644 --- a/lisp/magit-notes.el +++ b/lisp/magit-notes.el @@ -194,8 +194,13 @@ Also see `magit-notes-merge'." (list (magit-read-branch-or-commit prompt (magit-stash-at-point)) (and-let* ((str (seq-find (##string-match "^--ref=\\(.+\\)" %) (transient-args 'magit-notes)))) - (match-string 1 str)))) + (match-str 1 str)))) ;;; _ (provide 'magit-notes) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-notes.el ends here diff --git a/lisp/magit-patch.el b/lisp/magit-patch.el index 88641d5..8b55299 100644 --- a/lisp/magit-patch.el +++ b/lisp/magit-patch.el @@ -325,4 +325,9 @@ is asked to pull. START has to be reachable from that commit." ;;; _ (provide 'magit-patch) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-patch.el ends here diff --git a/lisp/magit-process.el b/lisp/magit-process.el index 9b54b52..637db3a 100644 --- a/lisp/magit-process.el +++ b/lisp/magit-process.el @@ -947,8 +947,8 @@ PARENT is used as the parent of the returned keymap." (y-or-n-p-map (magit-process-make-keymap process y-or-n-p-map))) (yes-or-no-p (substring string 0 beg)))) - (concat (downcase (match-string 1 string)) "\n") - (concat (downcase (match-string 2 string)) "\n"))))) + (concat (downcase (match-str 1 string)) "\n") + (concat (downcase (match-str 2 string)) "\n"))))) (defun magit-process-password-auth-source (key) "Use `auth-source-search' to get a password. @@ -990,8 +990,8 @@ be translated on the fly by doing this once (require 'auth-source) (and (fboundp 'auth-source-search) (string-match "\\`\\(.+\\)@\\([^@]+\\)\\'" key) - (let* ((user (match-string 1 key)) - (host (match-string 2 key)) + (let* ((user (match-str 1 key)) + (host (match-str 2 key)) (secret (plist-get (car (or (auth-source-search :max 1 :host host :user user) @@ -1026,7 +1026,7 @@ from the user." magit-process-password-prompt-regexps string))) (process-send-string process - (concat (or (and-let* ((key (match-string 99 string))) + (concat (or (and-let* ((key (match-str 99 string))) (run-hook-with-args-until-success 'magit-process-find-password-functions key)) (let ((read-passwd-map @@ -1048,7 +1048,7 @@ from the user." "Match STRING against PROMPTS and set match data. Return the matched string, appending \": \" if needed." (when (seq-some (##string-match % string) prompts) - (let ((prompt (match-string 0 string))) + (let ((prompt (match-str 0 string))) (cond ((string-suffix-p ": " prompt) prompt) ((string-suffix-p ":" prompt) (concat prompt " ")) (t (concat prompt ": ")))))) @@ -1209,7 +1209,7 @@ If STR is supplied, it replaces the `mode-line-process' text." (lambda (re) (save-excursion (and (re-search-backward re (oref section start) t) - (match-string-no-properties 1)))))))))) + (match-str 1)))))))))) (defun magit-process-error-tooltip (process-buf section) "Returns the text from SECTION of the PROCESS-BUF buffer. @@ -1344,4 +1344,9 @@ Limited by `magit-process-error-tooltip-max-lines'." ;;; _ (provide 'magit-process) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-process.el ends here diff --git a/lisp/magit-pull.el b/lisp/magit-pull.el index 7116c29..23b1058 100644 --- a/lisp/magit-pull.el +++ b/lisp/magit-pull.el @@ -163,4 +163,9 @@ the upstream." ;;; _ (provide 'magit-pull) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-pull.el ends here diff --git a/lisp/magit-push.el b/lisp/magit-push.el index 1b8acb4..e433839 100644 --- a/lisp/magit-push.el +++ b/lisp/magit-push.el @@ -370,4 +370,9 @@ You can add this command as a suffix using something like: ;;; _ (provide 'magit-push) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-push.el ends here diff --git a/lisp/magit-reflog.el b/lisp/magit-reflog.el index 7ffce3e..5163686 100644 --- a/lisp/magit-reflog.el +++ b/lisp/magit-reflog.el @@ -189,9 +189,9 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (defun magit-reflog-format-subject (subject) (let* ((match (string-match magit-reflog-subject-re subject)) - (command (and match (match-string 1 subject))) - (option (and match (match-string 2 subject))) - (type (and match (match-string 3 subject))) + (command (and match (match-str 1 subject))) + (option (and match (match-str 2 subject))) + (type (and match (match-str 3 subject))) (label (if (string= command "commit") (or type command) command)) @@ -205,4 +205,9 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. ;;; _ (provide 'magit-reflog) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-reflog.el ends here diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el index a26981a..6ae65c4 100644 --- a/lisp/magit-refs.el +++ b/lisp/magit-refs.el @@ -547,8 +547,8 @@ line is inserted at all." (magit-insert-heading (length tags) "Tags") (dolist (tag tags) (string-match "^\\([^ \t]+\\)[ \t]+\\([^ \t\n].*\\)?" tag) - (let ((tag (match-string 1 tag)) - (msg (match-string 2 tag))) + (let ((tag (match-str 1 tag)) + (msg (match-str 2 tag))) (when (magit-refs--insert-refname-p tag) (magit-insert-section (tag tag t) (magit-insert-heading @@ -709,20 +709,20 @@ line is inserted at all." (string-match "ahead \\([0-9]+\\)" u:track) (magit--propertize-face (concat (and magit-refs-pad-commit-counts " ") - (match-string 1 u:track) + (match-str 1 u:track) ">") 'magit-dimmed))) (u:behind (and u:track (string-match "behind \\([0-9]+\\)" u:track) (magit--propertize-face (concat "<" - (match-string 1 u:track) + (match-str 1 u:track) (and magit-refs-pad-commit-counts " ")) 'magit-dimmed))) (p:ahead (and pushp p:track (string-match "ahead \\([0-9]+\\)" p:track) (magit--propertize-face - (concat (match-string 1 p:track) + (concat (match-str 1 p:track) ">" (and magit-refs-pad-commit-counts " ")) 'magit-branch-remote))) @@ -730,7 +730,7 @@ line is inserted at all." (string-match "behind \\([0-9]+\\)" p:track) (magit--propertize-face (concat "<" - (match-string 1 p:track) + (match-str 1 p:track) (and magit-refs-pad-commit-counts " ")) 'magit-dimmed)))) (list (1+ (length (concat branch-pretty u:ahead p:ahead u:behind))) @@ -811,4 +811,9 @@ line is inserted at all." ;;; _ (provide 'magit-refs) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-refs.el ends here diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el index e4cdab7..6822fac 100644 --- a/lisp/magit-remote.el +++ b/lisp/magit-remote.el @@ -175,8 +175,8 @@ the now stale refspecs. Other stale branches are not removed." stale) (dolist (refspec refspecs) (when (string-match magit--refspec-re refspec) - (let ((theirs (match-string 2 refspec)) - (ours (match-string 3 refspec))) + (let ((theirs (match-str 2 refspec)) + (ours (match-str 3 refspec))) (unless (if (string-match "\\*" theirs) (let ((re (replace-match ".*" t t theirs))) (seq-some (##string-match-p re %) remote-refs)) @@ -393,4 +393,9 @@ refspec." ;;; _ (provide 'magit-remote) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-remote.el ends here diff --git a/lisp/magit-repos.el b/lisp/magit-repos.el index b815757..87a4422 100644 --- a/lisp/magit-repos.el +++ b/lisp/magit-repos.el @@ -384,7 +384,7 @@ Usually this is just its basename." (when (match-end 4) (magit--put-face (or (match-beginning 3) (match-beginning 4)) (match-end 4) 'error v)) - (when (and (equal (match-string 2 v) "1") + (when (and (equal (match-str 2 v) "1") (string-match-p magit-repolist-column-version-resume-regexp (magit-rev-format "%s"))) (setq v (replace-match (propertize "+" 'face 'shadow) t t v 1)))) @@ -397,8 +397,8 @@ Usually this is just its basename." (defun magit-repolist-version< (a b) (save-match-data (let ((re "[0-9]+\\(\\.[0-9]*\\)*")) - (setq a (and (string-match re a) (match-string 0 a))) - (setq b (and (string-match re b) (match-string 0 b))) + (setq a (and (string-match re a) (match-str 0 a))) + (setq b (and (string-match re b) (match-str 0 b))) (cond ((and a b) (version< a b)) (b nil) (t t))))) @@ -544,4 +544,9 @@ instead." ;;; _ (provide 'magit-repos) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-repos.el ends here diff --git a/lisp/magit-reset.el b/lisp/magit-reset.el index a166dd9..5b099fc 100644 --- a/lisp/magit-reset.el +++ b/lisp/magit-reset.el @@ -134,4 +134,9 @@ or \"detached head\" will be substituted for %s." ;;; _ (provide 'magit-reset) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-reset.el ends here diff --git a/lisp/magit-section.el b/lisp/magit-section.el index 6f8e2c4..0c0b31d 100644 --- a/lisp/magit-section.el +++ b/lisp/magit-section.el @@ -2604,4 +2604,9 @@ with the variables' values as arguments, which were recorded by ;;; _ (provide 'magit-section) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-section.el ends here diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el index 757bd59..3680229 100644 --- a/lisp/magit-sequence.el +++ b/lisp/magit-sequence.el @@ -1010,7 +1010,7 @@ status buffer (i.e., the reverse of how they will be applied)." (if (eq (oref obj action-type) 'merge) (let ((options (oref obj action-options))) (and (string-match "-[cC] \\([^ ]+\\)" options) - (match-string 1 options))) + (match-str 1 options))) (oref obj target))) commits))))) (cl-assert (equal (length commits) (length abbrevs))) @@ -1141,4 +1141,9 @@ status buffer (i.e., the reverse of how they will be applied)." ;;; _ (provide 'magit-sequence) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-sequence.el ends here diff --git a/lisp/magit-sparse-checkout.el b/lisp/magit-sparse-checkout.el index 1df657a..e4fb663 100644 --- a/lisp/magit-sparse-checkout.el +++ b/lisp/magit-sparse-checkout.el @@ -155,4 +155,9 @@ This header is not inserted by default. To enable it, add it to ;;; _ (provide 'magit-sparse-checkout) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-sparse-checkout.el ends here diff --git a/lisp/magit-stash.el b/lisp/magit-stash.el index 84fbebd..0296528 100644 --- a/lisp/magit-stash.el +++ b/lisp/magit-stash.el @@ -681,4 +681,9 @@ that make up the stash." ;;; _ (provide 'magit-stash) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-stash.el ends here diff --git a/lisp/magit-status.el b/lisp/magit-status.el index 66ee907..9f84e95 100644 --- a/lisp/magit-status.el +++ b/lisp/magit-status.el @@ -817,4 +817,9 @@ Honor the buffer's file filter, which can be set using \"D - -\"." ;;; _ (provide 'magit-status) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-status.el ends here diff --git a/lisp/magit-submodule.el b/lisp/magit-submodule.el index 9d2b336..503a1f4 100644 --- a/lisp/magit-submodule.el +++ b/lisp/magit-submodule.el @@ -230,7 +230,7 @@ it is nil, then PATH also becomes the name." (file-relative-name (read-directory-name prompt nil nil nil (and (string-match "\\([^./]+\\)\\(\\.git\\)?$" url) - (match-string 1 url)))))) + (match-str 1 url)))))) (defun magit-submodule-add-1 (url &optional path name args) (magit-with-toplevel @@ -592,10 +592,10 @@ These sections can be expanded to show the respective commits." (magit-insert-section ((eval type) nil t) (string-match "\\`\\(.+\\) \\([^ ]+\\)\\'" heading) (magit-insert-heading - (propertize (match-string 1 heading) + (propertize (match-str 1 heading) 'font-lock-face 'magit-section-heading) " " - (propertize (match-string 2 heading) + (propertize (match-str 2 heading) 'font-lock-face 'magit-branch-remote) ":") (dolist (module modules) @@ -612,8 +612,8 @@ These sections can be expanded to show the respective commits." (propertize module 'font-lock-face 'magit-diff-file-heading)) (dolist (line lines) (string-match magit-log-module-re line) - (let ((rev (match-string 1 line)) - (msg (match-string 2 line))) + (let ((rev (match-str 1 line)) + (msg (match-str 2 line))) (magit-insert-section (module-commit rev t) (insert (propertize rev 'font-lock-face 'magit-hash) " " (magit-log--wash-summary msg) "\n"))))))) @@ -713,4 +713,9 @@ These sections can be expanded to show the respective commits." ;;; _ (provide 'magit-submodule) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-submodule.el ends here diff --git a/lisp/magit-subtree.el b/lisp/magit-subtree.el index b771a23..0ad655a 100644 --- a/lisp/magit-subtree.el +++ b/lisp/magit-subtree.el @@ -184,4 +184,9 @@ ;;; _ (provide 'magit-subtree) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-subtree.el ends here diff --git a/lisp/magit-tag.el b/lisp/magit-tag.el index 94f2802..a696686 100644 --- a/lisp/magit-tag.el +++ b/lisp/magit-tag.el @@ -167,7 +167,7 @@ that is not the case, propose a message using a reasonable format." (`(,pver ,ptag ,pmsg) (car (magit--list-releases))) (msg (magit-rev-format "%s")) (ver (and (string-match magit-release-commit-regexp msg) - (match-string 1 msg))) + (match-str 1 msg))) (_ (and (not ver) (require (quote sisyphus) nil t) (string-match magit-release-commit-regexp @@ -185,14 +185,14 @@ that is not the case, propose a message using a reasonable format." ver))) (ver (concat (and (string-match magit-release-tag-regexp ptag) - (match-string 1 ptag)) + (match-str 1 ptag)) ver)) (t (read-string (format "Create release tag (previous was %s): " ptag) ptag)))) (ver (and (string-match magit-release-tag-regexp tag) - (match-string 2 tag)))) + (match-str 2 tag)))) (list tag (and (seq-some (apply-partially #'string-match-p @@ -232,7 +232,7 @@ a tag qualifies as a release tag." (let ((tag (substring line 0 (match-beginning 0))) (msg (substring line (match-end 0)))) (and (string-match magit-release-tag-regexp tag) - (let ((ver (match-string 2 tag)) + (let ((ver (match-str 2 tag)) (version-regexp-alist magit-tag-version-regexp-alist)) (list (list (version-to-list ver) @@ -245,4 +245,9 @@ a tag qualifies as a release tag." ;;; _ (provide 'magit-tag) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-tag.el ends here diff --git a/lisp/magit-transient.el b/lisp/magit-transient.el index 7ebd10c..55dc374 100644 --- a/lisp/magit-transient.el +++ b/lisp/magit-transient.el @@ -240,4 +240,9 @@ The value derives from that returned by `transient-get-value'." ;;; _ (provide 'magit-transient) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-transient.el ends here diff --git a/lisp/magit-wip.el b/lisp/magit-wip.el index 712b784..117d79e 100644 --- a/lisp/magit-wip.el +++ b/lisp/magit-wip.el @@ -430,7 +430,7 @@ many \"branches\" of each wip ref are shown." reflog :test #'string-match-p)) (when (and (cadr reflog) (string-match "^[^ ]+ \\([^:]+\\)" (cadr reflog))) - (push (match-string 1 (cadr reflog)) tips)) + (push (match-str 1 (cadr reflog)) tips)) (setq reflog (cddr reflog)) (cl-decf count)) (cons wipref (nreverse tips))))) @@ -458,4 +458,9 @@ many \"branches\" of each wip ref are shown." ;;; _ (provide 'magit-wip) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-wip.el ends here diff --git a/lisp/magit-worktree.el b/lisp/magit-worktree.el index 0ea5392..80b3a0f 100644 --- a/lisp/magit-worktree.el +++ b/lisp/magit-worktree.el @@ -293,4 +293,9 @@ with padding for alignment." ;;; _ (provide 'magit-worktree) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit-worktree.el ends here diff --git a/lisp/magit.el b/lisp/magit.el index 7c41eec..0251aaa 100644 --- a/lisp/magit.el +++ b/lisp/magit.el @@ -651,7 +651,7 @@ the output in the kill ring. (let ((dirname (file-name-nondirectory (directory-file-name topdir)))) (when (string-match "\\`magit-\\([0-9].*\\)" dirname) - (setq magit-version (match-string 1 dirname))))) + (setq magit-version (match-str 1 dirname))))) ;; If all else fails, just report the commit hash. It's ;; better than nothing and we cannot do better in the case ;; of e.g., a shallow clone. @@ -796,4 +796,9 @@ For X11 something like ~/.xinitrc should work.\n" (add-hook 'after-init-hook #'magit-startup-asserts t) (add-hook 'after-init-hook #'magit-version t))) +;; Local Variables: +;; read-symbol-shorthands: ( +;; ("match-string" . "match-string") +;; ("match-str" . "match-string-no-properties")) +;; End: ;;; magit.el ends here |
