From 0d42eb3e961e612b1b04e32e99c2998dd4d5d3be Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Wed, 25 Apr 2012 23:18:47 -0400 Subject: [PATCH] =?utf8?q?*=20lisp/vc/vc-mtn.el:=20*=20lisp/vc/vc-hg.el:?= =?utf8?q?=20*=20lisp/vc/vc-git.el:=20*=20lisp/vc/vc-dir.el:=20*=20lisp/vc?= =?utf8?q?/vc-cvs.el:=20*=20lisp/vc/vc-bzr.el:=20*=20lisp/vc/vc-arch.el:?= =?utf8?q?=20*=20lisp/vc/vc.el:=20Replace=20lexical-let=20by=20lexical-bin?= =?utf8?q?ding.=20*=20lisp/minibuffer.el=20(lazy-completion-table):=20Avoi?= =?utf8?q?d=20((=CE=BB=20...)=20...).=20*=20lisp/emacs-lisp/cl-macs.el=20(?= =?utf8?q?lexical-let):=20Fix=20use=20in=20lexical-binding.=20*=20lisp/ema?= =?utf8?q?cs-lisp/cconv.el=20(cconv-analyse-form):=20Warn=20use=20of=20((?= =?utf8?q?=CE=BB=20...)=20...).?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lisp/ChangeLog | 14 +++ lisp/emacs-lisp/cconv.el | 4 +- lisp/emacs-lisp/cl-loaddefs.el | 2 +- lisp/emacs-lisp/cl-macs.el | 22 ++-- lisp/files.el | 3 +- lisp/minibuffer.el | 2 +- lisp/vc/vc-arch.el | 34 +++--- lisp/vc/vc-bzr.el | 209 ++++++++++++++++----------------- lisp/vc/vc-cvs.el | 16 ++- lisp/vc/vc-dir.el | 31 +++-- lisp/vc/vc-git.el | 28 ++--- lisp/vc/vc-hg.el | 25 ++-- lisp/vc/vc-mtn.el | 81 +++++++------ lisp/vc/vc.el | 173 ++++++++++++--------------- 14 files changed, 317 insertions(+), 327 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0427184975..bb40b54279 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,17 @@ +2012-04-26 Stefan Monnier + + * vc/vc-mtn.el: + * vc/vc-hg.el: + * vc/vc-git.el: + * vc/vc-dir.el: + * vc/vc-cvs.el: + * vc/vc-bzr.el: + * vc/vc-arch.el: + * vc/vc.el: Replace lexical-let by lexical-binding. + * minibuffer.el (lazy-completion-table): Avoid ((λ ...) ...). + * emacs-lisp/cl-macs.el (lexical-let): Fix use in lexical-binding. + * emacs-lisp/cconv.el (cconv-analyse-form): Warn use of ((λ ...) ...). + 2012-04-26 Chong Yidong * vc/ediff-wind.el (ediff-setup-windows-default): New function. diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index b6b6a78a9b..3ce0eadab5 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -639,7 +639,9 @@ and updates the data stored in ENV." (cconv-analyse-form (cadr forms) env) (setq forms (cddr forms)))) - (`((lambda . ,_) . ,_) ; first element is lambda expression + (`((lambda . ,_) . ,_) ; First element is lambda expression. + (byte-compile-log-warning + "Use of deprecated ((lambda ...) ...) form" t :warning) (dolist (exp `((function ,(car form)) . ,(cdr form))) (cconv-analyse-form exp env))) diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index 9e0099bb64..48be2f7297 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el @@ -286,7 +286,7 @@ This also does some trivial optimizations to make the form prettier. ;;;;;; flet progv psetq do-all-symbols do-symbols dotimes dolist ;;;;;; do* do loop return-from return block etypecase typecase ecase ;;;;;; case load-time-value eval-when destructuring-bind function* -;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "91b45885535a73dd8015973cb8c988e1") +;;;;;; defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "abb2e33c6f61539d69ddbe7c4046261b") ;;; Generated autoloads from cl-macs.el (autoload 'gensym "cl-macs" "\ diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 4fc71bbbc6..35cda8cfcf 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -1483,18 +1483,24 @@ lexical closures as in Common Lisp. (cons 'progn body) (nconc (mapcar (function (lambda (x) (list (symbol-name (car x)) - (list 'symbol-value (caddr x)) + (list 'symbol-value (caddr x)) t))) vars) (list '(defun . cl-defun-expander)) cl-macro-environment)))) (if (not (get (car (last cl-closure-vars)) 'used)) - (list 'let (mapcar (function (lambda (x) - (list (caddr x) (cadr x)))) vars) - (sublis (mapcar (function (lambda (x) - (cons (caddr x) - (list 'quote (caddr x))))) - vars) - ebody)) + ;; Turn (let ((foo (gensym))) (set foo ) ...(symbol-value foo)...) + ;; into (let ((foo )) ...(symbol-value 'foo)...). + ;; This is good because it's more efficient but it only works with + ;; dynamic scoping, since with lexical scoping we'd need + ;; (let ((foo )) ...foo...). + `(progn + ,@(mapcar (lambda (x) `(defvar ,(caddr x))) vars) + (let ,(mapcar (lambda (x) (list (caddr x) (cadr x))) vars) + ,(sublis (mapcar (lambda (x) + (cons (caddr x) + (list 'quote (caddr x)))) + vars) + ebody))) (list 'let (mapcar (function (lambda (x) (list (caddr x) (list 'make-symbol diff --git a/lisp/files.el b/lisp/files.el index 703b443765..96a5b40e79 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3642,7 +3642,8 @@ and `file-local-variables-alist', without applying them." (when (and enable-local-variables (not (file-remote-p (or (buffer-file-name) default-directory)))) ;; Find the variables file. - (let ((variables-file (dir-locals-find-file (or (buffer-file-name) default-directory))) + (let ((variables-file (dir-locals-find-file + (or (buffer-file-name) default-directory))) (class nil) (dir-name nil)) (cond diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 733a132bb1..59bd0d231d 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -199,7 +199,7 @@ You should give VAR a non-nil `risky-local-variable' property." `(completion-table-dynamic (lambda (,str) (when (functionp ,var) - (setq ,var (,fun))) + (setq ,var (funcall #',fun))) ,var)))) (defun completion-table-case-fold (table &optional dont-fold) diff --git a/lisp/vc/vc-arch.el b/lisp/vc/vc-arch.el index 052e6784b0..18dfbe1f5f 100644 --- a/lisp/vc/vc-arch.el +++ b/lisp/vc/vc-arch.el @@ -1,4 +1,4 @@ -;;; vc-arch.el --- VC backend for the Arch version-control system +;;; vc-arch.el --- VC backend for the Arch version-control system -*- lexical-binding: t -*- ;; Copyright (C) 2004-2012 Free Software Foundation, Inc. @@ -59,7 +59,7 @@ ;;; Properties of the backend (defun vc-arch-revision-granularity () 'repository) -(defun vc-arch-checkout-model (files) 'implicit) +(defun vc-arch-checkout-model (_files) 'implicit) ;;; ;;; Customization options @@ -227,7 +227,7 @@ Only the value `maybe' can be trusted :-(." (vc-file-setprop file 'arch-root root))))) -(defun vc-arch-register (files &optional rev comment) +(defun vc-arch-register (files &optional rev _comment) (if rev (error "Explicit initial revision not supported for Arch")) (dolist (file files) (let ((tagmet (vc-arch-tagging-method file))) @@ -258,7 +258,7 @@ Only the value `maybe' can be trusted :-(." ;; Strip the terminating newline. (buffer-substring (point-min) (1- (point-max))))))))) -(defun vc-arch-workfile-unchanged-p (file) +(defun vc-arch-workfile-unchanged-p (_file) "Stub: arch workfiles are always considered to be in a changed state," nil) @@ -508,12 +508,11 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see "*")))))) (defun vc-arch-revision-completion-table (files) - (lexical-let ((files files)) - (lambda (string pred action) - ;; FIXME: complete revision patches as well. - (let* ((root (expand-file-name "{arch}" (vc-arch-root (car files)))) - (table (vc-arch--version-completion-table root string))) - (complete-with-action action table string pred))))) + (lambda (string pred action) + ;; FIXME: complete revision patches as well. + (let* ((root (expand-file-name "{arch}" (vc-arch-root (car files)))) + (table (vc-arch--version-completion-table root string))) + (complete-with-action action table string pred)))) ;;; Trimming revision libraries. @@ -547,13 +546,12 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see minrev)) (defun vc-arch-trim-make-sentinel (revs) - (if (null revs) (lambda (proc msg) (message "VC-Arch trimming ... done")) - (lexical-let ((revs revs)) - (lambda (proc msg) - (message "VC-Arch trimming %s..." (file-name-nondirectory (car revs))) - (rename-file (car revs) (concat (car revs) "*rm*")) - (setq proc (start-process "vc-arch-trim" nil - "rm" "-rf" (concat (car revs) "*rm*"))) + (if (null revs) (lambda (_proc _msg) (message "VC-Arch trimming ... done")) + (lambda (_proc _msg) + (message "VC-Arch trimming %s..." (file-name-nondirectory (car revs))) + (rename-file (car revs) (concat (car revs) "*rm*")) + (let ((proc (start-process "vc-arch-trim" nil + "rm" "-rf" (concat (car revs) "*rm*")))) (set-process-sentinel proc (vc-arch-trim-make-sentinel (cdr revs))))))) (defun vc-arch-trim-one-revlib (dir) @@ -572,7 +570,7 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see 'car-less-than-car)) (subdirs nil)) (when (cddr revs) - (dotimes (i (/ (length revs) 2)) + (dotimes (_i (/ (length revs) 2)) (let ((minrev (vc-arch-trim-find-least-useful-rev revs))) (setq revs (delq minrev revs)) (push minrev subdirs))) diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el index 505e40f46b..5488e53e32 100644 --- a/lisp/vc/vc-bzr.el +++ b/lisp/vc/vc-bzr.el @@ -1,4 +1,4 @@ -;;; vc-bzr.el --- VC backend for the bzr revision control system +;;; vc-bzr.el --- VC backend for the bzr revision control system -*- lexical-binding: t -*- ;; Copyright (C) 2006-2012 Free Software Foundation, Inc. @@ -41,7 +41,7 @@ ;;; Properties of the backend (defun vc-bzr-revision-granularity () 'repository) -(defun vc-bzr-checkout-model (files) 'implicit) +(defun vc-bzr-checkout-model (_files) 'implicit) ;;; Code: @@ -208,9 +208,9 @@ in the repository root directory of FILE." ;; + working ( = packed_stat ) ;; parent = common ( as above ) + history ( = rev_id ) ;; kinds = (r)elocated, (a)bsent, (d)irectory, (f)ile, (l)ink - (lexical-let ((root (vc-bzr-root file))) + (let ((root (vc-bzr-root file))) (when root ; Short cut. - (lexical-let ((dirstate (expand-file-name vc-bzr-admin-dirstate root))) + (let ((dirstate (expand-file-name vc-bzr-admin-dirstate root))) (condition-case nil (with-temp-buffer (insert-file-contents dirstate) @@ -303,9 +303,8 @@ in the repository root directory of FILE." (defun vc-bzr-file-name-relative (filename) "Return file name FILENAME stripped of the initial Bzr repository path." - (lexical-let* - ((filename* (expand-file-name filename)) - (rootdir (vc-bzr-root filename*))) + (let* ((filename* (expand-file-name filename)) + (rootdir (vc-bzr-root filename*))) (when rootdir (file-relative-name filename* rootdir)))) @@ -412,9 +411,8 @@ in the branch repository (or whose status not be determined)." (with-temp-buffer ;; This is with-demoted-errors without the condition-case-unless-debug ;; annoyance, which makes it fail during ert testing. - (let (err) - (condition-case err (vc-bzr-command "status" t 0 file) - (error (message "Error: %S" err) nil))) + (condition-case err (vc-bzr-command "status" t 0 file) + (error (message "Error: %S" err) nil)) (let ((status 'unchanged)) ;; the only secure status indication in `bzr status' output ;; is a couple of lines following the pattern:: @@ -433,7 +431,7 @@ in the branch repository (or whose status not be determined)." (if (file-directory-p file) "/?" "\\*?") "[ \t\n]*$") nil t) - (lexical-let ((statusword (match-string 1))) + (let ((statusword (match-string 1))) ;; Erase the status text that matched. (delete-region (match-beginning 0) (match-end 0)) (setq status @@ -452,7 +450,7 @@ in the branch repository (or whose status not be determined)." (unless (eobp) (buffer-substring (point) (point-max)))))))) (defun vc-bzr-state (file) - (lexical-let ((result (vc-bzr-status file))) + (let ((result (vc-bzr-status file))) (when (consp result) (let ((warnings (cdr result))) (when warnings @@ -504,16 +502,15 @@ in the branch repository (or whose status not be determined)." (defun vc-bzr-working-revision (file) ;; Together with the code in vc-state-heuristic, this makes it possible ;; to get the initial VC state of a Bzr file even if Bzr is not installed. - (lexical-let* - ((rootdir (vc-bzr-root file)) - (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file - rootdir)) - (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir)) - (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir))) + (let* ((rootdir (vc-bzr-root file)) + (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file + rootdir)) + (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir)) + (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir))) ;; This looks at internal files to avoid forking a bzr process. ;; May break if they change their format. (if (and (file-exists-p branch-format-file) - ;; For lightweight checkouts (obtained with bzr checkout --lightweight) + ;; For lightweight checkouts (obtained with bzr co --lightweight) ;; the branch-format-file does not contain the revision ;; information, we need to look up the branch-format-file ;; in the place where the lightweight checkout comes @@ -532,17 +529,21 @@ in the branch repository (or whose status not be determined)." (when (re-search-forward "file://\\(.+\\)" nil t) (let ((l-c-parent-dir (match-string 1))) (when (and (memq system-type '(ms-dos windows-nt)) - (string-match-p "^/[[:alpha:]]:" l-c-parent-dir)) - ;;; The non-Windows code takes a shortcut by using the host/path - ;;; separator slash as the start of the absolute path. That - ;;; does not work on Windows, so we must remove it (bug#5345) + (string-match-p "^/[[:alpha:]]:" + l-c-parent-dir)) + ;;; The non-Windows code takes a shortcut by using + ;;; the host/path separator slash as the start of + ;;; the absolute path. That does not work on + ;;; Windows, so we must remove it (bug#5345) (setq l-c-parent-dir (substring l-c-parent-dir 1))) (setq branch-format-file (expand-file-name vc-bzr-admin-branch-format-file l-c-parent-dir)) (setq lastrev-file - (expand-file-name vc-bzr-admin-lastrev l-c-parent-dir)) - ;; FIXME: maybe it's overkill to check if both these files exist. + (expand-file-name vc-bzr-admin-lastrev + l-c-parent-dir)) + ;; FIXME: maybe it's overkill to check if both these + ;; files exist. (and (file-exists-p branch-format-file) (file-exists-p lastrev-file))))) t))) @@ -564,11 +565,10 @@ in the branch repository (or whose status not be determined)." (when (re-search-forward "[0-9]+" nil t) (buffer-substring (match-beginning 0) (match-end 0)))))) ;; fallback to calling "bzr revno" - (lexical-let* - ((result (vc-bzr-command-discarding-stderr - vc-bzr-program "revno" (file-relative-name file))) - (exitcode (car result)) - (output (cdr result))) + (let* ((result (vc-bzr-command-discarding-stderr + vc-bzr-program "revno" (file-relative-name file))) + (exitcode (car result)) + (output (cdr result))) (cond ((eq exitcode 0) (substring output 0 -1)) (t nil)))))) @@ -577,21 +577,21 @@ in the branch repository (or whose status not be determined)." "Create a new Bzr repository." (vc-bzr-command "init" nil 0 nil)) -(defun vc-bzr-init-revision (&optional file) +(defun vc-bzr-init-revision (&optional _file) "Always return nil, as Bzr cannot register explicit versions." nil) -(defun vc-bzr-previous-revision (file rev) +(defun vc-bzr-previous-revision (_file rev) (if (string-match "\\`[0-9]+\\'" rev) (number-to-string (1- (string-to-number rev))) (concat "before:" rev))) -(defun vc-bzr-next-revision (file rev) +(defun vc-bzr-next-revision (_file rev) (if (string-match "\\`[0-9]+\\'" rev) (number-to-string (1+ (string-to-number rev))) (error "Don't know how to compute the next revision of %s" rev))) -(defun vc-bzr-register (files &optional rev comment) +(defun vc-bzr-register (files &optional rev _comment) "Register FILES under bzr. Signal an error unless REV is nil. COMMENT is ignored." @@ -640,7 +640,7 @@ REV non-nil gets an error." (vc-bzr-command "cat" t 0 file "-r" rev) (vc-bzr-command "cat" t 0 file)))) -(defun vc-bzr-checkout (file &optional editable rev) +(defun vc-bzr-checkout (_file &optional _editable rev) (if rev (error "Operation not supported") ;; Else, there's nothing to do. nil)) @@ -791,7 +791,7 @@ Each line is tagged with the revision number, which has a `help-echo' property containing author and date information." (apply #'vc-bzr-command "annotate" buffer 'async file "--long" "--all" (if revision (list "-r" revision))) - (lexical-let ((table (make-hash-table :test 'equal))) + (let ((table (make-hash-table :test 'equal))) (set-process-filter (get-buffer-process buffer) (lambda (proc string) @@ -956,7 +956,7 @@ stream. Standard error output is discarded." ;; frob the results accordingly. (file-relative-name ,dir (vc-bzr-root ,dir))))) -(defun vc-bzr-dir-status-files (dir files default-state update-function) +(defun vc-bzr-dir-status-files (dir files _default-state update-function) "Return a list of conses (file . state) for DIR." (apply 'vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S" files) (vc-exec-after @@ -1193,74 +1193,73 @@ stream. Standard error output is discarded." "revno" "submit" "tag"))) (defun vc-bzr-revision-completion-table (files) - (lexical-let ((files files)) - ;; What about using `files'?!? --Stef - (lambda (string pred action) - (cond - ((string-match "\\`\\(ancestor\\|branch\\|\\(revno:\\)?[-0-9]+:\\):" - string) - (completion-table-with-context (substring string 0 (match-end 0)) - (apply-partially - 'completion-table-with-predicate - 'completion-file-name-table - 'file-directory-p t) - (substring string (match-end 0)) - pred - action)) - ((string-match "\\`\\(before\\):" string) - (completion-table-with-context (substring string 0 (match-end 0)) - (vc-bzr-revision-completion-table files) - (substring string (match-end 0)) - pred - action)) - ((string-match "\\`\\(tag\\):" string) - (let ((prefix (substring string 0 (match-end 0))) - (tag (substring string (match-end 0))) - (table nil) - process-file-side-effects) - (with-temp-buffer - ;; "bzr-1.2 tags" is much faster with --show-ids. - (process-file vc-bzr-program nil '(t) nil "tags" "--show-ids") - ;; The output is ambiguous, unless we assume that revids do not - ;; contain spaces. - (goto-char (point-min)) - (while (re-search-forward "^\\(.*[^ \n]\\) +[^ \n]*$" nil t) - (push (match-string-no-properties 1) table))) - (completion-table-with-context prefix table tag pred action))) - - ((string-match "\\`annotate:" string) - (completion-table-with-context - (substring string 0 (match-end 0)) - (apply-partially #'completion-table-with-terminator '(":" . "\\`a\\`") - #'completion-file-name-table) - (substring string (match-end 0)) pred action)) - - ((string-match "\\`date:" string) - (completion-table-with-context - (substring string 0 (match-end 0)) - '("yesterday" "today" "tomorrow") - (substring string (match-end 0)) pred action)) - - ((string-match "\\`\\([a-z]+\\):" string) - ;; no actual completion for the remaining keywords. - (completion-table-with-context (substring string 0 (match-end 0)) - (if (member (match-string 1 string) - vc-bzr-revision-keywords) - ;; If it's a valid keyword, - ;; use a non-empty table to - ;; indicate it. - '("") nil) - (substring string (match-end 0)) - pred - action)) - (t - ;; Could use completion-table-with-terminator, except that it - ;; currently doesn't work right w.r.t pcm and doesn't give - ;; the *Completions* output we want. - (complete-with-action action (eval-when-compile - (mapcar (lambda (s) (concat s ":")) - vc-bzr-revision-keywords)) - string pred)))))) + ;; What about using `files'?!? --Stef + (lambda (string pred action) + (cond + ((string-match "\\`\\(ancestor\\|branch\\|\\(revno:\\)?[-0-9]+:\\):" + string) + (completion-table-with-context (substring string 0 (match-end 0)) + (apply-partially + 'completion-table-with-predicate + 'completion-file-name-table + 'file-directory-p t) + (substring string (match-end 0)) + pred + action)) + ((string-match "\\`\\(before\\):" string) + (completion-table-with-context (substring string 0 (match-end 0)) + (vc-bzr-revision-completion-table files) + (substring string (match-end 0)) + pred + action)) + ((string-match "\\`\\(tag\\):" string) + (let ((prefix (substring string 0 (match-end 0))) + (tag (substring string (match-end 0))) + (table nil) + process-file-side-effects) + (with-temp-buffer + ;; "bzr-1.2 tags" is much faster with --show-ids. + (process-file vc-bzr-program nil '(t) nil "tags" "--show-ids") + ;; The output is ambiguous, unless we assume that revids do not + ;; contain spaces. + (goto-char (point-min)) + (while (re-search-forward "^\\(.*[^ \n]\\) +[^ \n]*$" nil t) + (push (match-string-no-properties 1) table))) + (completion-table-with-context prefix table tag pred action))) + + ((string-match "\\`annotate:" string) + (completion-table-with-context + (substring string 0 (match-end 0)) + (apply-partially #'completion-table-with-terminator '(":" . "\\`a\\`") + #'completion-file-name-table) + (substring string (match-end 0)) pred action)) + + ((string-match "\\`date:" string) + (completion-table-with-context + (substring string 0 (match-end 0)) + '("yesterday" "today" "tomorrow") + (substring string (match-end 0)) pred action)) + + ((string-match "\\`\\([a-z]+\\):" string) + ;; no actual completion for the remaining keywords. + (completion-table-with-context (substring string 0 (match-end 0)) + (if (member (match-string 1 string) + vc-bzr-revision-keywords) + ;; If it's a valid keyword, + ;; use a non-empty table to + ;; indicate it. + '("") nil) + (substring string (match-end 0)) + pred + action)) + (t + ;; Could use completion-table-with-terminator, except that it + ;; currently doesn't work right w.r.t pcm and doesn't give + ;; the *Completions* output we want. + (complete-with-action action (eval-when-compile + (mapcar (lambda (s) (concat s ":")) + vc-bzr-revision-keywords)) + string pred))))) (provide 'vc-bzr) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 2d8d132a24..4d06e766a3 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -1,4 +1,4 @@ -;;; vc-cvs.el --- non-resident support for CVS version-control +;;; vc-cvs.el --- non-resident support for CVS version-control -*- lexical-binding: t -*- ;; Copyright (C) 1995, 1998-2012 Free Software Foundation, Inc. @@ -280,7 +280,7 @@ committed and support display of sticky tags." ;;; State-changing functions ;;; -(defun vc-cvs-register (files &optional rev comment) +(defun vc-cvs-register (files &optional _rev comment) "Register FILES into the CVS version-control system. COMMENT can be used to provide an initial description of FILES. Passes either `vc-cvs-register-switches' or `vc-register-switches' @@ -502,7 +502,7 @@ Will fail unless you have administrative privileges on the repo." (declare-function vc-rcs-print-log-cleanup "vc-rcs" ()) -(defun vc-cvs-print-log (files buffer &optional shortlog start-revision-ignored limit) +(defun vc-cvs-print-log (files buffer &optional _shortlog _start-revision limit) "Get change logs associated with FILES." (require 'vc-rcs) ;; It's just the catenation of the individual logs. @@ -1006,7 +1006,7 @@ state." (vc-exec-after `(vc-cvs-after-dir-status (quote ,update-function)))))) -(defun vc-cvs-dir-status-files (dir files default-state update-function) +(defun vc-cvs-dir-status-files (dir files _default-state update-function) "Create a list of conses (file . state) for DIR." (apply 'vc-cvs-command (current-buffer) 'async dir "-f" "status" files) (vc-exec-after @@ -1021,7 +1021,7 @@ state." (buffer-substring (point) (point-max))) (file-error nil))) -(defun vc-cvs-dir-extra-headers (dir) +(defun vc-cvs-dir-extra-headers (_dir) "Extract and represent per-directory properties of a CVS working copy." (let ((repo (condition-case nil @@ -1206,10 +1206,8 @@ is non-nil." res))) (defun vc-cvs-revision-completion-table (files) - (lexical-let ((files files) - table) - (setq table (lazy-completion-table - table (lambda () (vc-cvs-revision-table (car files))))) + (letrec ((table (lazy-completion-table + table (lambda () (vc-cvs-revision-table (car files)))))) table)) diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 4c32eea2f7..acb1a4d886 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -1,4 +1,4 @@ -;;; vc-dir.el --- Directory status display under VC +;;; vc-dir.el --- Directory status display under VC -*- lexical-binding: t -*- ;; Copyright (C) 2007-2012 Free Software Foundation, Inc. @@ -529,7 +529,7 @@ If a prefix argument is given, move by that many lines." (defun vc-dir-mark-unmark (mark-unmark-function) (if (use-region-p) - (let ((firstl (line-number-at-pos (region-beginning))) + (let (;; (firstl (line-number-at-pos (region-beginning))) (lastl (line-number-at-pos (region-end)))) (save-excursion (goto-char (region-beginning)) @@ -546,7 +546,7 @@ If a prefix argument is given, move by that many lines." ;; Non-nil iff a parent directory of arg is marked. ;; Return value, if non-nil is the `ewoc-data' for the marked parent. (let* ((argdir (vc-dir-node-directory arg)) - (arglen (length argdir)) + ;; (arglen (length argdir)) (crt arg) (found nil)) ;; Go through the predecessors, checking if any directory that is @@ -814,7 +814,7 @@ child files." ;; FIXME: use vc-dir-child-files-and-states here instead of duplicating it. (if (vc-dir-fileinfo->directory crt-data) (let* ((dir (vc-dir-fileinfo->directory crt-data)) - (dirlen (length dir)) + ;; (dirlen (length dir)) data) (while (and (setq crt (ewoc-next vc-ewoc crt)) @@ -842,7 +842,7 @@ If it is a file, return the corresponding cons for the file itself." result) (if (vc-dir-fileinfo->directory crt-data) (let* ((dir (vc-dir-fileinfo->directory crt-data)) - (dirlen (length dir)) + ;; (dirlen (length dir)) data) (while (and (setq crt (ewoc-next vc-ewoc crt)) @@ -861,7 +861,7 @@ If it is a file, return the corresponding cons for the file itself." (defun vc-dir-recompute-file-state (fname def-dir) (let* ((file-short (file-relative-name fname def-dir)) - (remove-me-when-CVS-works + (_remove-me-when-CVS-works (when (eq vc-dir-backend 'CVS) ;; FIXME: Warning: UGLY HACK. The CVS backend caches the state ;; info, this forces the backend to update it. @@ -875,15 +875,14 @@ If it is a file, return the corresponding cons for the file itself." ;; Give a DIRNAME string return the list of all child files shown in ;; the current *vc-dir* buffer. (let ((crt (ewoc-nth vc-ewoc 0)) - children - dname) + children) ;; Find DIR (while (and crt (not (string-prefix-p dirname (vc-dir-node-directory crt)))) (setq crt (ewoc-next vc-ewoc crt))) (while (and crt (string-prefix-p dirname - (setq dname (vc-dir-node-directory crt)))) + (vc-dir-node-directory crt))) (let ((data (ewoc-data crt))) (unless (vc-dir-fileinfo->directory data) (push (expand-file-name (vc-dir-fileinfo->name data)) children))) @@ -1014,7 +1013,7 @@ specific headers." (unless (buffer-live-p vc-dir-process-buffer) (setq vc-dir-process-buffer (generate-new-buffer (format " *VC-%s* tmp status" backend)))) - (lexical-let ((buffer (current-buffer))) + (let ((buffer (current-buffer))) (with-current-buffer vc-dir-process-buffer (setq default-directory def-dir) (erase-buffer) @@ -1045,7 +1044,7 @@ specific headers." (not (vc-dir-fileinfo->needs-update info)))))))))))) -(defun vc-dir-revert-buffer-function (&optional ignore-auto noconfirm) +(defun vc-dir-revert-buffer-function (&optional _ignore-auto _noconfirm) (vc-dir-refresh)) (defun vc-dir-refresh () @@ -1079,7 +1078,7 @@ Throw an error if another update process is in progress." ;; Bzr has serious locking problems, so setup the headers first (this is ;; synchronous) rather than doing it while dir-status is running. (ewoc-set-hf vc-ewoc (vc-dir-headers backend def-dir) "") - (lexical-let ((buffer (current-buffer))) + (let ((buffer (current-buffer))) (with-current-buffer vc-dir-process-buffer (setq default-directory def-dir) (erase-buffer) @@ -1219,7 +1218,7 @@ These are the commands available for use in the file status buffer: (let ((use-vc-backend backend)) (vc-dir-mode)))) -(defun vc-default-dir-extra-headers (backend dir) +(defun vc-default-dir-extra-headers (_backend _dir) ;; Be loud by default to remind people to add code to display ;; backend specific headers. ;; XXX: change this to return nil before the release. @@ -1234,7 +1233,7 @@ These are the commands available for use in the file status buffer: map) "Local keymap for visiting a file.") -(defun vc-default-dir-printer (backend fileentry) +(defun vc-default-dir-printer (_backend fileentry) "Pretty print FILEENTRY." ;; If you change the layout here, change vc-dir-move-to-goal-column. ;; VC backends can implement backend specific versions of this @@ -1267,10 +1266,10 @@ These are the commands available for use in the file status buffer: 'mouse-face 'highlight 'keymap vc-dir-filename-mouse-map)))) -(defun vc-default-extra-status-menu (backend) +(defun vc-default-extra-status-menu (_backend) nil) -(defun vc-default-status-fileinfo-extra (backend file) +(defun vc-default-status-fileinfo-extra (_backend _file) "Default absence of extra information returned for a file." nil) diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index b71dc95dba..c185c4e8fa 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1,4 +1,4 @@ -;;; vc-git.el --- VC backend for the git version control system +;;; vc-git.el --- VC backend for the git version control system -*- lexical-binding: t -*- ;; Copyright (C) 2006-2012 Free Software Foundation, Inc. @@ -160,7 +160,7 @@ matching the resulting Git log output, and KEYWORDS is a list of ;;; BACKEND PROPERTIES (defun vc-git-revision-granularity () 'repository) -(defun vc-git-checkout-model (files) 'implicit) +(defun vc-git-checkout-model (_files) 'implicit) ;;; STATE-QUERYING FUNCTIONS @@ -233,7 +233,7 @@ matching the resulting Git log output, and KEYWORDS is a list of (vc-git--state-code diff-letter))) (if (vc-git--empty-db-p) 'added 'up-to-date))))) -(defun vc-git-working-revision (file) +(defun vc-git-working-revision (_file) "Git-specific version of `vc-working-revision'." (let* (process-file-side-effects (str (with-output-to-string @@ -471,14 +471,14 @@ or an empty string if none." (vc-exec-after `(vc-git-after-dir-status-stage ',stage ',files ',update-function))) -(defun vc-git-dir-status (dir update-function) +(defun vc-git-dir-status (_dir update-function) "Return a list of (FILE STATE EXTRA) entries for DIR." ;; Further things that would have to be fixed later: ;; - how to handle unregistered directories ;; - how to support vc-dir on a subdir of the project tree (vc-git-dir-status-goto-stage 'update-index nil update-function)) -(defun vc-git-dir-status-files (dir files default-state update-function) +(defun vc-git-dir-status-files (_dir files _default-state update-function) "Return a list of (FILE STATE EXTRA) entries for FILES in DIR." (vc-git-dir-status-goto-stage 'update-index files update-function)) @@ -512,7 +512,7 @@ or an empty string if none." :help "Show the contents of the current stash")) map)) -(defun vc-git-dir-extra-headers (dir) +(defun vc-git-dir-extra-headers (_dir) (let ((str (with-output-to-string (with-current-buffer standard-output (vc-git--out-ok "symbolic-ref" "HEAD")))) @@ -590,7 +590,7 @@ The car of the list is the current branch." "Create a new Git repository." (vc-git-command nil 0 nil "init")) -(defun vc-git-register (files &optional rev comment) +(defun vc-git-register (files &optional _rev _comment) "Register FILES into the git version-control system." (let (flist dlist) (dolist (crt files) @@ -609,7 +609,7 @@ The car of the list is the current branch." (declare-function log-edit-extract-headers "log-edit" (headers string)) -(defun vc-git-checkin (files rev comment) +(defun vc-git-checkin (files _rev comment) (let ((coding-system-for-write vc-git-commits-coding-system)) (apply 'vc-git-command nil 0 files (nconc (list "commit" "-m") @@ -635,7 +635,7 @@ The car of the list is the current branch." nil "cat-file" "blob" (concat (if rev rev "HEAD") ":" fullname)))) -(defun vc-git-checkout (file &optional editable rev) +(defun vc-git-checkout (file &optional _editable rev) (vc-git-command nil 0 file "checkout" (or rev "HEAD"))) (defun vc-git-revert (file &optional contents-done) @@ -821,7 +821,7 @@ or BRANCH^ (where \"^\" can be repeated)." (append (vc-switches 'git 'diff) (list "-p" (or rev1 "HEAD") rev2 "--"))))) -(defun vc-git-revision-table (files) +(defun vc-git-revision-table (_files) ;; What about `files'?!? --Stef (let (process-file-side-effects (table (list "HEAD"))) @@ -834,10 +834,8 @@ or BRANCH^ (where \"^\" can be repeated)." table)) (defun vc-git-revision-completion-table (files) - (lexical-let ((files files) - table) - (setq table (lazy-completion-table - table (lambda () (vc-git-revision-table files)))) + (letrec ((table (lazy-completion-table + table (lambda () (vc-git-revision-table files))))) table)) (defun vc-git-annotate-command (file buf &optional rev) @@ -876,7 +874,7 @@ or BRANCH^ (where \"^\" can be repeated)." (vc-git-command nil 0 nil "checkout" "-b" name) (vc-git-command nil 0 nil "tag" name))))) -(defun vc-git-retrieve-tag (dir name update) +(defun vc-git-retrieve-tag (dir name _update) (let ((default-directory dir)) (vc-git-command nil 0 nil "checkout" name) ;; FIXME: update buffers if `update' is true diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index a272826881..e3af8a353e 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -1,4 +1,4 @@ -;;; vc-hg.el --- VC backend for the mercurial version control system +;;; vc-hg.el --- VC backend for the mercurial version control system -*- lexical-binding: t -*- ;; Copyright (C) 2006-2012 Free Software Foundation, Inc. @@ -168,7 +168,7 @@ highlighting the Log View buffer." (defvar vc-hg-history nil) (defun vc-hg-revision-granularity () 'repository) -(defun vc-hg-checkout-model (files) 'implicit) +(defun vc-hg-checkout-model (_files) 'implicit) ;;; State querying functions @@ -338,10 +338,8 @@ highlighting the Log View buffer." ;; Modeled after the similar function in vc-cvs.el (defun vc-hg-revision-completion-table (files) - (lexical-let ((files files) - table) - (setq table (lazy-completion-table - table (lambda () (vc-hg-revision-table files)))) + (letrec ((table (lazy-completion-table + table (lambda () (vc-hg-revision-table files))))) table)) (defun vc-hg-annotate-command (file buffer &optional revision) @@ -377,12 +375,12 @@ Optional arg REVISION is a revision to annotate from." (expand-file-name (match-string-no-properties 4) (vc-hg-root default-directory))))))) -(defun vc-hg-previous-revision (file rev) +(defun vc-hg-previous-revision (_file rev) (let ((newrev (1- (string-to-number rev)))) (when (>= newrev 0) (number-to-string newrev)))) -(defun vc-hg-next-revision (file rev) +(defun vc-hg-next-revision (_file rev) (let ((newrev (1+ (string-to-number rev))) (tip-revision (with-temp-buffer @@ -408,7 +406,7 @@ Optional arg REVISION is a revision to annotate from." "Rename file from OLD to NEW using `hg mv'." (vc-hg-command nil 0 new "mv" old)) -(defun vc-hg-register (files &optional rev comment) +(defun vc-hg-register (files &optional _rev _comment) "Register FILES under hg. REV is ignored. COMMENT is ignored." @@ -438,7 +436,7 @@ COMMENT is ignored." (declare-function log-edit-extract-headers "log-edit" (headers string)) -(defun vc-hg-checkin (files rev comment) +(defun vc-hg-checkin (files _rev comment) "Hg-specific version of `vc-backend-checkin'. REV is ignored." (apply 'vc-hg-command nil 0 files @@ -455,7 +453,7 @@ REV is ignored." (vc-hg-command buffer 0 file "cat")))) ;; Modeled after the similar function in vc-bzr.el -(defun vc-hg-checkout (file &optional editable rev) +(defun vc-hg-checkout (file &optional _editable rev) "Retrieve a revision of FILE. EDITABLE is ignored. REV is the revision to check out into WORKFILE." @@ -511,8 +509,7 @@ REV is the revision to check out into WORKFILE." 'face 'font-lock-comment-face))))) (defun vc-hg-after-dir-status (update-function) - (let ((status-char nil) - (file nil) + (let ((file nil) (translation '((?= . up-to-date) (?C . up-to-date) (?A . added) @@ -567,7 +564,7 @@ REV is the revision to check out into WORKFILE." (vc-exec-after `(vc-hg-after-dir-status (quote ,update-function)))) -(defun vc-hg-dir-status-files (dir files default-state update-function) +(defun vc-hg-dir-status-files (dir files _default-state update-function) (apply 'vc-hg-command (current-buffer) 'async dir "status" "-C" files) (vc-exec-after `(vc-hg-after-dir-status (quote ,update-function)))) diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el index 122743c374..bd3a6207b7 100644 --- a/lisp/vc/vc-mtn.el +++ b/lisp/vc/vc-mtn.el @@ -1,4 +1,4 @@ -;;; vc-mtn.el --- VC backend for Monotone +;;; vc-mtn.el --- VC backend for Monotone -*- lexical-binding: t -*- ;; Copyright (C) 2007-2012 Free Software Foundation, Inc. @@ -76,7 +76,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." ;;;###autoload (vc-mtn-registered file)))) (defun vc-mtn-revision-granularity () 'repository) -(defun vc-mtn-checkout-model (files) 'implicit) +(defun vc-mtn-checkout-model (_files) 'implicit) (defun vc-mtn-root (file) (setq file (if (file-directory-p file) @@ -173,7 +173,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (t ?:)) branch))) -(defun vc-mtn-register (files &optional rev comment) +(defun vc-mtn-register (files &optional _rev _comment) (vc-mtn-command nil 0 files "add")) (defun vc-mtn-responsible-p (file) (vc-mtn-root file)) @@ -181,7 +181,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (declare-function log-edit-extract-headers "log-edit" (headers string)) -(defun vc-mtn-checkin (files rev comment) +(defun vc-mtn-checkin (files _rev comment) (apply 'vc-mtn-command nil 0 files (nconc (list "commit" "-m") (log-edit-extract-headers '(("Author" . "--author") @@ -201,7 +201,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." ;; (defun vc-mtn-rollback (files) ;; ) -(defun vc-mtn-print-log (files buffer &optional shortlog start-revision limit) +(defun vc-mtn-print-log (files buffer &optional _shortlog start-revision limit) (apply 'vc-mtn-command buffer 0 files "log" (append (when start-revision (list "--from" (format "%s" start-revision))) @@ -304,44 +304,43 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (push (match-string 0) ids)) ids))) -(defun vc-mtn-revision-completion-table (files) +(defun vc-mtn-revision-completion-table (_files) ;; TODO: Implement completion for selectors ;; TODO: Implement completion for composite selectors. - (lexical-let ((files files)) - ;; What about using `files'?!? --Stef - (lambda (string pred action) - (cond - ;; "Tag" selectors. - ((string-match "\\`t:" string) - (complete-with-action action - (mapcar (lambda (tag) (concat "t:" tag)) - (vc-mtn-list-tags)) - string pred)) - ;; "Branch" selectors. - ((string-match "\\`b:" string) - (complete-with-action action - (mapcar (lambda (tag) (concat "b:" tag)) - (vc-mtn-list-branches)) - string pred)) - ;; "Head" selectors. Not sure how they differ from "branch" selectors. - ((string-match "\\`h:" string) - (complete-with-action action - (mapcar (lambda (tag) (concat "h:" tag)) - (vc-mtn-list-branches)) - string pred)) - ;; "ID" selectors. - ((string-match "\\`i:" string) - (complete-with-action action - (mapcar (lambda (tag) (concat "i:" tag)) - (vc-mtn-list-revision-ids - (substring string (match-end 0)))) - string pred)) - (t - (complete-with-action action - '("t:" "b:" "h:" "i:" - ;; Completion not implemented for these. - "a:" "c:" "d:" "e:" "l:") - string pred)))))) + ;; What about using `files'?!? --Stef + (lambda (string pred action) + (cond + ;; "Tag" selectors. + ((string-match "\\`t:" string) + (complete-with-action action + (mapcar (lambda (tag) (concat "t:" tag)) + (vc-mtn-list-tags)) + string pred)) + ;; "Branch" selectors. + ((string-match "\\`b:" string) + (complete-with-action action + (mapcar (lambda (tag) (concat "b:" tag)) + (vc-mtn-list-branches)) + string pred)) + ;; "Head" selectors. Not sure how they differ from "branch" selectors. + ((string-match "\\`h:" string) + (complete-with-action action + (mapcar (lambda (tag) (concat "h:" tag)) + (vc-mtn-list-branches)) + string pred)) + ;; "ID" selectors. + ((string-match "\\`i:" string) + (complete-with-action action + (mapcar (lambda (tag) (concat "i:" tag)) + (vc-mtn-list-revision-ids + (substring string (match-end 0)))) + string pred)) + (t + (complete-with-action action + '("t:" "b:" "h:" "i:" + ;; Completion not implemented for these. + "a:" "c:" "d:" "e:" "l:") + string pred))))) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 433383502d..ad828d6f78 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1,4 +1,4 @@ -;;; vc.el --- drive a version-control system from within Emacs +;;; vc.el --- drive a version-control system from within Emacs -*- lexical-binding: t -*- ;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc. @@ -1075,7 +1075,7 @@ For old-style locking-based version control systems, like RCS: (let* ((vc-fileset (vc-deduce-fileset nil t 'state-model-only-files)) (backend (car vc-fileset)) (files (nth 1 vc-fileset)) - (fileset-only-files (nth 2 vc-fileset)) + ;; (fileset-only-files (nth 2 vc-fileset)) ;; FIXME: We used to call `vc-recompute-state' here. (state (nth 3 vc-fileset)) ;; The backend should check that the checkout-model is consistent @@ -1410,34 +1410,31 @@ that the version control system supports this mode of operation. Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'." (when vc-before-checkin-hook (run-hooks 'vc-before-checkin-hook)) - (lexical-let - ((backend backend)) - (vc-start-logentry - files comment initial-contents - "Enter a change comment." - "*vc-log*" - (lambda () - (vc-call-backend backend 'log-edit-mode)) - (lexical-let ((rev rev)) - (lambda (files comment) - (message "Checking in %s..." (vc-delistify files)) - ;; "This log message intentionally left almost blank". - ;; RCS 5.7 gripes about white-space-only comments too. - (or (and comment (string-match "[^\t\n ]" comment)) - (setq comment "*** empty log message ***")) - (with-vc-properties - files - ;; We used to change buffers to get local value of - ;; vc-checkin-switches, but 'the' local buffer is - ;; not a well-defined concept for filesets. - (progn - (vc-call-backend backend 'checkin files rev comment) - (mapc 'vc-delete-automatic-version-backups files)) - `((vc-state . up-to-date) - (vc-checkout-time . ,(nth 5 (file-attributes file))) - (vc-working-revision . nil))) - (message "Checking in %s...done" (vc-delistify files)))) - 'vc-checkin-hook))) + (vc-start-logentry + files comment initial-contents + "Enter a change comment." + "*vc-log*" + (lambda () + (vc-call-backend backend 'log-edit-mode)) + (lambda (files comment) + (message "Checking in %s..." (vc-delistify files)) + ;; "This log message intentionally left almost blank". + ;; RCS 5.7 gripes about white-space-only comments too. + (or (and comment (string-match "[^\t\n ]" comment)) + (setq comment "*** empty log message ***")) + (with-vc-properties + files + ;; We used to change buffers to get local value of + ;; vc-checkin-switches, but 'the' local buffer is + ;; not a well-defined concept for filesets. + (progn + (vc-call-backend backend 'checkin files rev comment) + (mapc 'vc-delete-automatic-version-backups files)) + `((vc-state . up-to-date) + (vc-checkout-time . ,(nth 5 (file-attributes file))) + (vc-working-revision . nil))) + (message "Checking in %s...done" (vc-delistify files))) + 'vc-checkin-hook)) ;;; Additional entry points for examining version histories @@ -1671,7 +1668,7 @@ Return t if the buffer had changes, nil otherwise." (list files rev1 rev2)))) ;;;###autoload -(defun vc-version-diff (files rev1 rev2) +(defun vc-version-diff (_files rev1 rev2) "Report diffs between revisions of the fileset in the repository history." (interactive (vc-diff-build-argument-list-internal)) ;; All that was just so we could do argument completion! @@ -1883,11 +1880,9 @@ The headers are reset to their non-expanded form." "Enter a replacement change comment." "*vc-log*" (lambda () (vc-call-backend backend 'log-edit-mode)) - (lexical-let ((rev rev) - (backend backend)) - (lambda (files comment) - (vc-call-backend backend - 'modify-change-comment files rev comment)))))) + (lambda (files comment) + (vc-call-backend backend + 'modify-change-comment files rev comment))))) ;;;###autoload (defun vc-merge () @@ -1952,7 +1947,7 @@ changes from the current branch." (error "Sorry, merging is not implemented for %s" backend))))) -(defun vc-maybe-resolve-conflicts (file status &optional name-A name-B) +(defun vc-maybe-resolve-conflicts (file status &optional _name-A _name-B) (vc-resynch-buffer file t (not (buffer-modified-p))) (if (zerop status) (message "Merge successful") (smerge-mode 1) @@ -2077,22 +2072,20 @@ Not all VC backends support short logs!") (when (and limit (not (eq 'limit-unsupported pl-return)) (not is-start-revision)) (goto-char (point-max)) - (lexical-let ((working-revision working-revision) - (limit limit)) - (insert "\n") - (insert-text-button "Show 2X entries" - 'action (lambda (&rest ignore) - (vc-print-log-internal - log-view-vc-backend log-view-vc-fileset - working-revision nil (* 2 limit))) - 'help-echo "Show the log again, and double the number of log entries shown") - (insert " ") - (insert-text-button "Show unlimited entries" - 'action (lambda (&rest ignore) - (vc-print-log-internal - log-view-vc-backend log-view-vc-fileset - working-revision nil nil)) - 'help-echo "Show the log again, including all entries")))) + (insert "\n") + (insert-text-button "Show 2X entries" + 'action (lambda (&rest _ignore) + (vc-print-log-internal + log-view-vc-backend log-view-vc-fileset + working-revision nil (* 2 limit))) + 'help-echo "Show the log again, and double the number of log entries shown") + (insert " ") + (insert-text-button "Show unlimited entries" + 'action (lambda (&rest _ignore) + (vc-print-log-internal + log-view-vc-backend log-view-vc-fileset + working-revision nil nil)) + 'help-echo "Show the log again, including all entries"))) (defun vc-print-log-internal (backend files working-revision &optional is-start-revision limit) @@ -2102,8 +2095,7 @@ Not all VC backends support short logs!") (let ((dir-present nil) (vc-short-log nil) (buffer-name "*vc-change-log*") - type - pl-return) + type) (dolist (file files) (when (file-directory-p file) (setq dir-present t))) @@ -2112,25 +2104,20 @@ Not all VC backends support short logs!") (memq 'directory vc-log-short-style) (memq 'file vc-log-short-style))))) (setq type (if vc-short-log 'short 'long)) - (lexical-let - ((working-revision working-revision) - (backend backend) - (limit limit) - (shortlog vc-short-log) - (files files) - (is-start-revision is-start-revision)) + (let ((shortlog vc-short-log)) (vc-log-internal-common backend buffer-name files type - (lambda (bk buf type-arg files-arg) - (vc-call-backend bk 'print-log files-arg buf - shortlog (when is-start-revision working-revision) limit)) - (lambda (bk files-arg ret) + (lambda (bk buf _type-arg files-arg) + (vc-call-backend bk 'print-log files-arg buf shortlog + (when is-start-revision working-revision) limit)) + (lambda (_bk _files-arg ret) (vc-print-log-setup-buttons working-revision is-start-revision limit ret)) (lambda (bk) (vc-call-backend bk 'show-log-entry working-revision)) - (lambda (ignore-auto noconfirm) - (vc-print-log-internal backend files working-revision is-start-revision limit)))))) + (lambda (_ignore-auto _noconfirm) + (vc-print-log-internal backend files working-revision + is-start-revision limit)))))) (defvar vc-log-view-type nil "Set this to differentiate the different types of logs.") @@ -2168,20 +2155,12 @@ Not all VC backends support short logs!") (defun vc-incoming-outgoing-internal (backend remote-location buffer-name type) (vc-log-internal-common backend buffer-name nil type - (lexical-let - ((remote-location remote-location)) - (lambda (bk buf type-arg files) - (vc-call-backend bk type-arg buf remote-location))) - (lambda (bk files-arg ret)) - (lambda (bk) - (goto-char (point-min))) - (lexical-let - ((backend backend) - (remote-location remote-location) - (buffer-name buffer-name) - (type type)) - (lambda (ignore-auto noconfirm) - (vc-incoming-outgoing-internal backend remote-location buffer-name type))))) + (lambda (bk buf type-arg _files) + (vc-call-backend bk type-arg buf remote-location)) + (lambda (_bk _files-arg _ret) nil) + (lambda (_bk) (goto-char (point-min))) + (lambda (_ignore-auto _noconfirm) + (vc-incoming-outgoing-internal backend remote-location buffer-name type)))) ;;;###autoload (defun vc-print-log (&optional working-revision limit) @@ -2246,11 +2225,11 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION.." (interactive (when current-prefix-arg (list (read-string "Remote location (empty for default): ")))) - (let ((backend (vc-deduce-backend)) - rootdir working-revision) + (let ((backend (vc-deduce-backend))) (unless backend (error "Buffer is not version controlled")) - (vc-incoming-outgoing-internal backend remote-location "*vc-incoming*" 'log-incoming))) + (vc-incoming-outgoing-internal backend remote-location "*vc-incoming*" + 'log-incoming))) ;;;###autoload (defun vc-log-outgoing (&optional remote-location) @@ -2259,11 +2238,11 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION." (interactive (when current-prefix-arg (list (read-string "Remote location (empty for default): ")))) - (let ((backend (vc-deduce-backend)) - rootdir working-revision) + (let ((backend (vc-deduce-backend))) (unless backend (error "Buffer is not version controlled")) - (vc-incoming-outgoing-internal backend remote-location "*vc-outgoing*" 'log-outgoing))) + (vc-incoming-outgoing-internal backend remote-location "*vc-outgoing*" + 'log-outgoing))) ;;;###autoload (defun vc-revert () @@ -2688,23 +2667,23 @@ log entries should be gathered." (when index (substring rev 0 index)))) -(defun vc-default-responsible-p (backend file) +(defun vc-default-responsible-p (_backend _file) "Indicate whether BACKEND is responsible for FILE. The default is to return nil always." nil) -(defun vc-default-could-register (backend file) +(defun vc-default-could-register (_backend _file) "Return non-nil if BACKEND could be used to register FILE. The default implementation returns t for all files." t) -(defun vc-default-latest-on-branch-p (backend file) +(defun vc-default-latest-on-branch-p (_backend _file) "Return non-nil if FILE is the latest on its branch. This default implementation always returns non-nil, which means that editing non-current revisions is not supported by default." t) -(defun vc-default-init-revision (backend) vc-default-init-revision) +(defun vc-default-init-revision (_backend) vc-default-init-revision) (defun vc-default-find-revision (backend file rev buffer) "Provide the new `find-revision' op based on the old `checkout' op. @@ -2718,7 +2697,7 @@ to provide the `find-revision' operation instead." (insert-file-contents-literally tmpfile))) (delete-file tmpfile)))) -(defun vc-default-rename-file (backend old new) +(defun vc-default-rename-file (_backend old new) (condition-case nil (add-name-to-file old new) (error (rename-file old new))) @@ -2730,11 +2709,11 @@ to provide the `find-revision' operation instead." (declare-function log-edit-mode "log-edit" ()) -(defun vc-default-log-edit-mode (backend) (log-edit-mode)) +(defun vc-default-log-edit-mode (_backend) (log-edit-mode)) -(defun vc-default-log-view-mode (backend) (log-view-mode)) +(defun vc-default-log-view-mode (_backend) (log-view-mode)) -(defun vc-default-show-log-entry (backend rev) +(defun vc-default-show-log-entry (_backend rev) (with-no-warnings (log-view-goto-rev rev))) @@ -2800,7 +2779,7 @@ to provide the `find-revision' operation instead." (defalias 'vc-default-revision-completion-table 'ignore) (defalias 'vc-default-mark-resolved 'ignore) -(defun vc-default-dir-status-files (backend dir files default-state update-function) +(defun vc-default-dir-status-files (_backend _dir files default-state update-function) (funcall update-function (mapcar (lambda (file) (list file default-state)) files))) -- 2.20.1