|
View:
New views
20 Messages
—
Rating Filter:
Alert me
|
| < Prev | 1 - 2 | Next > |
|
|
First try at the Biber support mergeHi 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) --- > 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))))) > --- > ;; 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" < 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 --- > 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)))) 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 mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support merge* Tassilo Horn <tassilo@...> wrote:
> 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. Great, thank you very much for adding the patches. > 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? The patch file applied cleanly to my CVS version. At the moment I'm working with it and everything seems to be fine. If I found a weird behaviour or a bug I'll report it here! Gruß, Marcus -- Fry: "I have an idea." Leela: "I have a better one." _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeMarcus Frings <iam-est-hora-surgere@...> writes:
>> 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? > > The patch file applied cleanly to my CVS version. At the moment I'm > working with it and everything seems to be fine. If I found a weird > behaviour or a bug I'll report it here! Great. My main problem when compiling that patch was that there were a lot of differences between Philips files and the AUCTeX CVS version that didn't look Biber-related. Maybe that were general improvements and fixes of the AUCTeX code, or maybe it was just an older AUCTeX version he worked on. Since I couldn't judge that, I preferred the stock AUCTeX versions in those cases. Bye, Tassilo _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeOn 7/20/2012 5:42 AM, Tassilo Horn wrote:
> Marcus Frings <iam-est-hora-surgere@...> writes: > >>> 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? >> >> The patch file applied cleanly to my CVS version. At the moment I'm >> working with it and everything seems to be fine. If I found a weird >> behaviour or a bug I'll report it here! > > Great. > > My main problem when compiling that patch was that there were a lot of > differences between Philips files and the AUCTeX CVS version that didn't > look Biber-related. Maybe that were general improvements and fixes of > the AUCTeX code, or maybe it was just an older AUCTeX version he worked > on. Since I couldn't judge that, I preferred the stock AUCTeX versions > in those cases. Tassilo, My impression is that Philip's files were based on auctex-11.86, but he could confirm. Based on that assumption, I did a 3-way merge (using diff3) of Philip's files and CVS head, using auctex-11.86 as common ancestor. My patches are different from yours in a few places. I don't want to waste everyone's time, so I'll do a little testing before sending my patches to the list. Ken _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeKen Brown <kbrown@...> writes:
Hi Ken, >> My main problem when compiling that patch was that there were a lot >> of differences between Philips files and the AUCTeX CVS version that >> didn't look Biber-related. Maybe that were general improvements and >> fixes of the AUCTeX code, or maybe it was just an older AUCTeX >> version he worked on. Since I couldn't judge that, I preferred the >> stock AUCTeX versions in those cases. > > My impression is that Philip's files were based on auctex-11.86, but > he could confirm. Based on that assumption, I did a 3-way merge > (using diff3) of Philip's files and CVS head, using auctex-11.86 as > common ancestor. My patches are different from yours in a few places. Awesome, I guess your results will probably be more accurate than mine. > I don't want to waste everyone's time, so I'll do a little testing > before sending my patches to the list. Sure. Bye, Tassilo _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeHi Tassilo,
On 7/20/2012 7:26 PM, Tassilo Horn wrote: > Ken Brown <kbrown@...> writes: > > Hi Ken, > >>> My main problem when compiling that patch was that there were a lot >>> of differences between Philips files and the AUCTeX CVS version that >>> didn't look Biber-related. Maybe that were general improvements and >>> fixes of the AUCTeX code, or maybe it was just an older AUCTeX >>> version he worked on. Since I couldn't judge that, I preferred the >>> stock AUCTeX versions in those cases. >> >> My impression is that Philip's files were based on auctex-11.86, but >> he could confirm. Based on that assumption, I did a 3-way merge >> (using diff3) of Philip's files and CVS head, using auctex-11.86 as >> common ancestor. My patches are different from yours in a few places. > > Awesome, I guess your results will probably be more accurate than mine. > >> I don't want to waste everyone's time, so I'll do a little testing >> before sending my patches to the list. unified diff, which I find easier to read, and the other is in the same format as yours, so you can more easily see where it differs. Philip did confirm in private mail that his patches were based on 11.86. I hope he can take a quick look and see if what I did seems right. Ken ? biber.patch ? biber1.patch 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) --- > (("nocite" "*{") ("cite" "*[[{") ("label" "{") ("pageref" "{") 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))))) > --- > ;; 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") > 1682c1712 < (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-file-extensions) --- > (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-Biber-file-extensions) 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,1793c1821,1823 < (message "Searching for BibTeX files...") < (or BibTeX-global-files < (setq BibTeX-global-files --- > (message "Searching for BibTeX/Biber files...") > (or BibTeX-Biber-global-files > (setq BibTeX-Biber-global-files 1797c1827 < (TeX-argument-prompt optional prompt "BibTeX files") --- > (TeX-argument-prompt optional prompt "BibTeX/Biber files") 1800c1830 < BibTeX-global-files)))) --- > BibTeX-Biber-global-files)))) 5262a5293 > '("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. 371,384c371,385 < in `TeX-check-path'." < (let ((found nil) < (regexp (concat "\\`\\(" < (mapconcat (lambda (dir) < (regexp-quote < (expand-file-name < (file-name-as-directory dir)))) < TeX-check-path "\\|") < "\\).*\\(" < (mapconcat 'regexp-quote originals "\\|") < "\\)\\.\\(" < (mapconcat 'regexp-quote extensions "\\|") < "\\)\\'")) < (buffers (buffer-list))) --- > in `TeX-check-path'. Returns true if any of the ORIGINALS with any of the > EXTENSIONS are newer than DERIVED. Will prompt to save the buffer of any > ORIGINALS which are modified but not saved yet." > (let ((existingoriginals nil) > (found nil) > (buffers (buffer-list))) > (dolist (path (map 'list (lambda (dir) > (expand-file-name > (file-name-as-directory dir))) > TeX-check-path)) > (dolist (orig originals) > (dolist (ext extensions) > (let ((filepath (concat path orig "." ext))) > (if (file-exists-p filepath) > (setq existingoriginals (cons filepath existingoriginals))))))) < (setq buffers (cdr buffers)) < (if (and name (string-match regexp name)) < (progn < (and (buffer-modified-p buffer) < (or (not TeX-save-query) < (y-or-n-p (concat "Save file " < (buffer-file-name buffer) < "? "))) < (save-excursion (set-buffer buffer) (save-buffer))) < (if (file-newer-than-file-p name derived) < (setq found t)))))) < found)) --- > (name (buffer-file-name buffer))) > (setq buffers (cdr buffers)) > (if (and name (member name existingoriginals)) > (progn > (and (buffer-modified-p buffer) > (or (not TeX-save-query) > (y-or-n-p (concat "Save file " > (buffer-file-name buffer) > "? "))) > (save-excursion (set-buffer buffer) (save-buffer))))))) > (dolist (eo existingoriginals) > (if (file-newer-than-file-p eo derived) > (setq found t))) > found > )) > ;; Something to remember - if you are testing on a document with no content at all, > ;; perhaps one with just \nocite{*} in it for testing Biber runs, no PDF file is created > ;; by latex and so the first cond clause will match because (file-newer-than-p) returns > ;; t when the second argument does not exist ... this has caused hours of pointless investigations > ;; before ... < (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" < answer --- > (not (string-equal answer ""))) > answer 675a686,693 > (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)))) > 942a961,973 > "^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 --- > BibTeX-Biber-file-extensions))))) 953a985,988 > ((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,1012c1046,1071 < "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)))) RCS file: /sources/auctex/auctex/tex.el,v retrieving revision 5.697 diff -r5.697 tex.el 137a138 > ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber") 181a183,184 > TeX-run-Biber: For Biber output. > 229a233 > (function-item TeX-run-Biber) 1783a1788,1793 > (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) > 3296c3306 < BibTeX-file-extensions)) --- > BibTeX-Biber-file-extensions)) 3316c3326 < (BibTeX-file-extensions nil)) --- > (BibTeX-Biber-file-extensions nil)) 3631,3632c3641,3642 < (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." 3807c3817 < (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-file-extensions) --- > (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-Biber-file-extensions) 5164c5174 < BibTeX-global-files nil --- > BibTeX-Biber-global-files nil ? biber.patch Index: font-latex.el =================================================================== RCS file: /sources/auctex/auctex/font-latex.el,v retrieving revision 5.194 diff -u -r5.194 font-latex.el --- font-latex.el 4 Jul 2012 06:11:58 -0000 5.194 +++ font-latex.el 21 Jul 2012 02:33:56 -0000 @@ -291,8 +291,36 @@ ("arabic" "{") ("roman" "{") ("Roman" "{") ("alph" "{") ("Alph" "{") ("fnsymbol" "{")) 'font-lock-variable-name-face 2 command) + ("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) ("reference" - (("nocite" "{") ("cite" "[{") ("label" "{") ("pageref" "{") + (("nocite" "*{") ("cite" "*[[{") ("label" "{") ("pageref" "{") ("vref" "{") ("eqref" "{") ("ref" "{") ("include" "{") ("input" "{") ("bibliography" "{") ("index" "{") ("glossary" "{") ("footnote" "[{") ("footnotemark" "[") ("footnotetext" "[{")) @@ -795,7 +823,7 @@ "Add KEYWORDS to CLASS. KEYWORDS is a list of keywords or keywords with syntax specs. CLASS corresponds to a keyword class and can be one of the -symbols 'warning, 'variable, 'reference, 'function, sectioning-0, +symbols 'warning, 'variable, 'reference, 'biblatex, 'function, sectioning-0, 'sectioning-1, 'sectioning-2, 'sectioning-3, 'sectioning-4, 'sectioning-5, 'slide-title, 'textual, 'bold-command, 'italic-command, 'math-command, 'type-command, 'bold-declaration, Index: latex.el =================================================================== RCS file: /sources/auctex/auctex/latex.el,v retrieving revision 5.470 diff -u -r5.470 latex.el --- latex.el 7 Aug 2011 15:32:42 -0000 5.470 +++ latex.el 21 Jul 2012 02:33:58 -0000 @@ -1212,13 +1212,37 @@ (, (concat "\\\\bibitem{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}") 1 LaTeX-auto-bibitem) (, (concat "\\\\bibitem\\[[^][\n\r]+\\]{\\(" token "[^, \n\r\t%\"#'()={}]*\\)}") 1 LaTeX-auto-bibitem) - ("\\\\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))) 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) + (LaTeX-add-bibliographies (replace-regexp-in-string + (concat "\\(?:\\." + (mapconcat 'regexp-quote + BibTeX-Biber-file-extensions + "\\|\\.") + "\\)") + "" bib))))) + (defun LaTeX-auto-prepare () "Prepare for LaTeX parsing." (setq LaTeX-auto-arguments nil @@ -1248,7 +1272,7 @@ (defun LaTeX-auto-cleanup () "Cleanup after LaTeX parsing." - ;; Cleanup BibTeX files + ;; Cleanup BibTeX/Biber files (setq LaTeX-auto-bibliography (apply 'append (mapcar (lambda (arg) (TeX-split-string "," arg)) @@ -1384,6 +1408,12 @@ (setq LaTeX-environment-menu nil) (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") + ;;; BibTeX ;;;###autoload @@ -1679,7 +1709,7 @@ TeX-file-extensions) (docs "${TEXDOCS}" ("doc/") TeX-doc-extensions) (graphics "${TEXINPUTS}" ("tex/") LaTeX-includegraphics-extensions) - (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-file-extensions) + (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-Biber-file-extensions) (bstinputs "${BSTINPUTS}" ("bibtex/bst/") BibTeX-style-extensions)) "Alist of filetypes with locations and file extensions. Each element of the alist consists of a symbol expressing the @@ -1777,27 +1807,27 @@ BibTeX-global-style-files)) optional)) -(defvar BibTeX-global-files nil - "Association list of BibTeX files. +(defvar BibTeX-Biber-global-files nil + "Association list of BibTeX/Biber files. -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. May be reset with `\\[universal-argument] \\[TeX-normal-mode]'.") (defun TeX-arg-bibliography (optional &optional prompt) - "Prompt for a BibTeX database file. + "Prompt for a BibTeX/Biber database file. If OPTIONAL is non-nil, insert the resulting value as an optional argument, otherwise as a mandatory one. Use PROMPT as the prompt string." - (message "Searching for BibTeX files...") - (or BibTeX-global-files - (setq BibTeX-global-files + (message "Searching for BibTeX/Biber files...") + (or BibTeX-Biber-global-files + (setq BibTeX-Biber-global-files (mapcar 'list (TeX-search-files-by-type 'bibinputs 'global t t)))) (let ((styles (multi-prompt "," t - (TeX-argument-prompt optional prompt "BibTeX files") + (TeX-argument-prompt optional prompt "BibTeX/Biber files") (append (mapcar 'list (TeX-search-files-by-type 'bibinputs 'local t t)) - BibTeX-global-files)))) + BibTeX-Biber-global-files)))) (apply 'LaTeX-add-bibliographies styles) (TeX-argument-insert (mapconcat 'identity styles ",") optional))) @@ -5260,6 +5290,7 @@ '("nocite" TeX-arg-cite) '("bibliographystyle" TeX-arg-bibstyle) '("bibliography" TeX-arg-bibliography) + '("addbibresource" TeX-arg-bibliography) '("footnote" (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil) t) Index: tex-buf.el =================================================================== RCS file: /sources/auctex/auctex/tex-buf.el,v retrieving revision 1.286 diff -u -r1.286 tex-buf.el --- tex-buf.el 20 Mar 2011 08:59:15 -0000 1.286 +++ tex-buf.el 21 Jul 2012 02:33:59 -0000 @@ -76,7 +76,7 @@ (defun TeX-save-document (name) "Save all files belonging to the current document. -Return non-nil if document need to be re-TeX'ed." +Return non-nil if document needs to be re-TeX'ed." (interactive (list (TeX-master-file))) (if (string-equal name "") (setq name (TeX-master-file))) @@ -366,37 +366,40 @@ command) (defun TeX-check-files (derived originals extensions) - "Check that DERIVED is newer than any of the ORIGINALS. + "Check if DERIVED is newer than any of the ORIGINALS. Try each original with each member of EXTENSIONS, in all directories -in `TeX-check-path'." - (let ((found nil) - (regexp (concat "\\`\\(" - (mapconcat (lambda (dir) - (regexp-quote - (expand-file-name - (file-name-as-directory dir)))) - TeX-check-path "\\|") - "\\).*\\(" - (mapconcat 'regexp-quote originals "\\|") - "\\)\\.\\(" - (mapconcat 'regexp-quote extensions "\\|") - "\\)\\'")) - (buffers (buffer-list))) +in `TeX-check-path'. Returns true if any of the ORIGINALS with any of the +EXTENSIONS are newer than DERIVED. Will prompt to save the buffer of any +ORIGINALS which are modified but not saved yet." + (let ((existingoriginals nil) + (found nil) + (buffers (buffer-list))) + (dolist (path (map 'list (lambda (dir) + (expand-file-name + (file-name-as-directory dir))) + TeX-check-path)) + (dolist (orig originals) + (dolist (ext extensions) + (let ((filepath (concat path orig "." ext))) + (if (file-exists-p filepath) + (setq existingoriginals (cons filepath existingoriginals))))))) (while buffers (let* ((buffer (car buffers)) - (name (buffer-file-name buffer))) - (setq buffers (cdr buffers)) - (if (and name (string-match regexp name)) - (progn - (and (buffer-modified-p buffer) - (or (not TeX-save-query) - (y-or-n-p (concat "Save file " - (buffer-file-name buffer) - "? "))) - (save-excursion (set-buffer buffer) (save-buffer))) - (if (file-newer-than-file-p name derived) - (setq found t)))))) - found)) + (name (buffer-file-name buffer))) + (setq buffers (cdr buffers)) + (if (and name (member name existingoriginals)) + (progn + (and (buffer-modified-p buffer) + (or (not TeX-save-query) + (y-or-n-p (concat "Save file " + (buffer-file-name buffer) + "? "))) + (save-excursion (set-buffer buffer) (save-buffer))))))) + (dolist (eo existingoriginals) + (if (file-newer-than-file-p eo derived) + (setq found t))) + found + )) (defcustom TeX-save-query t "*If non-nil, ask user for permission to save files before starting TeX." @@ -405,36 +408,43 @@ (defvar TeX-command-history nil) +;; Something to remember - if you are testing on a document with no content at all, +;; perhaps one with just \nocite{*} in it for testing Biber runs, no PDF file is created +;; by latex and so the first cond clause will match because (file-newer-than-p) returns +;; t when the second argument does not exist ... this has caused hours of pointless investigations +;; before ... (defun TeX-command-query (name) "Query the user for what TeX command to use." (let* ((default (cond ((if (string-equal name TeX-region) - (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" (setq answer (car-safe (TeX-assoc answer TeX-command-list))) (if (and answer - (not (string-equal answer ""))) - answer + (not (string-equal answer ""))) + answer default))) (defvar TeX-command-next nil @@ -673,6 +683,14 @@ process (TeX-synchronous-sentinel name file process)))) +(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)))) + (defun TeX-run-compile (name command file) "Ignore first and third argument, start compile with second argument." (compile command)) @@ -940,17 +958,34 @@ (cond ((TeX-TeX-sentinel-check process name)) ((and (save-excursion (re-search-forward + "^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 "^\\(?:LaTeX\\|Package natbib\\) Warning: Citation" 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-file-extensions))))) + BibTeX-Biber-file-extensions))))) (message "%s%s" "You should run BibTeX to get citations right, " (TeX-current-pages)) (setq TeX-command-next (with-current-buffer TeX-command-buffer TeX-command-BibTeX))) + ((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)) ((re-search-forward "^\\(?:LaTeX Warning: Label(s)\\|\ Package natbib Warning: Citation(s)\\)" nil t) (message "%s%s" "You should run LaTeX again to get references right, " @@ -1008,8 +1043,32 @@ "\\<TeX-mode-map>\\[TeX-recenter-output-buffer]"))) (t (message (concat "BibTeX finished successfully. " - "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)))) ;;; Process Control Index: tex.el =================================================================== RCS file: /sources/auctex/auctex/tex.el,v retrieving revision 5.697 diff -u -r5.697 tex.el --- tex.el 22 Jun 2012 06:26:04 -0000 5.697 +++ tex.el 21 Jul 2012 02:34:02 -0000 @@ -135,6 +135,7 @@ TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") + ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber") ,(if (or window-system (getenv "DISPLAY")) '("View" "%V" TeX-run-discard-or-function t t :help "Run Viewer") '("View" "dvi2tty -q -w 132 %s" TeX-run-command t t @@ -179,6 +180,8 @@ TeX-run-BibTeX: For BibTeX output. +TeX-run-Biber: For Biber output. + TeX-run-compile: Use `compile' to run the process. TeX-run-shell: Use `shell-command' to run the process. @@ -227,6 +230,7 @@ (function-item TeX-run-TeX) (function-item TeX-run-interactive) (function-item TeX-run-BibTeX) + (function-item TeX-run-Biber) (function-item TeX-run-compile) (function-item TeX-run-shell) (function-item TeX-run-discard) @@ -1781,6 +1785,12 @@ :type 'string) (make-variable-buffer-local 'TeX-command-BibTeX) +(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) + (defcustom TeX-command-Show "View" "*The default command to show (view or print) a TeX file. Must be the car of an entry in `TeX-command-list'." @@ -3293,7 +3303,7 @@ (TeX-strip-extension tex TeX-all-extensions t) ".el")))) ((TeX-match-extension tex (append TeX-file-extensions - BibTeX-file-extensions)) + BibTeX-Biber-file-extensions)) (save-excursion (set-buffer (let (enable-local-eval) (find-file-noselect tex))) @@ -3313,7 +3323,7 @@ (unless (file-directory-p TeX-auto-global) (make-directory TeX-auto-global)) (let ((TeX-file-extensions '("cls" "sty")) - (BibTeX-file-extensions nil)) + (BibTeX-Biber-file-extensions nil)) (mapc (lambda (macro) (TeX-auto-generate macro TeX-auto-global)) TeX-macro-global)) (byte-recompile-directory TeX-auto-global 0)) @@ -3628,8 +3638,8 @@ (make-variable-buffer-local 'TeX-output-extension) -(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." :group 'TeX-file-extension :type '(repeat (string :format "%v"))) @@ -3804,7 +3814,7 @@ '((texinputs "${TEXINPUTS}" ("tex/") TeX-file-extensions) (docs "${TEXDOCS}" ("doc/") TeX-doc-extensions) (graphics "${TEXINPUTS}" ("tex/") LaTeX-includegraphics-extensions) - (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-file-extensions) + (bibinputs "${BIBINPUTS}" ("bibtex/bib/") BibTeX-Biber-file-extensions) (bstinputs "${BSTINPUTS}" ("bibtex/bst/") BibTeX-style-extensions)) "Alist of filetypes with locations and file extensions. Each element of the alist consists of a symbol expressing the @@ -5161,7 +5171,7 @@ (if arg (setq TeX-style-hook-list nil BibTeX-global-style-files nil - BibTeX-global-files nil + BibTeX-Biber-global-files nil TeX-global-input-files nil)) (let ((TeX-auto-save t)) (if (buffer-modified-p) _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeMany thanks for looking at this. It's hard to tell from the patches if they are right - some people will have to install and test it. Can I just pull this from the CVS head? One thing to note is that many users of biblatex 2.0 will want to set:
(setq LaTeX-always-use-Biber t) Since biber is the default backend as of version 2.0 of biblatex and most of the really important features are biber only in 2.0. PK On 21 Jul 2012, at 12:36 PM, Ken Brown wrote: > Hi Tassilo, > > On 7/20/2012 7:26 PM, Tassilo Horn wrote: >> Ken Brown <kbrown@...> writes: >> >> Hi Ken, >> >>>> My main problem when compiling that patch was that there were a lot >>>> of differences between Philips files and the AUCTeX CVS version that >>>> didn't look Biber-related. Maybe that were general improvements and >>>> fixes of the AUCTeX code, or maybe it was just an older AUCTeX >>>> version he worked on. Since I couldn't judge that, I preferred the >>>> stock AUCTeX versions in those cases. >>> >>> My impression is that Philip's files were based on auctex-11.86, but >>> he could confirm. Based on that assumption, I did a 3-way merge >>> (using diff3) of Philip's files and CVS head, using auctex-11.86 as >>> common ancestor. My patches are different from yours in a few places. >> >> Awesome, I guess your results will probably be more accurate than mine. >> >>> I don't want to waste everyone's time, so I'll do a little testing >>> before sending my patches to the list. > > My version works for me, so I'm attaching it in two forms; one is a unified diff, which I find easier to read, and the other is in the same format as yours, so you can more easily see where it differs. > > Philip did confirm in private mail that his patches were based on 11.86. I hope he can take a quick look and see if what I did seems right. > > Ken > > <biber-merge-2nd-try.patch><biber-merge-2nd-try-unified.patch> -- Dr Philip Kime _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeOn 7/21/2012 1:07 PM, Philip Kime wrote:
> Many thanks for looking at this. It's hard to tell from the patches if they are right - some people will have to install and test it. Can I just pull this from the CVS head? Just pull CVS head and apply the patches. > One thing to note is that many users of biblatex 2.0 will want to set: > > (setq LaTeX-always-use-Biber t) > > Since biber is the default backend as of version 2.0 of biblatex and most of the really important features are biber only in 2.0. So I guess that advice should go into the auctex manual, as well as the release notes for the next release. Ken _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeKen Brown <kbrown@...> writes:
>> Many thanks for looking at this. It's hard to tell from the patches >> if they are right - some people will have to install and test it. Can >> I just pull this from the CVS head? > > Just pull CVS head and apply the patches. > >> One thing to note is that many users of biblatex 2.0 will want to set: >> >> (setq LaTeX-always-use-Biber t) >> >> Since biber is the default backend as of version 2.0 of biblatex and most of >> the really important features are biber only in 2.0. > > So I guess that advice should go into the auctex manual, as well as > the release notes for the next release. Yes, the release notes are in doc/changes.texi which is both manual, and the text only CHANGES is generated from it. But probably there should only be a statement that biber's now supported, and all usage docs should be an own section in the manual. Bye, Tassilo _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeKen Brown <kbrown@...> writes:
>>> I don't want to waste everyone's time, so I'll do a little testing >>> before sending my patches to the list. > > My version works for me, so I'm attaching it in two forms; one is a > unified diff, which I find easier to read, and the other is in the > same format as yours, so you can more easily see where it differs. Thanks. I'm using your patch now for a few days and see if it works for me. Bye, Tassilo _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
|
|
|
Re: First try at the Biber support mergeKen Brown <kbrown@...> writes:
Hi Ken, > On 7/23/2012 6:50 AM, Philip Kime wrote: >> The unified diff applies cleanly for me and seems to work fine on the >> current CVS checkout. > > Great. Thanks for testing. I'm also running with your patch. I don't use Biber (yet), but at least it doesn't seem to break anything with respect to the normal reftex stuff. One difference between your and my patch is that with mine, C-c [ <tab> showed a completions buffer when being at the `reftex-citation' prompt. With your patch, <tab> just says [No match]. This feature is in fact broken in the current (unpatched) CVS version, but it works with Philip's version and my patch against CVS trunk. It would be awesome if you could have a look at this. Bye, Tassilo _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeOn 7/24/2012 3:12 AM, Tassilo Horn wrote:
Hi Tassilo, > One difference between your and my patch is that with mine, > > C-c [ <tab> > > showed a completions buffer when being at the `reftex-citation' prompt. > With your patch, <tab> just says [No match]. > > This feature is in fact broken in the current (unpatched) CVS version, > but it works with Philip's version and my patch against CVS trunk. It > would be awesome if you could have a look at this. Since this is broken in the current (unpatched) CVS head, I would think the way to proceed would be to do a bisection between 11.86 and CVS head to see which commit broke it. (I'm assuming that it works in 11.86.) I tried to do this myself, but I ran into two problems. First, I'm not proficient in using cvs, and I didn't know how to do the bisection. Everything I tried messed up my auctex checkout, and I had to keep restarting. Second, I found that the problem occurred in some of my tex files but not all. It would probably be good to have a minimal example in which it fails. And can you give me a recipe for doing the bisection so that I don't have to study the cvs manual? Ken _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeKen Brown <kbrown@...> writes:
Hi Ken, >> This feature is in fact broken in the current (unpatched) CVS >> version, but it works with Philip's version and my patch against CVS >> trunk. It would be awesome if you could have a look at this. > > Since this is broken in the current (unpatched) CVS head, I would > think the way to proceed would be to do a bisection between 11.86 and > CVS head to see which commit broke it. Whatever is easier: Comparing your and my patch, or bisecting. > (I'm assuming that it works in 11.86.) I tried to do this myself, but > I ran into two problems. First, I'm not proficient in using cvs, and > I didn't know how to do the bisection. Ditto, I haven't used CVS for anything except auctex, and here I didn't have to use more than the usual update-edit-commit cycle. > Everything I tried messed up my auctex checkout, and I had to keep > restarting. Probably, you've updated to some specific revision (-r, or -D given a date). In CVS, those options are sticky. Once you've updated a file to some specific revision a usual "cvs update" won't update that specific file to the current HEAD. In order to do that, you have to release all stickiness using "cvs update -A" explicitly. > Second, I found that the problem occurred in some of my tex files but > not all. Oh, that's interesting. I don't have any tex file where it works. > It would probably be good to have a minimal example in which it > fails. Here's one that fails for me. The tex file: --8<---------------cut here---------------start------------->8--- \documentclass{article} \begin{document} Just do C-x [ somewhere and you should be able to complete the keys aucbrown12 and auchorn12. \bibliographystyle{alpha} \bibliography{foo} \end{document} --8<---------------cut here---------------end--------------->8--- The corresponding bib file: --8<---------------cut here---------------start------------->8--- @Article{aucbrown12, author = {Ken Brown}, title = {Merging Biber support into AUCTeX}, journal = {The Emacs Journal}, year = {2012} } @InProceedings{auchorn12, author = {Tassilo Horn}, title = {Bla bla about AUCTeX}, year = {2012} } --8<---------------cut here---------------end--------------->8--- > And can you give me a recipe for doing the bisection so that I don't > have to study the cvs manual? I think CVS has no support for bisection. The best I can come up with is to do it manually using a sequence of cvs update -D 2011-09-24 # check if it works there cycles, and once you know the date where the regression occured, check the differences committed at that day with cvs diff -D 2011-12-11 2011-12-12 Bye, Tassilo _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeOn 7/24/2012 1:30 PM, Tassilo Horn wrote:
Hi Tassilo, > --8<---------------cut here---------------start------------->8--- > \documentclass{article} > > \begin{document} > > Just do C-x [ somewhere and you should be able to complete the keys > aucbrown12 and auchorn12. > > \bibliographystyle{alpha} > \bibliography{foo} > \end{document} > --8<---------------cut here---------------end--------------->8--- > > The corresponding bib file: > --8<---------------cut here---------------start------------->8--- > @Article{aucbrown12, > author = {Ken Brown}, > title = {Merging Biber support into AUCTeX}, > journal = {The Emacs Journal}, > year = {2012} > } > > @InProceedings{auchorn12, > author = {Tassilo Horn}, > title = {Bla bla about AUCTeX}, > year = {2012} > } > --8<---------------cut here---------------end--------------->8--- Completion works for me on this example, using CVS head with my version of Philip's patches. It didn't work immediately when I first entered the text into the buffer. But then I saved the file, killed the buffer, and revisited the file, and completion worked fine. I tested with a fairly minimal .emacs, appended below. Ken (load "auctex.el" nil t t) (load "preview-latex.el" nil t t) (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t) (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil) (autoload 'reftex-citation "reftex-cite" "Make citation" nil) (add-hook 'LaTeX-mode-hook 'turn-on-reftex) (setq reftex-plug-into-AUCTeX t) (add-hook 'latex-mode-hook 'turn-on-reftex) _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeOn 7/24/2012 2:12 PM, Ken Brown wrote:
> On 7/24/2012 1:30 PM, Tassilo Horn wrote: > > Hi Tassilo, > >> --8<---------------cut here---------------start------------->8--- >> \documentclass{article} >> >> \begin{document} >> >> Just do C-x [ somewhere and you should be able to complete the keys >> aucbrown12 and auchorn12. >> >> \bibliographystyle{alpha} >> \bibliography{foo} >> \end{document} >> --8<---------------cut here---------------end--------------->8--- >> >> The corresponding bib file: >> --8<---------------cut here---------------start------------->8--- >> @Article{aucbrown12, >> author = {Ken Brown}, >> title = {Merging Biber support into AUCTeX}, >> journal = {The Emacs Journal}, >> year = {2012} >> } >> >> @InProceedings{auchorn12, >> author = {Tassilo Horn}, >> title = {Bla bla about AUCTeX}, >> year = {2012} >> } >> --8<---------------cut here---------------end--------------->8--- > > Completion works for me on this example, using CVS head with my version > of Philip's patches. It didn't work immediately when I first entered the > text into the buffer. But then I saved the file, killed the buffer, and > revisited the file, and completion worked fine. I tested with a fairly > minimal .emacs, appended below. > > Ken > > (load "auctex.el" nil t t) > (load "preview-latex.el" nil t t) > (autoload 'reftex-mode "reftex" "RefTeX Minor Mode" t) > (autoload 'turn-on-reftex "reftex" "RefTeX Minor Mode" nil) > (autoload 'reftex-citation "reftex-cite" "Make citation" nil) > (add-hook 'LaTeX-mode-hook 'turn-on-reftex) > (setq reftex-plug-into-AUCTeX t) > (add-hook 'latex-mode-hook 'turn-on-reftex) Sorry, that last line shouldn't be there. But I don't think it affects anything. _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeKen Brown <kbrown@...> writes:
> Completion works for me on this example, using CVS head with my > version of Philip's patches. It didn't work immediately when I first > entered the text into the buffer. But then I saved the file, killed > the buffer, and revisited the file, and completion worked fine. I > tested with a fairly minimal .emacs, appended below. Indeed, it also works for me using emacs -Q and your configs. Oh, and it also works with my usual emacs configs, at least after finding the tex file for the second time. But with my other "real" tex files, that doesn't help. Anyway, this issue is separate from the Biber merge, so we can debug that after the merge. Bye, Tassilo _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeOn Sun, Jul 22, 2012 at 11:07:58AM +0200, Tassilo Horn wrote:
> Thanks. I'm using your patch now for a few days and see if it works for > me. Hello, I have been following this, and wanted to try the patches on OS X. After rebuilding auctex, they work well with a stock Emacs.app. With Aquamacs.app, however, while the LaTeX-Biber-LaTeX-LaTeX cycle works (as above), the View command breaks. There is some code designed to configure auctex in order to use Skim as a viewer application, and that now fails. Specifically, it's the aquamacs-call-viewer function, but I need guidance to understand why. I'm posting this to the macosx-emacs list as well. --Ettore -- Ettore Aldrovandi Department of Mathematics, Florida State University 1017 Academic Way * http://www.math.fsu.edu/~ealdrov Tallahassee, FL 32306-4510, USA * * aldrovandi at math dot fsu dot edu _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeEttore Aldrovandi <ealdrov@...> writes:
Hi Ettore, >> Thanks. I'm using your patch now for a few days and see if it works >> for me. > > I have been following this, and wanted to try the patches on OS X. > After rebuilding auctex, they work well with a stock Emacs.app. > > With Aquamacs.app, however, while the LaTeX-Biber-LaTeX-LaTeX cycle > works (as above), the View command breaks. There is some code designed > to configure auctex in order to use Skim as a viewer application, and > that now fails. Specifically, it's the aquamacs-call-viewer function, > but I need guidance to understand why. Do you have a backtrace, or in what way does it fail? Looking at the patch, the only function in that procedure that was touched is `TeX-command-query', but to me it looks unlikely to be the cause. Are you sure that the problem doesn't also occur in aquamacs without Ken's biber patch? Bye, Tassilo _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
|
|
Re: First try at the Biber support mergeOn Wed, Jul 25, 2012 at 08:50:36AM +0200, Tassilo Horn wrote:
> Do you have a backtrace, or in what way does it fail? > > Looking at the patch, the only function in that procedure that was > touched is `TeX-command-query', but to me it looks unlikely to be the Here's the trace on TeX-command-query ("ringstacks" is the file I'm using) if Skim is already running: ====================================================================== 1 -> TeX-command-master: override-confirm=nil | 2 -> TeX-command-query: name="ringstacks" | 2 <- TeX-command-query: "View" | 2 -> TeX-command: name="View" file=TeX-master-file override-confirm=nil | 2 <- TeX-command: nil 1 <- TeX-command-master: nil ====================================================================== At the 2 -> Tex-command: stage, under normal behavior, I should have a Skim window pop up. What I get is: View command: (aquamacs-call-viewer 815 "ringstacks.tex") in the mini-buffer. Then it returns nil. If Skim is not running, then I get: ====================================================================== 1 -> TeX-command-master: override-confirm=nil | 2 -> TeX-command-query: name="ringstacks" | 2 <- TeX-command-query: "View" | 2 -> TeX-command: name="View" file=TeX-master-file override-confirm=nil and it hangs here until I kill it. > cause. Are you sure that the problem doesn't also occur in aquamacs > without Ken's biber patch? No, without the patch it doesn't occur. Thanks, --Ettore -- Ettore Aldrovandi Department of Mathematics, Florida State University 1017 Academic Way * http://www.math.fsu.edu/~ealdrov Tallahassee, FL 32306-4510, USA * * aldrovandi at math dot fsu dot edu _______________________________________________ auctex mailing list auctex@... https://lists.gnu.org/mailman/listinfo/auctex |
| < Prev | 1 - 2 | Next > |
| Free embeddable forum powered by Nabble | Forum Help |