Make snippets for org header args

This commit is contained in:
Kiana Sheibani 2024-03-07 01:46:11 -05:00
parent 1dedd8c273
commit 4d2e6eed7b
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
12 changed files with 155 additions and 2 deletions

View file

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# key: S
# name: header arg - session
# condition: (~/yas-org-src-header-p)
# --
:session "${1:`(file-name-base (or (buffer-file-name) "unnnamed"))`-session}" $0

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# key: d
# name: header arg - dir
# condition: (~/yas-org-src-header-p)
# --
:dir `(file-relative-name (read-directory-name "Working directory: "))` $0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# key: e
# name: header arg - export
# condition: (~/yas-org-src-header-p)
# --
`(let ((out (~/yas-org-prompt-header-arg
:exports "Exports: "
'("code" "results" "both" "none"))))
(if out (concat ":exports " out " ") ""))`

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# key: f
# name: header arg - file
# condition: (~/yas-org-src-header-p)
# --
:file $0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# key: n
# name: header arg - noweb
# condition: (~/yas-org-src-header-p)
# --
`(let ((out (~/yas-org-prompt-header-arg
:noweb "NoWeb: "
'("no" "yes" "tangle" "no-export" "strip-export" "eval"))))
(if out (concat ":noweb " out " ") ""))`

View file

@ -0,0 +1,15 @@
# -*- mode: snippet -*-
# key: r
# name: header arg - results
# condition: (~/yas-org-src-header-p)
# --
`(let ((out
(->>
'((:results "Result collection: " ("value" "output"))
(:results "Results type: " ("table" "vector" "list" "verbatim" "file"))
(:results "Results format: " ("code" "drawer" "html" "latex" "link" "graphics" "org" "pp" "raw"))
(:results "Result output: " ("silent" "replace" "append" "prepend")))
(--map (apply #'~/yas-org-prompt-header-arg it))
-non-nil
(s-join " "))))
(if (string= out "") "" (concat ":results " out " ")))`

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# key: s
# name: header arg - silent
# condition: (~/yas-org-src-header-p)
# --
:results silent $0

View file

@ -0,0 +1,6 @@
# -*- mode: snippet -*-
# key: t
# name: header arg - tangle
# condition: (~/yas-org-src-header-p)
# --
:tangle $0

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# key: v
# name: header arg - eval
# condition: (~/yas-org-src-header-p)
# --
`(let ((out (~/yas-org-prompt-header-arg
:eval "Evaluate: "
'("no" "query" "no-export" "query-export"))))
(if out (concat ":eval " out " ") ""))`

View file

@ -0,0 +1,9 @@
# -*- mode: snippet -*-
# key: w
# name: header arg - wrap
# condition: (~/yas-org-src-header-p)
# --
`(let ((out (~/yas-org-prompt-header-arg
:noweb "Wrap: "
'("example" "export" "comment" "src"))))
(if out (concat ":wrap " out " ") ""))`