5
votes
Accepted
Obtaining a backtrace on batch invocation of Emacs?
Is there a more idiomatic method for displaying backtraces for errors in batch mode?
Nope, that's pretty much it. You can save a few characters by calling toggle-debug-on-error instead:
emacs -...
5
votes
Export an org-mode file as a PDF via command line?
I'm using self-compiled emacs 27.0.9x on Linux and macOS. To generate my presentations, I use org-mode.
emacs -Q \
--batch "(require 'ox-beamer)" \
<input>.org -f org-beamer-export-to-pdf
...
4
votes
Accepted
How to use emacs packages in emacs lisp scripting
You have to tell Emacs where to find the s library:
(add-to-list 'load-path "/path/to/s/")
Or if you put s in the same directory:
(add-to-list 'load-path ".")
4
votes
Accepted
Export all org-tables from batch mode
You can use org-table-map-tables for iterating over the tables of an Org file.
Example for the Shell command:
emacs --batch table.org --eval '(org-table-map-tables (quote org-table-export))'
You ...
4
votes
Batch mode, read NUL-delimited list of file names from stdin
As NickD analyzed, read-from-minibuffer reads one line at a time, and considers either CR or LF to end a line and doesn't distinguish between them. And I can't find another way to read from standard-...
3
votes
Batch mode, read NUL-delimited list of file names from stdin
Assuming I'm reading the code correctly, the keymap argument is ineffective when -batch is used. What happens is that read-from-minibuffer gets called and it, in turn, calls read_minibuf (Line 1318 in ...
3
votes
How to run elisp checking utilities from the command line?
See the function batch-byte-compile which implements the last of your asks. It is invoked as
emacs --batch -f batch-byte-compile *.el
to compile all the *.el files in the current directory. If you ...
3
votes
Make Emacs Line-Oriented
According to @NickD’s answer,
to make Emacs line-oriented just like Vim’s ex mode, use:
$ emacs -batch \
> -eval "(while t \
> (write-char ?\\n) \
> (...
3
votes
Accepted
Make Emacs Line-Oriented
emacs -batch can do that:
echo '(progn (find-file "123.txt") (replace-string "2" "0") (save-buffer))' | emacs -batch --eval "(call-interactively #'eval-expression)&...
3
votes
How to use emacs packages in emacs lisp scripting
--batch doesn't process your init file, so it has no idea where your personal libraries are.
Instead of (require 's) (which, as per clemera's answer, means you need to set load-path), you could simply ...
3
votes
Accepted
Using org in emacs batch mode
I presume you have access to org-latex-classes when you start
up Emacs for interactive use, so something in your init file is
loading it. You can check which library defines
org-latex-classes with C-...
Dan♦
- 33.4k
3
votes
Accepted
script to Ediff two files in running gui Emacs?
I use this to diff from bash. --eval is what I think you are looking for.
If you are not using emacsclient you can adjust the first portion accordingly.
ediff ()
{
if [ -d $1 ]; then
...
2
votes
Accepted
Running flyspell on Latex files in batch-mode
I presume that the question mentioned flyspell specifically because it knows about TeX syntax and is good at ignoring math, TeX commands, etc. Although aspell can also do this (more on that below), I ...
1
vote
Accepted
"unspecified-fg/bg" in "batch mode" when querying foreground/background colors
Emacs won't initialize the window system when launched by -batch:
When Emacs is started up, it performs the following operations:
If not running in batch mode, it initializes the window system that ....
1
vote
Accepted
How can I get the output of a batch emacs run to a custom path?
You will need to use a different function if you want to control where the export output goes. org-html-export-to-html uses the name of the Org mode file and saves it in the same directory with the ...
1
vote
Accepted
Specifying a subdirectory in the argument of :tangle: effect only non-interactively
[These are my original comments made into an answer -- but note that there is a mysterious mode change that is so far unexplained.]
I cannot reproduce the problem: interactively tangling the file ...
1
vote
Trying to update emacs from the command line, but add-hook won't fire
The documentation gives the answer.
Don't run this hook directly. It is meant to be run as part of
package--update-downloads-in-progress.
As a rule, -- in the name is an indication that it's a ...
1
vote
1
vote
Accepted
Can I use emacs to execute elisp files witout opening emacs?
You can use the --script flag to run an elisp file as a script:
#!/usr/bin/emacs --script
<-- Insert your elisp program here -->
See the manual page on Initial Options for more details.
1
vote
How can I export an org file to PDF in batch mode and have source code blocks executed?
As you found out, the problem is that --batch prevents Emacs from loading your init file. You can work around that by using something like
emacs --batch -l ~/.emacs ...
or
emacs --batch -l ~/....
1
vote
indentation (with multiline comments) in batch processing
Should just be a matter of setting the comment offset to always choose the current indentation:
(defun myindent ()
"Format the whole buffer."
(c-set-style "stroustrup")
;; `c' is for comment....
1
vote
Accepted
Readline emulation in batch mode
I ended up writing my own readline thing with the help of @ack006. It consists of a shell script enabling raw mode and sending one character at a time to an Emacs in batch mode which interprets the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
batch-mode × 32org-mode × 12
org-export × 7
themes × 2
script × 2
key-bindings × 1
latex × 1
init-file × 1
org-babel × 1
indentation × 1
debugging × 1
microsoft-windows × 1
hooks × 1
faces × 1
org-table × 1
font-lock × 1
files × 1
terminal-emacs × 1
minibuffer × 1
html × 1
start-up × 1
comment × 1
doom × 1
flyspell × 1
ediff × 1