emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] 58/299: * style/biblatex.el ("biblatex"): Add hooks for loaded pa


From: Stefan Monnier
Subject: [elpa] 58/299: * style/biblatex.el ("biblatex"): Add hooks for loaded packages. (LaTeX-biblatex-package-options): New function. (LaTeX-biblatex-package-options-list): Renamed from `LaTeX-biblatex-package-options' to avoid clash with the function with the same name.
Date: Sun, 02 Nov 2014 03:10:17 +0000

monnier pushed a commit to branch externals/auctex
in repository elpa.

commit 9e64e4f2bf393333fce921c1f99d9ab17a7d1a9d
Author: Tassilo Horn <address@hidden>
Date:   Mon Feb 18 10:57:49 2013 +0000

    * style/biblatex.el ("biblatex"): Add hooks for loaded packages.
    (LaTeX-biblatex-package-options): New function.
    (LaTeX-biblatex-package-options-list): Renamed from
    `LaTeX-biblatex-package-options' to avoid clash with the function
    with the same name.
    
    * latex.el (LaTeX-search-files-type-alist): Add `bbxinputs'.
    (BibLaTeX-global-style-files): New variable.
    
    * tex.el (BibLaTeX-style-extensions): New variable.
    (TeX-normal-mode): Make ARG argument optional.
    (TeX-normal-mode): Reset `BibLaTeX-global-style-files' when ARG is
    non-nil.
---
 ChangeLog         |   16 ++++++
 latex.el          |    7 +++
 style/biblatex.el |  140 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 tex.el            |    9 +++-
 4 files changed, 165 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f13e6da..1cd198c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2013-02-16  Mos� Giordano  <address@hidden>
