From 352c26e8232bca52718d787103919fb57a6628f8 Mon Sep 17 00:00:00 2001 From: Joost Kremers Date: Thu, 9 Mar 2017 23:47:05 +0100 Subject: Move `parsebib-find-bibtex-dialect' in source file. Since this function does not depend on point, it is more in line with the higher-level API. --- parsebib.el | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/parsebib.el b/parsebib.el index be2ea15..3d76f7c 100644 --- a/parsebib.el +++ b/parsebib.el @@ -152,22 +152,6 @@ point right before the closing delimiter (unlike e.g., ;; parsing a bib file ;; ;;;;;;;;;;;;;;;;;;;;;;;; -(defun parsebib-find-bibtex-dialect () - "Find the BibTeX dialect of a file if one is set. -This function looks for a local value of the variable -`bibtex-dialect' in the local variable block at the end of the -file. Return nil if no dialect is found." - (save-excursion - (goto-char (point-max)) - (let ((case-fold-search t)) - (when (re-search-backward (concat parsebib--entry-start "comment") (- (point-max) 3000) t) - (let ((comment (parsebib-read-comment))) - (when (and comment - (string-match-p "\\`[ \n\t\r]*Local Variables:" comment) - (string-match-p "End:[ \n\t\r]*\\'" comment) - (string-match (concat "bibtex-dialect: " (regexp-opt (mapcar #'symbol-name bibtex-dialect-list) t)) comment)) - (intern (match-string 1 comment)))))))) - (defun parsebib-find-next-item (&optional pos) "Find the first (potential) BibTeX item following POS. @@ -402,6 +386,22 @@ function." (unless hash res)))) +(defun parsebib-find-bibtex-dialect () + "Find the BibTeX dialect of a file if one is set. +This function looks for a local value of the variable +`bibtex-dialect' in the local variable block at the end of the +file. Return nil if no dialect is found." + (save-excursion + (goto-char (point-max)) + (let ((case-fold-search t)) + (when (re-search-backward (concat parsebib--entry-start "comment") (- (point-max) 3000) t) + (let ((comment (parsebib-read-comment))) + (when (and comment + (string-match-p "\\`[ \n\t\r]*Local Variables:" comment) + (string-match-p "End:[ \n\t\r]*\\'" comment) + (string-match (concat "bibtex-dialect: " (regexp-opt (mapcar #'symbol-name bibtex-dialect-list) t)) comment)) + (intern (match-string 1 comment)))))))) + (provide 'parsebib) ;;; parsebib.el ends here -- cgit v1.2.3