[Emacs] Add swift to org-babel languages, neater noweb code
This commit is contained in:
parent
4ccab5440a
commit
b9d4d6b180
@ -2082,19 +2082,22 @@ One of the amazing features of org-mode is its literary programming capacities b
|
||||
| sass |
|
||||
| scheme |
|
||||
| shell |
|
||||
| swift |
|
||||
|
||||
#+NAME: org-babel-languages-gen
|
||||
#+header: :cache yes :results replace
|
||||
#+header: :var languages=org-babel-languages-table[,0]
|
||||
#+BEGIN_SRC emacs-lisp :exports none
|
||||
(mapconcat (lambda ($language) (format "(%s . t)" $language))
|
||||
(format "'(%s)"
|
||||
(mapconcat (lambda ($language)
|
||||
(format "(%s . t)" $language))
|
||||
languages
|
||||
"\n")
|
||||
"\n "))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[0e796575005954e09cc4c2ce54d4bbf93364e45d]: org-babel-languages-gen
|
||||
#+begin_example
|
||||
(C . t)
|
||||
#+RESULTS[498fc46efb1de59954f758ca3d9869ea6a73dad9]: org-babel-languages-gen
|
||||
#+begin_src emacs-lisp
|
||||
'((C . t)
|
||||
(dot . t)
|
||||
(emacs-lisp . t)
|
||||
(gnuplot . t)
|
||||
@ -2105,15 +2108,15 @@ One of the amazing features of org-mode is its literary programming capacities b
|
||||
(sass . t)
|
||||
(scheme . t)
|
||||
(shell . t)
|
||||
#+end_example
|
||||
(swift . t))
|
||||
#+end_src
|
||||
|
||||
The corresponding code is as follows:
|
||||
#+NAME: org-babel-load-languages
|
||||
#+BEGIN_SRC emacs-lisp :noweb yes
|
||||
(org-babel-do-load-languages
|
||||
'org-babel-load-languages
|
||||
'(
|
||||
<<org-babel-languages-gen()>>))
|
||||
<<org-babel-languages-gen()>>)
|
||||
#+END_SRC
|
||||
|
||||
Scheme requires a default implementation for geiser:
|
||||
@ -2458,6 +2461,7 @@ The following code snipped is not tangled into my configuration file, but instea
|
||||
#+NAME: org-capture-shortcut-gen
|
||||
#+header: :exports code :cache yes :results replace
|
||||
#+BEGIN_SRC emacs-lisp :var table=org-capture-shortcuts-table
|
||||
(format "'(%s)"
|
||||
(mapconcat (lambda (entry)
|
||||
(let* ((shortcut (nth 0 entry))
|
||||
(name (nth 1 entry))
|
||||
@ -2472,12 +2476,12 @@ The following code snipped is not tangled into my configuration file, but instea
|
||||
(if (string= "file+datetree" insertmode) ""
|
||||
(format " \"%s\"" (if (string= "" title) name title))))
|
||||
(format " (file \"~/org/capture/%s\"))" sourceorg)))) )
|
||||
table "\n")
|
||||
table "\n "))
|
||||
#+END_SRC
|
||||
|
||||
#+RESULTS[5826faa0521c58664ddeedcf44b88910dbd344b6]: org-capture-shortcut-gen
|
||||
#+RESULTS[1fec26dc1d0158ebcaf9b282eb997901321593fa]: org-capture-shortcut-gen
|
||||
#+begin_example
|
||||
("e" "Email")
|
||||
'(("e" "Email")
|
||||
("ew" "Write Email" entry
|
||||
(file+headline org-default-notes-file "Emails")
|
||||
(file "~/org/capture/emails.orgcaptmpl"))
|
||||
@ -2545,7 +2549,7 @@ The following code snipped is not tangled into my configuration file, but instea
|
||||
(file "~/org/capture/health.orgcaptmpl"))
|
||||
("ti" "Informatique" entry
|
||||
(file+headline org-private-agenda-file "Informatique")
|
||||
(file "~/org/capture/informatique.orgcaptmpl"))
|
||||
(file "~/org/capture/informatique.orgcaptmpl")))
|
||||
#+end_example
|
||||
|
||||
Below you can find the equivalent code as described above.
|
||||
@ -2553,9 +2557,7 @@ Below you can find the equivalent code as described above.
|
||||
#+BEGIN_SRC emacs-lisp :noweb yes
|
||||
(setq
|
||||
org-capture-templates
|
||||
'(
|
||||
<<org-capture-shortcut-gen()>>
|
||||
))
|
||||
<<org-capture-shortcut-gen()>>)
|
||||
#+END_SRC
|
||||
|
||||
You may notice a capture entry for my journal, and this is due to the fact I do not use ~org-journal~ anymore: it was too overpowered for me, and I prefer to keep it simple with a single file. And as you can see, and unlike a lot of other Emacs configurations, the content of the template is not set in the variable, but in external files which can be modified freely as actual Org buffers instead of trying to get a proper one with loads of ~\n~ characters and such. All these templates are declared below.
|
||||
|
Loading…
Reference in New Issue
Block a user