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

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
  • 107
0 votes
0 answers
25 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
131 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
  • 4,563
0 votes
1 answer
126 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
46 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
122 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
123 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,546
0 votes
0 answers
76 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
146 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
39 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
149 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
  • 239
1 vote
1 answer
75 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
660 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
489 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
300 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
473 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,389
0 votes
1 answer
390 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,938
1 vote
1 answer
241 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
569 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
112 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,963
1 vote
1 answer
1k 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
58 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
458 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
82 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
81 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
  • 22k
6 votes
1 answer
263 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
561 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,450
2 votes
1 answer
508 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
18 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