-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathlentic-latex-code.el
97 lines (70 loc) · 2.94 KB
/
lentic-latex-code.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
;;; lentic-latex-code.el -- Latex literate programming -*- lexical-binding: t -*-
;;; Header:
;; This file is not part of Emacs
;; Author: Phillip Lord <[email protected]>
;; Maintainer: Phillip Lord <[email protected]>
;; Version: 0.1
;; The contents of this file are subject to the GPL License, Version 3.0.
;; Copyright (C) 2014-2022 Free Software Foundation, Inc.
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; A `lentic-chunk-configuration' environment where one buffer is latex
;; and the other is some programming language, with code chunks marked up with
;; a =\begin{code}\end{code}= environment.
;; The code environment is not normally defined and has been picked for this
;; reason. It avoids defining multiple init functions for different macros;
;; instead the code chunks can be interpreted using what ever environment the
;; author wants, by defining the code environment first.
;;; Code:
;; #+begin_src emacs-lisp
(require 'lentic-chunk)
(defun lentic-latex-clojure-oset (conf)
(lentic-m-oset
conf
'this-buffer (current-buffer)
'comment ";; "
'comment-start "\\\\end{code}"
'comment-stop "\\\\begin{code}"))
(defun lentic-clojure-to-latex-new ()
(lentic-latex-clojure-oset
(lentic-commented-chunk-configuration
:lentic-file
(concat (file-name-sans-extension buffer-file-name) ".tex"))))
;;;###autoload
(defun lentic-clojure-latex-init ()
(lentic-clojure-to-latex-new))
(add-to-list 'lentic-init-functions #'lentic-clojure-latex-init)
(defun lentic-latex-to-clojure-new ()
(lentic-latex-clojure-oset
(lentic-uncommented-chunk-configuration
:lentic-file
(concat (file-name-sans-extension buffer-file-name) ".clj"))))
;;;###autoload
(defun lentic-latex-clojure-init ()
(lentic-latex-to-clojure-new))
(add-to-list 'lentic-init-functions #'lentic-latex-clojure-init)
;;;###autoload
(defun lentic-clojure-latex-delayed-init ()
(lentic-delayed-init #'lentic-clojure-latex-init))
(add-to-list 'lentic-init-functions #'lentic-clojure-latex-delayed-init)
;;;###autoload
(defun lentic-haskell-latex-init ()
(lentic-default-configuration
:this-buffer (current-buffer)
:lentic-file
(concat
(file-name-sans-extension buffer-file-name)
".tex")))
(add-to-list 'lentic-init-functions #'lentic-haskell-latex-init)
(provide 'lentic-latex-code)
;;; lentic-latex-code ends here
;; #+end_src