summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-02-20 15:34:24 -0500
committerKyle Meyer <kyle@kyleam.com>2014-02-20 15:34:24 -0500
commita8aab1072847181ec5513eb7778523518228beb7 (patch)
tree95f06f5fca570533f8f0ff60ba03c6c0c59ace5a
parentc700c0c6ddb8ad60ced215cd23b63afce6f101be (diff)
downloademacs.d-a8aab1072847181ec5513eb7778523518228beb7.tar.gz
Add binding to narrow Org tree in current window
Complements C-c C-x b, which (by default) opens the tree in an indirect buffer in a new window.
-rw-r--r--lisp/init-org.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/init-org.el b/lisp/init-org.el
index 99245cb..0e66f72 100644
--- a/lisp/init-org.el
+++ b/lisp/init-org.el
@@ -76,6 +76,8 @@
(eval-after-load 'org
'(progn
+ (define-key org-mode-map (kbd "C-c C-x B")
+ 'km/org-tree-to-indirect-buffer-current-window)
;; Don't let `org-cycle-agenda-files' binding override custom
;; `backward-kill-word' binding (`org-cycle-agenda-files' is still bound
;; to C-,).
@@ -105,6 +107,14 @@ number, which has a different meaning, it is left untouched."
(unless (numberp arg)
(setq arg (not arg))))
+(defun km/org-tree-to-indirect-buffer-current-window (&optional arg)
+ "Create indirect buffer and narrow to subtree in this window.
+Before running `org-tree-to-indirect-buffer',
+`org-indirect-buffer-display' is set to `current-window'."
+ (interactive "P")
+ (let ((org-indirect-buffer-display 'current-window))
+ (org-tree-to-indirect-buffer arg)))
+
;;; Org in other modes
(defun km/load-orgstruct ()
(turn-on-orgstruct++)