/[auctex]/auctex/style/csquotes.el
ViewVC logotype

Diff of /auctex/style/csquotes.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by angeli, Sun Jun 5 11:53:41 2005 UTC revision 1.8 by angeli, Thu Jul 21 11:08:24 2005 UTC
# Line 26  Line 26 
26    
27  ;;; Commentary:  ;;; Commentary:
28    
29  ;; This file adds support for `csquotes.sty'.  ;; This file adds support for `csquotes.sty', version 3.0.
30    
31    
32  ;;; Code:  ;;; Code:
33    
34    ;; FIXME: It would be nice to be able to dump this function in favor
35    ;; of a generalized handling of additional arguments for environments
36    ;; specified via `LaTeX-add-environments'.  `TeX-parse-arguments' and
37    ;; friends would be the functions to be used for that, but those
38    ;; functions currently insert text directly into the buffer.  There
39    ;; would either have to be a way of preventing this and letting them
40    ;; return a string, or the insertion could happen in a temporary buffer
41    ;; and the buffer content be returned.
42    (defun LaTeX-csquotes-insert-environment (env &rest args)
43      "Insert environment ENV considering optional arguments ARGS.
44    
45    This is basically a variant of `LaTeX-environment-menu'
46    specialized for csquotes.el.  ARGS can be made up of strings and
47    vectors containing single strings.  Plain strings will be used as
48    prompts for mandatory arguments and strings in vectors as prompts
49    for optional arguments of the environment to be inserted.
50    
51    That means, in contrast to `LaTeX-environment-menu' it supports
52    the insertion of optional arguments."
53      (let (env-extra prompt optional user-input)
54        (dolist (elt args)
55          (if (vectorp elt)
56              (setq prompt (aref elt 0)
57                    optional t)
58            (setq optional nil))
59          (setq user-input (read-string (TeX-argument-prompt optional prompt nil)))
60          (unless (and optional (zerop (length user-input)))
61            (setq env-extra (concat env-extra
62                                    (if optional LaTeX-optop TeX-grop)
63                                    user-input
64                                    (if optional LaTeX-optcl TeX-grcl)))))
65        (LaTeX-insert-environment env env-extra)))
66    
67  (TeX-add-style-hook  (TeX-add-style-hook
68   "csquotes"   "csquotes"
69   (lambda ()   (lambda ()
# Line 47  Line 81 
81        '("foreignquote*" 2)        '("foreignquote*" 2)
82        '("hyphenquote" 2)        '("hyphenquote" 2)
83        '("hyphenquote*" 2)        '("hyphenquote*" 2)
84        '("blockquote" ["Line threshold"] 2)        '("blockquote" ["Citation"] ["Punctuation"] t)
85        '("foreignblockquote" t ["Line threshold"] nil nil)        '("foreignblockquote" t ["Citation"] ["Punctuation"] nil)
86        '("hyphenblockquote" t ["Line threshold"] nil nil)        '("hyphenblockquote" t ["Citation"] ["Punctuation"] nil)
87        `("setquotestyle"        `("setquotestyle"
88          [ (TeX-arg-eval completing-read "Quote style variant: "          [ (TeX-arg-eval completing-read "Quote style variant: "
89                          ',quote-style-variant-list) ]                          ',quote-style-variant-list) ]
90          (TeX-arg-eval completing-read "Quote style name or alias: "          (TeX-arg-eval completing-read "Quote style name or alias: "
91                        ',quote-style-name-list))                        ',quote-style-name-list))
92          "setquotestyle*"
93        '("MakeInnerQuote" "Character")        '("MakeInnerQuote" "Character")
94        '("MakeOuterQuote" "Character")        '("MakeOuterQuote" "Character")
95        '("MakeAutoQuote" "Opening quotation mark" "Closing quotation mark")        '("MakeAutoQuote" "Opening quotation mark" "Closing quotation mark")
# Line 62  Line 97 
97          "Opening quotation mark" "Closing quotation mark")          "Opening quotation mark" "Closing quotation mark")
98        '("MakeHyphenQuote" "Babel's language name"        '("MakeHyphenQuote" "Babel's language name"
99          "Opening quotation mark" "Closing quotation mark")          "Opening quotation mark" "Closing quotation mark")
100          '("MakeBlockQuote" "Opening quotation mark" "Delimiter for citation"
101            "Closing quotation mark")
102          '("MakeForeignBlockQuote" "Language" "Opening quotation mark"
103            "Delimiter for citation" "Closing quotation mark")
104          '("MakeHyphenBlockQuote" "Language" "Opening quotation mark"
105            "Delimiter for citation" "Closing quotation mark")
106          "DisableQuotes"
107        "RestoreQuotes"        "RestoreQuotes"
108          '("cquote" ["Pre-note"] ["Post-note"] "Key" t)
109          '("cquote*" ["Pre-note"] ["Post-note"] "Key" t)
110          '("foreigncquote" "Language" ["Pre-note"] ["Post-note"] "Key" t)
111          '("foreigncquote*" "Language" ["Pre-note"] ["Post-note"] "Key" t)
112          '("hyphencquote" "Language" ["Pre-note"] ["Post-note"] "Key" t)
113          '("hyphencquote*" "Language" ["Pre-note"] ["Post-note"] "Key" t)
114          '("blockcquote" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"] t)
115          '("foreignblockcquote" "Language" ["Pre-note"] ["Post-note"] "Key"
116            ["Punctuation"] t)
117          '("hyphenblockcquote" "Language" ["Pre-note"] ["Post-note"] "Key"
118            ["Punctuation"] t)
119        `("DeclareQuoteStyle"        `("DeclareQuoteStyle"
120          [ (TeX-arg-eval completing-read "Quote style variant: "          [ (TeX-arg-eval completing-read "Quote style variant: "
121                          ',quote-style-variant-list) ]                          ',quote-style-variant-list) ]
# Line 80  Line 133 
133                        ',quote-style-name-list)                        ',quote-style-name-list)
134          "Alias name")          "Alias name")
135      '("DeclareQuoteOption" 1)      '("DeclareQuoteOption" 1)
136      '("DeclarePlainStyle" "Outer quotation mark" "Inner quotation mark")      '("DeclarePlainStyle" "Opening outer quotation mark"
137      '("setblockthreshold" "Number of lines")        "Closing outer quotation mark" "Opening inner quotation mark"
138      '("setblockenvironment" "Environment")        "Closing inner quotation mark")
139      '("blockcite" 1))      '("SetBlockThreshold" "Number of lines")
140        '("SetBlockEnvironment" "Environment")
141        '("SetCiteCommand" "Command")
142        "mkcitation"
143        "mkccitation"
144        "mkmidblockpunct"
145        "mkfinblockpunct"
146        '("ifblockquote" 2)
147        '("ifquotepunct" 2)
148        '("ifquoteterm" 2)
149        '("ifquoteperiod" 2)
150        '("ifquotecomma" 2)
151        '("ifquotesemicolon" 2)
152        '("ifquotecolon" 2)
153        '("ifquoteexclam" 2)
154        '("ifquotequestion" 2)
155        '("ifstringblank" 2))
156     ;; New environments     ;; New environments
157     (LaTeX-add-environments     (LaTeX-add-environments
158      "quoteblock")      "quoteblock"
159        '("displayquote" "Citation")
160        '("foreigndisplayquote" "Language" "Citation")
161        '("hyphendisplayquote" "Language" "Citation")
162        '("displaycquote" LaTeX-csquotes-insert-environment
163          ["Pre-note"] ["Post-note"] "Key")
164        '("foreigndisplaycquote" LaTeX-csquotes-insert-environment
165          "Language" ["Pre-note"] ["Post-note"] "Key")
166        '("hyphendisplaycquote" LaTeX-csquotes-insert-environment
167          "Language" ["Pre-note"] ["Post-note"] "Key"))
168     ;; Quotation marks     ;; Quotation marks
169     (when (and (> (length LaTeX-csquotes-open-quote) 0)     (when (and (> (length LaTeX-csquotes-open-quote) 0)
170                (> (length LaTeX-csquotes-close-quote) 0))                (> (length LaTeX-csquotes-close-quote) 0))
# Line 96  Line 174 
174     ;; Fontification     ;; Fontification
175     (when (and (featurep 'font-latex)     (when (and (featurep 'font-latex)
176                (eq TeX-install-font-lock 'font-latex-setup))                (eq TeX-install-font-lock 'font-latex-setup))
177         (add-to-list 'font-latex-match-function-keywords-local "DisableQuotes")
178       (add-to-list 'font-latex-match-function-keywords-local "RestoreQuotes")       (add-to-list 'font-latex-match-function-keywords-local "RestoreQuotes")
179       (font-latex-match-function-make)       (font-latex-match-function-make)
180       (add-to-list 'font-latex-match-reference-keywords-local "blockcite")       (add-to-list 'font-latex-match-reference-keywords-local "blockcite")
# Line 105  Line 184 
184               '("enquote"               '("enquote"
185                 "foreignquote"                 "foreignquote"
186                 "hyphenquote"                 "hyphenquote"
187                   "cquote"
188                   "cquote*"
189                   "foreigncquote"
190                   "foreigncquote*"
191                   "hyphencquote"
192                   "hyphencquote*"
193                 "blockquote"                 "blockquote"
194                 "foreignblockquote"                 "foreignblockquote"
195                 "hyphenblockquote"))                 "hyphenblockquote"
196                   "blockcquote"
197                   "foreignblockcquote"
198                   "hyphenblockcquote"))
199       (font-latex-match-textual-make)       (font-latex-match-textual-make)
200       (mapcar (lambda (keyword)       (mapcar (lambda (keyword)
201                 (add-to-list 'font-latex-match-variable-keywords-local keyword))                 (add-to-list 'font-latex-match-variable-keywords-local keyword))
202               '("setquotestyle"               '("setquotestyle"
203                   "setquotestyle"
204                 "MakeOuterQuote"                 "MakeOuterQuote"
205                 "MakeInnerQuote"                 "MakeInnerQuote"
206                 "MakeAutoQuote"                 "MakeAutoQuote"
207                 "MakeForeignQuote"                 "MakeForeignQuote"
208                 "MakeHyphenQuote"                 "MakeHyphenQuote"
209                   "MakeBlockQuote"
210                   "MakeForeignBlockQuote"
211                   "MakeHyphenBlockQuote"
212                 "DeclareQuoteStyle"                 "DeclareQuoteStyle"
213                 "DeclareQuoteAlias"                 "DeclareQuoteAlias"
214                 "DeclareQuoteOption"                 "DeclareQuoteOption"
215                 "DeclarePlainStyle"))                 "DeclarePlainStyle"
216                   "SetBlockThreshold"
217                   "SetBlockEnvironment"
218                   "SetCiteCommand"))
219       (font-latex-match-variable-make)       (font-latex-match-variable-make)
220       ;; Tell font-lock about the update.       ;; Tell font-lock about the update.
221       (setq font-lock-set-defaults nil)       (setq font-lock-set-defaults nil)

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26