[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7428f4a 37/42: Reduce warnings during byte-compilation; do
From: |
Dmitry Gutov |
Subject: |
[elpa] master 7428f4a 37/42: Reduce warnings during byte-compilation; don't error b-c in <24.4 |
Date: |
Wed, 09 Sep 2015 19:03:47 +0000 |
branch: master
commit 7428f4aab0060e77fac1945aa2aa86be7c6c9b94
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Reduce warnings during byte-compilation; don't error b-c in <24.4
#54
---
diff-hl-flydiff.el | 65 +++++++++++++++++++++++++++------------------------
1 files changed, 34 insertions(+), 31 deletions(-)
diff --git a/diff-hl-flydiff.el b/diff-hl-flydiff.el
index b89401d..17ab769 100644
--- a/diff-hl-flydiff.el
+++ b/diff-hl-flydiff.el
@@ -26,47 +26,50 @@
;;; Code:
(require 'diff-hl)
-(require 'nadvice)
+(require 'diff)
+(if (version< emacs-version "24.4")
+ (error "`diff-hl-flydiff-mode' requires Emacs 24.4 or newer")
+ (require 'nadvice))
(defvar diff-hl-flydiff-modified-tick 0)
(defvar diff-hl-flydiff-timer)
(make-variable-buffer-local 'diff-hl-flydiff-modified-tick)
+(defun diff-hl-flydiff/vc-git--symbolic-ref (file)
+ (or
+ (vc-file-getprop file 'vc-git-symbolic-ref)
+ (let* (process-file-side-effects
+ (str (vc-git--run-command-string nil "symbolic-ref" "HEAD")))
+ (vc-file-setprop file 'vc-git-symbolic-ref
+ (if str
+ (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
+ (match-string 2 str)
+ str))))))
+
+(defun diff-hl-flydiff/vc-git-working-revision (_file)
+ "Git-specific version of `vc-working-revision'."
+ (let (process-file-side-effects)
+ (vc-git--rev-parse "HEAD")))
+
+(defun diff-hl-flydiff/vc-git-mode-line-string (file)
+ "Return a string for `vc-mode-line' to put in the mode line for FILE."
+ (let* ((rev (vc-working-revision file))
+ (disp-rev (or (diff-hl-flydiff/vc-git--symbolic-ref file)
+ (substring rev 0 7)))
+ (def-ml (vc-default-mode-line-string 'Git file))
+ (help-echo (get-text-property 0 'help-echo def-ml))
+ (face (get-text-property 0 'face def-ml)))
+ (propertize (replace-regexp-in-string (concat rev "\\'") disp-rev def-ml t
t)
+ 'face face
+ 'help-echo (concat help-echo "\nCurrent revision: " rev))))
+
;; Polyfill concrete revisions for vc-git-working-revision in Emacs 24.4, 24.5
(when (version<= emacs-version "25.0")
(with-eval-after-load 'vc-git
- (defun vc-git--symbolic-ref (file)
- (or
- (vc-file-getprop file 'vc-git-symbolic-ref)
- (let* (process-file-side-effects
- (str (vc-git--run-command-string nil "symbolic-ref" "HEAD")))
- (vc-file-setprop file 'vc-git-symbolic-ref
- (if str
- (if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
- (match-string 2 str)
- str))))))
-
- (defun diff-hl-flydiff/vc-git-working-revision (_file)
- "Git-specific version of `vc-working-revision'."
- (let (process-file-side-effects)
- (vc-git--rev-parse "HEAD")))
-
- (defun diff-hl-flydiff/vc-git-mode-line-string (file)
- "Return a string for `vc-mode-line' to put in the mode line for FILE."
- (let* ((rev (vc-working-revision file))
- (disp-rev (or (vc-git--symbolic-ref file)
- (substring rev 0 7)))
- (def-ml (vc-default-mode-line-string 'Git file))
- (help-echo (get-text-property 0 'help-echo def-ml))
- (face (get-text-property 0 'face def-ml)))
- (propertize (replace-regexp-in-string (concat rev "\\'") disp-rev
def-ml t t)
- 'face face
- 'help-echo (concat help-echo "\nCurrent revision: " rev))))
-
(advice-add 'vc-git-working-revision :override
- #'diff-hl-flydiff/vc-git-working-revision)
+ #'diff-hl-flydiff/vc-git-working-revision)
(advice-add 'vc-git-mode-line-string :override
- #'diff-hl-flydiff/vc-git-mode-line-string)))
+ #'diff-hl-flydiff/vc-git-mode-line-string)))
(defun diff-hl-flydiff/working-revision (file)
"Like vc-working-revision, but always up-to-date"
- [elpa] master 4bd5166 28/42: Update copyright year(s) for diff-hl-flydiff, (continued)
- [elpa] master 4bd5166 28/42: Update copyright year(s) for diff-hl-flydiff, Dmitry Gutov, 2015/09/09
- [elpa] master 3fa2b54 25/42: Prefer using /dev/shm for temporary files, Dmitry Gutov, 2015/09/09
- [elpa] master 3ab3aae 29/42: Fix *another* usage of "ignored", Dmitry Gutov, 2015/09/09
- [elpa] master 2992efd 31/42: Simplify diff-hl-flydiff/modified-p advice, Dmitry Gutov, 2015/09/09
- [elpa] master 6ab3ebe 30/42: Stop duplicating code in diff-hl-changes, Dmitry Gutov, 2015/09/09
- [elpa] master 2209370 27/42: Ensure working revisions are never stale, Dmitry Gutov, 2015/09/09
- [elpa] master 15aa2b8 26/42: Fix usage of "ignored", Dmitry Gutov, 2015/09/09
- [elpa] master 2d40373 34/42: Update diff-hl-flydiff/vc-git-mode-line-string as per Emacs master, Dmitry Gutov, 2015/09/09
- [elpa] master a16b225 38/42: One fewer version check, Dmitry Gutov, 2015/09/09
- [elpa] master f300548 33/42: Merge pull request #50 from PythonNut/master, Dmitry Gutov, 2015/09/09
- [elpa] master 7428f4a 37/42: Reduce warnings during byte-compilation; don't error b-c in <24.4,
Dmitry Gutov <=
- [elpa] master 418dbc7 32/42: Update docs to reflect new diff-hl-flydiff-mode, Dmitry Gutov, 2015/09/09
- [elpa] master 1558064 35/42: Reword the recent README changes, Dmitry Gutov, 2015/09/09
- [elpa] master 8d313db 36/42: Use --strip-trailing-cr, Dmitry Gutov, 2015/09/09
- [elpa] master 5068da4 39/42: Reindent, Dmitry Gutov, 2015/09/09
- [elpa] master 7fa7f09 41/42: Bump the version, Dmitry Gutov, 2015/09/09
- [elpa] master e576ee2 40/42: Make diff-hl-flydiff-delay customizable, Dmitry Gutov, 2015/09/09
- [elpa] master a454a24 42/42: Merge commit '7fa7f099c7008d521dbbb57a1546f11535544536' from diff-hl, Dmitry Gutov, 2015/09/09