Questions tagged [command-line-arguments]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
2answers
28 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
0answers
22 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 "...
0
votes
0answers
59 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
1answer
49 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
0answers
87 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
0answers
195 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
0answers
48 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 ...
0
votes
0answers
131 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
1answer
62 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
1answer
67 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
1answer
124 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 ...
2
votes
0answers
320 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
1answer
62 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
1answer
189 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
1answer
78 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 ...
4
votes
3answers
5k 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?
3
votes
1answer
229 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
1answer
168 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
1answer
85 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?
2
votes
2answers
523 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
1answer
107 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
1answer
90 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
1answer
43 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
2answers
764 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
2answers
356 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
1answer
574 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
3answers
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
1answer
84 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 ...
1
vote
0answers
169 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-...
1
vote
1answer
146 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-...
2
votes
2answers
482 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
2answers
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 ...
3
votes
1answer
860 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 ...
6
votes
1answer
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 ...
7
votes
1answer
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
0answers
158 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 ...
3
votes
1answer
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 ...
5
votes
1answer
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"...
4
votes
1answer
433 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 ...
2
votes
1answer
332 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....
4
votes
1answer
922 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 ...
5
votes
2answers
705 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 ...
3
votes
2answers
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 ...
1
vote
1answer
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.
4
votes
1answer
186 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 ...
1
vote
1answer
206 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 ...
5
votes
2answers
500 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 ...
9
votes
3answers
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 ...
6
votes
1answer
429 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 ...