Questions tagged [script]

28 questions
8
votes
2 answers

Print process output line by line

Read process output line by line gives some partial ideas about how to deal with sub-process output in an intelligent manner, but no example and no working solution. I have a couple of examples, one of them works (badly) and the other doesn't. To…
Joe Corneli
  • 1,786
  • 1
  • 14
  • 27
5
votes
3 answers

How can I detect if an elisp script is piped?

I want to be able to tell whether stdout is a pipe in an elisp script. This would allow to distinguish between: $ emacs --script foo.el and $ emacs --script foo.el | cat Is this possible in Emacs lisp? Most programming languages have this in the…
Wilfred Hughes
  • 6,890
  • 2
  • 29
  • 59
5
votes
2 answers

How can I script an emacs recording session?

Recording a GIF screencast of Emacs details a few ways we can record screencasts of Emacs sessions (e.g. to demonstrate features), but I'm really bad at not screwing things up :-) Is there a way to script a session such that I can fake proficiency…
Sean Allred
  • 6,861
  • 16
  • 85
4
votes
3 answers

How to add a new input method for Syriac script in Emacs?

I want to write an article in English mingled with Syriac script in emacs, when I hit list-input-methods the script is not shown, or at least I couldn't identify this language in the displayed list. However, I am using a machine running Linux Ubuntu…
doctorate
  • 1,789
  • 16
  • 39
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
2 answers

Emacs script to indent files from the command line

I am trying to create an Emacs script that indents HTML files from the command line. This is what I have so far: #!/usr/bin/env -S emacs --script (require 'web-mode) (indent-region (point-min) (point-max) nil) (save-buffer) I saved this file as…
2
votes
1 answer

Print shell-command output to STDOUT?

Is there an equivalent of C's system(char*) or Python's os.system(string) for emacs --script? I want to use Emacs for shell-scripting purposes. However, I cannot find a function that allows running an executable in a subprocess and connectings its…
kdb
  • 1,561
  • 12
  • 21
2
votes
1 answer

emacsclient's "--script" option alternatives

To run an elisp file hello.el with emacs in cli, do simply $ emacs --script hello.el However, a naive try for emacsclient fails, as --script is not an option of emacsclient. $ emacsclient --script emacsclient: unrecognized option '--script' Try…
Student
  • 225
  • 1
  • 7
2
votes
2 answers

Slurp standard-input into a buffer

How do I read the entire contents of stdin into an Emacs buffer in #! /usr/bin/env emacs --script mode? Stdin may not be a regular file.
Lassi
  • 377
  • 1
  • 7
2
votes
1 answer

Is --script a valid emacs switch?

When I execute emacs --batch --script=/home/jim/test.el --no-site-file --file=testing I get: Cannot open load file: no such file or directory, /home/jim/--script=/home/jim/test.el While emacs --help shows --script in its list of options, executing…
Jim
  • 21
  • 1
2
votes
1 answer

Can I call a python script from emacs?

I have a simple python script: $ cat ~/simple.py import os import sys def write_greeting(inpath): outpath = os.path.splitext(inpath)[0] + '.txt' with open(outpath, 'w') as f: f.write('hello world!') sys.stdout.write('wrote…
Brian Fitzpatrick
  • 2,265
  • 1
  • 17
  • 40
1
vote
1 answer

How to build a script that queries an org-table?

I have a list of more than 80 search engines to perform keyword searches. They are listed in an org-table like this: #+name: keyword-search |---------------+---------------------------------------------------------------------+-----| | Name …
crocefisso
  • 1,141
  • 7
  • 15
1
vote
3 answers

Using Emacs to find and copy relevant database records

I have reduced a large text file to a 1.9GB size that Microsoft Access can handle, but only as a linked file. To permit full Access operations - to import the relevant data into Access - I need to extract, from that file, only the potentially…
Ray Woodcock
  • 144
  • 4
1
vote
1 answer

Why does the same code called first by bash and then by emacs not behave the same way?

I have this LaTeX code: %% test.tex \begin{wrapfig} \includegraphics[width=1cm]{fig1.eps}\end{wrapfig} \includegraphics[width=1cm]{fig2.eps} I have a script called fix-files-ext.sh that fixes the extensions of graphic files (in this example it will…
Onner Irotsab
  • 431
  • 2
  • 9
1
vote
1 answer

How can I run a subprocess with emacs --script

I'm trying to write a script using emacs --script and in it I am using start-process, because I want to use set-process-filter. The following does nothing if run as a script: #!/usr/bin/env -S emacs -Q --script # -*- mode: emacs-lisp;…
theia-jane
  • 80
  • 7
1
2