This file contains 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
; Speed commands are really useful, but I often want to make use of | |
; them when I'm not at the beginning of a header. This command brings | |
; you back to the beginning of an item's header, so that you can do | |
; speed commands. | |
(defun org-go-speed () | |
"Goes to the beginning of an element's header, so that you can | |
execute speed commands." | |
(interactive) | |
(when (equal major-mode 'org-mode) |
This file contains 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
(defun narrow-or-widen-dwim () | |
"If the buffer is narrowed, it widens. Otherwise, it narrows to region, or Org subtree." | |
(interactive) | |
(cond ((buffer-narrowed-p) (widen)) | |
((region-active-p) (narrow-to-region (region-beginning) (region-end))) | |
((equal major-mode 'org-mode) (org-narrow-to-subtree)) | |
(t (error "Please select a region to narrow to")))) | |
;; I bind this key to C-c n, using the bind-key function that comes with use-package. | |
(bind-key "C-c n" 'narrow-or-widen-dwim) |
NewerOlder