diff options
author | Joost Kremers <joostkremers@fastmail.fm> | 2017-03-09 23:47:05 +0100 |
---|---|---|
committer | Joost Kremers <joostkremers@fastmail.fm> | 2017-03-09 23:47:05 +0100 |
commit | 352c26e8232bca52718d787103919fb57a6628f8 (patch) | |
tree | 1e43234348e26e8947320ded1b0a984ecfc3adef | |
parent | fab63fef6509dd7640a805e108e354257af9e937 (diff) |
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.
-rw-r--r-- | parsebib.el | 32 |
1 files 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 |