Questions tagged [command-line-arguments]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
39 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 ...
user avatar
1 vote
2 answers
42 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 ...
user avatar
0 votes
0 answers
31 views

How to process command line arguments in an elisp script?

Using Emacs as a scripting language, how can the remaining arguments be parsed with handlers? Such as command-switch-alist and command-line-functions? #!/usr/bin/env -S emacs --script (message "...
user avatar
  • 7,179
0 votes
0 answers
80 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 ...
user avatar
  • 11
1 vote
1 answer
68 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 ...
user avatar
  • 553
1 vote
0 answers
145 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 ...
user avatar
  • 7,179
0 votes
0 answers
259 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. ...
user avatar
  • 273
0 votes
0 answers
63 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 ...
user avatar
  • 553
0 votes
0 answers
163 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 ...
user avatar
  • 607
1 vote
1 answer
71 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 -...
user avatar
1 vote
1 answer
98 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 ...
user avatar
  • 2,025
0 votes
1 answer
160 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 ...
user avatar
3 votes
0 answers
426 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 ...
user avatar
  • 133
0 votes
1 answer
64 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 ...
user avatar
  • 193
3 votes
1 answer
227 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 ...
user avatar
2 votes
1 answer
90 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 ...
user avatar
4 votes
3 answers
7k 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?
user avatar
  • 355
4 votes
1 answer
263 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 ...
user avatar
  • 57
1 vote
1 answer
183 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 ...
user avatar
  • 11
3 votes
1 answer
87 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?
user avatar
2 votes
2 answers
562 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?
user avatar
  • 140
0 votes
1 answer
121 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 ...
user avatar
0 votes
1 answer
93 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 ...
user avatar
0 votes
1 answer
45 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] ...
user avatar
  • 3,435
1 vote
2 answers
825 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....
user avatar
  • 141
2 votes
2 answers
361 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 ...
user avatar
3 votes
1 answer
672 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 ...
user avatar
  • 4,224
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 (...
user avatar
  • 191
3 votes
1 answer
92 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 ...
user avatar
2 votes
0 answers
181 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-...
user avatar
  • 7,179
1 vote
1 answer
151 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-...
user avatar
  • 7,179
2 votes
2 answers
532 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 ...
user avatar
  • 821
0 votes
2 answers
1k 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 ...
user avatar
3 votes
1 answer
930 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 ...
user avatar
  • 537
7 votes
1 answer
3k 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 ...
user avatar
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 ...
user avatar
  • 4,224
5 votes
0 answers
163 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 ...
user avatar
  • 4,224
3 votes
1 answer
2k 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 ...
user avatar
  • 285
7 votes
1 answer
1k views

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"...
user avatar
  • 1,272
5 votes
1 answer
485 views

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 ...
user avatar
2 votes
1 answer
352 views

Emacsclient not focusing if called with --eval argument from terminal

I wish to call man function in emacsclient when I typing "man smth" in terminal. When I open files from iterm via emacsclient - emacs gaining focus and when I kill buffer - terminal gaining focus back....
user avatar
  • 1,151
4 votes
1 answer
943 views

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 ...
user avatar
5 votes
2 answers
740 views

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 ...
user avatar
  • 3,132
3 votes
2 answers
1k views

How can I override initial-buffer-choice if I specify a filename at command line?

In my .emacs file I have the following line in custom-set-variables: '(initial-buffer-choice "~/Programming/C++/<some project I'm working on>") This works great. However, I use emacs to edit ...
user avatar
1 vote
1 answer
1k views

Open "emacs -nw" and running a command from bash

I would like to know if it is possible, with a single command from bash, to open a file with emacs -nwand execute a command in the same time, for example goto-line 20.
user avatar
  • 413
4 votes
1 answer
187 views

How to specify the buffer mode on the command line?

I want to open a file in makefile-gmake mode. Is there a way to do this from the command line? I'm looking for something like: $ emacs -m makefile-gmake filename I do not want to change any config ...
user avatar
  • 143
1 vote
1 answer
209 views

Switch to buffer conditional to no file having been specified in the command line?

On startup, I want to create an empty buffer and switch to it, but only if no file has been specified in the command line. The closest I have is (switch-to-buffer "untitled") at the end of init.el ...
user avatar
  • 461
5 votes
2 answers
526 views

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 ...
user avatar
  • 10k
9 votes
3 answers
4k views

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 ...
user avatar
6 votes
1 answer
451 views

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 ...
user avatar