Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
hongyi-zhao opened this issue May 17, 2023 · 4 comments

Comments

@hongyi-zhao
Copy link

hongyi-zhao commented May 17, 2023

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.

Regards,
Zhao

@hongyi-zhao hongyi-zhao changed the title What's the mode hook defined in helm-bibtex to conditionally activate helm-bibtex based on AUCTeX's LaTeX-mode. What's the mode hook defined in helm-bibtex to conditionally activate it when AUCTeX's LaTeX-mode is called? May 17, 2023
@tmalsburg
Copy link
Owner

Helm-bibtex doesn't have a global mode that can be activated/deactivated. It's generally available for use once it's loaded. Could you please explain why you'd want to activate it only in specific buffers? Helm-bibtex should not interfere with modes in other buffers, so I don't see what would be gained by deactivating it. And what would you like to happen when the user tries to use the helm-bibtex command in a buffer where helm-bibtex is not activated? Would you like to get an error message like Error: helm-bibtex not activated? If yes, why?

@hongyi-zhao
Copy link
Author

My simple idea is that this package should only be used when preparing documents with LaTeX. Therefore, I have filed this issue.

@tmalsburg
Copy link
Owner

tmalsburg commented May 17, 2023

The purpose of this package is not just to support LaTeX authoring. I use it productively in many other scenarios. For instance, when a student asks me for the most important papers about topic X. To answer this, I start an e-mail, fire up helm-bibtex, select these papers, and then insert their references into the e-mail ("Insert reference" from action menu). Done.

If you don't want to use helm-bibtex outside LaTeX documents, the easiest solution is just to ignore it. No need to deactivate it, since it's not doing much anyway when you don't use it.

@hongyi-zhao
Copy link
Author

hongyi-zhao commented May 17, 2023

Thank you for sharing your ideas and examples of usage scenarios. As a result, the :demand t should be used when using it via use-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants