[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] scratch/add-vdiff 425d50b 085/258: Add vdiff-close-other-folds
From: |
Justin Burkett |
Subject: |
[elpa] scratch/add-vdiff 425d50b 085/258: Add vdiff-close-other-folds |
Date: |
Wed, 17 May 2017 08:13:27 -0400 (EDT) |
branch: scratch/add-vdiff
commit 425d50b2d4a74ba9fbda7478a9cdd6b52a8950ba
Author: justbur <address@hidden>
Commit: justbur <address@hidden>
Add vdiff-close-other-folds
---
README.org | 1 +
vdiff.el | 25 +++++++++++++++++++------
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/README.org b/README.org
index 36ba57d..7a41069 100644
--- a/README.org
+++ b/README.org
@@ -51,6 +51,7 @@ the commands would be
| =C-c s= | =vdiff-send-changes= | Send this hunk (or all in
region) to other buffer |
| =C-c c= | =vdiff-close-fold= | Close fold at point or in region
|
| =C-c C= | =vdiff-close-all-folds= | Close all folds in buffer
|
+| =C-c t= | =vdiff-close-other-folds= | Close all other folds in buffer
|
| =C-c o= | =vdiff-open-fold= | Open fold at point or in region
|
| =C-c O= | =vdiff-open-all-folds= | Open all folds in buffer
|
| =C-c w= | =vdiff-save-buffers= | Save both buffers
|
diff --git a/vdiff.el b/vdiff.el
index 7bd79db..79aa689 100644
--- a/vdiff.el
+++ b/vdiff.el
@@ -387,8 +387,8 @@ parsing the diff output and triggering the overlay updates."
(cons (+ vdiff-fold-padding (car range))
(1+ (- (cdr range) vdiff-fold-padding))))
-(defun vdiff--point-in-fold-p (buf fold)
- (and (eq (current-buffer) buf)
+(defun vdiff--point-in-fold-p (fold)
+ (and (eq (current-buffer) (overlay-buffer fold))
(>= (point) (overlay-start fold))
(<= (point) (overlay-end fold))))
@@ -833,6 +833,17 @@ folds in the region."
(setq vdiff--all-folds-open nil)
(vdiff-close-fold (point-min) (point-max)))
+(defun vdiff-close-other-folds ()
+ "Close all other folds in both buffers"
+ (interactive)
+ (dolist (ovr (overlays-in (point-min) (point-max)))
+ (when (and (eq (overlay-get ovr 'vdiff-type) 'fold)
+ (not (vdiff--point-in-fold-p ovr)))
+ (setq vdiff--all-folds-open nil)
+ (vdiff--set-closed-fold-props ovr)
+ (vdiff--set-closed-fold-props
+ (overlay-get ovr 'vdiff-other-fold)))))
+
;; * Movement
(defun vdiff--nth-change (&optional n find-folds)
@@ -972,6 +983,7 @@ asked to select two buffers."
(define-key map "O" 'vdiff-open-all-folds)
(define-key map "c" 'vdiff-close-fold)
(define-key map "C" 'vdiff-close-all-folds)
+ (define-key map "t" 'vdiff-close-other-folds)
(define-key map "h" 'vdiff-maybe-hydra)
map))
@@ -1032,12 +1044,12 @@ enabled automatically if `vdiff-lock-scrolling' is
non-nil."
(defhydra vdiff-hydra (nil nil :hint nil :foreign-keys run)
(concat (propertize
"\
- Navigation^^^^ Transmit^^ Folds^^^^
Other^^^^ "
+ Navigation^^^^ Transmit^^ Folds^^^^ Other^^^^
"
'face 'header-line)
"
- [_n_/_N_] next change/fold [_s_] send [_o_/_O_] open (all)
[_u_]^ ^ update diff
- [_p_/_P_] prev change/fold [_r_] receive [_c_/_C_] close (all)
[_w_]^ ^ save buffers
- [_g_]^ ^ goto corr. line ^ ^ ^ ^ ^ ^
[_q_/_Q_] quit hydra/vdiff")
+ _n_/_N_ next change/fold _s_ send _o_/_O_ open (all) _u_^ ^
update diff
+ _p_/_P_ prev change/fold _r_ receive _c_/_C_ close (all) _w_^ ^
save buffers
+ _g_^ ^ goto corresp. line ^ ^ _t_^ ^ close other _q_/_Q_
quit hydra/vdiff")
("n" vdiff-next-change)
("p" vdiff-previous-change)
("N" vdiff-next-fold)
@@ -1049,6 +1061,7 @@ enabled automatically if `vdiff-lock-scrolling' is
non-nil."
("O" vdiff-open-all-folds)
("c" vdiff-close-fold)
("C" vdiff-close-all-folds)
+ ("t" vdiff-close-other-folds)
("u" vdiff-refresh)
("w" vdiff-save-buffers)
("q" nil :exit t)
- [elpa] scratch/add-vdiff d8cfb8f 243/258: vdiff: Don't use scroll-lock-mode programmatically, (continued)
- [elpa] scratch/add-vdiff d8cfb8f 243/258: vdiff: Don't use scroll-lock-mode programmatically, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff bc5a9a8 242/258: vdiff-magit: Remove unnecessary local bindings, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff c32fe46 251/258: vdiff: Fix compiler warnings, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 875b0d5 252/258: README: Improve vdiff-magit-popup, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 8a3dff3 254/258: vdiff-magit: Add vdiff-magit-stage-is-2way, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 3a32c4e 255/258: README: Update, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff d4883de 256/258: vdiff-magit: Remove use of camel case names for consistency, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 819ea4b 258/258: Add 'packages/vdiff/' from commit 'f11c7c2eeef33a0b75fe4e025818e7e672c57397', Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 14abb75 078/258: Allow jumping to subtraction overlays, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff a15b0e5 084/258: Move point before closing fold, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 425d50b 085/258: Add vdiff-close-other-folds,
Justin Burkett <=
- [elpa] scratch/add-vdiff 6516112 075/258: Minor formatting, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 968047f 093/258: Change wording in a docstring, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff ad0e8c3 091/258: Make mirrored-commands private and rename, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 309e912 108/258: Refresh automatically on idle after change, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 5b1b342 119/258: Remove duplicated code in vdiff-files, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 750a1bc 124/258: Fix bug in remove-refinements, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff c8cba47 125/258: Fix package, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 83f0788 118/258: Don't make temp files global, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff 72fe0fa 130/258: Don't update diff info while sending changes, Justin Burkett, 2017/05/17
- [elpa] scratch/add-vdiff c6e30a2 136/258: Merge pull request #9 from gvol/master, Justin Burkett, 2017/05/17