diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-02-26 16:51:15 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2021-02-26 16:51:15 -0500 |
commit | 99340ad17a826c61895b3e1ed6928b36fbfeac60 (patch) | |
tree | c8dd33d2840c4c5072ba3016a782b48d7d4d40ae /lisp/vc/vc-git.el | |
parent | 2987376bc358b069ee27f4b0757491f1a8157bf2 (diff) | |
download | emacs-99340ad17a826c61895b3e1ed6928b36fbfeac60.tar.gz emacs-99340ad17a826c61895b3e1ed6928b36fbfeac60.tar.bz2 emacs-99340ad17a826c61895b3e1ed6928b36fbfeac60.zip |
lisp/vc/*.el: Use lexical-bindings in all the files
Also remove some redundant `:group` arguments.
* lisp/vc/vc.el (vc-ignore): Autoload.
* lisp/vc/pcvs-util.el (cvs-every, cvs-union, cvs-map): Delete functions.
* lisp/vc/cvs-status.el: Require `cl-lib` at runtime.
(cvs-tree-tags-insert): Use `cl-mapcar` and `cl-every` instead.
* lisp/vc/pcvs.el: Require `cl-lib` at runtime.
(cvs-do-removal): Use `cl-every` instead.
* lisp/vc/ediff-init.el: Require `ediff-util` (for `ediff-cleanup-mess`
and `ediff-default-suspend-function`).
* lisp/vc/pcvs-info.el (cvs-fileinfo<): Remove unused vars `subtypea`
and `subtypeb`.
* lisp/vc/vc-git.el:
* lisp/vc/vc-bzr.el: Require `vc-dispatcher` at runtime for
`vc-do-async-command`.
Diffstat (limited to 'lisp/vc/vc-git.el')
-rw-r--r-- | lisp/vc/vc-git.el | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 25ae26d746a..465ed8735c2 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -106,6 +106,7 @@ ;;; Code: (require 'cl-lib) +(require 'vc-dispatcher) (eval-when-compile (require 'subr-x) ; for string-trim-right (require 'vc) @@ -658,29 +659,29 @@ or an empty string if none." (defvar vc-git-stash-shared-map (let ((map (make-sparse-keymap))) - (define-key map "S" 'vc-git-stash-snapshot) - (define-key map "C" 'vc-git-stash) + (define-key map "S" #'vc-git-stash-snapshot) + (define-key map "C" #'vc-git-stash) map)) (defvar vc-git-stash-map (let ((map (make-sparse-keymap))) (set-keymap-parent map vc-git-stash-shared-map) ;; Turn off vc-dir marking - (define-key map [mouse-2] 'ignore) - - (define-key map [down-mouse-3] 'vc-git-stash-menu) - (define-key map "\C-k" 'vc-git-stash-delete-at-point) - (define-key map "=" 'vc-git-stash-show-at-point) - (define-key map "\C-m" 'vc-git-stash-show-at-point) - (define-key map "A" 'vc-git-stash-apply-at-point) - (define-key map "P" 'vc-git-stash-pop-at-point) + (define-key map [mouse-2] #'ignore) + + (define-key map [down-mouse-3] #'vc-git-stash-menu) + (define-key map "\C-k" #'vc-git-stash-delete-at-point) + (define-key map "=" #'vc-git-stash-show-at-point) + (define-key map "\C-m" #'vc-git-stash-show-at-point) + (define-key map "A" #'vc-git-stash-apply-at-point) + (define-key map "P" #'vc-git-stash-pop-at-point) map)) (defvar vc-git-stash-button-map (let ((map (make-sparse-keymap))) (set-keymap-parent map vc-git-stash-shared-map) - (define-key map [mouse-2] 'push-button) - (define-key map "\C-m" 'push-button) + (define-key map [mouse-2] #'push-button) + (define-key map "\C-m" #'push-button) map)) (defconst vc-git-stash-shared-help @@ -871,7 +872,7 @@ The car of the list is the current branch." (when dlist (vc-git-command nil 0 dlist "add")))) -(defalias 'vc-git-responsible-p 'vc-git-root) +(defalias 'vc-git-responsible-p #'vc-git-root) (defun vc-git-unregister (file) (vc-git-command nil 0 file "rm" "-f" "--cached" "--")) @@ -905,9 +906,9 @@ If toggling on, also insert its message into the buffer." (defvar vc-git-log-edit-mode-map (let ((map (make-sparse-keymap "Git-Log-Edit"))) - (define-key map "\C-c\C-s" 'vc-git-log-edit-toggle-signoff) - (define-key map "\C-c\C-n" 'vc-git-log-edit-toggle-no-verify) - (define-key map "\C-c\C-e" 'vc-git-log-edit-toggle-amend) + (define-key map "\C-c\C-s" #'vc-git-log-edit-toggle-signoff) + (define-key map "\C-c\C-n" #'vc-git-log-edit-toggle-no-verify) + (define-key map "\C-c\C-e" #'vc-git-log-edit-toggle-amend) map)) (define-derived-mode vc-git-log-edit-mode log-edit-mode "Log-Edit/git" @@ -941,7 +942,7 @@ It is based on `log-edit-mode', and has Git-specific extensions.") (lambda (value) (when (equal value "yes") (list argument))))) ;; When operating on the whole tree, better pass "-a" than ".", since "." ;; fails when we're committing a merge. - (apply 'vc-git-command nil 0 (if only files) + (apply #'vc-git-command nil 0 (if only files) (nconc (if msg-file (list "commit" "-F" (file-local-name msg-file)) (list "commit" "-m")) @@ -1024,13 +1025,13 @@ If PROMPT is non-nil, prompt for the Git command to run." args (cddr args))) (setq args (nconc args extra-args)) (require 'vc-dispatcher) - (apply 'vc-do-async-command buffer root git-program command args) + (apply #'vc-do-async-command buffer root git-program command args) (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'git) (setq-local compile-command (concat git-program " " command " " - (mapconcat 'identity args " "))) + (mapconcat #'identity args " "))) (setq-local compilation-directory root) ;; Either set `compilation-buffer-name-function' locally to nil ;; or use `compilation-arguments' to set `name-function'. @@ -1068,7 +1069,7 @@ This prompts for a branch to merge from." branches (cons "FETCH_HEAD" branches)) nil t))) - (apply 'vc-do-async-command buffer root vc-git-program "merge" + (apply #'vc-do-async-command buffer root vc-git-program "merge" (list merge-source)) (with-current-buffer buffer (vc-run-delayed (vc-compilation-mode 'git))) (vc-set-async-update buffer))) @@ -1115,7 +1116,7 @@ This prompts for a branch to merge from." (vc-git-command nil 0 nil "reset")) (vc-resynch-buffer buffer-file-name t t) ;; Remove the hook so that it is not called multiple times. - (remove-hook 'after-save-hook 'vc-git-resolve-when-done t)))) + (remove-hook 'after-save-hook #'vc-git-resolve-when-done t)))) (defun vc-git-find-file-hook () "Activate `smerge-mode' if there is a conflict." @@ -1126,7 +1127,7 @@ This prompts for a branch to merge from." (re-search-forward "^<<<<<<< " nil 'noerror))) (smerge-start-session) (when vc-git-resolve-conflicts - (add-hook 'after-save-hook 'vc-git-resolve-when-done nil 'local)) + (add-hook 'after-save-hook #'vc-git-resolve-when-done nil 'local)) (vc-message-unresolved-conflicts buffer-file-name))) ;;; HISTORY FUNCTIONS @@ -1154,7 +1155,7 @@ If LIMIT is a revision string, use it as an end-revision." ;; read-only. (let ((inhibit-read-only t)) (with-current-buffer buffer - (apply 'vc-git-command buffer + (apply #'vc-git-command buffer 'async files (append '("log" "--no-color") @@ -1224,11 +1225,11 @@ log entries." (read-shell-command "Search log with command: " (format "%s %s" vc-git-program - (mapconcat 'identity args " ")) + (mapconcat #'identity args " ")) 'vc-git-history) " " t)))) (vc-setup-buffer buffer) - (apply 'vc-git-command buffer 'async nil args))) + (apply #'vc-git-command buffer 'async nil args))) (defun vc-git-mergebase (rev1 &optional rev2) (unless rev2 (setq rev2 "HEAD")) @@ -1299,7 +1300,7 @@ or BRANCH^ (where \"^\" can be repeated)." (defun vc-git-expanded-log-entry (revision) (with-temp-buffer - (apply 'vc-git-command t nil nil (list "log" revision "-1" "--")) + (apply #'vc-git-command t nil nil (list "log" revision "-1" "--")) (goto-char (point-min)) (unless (eobp) ;; Indent the expanded log entry. @@ -1415,7 +1416,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"." (vc-git-command (or buffer "*vc-diff*") 1 files "difftool" "--exit-code" "--no-prompt" "-x" (concat "diff " - (mapconcat 'identity + (mapconcat #'identity (vc-switches nil 'diff) " ")) rev1 rev2 "--")))) @@ -1776,7 +1777,7 @@ The difference to vc-do-command is that this function always invokes ,@(when revert-buffer-in-progress-p '("GIT_OPTIONAL_LOCKS=0"))) process-environment))) - (apply 'vc-do-command (or buffer "*vc*") okstatus vc-git-program + (apply #'vc-do-command (or buffer "*vc*") okstatus vc-git-program ;; https://debbugs.gnu.org/16897 (unless (and (not (cdr-safe file-or-list)) (let ((file (or (car-safe file-or-list) @@ -1810,10 +1811,10 @@ The difference to vc-do-command is that this function always invokes ,@(when revert-buffer-in-progress-p '("GIT_OPTIONAL_LOCKS=0"))) process-environment))) - (apply 'process-file vc-git-program nil buffer nil "--no-pager" command args))) + (apply #'process-file vc-git-program nil buffer nil "--no-pager" command args))) (defun vc-git--out-ok (command &rest args) - (zerop (apply 'vc-git--call '(t nil) command args))) + (zerop (apply #'vc-git--call '(t nil) command args))) (defun vc-git--run-command-string (file &rest args) "Run a git command on FILE and return its output as string. @@ -1821,7 +1822,7 @@ FILE can be nil." (let* ((ok t) (str (with-output-to-string (with-current-buffer standard-output - (unless (apply 'vc-git--out-ok + (unless (apply #'vc-git--out-ok (if file (append args (list (file-relative-name file))) |