Function: org-agenda-switch-to

org-agenda-switch-to is an interactive and byte-compiled function defined in org-agenda.el.gz.

Signature

(org-agenda-switch-to &optional DELETE-OTHER-WINDOWS)

Documentation

Go to the Org mode file which contains the item at point.

When optional argument DELETE-OTHER-WINDOWS is non-nil, the displayed Org file fills the frame.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-agenda.el.gz
(defun org-agenda-switch-to (&optional delete-other-windows)
  "Go to the Org mode file which contains the item at point.
When optional argument DELETE-OTHER-WINDOWS is non-nil, the
displayed Org file fills the frame."
  (interactive)
  (if (and org-return-follows-link
	   (not (org-get-at-bol 'org-marker))
	   (org-in-regexp org-link-bracket-re))
      (org-link-open-from-string (match-string 0))
    (let* ((marker (or (org-get-at-bol 'org-marker)
		       (org-agenda-error)))
	   (buffer (marker-buffer marker))
	   (pos (marker-position marker)))
      (unless buffer (user-error "Trying to switch to non-existent buffer"))
      (pop-to-buffer-same-window buffer)
      (when delete-other-windows
        (display-buffer (current-buffer) '(org-display-buffer-full-frame)))
      (widen)
      (goto-char pos)
      (when (derived-mode-p 'org-mode)
	(org-fold-show-context 'agenda)
	(run-hooks 'org-agenda-after-show-hook)))))