Questions tagged [batch-mode]

Running Emacs non-interactively via the `--batch` command-line option.

Filter by
Sorted by
Tagged with
0 votes
1 answer
30 views

"unspecified-fg/bg" in "batch mode" when querying foreground/background colors

While writing tests for color-identifiers-mode I stumbled upon inability to make Emacs load background and foreground colors from a theme in "batch-mode". Example: emacs -batch --eval "(...
Hi-Angel's user avatar
  • 736
0 votes
1 answer
60 views

Running emacs in batch mode from command line doesn't work

Does anyone know if ox-koma-export.el can be invoked from command line: emacs --batch -e '(org-koma-letter-export-to-pdf)' letter.org Should emacs in general be universally reproducible from command ...
Daniel Krajnik's user avatar
0 votes
1 answer
51 views

How can I get the output of a batch emacs run to a custom path?

This works, but the output file is in the same directory as the source file: $ emacs ./notes.org --batch -f org-html-export-to-html --kill How can I get the output in a different directory? I tried ...
Pietro's user avatar
  • 121
0 votes
0 answers
36 views

How to run flycheck synchronously and programmatically

As part of some automated tests I'd like to include flycheck. However, I haven't found a way to invoke the checker programmatically and synchronously. I've tried something like: (progn (with-current-...
erjoalgo's user avatar
  • 863
2 votes
2 answers
142 views

Make Emacs Line-Oriented

I heard that Vim has an ex mode which is line-oriented. That means users can use the editor by echoing commands to it, e.g., bash$ echo "123" > 123.txt # 123.txt: 123 bash$ echo "...
shynur's user avatar
  • 5,288
0 votes
1 answer
175 views

Specifying a subdirectory in the argument of :tangle: effect only non-interactively

Recently, I added to this answer to the question “How to specify a directory to tangle all code blocks into”, the following comment: “AFAICS, specifying a subdirectory in the argument of :tangle ...
Denis Bitouzé's user avatar
0 votes
1 answer
49 views

Trying to update emacs from the command line, but add-hook won't fire

