Handle org-mode source blocks without a tangled file

This commit is contained in:
Gerard Vermeulen 2022-09-02 08:07:04 +02:00
parent e6d5a257fc
commit dd585264c2

View File

@ -3271,9 +3271,12 @@ mode independent [[https://github.com/joaotavora/eglot][eglot]] configuration:
(user-error "Buffer %s is no `org-src-mode' buffer" (buffer-name)))
(let ((mark (point))
(body (nth 1 info))
(filename (expand-file-name (cdr (assq :tangle (nth 2 info))))))
(filename (cdr (assq :tangle (nth 2 info)))))
(when (string= filename "no")
(user-error "Org source block has no tangled file"))
(setq filename (expand-file-name filename))
(unless (file-readable-p filename)
(user-error "Tangled file %s is not readible" filename))
(user-error "Tangled file %s is not readable" filename))
(with-temp-buffer
(insert-file-contents filename 'visit nil nil 'replace)
(unless (search-forward body nil 'noerror)