[Emacs] Add swift to org-babel languages, neater noweb code
This commit is contained in:
parent
4ccab5440a
commit
b9d4d6b180
@ -2082,38 +2082,41 @@ One of the amazing features of org-mode is its literary programming capacities b
|
|||||||
| sass |
|
| sass |
|
||||||
| scheme |
|
| scheme |
|
||||||
| shell |
|
| shell |
|
||||||
|
| swift |
|
||||||
|
|
||||||
#+NAME: org-babel-languages-gen
|
#+NAME: org-babel-languages-gen
|
||||||
#+header: :cache yes :results replace
|
#+header: :cache yes :results replace
|
||||||
#+header: :var languages=org-babel-languages-table[,0]
|
#+header: :var languages=org-babel-languages-table[,0]
|
||||||
#+BEGIN_SRC emacs-lisp :exports none
|
#+BEGIN_SRC emacs-lisp :exports none
|
||||||
(mapconcat (lambda ($language) (format "(%s . t)" $language))
|
(format "'(%s)"
|
||||||
|
(mapconcat (lambda ($language)
|
||||||
|
(format "(%s . t)" $language))
|
||||||
languages
|
languages
|
||||||
"\n")
|
"\n "))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS[0e796575005954e09cc4c2ce54d4bbf93364e45d]: org-babel-languages-gen
|
#+RESULTS[498fc46efb1de59954f758ca3d9869ea6a73dad9]: org-babel-languages-gen
|
||||||
#+begin_example
|
#+begin_src emacs-lisp
|
||||||
(C . t)
|
'((C . t)
|
||||||
(dot . t)
|
(dot . t)
|
||||||
(emacs-lisp . t)
|
(emacs-lisp . t)
|
||||||
(gnuplot . t)
|
(gnuplot . t)
|
||||||
(latex . t)
|
(latex . t)
|
||||||
(makefile . t)
|
(makefile . t)
|
||||||
(plantuml . t)
|
(plantuml . t)
|
||||||
(python . t)
|
(python . t)
|
||||||
(sass . t)
|
(sass . t)
|
||||||
(scheme . t)
|
(scheme . t)
|
||||||
(shell . t)
|
(shell . t)
|
||||||
#+end_example
|
(swift . t))
|
||||||
|
#+end_src
|
||||||
|
|
||||||
The corresponding code is as follows:
|
The corresponding code is as follows:
|
||||||
#+NAME: org-babel-load-languages
|
#+NAME: org-babel-load-languages
|
||||||
#+BEGIN_SRC emacs-lisp :noweb yes
|
#+BEGIN_SRC emacs-lisp :noweb yes
|
||||||
(org-babel-do-load-languages
|
(org-babel-do-load-languages
|
||||||
'org-babel-load-languages
|
'org-babel-load-languages
|
||||||
'(
|
<<org-babel-languages-gen()>>)
|
||||||
<<org-babel-languages-gen()>>))
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
Scheme requires a default implementation for geiser:
|
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
|
#+NAME: org-capture-shortcut-gen
|
||||||
#+header: :exports code :cache yes :results replace
|
#+header: :exports code :cache yes :results replace
|
||||||
#+BEGIN_SRC emacs-lisp :var table=org-capture-shortcuts-table
|
#+BEGIN_SRC emacs-lisp :var table=org-capture-shortcuts-table
|
||||||
|
(format "'(%s)"
|
||||||
(mapconcat (lambda (entry)
|
(mapconcat (lambda (entry)
|
||||||
(let* ((shortcut (nth 0 entry))
|
(let* ((shortcut (nth 0 entry))
|
||||||
(name (nth 1 entry))
|
(name (nth 1 entry))
|
||||||
@ -2472,80 +2476,80 @@ The following code snipped is not tangled into my configuration file, but instea
|
|||||||
(if (string= "file+datetree" insertmode) ""
|
(if (string= "file+datetree" insertmode) ""
|
||||||
(format " \"%s\"" (if (string= "" title) name title))))
|
(format " \"%s\"" (if (string= "" title) name title))))
|
||||||
(format " (file \"~/org/capture/%s\"))" sourceorg)))) )
|
(format " (file \"~/org/capture/%s\"))" sourceorg)))) )
|
||||||
table "\n")
|
table "\n "))
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
#+RESULTS[5826faa0521c58664ddeedcf44b88910dbd344b6]: org-capture-shortcut-gen
|
#+RESULTS[1fec26dc1d0158ebcaf9b282eb997901321593fa]: org-capture-shortcut-gen
|
||||||
#+begin_example
|
#+begin_example
|
||||||
("e" "Email")
|
'(("e" "Email")
|
||||||
("ew" "Write Email" entry
|
("ew" "Write Email" entry
|
||||||
(file+headline org-default-notes-file "Emails")
|
(file+headline org-default-notes-file "Emails")
|
||||||
(file "~/org/capture/emails.orgcaptmpl"))
|
(file "~/org/capture/emails.orgcaptmpl"))
|
||||||
("j" "Journal" entry
|
("j" "Journal" entry
|
||||||
(file+datetree org-journal-file)
|
(file+datetree org-journal-file)
|
||||||
(file "~/org/capture/journal.orgcaptmpl"))
|
(file "~/org/capture/journal.orgcaptmpl"))
|
||||||
("l" "Link")
|
("l" "Link")
|
||||||
("ll" "General" entry
|
("ll" "General" entry
|
||||||
(file+headline org-default-notes-file "General")
|
(file+headline org-default-notes-file "General")
|
||||||
(file "~/org/capture/"))
|
(file "~/org/capture/"))
|
||||||
("ly" "YouTube" entry
|
("ly" "YouTube" entry
|
||||||
(file+headline org-default-notes-file "YouTube")
|
(file+headline org-default-notes-file "YouTube")
|
||||||
(file "~/org/capture/youtube.orgcaptmpl"))
|
(file "~/org/capture/youtube.orgcaptmpl"))
|
||||||
("L" "Protocol Link" entry
|
("L" "Protocol Link" entry
|
||||||
(file+headline org-default-notes-file "Link")
|
(file+headline org-default-notes-file "Link")
|
||||||
(file "~/org/capture/protocol-link.orgcaptmpl"))
|
(file "~/org/capture/protocol-link.orgcaptmpl"))
|
||||||
("n" "Notes")
|
("n" "Notes")
|
||||||
("nc" "Conlanging" entry
|
("nc" "Conlanging" entry
|
||||||
(file+headline org-conlanging-file "Note")
|
(file+headline org-conlanging-file "Note")
|
||||||
(file "~/org/capture/notes.orgcaptmpl"))
|
(file "~/org/capture/notes.orgcaptmpl"))
|
||||||
("nn" "General" entry
|
("nn" "General" entry
|
||||||
(file+headline org-default-notes-file "General")
|
(file+headline org-default-notes-file "General")
|
||||||
(file "~/org/capture/notes.orgcaptmpl"))
|
(file "~/org/capture/notes.orgcaptmpl"))
|
||||||
("nN" "Novel" entry
|
("nN" "Novel" entry
|
||||||
(file+headline org-novel-notes-file "Note")
|
(file+headline org-novel-notes-file "Note")
|
||||||
(file "~/org/capture/notes.orgcaptmpl"))
|
(file "~/org/capture/notes.orgcaptmpl"))
|
||||||
("nq" "Quote" entry
|
("nq" "Quote" entry
|
||||||
(file+headline org-default-notes-file "Quote")
|
(file+headline org-default-notes-file "Quote")
|
||||||
(file "~/org/capture/notes-quote.orgcaptmpl"))
|
(file "~/org/capture/notes-quote.orgcaptmpl"))
|
||||||
("nw" "Worldbuilding" entry
|
("nw" "Worldbuilding" entry
|
||||||
(file+headline org-wordbuilding-file "Note")
|
(file+headline org-wordbuilding-file "Note")
|
||||||
(file "~/org/capture/notes.orgcaptmpl"))
|
(file "~/org/capture/notes.orgcaptmpl"))
|
||||||
("N" "Novel")
|
("N" "Novel")
|
||||||
("Ni" "Ideas" entry
|
("Ni" "Ideas" entry
|
||||||
(file+headline org-novel-notes-file "Ideas")
|
(file+headline org-novel-notes-file "Ideas")
|
||||||
(file "~/org/capture/notes.orgcaptmpl"))
|
(file "~/org/capture/notes.orgcaptmpl"))
|
||||||
("p" "Protocol" entry
|
("p" "Protocol" entry
|
||||||
(file+headline org-default-notes-file "Link")
|
(file+headline org-default-notes-file "Link")
|
||||||
(file "~/org/capture/protocol.orgcaptmpl"))
|
(file "~/org/capture/protocol.orgcaptmpl"))
|
||||||
("r" "Resources")
|
("r" "Resources")
|
||||||
("rc" "Conlanging" entry
|
("rc" "Conlanging" entry
|
||||||
(file+headline org-conlanging-file "Resource")
|
(file+headline org-conlanging-file "Resource")
|
||||||
(file "~/org/capture/resource.orgcaptmpl"))
|
(file "~/org/capture/resource.orgcaptmpl"))
|
||||||
("re" "Emacs" entry
|
("re" "Emacs" entry
|
||||||
(file+headline org-default-notes-file "Emacs")
|
(file+headline org-default-notes-file "Emacs")
|
||||||
(file "~/org/capture/resource.orgcaptmpl"))
|
(file "~/org/capture/resource.orgcaptmpl"))
|
||||||
("ri" "Informatique" entry
|
("ri" "Informatique" entry
|
||||||
(file+headline org-default-notes-file "Informatique")
|
(file+headline org-default-notes-file "Informatique")
|
||||||
(file "~/org/capture/resource.orgcaptmpl"))
|
(file "~/org/capture/resource.orgcaptmpl"))
|
||||||
("rl" "Linguistics" entry
|
("rl" "Linguistics" entry
|
||||||
(file+headline org-default-notes-file "Linguistics")
|
(file+headline org-default-notes-file "Linguistics")
|
||||||
(file "~/org/capture/resource.orgcaptmpl"))
|
(file "~/org/capture/resource.orgcaptmpl"))
|
||||||
("rw" "Worldbuilding" entry
|
("rw" "Worldbuilding" entry
|
||||||
(file+headline org-wordbuilding-file "Resource")
|
(file+headline org-wordbuilding-file "Resource")
|
||||||
(file "~/org/capture/resource.orgcaptmpl"))
|
(file "~/org/capture/resource.orgcaptmpl"))
|
||||||
("t" "Tasks")
|
("t" "Tasks")
|
||||||
("tb" "Birthday" entry
|
("tb" "Birthday" entry
|
||||||
(file+headline org-private-agenda-file "Birthday")
|
(file+headline org-private-agenda-file "Birthday")
|
||||||
(file "~/org/capture/birthday.orgcaptmpl"))
|
(file "~/org/capture/birthday.orgcaptmpl"))
|
||||||
("te" "Event" entry
|
("te" "Event" entry
|
||||||
(file+headline org-private-agenda-file "Event")
|
(file+headline org-private-agenda-file "Event")
|
||||||
(file "~/org/capture/event.orgcaptmpl"))
|
(file "~/org/capture/event.orgcaptmpl"))
|
||||||
("th" "Health" entry
|
("th" "Health" entry
|
||||||
(file+headline org-private-agenda-file "Health")
|
(file+headline org-private-agenda-file "Health")
|
||||||
(file "~/org/capture/health.orgcaptmpl"))
|
(file "~/org/capture/health.orgcaptmpl"))
|
||||||
("ti" "Informatique" entry
|
("ti" "Informatique" entry
|
||||||
(file+headline org-private-agenda-file "Informatique")
|
(file+headline org-private-agenda-file "Informatique")
|
||||||
(file "~/org/capture/informatique.orgcaptmpl"))
|
(file "~/org/capture/informatique.orgcaptmpl")))
|
||||||
#+end_example
|
#+end_example
|
||||||
|
|
||||||
Below you can find the equivalent code as described above.
|
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
|
#+BEGIN_SRC emacs-lisp :noweb yes
|
||||||
(setq
|
(setq
|
||||||
org-capture-templates
|
org-capture-templates
|
||||||
'(
|
<<org-capture-shortcut-gen()>>)
|
||||||
<<org-capture-shortcut-gen()>>
|
|
||||||
))
|
|
||||||
#+END_SRC
|
#+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.
|
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