Function: bibtex-set-dialect

bibtex-set-dialect is an interactive and byte-compiled function defined in bibtex.el.gz.

Signature

(bibtex-set-dialect &optional DIALECT LOCAL)

Documentation

Select BibTeX DIALECT for editing BibTeX files.

This sets the user variable bibtex-dialect as well as the dialect-dependent internal variables. Allowed dialects are listed in bibtex-dialect-list. If DIALECT is nil use current value of bibtex-dialect. If LOCAL is non-nil make buffer-local bindings for these variables rather than setting the global values. The dialect-dependent internal variables are also bound buffer-locally if bibtex-dialect is already buffer-local in the current buffer (for example, as a file-local variable). LOCAL is t for interactive calls.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/bibtex.el.gz
(defun bibtex-set-dialect (&optional dialect local)
  "Select BibTeX DIALECT for editing BibTeX files.
This sets the user variable `bibtex-dialect' as well as the dialect-dependent
internal variables.  Allowed dialects are listed in `bibtex-dialect-list'.
If DIALECT is nil use current value of `bibtex-dialect'.
If LOCAL is non-nil make buffer-local bindings for these variables rather than
setting the global values.  The dialect-dependent internal variables
are also bound buffer-locally if `bibtex-dialect' is already buffer-local
in the current buffer (for example, as a file-local variable).
LOCAL is t for interactive calls."
  (interactive (list (intern (completing-read "Dialect: "
                                              (mapcar #'list bibtex-dialect-list)
                                              nil t))
                     t))
  (setq local (or local (local-variable-p 'bibtex-dialect)))
  (cl-flet ((setfun (var val)
              (if local
                  (set (make-local-variable var) val)
                (set var val))))
    (if dialect (setfun 'bibtex-dialect dialect))

    ;; Set internal variables.
    (setfun 'bibtex-entry-alist (bibtex-entry-alist bibtex-dialect))
    (setfun 'bibtex-field-alist (bibtex-field-alist bibtex-dialect))
    (setfun 'bibtex-entry-type
            (concat "@[ \t]*"
                    (regexp-opt (mapcar #'car bibtex-entry-alist))))
    (setfun 'bibtex-entry-head
            (concat "^[ \t]*\\(" bibtex-entry-type "\\)[ \t]*[({][ \t\n]*\\("
                    bibtex-reference-key "\\)"))
    (setfun 'bibtex-entry-maybe-empty-head
            (concat bibtex-entry-head "?"))
    (setfun 'bibtex-any-valid-entry-type
            (concat "^[ \t]*@[ \t]*"
                    (regexp-opt
                     (append '("String" "Preamble")
                             (mapcar #'car bibtex-entry-alist)))))
    (setq imenu-generic-expression
          (list (list nil bibtex-entry-head bibtex-key-in-head))
          imenu-case-fold-search t)))