[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] First try at the Biber support merge
From: |
Tassilo Horn |
Subject: |
[AUCTeX] First try at the Biber support merge |
Date: |
Thu, 19 Jul 2012 19:42:25 +0200 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux) |
Hi all,
I've just done my first try at merging Philips Biber support changes,
simply by ediffing his files agains the current CVS trunk and merging
everything that looked Biber-related. I might have missed something,
and maybe I even destroyed existing functionality, but I tried to be as
conservative as possible.
At least, it seems that I don't have broken the RefTeX support. And
even better, now I also have completion at the citation prompt! :-)
So Biber users, could you please try applying the attached patch against
AUCTeX from CVS and check if the Biber stuff also works as expected?
Bye,
Tassilo
Index: font-latex.el
===================================================================
RCS file: /sources/auctex/auctex/font-latex.el,v
retrieving revision 5.194
diff -r5.194 font-latex.el
293a294,321
> ("biblatexnoarg"
> ("newrefsegment" "mancite" "pno" "ppno" "nopp" "psq" "psqq")
> 'font-lock-variable-name-face 2 noarg)
> ("biblatex"
> (("newrefsection" "[") ("ExecuteBibliographyOptions" "[{")
> ("printbibliography" "[") ("printshorthands" "[") ("printbibheading"
> "[")
> ("addbibresource" "[{") ("addglobalbib" "[{") ("addsectionbib" "[{")
> ("bibbysection" "[") ("bibbysegment" "[") ("bibbycategory" "[")
> ("DeclareBibliographyCategory" "{") ("addtocategory" "{{")
> ("defbibenvironment" "{{{{")
> ("defbibheading" "{[{") ("defbibnote" "{{") ("defbibfilter" "{{")
> ("defbibcheck" "{{")
> ("defbibentryset" "{{") ("Cite" "[[{") ("parencite" "*[[{")
> ("Parencite" "[[{")
> ("footcite" "[[{") ("footcitetext" "[[{") ("textcite" "[[{")
> ("Textcite" "[[{")
> ("smartcite" "[[{") ("Smartcite" "[[{") ("supercite" "{") ("autocite"
> "*[{{")
> ("Autocite" "*[{{") ("citeauthor" "[{{") ("Citeauthor" "[{{")
> ("citetitle" "*[{{")
> ("citeyear" "*[[{") ("citedate" "*[[{") ("citeurl" "[[{") ("parentext"
> "{")
> ("brackettext" "{") ("fullcite" "[[{") ("fullfootcite" "[[{")
> ("volcite" "[{[[")
> ("Volcite" "[{[[") ("pvolcite" "[{[[") ("Pvolcite" "[{[[") ("fvolcite"
> "[{[[")
> ("ftvolcite" "[{[[") ("svolcite" "[{[[") ("Svolcite" "[{[[")
> ("tvolcite" "[{[[")
> ("Tvolcite" "[{[[") ("avolcite" "[{[[") ("Avolcite" "[{[[") ("notecite"
> "[[{")
> ("Notecite" "[[{") ("pnotecite" "[[{") ("Pnotecite" "[[{") ("fnotecite"
> "[[{")
> ("citename" "[[{[{") ("citelist" "[[{[{") ("citefield" "[[{[{")
> ("citereset" "*")
> ("RN" "{") ("Rn" "{") ("DefineBibliographyStrings" "{{")
> ("DefineBibliographyExtras" "{{")
> ("UndefineBibliographyExtras" "{{") ("DefineHyphenationExceptions" "{{")
> ("NewBibliographyString" "{") ("autocites" "(([[{") ("Autocites"
> "(([[{")
> ("cites" "(([[{") ("Cites" "(([[{") ("parencites" "(([[{")
> ("Parencites" "(([[{")
> ("footcites" "(([[{") ("footcitetexts" "(([[{") ("smartcites" "(([[{")
> ("Smartcites" "(([[{") ("textcites" "(([[{") ("Textcites" "(([[{")
> ("supercites" "(([[{"))
> 'font-lock-constant-face 2 command)
798c826
< symbols 'warning, 'variable, 'reference, 'function, sectioning-0,
---
> symbols 'warning, 'variable, 'reference, 'biblatex, 'function, sectioning-0,
Index: latex.el
===================================================================
RCS file: /sources/auctex/auctex/latex.el,v
retrieving revision 5.470
diff -r5.470 latex.el
1215c1215,1221
< ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography)))
---
> ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography)
> ("\\\\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)))
1221a1228,1245
> ;; 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)
> (LaTeX-add-bibliographies (replace-regexp-in-string
> (concat "\\(?:\\."
> (mapconcat 'regexp-quote
> BibTeX-Biber-file-extensions
> "\\|\\.")
> "\\)")
> "" bib)))))
>
1251c1275
< ;; Cleanup BibTeX files
---
> ;; Cleanup BibTeX/Biber files
1386a1411,1416
> ;;; 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")
>
1780,1781c1810,1811
< (defvar BibTeX-global-files nil
< "Association list of BibTeX files.
---
> (defvar BibTeX-Biber-global-files nil
> "Association list of BibTeX/Biber files.
1783c1813
< Initialized once at the first time you prompt for an BibTeX file.
---
> Initialized once at the first time you prompt for an BibTeX/Biber file.
1787c1817
< "Prompt for a BibTeX database file.
---
> "Prompt for a BibTeX/Biber database file.
1791,1794c1821,1825
< (message "Searching for BibTeX files...")
< (or BibTeX-global-files
< (setq BibTeX-global-files
< (mapcar 'list (TeX-search-files-by-type 'bibinputs 'global t t))))
---
> (message "Searching for BibTeX/Biber files...")
> (or BibTeX-Biber-global-files
> (setq BibTeX-Biber-global-files
> (mapcar 'list (TeX-search-files nil BibTeX-Biber-file-extensions t
> t))))
>
1797,1800c1828,1833
< (TeX-argument-prompt optional prompt "BibTeX files")
< (append (mapcar 'list (TeX-search-files-by-type
< 'bibinputs 'local t t))
< BibTeX-global-files))))
---
> (TeX-argument-prompt optional prompt "BibTeX/Biber files")
> (append (mapcar 'list
> (TeX-search-files '("./")
> BibTeX-Biber-file-extensions
> t t))
> BibTeX-Biber-global-files))))
5262a5296
> '("addbibresource" TeX-arg-bibliography)
Index: tex-buf.el
===================================================================
RCS file: /sources/auctex/auctex/tex-buf.el,v
retrieving revision 1.286
diff -r1.286 tex-buf.el
79c79
< Return non-nil if document need to be re-TeX'ed."
---
> Return non-nil if document needs to be re-TeX'ed."
369c369
< "Check that DERIVED is newer than any of the ORIGINALS.
---
> "Check if DERIVED is newer than any of the ORIGINALS.
411,433c411,435
< (TeX-check-files (concat name "."
(TeX-output-extension))
< (list name)
< TeX-file-extensions)
< (TeX-save-document (TeX-master-file)))
< TeX-command-default)
< ((and (memq major-mode '(doctex-mode latex-mode))
< (TeX-check-files (concat name ".bbl")
< (mapcar 'car
<
(LaTeX-bibliography-list))
< BibTeX-file-extensions))
< ;; We should check for bst files here as well.
< TeX-command-BibTeX)
< ((TeX-process-get-variable name
< 'TeX-command-next
< TeX-command-Show))
< (TeX-command-Show)))
< (completion-ignore-case t)
< (answer (or TeX-command-force
< (completing-read
< (concat "Command: (default " default ") ")
< (TeX-mode-specific-command-list major-mode) nil t
< nil 'TeX-command-history))))
< ;; If the answer "latex" it will not be expanded to "LaTeX"
---
> (TeX-check-files (concat name "."
> (TeX-output-extension))
> (list name)
> TeX-file-extensions)
> (TeX-save-document (TeX-master-file)))
> TeX-command-default)
> ((and (memq major-mode '(doctex-mode latex-mode))
> ;; Want to know if bib file is newer than .bbl
> ;; We don't care whether the bib files are open
> in emacs
> (TeX-check-files (concat name ".bbl")
> (mapcar 'car
>
> (LaTeX-bibliography-list))
> BibTeX-Biber-file-extensions))
> ;; We should check for bst files here as well.
> (if LaTeX-using-Biber TeX-command-Biber
> TeX-command-BibTeX))
> ((TeX-process-get-variable name
> 'TeX-command-next
> TeX-command-Show))
> (TeX-command-Show)))
> (completion-ignore-case t)
> (answer (or TeX-command-force
> (completing-read
> (concat "Command: (default " default ") ")
> (TeX-mode-specific-command-list major-mode) nil t
> nil 'TeX-command-history))))
> ;; If the answer is "latex" it will not be expanded to "LaTeX"
436,437c438,439
< (not (string-equal answer "")))
< answer
---
> (not (string-equal answer "")))
> answer
675a678,685
> (defun TeX-run-Biber (name command file)
> "Create a process for NAME using COMMAND to format FILE with Biber."
> (let ((process (TeX-run-command name command file)))
> (setq TeX-sentinel-function 'TeX-Biber-sentinel)
> (if TeX-process-asynchronous
> process
> (TeX-synchronous-sentinel name file process))))
>
942a953,965
> "^Package biblatex Warning: Please (re)run Biber on the file"
> nil t))
> (with-current-buffer TeX-command-buffer
> (and (LaTeX-bibliography-list)
> (TeX-check-files (TeX-master-file "bbl")
> (TeX-style-list)
> (append TeX-file-extensions
> BibTeX-Biber-file-extensions)))))
> (message "%s%s" "You should run Biber to get citations right, "
> (TeX-current-pages))
> (setq TeX-command-next (with-current-buffer TeX-command-buffer
> TeX-command-Biber)))
> ((and (save-excursion
> (re-search-forward
949c972
< BibTeX-file-extensions)))))
---
> BibTeX-Biber-file-extensions)))))
953a977,980
> ((re-search-forward "^(biblatex)\\W+Page breaks have changed" nil t)
> (message "%s%s" "You should run LaTeX again - page breaks have
> changed, "
> (TeX-current-pages))
> (setq TeX-command-next TeX-command-default))
1011,1012c1038,1063
< "Run LaTeX again to get citations right."))))
< (setq TeX-command-next TeX-command-default))
---
> "Run LaTeX again to get citations right."))
> (setq TeX-command-next TeX-command-default))))
>
> (defun TeX-Biber-sentinel (process name)
> "Cleanup TeX output buffer after running Biber."
> (goto-char (point-max))
> (cond
> ((re-search-backward (concat
> "^INFO - \\(WARNINGS\\|ERRORS\\): \\([0-9]+\\)") nil
> t)
> (message (concat "Biber finished with %s %s. "
> "Type `%s' to display output.")
> (match-string 2) (downcase (match-string 1))
> (substitute-command-keys
> "\\<TeX-mode-map>\\[TeX-recenter-output-buffer]"))
> (setq TeX-command-next TeX-command-default))
> ((re-search-backward (concat
> "^FATAL") nil t)
> (message (concat "Biber had a fatal error and did not finish! "
> "Type `%s' to display output.")
> (substitute-command-keys
> "\\<TeX-mode-map>\\[TeX-recenter-output-buffer]"))
> (setq TeX-command-next TeX-command-Biber))
> (t
> (message (concat "Biber finished successfully. "
> "Run LaTeX again to get citations right."))
> (setq TeX-command-next TeX-command-default))))
Index: tex.el
===================================================================
RCS file: /sources/auctex/auctex/tex.el,v
retrieving revision 5.697
diff -r5.697 tex.el
29c29,31
< ;; This file provides basic functions used by the AUCTeX modes.
---
> ;; This file provides AUCTeX support for plain TeX as well as basic
> ;; functions used by other AUCTeX modes (e.g. for LaTeX, Texinfo and
> ;; ConTeXt).
137a140
> ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
181a185,186
> TeX-run-Biber: For Biber output.
>
229a235
> (function-item TeX-run-Biber)
1783a1790,1795
> (defcustom TeX-command-Biber "Biber"
> "*The name of the Biber entry in `TeX-command-list'."
> :group 'TeX-command-name
> :type 'string)
> (make-variable-buffer-local 'TeX-command-Biber)
>
3296c3308
< BibTeX-file-extensions))
---
> BibTeX-Biber-file-extensions))
3316c3328
< (BibTeX-file-extensions nil))
---
> (BibTeX-Biber-file-extensions nil))
3631,3632c3643,3644
< (defcustom BibTeX-file-extensions '("bib")
< "Valid file extensions for BibTeX files."
---
> (defcustom BibTeX-Biber-file-extensions '("bib" "ris" "xml")
> "Valid file extensions for BibTeX/Biber files."
5164c5176
< BibTeX-global-files nil
---
> BibTeX-Biber-global-files nil
- [AUCTeX] First try at the Biber support merge,
Tassilo Horn <=
- Re: [AUCTeX] First try at the Biber support merge, Marcus Frings, 2012/07/20
- Re: [AUCTeX] First try at the Biber support merge, Tassilo Horn, 2012/07/20
- Re: [AUCTeX] First try at the Biber support merge, Ken Brown, 2012/07/20
- Re: [AUCTeX] First try at the Biber support merge, Tassilo Horn, 2012/07/20
- Re: [AUCTeX] First try at the Biber support merge, Ken Brown, 2012/07/21
- Re: [AUCTeX] First try at the Biber support merge, Philip Kime, 2012/07/21
- Re: [AUCTeX] First try at the Biber support merge, Ken Brown, 2012/07/21
- Re: [AUCTeX] First try at the Biber support merge, Tassilo Horn, 2012/07/22
- Re: [AUCTeX] First try at the Biber support merge, Tassilo Horn, 2012/07/22
- Re: [AUCTeX] First try at the Biber support merge, Ettore Aldrovandi, 2012/07/24