Simply use (progn ). This should address your question:
emacs --eval "(progn (toggle-frame-maximized) (sr-speedbar-toggle))"
Please note that this does not execute the commands simultaneously (as you requested). It executes one command after another.
I'm pretty sure there are other solutions, but you can do this using --eval instead of -f (--funcall):
emacs --eval '(ediff-files "file1" "file2")'
In fact, the Emacs manual on "Command Line Arguments for Emacs Invocation" says that -f function and --funcall function
Call Lisp function function. If it is an interactive ...
Instead of trying to start emacs in daemon mode first and asking it to execute the package update, I'd recommend doing that after performing a scripted upgrade of the packages. To update the packages non-interactively, use the following:
emacs --batch -l ~/.emacs.d/init.el --eval="(configuration-layer/update-packages t)"
The key here is the --batch switch ...
See the documentation within emacs for more information.
The --script FILE option runs emacs in batch mode (See below to know more about this mode) and executes the code in the FILE.
This option implies the -q option.
The --load=FILE loads the FILE library using the load function (and tries to find that library in load-path if FILE is not an absolute path)...
I was able to do it by switching the order around
emacs -nw foo -f org-mode
After reading the help, if the function is a command, it is just like pressing a key command to do it. There's also the --file option and --find-file option, so I figured it is executing find-file when you put the filename on the command line, and would call these in order. So ...
I use the following script: it checks in advance if there are differences, and in case there are, it opens Emacs with the appropriate function evaluated. With the -d option, it assumes the items provided are directories, and ediff-directories instead of ediff-files is used; otherwise it checks if they are directories or files, and sets the function to use ...
What I recommend you to try is to start Isearch first and then yank your word to the search string, effectively doing the same what you would do manually to add words in isearch-mode:
(defun my-search-word ()
(isearch-forward nil 1)
If you need to match word boundaries, then try this:
In you progn, you do load org-babel, but don't load any extra languages:
It does work in your regular Emacs session because these are obviously loaded somewhere in your init.el
So I've saved your script and edited it like this:
# -*- mode: shell-script -*-
# Call named code ...
This should do what you want. If you don't have the file open, you may need to replace the switch-to-buffer function to something that opens the file.
emacsclient -e '(progn (switch-to-buffer "my-presentation.org") (org-beamer-export-to-pdf))'
You can either wrap your two forms in a progn:
emacsclient --no-wait --eval '(progn (message "hi") (setq abc 123))'
Or you can send them separately:
emacsclient --no-wait --eval '(message "hi")' '(setq def 456)'
Surprisingly (at least to me), the -f flag means different things to emacs and emacsclient. To emacs, it means:
Call Lisp function FUNCTION. If it is an interactive function (a
command), it reads the arguments interactively just as if you had
called the same function with a key sequence. Otherwise, ...
Here's a generic solution to eval some elisp expression after launching emacs
For your example, that will be
emacs -nw --eval="(goto-line 20)" FILE
Also check out the --load option from the below referenced link if you want to load an elisp file instead of writing elisp at command line.
This doesn't work because command line options are processed after the init file. This allows the command line to refer to functions and variables defined or loaded in the init file, and allows the init file to declare additional options.
To run something before the init file, you can force a different load order:
# emacs --no-init-file --eval '(defvar ...
Command line arguments are processed in-order. So your -f diff-mode will put into diff-mode whichever buffer happens to be current right after Emacs has started (most likely it will be the *scratch* buffer). The next argument will probbaly look like /.../COMMIT_EDITMSG and will cause Emacs to load that file into some new buffer using some other major mode, ...
Arguments are deleted after being processed at startup, you can either handle them like sds specified or if you'd like the list of args given after start up, save the contents of command-line-args at the start of your init.
(setq my-save-args command-line-args)
Though if you're planning on passing custom args, you'll need to handle them during startup.
The --show-signature argument can be selected in the log popup but it is not actually passed to git log. Instead %G? is added to the value of the --format= argument.
That (%G?) causes some letter to be printed for each commit and the code that parses the log output detects that letter and uses it to determine what face should be used to display the commit ...
The -F flag takes an alist (short for association list), which is a list where each element is a cons cell of the form (parameter . value). One of the available parameters is font, so to specify e.g. "Consolas 12", you'd say
emacsclient -F '((font . "Consolas 12"))'
New windows not getting focus seems to be an issue with the OS/window manager, not Emacs.
There are a lot of search results suggesting various hacks at either the Emacs or OS level, but my preferred solution is to use the scripts suggested by MJ Wall. These have explicit raise-frame actions.
I think you should be able to do something like this:
emacsclient -e '(pp (with-temp-buffer (insert-file-contents "my-file-containing sexp") (read (current-buffer))))'
The problem is that this will print a string (e.g., "[foo\n bar]"), so to see it on the screen you will need
echo -e $(emacsclient ...)
You can control the behavior of pp with many ...
First you should run (server-start) within emacs. This can be put in your init file.
The command you are looking for is emacsclient --no-wait --alternate-editor=emacs. You can put this behind an alias if you want. This will open the files on the existing server and frame if there is one, and will otherwise run emacs as usual. The --no-wait is optional and ...
Is it possible to set Emacs start-up command-line flags such as -nw and -q in an init file? If it is, how can I do that?
In general, no, you can't do that -- and your second example option is precisely what I would have used to explain why:
-q (aka --no-init-file) tells Emacs not to load your init file, so trying to set that option in your init file does ...
You can modify the command line arguments in an init file if you want. But if you do that after Emacs has processed the argument, it won't have any effect.
Emacs processes command line arguments in two places: in the C startup code, and in startup.el. The C startup code processes arguments before it executes any Lisp code, so there's no way to influence ...
I would like to run convert - -draw 'rectangle 0,0,100,100' -
Note that you're quoting for the shell there, so that it will not break that argument into two, on account of the space.
For example I tried (call-process-region (point-min) (point-max) "convert" t t nil "-" "-draw" "'rectangle 0,0,50,50'" "-")
Basically, Emacs exits before the subprocess has exited. All you have to do is delay the exit until the subprocess has exited. Since Emacs does not have anything useful to do, you can have it sleep for a while. The following sleeps in a loop until the subprocess does not appear in the process list any longer:
#!/usr/bin/env -S emacs -Q --script # -*- mode: ...
You can pass options to Emacs to make it run code when it starts: -l /path/to/file.el, -f function-called-without-arguments, --eval "(some-lisp-code 'taking-care-of \"quoting for the shell\")".
The function gdb is autoloaded, so you don't need to load a package explicitly. It takes an argument. You'll have to write some Lisp code to grab it from the command ...