[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ztree dc5f769 8/8: Finalized the refactoring with proto
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ztree dc5f769 8/8: Finalized the refactoring with protocol usage. |
Date: |
Mon, 15 Mar 2021 22:26:17 -0400 (EDT) |
branch: externals/ztree
commit dc5f76923436ea87b802b56a54185b6888177a8c
Author: Alexey Veretennikov <fourier@protonmail.ch>
Commit: Alexey Veretennikov <fourier@protonmail.ch>
Finalized the refactoring with protocol usage.
Fixed the issue when the buffer local variables
used to recreate a model set before the buffer has
been created. This avoids double refreshing of
the diff buffer on a first start.
---
ztree-diff-model.el | 1 -
ztree-diff.el | 12 +++++++-----
ztree-dir.el | 4 ++--
ztree-view.el | 8 +++++++-
4 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/ztree-diff-model.el b/ztree-diff-model.el
index 8a2faa0..aaf2a8f 100644
--- a/ztree-diff-model.el
+++ b/ztree-diff-model.el
@@ -304,7 +304,6 @@ When REPORTER provided update the progress."
(children nil)) ;; list of children
;; update waiting status
(when reporter
- (sit-for 1)
(progress-reporter-update reporter))
;; update node status ignore status either inhereted from the
;; parent or the own
diff --git a/ztree-diff.el b/ztree-diff.el
index 6b29928..44cc101 100644
--- a/ztree-diff.el
+++ b/ztree-diff.el
@@ -615,16 +615,18 @@ Argument DIR2 right directory."
" <--> "
(ztree-diff-node-right-short-name model)
"*")))
- (ztree-diff-model-set-ignore-fun #'ztree-diff-node-ignore-p)
- (setq ztree-diff-dirs-pair (cons dir1 dir2))
- (ztree-diff-node-recreate-with-progress model)
;; after this command we are in a new buffer,
;; so all buffer-local vars are valid
(ztree-view buf-name
#'ztree-diff-insert-buffer-header
model
- t)
- (ztreediff-mode)))
+ (lambda ()
+ (ztree-diff-model-set-ignore-fun #'ztree-diff-node-ignore-p)
+ (setq ztree-diff-dirs-pair (cons dir1 dir2))
+ (ztree-diff-node-recreate-with-progress model)
+ (ztreediff-mode))
+ t)))
+
(provide 'ztree-diff)
diff --git a/ztree-dir.el b/ztree-dir.el
index 68daec0..b0d7880 100644
--- a/ztree-dir.el
+++ b/ztree-dir.el
@@ -245,8 +245,8 @@ Return T if nodes are equal"
(ztree-view buf-name
#'ztree-insert-buffer-header
(expand-file-name (substitute-in-file-name path))
- nil)
- (ztreedir-mode))))
+ #'ztreedir-mode
+ nil))))
diff --git a/ztree-view.el b/ztree-view.el
index 518fe51..d79134b 100644
--- a/ztree-view.el
+++ b/ztree-view.el
@@ -739,12 +739,16 @@ change the root node to the node specified."
(ztree-refresh-buffer)))))
nil 'visible))
-(defun ztree-view (buffer-name header-fun start-node &optional two-sided-p)
+(defun ztree-view (buffer-name header-fun start-node init-function &optional
two-sided-p)
"Create a ztree view buffer configured with parameters given.
Argument BUFFER-NAME Name of the buffer created.
Argument HEADER-FUN Function which inserts the header into the buffer
before drawing the tree.
Argument START-NODE Starting node - the root of the tree.
+Argument INIT-FUNCTION Function to call just before refreshing the buffer and
+setting all variables and mode. Could be nil.
+It could be used to set up a minor mode or build a tree. Function should not
+expect any arguments. Example: #'ztreedir-mode
Optional argument TWO-SIDED-P Determines if the tree is 2-sided (nil by
default)"
(let ((buf (get-buffer-create buffer-name)))
(switch-to-buffer buf)
@@ -754,6 +758,8 @@ Optional argument TWO-SIDED-P Determines if the tree is
2-sided (nil by default)
(setq ztree-expanded-nodes-list (list ztree-start-node))
(setq ztree-tree-header-fun header-fun)
(setq ztree-two-sided-p two-sided-p)
+ (when init-function
+ (funcall init-function))
(ztree-refresh-buffer)
(add-hook 'window-configuration-change-hook
#'ztree-view-on-window-configuration-changed)))
- [elpa] externals/ztree updated (0a5b25f -> dc5f769), Stefan Monnier, 2021/03/15
- [elpa] externals/ztree f658f5a 1/8: Issue #71: Warning: Package cl is deprecated, Stefan Monnier, 2021/03/15
- [elpa] externals/ztree 79a0d6e 2/8: Renamed cl function incf to cl-incf, Stefan Monnier, 2021/03/15
- [elpa] externals/ztree 6eee81d 3/8: Issue #67: LICENSE / COPYING file missing, Stefan Monnier, 2021/03/15
- [elpa] externals/ztree 8f1ff33 6/8: Reimplemented progress reporting., Stefan Monnier, 2021/03/15
- [elpa] externals/ztree dc5f769 8/8: Finalized the refactoring with protocol usage.,
Stefan Monnier <=
- [elpa] externals/ztree 0be261d 5/8: Refactored using generics instead of function variables, Stefan Monnier, 2021/03/15
- [elpa] externals/ztree 51b1604 7/8: Fixed bug with not expanded root, Stefan Monnier, 2021/03/15
- [elpa] externals/ztree 07bca6c 4/8: Unified creation of callback functions, Stefan Monnier, 2021/03/15