I want to update Emacs from the command line so I created the following function to help with this: ;;; update.el -- Update Emacs from the command line (defun update-emacs () "Update Emacs ...
Ricky Nelson's user avatar
3 votes
2 answers
139 views

Batch mode, read NUL-delimited list of file names from stdin

I am writing a batch Emacs script and I would like it to read a NUL-delimited list of file names to process from stdin. (NUL-delimited lists of file names are what you get from the Unix command find ....
zwol's user avatar
  • 272
3 votes
1 answer
158 views

How to run elisp checking utilities from the command line?

There are a number of emacs-lisp checking utilities - for example: checkdoc. package-lint. relint. byte-code-compilation. Are there existing ways to quickly run this on an entire project without ...
ideasman42's user avatar
  • 8,796
0 votes
0 answers
88 views

Ox-epub Window required for cover

When exporting in batch mode (for example in continuous integration) with ox-epub: emacs --batch main.org --eval="(package-initialize)" --eval="(require 'ox-epub)" --funcal org-...
DPD-'s user avatar
  • 251
1 vote
1 answer
159 views

Export all org-tables from batch mode

How can I export all the tables in org-mode file similar to that. * May :PROPERTIES: :TABLE_EXPORT_FILE: ~/Desktop/may.csv :TABLE_EXPORT_FORMAT: orgtbl-to-csv :END: |One|Two| |---+---| * June :...
Omar113's user avatar
  • 157
2 votes
0 answers
40 views

Aborting emacs batch mode when no user input available

I have a small script that runs the following command to export my org-mode agendas automatically: emacs -batch -l ~/.emacs.d/init.el -eval '(org-batch-store-agenda-views)' Occasionally, a required ...
FixMaker's user avatar
  • 121
0 votes
1 answer
161 views

Emacs org export shell script from txt file

I have a .txt file which is an org file but not with the .org file extension. I want to export the file to html on the command line, but it does not work if the file extension is .txt, only if the ...
user27815's user avatar
  • 249
1 vote
1 answer
93 views

Can I use emacs to execute elisp files witout opening emacs?

#!/usr/bin/clisp (write-line "Hello World") If I put this in a script it prints Hello World as expected. What I'm wondering is there a way to use emacs-nox instead of clisp in the shebang ...
Nifle's user avatar
  • 113
0 votes
0 answers
36 views

Emacs Is Auto-Escaping Periods From The Command Line

I'm attempting to run the profile-dotemacs.el script from the command line using Powershell on Windows. Here's what I'm trying to run emacs -Q -l C:\users\tom\Downloads\profile-dotemacs.el --eval "(...
Tom Purl's user avatar
  • 377
1 vote
2 answers
712 views

How to use emacs packages in emacs lisp scripting

I have the following emacs script from here #!/usr/local/bin/emacs --script ;;; rcat --- cat ;;; Commentary: ;;; cat function in elisp ;;; Code: ;;-*- mode: emacs-lisp;-*- (defun process (string) ...
anquegi's user avatar
  • 749
0 votes
1 answer
506 views

Batch convert local HTML webpages to plain text

Here is my zsh code function eweb() { emacsclient -t --eval "(eww-open-file \"$1\")" "(save-buffer \"$2\")" } There are two parameters, the first is the local webpage filename, for example, ./1....
yuxuan's user avatar
  • 781
5 votes
1 answer
1k views

How can I export an org file to PDF in batch mode and have source code blocks executed?

On Debian Stretch, I'm trying to export this file called test.org # -*- org-confirm-babel-evaluate: nil -*- #+OPTIONS: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline #+OPTIONS: author:t c:nil ...
Bill's user avatar
  • 161
2 votes
2 answers
314 views

indentation (with multiline comments) in batch processing

i'm trying to indent a couple of C++-files (and untabify them; and remove trailing whitespace), so i thought about using emacs in batch mode. Since I'm pretty much a noob when it comes to elpa (or ...
umläute's user avatar
  • 121
5 votes
1 answer
486 views

Obtaining a backtrace on batch invocation of Emacs?

The only way I know of printing a backtrace for errors in batch invocation of Emacs is by setting debug-on-error inline like so: $ emacs -batch --eval "(setq debug-on-error t)" -f "my/foo-function" ...
ebpa's user avatar
  • 7,479
0 votes
1 answer
411 views

script to Ediff two files in running gui Emacs?

I'm putting together a presentation that involves some live demos in the terminal. In one of the demos, I run a shell script that takes an input file, runs it through an Awk script, and generates a ...
ivan's user avatar
  • 1,948
1 vote
1 answer
244 views

Running flyspell on Latex files in batch-mode

I'd like to run flyspell on several Latex-files in the same directory and output all the words which are misspelled.
arvidj's user avatar
  • 65
3 votes
1 answer
591 views

Using org in emacs batch mode

I'd like to export an org file to LaTeX from the command line. I have created a file export.el with the following contents (simplified to reproduce the problem): (require 'org) (when (not (assoc "...
taerath's user avatar
  • 53
3 votes
0 answers
118 views

Loading a theme and fontifying in batch mode

Loading a theme in batch mode seems to not set face attributes: $ emacs -Q --eval "(load-theme 'tango t)" \ --eval "(prin1 (face-attribute 'font-lock-keyword-face :foreground)))" "#346604" ...
Clément's user avatar
  • 3,985
1 vote
1 answer
2k views

Run batch file from Emacs

So, I've made a little batch file that simply compiles all the code I need and moves it to their right places. I've seen some people using the compile function to launch something like the batch file ...
GiovaniAbel's user avatar
1 vote
0 answers
59 views

Why does end-of-line behave differently in --batch?

I have an elisp script that behaves differently between an interactive Emacs session and running Emacs with --batch. (defun call-fn-in-let (unused) (let (xx) (let (yy) (split-string "foo" ...
Wilfred Hughes's user avatar
3 votes
1 answer
477 views

Can I print output to stderr in batch mode WITHOUT a trailing newline?

In emacs --batch (also, emacs --script), (message "My Message") will print "My Message" to standard error (file descriptor 2) along with a trailing newline. What if I don't want the newline? I ...
Joel M Ward's user avatar
0 votes
0 answers
85 views

how do I evaluate elisp in a certain buffer from batch mode?

I want to evaluate some elisp with batch mode, but it only works in a certain (type-of) buffer. Specifically emacsclient --eval "(emms-playlist-mode-play-smart)" This command only works on an emms-...
Alejandro Erickson's user avatar
1 vote
1 answer
82 views

Readline emulation in batch mode

I wrote an interpreter by leveraging --batch, read-from-minibuffer and princ. Now, reading input is relatively limited, you can type consecutive characters, erase the last character with <...
wasamasa's user avatar
  • 22.2k
6 votes
1 answer
270 views

How to know if Emacs is running in batch mode

I have one file that needs to behave differently depending on whether Emacs is running in batch mode (non interactive) or normal mode. (if batch-mode-t a-func b-func) How can I detect this?
netawater's user avatar
  • 245
4 votes
1 answer
588 views

In emacs batch mode, how to evaluate/tangle a named source block in an org-mode file?

I have a org-mode file (test.org) as below: #+NAME: my-tangle-to-file #+BEGIN_SRC sh :tangle my_tangle_file.sh :dir /tmp :shebang "#!/usr/bin/env bash" me=$(basename $(test -L "$0" && ...
Enze Chi's user avatar
  • 1,470
2 votes
1 answer
521 views

How can I export many org documents to ASCII?

I have a directory ~/foo/ with hundreds of org documents among other types of files. I want to export each org file to ASCII. The only way I know how to do this is to follow the following procedure ...
Brian Fitzpatrick's user avatar
19 votes
2 answers
4k views

Export an org-mode file as a PDF via command line?

What command-line arguments do I use to get Emacs to export an org-mode file to a Beamer PDF? (I want to create a Makefile that produces a PDF when the user runs make.) I tried following this answer ...
Richard Hansen's user avatar