+
+       * style/biblatex.el ("biblatex"): Add hooks for loaded packages.
+       (LaTeX-biblatex-package-options): New function.
+       (LaTeX-biblatex-package-options-list): Renamed from
+       `LaTeX-biblatex-package-options' to avoid clash with the function
+       with the same name.
+
+       * latex.el (LaTeX-search-files-type-alist): Add `bbxinputs'.
+       (BibLaTeX-global-style-files): New variable.
+
+       * tex.el (BibLaTeX-style-extensions): New variable.
+       (TeX-normal-mode): Make ARG argument optional.
+       (TeX-normal-mode): Reset `BibLaTeX-global-style-files' when ARG is
+       non-nil.
+
 2013-02-14  Mos� Giordano  <address@hidden>
 
        * style/siunitx.el (LaTeX-siunitx-package-options): New function.
diff --git a/latex.el b/latex.el
index 17ce77a..8321193 100644
--- a/latex.el
+++ b/latex.el
@@ -1804,6 +1804,7 @@ OPTIONAL is ignored."
     (graphics "${TEXINPUTS}" ("tex/") LaTeX-includegraphics-extensions)
     (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-file-extensions)
     (bstinputs "${BSTINPUTS}" ("bibtex/bst/") BibTeX-style-extensions)
+    (bbxinputs "" ("tex/latex/") BibLaTeX-style-extensions)
     (biberinputs "${BIBINPUTS}" ("bibtex/bib/") TeX-Biber-file-extensions))
   "Alist of filetypes with locations and file extensions.
 Each element of the alist consists of a symbol expressing the
@@ -1885,6 +1886,12 @@ files."
 Initialized once at the first time you prompt for an input file.
 May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.")
 
+(defvar BibLaTeX-global-style-files nil
+  "Association list of BibLaTeX style files.
+
+Initialized once at the first time you prompt for a BibLaTeX
+style.  May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.")
+
 (defun TeX-arg-bibstyle (optional &optional prompt)
   "Prompt for a BibTeX style file.
 If OPTIONAL is non-nil, insert the resulting value as an optional
diff --git a/style/biblatex.el b/style/biblatex.el
index 5a4c005..cb5c138 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -1,4 +1,4 @@
-;;; biblatex.el --- AUCTeX style for `biblatex.sty'
+;;; biblatex.el --- AUCTeX style for `biblatex.sty' version 2.5.
 
 ;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
 
@@ -26,7 +26,7 @@
 
 ;;; Commentary:
 
-;; This file adds support for `biblatex.sty'.
+;; This file adds support for `biblatex.sty' version 2.5.
 
 ;;; Code:
 
@@ -38,10 +38,140 @@
    (unless (or (member "backend=bibtex" TeX-active-styles)
               (member "backend=bibtex8" TeX-active-styles)
               (member "backend=bibtexu" TeX-active-styles))
-     (setq LaTeX-using-Biber t))))
+     (setq LaTeX-using-Biber t))
 
-;; TODO: Add package options.
-(defvar LaTeX-biblatex-package-options nil
+   (TeX-run-style-hooks
+    "etoolbox"
+    "keyval"
+    "kvoptions"
+    "logreq"
+    "ifthen"
+    "url")))
+
+(defvar LaTeX-biblatex-package-options-list
+  '(;;; Load-time Options
+    ("backend" ("biber" "bibtex" "bibtexu" "bibtex8"))
+    ("style" BibLaTeX-global-style-files)
+    ("bibstyle" BibLaTeX-global-style-files)
+    ("citestyle" BibLaTeX-global-style-files)
+    ("natbib" ("true" "false"))
+    ("mcite" ("true" "false"))
+    ;;; Preamble Options
+    ;; General
+    ("sorting" ("nty" "nyt" "nyvt" "anyt" "anyvt" "ynt" "ydnt" "none" "debug"))
+    ("sortcase" ("true" "false"))
+    ("sortupper" ("true" "false"))
+    ("sortlocale")
+    ("sortlos" ("bib" "los"))
+    ("related" ("true" "false"))
+    ("sortcites" ("true" "false"))
+    ("maxnames")
+    ("minnames")
+    ("maxbibnames")
+    ("minbibnames")
+    ("maxcitenames")
+    ("mincitenames")
+    ("maxitems")
+    ("minitems")
+    ("autocite" ("plain" "inline" "footnote" "superscript"))
+    ("autopunct" ("true" "false"))
+    ("language" ("auto" "catalan" "czech" "danish" "dutch" "american" "british"
+                "canadian" "australian" "newzealand" "finnish" "french"
+                "german" "austrian" "ngernam" "naustrian" "greek" "italian"
+                "norwegian" "brazilian" "portuguese" "russian" "spanish"
+                "swedish"))
+    ("clearlang" ("true" "false"))
+    ("babel" ("none" "hyphen" "other" "other*"))
+    ("block" ("none" "space" "par" "nbpar" "ragged"))
+    ("notetype" ("foot+end" "footonly" "endonly"))
+    ("hyperref" ("true" "false"))
+    ("backref" ("true" "false"))
+    ("backrefstyle" ("none" "three" "two" "two+" "three+" "all+"))
+    ("backrefsetstyle" ("setonly" "memonly" "setormem" "setandmem" "memandset" 
"setplusmem"))
+    ("indexing" ("true" "false" "cite" "bib"))
+    ("loadfiles" ("true" "false"))
+    ("refsection" ("none" "part" "chapter" "section" "subsection"))
+    ("refsegment" ("none" "part" "chapter" "section" "subsection"))
+    ("citereset" ("none" "part" "chapter" "section" "subsection"))
+    ("abbreviate" ("true" "false"))
+    ("date" ("short" "long" "terse" "comp" "iso8601"))
+    ("origdate" ("short" "long" "terse" "comp" "iso8601"))
+    ("eventdate" ("short" "long" "terse" "comp" "iso8601"))
+    ("urldate" ("short" "long" "terse" "comp" "iso8601"))
+    ("alldates" ("short" "long" "terse" "comp" "iso8601"))
+    ("datezeros" ("true" "false"))
+    ("dateabbrev" ("true" "false"))
+    ("defernumbers" ("true" "false"))
+    ("punctfont" ("true" "false"))
+    ("arxiv" ("abs" "ps" "pdf" "format"))
+    ("texencoding" ("auto"))
+    ("bibencoding" ("auto"))
+    ("safeinputenc" ("true" "false"))
+    ("bibwarn" ("true" "false"))
+    ("mincrossrefs")
+    ;; Style-specific
+    ("isbn" ("true" "false"))
+    ("url" ("true" "false"))
+    ("doi" ("true" "false"))
+    ("eprint" ("true" "false"))
+    ;; Internal
+    ("pagetracker" ("true" "false" "page" "spread"))
+    ("citecounter" ("true" "false" "context"))
+    ("citetracker" ("true" "false" "context" "strict" "constrict"))
+    ("ibidtracker" ("true" "false" "context" "strict" "constrict"))
+    ("opcittracker" ("true" "false" "context" "strict" "constrict"))
+    ("loccittracker" ("true" "false" "context" "strict" "constrict"))
+    ("idemtracker" ("true" "false" "context" "strict" "constrict"))
+    ("parentracker" ("true" "false"))
+    ("maxparens")
+    ("firstinits" ("true" "false"))
+    ("sortfirstinits" ("true" "false"))
+    ("tersefirstinits" ("true" "false"))
+    ("labelalpha" ("true" "false"))
+    ("maxalphanames")
+    ("minalphanames")
+    ("labelnum" ("true" "false"))
+    ("labeltitle" ("true" "false"))
+    ("labeltitleyear" ("true" "false"))
+    ("labelyear" ("true" "false"))
+    ("singletitle" ("true" "false"))
+    ("uniquename" ("true" "false" "init" "full" "allinit" "allfull" "mininit" 
"minfull"))
+    ("uniquelist" ("true" "false" "minyear"))
+    ;;; Entry Options
+    ;; Preamble/Type/Entry Options
+    ("useauthor" ("true" "false"))
+    ("useeditor" ("true" "false"))
+    ("usetranslator" ("true" "false"))
+    ("useprefix" ("true" "false"))
+    ("indexing" ("true" "false" "cite" "bib"))
+    ;; Type/Entry Options are not available globally.
+    ;; Legacy Options (deprecated)
+    ("openbib"))
   "Package options for the biblatex package.")
 
+(defun LaTeX-biblatex-package-options nil
+  "Prompt for package options for the biblatex package."
+  (unless BibLaTeX-global-style-files
+    (if (eq TeX-arg-input-file-search t)  ;; Treat `ask' value as `nil'.
+       ;; ...then, search for BibLaTeX styles.
+       (progn
+         (message "Searching for BibLaTeX styles...")
+         (setq BibLaTeX-global-style-files
+               (mapcar 'identity (TeX-search-files-by-type 'bbxinputs 'global 
t t))))
+      ;; ...else, use default BibLaTeX styles.
+      (setq BibLaTeX-global-style-files
+           '("numeric" "numeric-comp" "numeric-verb" "alphabetic"
+             "alphabetic-verb" "authoryear" "authoryear-comp" "authoryear-ibid"
+             "authoryear-icomp" "authortitle" "authortitle-comp"
+             "authortitle-ibid" "authortitle-icomp" "authortitle-terse"
+             "authortitle-tcomp" "authortitle-ticomp" "verbose" "verbose-ibid"
+             "verbose-note" "verbose-inote" "verbose-trad1" "verbose-trad2"
+             "verbose-trad3" "reading" "draft" "debug"))))
+  ;; Can't use directly `TeX-arg-key-val' because that would insert an empty
+  ;; `[]' after `\usepackage' when `options' is empty.
+  (let ((options (multi-prompt-key-value
+                 (TeX-argument-prompt optional "Options (k=v)" nil)
+                 LaTeX-biblatex-package-options-list)))
+    options))
+
 ;;; biblatex.el ends here
