This question already has answers here:
Idiomatic batch processing of text in Emacs?
(3 answers)
Closed 8 years ago.
Imagine I have an input file,an output file and a file containing some elisp code, which should transform the input file into the output file. Is there a way I could do all this from an external process? Maybe some kind of script mode for emacs? I would like to embed this in a web application.
See emacs --batch in the Initial Options section of the manual. Use it with -l, 'f' or--eval. Thebatchoption forcesprin1,princ, andprintto print to stdout andmessageanderror` to print to stderr - so you can actually read and write to pipes.
Yes, it is possible. See emacs -l or emacs --eval.
Related
This question already has answers here:
How do I count the characters, words, and lines in a file, using Perl?
(10 answers)
Closed 4 years ago.
How do I find out linecount in perl similar to what wc -l gives me. A method preferably that doesn't require reading the whole file.
This question is way too broad and un-specific. But as it is based on an often seen misconception I'd like to comment on that.
A file is a sequence of bytes with no notion of "lines." The lines that we see when a file is displayed are determined by a particular character (or a short sequence of characters) in the file, denoting a "linebreak" to be used by software that views or edits the file. They are not a property of a file that one can just look up as metadata.
So you have to read the whole file in order to determine how many "lines" it has.
This can be done using native tools in a language or by running an external utility which does this, like wc. I'd recommended to do it using Perl in a Perl program, since the job fits squarely within Perl's most common uses. Then there are a number of ways to do this but we'd need to see your code in order to offer a specific recommendation.
This question already has answers here:
Go back to last state
(2 answers)
Closed 8 years ago.
I would like to save the state of a Lisp compiler so that I need not load my file in several minutes, but instead I would load that image in seconds.
Which Common Lisp compiler would do this favor for me?
I came to this idea as Standard ML of New Jersey does this: Exporting Heaps.
I could not find similar in the sbcl manual or the
ecl manual.
With SBCL, use save-lisp-and-die. To restart the image, use the --core arguments.
Read carefully the caveats in the documentation.
With CLISP, use EXT:SAVEINITMEM
This question already has an answer here:
Emacs: How to use a major mode for non-standard file extension
(1 answer)
Closed 9 years ago.
I am using GNU Emacs 24.2.1 to write some perl code. Syntax highlighting works well for files with extension .pl and .pm, but unfortunately not for perl unit tests (.t extension),
Is there a simple way to automatically turn on perl syntax highlighting whenever I open a .t file?
Popular question. I've answered a similar one a few days back: Emacs: How to use a major mode for non-standard file extension.
(add-to-list 'auto-mode-alist '("\\.t\\'" . perl-mode))
This question already has answers here:
How can I start an interactive console for Perl?
(24 answers)
Closed 9 years ago.
Languages like Ruby, Python, Lua, PHP, Node.js, etc. have a simple "shell" where you can type simple one-liners and see the result. Does Perl has something similar? I'm not looking for something fancy that does pretty printing (I'll use print()) or accepts multiline input.
The story is this:
I need to experiment with some regexps. I know I can do perl -e "..." but then I need to shell-escape the code and this complicates matters. If I had a Perl shell I wouldn't need to worry about escaping.
Have you ever tried Reply.pm? I'm using it.
https://metacpan.org/release/Reply
Have a try with this CPAN module:
Perl::Shell
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Suppressing a function’s command window output
Suppress Output
Is there a way to "silence" the output of a Matlab function? In other words, if a function generates some displayed text in the command window, is there a way to run it in a quiet mode, where the output is suppressed?
In my case, I am using a third-party function iteratively that displays a lot of text, and I want to find a way to suppress that text without modifying the function itself. I'm thinking there must be some kind of wrapper function like quiet(thirdpartyFunction) that gives this kind of behavior. Or is this wishful thinking?
You can probably use evalc and discard the return value.