Questions tagged [command-line-arguments]
The command-line-arguments tag has no usage guidance.
62 questions
1
vote
1
answer
63
views
Why this command line argument does not work when an emacs server is not running?
If an emacs server is already running, the following command opens an emacs frame and switches to *scratch* buffer.
"emacsclientw" -na "runemacs" -e "(switch-to-buffer \"*...
0
votes
0
answers
32
views
`async-shell-command: Wrong type argument: sequencep, #<buffer *scratch*>`
This is not a question about switching to the scratch buffer but to understand why the error is produced and to correct the function.
By running the following command from command line, I can switch ...
0
votes
0
answers
55
views
How to setup ediff-merge-files to interactively either save the mergebuffer or abort the merging when calling from the command line
I want to merge the two files $FILE1 and $FILE2 via emacs(client) into a $FILE3 on the command line with a way to abort the merge.
I tried
emacsclient --eval '(ediff-merge-files "'$FILE1'" &...
1
vote
1
answer
55
views
How to switch to a buffer from terminal with a unique partial name
I have a buffer with the name very-long-name-xyz-etc. This buffer is the only buffer whose name contains xyz.
From terminal I can switch to that buffer using the following
emacsclientw -cna runemacs --...
2
votes
1
answer
163
views
How to setq a variable for a script in the command line?
I was confused by this problem when I tried to setq a switch variable for an Elisp script in the command line.
So I had a script ~/tmp/test.el referring to a variable: (message "foo %S" foo),...
1
vote
1
answer
357
views
How do I start non-GUI Emacs on the commandline?
How do I start non-GUI Emacs on the commandline?
emacs-no-x11 doesn't seem to be in recent Emacs versions.
1
vote
1
answer
44
views
Emacsclient.exe -- How Load elisp from Command Line Argument --"-l" Option Not Recognized
Windows 7
emacs 28.2
Is there a way to load an elisp program from the command line when running the emacsclient?
emacsclient.exe doesn't recognize the "-l" command line option.
This works: \...
0
votes
1
answer
35
views
Custom `command-line-1` for `emacsclient`
I've put a custom definition of command-line-1 in my early-init.el which works for for calling emacs but not for calling an emacsclient. How can I make it work in the latter case?
2
votes
1
answer
48
views
FILE(s) Passed by Shell to Emacs to Visit
The FILE mentioned in the title, is what in
$ emacs FILE
or
$ emacs -file FILE
or something else similar.
How do I know whether there’s a FILE / FILEs set for Emacs to visit at startup?
If there’...
2
votes
1
answer
345
views
How can I start emacs in "headless" mode?
I'm configuring a .emacs.d folder for putting inside a Docker container. On Docker, I need to install all the tools that I want on my image while I'm building the image. Even though I can properly put ...
1
vote
2
answers
69
views
What variable holds filenames specified on Emacs command line?
What variable can Emacs Lisp access, to know the filenames specified on the command line that was used to invoke this Emacs session?
The general command-line-args contains the remaining command-line ...
0
votes
1
answer
173
views
How to give command-line arguments (sys.argv) when executing python session in Orgmode
I want to run my python code (that'll eventually become standalone python script) in org-mode.
This script requires command line arguments (provided by sys lib's sys.argv).
How do I execute python ...
0
votes
1
answer
137
views
How to display commit signature information in Magit Rev mode when visiting a commit?
Magit displays signature information in the magit-revision buffer when visiting a tag, but I can't seem to configure this behaviour when visiting a commit using the default bindings for magit-visit-...
0
votes
2
answers
501
views
How to always work from a daemon and always reuse an existing frame? (bonus: do it with chemacs2)
I'm new to emacs. I'm a spacemacs implant, really love ORG mode and evil mode. Been using for the past year or so.
I've read some of the emacs documentation, which is fantastically written. But I'm ...
1
vote
2
answers
213
views
Is there a way to get the name of the current file being opened?
I'm trying to conditionally load configuration in my init.el. How can I get the filename (preferable the extension) of the current file being opened?
For example, if I run emacs foo.rs, I'd like to ...
0
votes
0
answers
239
views
Kill buffers - how to make *scratch* and *Messages* last
Any setting I can use to get back the old behavior where killing a buffer I get to the next buffer for the files I have given on the command line?
I have been using Emacs like this for years
Open ...
1
vote
1
answer
198
views
How do I open an inferior Python process in a full window from the command line?
From the command line, I want to open an inferior Python process in a full window. I have tried: emacs --eval '(run-python)', but when Emacs opens, the *scratch* buffer is shown instead of the ...
1
vote
0
answers
459
views
How to evaluate elisp --batch after the init file has loaded?
I would like to run code on the command line using the environment created by my own (early-init.el & init.el).
emacs --eval '(message "%S" load-path)' --batch
... it doesn't show paths ...
0
votes
0
answers
547
views
How do I run an Emacs function from the terminal with an argument?
I want to install icon font for that I need to run all-the-icons-install-fonts function. According to the documentation I have to type: emacs --batch -f all-the-icons-install-fonts in the terminal. ...
0
votes
0
answers
205
views
How to start SLIME in a full window from the command line
I am looking for command-line solution for starting SLIME in a full window when starting Emacs. I need a command-line solution because I do not always want to start SLIME when starting Emacs (only ...
1
vote
0
answers
308
views
How can I tangle a specific org mode header from commandline?
$ cat foo.org
* A
#+begin_src text :tangle a.txt
123
#+end_src
* B
#+begin_src text :tangle b.txt
456
#+end_src
Now I change 123 to 1234 and save foo.org
$ cat foo.org
* A
#+begin_src text :tangle ...
1
vote
1
answer
227
views
How can I run a subprocess with emacs --script
I'm trying to write a script using emacs --script and in it I am using start-process, because I want to use set-process-filter.
The following does nothing if run as a script:
#!/usr/bin/env -S emacs -...
1
vote
1
answer
318
views
How to send quoted argument to call-process
I want to use the imagemagick convert command to draw on a image file. I have the image data as raw-text in a buffer and now I would like to run convert - -draw 'rectangle 0,0,100,100' - on it (the ...
0
votes
1
answer
362
views
reverse buffer order
I open Emacs from the command line to inspect 10+ files, say like this:
emacs *.java
However, all the files are listed in reverse order. This is getting kind of annoying--I'd like to start with the ...
3
votes
0
answers
757
views
how do I install emacs packages from the command line?
I'm attempting to automate deployment of my different machines by scripting installation of emacs and emacs packages. While I realize that I can set up my .emacs file to automatically install packages ...
0
votes
1
answer
70
views
Linux command line to launch gnuemacs
I would like to launch Emacs by typing a command line in the terminal in Ubuntu linux. I want Emacs to open file a.txt in one frame and another file b.txt in another frame.
I tried the command *emacs ...
3
votes
1
answer
364
views
How to activate diff-mode from command line?
Git's editor config is set to launch emacs in no-window mode and to execute lisp function diff-mode:
git config --global core.editor "emacs -nw -f diff-mode"
However, when I execute git commit -v to ...
2
votes
1
answer
180
views
Invoke emacsclient with a smaller font
For a certain application, I would like to start up emacsclient, but with a slightly smaller font. I can do it for a running emacs by eval'ing:
(set-face-attribute 'default nil :height 90)
But how ...
7
votes
5
answers
23k
views
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?
7
votes
1
answer
523
views
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 ...
1
vote
1
answer
210
views
starting emacs from the commandline and setting line wrap to 60 - howto?
I'm new with Emacs and come from Joe.
There I started editing mail from the command line by
joe -rmargin 60
because I don't want to generally set the right margin to 60.
I can't find a similar ...
3
votes
1
answer
89
views
Why won't `emacs -nw -f org-mode foo` open `foo` in `org-mode`?
I want to open a file foo in org-mode on the terminal. However, Issuing emacs -nw -f org-mode foo opens foo in Fundamental mode. What's wrong with my command?
3
votes
2
answers
877
views
How can I set command-line parameters through `.emacs` file?
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?
0
votes
1
answer
194
views
How to make `emacs` shell command switch to existing emacs process, if it exists?
Is there a way to get the emacs shell command (the UNIX utility) to start an emacs process, if none exists, but if one does, switch to it?
More specifically, is there a way to get the command emacs ...
0
votes
1
answer
124
views
emacs (v24.3.1): command line '--' before the file name
I have a RHEL 7 box, and I've installed emacs onto it (v24.3.1). This version of Emacs seems to be broken. You used to be able to edit by entering a command like this:
emacs -- somefilename.txt
and ...
0
votes
1
answer
50
views
How input all params from console without interactively?
Here snippet of my elips function:
(defun log-report (filePath uniqueText)
"Create log4j record report from any log4j (e.g.traceXXX.log) files. Log4j level MUST be in square brackets. e.g.: [DEBUG] ...
1
vote
2
answers
1k
views
Run gdb from the command line
I use emacs/gdb for debugging. Generally, I
emacs
M-x then type gdb
type exe name.
Every debug, I've gone through these 3 steps.
I want to know: is it possible to run gdb from the command line, e....
2
votes
2
answers
380
views
Windows 10 native (spac)emacs install can't call cygwin binary (ledger) with proper path passed
I'd like to use Windows (10) native Emacs (spacemacs) and ledger (both installed via Chocolatey). The finance layer from spacemacs provides integration for it, however when I tried to run a simple ...
3
votes
1
answer
1k
views
How to call org-lint against org-mode file from command-line
I am configuring a CI/CD pipeline to process org-mode files into documentation, source code, and other file formats.
I would like to add a call to org-lint to do basic syntax checking against org ...
5
votes
3
answers
2k
views
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 (...
3
votes
1
answer
151
views
Emacs 25.3.2: reverse windows on files opening
If I open 2 files by command line:
emacs file1 file2
in Emacs 25.3.2, file2 is opened in the upper window and file1 in the lower.
This didn't happen in previous versions of Emacs that had the ...
2
votes
0
answers
235
views
Possible to pass arguments to emacsclient alternate-editor?
Currently this works:
emacsclient ..args.. --alternate-editor=some_editor
However this does not:
emacsclient ..args.. --alternate-editor="some_editor --args"
Is there a way to call the alternate-...
2
votes
1
answer
231
views
How to open a file using eval that works with '--alternative-editor'
The following command works to open a file in an existing emacs instance:
emacsclient --eval \
"(progn (find-file \\"/a/b.txt\\") (goto-line 1) (forward-char 2) (recenter))" \
--no-wait \
--alternate-...
4
votes
3
answers
855
views
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 ...
0
votes
2
answers
2k
views
How to use OSX command line GUI emacs as git $EDITOR
I have a script to launch OSX GUI emacs from command line at:
/usr/local/bin/emacs
The script looks like:
#!/bin/sh
$(/Applications/Emacs.app/Contents/MacOS/Emacs --chdir $PWD "$@") &
I have ...
3
votes
1
answer
1k
views
Pretty print s expressions from the command line
I've got a file containing an emacs s-expression and I want to pretty print it from the command line: Is there an easy way of doing this? Paranoia suggests I want to do as little parsing of this data ...
10
votes
1
answer
4k
views
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 ...
8
votes
1
answer
3k
views
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 ...
5
votes
0
answers
234
views
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 ...
4
votes
1
answer
3k
views
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 ...