To load helm-mini every-time when emacs starts, I use the following line in my .emacs file as suggested in https://emacs.stackexchange.com/a/26402/2323

(add-hook 'emacs-startup-hook #'helm-mini)

This in particular avoids that helm-mini is loaded if I execute eval-buffer after changing my .emacs-file.

However there is another problem with it: If I start emacs from command line like emacs myfile.tex, emacs opens the file myfile.tex but also opens helm-mini. How can I make emacs not to load helm-mini in this case?

1 Answer 1


The variable command-line-args contains the command line ("emacs") when there are no arguments and ("emacs" "myfile.tex") when you invoke it for myfile.tex. The simplest thing I can think of doing here is to check the length:

(when (< (length command-line-args) 2)
  (add-hook 'emacs-startup-hook #'helm-mini))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.