Questions tagged [batch-mode]
Running Emacs non-interactively via the `--batch` command-line option.
29
questions
0
votes
1
answer
42
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 ...
0
votes
1
answer
34
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 ...
3
votes
2
answers
63
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 ....
3
votes
1
answer
53
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 ...
0
votes
0
answers
45
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-...
0
votes
0
answers
39
views
How to delay execution of code after handling command line argument but also running it in batch mode?
According to ELisp manual, the emacs-startup-hook is run, once, just after handling the command line arguments. In batch mode, Emacs does not run this hook.
Is there a standard way of delaying code ...
1
vote
1
answer
75
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
:...
2
votes
0
answers
34
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 ...
0
votes
1
answer
101
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 ...
1
vote
1
answer
38
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 ...
0
votes
0
answers
31
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 "(...
0
votes
2
answers
343
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)
...
0
votes
1
answer
423
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....
5
votes
1
answer
838
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 ...
2
votes
2
answers
246
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 ...
4
votes
1
answer
376
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"
...
0
votes
1
answer
305
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 ...
1
vote
1
answer
220
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.
3
votes
1
answer
503
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 "...
3
votes
0
answers
84
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"
...
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 ...
1
vote
0
answers
52
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" ...
3
votes
1
answer
359
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 ...
0
votes
0
answers
72
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-...
1
vote
1
answer
77
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 <...
6
votes
1
answer
211
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?
3
votes
1
answer
433
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" && ...
2
votes
1
answer
448
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
...
16
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 ...