diff --git a/tex.el b/tex.el
index 4660f47..2ac5e3e 100644
--- a/tex.el
+++ b/tex.el
@@ -3656,6 +3656,11 @@ Access to the value should be through the function 
`TeX-output-extension'.")
   :group 'TeX-file-extension
   :type '(repeat (string :format "%v")))
 
+(defcustom BibLaTeX-style-extensions '("bbx")
+  "Valid file extensions for BibLaTeX styles."
+  :group 'TeX-file-extension
+  :type '(repeat (string :format "%v")))
+
 (defcustom BibTeX-style-extensions '("bst")
   "Valid file extensions for BibTeX styles."
   :group 'TeX-file-extension
@@ -5191,16 +5196,16 @@ sign.  With optional ARG, insert that many dollar 
signs."
 
 ;;; Simple Commands
 
-(defun TeX-normal-mode (arg)
+(defun TeX-normal-mode (&optional arg)
   "Remove all information about this buffer, and apply the style hooks again.
 Save buffer first including style information.
 With optional argument ARG, also reload the style hooks."
-  ;; FIXME: Shouldn't it be (&optional arg)?  -- rs
   (interactive "*P")
   (if arg
       (setq TeX-style-hook-list nil
            BibTeX-global-style-files nil
            BibTeX-global-files nil
+           BibLaTeX-global-style-files nil
            TeX-Biber-global-files nil
            TeX-global-input-files nil))
   (let ((TeX-auto-save t))



reply via email to

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