Function: allout-resolve-xref

allout-resolve-xref is an interactive and byte-compiled function defined in allout.el.gz.

Signature

(allout-resolve-xref)

Documentation

Pop to file associated with current heading, if it has an xref bullet.

(Works according to setting of allout-file-xref-bullet).

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/allout.el.gz
;;;_  - Specialty bullet functions
;;;_   : File Cross references
;;;_    > allout-resolve-xref ()
(defun allout-resolve-xref ()
  "Pop to file associated with current heading, if it has an xref bullet.

\(Works according to setting of `allout-file-xref-bullet')."
  (interactive)
  (if (not allout-file-xref-bullet)
      (error
       "Outline cross references disabled -- no `allout-file-xref-bullet'")
    (if (not (string= (allout-current-bullet) allout-file-xref-bullet))
        (error "Current heading lacks cross-reference bullet `%s'"
               allout-file-xref-bullet)
      (let ((inhibit-field-text-motion t)
            file-name)
        (save-match-data
          (save-excursion
            (let* ((text-start allout-recent-prefix-end)
                   (heading-end (line-end-position)))
              (goto-char text-start)
              (setq file-name
                    (if (re-search-forward "\\s-\\(\\S-*\\)" heading-end t)
                        (buffer-substring (match-beginning 1)
                                          (match-end 1)))))))
        (setq file-name (expand-file-name file-name))
        (if (or (file-exists-p file-name)
                (if (file-writable-p file-name)
                    (y-or-n-p (format "%s not there, create one? "
                                      file-name))
                  (error "%s not found and can't be created" file-name)))
            (condition-case failure
                (find-file-other-window file-name)
              (error failure))
          (error "%s not found" file-name))
        )
      )
    )
  )