Function: org-archive--compute-location

org-archive--compute-location is a byte-compiled function defined in org-archive.el.gz.

Signature

(org-archive--compute-location LOCATION)

Documentation

Extract and expand the location from archive LOCATION.

Return a pair (FILE . HEADING) where FILE is the file name and HEADING the heading of the archive location, as strings. Raise an error if LOCATION is not a valid archive location.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-archive.el.gz
(defun org-archive--compute-location (location)
  "Extract and expand the location from archive LOCATION.
Return a pair (FILE . HEADING) where FILE is the file name and
HEADING the heading of the archive location, as strings.  Raise
an error if LOCATION is not a valid archive location."
  (unless (string-match "::" location)
    (error "Invalid archive location: %S" location))
  (let ((current-file (buffer-file-name (buffer-base-buffer)))
	(file-fmt (substring location 0 (match-beginning 0)))
	(heading-fmt (substring location (match-end 0))))
    (cons
     ;; File part.
     (if (org-string-nw-p file-fmt)
	 (expand-file-name
	  (format file-fmt (file-name-nondirectory current-file)))
       current-file)
     ;; Heading part.
     (format heading-fmt (file-name-nondirectory current-file)))))