Org-Babel support for evaluating permalink and insert source code.
👇Evaluate org-babel(C-c C-c)
M-x package-install RET ob-git-permalink RET
#+begin_src git-permalink
https://github.com/emacs-mirror/emacs/blob/a4dcc8b9a94466c792be3743760a4a45cf6e1e61/lisp/emacs-lisp/ring.el#L48-L52
#+end_src
↓ evaluate(C-c)
(defun ring-p (x)
"Return t if X is a ring; nil otherwise."
(and (consp x) (integerp (car x))
(consp (cdr x)) (integerp (cadr x))
(vectorp (cddr x))))
- Emacs: git-link is very useful.
- GitHub Web UI: Creating a permanent link to a code snippet - GitHub Docs
The results shown below are same.
#+caption: Emacs README
#+begin_src git-permalink :url https://github.com/emacs-mirror/emacs/blob/a4dcc8b9a94466c792be3743760a4a45cf6e1e61/README#L1-L2
#+end_src
#+RESULTS:
: Copyright (C) 2001-2022 Free Software Foundation, Inc.
: See the end of the file for license conditions.
- support other hosting service(GitLab, Bitbucket...)