[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ztree 50412fa 20/23: Issue #65: added ztree-diff-additi
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ztree 50412fa 20/23: Issue #65: added ztree-diff-additional-options variable |
Date: |
Thu, 17 Dec 2020 23:17:06 -0500 (EST) |
branch: externals/ztree
commit 50412fa553fb68fcd7218cc44cf66b5342ab6889
Author: Alexey Veretennikov <alexey.veretennikov@gmail.com>
Commit: Alexey Veretennikov <alexey.veretennikov@gmail.com>
Issue #65: added ztree-diff-additional-options variable
Now the special variable ztree-diff-additional-options
introduced to provide an additional arguments
to the 'diff' tool.
For example one could specify
(setq ztree-diff-additional-options '("-w" "-i"))
to ignore case differences and whitespace differences.
---
ztree-diff-model.el | 16 +++++++++++++---
ztree-diff.el | 5 ++++-
ztree-view.el | 12 ++++++++----
3 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/ztree-diff-model.el b/ztree-diff-model.el
index d31ce34..219ad68 100644
--- a/ztree-diff-model.el
+++ b/ztree-diff-model.el
@@ -36,6 +36,13 @@
(defvar ztree-diff-consider-file-permissions nil
"Mark files as different if their permissions are different")
+(defvar ztree-diff-additional-options nil
+ "Command-line options for the diff program used as a diff backend. These
options are added to default '-q' option.
+Should be a list of strings.
+Example:
+(setq ztree-diff-options '(\"-w\" \"-i\"))")
+
+
(defvar-local ztree-diff-model-ignore-fun nil
"Function which determines if the node should be excluded from comparison.")
@@ -154,9 +161,12 @@ Returns t if equal."
(and ztree-diff-consider-file-permissions
(not (string-equal (nth 8 (file-attributes file1))
(nth 8 (file-attributes file2)))))
- (/= 0 (process-file diff-command nil nil nil "-q"
- file1-untrampified
- file2-untrampified)))
+ (/= 0
+ (apply #'process-file
+ diff-command nil nil nil
+ `("-q" ,@ztree-diff-additional-options
+ ,file1-untrampified
+ ,file2-untrampified))))
'diff
'same)))
diff --git a/ztree-diff.el b/ztree-diff.el
index 3ff39fb..7634816 100644
--- a/ztree-diff.el
+++ b/ztree-diff.el
@@ -242,7 +242,7 @@ See the Info node `(ediff) hooks'.
This hook function removes itself."
(push (current-window-configuration)
ztree-diff-ediff-previous-window-configurations)
- (setq ztree-prev-position (cons (line-number-at-pos (point))
(current-column)))
+ (ztree-save-current-position)
(remove-hook 'ediff-before-setup-hook
#'ztree-diff-ediff-before-setup-hook-function))
(defun ztree-diff-ediff-quit-hook-function ()
@@ -272,6 +272,9 @@ configuration is restored."
1.1.2 simple diff otherwiste
1.2 if they are the same - view left
2 if left or right present - view left or rigth"
+ ;; save current position in case if the window
+ ;; configuration will change
+ (ztree-save-current-position)
(let ((left (ztree-diff-node-left-path node))
(right (ztree-diff-node-right-path node))
;; FIXME: The GNU convention is to only use "path" for lists of
diff --git a/ztree-view.el b/ztree-view.el
index e053210..9f0cef8 100644
--- a/ztree-view.el
+++ b/ztree-view.el
@@ -683,6 +683,12 @@ Returns the position where the text starts."
(ztree-scroll-to-line (line-number-at-pos)))))
+(defun ztree-save-current-position ()
+ "Save the current position into the global variable."
+ (setq ztree-prev-position (cons (line-number-at-pos (point))
+ (current-column))))
+
+
(defun ztree-refresh-buffer (&optional line)
"Refresh the buffer.
Optional argument LINE scroll to the line given."
@@ -694,8 +700,7 @@ Optional argument LINE scroll to the line given."
;; create a hash table of node properties for line
(setq ztree-line-tree-properties (make-hash-table))
(let ((inhibit-read-only t))
- (setq ztree-prev-position (cons (line-number-at-pos (point))
- (current-column)))
+ (ztree-save-current-position)
(erase-buffer)
(funcall ztree-tree-header-fun)
(setq ztree-start-line (line-number-at-pos (point)))
@@ -707,8 +712,7 @@ Optional argument LINE scroll to the line given."
(goto-char (+ (cdr ztree-prev-position) (point)))))
((and (null line) (null prev-pos)) ;; first refresh
(ztree-scroll-to-line ztree-start-line)
- (setq ztree-prev-position (cons (line-number-at-pos (point))
- (current-column))))
+ (ztree-save-current-position))
((and (null line) prev-pos) ;; not first refresh
;; restore cursor position if possible
(ztree-scroll-to-line (car ztree-prev-position))
- [elpa] externals/ztree 3273e1f 13/23: Issue #60: ztree-dir change Emacs default directory, (continued)
- [elpa] externals/ztree 3273e1f 13/23: Issue #60: ztree-dir change Emacs default directory, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree a3e0442 14/23: Issue #59: Place cursor at the beginning of the text, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 2f62ba7 18/23: Issue #62: Cleared warnings, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 4879576 19/23: Issue #39: restore cursor position and window configuration, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree c54425a 21/23: Updated README for issue #65., Stefan Monnier, 2020/12/17
- [elpa] externals/ztree d078daf 08/23: Issue #54: Added (optional) number of directory entries, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree c5a1190 15/23: Issue #61: Error on unaccessible directory contents, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 0a5b25f 23/23: Merge pull request #68 from webzak/fix_ws_ignore, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 1ebb00c 07/23: Issue #52: Added 'd' hotkey for the ztree-dir to open dired., Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 30dbda7 16/23: Issue #62, #63, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 50412fa 20/23: Issue #65: added ztree-diff-additional-options variable,
Stefan Monnier <=
- [elpa] externals/ztree 901c3e3 22/23: support -w for different file size, Stefan Monnier, 2020/12/17
- [elpa] externals/ztree 17f8f32 17/23: Update to issue #62, Stefan Monnier, 2020/12/17