How does one ask for super-plain vanilla standard input? - lisp

I find when I'm typing a line like this to a clisp program's standard input ...
((74 25 80))
... the cursor seems to dance, and it doesn't matter whether I'm doing
(read)
or
(read-from-string (read-line))
That is, when I type each right parenthesis, the cursor briefly hovers over the matching left parenthesis. If I type ahead, sometimes the whole line typed up to that point is re-echoed back to me.
This would be fine, I guess, but I'm doing this over a pty, and I want the input from that pty (what shows up on the clisp program's standard output and error output) to be "clean". No dancing cursor, no re-echoing of the line.
I suppose I could use named pipes for the input and output, but I want to handle this through the pty.
How do I make standard input be purely vanilla? No dancing cursor? No re-echoing of typeahead? Can I just modify a configuration file somewhere?

Sounds like GNU Readline is being used. There's a -disable-readline command line flag for clisp according to this page. Failing that, I think you're going to have to use a pipe to either convince readline that it isn't reading from a terminal or that it isn't outputting to a terminal.

Related

Emacs: How to read command help just as one would read Man pages?

It's nice to run M-x man foo for command foo within Emacs. It's then possible to navigate easily within the man page and to find details quickly.
When the help of a command (such as git) produces limited output, one can just use a terminal instead of emacs.
But occasionally, a command (such as aws help—run in a terminal) produces extensive output. Yet the output is not compatible with the emacs Man mode. An option is to use M-x shell within emacs, but that will not display the page at once. It will report "WARNING: terminal is not fully functional" and require pressing a key endlessly until the complete help appears, or, for Emacs 25, "Could not find executable named 'groff'".
What is a good way to read long manual pages produced by commands within emacs?
I just ran into this exact problem a few days ago.
Type escape + ! then type (for example) “aws ec2 help”. This brings the help text into a new buffer called Shell Command Output, with all of the control-h characters, etc.
Switch to the new buffer with control-x then lowercase ‘o’ (for other buffer)
Type escape + lowercase ‘x’ to run an emacs function, then type ‘man’ and hit Enter. It will prompt for man page entry and default to EC2, just hit Enter. In my case, it displays an error in the status line, “error in process sentinel: Can’t find the EC2 manpage”.
However, the “man page” functions are now available, so now (in that buffer)you can type escape + x and run the function Man-fontify-manpage. The page should now look like a nice man page with bold, etc.
You can then rename the buffer (escape + x then something like ec2) so the buffer isn’t replaced if you run another shell command.
I you just want the output in a buffer, you can simply use:
M-! aws help RET
If you want the output in a shell buffer, you can do git help commit | cat (so no more "terminal is not fully functional").
Probably you can do M-! aws help | cat RET also. I do not have aws, but hopefully the piping will remove the escape characters if aws output formatting is done right. You should try also TERM=dumb aws help. Any command should know better than using fancy output when TERM is set to dumb. If aws is dumb that way itself, you could pipe its output to something that filters out control characters -- try this
For forcing man mode in an arbitrary buffer, M-x Man-mode (yes, uppercase). I am not sure if that will play nice with aws's output.
By the way, for git I suppose you know you can do man git-commit (or man git-any_git_command, in general), so you have a nice alternative to git help when using emacs (output of help and man page is the same).

How can I input line-sparator in Emacs?

In some elisp file, they use line-sparator(I have no idea what is the name of it) to sparate some functions.
Some functions maybe be called only by some functions which will be made for API for user. So the two part of functions are different.
In some elisp file, there a one charator which display like a line in Emacs(I call it line-sparator).
For example, in help.el file, after the line (defvar help-button-cache nil) , there is a line-sparator in line 114.
So, My question is How to input it in Emacs.
This character is called "form feed", shown in Emacs as ^L, represented in files as byte 12 (decimal) / 0C (hex). Its function is to separate pages; when sent to a printer, it will usually make the printer output the current page and restart output at the top of a new page.
You can input it with C-q C-l. C-q is bound to quoted-insert, which can insert almost anything into the buffer literally.
You are looking for C-q C-l I believe. This inserts the ^L escape, which is commonly known as a FORM_FEED. Traditionally, this command was used to tell printers to eject the page and start a new one; of course, this has changed over time. Normally, this is used as a directive to clear the screen in terminals.
I'm not sure what you're seeing, because the character displays as ^L to me.
EDIT: sniped.

Display TTY in Emacs Shell mode dirtrack

Is there any way to display the current TTY when using Emacs shell mode? Right now I get around by having tty displayed as part of the prompt but this requires scrolling back
You can display it on the mode line.
Look at the documentation , in elisp manual, section 23.4 -- Mode Line Format. In subsection 23.4.2 there is written how you do it: you write a form that returns the value you are interested about.
`(:eval FORM)'
A list whose first element is the symbol `:eval' says to evaluate
FORM, and use the result as a string to display. Make sure this
evaluation cannot load any files, as doing so could cause infinite
recursion.

My slime-repl is not working in ClojureBox

I installed ClojureBox and the REPL is not working.
If I type (+ 1 2) into the *slime-repl clojure* buffer and press enter, the expression text becomes bold as if it has been evaluated, but there is no result of the evaluation printed on the screen.
Can anyone help me figure out why my REPL is not printing the evaluation results?
Thanks.
Try looking in *inferior-lisp* and failing that all other buffers.
The binding of clojure's *out* plus emacs slime-swank based capture and redirection of output streams can occasionally make it seem like emacs is swallowing output. (This can get really confusing when output comes from multiple threads - definitely one of the few warts of developing clojure with the slime-swank environment.)
Have you ever tried emacs before using clojurebox? Any left behind .emacs configuration or library paths etc. can interact badly with clojurebox which, in my experience, assumes it is the only installation of emacs going onto a clean system.

How to force emacs to use \n instead of \r\n

I have to use windows to write some shell scripts. I decided to use emacs, but I get a weird error when running the script:
/bin/bash^M: bad interpreter: No such file or directory
Correct me if I'm wrong, but that looks like the shebang ends in \r\n instead of just \n. How can I tell emacs to only write \n? I'm in Shell-script major mode. It's quite surprising this isn't fixed by default.
As Jürgen mentioned, you need to use the set-buffer-file-coding-system. You can say
(set-buffer-file-coding-system 'unix)
and stick that into a function inside the find-file-hook so that it will set it for all the buffers you open. Alternatively, you can put it inside the write-file-hook list so that the file-coding-system is set properly before you dump the file to disk.
For a simpler way out, if you're using the GUI version of Emacs, you can click on the 3rd character in the modeline from the left. It's to toggle between eol formats.
Use:
set-buffer-file-coding-system
(should be bound to a key-sequence) before saving the file.