[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 78/299: Better management of package options.
From: |
Stefan Monnier |
Subject: |
[elpa] 78/299: Better management of package options. |
Date: |
Sun, 02 Nov 2014 03:10:27 +0000 |
monnier pushed a commit to branch externals/auctex
in repository elpa.
commit 15943e0c7436cfa7ff77859231c9c08af5dab2a7
Author: Mosè Giordano <address@hidden>
Date: Thu Apr 4 15:17:23 2013 +0200
Better management of package options.
* latex.el (LaTeX-provided-class-options): New buffer-local
variable. (LaTeX-provided-class-options-member): New
function. (LaTeX-provided-package-options): New
buffer-local variable.
(LaTeX-provided-package-options-member): New function
(LaTeX-auto-cleanup): Rewrite to support
`LaTeX-provided-{class,package}-options' variables.
(LaTeX-arg-usepackage): Ditto.
* tex.el (TeX-auto-store): Write to parsed file values of
`LaTeX-provided-{class,package}-options' variables.
(TeX-auto-insert): Fix indentation of inserted lines.
(TeX-search-files-by-type): Fix typo in doc-string.
(TeX-add-to-alist): New function.
(TeX-quote-language-alist): Fix typo in doc-string.
* style/babel.el (LaTeX-babel-package-options): Add missing
languages.
(LaTeX-babel-package-options): Add options other than
languages.
(LaTeX-babel-active-languages): Use
`LaTeX-provided-{class,package}-options'. Loop over actually
used options instead of all babel languages.
("babel"): Run styles of active languages.
* style/biblatex.el ("biblatex"): Use
`LaTeX-provided-package-options-member'.
(LaTeX-biblatex-package-options): Consider the `ask' value for
'TeX-arg-input-file-search'.
* style/kpfonts.el ("kpfonts"): Use
`LaTeX-provided-package-options-member'.
* style/siunitx.el: Rename `TeX-siunitx-*' functions to
`LaTeX-siunitx-*' for consistency.
("siunitx"): Use `LaTeX-provided-package-options-member'.
---
ChangeLog | 39 +++++++++++++++++++++++
latex.el | 89 +++++++++++++++++++++++++++++++++++++---------------
style/babel.el | 48 ++++++++++++++++++-----------
style/biblatex.el | 13 +++++---
style/kpfonts.el | 6 ++--
style/siunitx.el | 56 ++++++++++++++++----------------
tex.el | 45 +++++++++++++++++++++++---
7 files changed, 210 insertions(+), 86 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ca24cf5..3ab0320 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,42 @@
+2013-04-03 Mos� Giordano <address@hidden>
+
+ * latex.el (LaTeX-provided-class-options): New buffer-local
+ variable.
+ (LaTeX-provided-class-options-member): New function.
+ (LaTeX-provided-package-options): New buffer-local variable.
+ (LaTeX-provided-package-options-member): New function
+ (LaTeX-auto-cleanup): Rewrite to support
+ `LaTeX-provided-{class,package}-options' variables.
+ (LaTeX-arg-usepackage): Ditto.
+
+ * tex.el (TeX-auto-store): Write to parsed file values of
+ `LaTeX-provided-{class,package}-options' variables.
+ (TeX-auto-insert): Fix indentation of inserted lines.
+ (TeX-search-files-by-type): Fix typo in doc-string.
+ (TeX-add-to-alist): New function.
+ (TeX-quote-language-alist): Fix typo in doc-string.
+
+ * style/babel.el (LaTeX-babel-package-options): Add missing
+ languages.
+ (LaTeX-babel-package-options): Add options other than
+ languages.
+ (LaTeX-babel-active-languages): Use
+ `LaTeX-provided-{class,package}-options'. Loop over actually
+ used options instead of all babel languages.
+ ("babel"): Run styles of active languages.
+
+ * style/biblatex.el ("biblatex"): Use
+ `LaTeX-provided-package-options-member'.
+ (LaTeX-biblatex-package-options): Consider the `ask' value for
+ 'TeX-arg-input-file-search'.
+
+ * style/kpfonts.el ("kpfonts"): Use
+ `LaTeX-provided-package-options-member'.
+
+ * style/siunitx.el: Rename `TeX-siunitx-*' functions to
+ `LaTeX-siunitx-*' for consistency.
+ ("siunitx"): Use `LaTeX-provided-package-options-member'.
+
2013-03-29 Mos� Giordano <address@hidden>
* latex.el (TeX-arg-document): Search for LaTeX classes.
diff --git a/latex.el b/latex.el
index ada12d4..a37ff98 100644
--- a/latex.el
+++ b/latex.el
@@ -1322,6 +1322,39 @@ The input string may include LaTeX comments and
newlines."
(delete-backward-char 1)))))
opts))
+(defvar LaTeX-provided-class-options nil
+ "Alist of options provided to LaTeX classes.
+For each element, the CAR is the name of the class, the CDR is
+the list of options provided to it.
+
+E.g., its value will be
+ \(\(\"book\" \"a4paper\" \"11pt\" \"openany\" \"fleqn\"\)
+ ...\)
+See also `LaTeX-provided-package-options'.")
+(make-variable-buffer-local 'LaTeX-provided-class-options)
+
+(defun LaTeX-provided-class-options-member (class option)
+ "Return non-nil if OPTION has been given to CLASS at load time.
+The value is actually the tail of the list of options given to CLASS."
+ (member option (cdr (assoc package LaTeX-provided-class-options))))
+
+(defvar LaTeX-provided-package-options nil
+ "Alist of options provided to LaTeX packages.
+For each element, the CAR is the name of the package, the CDR is
+the list of options provided to it.
+
+E.g., its value will be
+ \(\(\"babel\" \"german\"\)
+ \(\"geometry\" \"a4paper\" \"top=2cm\" \"bottom=2cm\" \"left=2.5cm\"
\"right=2.5cm\"\)
+ ...\)
+See also `LaTeX-provided-class-options'.")
+(make-variable-buffer-local 'LaTeX-provided-package-options)
+
+(defun LaTeX-provided-package-options-member (package option)
+ "Return non-nil if OPTION has been given to PACKAGE at load time.
+The value is actually the tail of the list of options given to PACKAGE."
+ (member option (cdr (assoc package LaTeX-provided-package-options))))
+
(defun LaTeX-auto-cleanup ()
"Cleanup after LaTeX parsing."
@@ -1331,6 +1364,10 @@ The input string may include LaTeX comments and
newlines."
(TeX-split-string "," arg))
LaTeX-auto-bibliography)))
+ ;; Reset class and packages options for the current buffer
+ (setq LaTeX-provided-class-options nil)
+ (setq LaTeX-provided-package-options nil)
+
;; Cleanup document classes and packages
(unless (null LaTeX-auto-style)
(while LaTeX-auto-style
@@ -1345,18 +1382,18 @@ The input string may include LaTeX comments and
newlines."
;; Get the options.
(setq options (LaTeX-listify-package-options options))
- ;; Append them to the style list.
- (dolist (elt options)
- (add-to-list 'TeX-auto-file elt t))
-
- ;; Treat documentclass/documentstyle specially.
- (if (or (string-equal "package" class)
- (string-equal "Package" class))
- (dolist (elt (TeX-split-string
- "\\([ \t\r\n]\\|%[^\n\r]*[\n\r]\\|,\\)+" style))
- ;; Append style to the style list, so style files can check the
- ;; values of the options given on load time to packages.
- (add-to-list 'TeX-auto-file elt t))
+ ;; Treat documentclass/documentstyle specially.
+ (if (or (string-equal "package" class)
+ (string-equal "Package" class))
+ (dolist (elt (TeX-split-string
+ "\\([ \t\r\n]\\|%[^\n\r]*[\n\r]\\|,\\)+" style))
+ ;; Append style to the style list.
+ (add-to-list 'TeX-auto-file elt t)
+ ;; Append to `LaTeX-provided-package-options' the name of the
+ ;; package and the options provided to it at load time.
+ (unless (equal options '(""))
+ (TeX-add-to-alist 'LaTeX-provided-package-options
+ (list (cons elt options)))))
;; And a special "art10" style file combining style and size.
(add-to-list 'TeX-auto-file style t)
(add-to-list 'TeX-auto-file
@@ -1385,7 +1422,10 @@ The input string may include LaTeX comments and
newlines."
((member "12pt" options)
"12")
(t
- "10"))) t))
+ "10"))) t)
+ (unless (equal options '(""))
+ (TeX-add-to-alist 'LaTeX-provided-class-options
+ (list (cons style options)))))
;; The third argument if "class" indicates LaTeX2e features.
(cond ((equal class "class")
@@ -1770,11 +1810,11 @@ OPTIONAL and IGNORE are ignored."
"Insert arguments to usepackage.
OPTIONAL is ignored."
(let ((TeX-file-extensions '("sty"))
- (TeX-input-file-search t))
+ (TeX-arg-input-file-search (or TeX-arg-input-file-search 'ask)))
(TeX-arg-input-file nil "Package")
(save-excursion
(search-backward-regexp "{\\(.*\\)}")
- (let* ((package (match-string 1))
+ (let* ((package (TeX-match-buffer 1))
(var (intern (format "LaTeX-%s-package-options" package)))
(crm-separator ",")
(TeX-arg-opening-brace LaTeX-optop)
@@ -1793,17 +1833,14 @@ OPTIONAL is ignored."
","))))
(setq options (read-string "Options: ")))
(when options
- ;; XXX: The following statement will add the options
- ;; supplied to the LaTeX package to the style list. This is
- ;; consistent with the way the parser works (see
- ;; `LaTeX-auto-cleanup'). But in a revamped style system
- ;; such options should be associated with their LaTeX
- ;; package to avoid confusion. For example a `german' entry
- ;; in the style list can come from documentclass options and
- ;; does not necessarily mean that the babel-related
- ;; extensions should be activated.
- (mapc 'TeX-run-style-hooks (LaTeX-listify-package-options options))
- (TeX-argument-insert options t))))))
+ (let ((opts (LaTeX-listify-package-options options)))
+ (TeX-add-to-alist 'LaTeX-provided-package-options
+ (list (add-to-list 'opts package))))
+ (TeX-argument-insert options t)
+ ;; When `babel' package is loaded with options, load also language
+ ;; style files.
+ (when (string-equal package "babel")
+ (mapc 'TeX-run-style-hooks (LaTeX-babel-active-languages))))))))
(defcustom LaTeX-search-files-type-alist
'((texinputs "${TEXINPUTS.latex}" ("tex/generic/" "tex/latex/")
diff --git a/style/babel.el b/style/babel.el
index 3242d0e..cd97038 100755
--- a/style/babel.el
+++ b/style/babel.el
@@ -31,30 +31,39 @@
;;; Code:
(defvar LaTeX-babel-language-list
- '("acadian" "afrikaans" "american" "austrian""bahasa" "basque" "brazil"
- "brazilian" "breton" "british" "bulgarian" "canadian" "canadien"
- "catalan" "croatian" "czech" "danish" "dutch" "english" "esperanto"
- "estonian" "finnish" "francais" "frenchb" "french" "galician"
- "german" "germanb" "greek" "polutonikogreek" "hebrew" "hungarian"
- "icelandic" "irish" "italian" "latin" "lowersorbian" "magyar"
- "naustrian" "ngerman" "norsk" "samin" "nynorsk" "polish" "portuges"
- "portuguese" "romanian" "russian" "scottish" "serbian" "slovak"
- "slovene" "spanish" "swedish" "turkish" "ukrainian" "uppersorbian"
- "welsh" "UKenglish" "USenglish")
+ '("acadian" "albanian" "afrikaans" "american" "australian" "austrian"
"bahasa"
+ "indonesian" "indon" "bahasai" "malay" "meyalu" "bahasam" "basque" "brazil"
+ "brazilian" "breton" "british" "bulgarian" "canadian" "canadien" "catalan"
+ "croatian" "czech" "danish" "dutch" "english" "esperanto" "estonian"
"finnish"
+ "francais" "frenchb" "french" "galician" "german" "germanb" "greek"
+ "polutonikogreek" "hebrew" "hungarian" "icelandic" "interlingua" "irish"
+ "italian" "latin" "lowersorbian" "magyar" "naustrian" "newzealand"
"ngerman"
+ "norsk" "samin" "nynorsk" "polish" "portuges" "portuguese" "romanian"
+ "russian" "scottish" "serbian" "slovak" "slovene" "spanish" "swedish"
"turkish"
+ "ukrainian" "uppersorbian" "welsh" "UKenglish" "USenglish")
"List of languages supported by the babel LaTeX package.")
-(if (fboundp 'defvaralias)
- (defvaralias 'LaTeX-babel-package-options 'LaTeX-babel-language-list)
- (defvar LaTeX-babel-package-options LaTeX-babel-language-list
- "Package options for the babel package."))
+(defvar LaTeX-babel-package-options
+ (append LaTeX-babel-language-list '("activeacute" "activegrave"
+ "KeepShorthandsActive"))
+ "Package options for the babel package.")
(defun LaTeX-babel-active-languages ()
"Return a list of languages used in the document."
(let (active-languages)
- (dolist (elt LaTeX-babel-language-list)
- (when (member elt TeX-active-styles)
- (add-to-list 'active-languages (list elt))))
- active-languages))
+ ;; Loop over options provided to class and `babel' package at load time.
+ (dolist (elt (append
+ ;; In most cases there is only one element in the alist, if
+ ;; there is more than one element, the first one should
+ ;; contain the class options of the current buffer. So we can
+ ;; take the car of `LaTeX-provided-class-options'.
+ (cdr (car LaTeX-provided-class-options))
+ (cdr (assoc "babel" LaTeX-provided-package-options))))
+ (when (member elt LaTeX-babel-language-list)
+ ;; Append element to `active-languages' to respect loading order.
+ ;; `babel' package uses as default language the last loaded one.
+ (add-to-list 'active-languages elt t)))
+ active-languages))
(defun TeX-arg-babel-lang (optional &optional prompt)
"Prompt for a language with completion and insert it as an argument."
@@ -70,6 +79,9 @@
(TeX-add-style-hook
"babel"
(lambda ()
+ ;; Run style hooks for every active language in loading order, so
+ ;; `TeX-quote-language' will be correctly set.
+ (mapc 'TeX-run-style-hooks (LaTeX-babel-active-languages))
;; New symbols
(TeX-add-symbols
'("selectlanguage" TeX-arg-babel-lang)
diff --git a/style/biblatex.el b/style/biblatex.el
index 18fdd23..e66f70a 100644
--- a/style/biblatex.el
+++ b/style/biblatex.el
@@ -67,9 +67,9 @@ string."
(lambda ()
;; Biblatex uses as default backend biber, run it unless biblatex `backend'
;; option value is one of `bibtex', `bibtex8', `bibtexu'.
- (unless (or (member "backend=bibtex" TeX-active-styles)
- (member "backend=bibtex8" TeX-active-styles)
- (member "backend=bibtexu" TeX-active-styles))
+ (unless (or (LaTeX-provided-package-options-member "biblatex"
"backend=bibtex")
+ (LaTeX-provided-package-options-member "biblatex"
"backend=bibtex8")
+ (LaTeX-provided-package-options-member "biblatex"
"backend=bibtexu"))
(setq LaTeX-using-Biber t))
(TeX-run-style-hooks
@@ -187,13 +187,16 @@ string."
(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'.
+ (if (if (eq TeX-arg-input-file-search 'ask)
+ (not (y-or-n-p "Find BibLaTeX style yourself? "))
+ TeX-arg-input-file-search)
;; ...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.
+ ;; ...else, use for completion only standard BibLaTeX styles (see §3.3 of
+ ;; Biblatex reference manual).
(setq BibLaTeX-global-style-files
'("numeric" "numeric-comp" "numeric-verb" "alphabetic"
"alphabetic-verb" "authoryear" "authoryear-comp" "authoryear-ibid"
diff --git a/style/kpfonts.el b/style/kpfonts.el
index 673c8d3..a93ba36 100644
--- a/style/kpfonts.el
+++ b/style/kpfonts.el
@@ -531,9 +531,9 @@ following commands are defined:
(TeX-add-style-hook
"kpfonts"
(lambda ()
- (unless (member "notextcomp" TeX-active-styles)
- (TeX-run-style-hooks "full" "textcomp"))
- (unless (member "noamsmath" TeX-active-styles)
+ (unless (LaTeX-provided-package-options-member "kpfonts" "notextcomp")
+ (TeX-run-style-hooks "textcomp"))
+ (unless (LaTeX-provided-package-options-member "kpfonts" "noamsmath")
(TeX-run-style-hooks "amsmath"))
(TeX-add-symbols
;; Text fonts options
diff --git a/style/siunitx.el b/style/siunitx.el
index 80acc1b..c21f3ca 100644
--- a/style/siunitx.el
+++ b/style/siunitx.el
@@ -1,4 +1,4 @@
-;;; siunitx.el --- AUCTeX style for `siunitx.sty' version 2.5p.
+;;; siunitx.el --- AUCTeX style for `siunitx.sty' version 2.5q.
;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
@@ -25,7 +25,7 @@
;;; Commentary:
-;; This file adds support for `siunitx.sty' version 2.5p.
+;; This file adds support for `siunitx.sty' version 2.5q.
;;; Code:
@@ -57,7 +57,7 @@
(add-hook 'TeX-auto-prepare-hook 'LaTeX-siunitx-prepare)
(add-hook 'TeX-auto-cleanup-hook 'LaTeX-siunitx-cleanup)
-(defun TeX-arg-siunitx-unit (optional &optional prompt initial-input
definition)
+(defun LaTeX-arg-siunitx-unit (optional &optional prompt initial-input
definition)
"Prompt for siunitx units, prefixes, powers, and qualifiers.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
@@ -79,16 +79,16 @@ non-nil, add the chosen unit to the list of defined units."
(if (and definition (not (string-equal "" unit)))
(LaTeX-add-siunitx-units unit))
(TeX-argument-insert unit optional))
- ;; Restore <SPC> key bindings in minibuffer.
- (define-key minibuffer-local-completion-map " " space-completion)
- (define-key minibuffer-local-must-match-map " " space-must-match)))
+ ;; Restore <SPC> key bindings in minibuffer.
+ (define-key minibuffer-local-completion-map " " space-completion)
+ (define-key minibuffer-local-must-match-map " " space-must-match)))
-(defun TeX-arg-define-siunitx-unit (optional &optional prompt)
+(defun LaTeX-arg-define-siunitx-unit (optional &optional prompt)
"Prompt for a LaTeX siunitx unit, prefix, power, and qualifier.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one. Use PROMPT as the prompt
string."
- (TeX-arg-siunitx-unit optional prompt "\\" t))
+ (LaTeX-arg-siunitx-unit optional prompt "\\" t))
(defvar LaTeX-siunitx-package-options
'(;; Detecting fonts
@@ -266,26 +266,26 @@ string."
(TeX-auto-add-regexp `(,LaTeX-siunitx-regexp 1 LaTeX-auto-siunitx-unit))
(TeX-add-symbols
;; Numbers
- '("ang" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ] "Angle")
- '("num" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ] "Number")
- '("numlist" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ] "Numbers")
- '("numrange" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ] "Number
1" "Number 2")
+ '("ang" [TeX-arg-key-val LaTeX-siunitx-package-options] "Angle")
+ '("num" [TeX-arg-key-val LaTeX-siunitx-package-options] "Number")
+ '("numlist" [TeX-arg-key-val LaTeX-siunitx-package-options] "Numbers")
+ '("numrange" [TeX-arg-key-val LaTeX-siunitx-package-options] "Number 1"
"Number 2")
;; Units
- '("si" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ]
TeX-arg-siunitx-unit)
- '("SI" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ] "Value" [
"Pre-unit"] TeX-arg-siunitx-unit)
- '("SIlist" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ] "Values"
TeX-arg-siunitx-unit)
- '("SIrange" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ] "Value 1"
"Value 2" TeX-arg-siunitx-unit)
+ '("si" [TeX-arg-key-val LaTeX-siunitx-package-options]
LaTeX-arg-siunitx-unit)
+ '("SI" [TeX-arg-key-val LaTeX-siunitx-package-options] "Value" [
"Pre-unit"] LaTeX-arg-siunitx-unit)
+ '("SIlist" [TeX-arg-key-val LaTeX-siunitx-package-options] "Values"
LaTeX-arg-siunitx-unit)
+ '("SIrange" [TeX-arg-key-val LaTeX-siunitx-package-options] "Value 1"
"Value 2" LaTeX-arg-siunitx-unit)
;; Settings
'("sisetup" (TeX-arg-key-val LaTeX-siunitx-package-options))
;; Tabular material
- '("tablenum" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ] "Number")
+ '("tablenum" [TeX-arg-key-val LaTeX-siunitx-package-options] "Number")
;; Creating new macros (`DeclareSIUnitWithOptions' macro is deprecated)
- '("DeclareSIUnit" [ (TeX-arg-key-val LaTeX-siunitx-package-options) ]
(TeX-arg-define-siunitx-unit) "Symbol")
- '("DeclareSIPrefix" (TeX-arg-define-siunitx-unit "Prefix") "Symbol"
"Powers of 10")
- '("DeclareBinaryPrefix" (TeX-arg-define-siunitx-unit "Prefix") "Symbol"
"Powers of 2")
- '("DeclareSIPostPower" (TeX-arg-define-siunitx-unit "Name") "Power")
- '("DeclareSIPrePower" (TeX-arg-define-siunitx-unit "Name") "Power")
- '("DeclareSIQualifier" (TeX-arg-define-siunitx-unit "Qualifier") "Symbol")
+ '("DeclareSIUnit" [TeX-arg-key-val LaTeX-siunitx-package-options]
(LaTeX-arg-define-siunitx-unit) "Symbol")
+ '("DeclareSIPrefix" (LaTeX-arg-define-siunitx-unit "Prefix") "Symbol"
"Powers of 10")
+ '("DeclareBinaryPrefix" (LaTeX-arg-define-siunitx-unit "Prefix") "Symbol"
"Powers of 2")
+ '("DeclareSIPostPower" (LaTeX-arg-define-siunitx-unit "Name") "Power")
+ '("DeclareSIPrePower" (LaTeX-arg-define-siunitx-unit "Name") "Power")
+ '("DeclareSIQualifier" (LaTeX-arg-define-siunitx-unit "Qualifier")
"Symbol")
;; Highlighting
'("highlight" "Color")
;; Transferring settings to pgf
@@ -390,7 +390,7 @@ string."
"\\per"
"\\of")
;; Abbreviated units (available unless `abbreviations' option is set to
`false')
- (unless (member "abbreviations=false" TeX-active-styles)
+ (unless (LaTeX-provided-package-options-member "siunitx"
"abbreviations=false")
(LaTeX-add-siunitx-units
"\\fg"
"\\pg"
@@ -479,8 +479,8 @@ string."
"\\K"
"\\dB"))
;; Binary prefixes and units available when `binary-units' option is used
- (when (or (member "binary-units" TeX-active-styles)
- (member "binary-units=true" TeX-active-styles))
+ (when (or (LaTeX-provided-package-options-member "siunitx" "binary-units")
+ (LaTeX-provided-package-options-member "siunitx"
"binary-units=true"))
(LaTeX-add-siunitx-units
"\\kibi"
"\\mebi"
@@ -502,8 +502,8 @@ string."
"\\SIUnitSymbolMicro"
"\\SIUnitSymbolOhm")
;; Macros available when `version-1-compatibility' option is used
- (when (or (member "version-1-compatibility" TeX-active-styles)
- (member "version-1-compatibility=true" TeX-active-styles))
+ (when (or (LaTeX-provided-package-options-member "siunitx"
"version-1-compatibility")
+ (LaTeX-provided-package-options-member "siunitx"
"version-1-compatibility=true"))
(LaTeX-add-siunitx-units
"\\Square"
"\\ssquare"
diff --git a/tex.el b/tex.el
index e914572..6881509 100644
--- a/tex.el
+++ b/tex.el
@@ -3363,13 +3363,23 @@ If TEX is a directory, generate style files for all
files in the directory."
(TeX-auto-parse)
(if (member nil (mapcar 'TeX-auto-entry-clear-p TeX-auto-parser))
- (let ((style (TeX-strip-extension nil TeX-all-extensions t)))
+ (let ((style (TeX-strip-extension nil TeX-all-extensions t))
+ (class-opts (if (boundp 'LaTeX-provided-class-options)
+ LaTeX-provided-class-options))
+ (pkg-opts (if (boundp 'LaTeX-provided-package-options)
+ LaTeX-provided-package-options)))
(TeX-unload-style style)
(save-excursion
(set-buffer (generate-new-buffer file))
(erase-buffer)
(insert "(TeX-add-style-hook\n \""
style "\"\n (lambda ()")
+ (when class-opts
+ (insert "\n (TeX-add-to-alist 'LaTeX-provided-class-options\n"
+ " '" (prin1-to-string class-opts) ")"))
+ (when pkg-opts
+ (insert "\n (TeX-add-to-alist 'LaTeX-provided-package-options\n"
+ " '" (prin1-to-string pkg-opts) ")"))
(mapc (lambda (el) (TeX-auto-insert el style))
TeX-auto-parser)
(insert "))\n\n")
@@ -3392,13 +3402,13 @@ If SKIP is not-nil, don't insert code for SKIP."
(let ((name (symbol-name (nth TeX-auto-parser-add entry)))
(list (symbol-value (nth TeX-auto-parser-temporary entry))))
(unless (null list)
- (insert "\n (" name)
+ (insert "\n (" name)
(dolist (el list)
(cond ((and (stringp el) (not (string= el skip)))
- (insert "\n ")
+ (insert "\n ")
(insert (prin1-to-string el)))
((not (stringp el))
- (insert "\n ")
+ (insert "\n ")
(insert "'" (prin1-to-string el)))))
(insert ")"))))
@@ -3874,7 +3884,7 @@ example.")
(defun TeX-search-files-by-type (filetype &optional scope nodir strip)
"Return a list of files in TeX's search path with type FILETYPE.
FILETYPE is a symbol used to choose the search paths and
-extensions. See `TeX-search-file-type-alist' for supported
+extensions. See `TeX-search-files-type-alist' for supported
symbols.
The optional argument SCOPE sets the scope for the search.
@@ -4015,6 +4025,29 @@ mark which is sort of equivalent."
(defalias 'TeX-run-mode-hooks
(if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks))
+(defun TeX-add-to-alist (alist-var new-alist)
+ "Add NEW-ALIST to the ALIST-VAR.
+If an element with the same key as the key of an element of
+NEW-ALIST is already present in ALIST-VAR, add the new values to
+it; if a matching element is not already present, append the new
+element to ALIST-VAR."
+ ;; Loop over all elements of NEW-ALIST.
+ (while new-alist
+ (let* ((new-element (car new-alist))
+ ;; Get the element of ALIST-VAR with the same key of the current
+ ;; element of NEW-ALIST, if any.
+ (old-element (assoc (car new-element) (symbol-value alist-var))))
+ (if old-element
+ (progn
+ (set alist-var (delete old-element (symbol-value alist-var)))
+ ;; Append to `old-element' the values of the current element of
+ ;; NEW-ALIST.
+ (mapc (lambda (elt) (add-to-list 'old-element elt t))
+ (cdr new-element))
+ (set alist-var (add-to-list alist-var old-element t)))
+ (add-to-list alist-var new-element t)))
+ ;; Next element of NEW-ALIST.
+ (setq new-alist (cdr new-alist))))
;;; Syntax Table
@@ -5264,7 +5297,7 @@ quotes are inserted only after \"."
"Alist for overriding the default language-specific quote insertion.
First element in each item is the name of the language as set by
the language style file as a string. Second element is the
-opening quotation mark. Third elemxent is the closing quotation
+opening quotation mark. Third element is the closing quotation
mark. Opening and closing quotation marks can be specified
directly as strings or as functions returning a string. Fourth
element is a boolean specifying insertion behavior, overriding
- [elpa] 74/299: * style/biblatex.el (LaTeX-biblatex-addbibresource-options): New variable. (LaTeX-arg-addbibresource): New function, based on current `TeX-arg-bibliography'. ("biblatex"): Add `addbibresource' macro. (LaTeX-biblatex-package-options): Use `TeX-read-key-val'. * latex.el (TeX-arg-bibliography): Remove `addbibresource' support., (continued)
- [elpa] 74/299: * style/biblatex.el (LaTeX-biblatex-addbibresource-options): New variable. (LaTeX-arg-addbibresource): New function, based on current `TeX-arg-bibliography'. ("biblatex"): Add `addbibresource' macro. (LaTeX-biblatex-package-options): Use `TeX-read-key-val'. * latex.el (TeX-arg-bibliography): Remove `addbibresource' support., Stefan Monnier, 2014/11/01
- [elpa] 77/299: * latex.el (TeX-arg-document): Search for LaTeX classes., Stefan Monnier, 2014/11/01
- [elpa] 80/299: Fix for conversion to git., Stefan Monnier, 2014/11/01
- [elpa] 79/299: Minor fix for the latest commit., Stefan Monnier, 2014/11/01
- [elpa] 81/299: Add .gitignore file., Stefan Monnier, 2014/11/01
- [elpa] 85/299: Minor docfix., Stefan Monnier, 2014/11/01
- [elpa] 83/299: provide completion for options in `TeX-arg-document', Stefan Monnier, 2014/11/01
- [elpa] 84/299: improve completion in LaTeX-arg-usepackage, Stefan Monnier, 2014/11/01
- [elpa] 82/299: Delete CVS Id keywords from lisp files., Stefan Monnier, 2014/11/01
- [elpa] 87/299: Support darwin., Stefan Monnier, 2014/11/01
- [elpa] 78/299: Better management of package options.,
Stefan Monnier <=
- [elpa] 90/299: Update README for Git., Stefan Monnier, 2014/11/01
- [elpa] 91/299: Fix typo., Stefan Monnier, 2014/11/01
- [elpa] 92/299: Syntax fix., Stefan Monnier, 2014/11/01
- [elpa] 93/299: Fix bug in TeX-evince-sync-view., Stefan Monnier, 2014/11/01
- [elpa] 86/299: Make LaTeX-outline-level work for customized outline-regexp., Stefan Monnier, 2014/11/01
- [elpa] 88/299: Improve TeX-math-input-method-off-regexp., Stefan Monnier, 2014/11/01
- [elpa] 89/299: Fix a bug in font-latex-add-to-syntax-alist., Stefan Monnier, 2014/11/01
- [elpa] 97/299: Replace completing-read-multiple with TeX-completing-read-multiple., Stefan Monnier, 2014/11/01
- [elpa] 98/299: Use crm-separator as separator in XEmacs TeX-completing-read-multiple., Stefan Monnier, 2014/11/01
- [elpa] 99/299: Add prompt argument to TeX-read-key-val and TeX-arg-key-val., Stefan Monnier, 2014/11/01