|
@@ -336,23 +336,25 @@ that the appropriate major-mode is set. SPEC has the form:
|
|
|
|
|
|
(start-line file link source-name params body comment)"
|
|
|
(let* ((start-line (nth 0 spec))
|
|
|
+ (info (nth 4 spec))
|
|
|
(file (if org-babel-tangle-use-relative-file-links
|
|
|
(file-relative-name (nth 1 spec))
|
|
|
(nth 1 spec)))
|
|
|
(link (let ((link (nth 2 spec)))
|
|
|
(if org-babel-tangle-use-relative-file-links
|
|
|
- (when (string-match "^\\(file:\\|docview:\\)\\(.*\\)" link)
|
|
|
- (let* ((type (match-string 1 link))
|
|
|
- (path (match-string 2 link))
|
|
|
- (origpath path)
|
|
|
- (case-fold-search nil))
|
|
|
- (setq path (file-relative-name path))
|
|
|
- (concat type path)))
|
|
|
+ (when (string-match org-link-types-re link)
|
|
|
+ (let ((type (match-string 0 link))
|
|
|
+ (link (substring link (match-end 0))))
|
|
|
+ (concat
|
|
|
+ type
|
|
|
+ (file-relative-name
|
|
|
+ link
|
|
|
+ (file-name-directory (cdr (assq :tangle info)))))))
|
|
|
link)))
|
|
|
(source-name (nth 3 spec))
|
|
|
(body (nth 5 spec))
|
|
|
(comment (nth 6 spec))
|
|
|
- (comments (cdr (assoc :comments (nth 4 spec))))
|
|
|
+ (comments (cdr (assq :comments info)))
|
|
|
(link-p (or (string= comments "both") (string= comments "link")
|
|
|
(string= comments "yes") (string= comments "noweb")))
|
|
|
(link-data (mapcar (lambda (el)
|
|
@@ -403,14 +405,14 @@ can be used to limit the collected code blocks by target file."
|
|
|
(let ((current-heading-pos
|
|
|
(org-with-wide-buffer
|
|
|
(org-with-limited-levels (outline-previous-heading)))))
|
|
|
- (cond ((eq last-heading-pos current-heading-pos) (incf counter))
|
|
|
- ((= counter 1))
|
|
|
- (t (setq counter 1))))
|
|
|
+ (if (eq last-heading-pos current-heading-pos) (incf counter)
|
|
|
+ (setq counter 1)
|
|
|
+ (setq last-heading-pos current-heading-pos)))
|
|
|
(unless (org-in-commented-heading-p)
|
|
|
(let* ((info (org-babel-get-src-block-info 'light))
|
|
|
(src-lang (nth 0 info))
|
|
|
(src-tfile (cdr (assq :tangle (nth 2 info)))))
|
|
|
- (unless (or (string= (cdr (assq :tangle (nth 2 info))) "no")
|
|
|
+ (unless (or (string= src-tfile "no")
|
|
|
(and tangle-file (not (equal tangle-file src-tfile)))
|
|
|
(and language (not (string= language src-lang))))
|
|
|
;; Add the spec for this block to blocks under its
|