forked from mirrors/org-mode
now able to open file links
This commit is contained in:
parent
3692c4b3a5
commit
f4f626e3e1
|
@ -364,7 +364,7 @@ buffer or nil if no such result exists."
|
|||
(concat "#\\+resname:[ \t]*" (regexp-quote name) "[ \t\n\f\v\r]") nil t)
|
||||
(move-beginning-of-line 1) (point))))
|
||||
|
||||
(defun org-babel-where-is-src-block-result ()
|
||||
(defun org-babel-where-is-src-block-result (&optional insert)
|
||||
"Return the point at the beginning of the result of the current
|
||||
source block. Specifically at the beginning of the #+RESNAME:
|
||||
line. If no result exists for this block then create a
|
||||
|
@ -383,7 +383,7 @@ line. If no result exists for this block then create a
|
|||
(or (progn ;; either an unnamed #+resname: line already exists
|
||||
(re-search-forward "[^ \f\t\n\r\v]" nil t)
|
||||
(move-beginning-of-line 1) (looking-at "#\\+resname:"))
|
||||
(progn ;; or we need to back up and make one ourselves
|
||||
(when insert ;; or (with optional insert) we need to back up and make one ourselves
|
||||
(goto-char end) (open-line 2) (forward-char 1)
|
||||
(insert (concat "#+resname:" (if name (concat " " name))))
|
||||
(move-beginning-of-line 1) t)))
|
||||
|
@ -445,7 +445,7 @@ silent -- no results are inserted"
|
|||
(string-equal (substring result -1) "\r"))))
|
||||
(setq result (concat result "\n")))
|
||||
(save-excursion
|
||||
(let ((existing-result (org-babel-where-is-src-block-result)))
|
||||
(let ((existing-result (org-babel-where-is-src-block-result t)))
|
||||
(when existing-result (goto-char existing-result) (forward-line 1)))
|
||||
(if (stringp result) ;; assume the result is a table if it's not a string
|
||||
(if (member "file" insert)
|
||||
|
@ -470,10 +470,10 @@ source code block, otherwise return nil."
|
|||
(goto-char (or (org-babel-where-is-src-block-result)
|
||||
(progn (org-babel-execute-src-block)
|
||||
(org-babel-where-is-src-block-result))))
|
||||
(move-end-of-line 1) (forward-char 1)
|
||||
;; open the results
|
||||
(if (looking-at org-bracket-link-regexp)
|
||||
;; file
|
||||
(org-open-at-point)
|
||||
(org-open-at-point) ;; file
|
||||
;; vector or scalar
|
||||
(let ((results (org-babel-read-result)))
|
||||
(pop-to-buffer (get-buffer-create "org-babel-results"))
|
||||
|
@ -491,7 +491,7 @@ relies on `org-babel-insert-result'."
|
|||
"Remove the result of the current source block."
|
||||
(interactive)
|
||||
(save-excursion
|
||||
(goto-char (org-babel-where-is-src-block-result)) (forward-line 1)
|
||||
(goto-char (org-babel-where-is-src-block-result t)) (forward-line 1)
|
||||
(delete-region (point) (org-babel-result-end))))
|
||||
|
||||
(defun org-babel-result-end ()
|
||||
|
|
|
@ -207,7 +207,7 @@ would then be [[#sandbox][the sandbox]].
|
|||
#+end_src
|
||||
|
||||
|
||||
* Tasks [37/59]
|
||||
* Tasks [36/58]
|
||||
** PROPOSED raise elisp error when source-blocks return errors
|
||||
Not sure how/if this would work, but it may be desirable.
|
||||
|
||||
|
@ -453,7 +453,7 @@ In interactive use we might want to allow the user to choose between
|
|||
screen and file output. In non-interactive use such as export, it
|
||||
would be file output (subject to the :exports directives).
|
||||
|
||||
** TODO =\C-c \C-o= to open results of source block
|
||||
** STARTED =\C-c \C-o= to open results of source block
|
||||
by adding a =defadvice= to =org-open-at-point= we can use the common
|
||||
=\C-c \C-o= keybinding to open the results of a source-code block.
|
||||
This would be especially useful for source-code blocks which generate
|
||||
|
@ -477,6 +477,8 @@ This could also act reasonably with other results types...
|
|||
#+end_src
|
||||
|
||||
#+resname:
|
||||
[[file:blue.png][blue.png]]
|
||||
|
||||
|
||||
|
||||
** TODO Finalise behaviour regarding vector/scalar output
|
||||
|
|
Loading…
Reference in a new issue