jwiegley / use-package

A use-package declaration for simplifying your .emacs
https://jwiegley.github.io/use-package
GNU General Public License v3.0
4.42k stars 260 forks source link

What's the mode hook defined in `helm-bibtex` to conditionally activate it when AUCTeX's `LaTeX-mode` is called? #1054

Open hongyi-zhao opened 1 year ago

hongyi-zhao commented 1 year ago

I'm using the following configuration for helm-bibtex:

(use-package helm
  :demand t
  :config (require 'helm-autoloads))
(use-package helm-bibtex
  :demand t
  :init
  (setq
   ;;https://github.com/tmalsburg/helm-bibtex#insert-latex-cite-commands
   bibtex-completion-cite-prompt-for-optional-arguments nil)

  :bind-keymap
  ("<menu>" . helm-command-prefix)
  :bind
  (
   :map helm-command-map
   ("b" . helm-bibtex)
   ("B" . helm-bibtex-with-local-bibliography)
   ("n" . helm-bibtex-with-notes)
   ("<menu>" . helm-resume)
   )
  )

The above configuration will always enable the above packages during the starting process of Emacs, but I want to conditionally activate helm-bibtex when AUCTeX's LaTeX-mode is called and enabled.

For this purpose, it seems that the mode hook based method should be used, but I don't know what's the appropriate hooks defined in helm-bibtex which can help me to achieve this goal. Any tips will be appreciated.

See here for the related discussion.

Regards, Zhao

skangas commented 1 year ago

If I understand you correctly, you should be able to do something like this:

(use-package helm-bibtex
  :after latex-mode
  ...)