Questions tagged [batch-mode]

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

30 questions
16
votes
2 answers

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 but couldn't get it to work: $ emacs --batch…
Richard Hansen
  • 495
  • 4
  • 15
6
votes
1 answer

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
  • 245
  • 1
  • 6
5
votes
1 answer

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 creator:nil d:(not "LOGBOOK") date:t e:t #+OPTIONS:…
Bill
  • 161
  • 5
4
votes
1 answer

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" Is there a more idiomatic method for displaying…
ebpa
  • 7,319
  • 26
  • 53
3
votes
2 answers

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 ... -print0 among other things.) I understand…
zwol
  • 272
  • 1
  • 8
3
votes
1 answer

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 having to access each individually (for every…
ideasman42
  • 8,375
  • 1
  • 28
  • 105
3
votes
1 answer

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 "scrreprt" org-latex-classes)) (push '("scrreprt" …
taerath
  • 53
  • 3
3
votes
0 answers

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" $ emacs --batch -Q --eval "(load-theme 'tango…
Clément
  • 3,924
  • 1
  • 22
  • 37
3
votes
1 answer

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 see that theoretically, (princ "My Message"…
3
votes
1 answer

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" && readlink "$0" || echo "$0")) echo "I was tangled to a file…
Enze Chi
  • 1,410
  • 12
  • 28
2
votes
2 answers

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 "s/2/0 > w" | vim -e 123.txt # replace "2" with "0", then save…
shynur
  • 4,065
  • 1
  • 3
  • 23
2
votes
0 answers

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 agenda file is missing or unavailable, which…
FixMaker
  • 121
  • 2
2
votes
2 answers

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 lisp in general), i searched the web and came up…
umläute
  • 121
  • 3
2
votes
1 answer

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 open each file with emacs and issue C-c C-e t…
Brian Fitzpatrick
  • 2,265
  • 1
  • 17
  • 40
1
vote
1 answer

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 :PROPERTIES: :TABLE_EXPORT_FILE:…
Omar113
  • 157
  • 4
1
2