[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX-diffs] Changes to auctex/latex.el,v
From: |
Ralf Angeli |
Subject: |
[AUCTeX-diffs] Changes to auctex/latex.el,v |
Date: |
Wed, 14 Nov 2012 17:57:15 +0000 |
CVSROOT: /cvsroot/auctex
Module name: auctex
Changes by: Ralf Angeli <angeli> 12/11/14 17:57:14
Index: latex.el
===================================================================
RCS file: /cvsroot/auctex/auctex/latex.el,v
retrieving revision 5.471
retrieving revision 5.472
diff -u -b -r5.471 -r5.472
--- latex.el 13 Sep 2012 10:14:18 -0000 5.471
+++ latex.el 14 Nov 2012 17:57:13 -0000 5.472
@@ -1216,22 +1216,13 @@
("\\\\addbibresource\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r\.]+\\)\\..+}"
1 LaTeX-auto-bibliography)
("\\\\add\\(?:global\\|section\\)bib\\(?:\\[[^]]+\\]\\)?{\\([^#}\\\\\n\r\.]+\\)\\(?:\\..+\\)?}"
1 LaTeX-auto-bibliography)
("\\\\newrefsection\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)
- ("\\\\begin{refsection}\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)
- ("backend=\\(biber\\)" 1 LaTeX-biber)
-
("\\\\ExecuteBibliographyOptions\\(?:\\[[^]]+\\]\\)?{.*?backend=\\(biber\\)}" 1
LaTeX-using-Biber)))
+ ("\\\\begin{refsection}\\[\\([^]]+\\)\\]" 1 LaTeX-split-bibs)))
LaTeX-auto-class-regexp-list
LaTeX-auto-label-regexp-list
LaTeX-auto-index-regexp-list
LaTeX-auto-minimal-regexp-list)
"List of regular expression matching common LaTeX macro definitions.")
-;; Either the user has set a global use biber flag or we detect it from the
file
-(defun LaTeX-biber (match)
- (if (or LaTeX-always-use-Biber
- (string= "biber" (TeX-match-buffer match)))
- (setq LaTeX-using-Biber t)
- (setq LaTeX-using-Biber nil)))
-
(defun LaTeX-split-bibs (match)
(let ((bibs (TeX-split-string " *, *" (TeX-match-buffer match))))
(dolist (bib bibs)
@@ -1256,17 +1247,41 @@
(defun LaTeX-listify-package-options (options)
"Return a list from a comma-separated string of package OPTIONS.
The input string may include LaTeX comments and newlines."
- ;; FIXME: Parse key=value options like "pdftitle={A Perfect
- ;; Day},colorlinks=false" correctly. When this works, the check for
- ;; "=" can be removed again.
- (let (opts)
- (dolist (elt (TeX-split-string "\\(,\\|%[^\n\r]*[\n\r]\\)+"
- options))
- (unless (string-match "=" elt)
- ;; Strip whitespace.
- (dolist (item (TeX-split-string "[ \t\r\n]+" elt))
- (unless (string= item "")
- (add-to-list 'opts item)))))
+ ;; We jump through all those hoops and don't just use `split-string'
+ ;; or the like in order to be able to deal with key=value package
+ ;; options which can look like this: "pdftitle={A Perfect Day},
+ ;; colorlinks=false"
+ (let (opts match start)
+ (with-temp-buffer
+ (set-syntax-table LaTeX-mode-syntax-table)
+ (insert options)
+ (newline) ; So that the last entry can be found.
+ (goto-char (point-min))
+ (setq start (point))
+ (while (re-search-forward "[{ ,%\n\r]" nil t)
+ (setq match (match-string 0))
+ (cond
+ ;; Step over groups. (Let's hope nobody uses escaped braces.)
+ ((string= match "{")
+ (up-list))
+ ;; Get rid of whitespace.
+ ((string= match " ")
+ (delete-region (1- (point))
+ (save-excursion
+ (skip-chars-forward " ")
+ (point))))
+ ;; Add entry to output.
+ ((or (string= match ",") (= (point) (point-max)))
+ (add-to-list 'opts (buffer-substring-no-properties
+ start (1- (point))) t)
+ (setq start (point)))
+ ;; Get rid of comments.
+ ((string= match "%")
+ (delete-region (1- (point))
+ (line-beginning-position 2)))
+ ;; Get rid of newlines.
+ ((or (string= match "\n") (string= match "\r"))
+ (delete-backward-char 1)))))
opts))
(defun LaTeX-auto-cleanup ()
@@ -1409,10 +1424,10 @@
(setq LaTeX-environment-modify-menu nil))
;;; Biber support
-;;; Need a variable to say if we're using biber - certain things need
consitionalising on this
-(defvar LaTeX-using-Biber nil "Used to track whether we detected Biber in use")
-(defvar LaTeX-always-use-Biber nil "Global override for biber usage")
+(defvar LaTeX-using-Biber nil
+ "Used to track whether Biber is in use.")
+(make-variable-buffer-local 'LaTeX-using-Biber)
;;; BibTeX
- [AUCTeX-diffs] Changes to auctex/latex.el,v,
Ralf Angeli <=