Created
May 25, 2019 20:51
-
-
Save treyharris/838805676086174bd1381480bace0b34 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; diff hooks for org mode | |
| (add-hook 'ediff-select-hook 'f-ediff-org-unfold-tree-element) | |
| (add-hook 'ediff-unselect-hook 'f-ediff-org-fold-tree) | |
| ;; Check for org mode and existence of buffer | |
| (defun f-ediff-org-showhide(buf command &rest cmdargs) | |
| "If buffer exists and is orgmode then execute command" | |
| (if buf | |
| (if (eq (buffer-local-value 'major-mode (get-buffer buf)) 'org-mode) | |
| (save-excursion (set-buffer buf) (apply command cmdargs))) | |
| ) | |
| ) | |
| (defun f-ediff-org-unfold-tree-element () | |
| "Unfold tree at diff location" | |
| (f-ediff-org-showhide ediff-buffer-A 'org-reveal) | |
| (f-ediff-org-showhide ediff-buffer-B 'org-reveal) | |
| (f-ediff-org-showhide ediff-buffer-C 'org-reveal) | |
| ) | |
| ;; | |
| (defun f-ediff-org-fold-tree () | |
| "Fold tree back to top level" | |
| (f-ediff-org-showhide ediff-buffer-A 'hide-sublevels 1) | |
| (f-ediff-org-showhide ediff-buffer-B 'hide-sublevels 1) | |
| (f-ediff-org-showhide ediff-buffer-C 'hide-sublevels 1) | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment