diff options
author | Robert Alessi <alessi@robertalessi.net> | 2020-04-13 17:28:32 +0200 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2020-04-13 17:28:32 +0200 |
commit | bfe0be49dc3240fc75bd9633c29511f625794f4c (patch) | |
tree | 8ae30ac672f940bbac6a51e161fe17243edf9f9e | |
parent | 2448ffc900eeea6c4d91eb61b503f2e4b33dd659 (diff) | |
download | arabluatex-bfe0be49dc3240fc75bd9633c29511f625794f4c.tar.gz |
much improved arabluatex.el - Thanks to Arash Esbati
-rw-r--r-- | arabluatex.el | 110 |
1 files changed, 66 insertions, 44 deletions
diff --git a/arabluatex.el b/arabluatex.el index 7db86e8..8c16c9e 100644 --- a/arabluatex.el +++ b/arabluatex.el | |||
@@ -4,6 +4,10 @@ | |||
4 | ;; ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX | 4 | ;; ArabLuaTeX -- Processing ArabTeX notation under LuaLaTeX |
5 | ;; Copyright (C) 2016--2020 Robert Alessi | 5 | ;; Copyright (C) 2016--2020 Robert Alessi |
6 | 6 | ||
7 | ;; The author would like to express his grateful thanks to Arash | ||
8 | ;; Esbati <arash@gnu.org> whose comments helped to improve this file | ||
9 | ;; immensely. | ||
10 | |||
7 | ;; Please send error reports and suggestions for improvements to Robert | 11 | ;; Please send error reports and suggestions for improvements to Robert |
8 | ;; Alessi <alessi@robertalessi.net> | 12 | ;; Alessi <alessi@robertalessi.net> |
9 | 13 | ||
@@ -22,8 +26,7 @@ | |||
22 | ;; <http://www.gnu.org/licenses/>. | 26 | ;; <http://www.gnu.org/licenses/>. |
23 | 27 | ||
24 | (defvar LaTeX-arabluatex-preamble-options | 28 | (defvar LaTeX-arabluatex-preamble-options |
25 | '(;; | 29 | '(("voc") |
26 | ("voc") | ||
27 | ("fullvoc") | 30 | ("fullvoc") |
28 | ("novoc") | 31 | ("novoc") |
29 | ("trans") | 32 | ("trans") |
@@ -32,21 +35,17 @@ | |||
32 | 35 | ||
33 | (defun LaTeX-arabluatex-package-options () | 36 | (defun LaTeX-arabluatex-package-options () |
34 | "Prompt for package options for arabluatex package." | 37 | "Prompt for package options for arabluatex package." |
35 | (TeX-read-key-val t | 38 | (TeX-read-key-val t LaTeX-arabluatex-preamble-options)) |
36 | (append LaTeX-arabluatex-preamble-options))) | ||
37 | 39 | ||
38 | (defvar LaTeX-arabluatex-mode-options | 40 | (defvar LaTeX-arabluatex-mode-options |
39 | '(;; | 41 | '("voc" |
40 | ("voc") | 42 | "fullvoc" |
41 | ("fullvoc") | 43 | "novoc" |
42 | ("novoc") | 44 | "trans") |
43 | ("trans") | 45 | "List of local options for arabluatex macros.") |
44 | ) | ||
45 | "Local options.") | ||
46 | 46 | ||
47 | (defvar LaTeX-arabluatex-key-val-options | 47 | (defvar LaTeX-arabluatex-key-val-options |
48 | '(;; | 48 | '(("mode" ("voc" "fullvoc" "novoc" "trans")) |
49 | ("mode" ("voc" "fullvoc" "novoc" "trans")) | ||
50 | ("width") | 49 | ("width") |
51 | ("gutter") | 50 | ("gutter") |
52 | ("metre") | 51 | ("metre") |
@@ -56,19 +55,17 @@ | |||
56 | ("export" ("true" "false"))) | 55 | ("export" ("true" "false"))) |
57 | "Key=value options for arabverse environment.") | 56 | "Key=value options for arabverse environment.") |
58 | 57 | ||
59 | (defvar LaTeX-arabluatex-color-options | 58 | ;; (defvar LaTeX-arabluatex-color-options |
60 | '(())) | 59 | ;; '(())) |
61 | 60 | ||
62 | (defvar LaTeX-arabluatex-outfile-options | 61 | (defvar LaTeX-arabluatex-outfile-options |
63 | '(;; | 62 | '(("newline")) |
64 | ("newline")) | 63 | "List of options for outfile command.") |
65 | "Option for outfile command.") | ||
66 | 64 | ||
67 | (defvar LaTeX-arabluatex-arbmark-options | 65 | (defvar LaTeX-arabluatex-arbmark-options |
68 | '(;; | 66 | '(("rl") |
69 | ("rl") | ||
70 | ("lr")) | 67 | ("lr")) |
71 | "Option for arbmark command.") | 68 | "List of options for arbmark command.") |
72 | 69 | ||
73 | (defvar LaTeX-arabluatex-arind-options | 70 | (defvar LaTeX-arabluatex-arind-options |
74 | '(;; | 71 | '(;; |
@@ -81,10 +78,11 @@ | |||
81 | (TeX-add-style-hook | 78 | (TeX-add-style-hook |
82 | "arabluatex" | 79 | "arabluatex" |
83 | (lambda () | 80 | (lambda () |
81 | ;; Run the style hook for loaded packages: | ||
82 | (TeX-run-style-hooks "xcolor") | ||
84 | ;; Folding features: | 83 | ;; Folding features: |
85 | (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) | 84 | (add-to-list (make-local-variable 'LaTeX-fold-macro-spec-list) |
86 | '("[i]" ("arind")) | 85 | '("[i]" ("arind"))) |
87 | ) | ||
88 | ;; This package relies on lualatex, so check for it: | 86 | ;; This package relies on lualatex, so check for it: |
89 | (TeX-check-engine-add-engines 'luatex) | 87 | (TeX-check-engine-add-engines 'luatex) |
90 | (TeX-add-symbols | 88 | (TeX-add-symbols |
@@ -105,24 +103,28 @@ | |||
105 | "uc" | 103 | "uc" |
106 | "prname" | 104 | "prname" |
107 | "txarb" | 105 | "txarb" |
108 | '("arb" [ (TeX-arg-eval completing-read "Mode: " | 106 | '("arb" [ TeX-arg-eval completing-read |
109 | LaTeX-arabluatex-mode-options) ] | 107 | (TeX-argument-prompt optional nil "Mode") |
108 | LaTeX-arabluatex-mode-options ] | ||
110 | t) | 109 | t) |
111 | '("arbcolor" [ (TeX-arg-eval completing-read "Color: " | 110 | '("arbcolor" [ TeX-arg-eval completing-read |
112 | LaTeX-arabluatex-color-options) ] | 111 | (TeX-argument-prompt optional nil "Color") |
112 | (LaTeX-xcolor-definecolor-list) ] | ||
113 | t) | 113 | t) |
114 | '("arbmark" [ (TeX-arg-eval completing-read "Option: " | 114 | '("arbmark" [ TeX-arg-eval completing-read |
115 | LaTeX-arabluatex-arbmark-options) ] | 115 | (TeX-argument-prompt optional nil "Option") |
116 | LaTeX-arabluatex-arbmark-options ] | ||
116 | t) | 117 | t) |
117 | '("ArbOutFile" [ (TeX-arg-eval completing-read "Color: " | 118 | '("ArbOutFile" [ TeX-arg-eval completing-read |
118 | LaTeX-arabluatex-outfile-options) ] | 119 | (TeX-argument-prompt optional nil "Option") |
120 | LaTeX-arabluatex-outfile-options ] | ||
119 | t) | 121 | t) |
120 | '("ArbOutFile*" [ (TeX-arg-eval completing-read "Option: " | 122 | '("ArbOutFile*" [ TeX-arg-eval completing-read |
121 | LaTeX-arabluatex-outfile-options) ] | 123 | (TeX-argument-prompt optional nil "Option") |
122 | t) | 124 | LaTeX-arabluatex-outfile-options ] |
123 | '("arind" [ (TeX-arg-key-val | ||
124 | LaTeX-arabluatex-arind-options) ] | ||
125 | t) | 125 | t) |
126 | '("arind" [ TeX-arg-key-val LaTeX-arabluatex-arind-options ] | ||
127 | TeX-arg-index) | ||
126 | "SetHemistichDelim" | 128 | "SetHemistichDelim" |
127 | '("bayt" 2) | 129 | '("bayt" 2) |
128 | "abjad" | 130 | "abjad" |
@@ -130,24 +132,44 @@ | |||
130 | "abraces" | 132 | "abraces" |
131 | "LR" | 133 | "LR" |
132 | "RL" | 134 | "RL" |
133 | "LRmarginpar" | 135 | '("LRmarginpar" [ "Left margin text" ] "Text") |
134 | "LRfootnote" | 136 | '("LRfootnote" |
135 | "RLfootnote" | 137 | (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil) |
138 | t) | ||
139 | '("RLfootnote" | ||
140 | (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil) | ||
141 | t) | ||
136 | "FixArbFtnmk" | 142 | "FixArbFtnmk" |
137 | "MkArbBreak" | 143 | "MkArbBreak" |
138 | '("newarbmark" 3) | 144 | '("newarbmark" 3) |
139 | '("setRL" 0) | 145 | '("setRL" 0) |
140 | '("setLR" 0)) | 146 | '("setLR" 0)) |
147 | |||
141 | (LaTeX-add-environments | 148 | (LaTeX-add-environments |
142 | '("arab" LaTeX-env-args | 149 | '("arab" LaTeX-env-args |
143 | [ (TeX-arg-eval completing-read "Mode: " | 150 | [ TeX-arg-eval completing-read |
144 | LaTeX-arabluatex-mode-options) ] | 151 | (TeX-argument-prompt optional nil "Mode") |
145 | 0) | 152 | LaTeX-arabluatex-mode-options ] |
153 | ) | ||
146 | "txarab" | 154 | "txarab" |
147 | "arabexport" | 155 | "arabexport" |
148 | '("arabverse" LaTeX-env-args | 156 | '("arabverse" LaTeX-env-args |
149 | [ TeX-arg-key-val LaTeX-arabluatex-key-val-options ] 0)) | 157 | [ TeX-arg-key-val LaTeX-arabluatex-key-val-options ] )) |
150 | ) | 158 | |
159 | ;; Fontification | ||
160 | (when (and (featurep 'font-latex) | ||
161 | (eq TeX-install-font-lock 'font-latex-setup)) | ||
162 | (font-latex-add-keywords '(("aemph" "{")) | ||
163 | 'italic-command) | ||
164 | (font-latex-add-keywords '(("LRmarginpar" "[{") | ||
165 | ("LRfootnote" "[{") | ||
166 | ("RLfootnote" "[{") | ||
167 | ("arind" "[{")) | ||
168 | 'reference) | ||
169 | (font-latex-add-keywords '(("SetTranslitFont" "{") | ||
170 | ("SetTranslitStyle" "{") | ||
171 | ("SetTranslitConvention" "{")) | ||
172 | 'function))) | ||
151 | LaTeX-dialect) | 173 | LaTeX-dialect) |
152 | 174 | ||
153 | ;;; arabluatex.el ends here | 175 | ;;; arabluatex.el ends here |