Skip to content

Instantly share code, notes, and snippets.

@pjones
Created July 12, 2012 20:37
Show Gist options
  • Save pjones/3100801 to your computer and use it in GitHub Desktop.
Save pjones/3100801 to your computer and use it in GitHub Desktop.
(defun pjones:org-goto (&optional alternative-interface)
"My version of `org-goto' that first widens the buffer (if
narrowed), jumps to the correct heading via `org-goto', then
narrows it again if necessary."
(interactive "P")
(let ((point-size (save-restriction (- (point-max) (point-min))))
(buff-size (buffer-size)))
(widen)
(org-goto alternative-interface)
(if (/= buff-size point-size) (org-narrow-to-subtree))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment