branch: elpa/magit commit 7b13ced2978fec4a45bf24a9124d9767249a55a5 Author: Jonas Bernoulli <jo...@bernoul.li> Commit: Jonas Bernoulli <jo...@bernoul.li>
Use ## more --- lisp/git-commit.el | 2 +- lisp/git-rebase.el | 3 +-- lisp/magit-apply.el | 7 ++----- lisp/magit-base.el | 6 +++--- lisp/magit-bisect.el | 2 +- lisp/magit-blame.el | 3 +-- lisp/magit-diff.el | 16 ++++++++-------- lisp/magit-ediff.el | 3 +-- lisp/magit-fetch.el | 4 ++-- lisp/magit-git.el | 20 ++++++++------------ lisp/magit-log.el | 8 ++------ lisp/magit-refs.el | 7 +++---- lisp/magit-remote.el | 8 +++----- lisp/magit-section.el | 10 +++++----- lisp/magit-sequence.el | 4 ++-- lisp/magit-sparse-checkout.el | 2 +- lisp/magit-stash.el | 2 +- lisp/magit-status.el | 3 +-- 18 files changed, 46 insertions(+), 64 deletions(-) diff --git a/lisp/git-commit.el b/lisp/git-commit.el index 7218168aa9..c89abe52a6 100644 --- a/lisp/git-commit.el +++ b/lisp/git-commit.el @@ -302,7 +302,7 @@ See also manpage git-interpret-trailer(1). This package does not use that Git command, but the initial description still serves as a good introduction." :group 'git-commit - :safe (lambda (val) (and (listp val) (seq-every-p #'stringp val))) + :safe (##and (listp %) (seq-every-p #'stringp %)) :type '(repeat string)) (defcustom git-commit-use-local-message-ring nil diff --git a/lisp/git-rebase.el b/lisp/git-rebase.el index d2d9ef10bd..afe5da9806 100644 --- a/lisp/git-rebase.el +++ b/lisp/git-rebase.el @@ -588,8 +588,7 @@ commit. For an upper-case -C, the message will be used as is." (insert (format "merge %s %s %s\n" (replace-regexp-in-string - "-[cC]" (lambda (c) - (if (equal c "-c") "-C" "-c")) + "-[cC]" (##if (equal % "-c") "-C" "-c") action-options t t) target trailer))) diff --git a/lisp/magit-apply.el b/lisp/magit-apply.el index a49f8fedd5..25a62860c4 100644 --- a/lisp/magit-apply.el +++ b/lisp/magit-apply.el @@ -274,8 +274,7 @@ return nil, possibly causing whitespace changes to be applied." "--ignore-all-space" "--ignore-blank-lines"))) magit-buffer-diff-args) - (not (cl-find-if (lambda (section) - (oref section binary)) + (not (cl-find-if (##oref % binary) (ensure-list selection))))) ;;;; Stage @@ -624,9 +623,7 @@ of a side, then keep that side without prompting." (magit-read-char-case (format "For these %d files\n%s\ncheckout:\n" (length files) - (mapconcat (lambda (file) - (concat " " file)) - files "\n")) + (mapconcat (##concat " " %) files "\n")) t (?o "[o]ur stage" "--ours") (?t "[t]heir stage" "--theirs") diff --git a/lisp/magit-base.el b/lisp/magit-base.el index 5a967a2e33..b2b401f201 100644 --- a/lisp/magit-base.el +++ b/lisp/magit-base.el @@ -808,12 +808,12 @@ ACTION is a member of option `magit-slow-confirm'." (when (and prompt (listp prompt)) (setq prompt (apply #'format (car prompt) - (mapcar (lambda (a) (if (stringp a) (string-replace "%" "%%" a) a)) + (mapcar (##if (stringp %) (string-replace "%" "%%" %) %) (cdr prompt))))) (when (and prompt-n (listp prompt-n)) (setq prompt-n (apply #'format (car prompt-n) - (mapcar (lambda (a) (if (stringp a) (string-replace "%" "%%" a) a)) + (mapcar (##if (stringp %) (string-replace "%" "%%" %) %) (cdr prompt-n))))) (setq prompt-n (format (concat (or prompt-n prompt) "? ") (length items))) (setq prompt (format (concat (or prompt (magit-confirm-make-prompt action)) @@ -878,7 +878,7 @@ See info node `(magit)Debugging Tools' for more information." `(,(concat invocation-directory invocation-name) "-Q" "--eval" "(setq debug-on-error t)" ,@(mapcan - (lambda (dir) (list "-L" dir)) + (##list "-L" %) (delete-dups (mapcan (lambda (lib) diff --git a/lisp/magit-bisect.el b/lisp/magit-bisect.el index 3d64daae20..8c737c13c0 100644 --- a/lisp/magit-bisect.el +++ b/lisp/magit-bisect.el @@ -62,7 +62,7 @@ ["Arguments" ("-n" "Don't checkout commits" "--no-checkout") ("-p" "Follow only first parent of a merge" "--first-parent" - :if (lambda () (magit-git-version>= "2.29"))) + :if (##magit-git-version>= "2.29")) (magit-bisect:--term-old :level 6) (magit-bisect:--term-new :level 6)] ["Actions" diff --git a/lisp/magit-blame.el b/lisp/magit-blame.el index 424a8740be..d6af784917 100644 --- a/lisp/magit-blame.el +++ b/lisp/magit-blame.el @@ -343,8 +343,7 @@ in `magit-blame-read-only-mode-map' instead." (unless magit-blame--style (setq magit-blame--style (car magit-blame-styles))) (setq magit-blame--make-margin-overlays - (and (cl-find-if (lambda (style) - (assq 'margin-format (cdr style))) + (and (cl-find-if (##assq 'margin-format (cdr %)) magit-blame-styles))) (magit-blame--update-margin 'enable)) (t diff --git a/lisp/magit-diff.el b/lisp/magit-diff.el index baefff3738..eb904fab58 100644 --- a/lisp/magit-diff.el +++ b/lisp/magit-diff.el @@ -197,7 +197,7 @@ keep their distinct foreground colors." `t' Show fine differences for the current diff hunk only. `all' Show fine differences for all displayed diff hunks." :group 'magit-diff - :safe (lambda (val) (memq val '(nil t all))) + :safe (##memq % '(nil t all)) :type '(choice (const :tag "Never" nil) (const :tag "Current" t) (const :tag "All" all))) @@ -258,7 +258,7 @@ The options `magit-diff-highlight-trailing' and `magit-diff-highlight-indentation' control what kind of whitespace errors are highlighted." :group 'magit-diff - :safe (lambda (val) (memq val '(t nil uncommitted status))) + :safe (##memq % '(t nil uncommitted status)) :type '(choice (const :tag "In all diffs" t) (const :tag "Only in uncommitted changes" uncommitted) (const :tag "Never" nil))) @@ -271,7 +271,7 @@ whitespace errors are highlighted." `all' Highlight in added, removed and context lines." :package-version '(magit . "3.0.0") :group 'magit-diff - :safe (lambda (val) (memq val '(t both all))) + :safe (##memq % '(t both all)) :type '(choice (const :tag "In added lines" t) (const :tag "In added and removed lines" both) (const :tag "In added, removed and context lines" all))) @@ -1522,12 +1522,12 @@ instead." (defun magit-diff-less-context (&optional count) "Decrease the context for diff hunks by COUNT lines." (interactive "p") - (magit-diff-set-context (lambda (cur) (max 0 (- (or cur 0) count))))) + (magit-diff-set-context (##max 0 (- (or % 0) count)))) (defun magit-diff-more-context (&optional count) "Increase the context for diff hunks by COUNT lines." (interactive "p") - (magit-diff-set-context (lambda (cur) (+ (or cur 0) count)))) + (magit-diff-set-context (##+ (or % 0) count))) (defun magit-diff-default-context () "Reset context for diff hunks to the default height." @@ -2232,7 +2232,7 @@ keymap is the parent of their keymaps." (unless (equal cmd "merge-tree") (push "--ita-visible-in-index" args)) (setq args (magit-diff--maybe-add-stat-arguments args)) - (when (cl-member-if (lambda (arg) (string-prefix-p "--color-moved" arg)) args) + (when (cl-member-if (##string-prefix-p "--color-moved" %) args) (push "--color=always" args) (setq magit-git-global-arguments (append magit-diff--reset-non-color-moved @@ -2339,7 +2339,7 @@ keymap is the parent of their keymaps." (if (looking-at "^$") (forward-line) (insert "\n")))))) (defun magit-diff-wash-diff (args) - (when (cl-member-if (lambda (arg) (string-prefix-p "--color-moved" arg)) args) + (when (cl-member-if (##string-prefix-p "--color-moved" %) args) (require 'ansi-color) (ansi-color-apply-on-region (point-min) (point-max))) (cond @@ -2454,7 +2454,7 @@ keymap is the parent of their keymaps." (setq header (nreverse header)) ;; KLUDGE `git-log' ignores `--no-prefix' when `-L' is used. (when (and (derived-mode-p 'magit-log-mode) - (seq-some (lambda (arg) (string-prefix-p "-L" arg)) + (seq-some (##string-prefix-p "-L" %) magit-buffer-log-args)) (when orig (setq orig (substring orig 2))) diff --git a/lisp/magit-ediff.el b/lisp/magit-ediff.el index 8c8d026c1b..da78e55e15 100644 --- a/lisp/magit-ediff.el +++ b/lisp/magit-ediff.el @@ -224,8 +224,7 @@ and alternative commands." (let* ((dir (magit-gitdir)) (revA (or (magit-name-branch "HEAD") (magit-commit-p "HEAD"))) - (revB (cl-find-if (lambda (head) - (file-exists-p (expand-file-name head dir))) + (revB (cl-find-if (##file-exists-p (expand-file-name % dir)) '("MERGE_HEAD" "CHERRY_PICK_HEAD" "REVERT_HEAD"))) (revB (or (magit-name-branch revB) (magit-commit-p revB))) diff --git a/lisp/magit-fetch.el b/lisp/magit-fetch.el index 18a2d631e4..7ef4504b77 100644 --- a/lisp/magit-fetch.el +++ b/lisp/magit-fetch.el @@ -99,8 +99,8 @@ Otherwise if a remote named \"origin\" exists, then use that. If no remote can be determined, then this command is not available from the `magit-fetch' transient prefix and invoking it directly results in an error." - :if (lambda () (magit-get-current-remote t)) - :description (lambda () (magit-get-current-remote t)) + :if (##magit-get-current-remote t) + :description (##magit-get-current-remote t) (interactive (list (magit-get-current-remote t) (magit-fetch-arguments))) (unless remote diff --git a/lisp/magit-git.el b/lisp/magit-git.el index 19f02f9a4b..fb8e46477a 100644 --- a/lisp/magit-git.el +++ b/lisp/magit-git.el @@ -498,7 +498,7 @@ insert the run command and stderr into the process buffer." (defun magit--locate-error-message () (goto-char (point-max)) (and (run-hook-wrapped 'magit-process-error-message-regexps - (lambda (re) (re-search-backward re nil t))) + (##re-search-backward % nil t)) (match-string-no-properties 1))) (defun magit-git-string (&rest args) @@ -1182,7 +1182,7 @@ Sorted from longest to shortest CYGWIN name." (setq filename (expand-file-name filename))) (if-let ((cyg:win (and (not (file-remote-p default-directory)) ; see #4976 (cl-assoc filename magit-cygwin-mount-points - :test (lambda (f cyg) (string-prefix-p cyg f)))))) + :test (##string-prefix-p %2 %1))))) (concat (cdr cyg:win) (substring filename (length (car cyg:win)))) filename)) @@ -1196,7 +1196,7 @@ Sorted from longest to shortest CYGWIN name." 3. Deal with an `windows-nt' Emacs vs. Cygwin Git incompatibility." (if (file-name-absolute-p filename) (if-let ((cyg:win (cl-rassoc filename magit-cygwin-mount-points - :test (lambda (f win) (string-prefix-p win f))))) + :test (##string-prefix-p %2 %1)))) (concat (car cyg:win) (substring filename (length (cdr cyg:win)))) (let ((expanded (expand-file-name filename))) @@ -1286,8 +1286,7 @@ are considered." (not (magit-module-worktree-p module))) (defun magit-ignore-submodules-p (&optional return-argument) - (or (cl-find-if (lambda (arg) - (string-prefix-p "--ignore-submodules" arg)) + (or (cl-find-if (##string-prefix-p "--ignore-submodules" %) magit-buffer-diff-args) (and-let* ((value (magit-get "diff.ignoreSubmodules"))) (if return-argument @@ -1630,7 +1629,7 @@ The amount of time spent searching is limited by (defun magit--set-default-branch (newname oldname) (let ((remote (or (magit-primary-remote) (user-error "Cannot determine primary remote"))) - (branches (mapcar (lambda (line) (split-string line "\t")) + (branches (mapcar (##split-string % "\t") (magit-git-lines "for-each-ref" "refs/heads" "--format=%(refname:short)\t%(upstream:short)")))) @@ -1808,8 +1807,7 @@ exists, then remotes in `magit-primary-remote-names' are tried in order and the first remote from that list that actually exists in the current repository is considered its primary remote." (let ((remotes (magit-list-remotes))) - (seq-find (lambda (name) - (member name remotes)) + (seq-find (##member % remotes) (delete-dups (delq nil (cons (magit-get "magit.primaryRemote") @@ -1983,8 +1981,7 @@ SORTBY is a key or list of keys to pass to the `--sort' flag of (defun magit-list-special-refnames () (let ((gitdir (magit-gitdir))) - (cl-remove-if-not (lambda (name) - (file-exists-p (expand-file-name name gitdir))) + (cl-remove-if-not (##file-exists-p (expand-file-name % gitdir)) magit-special-refnames))) (defun magit-list-branch-names () @@ -2183,8 +2180,7 @@ exists, then the branch names in `magit-main-branch-names' are tried in order. The first branch from that list that actually exists in the current repository is considered its main branch." (let ((branches (magit-list-local-branch-names))) - (seq-find (lambda (name) - (member name branches)) + (seq-find (##member % branches) (delete-dups (delq nil (cons (magit-get "init.defaultBranch") diff --git a/lisp/magit-log.el b/lisp/magit-log.el index 6dbf8b4e4c..c623d347bf 100644 --- a/lisp/magit-log.el +++ b/lisp/magit-log.el @@ -1145,8 +1145,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (setq revs (if (< (string-to-number count) limit) revs (format "%s~%s..%s" revs limit revs)))) - (let ((delay (cl-find-if (lambda (arg) - (member arg '("++header" "--patch" "--stat"))) + (let ((delay (cl-find-if (##member % '("++header" "--patch" "--stat")) args))) (setq magit-section-inhibit-markers (if delay 'delay t)) (setq magit-section-insert-in-reverse (not delay))) @@ -1179,10 +1178,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (defun magit-log-header-line-arguments (revs args files) "Return string describing some of the used arguments." - (mapconcat (lambda (arg) - (if (string-search " " arg) - (prin1 arg) - arg)) + (mapconcat (##if (string-search " " %) (prin1 %) %) `("git" "log" ,@args ,@revs "--" ,@files) " ")) diff --git a/lisp/magit-refs.el b/lisp/magit-refs.el index 09eb881848..be8a961368 100644 --- a/lisp/magit-refs.el +++ b/lisp/magit-refs.el @@ -63,7 +63,7 @@ To change the value in an existing buffer use the command `magit-refs-set-show-commit-count'." :package-version '(magit . "2.1.0") :group 'magit-refs - :safe (lambda (val) (memq val '(all branch nil))) + :safe (##memq % '(all branch nil)) :type '(choice (const :tag "For branches and tags" all) (const :tag "For branches only" branch) (const :tag "Never" nil))) @@ -134,7 +134,7 @@ AUTHOR-WIDTH has to be an integer. When the name of the author :package-version '(magit . "2.9.0") :group 'magit-refs :group 'magit-margin - :safe (lambda (val) (memq val '(all branch nil))) + :safe (##memq % '(all branch nil)) :type magit-log-margin--custom-type :initialize #'magit-custom-initialize-reset :set-after '(magit-log-margin) @@ -333,8 +333,7 @@ Type \\[magit-reset] to reset `HEAD' to the commit at point. (transient-define-prefix magit-show-refs (&optional transient) "List and compare references in a dedicated buffer." :man-page "git-branch" - :value (lambda () - (magit-show-refs-arguments magit-prefix-use-buffer-arguments)) + :value (##magit-show-refs-arguments magit-prefix-use-buffer-arguments) ["Arguments" (magit-for-each-ref:--contains) ("-M" "Merged" "--merged=" magit-transient-read-revision) diff --git a/lisp/magit-remote.el b/lisp/magit-remote.el index b5fdbf28a0..77a79a31c4 100644 --- a/lisp/magit-remote.el +++ b/lisp/magit-remote.el @@ -68,7 +68,7 @@ has to be used to view and change remote related variables." :man-page "git-remote" :value '("-f") ["Variables" - :if (lambda () (and magit-remote-direct-configure (transient-scope))) + :if (##and magit-remote-direct-configure (transient-scope)) ("u" magit-remote.<remote>.url) ("U" magit-remote.<remote>.fetch) ("s" magit-remote.<remote>.pushurl) @@ -210,13 +210,11 @@ the now stale refspecs. Other stale branches are not removed." nil refs)) (magit-confirm 'prune-stale-refspecs nil (format "Prune %%d stale refspecs and %d branches" - (length (mapcan (lambda (s) (copy-sequence (cdr s))) - stale))) + (length (mapcan (##copy-sequence (cdr %)) stale))) nil (mapcar (pcase-lambda (`(,refspec . ,refs)) (concat refspec "\n" - (mapconcat (lambda (b) (concat " " b)) - refs "\n"))) + (mapconcat (##concat " " %) refs "\n"))) stale))) (pcase-dolist (`(,refspec . ,refs) stale) (magit-call-git "config" "--unset" variable diff --git a/lisp/magit-section.el b/lisp/magit-section.el index 5ddd990a2e..065423bdd5 100644 --- a/lisp/magit-section.el +++ b/lisp/magit-section.el @@ -635,11 +635,11 @@ with SECTION, otherwise return a list of section types." (when-let (((not (oref section hidden))) (children (oref section children))) (when (seq-some #'magit-section-content-p children) - (when (seq-some (lambda (c) (oref c hidden)) children) + (when (seq-some (##oref % hidden) children) (keymap-set-after menu "<magit-section-show-children>" `(menu-item "Expand children" magit-section-show-children))) - (when (seq-some (lambda (c) (not (oref c hidden))) children) + (when (seq-some (##not (oref % hidden)) children) (keymap-set-after menu "<magit-section-hide-children>" `(menu-item "Collapse children" magit-section-hide-children))))) @@ -1580,7 +1580,7 @@ is explicitly expanded." (defun magit-insert-headers (hook) (let* ((header-sections nil) - (fn (lambda () (push magit-insert-section--current header-sections)))) + (fn (##push magit-insert-section--current header-sections))) (unwind-protect (progn (add-hook 'magit-insert-section-hook fn -90 t) @@ -2225,7 +2225,7 @@ Configuration'." (message "`%s' contains entries that are no longer valid. %s\nUsing standard value instead. Please re-configure hook variable." hook - (mapconcat (lambda (sym) (format " `%s'" sym)) invalid "\n")) + (mapconcat (##format " `%s'" %) invalid "\n")) (sit-for 5) (setq entries (eval (car (get hook 'standard-value))))) (dolist (entry entries) @@ -2466,7 +2466,7 @@ with the variables' values as arguments, which were recorded by (format "%s%s" (substring (symbol-name major-mode) 0 -5) (if-let ((vars (get major-mode 'magit-bookmark-variables))) - (mapcan (lambda (var) (ensure-list (symbol-value var))) vars) + (mapcan (##ensure-list (symbol-value %)) vars) ""))) ;;; Bitmaps diff --git a/lisp/magit-sequence.el b/lisp/magit-sequence.el index 0fd0142e0c..5cc119a110 100644 --- a/lisp/magit-sequence.el +++ b/lisp/magit-sequence.el @@ -528,11 +528,11 @@ This discards all changes made since the sequence started." :if-not magit-rebase-in-progress-p ("-k" "Keep empty commits" "--keep-empty") ("-p" "Preserve merges" ("-p" "--preserve-merges") - :if (lambda () (magit-git-version< "2.33.0"))) + :if (##magit-git-version< "2.33.0")) ("-r" "Rebase merges" ("-r" "--rebase-merges=") magit-rebase-merges-select-mode) ("-u" "Update branches" "--update-refs" - :if (lambda () (magit-git-version>= "2.38.0"))) + :if (##magit-git-version>= "2.38.0")) (7 magit-merge:--strategy) (7 magit-merge:--strategy-option) (7 "=X" magit-diff:--diff-algorithm :argument "-Xdiff-algorithm=") diff --git a/lisp/magit-sparse-checkout.el b/lisp/magit-sparse-checkout.el index d5ab0e9e2a..1df657a784 100644 --- a/lisp/magit-sparse-checkout.el +++ b/lisp/magit-sparse-checkout.el @@ -113,7 +113,7 @@ directories, call `magit-sparse-checkout-set' instead." (let ((re (concat "\\`" (regexp-opt (magit-sparse-checkout-directories))))) - (lambda (d) (string-match-p re d))) + (##string-match-p re %)) (magit-revision-directories "HEAD"))))) (magit-sparse-checkout--auto-enable) (magit-run-git-async "sparse-checkout" "add" directories)) diff --git a/lisp/magit-stash.el b/lisp/magit-stash.el index dc452d1a0a..ebbcd7d267 100644 --- a/lisp/magit-stash.el +++ b/lisp/magit-stash.el @@ -330,7 +330,7 @@ want to fall back to using \"--3way\", without being prompted." (concat "Could not apply stash because of unstaged changes.\n\n" "To do a tree-way merge, these files have to be staged\n" - (mapconcat (lambda (f) (format " %s" f)) conflicts "\n") + (mapconcat (##format " %s" %) conflicts "\n") "\n") nil (?s (format diff --git a/lisp/magit-status.el b/lisp/magit-status.el index f827de948d..63f852b26d 100644 --- a/lisp/magit-status.el +++ b/lisp/magit-status.el @@ -783,8 +783,7 @@ Honor the buffer's file filter, which can be set using \"D - -\"." (defun magit-insert-ignored-files () "Insert a list of ignored files. Honor the buffer's file filter, which can be set using \"D - -\"." - (magit-insert-files 'ignored - (lambda (args) (magit-ignored-files "--directory" args)))) + (magit-insert-files 'ignored (##magit-ignored-files "--directory" %))) (defun magit-insert-skip-worktree-files () "Insert a list of skip-worktree files.