[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/add-vdiff f54616f 039/258: Don't close folds if all are o
From: |
Justin Burkett |
Subject: |
[elpa] scratch/add-vdiff f54616f 039/258: Don't close folds if all are open |
Date: |
Wed, 17 May 2017 08:13:19 -0400 (EDT) |
branch: scratch/add-vdiff
commit f54616fc914ec66ffafa5abb1f43362ddb0fddcf
Author: justbur <address@hidden>
Commit: justbur <address@hidden>
Don't close folds if all are open
---
vdiff.el | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/vdiff.el b/vdiff.el
index 8a41e0f..09e969c 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -180,6 +180,7 @@ lines hidden."
(defvar vdiff--inhibit-sync nil)
(defvar vdiff--line-map nil)
(defvar vdiff--folds nil)
+(defvar vdiff--all-folds-open nil)
;; * Utilities
@@ -425,11 +426,19 @@ lines hidden."
;; Ranges include padding
(let ((a-fold (vdiff--make-fold a-buffer a-range))
(b-fold (vdiff--make-fold b-buffer b-range)))
- (overlay-put a-fold 'display (overlay-get a-fold
'vdiff-fold-text))
- (overlay-put a-fold 'vdiff-fold-open nil)
+ (dolist (fold (list a-fold b-fold))
+ (cond (vdiff--all-folds-open
+ (overlay-put fold 'line-prefix
+ (propertize
+ " " 'display '(left-fringe
vertical-bar)))
+ (overlay-put fold 'display nil)
+ (overlay-put fold 'vdiff-fold-open t))
+ (t
+ (overlay-put fold 'line-prefix nil)
+ (overlay-put fold 'display
+ (overlay-get fold 'vdiff-fold-text))
+ (overlay-put fold 'vdiff-fold-open nil))))
(overlay-put a-fold 'vdiff-other-fold b-fold)
- (overlay-put b-fold 'display (overlay-get b-fold
'vdiff-fold-text))
- (overlay-put b-fold 'vdiff-fold-open nil)
(overlay-put b-fold 'vdiff-other-fold a-fold)
(when (or (vdiff--point-in-fold-p a-buffer a-fold)
(vdiff--point-in-fold-p b-buffer b-fold))
@@ -769,6 +778,7 @@ folds in the region."
(when (eq (overlay-get ovr 'vdiff-type) 'fold)
(let ((other-fold (overlay-get ovr 'vdiff-other-fold)))
(dolist (ovr1 (list ovr other-fold))
+ (setq vdiff--all-folds-open nil)
(overlay-put ovr1 'vdiff-fold-open nil)
(overlay-put ovr1 'line-prefix nil)
(overlay-put ovr1 'display
@@ -777,11 +787,13 @@ folds in the region."
(defun vdiff-open-all-folds ()
"Open all folds in both buffers"
(interactive)
+ (setq vdiff--all-folds-open t)
(vdiff-open-fold (point-min) (point-max)))
(defun vdiff-close-all-folds ()
"Close all folds in both buffers"
(interactive)
+ (setq vdiff--all-folds-open nil)
(vdiff-close-fold (point-min) (point-max)))
;; * Movement
- [elpa] scratch/add-vdiff 23a8f14 013/258: One more TODO, (continued)
- [elpa] scratch/add-vdiff 23a8f14 013/258: One more TODO, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 3ef30aa 020/258: Update screenshot, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff dec9dc5 026/258: Small README change, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 2c113c4 029/258: Merge pull request #1 from syohex/cl-lib, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 4312bb1 034/258: Make subtraction overlays zero width, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 305e723 024/258: Add count to next/prev change and simplify, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 12f4a21 042/258: Add quit command, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 72d8dfc 038/258: Avoid making new folds, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff ad37c86 009/258: Factor out subtraction overlay and prefix internal vars, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 04f5436 001/258: Initial commit, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff f54616f 039/258: Don't close folds if all are open,
Justin Burkett <=
- [elpa] scratch/add-vdiff f77f184 062/258: Fix alignment of folds problem caused by recent change, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff f2aaa2e 067/258: Fix goto-corresponding-line, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 9a748df 065/258: Update README, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 9b4e829 069/258: Update requirements for vdiff-hydra, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff d6a399f 076/258: Annouce exit, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 43b9dc6 097/258: Add missing image, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 7811f01 095/258: Add two features, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff fa6391e 123/258: Reorg README commands section, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff a2fbb7b 146/258: Rename diff-program-args, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 3d38f6c 040/258: Fix line endings, Justin Burkett, 2017/05/17