branch: externals/diff-hl
commit f26003b6fa87b0838e9d5380453476faa45d1313
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
Fix compiler warnings involving macro
The macro `diff-hl-with-diff-switches' is define and used in
"diff-hl.el". Additionally it is used in "diff-hl-flydiff.el".
This macro uses variables from the `vc' package without requiring it
up front. Until now this was dealt with using top-level variable
declarations in "diff-hl.el". That is not enough because the
expansion of that macro, in another file, does not benefit from
these declarations.
diff-hl-flydiff.el:47:8: Warning: Unused lexical variable
‘vc-svn-diff-switches’
diff-hl-flydiff.el:47:8: Warning: Unused lexical variable
‘vc-fossil-diff-switches’
diff-hl-flydiff.el:47:8: Warning: Unused lexical variable
‘vc-jj-diff-switches’
So we have to add the variable declarations to the macro expansion
themselves.
---
diff-hl.el | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/diff-hl.el b/diff-hl.el
index ca66a51153..338ee98e7c 100644
--- a/diff-hl.el
+++ b/diff-hl.el
@@ -394,29 +394,29 @@ It can be a relative expression as well, such as
\"HEAD^\" with Git, or
(ignored 'diff-hl-bmp-i)
(t (intern (format "diff-hl-bmp-%s" type)))))
-(defvar vc-svn-diff-switches)
-(defvar vc-fossil-diff-switches)
-(defvar vc-jj-diff-switches)
-
(defmacro diff-hl-with-diff-switches (body)
- `(let ((vc-git-diff-switches
- ;; https://github.com/dgutov/diff-hl/issues/67
- (cons "-U0"
- ;; https://github.com/dgutov/diff-hl/issues/9
- (and (boundp 'vc-git-diff-switches)
- (listp vc-git-diff-switches)
- (cl-remove-if-not
- (lambda (arg)
- (member arg '("--histogram" "--patience" "--minimal"
"--textconv")))
- vc-git-diff-switches))))
- (vc-hg-diff-switches nil)
- (vc-svn-diff-switches nil)
- (vc-fossil-diff-switches '("-c" "0"))
- (vc-jj-diff-switches '("--git" "--context=0"))
- (vc-diff-switches '("-U0"))
- ,@(when (boundp 'vc-disable-async-diff)
- '((vc-disable-async-diff t))))
- ,body))
+ `(progn
+ (defvar vc-svn-diff-switches)
+ (defvar vc-fossil-diff-switches)
+ (defvar vc-jj-diff-switches)
+ (let ((vc-git-diff-switches
+ ;; https://github.com/dgutov/diff-hl/issues/67
+ (cons "-U0"
+ ;; https://github.com/dgutov/diff-hl/issues/9
+ (and (boundp 'vc-git-diff-switches)
+ (listp vc-git-diff-switches)
+ (cl-remove-if-not
+ (lambda (arg)
+ (member arg '("--histogram" "--patience" "--minimal"
"--textconv")))
+ vc-git-diff-switches))))
+ (vc-hg-diff-switches nil)
+ (vc-svn-diff-switches nil)
+ (vc-fossil-diff-switches '("-c" "0"))
+ (vc-jj-diff-switches '("--git" "--context=0"))
+ (vc-diff-switches '("-U0"))
+ ,@(when (boundp 'vc-disable-async-diff)
+ '((vc-disable-async-diff t))))
+ ,body)))
(defun diff-hl-modified-p (state)
(or (memq state '(edited conflict))