reddit / emacs

How to pass an emacs argument when calling it via a terminal?

maxle0312 · 2022-08-21 08:37
Hi all. I am using emacs in the terminal, mostly for quick editting of org files. I am on Linux, so I run emacs with: emacs -nw -Q --visit myfile.org This opens up terminal emacs really fast, without any config. Here, I would like to: \- disable menu bar mode (within emacs, it is `M-x menu-bar-mode` ) \- use evil mode and I dont want to reload the entire config file just to be able to use it Is there a way to pass these arguments to the command line when open emacs? Thanks
plm314 · 2022-08-21 08:47
You can use --exec to add arbitrary elisp code or you can load a separate (small) config file with -l. See here: https://www.gnu.org/software/emacs/manual/html_node/emacs/Action-Arguments.html
maxle0312 · 2022-08-21 09:41
Thank you so much. I manage to get the no menu mode, but still struggling with loading evil.el package. To get no menu, I try: `emacs -nw -Q --funcall=menu-bar-mode ` For the evil mode, I try to write a small config, small.el, with these contents: `(add-to-list 'load-path "~/.emacs.d/lisp/") (require 'evil) (evil-mode 1)` Then try to load it with: emacs -nw -Q --funcall=menu-bar-mode -l small.el But still could not get evil to load. Any pointers are appreciated.
maxle0312 · 2022-08-21 12:35
I figured it out, you need (package-initialize) before everything in the config file.
SasukeUchiha231 · 2022-08-21 14:05
Although the others have already said what you want, I would recommend chemacs, so that you could possibly have another light weight config file for the terminal
nv-elisp · 2022-08-21 14:22
The docs you've linked to have `--execute` rather than `--exec`.
deaddyfreddy · 2022-08-21 22:46
just use vi instead