Skip to main content
deleted 124 characters in body
Source Link
Tobias
  • 33.7k
  • 1
  • 38
  • 78

You can easily define your own link type that runs source blocks:

(org-link-set-parameters
 "run"
 :follow
 (lambda (path)
   (save-excursion
     (org-babel-goto-named-src-block path)
     (org#'org-babel-execute-src-blockref-maybe)))
 resolve)

Afterwards a click on run:hello executes the source block in the following Orgmode file.

#+name: hello
#+begin_src emacs-lisp :var n=1
(message "Hello""Hello. n=%s" n)
#+end_src

#+RESULTS: hello
: Hello

run:hello

[[run:hello(n=2)]]

You can easily define your own link type that runs source blocks:

(org-link-set-parameters
 "run"
 :follow
 (lambda (path)
   (save-excursion
     (org-babel-goto-named-src-block path)
     (org-babel-execute-src-block-maybe)))
 )

Afterwards a click on run:hello executes the source block in the following Orgmode file.

#+name: hello
#+begin_src emacs-lisp
(message "Hello")
#+end_src

#+RESULTS: hello
: Hello

run:hello

You can easily define your own link type that runs source blocks:

(org-link-set-parameters
 "run"
 :follow #'org-babel-ref-resolve)

Afterwards a click on run:hello executes the source block in the following Orgmode file.

#+name: hello
#+begin_src emacs-lisp :var n=1
(message "Hello. n=%s" n)
#+end_src

#+RESULTS: hello
: Hello

run:hello

[[run:hello(n=2)]]
Source Link
Tobias
  • 33.7k
  • 1
  • 38
  • 78

You can easily define your own link type that runs source blocks:

(org-link-set-parameters
 "run"
 :follow
 (lambda (path)
   (save-excursion
     (org-babel-goto-named-src-block path)
     (org-babel-execute-src-block-maybe)))
 )

Afterwards a click on run:hello executes the source block in the following Orgmode file.

#+name: hello
#+begin_src emacs-lisp
(message "Hello")
#+end_src

#+RESULTS: hello
: Hello

run:hello