Questions tagged [command-line-arguments]

54 questions
12
votes
3 answers

Launch emacs with ediff-files (of ediff-directories) from command line

I would like to launch emacs to ediff either files or directories. For example, I'd like something like: emacs -f ediff-files file1 file2 But when I do this, it doesn't take file1 and file2 as the two files to diff. Rather, emacs prompts me for…
9
votes
1 answer

emacs --eval of multiple functions on command line

How do I evaluate multiple functions simultaneously using emacs --eval on command line? For example I want to combine the followings in a single command: emacs --eval "(toggle-frame-maximized)" emacs --eval "(sr-speedbar-toggle)" I tried to wrap…
8
votes
1 answer

How to execute named code blocks written in any language using a shell script?

History Recently, I cobbled together a shell script that can execute a named code block from inside an org-mode file using the command-line. I copied source code directly from the org-mode manual and the org-babel-open-src-block-result function…
Melioratus
  • 4,504
  • 1
  • 25
  • 43
7
votes
1 answer

Run elisp from command line in running emacs

How can I execute elisp in the currently running emacs from the command line? The following command echoes 'hi' but doesn't set 'abc in the emacs instance. emacsclient --no-wait --eval '(message "hi") (setq abc)' Is there a way to modify emacs from…
Joe
  • 1,312
  • 1
  • 8
  • 19
6
votes
4 answers

How do you run Emacs on mac?

I find running the following is different from just running emacs on mac /Applications/Emacs.app/Contents/MacOS/Emacs -nw Should I create an alias in zsh/bash for it?
eugene
  • 481
  • 1
  • 5
  • 11
6
votes
1 answer

Preset search isearch-string from command line

I am trying to set isearch-string from the command line. The purpose is to have a Perl script start Emacs with a given search string, and go directly to the first line of the string and enter search mode. For example: $ emacs +2 t.txt -l srep.el…
Håkon Hægland
  • 3,608
  • 1
  • 20
  • 51
5
votes
2 answers

Parse command line arguments in interactive session

I'd like to pass some extra information to my init.el via command line arguments. However, the variable command-line-args-left is always nil when Emacs is run interactively. (Though it is correctly populated when run with the --script option). How…
PythonNut
  • 10,243
  • 2
  • 29
  • 75
5
votes
1 answer

Cannot get Magit to show the commit signatures in the log

In order to prove that I had a signature on a commit I needed to use a this command line command: $ git log --show-signature -1 I could not get Magit to display the signature I tried to use the Magit Key (l) and the -S switch. But could not see…
sanug
  • 67
  • 6
5
votes
3 answers

Update spacemacs packages from the command line

I'm trying to write a shell function to launch (spac)emacs, update packages, and then restart emacs in daemon mode. I tried this, but it hangs: emacs --daemon && emacsclient -e '(progn (configuration-layer/update-packages))'
Sid Raval
  • 191
  • 6
5
votes
0 answers

Is there some way to continue reading from a STDIN file descriptor when data is PIPED to Emacs on Command-line?

Historical Perspective On Unix like operating systems, it is common practice to redirect IO between shell commands using pipes. For example, the command below would insert all the lines that didn't match "10.1.2.3" into the *scratch* buffer in…
Melioratus
  • 4,504
  • 1
  • 25
  • 43
5
votes
1 answer

emacsclient directly start eshell command command line

Both of the following work to call a graphical/terminal eshell: emacs -f eshell emacs -nw -f eshell Furthermore, this 2-step process also works: `emacsclient -t -a '' /some/real/file/name Metax eshell BUT, this does not: emacsclient -t -a '' -f…
5
votes
2 answers

What is the difference between --load vs --script options?

man emacs: --script file Run file as an Emacs Lisp script. -l file, --load file Load the lisp code in the file file. I think that --load uses usual convention to boot from compiled file version firstly and --script does not. But I am…
gavenkoa
  • 3,352
  • 19
  • 36
4
votes
3 answers

Set an Elisp var on the command line and read it in the init file

I'm trying to set a variable at load-time: # emacs --eval '(defvar myvar t)' Now, in this session, if I C-h v myvar RET I get a nice t. But if I put (message "MYVAR: %s" myvar) in my init file, I get a nasty Symbol's value as variable is void:…
yPhil
  • 963
  • 5
  • 22
4
votes
1 answer

How to run emacs function from the shell

I would like to: run an emacs function from the shell in a standard emacs session (configured as if it was run in an interactive session) with a certain file in the active buffer So I would like to do something like: emacs --function…
blueFast
  • 295
  • 2
  • 8
4
votes
1 answer

From an external script, open file and run some simple expression whether emacs already running or not

Context / initial need (works fine) I wrote and use a script that generates a file and uses emacsclient to edit it in an existing or new instance of emacs, in a new window. Similar to Set up Emacs on Windows to start a single instance and open files…
1
2 3 4