auctex-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AUCTeX-diffs] Changes to auctex/style/csquotes.el


From: Ralf Angeli
Subject: [AUCTeX-diffs] Changes to auctex/style/csquotes.el
Date: Thu, 21 Jul 2005 07:08:25 -0400

Index: auctex/style/csquotes.el
diff -u auctex/style/csquotes.el:1.7 auctex/style/csquotes.el:1.8
--- auctex/style/csquotes.el:1.7        Sun Jun  5 11:53:41 2005
+++ auctex/style/csquotes.el    Thu Jul 21 11:08:24 2005
@@ -26,10 +26,44 @@
 
 ;;; Commentary:
 
-;; This file adds support for `csquotes.sty'.
+;; This file adds support for `csquotes.sty', version 3.0.
+
 
 ;;; Code:
 
+;; FIXME: It would be nice to be able to dump this function in favor
+;; of a generalized handling of additional arguments for environments
+;; specified via `LaTeX-add-environments'.  `TeX-parse-arguments' and
+;; friends would be the functions to be used for that, but those
+;; functions currently insert text directly into the buffer.  There
+;; would either have to be a way of preventing this and letting them
+;; return a string, or the insertion could happen in a temporary buffer
+;; and the buffer content be returned.
+(defun LaTeX-csquotes-insert-environment (env &rest args)
+  "Insert environment ENV considering optional arguments ARGS.
+
+This is basically a variant of `LaTeX-environment-menu'
+specialized for csquotes.el.  ARGS can be made up of strings and
+vectors containing single strings.  Plain strings will be used as
+prompts for mandatory arguments and strings in vectors as prompts
+for optional arguments of the environment to be inserted.
+
+That means, in contrast to `LaTeX-environment-menu' it supports
+the insertion of optional arguments."
+  (let (env-extra prompt optional user-input)
+    (dolist (elt args)
+      (if (vectorp elt)
+         (setq prompt (aref elt 0)
+               optional t)
+       (setq optional nil))
+      (setq user-input (read-string (TeX-argument-prompt optional prompt nil)))
+      (unless (and optional (zerop (length user-input)))
+       (setq env-extra (concat env-extra
+                               (if optional LaTeX-optop TeX-grop)
+                               user-input
+                               (if optional LaTeX-optcl TeX-grcl)))))
+    (LaTeX-insert-environment env env-extra)))
+
 (TeX-add-style-hook
  "csquotes"
  (lambda ()
@@ -47,14 +81,15 @@
       '("foreignquote*" 2)
       '("hyphenquote" 2)
       '("hyphenquote*" 2)
-      '("blockquote" ["Line threshold"] 2)
-      '("foreignblockquote" t ["Line threshold"] nil nil)
-      '("hyphenblockquote" t ["Line threshold"] nil nil)
+      '("blockquote" ["Citation"] ["Punctuation"] t)
+      '("foreignblockquote" t ["Citation"] ["Punctuation"] nil)
+      '("hyphenblockquote" t ["Citation"] ["Punctuation"] nil)
       `("setquotestyle"
        [ (TeX-arg-eval completing-read "Quote style variant: "
                        ',quote-style-variant-list) ]
        (TeX-arg-eval completing-read "Quote style name or alias: "
                      ',quote-style-name-list))
+      "setquotestyle*"
       '("MakeInnerQuote" "Character")
       '("MakeOuterQuote" "Character")
       '("MakeAutoQuote" "Opening quotation mark" "Closing quotation mark")
@@ -62,7 +97,25 @@
        "Opening quotation mark" "Closing quotation mark")
       '("MakeHyphenQuote" "Babel's language name"
        "Opening quotation mark" "Closing quotation mark")
+      '("MakeBlockQuote" "Opening quotation mark" "Delimiter for citation"
+       "Closing quotation mark")
+      '("MakeForeignBlockQuote" "Language" "Opening quotation mark"
+       "Delimiter for citation" "Closing quotation mark")
+      '("MakeHyphenBlockQuote" "Language" "Opening quotation mark"
+       "Delimiter for citation" "Closing quotation mark")
+      "DisableQuotes"
       "RestoreQuotes"
+      '("cquote" ["Pre-note"] ["Post-note"] "Key" t)
+      '("cquote*" ["Pre-note"] ["Post-note"] "Key" t)
+      '("foreigncquote" "Language" ["Pre-note"] ["Post-note"] "Key" t)
+      '("foreigncquote*" "Language" ["Pre-note"] ["Post-note"] "Key" t)
+      '("hyphencquote" "Language" ["Pre-note"] ["Post-note"] "Key" t)
+      '("hyphencquote*" "Language" ["Pre-note"] ["Post-note"] "Key" t)
+      '("blockcquote" ["Pre-note"] ["Post-note"] "Key" ["Punctuation"] t)
+      '("foreignblockcquote" "Language" ["Pre-note"] ["Post-note"] "Key"
+       ["Punctuation"] t)
+      '("hyphenblockcquote" "Language" ["Pre-note"] ["Post-note"] "Key"
+       ["Punctuation"] t)
       `("DeclareQuoteStyle"
        [ (TeX-arg-eval completing-read "Quote style variant: "
                        ',quote-style-variant-list) ]
@@ -80,13 +133,38 @@
                      ',quote-style-name-list)
        "Alias name")
     '("DeclareQuoteOption" 1)
-    '("DeclarePlainStyle" "Outer quotation mark" "Inner quotation mark")
-    '("setblockthreshold" "Number of lines")
-    '("setblockenvironment" "Environment")
-    '("blockcite" 1))
+    '("DeclarePlainStyle" "Opening outer quotation mark"
+      "Closing outer quotation mark" "Opening inner quotation mark"
+      "Closing inner quotation mark")
+    '("SetBlockThreshold" "Number of lines")
+    '("SetBlockEnvironment" "Environment")
+    '("SetCiteCommand" "Command")
+    "mkcitation"
+    "mkccitation"
+    "mkmidblockpunct"
+    "mkfinblockpunct"
+    '("ifblockquote" 2)
+    '("ifquotepunct" 2)
+    '("ifquoteterm" 2)
+    '("ifquoteperiod" 2)
+    '("ifquotecomma" 2)
+    '("ifquotesemicolon" 2)
+    '("ifquotecolon" 2)
+    '("ifquoteexclam" 2)
+    '("ifquotequestion" 2)
+    '("ifstringblank" 2))
    ;; New environments
    (LaTeX-add-environments
-    "quoteblock")
+    "quoteblock"
+    '("displayquote" "Citation")
+    '("foreigndisplayquote" "Language" "Citation")
+    '("hyphendisplayquote" "Language" "Citation")
+    '("displaycquote" LaTeX-csquotes-insert-environment
+      ["Pre-note"] ["Post-note"] "Key")
+    '("foreigndisplaycquote" LaTeX-csquotes-insert-environment
+      "Language" ["Pre-note"] ["Post-note"] "Key")
+    '("hyphendisplaycquote" LaTeX-csquotes-insert-environment
+      "Language" ["Pre-note"] ["Post-note"] "Key"))
    ;; Quotation marks
    (when (and (> (length LaTeX-csquotes-open-quote) 0)
              (> (length LaTeX-csquotes-close-quote) 0))
@@ -96,6 +174,7 @@
    ;; Fontification
    (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
+     (add-to-list 'font-latex-match-function-keywords-local "DisableQuotes")
      (add-to-list 'font-latex-match-function-keywords-local "RestoreQuotes")
      (font-latex-match-function-make)
      (add-to-list 'font-latex-match-reference-keywords-local "blockcite")
@@ -105,22 +184,38 @@
             '("enquote"
               "foreignquote"
               "hyphenquote"
+              "cquote"
+              "cquote*"
+              "foreigncquote"
+              "foreigncquote*"
+              "hyphencquote"
+              "hyphencquote*"
               "blockquote"
               "foreignblockquote"
-              "hyphenblockquote"))
+              "hyphenblockquote"
+              "blockcquote"
+              "foreignblockcquote"
+              "hyphenblockcquote"))
      (font-latex-match-textual-make)
      (mapcar (lambda (keyword)
               (add-to-list 'font-latex-match-variable-keywords-local keyword))
             '("setquotestyle"
+              "setquotestyle"
               "MakeOuterQuote"
               "MakeInnerQuote"
               "MakeAutoQuote"
               "MakeForeignQuote"
               "MakeHyphenQuote"
+              "MakeBlockQuote"
+              "MakeForeignBlockQuote"
+              "MakeHyphenBlockQuote"
               "DeclareQuoteStyle"
               "DeclareQuoteAlias"
               "DeclareQuoteOption"
-              "DeclarePlainStyle"))
+              "DeclarePlainStyle"
+              "SetBlockThreshold"
+              "SetBlockEnvironment"
+              "SetCiteCommand"))
      (font-latex-match-variable-make)
      ;; Tell font-lock about the update.
      (setq font-lock-set-defaults nil)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]