diff --git a/preview-auto.el b/preview-auto.el index 7614b4f..da184a2 100644 --- a/preview-auto.el +++ b/preview-auto.el @@ -39,6 +39,7 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) (require 'latex) (require 'preview) @@ -90,7 +91,6 @@ Should work in AUCTeX `LaTeX-mode' buffers. Implemented using (memq math-face face)))) (texmathp))) - (defun preview-auto--generate-rules () "Return list of rules for identifying math environments." (let* ((basic-rules @@ -120,7 +120,6 @@ is valid.") (defvar-local preview-auto--begin-re nil "Regular expression for identifying the beginning of a math environment.") - (defun preview-auto--check-default () "Default predicate for checking whether to consider a delimiter. Returns non-nil if either @@ -543,6 +542,7 @@ cancel the preview, so that the preview is not misplaced." (remove-hook 'after-change-functions #'preview-auto--after-change t) (remove-hook 'post-command-hook #'preview-auto--post-command t)))) +;;;###autoload (defun preview-auto-setup () "Hook function for installing bind and menu item." (remove-hook 'LaTeX-mode-hook #'preview-auto-setup) @@ -552,6 +552,9 @@ cancel the preview, so that the preview is not misplaced." ["automatically" preview-auto-mode] "(or toggle) at point")) +;; Please don't modify hooks on the top-level! Even if it removes +;; itself, it is better to advise the user to call this or by hand or +;; copy/adjust the code as they see fit. (add-hook 'LaTeX-mode-hook #'preview-auto-setup) (provide 'preview-auto)