Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [script]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
63 views

How can a regex replace that computes the replacement in a function using back references be converted to a CLI batch version processing line by line?

An example of this is a script to output the contents of .zsh_history file in the manner of the history command, so an emacs script would be invoked by a command line like display.sh.el < ~/....
vfclists's user avatar
  • 1,423
0 votes
0 answers
21 views

Getting diary-mail-entries to work with mu4e in a script

I'm trying to start using the Emacs diary to remind me of birthdays and such using emails, but I've configured mu4e as my mail client, so I wrote an Emacs script using (diary-mail-entries) that I want ...
Alexander Praehauser's user avatar
0 votes
2 answers
156 views

How can I use a file of Elisp code as a script?

I have written a code: ;;; calculator.el --- Calculator ;;; Commentary: ;;; Code: (let ((operand1 (read-number "Enter the first number: ")) (operand2 (read-number "Enter the ...
whiteman808's user avatar
0 votes
1 answer
30 views

set the correct major mode for script files based on interpreter

I want to make a function that will set the correct major mode based on the interpreter used for a script. I don't want to include extensions in my scripts (because that can be annoying if making cli ...
Hackerman's user avatar
1 vote
1 answer
53 views

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 |---------------+--------------------------------------------...
crocefisso's user avatar
  • 1,353
0 votes
1 answer
41 views

Emacs 28.1: Bash Shell Script Indenting does not recognize if [....];then

Since upgrade to Emacs 28.1, I have noted an annoy change in shell-script mode auto-formatting. I would like to recover the old behavior Before, if I entered if [ "$x" = "" ];then ...
SzS's user avatar
  • 1
1 vote
3 answers
138 views

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 ...
Ray Woodcock's user avatar
1 vote
1 answer
49 views

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 ...
Onner Irotsab's user avatar
0 votes
1 answer
224 views

How to comment out multiple or all files in a directory?

I frequently use commands like paredit-comment-dwim, comment-dwim, and comment-region. I am also aware these commands can have a compound effect with the mark command. But, I would like to comment ...
Pedro Delfino's user avatar
3 votes
1 answer
161 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,826
0 votes
0 answers
521 views

How to run shell scripts at startup of Emacs/EXWM?

I have configurations I would generally run on the startup of DWM. Now, I would like to do the same with EXWM/Emacs. Is there any Elispian way to do it? EDIT: arrived in conjunction with @lawlist OBS: ...
BuddhiLW's user avatar
  • 297
3 votes
2 answers
243 views

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-...
Jaap Joris Vens's user avatar
1 vote
1 answer
186 views

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 -...
theia-jane's user avatar
2 votes
1 answer
842 views

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 ...
kdb's user avatar
  • 1,561
0 votes
0 answers
98 views

A script to run emacs in cmd

Good day, I created the following script in order to run emacs 27.1 in cmd without gui: $ cd \Users\xxxxxx\emacs-27.1-x86_64\bin $ emacs-27.1.exe -nw %1 An elementary script which I named demacs. ...
davidebond's user avatar
4 votes
3 answers
419 views

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. ...
doctorate's user avatar
  • 1,829
0 votes
0 answers
97 views

How can I provide the first-error and next-error initial positions as region selection in order to save to the kill-ring?

I am running a make command. I'd like to capture the first error and output it to a file. How can I select as a region from the beginning of first-error position to the position right before the next-...
LeanMan's user avatar
  • 123
2 votes
1 answer
112 views

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 ...
Student's user avatar
  • 225
2 votes
2 answers
307 views

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's user avatar
  • 377
2 votes
1 answer
46 views

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 --...
Jim's user avatar
  • 21
1 vote
1 answer
55 views

visit buffer without setting mode in script

I'm trying to write a small program to indent lisp files using lisp-mode so I can get Emacs-compatible indentation even when using a different program. Here's my first attempt to write a program to ...
Greg Nisbet's user avatar
1 vote
2 answers
725 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
346 views

How to apply org-ctrl-c-ctrl-c-hook from command line?

This problem is so convoluted that maybe I should call it a puzzle... On the Unix shell command line, I can convert TSV (tab-separated-values) input to org-mode table format with this perl one-liner: ...
kjo's user avatar
  • 3,247
0 votes
1 answer
237 views

How to make web-mode handle HTML inside <script> element?

I have elements that contain various things. Some contain HTML; web-mode does not realize that so it messes up the indentation. Some contain CSS; same issue. My first preference is, can I somehow ...
Ron Burk's user avatar
  • 101
2 votes
1 answer
2k views

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(...
Brian Fitzpatrick's user avatar
-1 votes
1 answer
90 views

why is save-buffer asking for a chmod?

All of sudden, XEmacs 21.4.22 starts asking whether it should chmod a+x $f everytime I try to save a buffer that is in Shell-script mode. Switching it to fundamental-mode stops that behaviour. ...
PypeBros's user avatar
5 votes
3 answers
164 views

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 ...
Wilfred Hughes's user avatar
5 votes
2 answers
377 views

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 ...
Sean Allred's user avatar
  • 6,941
1 vote
1 answer
44 views

Can I use find to pass a list to emacs commands?

I'm trying to modify a script I got from an old question of mine. I have many .org files under many subdirectories of ~/foo. I want to quickly run htmlize on each .org file. I have some elisp code $ ...
Brian Fitzpatrick's user avatar
8 votes
2 answers
2k views

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 ...
Joe Corneli's user avatar
  • 1,808