If you are on Linux you can install gtklp and set
(setq lpr-command "gtklp")
(setq ps-lpr-command "gtklp")
to give you a graphical print wizard. This doesn't actually give you print-to-file (unless you have a virtual pdf printer set up in CUPS), but it generally allows for easy printing from emacs.
That is a struct of elfeed-entry (defined by elfeed). The #s here means struct. The first one is for elfeed-entry, the second is for elfeed-ref.
(cl-defstruct website name shortname url shorturl)
(make-website :name "StackOverflow"
;; => #s(website "StackOverflow" nil "https://stackoverflow.com/" nil)
... = truncated = abbreviated = ellipsis
See eval-expression-print-level and eval-expression-print-length: https://www.gnu.org/software/emacs/manual/html_node/emacs/Lisp-Eval.html
See also print-length and print-level: https://www.gnu.org/software/emacs/manual/html_node/elisp/Output-Variables.html
It seems that emacsclient is the wrong way to do what I want. I thought I could not use emacs --batch because I wanted to get "live" info from my running emacs instance.
The missing piece of the puzzle was the function server-eval-at:
$ emacs --batch --eval "(progn (require 'server) (princ (format \"%s\\n\" (server-eval-at \"server\" '(frame-parameter (...
'list and "list" are different datatypes:
ELISP> (type-of 'list)
ELISP> (type-of "list")
Note that they even show up differently in your example -- it's the difference between list and "list".
But why do they show up twice? Well, because the REPL displays anything printed out, but also prints out the return value of the s-expression. ...
You see both:
The behavior of the print function - a side effect.
The return value of that function.
This is because of the way you evaluated the expression, interactively. If you used something like M-: to evaluate it, that command prints (echoes) the return value of the evaluated expression, independently of what the function itself might do (which in ...
You need to set the variable pdf-misc-print-programm and possibly also pdf-misc-print-programm-args in the pdf-misc customisation group. They should be set to the system command that you will print your document with, and that program must be installed on your system.
I use lpr, with the settings:
When you evaluate a function with M-:, the function gets run, and then its return value is displayed in the echo area. The return value of test-fn is the value returned by message, which is the string that was printed. Thus, though message did actually display the message, it was overwritten by M-: displaying the return value. (You can confirm that both ...
What you see printed in the echo area when evaluating the command is its return value - a string. The print syntax for strings includes quotation marks.
When you call the command non-interactively from another function/command, you shouldn't see the quotation marks:
(defun test-test-fn ()
Then call M-x test-test-fn RET to test....
format generates a string, but it doesn't do anything with it. You probably want to pass the result of format on to something that does:
(defun mt ()
(dotimes (x 20)
(dotimes (y 20)
(insert (format "%3d " (* (1+ x) (1+ y)))))
(insert (format "\n"))))
I think you're also confused about how dotimes works. From the doc string:
According to the manual, anything printing a message in batch mode will use stderr for this. The print/prin1/princ family will continue printing to stdout unless you pass the optional argument for picking a different char printing function, therefore the following will work:
(princ "My Message" 'external-debugging-output)
Apparently the Emacs developers ...
Nowhere. See the docstring (C-h f eval-buffer):
(eval-buffer &optional BUFFER PRINTFLAG FILENAME UNIBYTE
Execute the accessible portion of current buffer as Lisp code.
PRINTFLAG controls printing of output by any output functions in the
evaluated code, such as ‘print’, ‘princ’, and ‘prin1’:
a value of nil ...
print will output to the echo area rather than putting stuff in your buffer. You're looking for insert and dotimes:
(dotimes (i 10) (insert (format "var%d, " i)))
(alternatively you can use keyboard macros for this)
The printing happens to the printer name set in the environment variable PRINTER.
I would first set the env var PRINTER to my-printer
Then launch emacs in that terminal
Then do M-x ps-print-buffer-with-faces
C-h v print-quoted:
print-quoted is a variable defined in C source code.
Its value is nil
Non-nil means print quoted forms with reader syntax.
I.e., (quote foo) prints as 'foo, (function foo) as #'foo.
You were following a good line of enquiry regarding standard-output, but just didn't manage to find the right information.
The value of standard-output has to be a valid value for the PRINTCHARFUN argument, which C-hf print describes nicely:
Optional argument PRINTCHARFUN is the output stream, which can be one
- a buffer, in which case output ...
Well it turns out that the long-complicated-names-with-goobers listed in the "Devices and Printers" "Control Panel" / "Windows Settings" really are the printer names... ick.
(setq printer-name "Microsoft Print to PDF")
does in fact generate a PDF file via Emacs.
The list of names in the "Control Panel" is confirmed by:
Put (just) this in "hello.el":
(prin1 "Hello, world!")
Then from the eshell prompt:
~/temp $ eshell-source-file "hello.el"
I may be misunderstanding your general intent but from your questions, it seems as though you're trying to "run programs" the way you would run C programs - write a source file hello.c, compile it, run it at ...
A couple of options:
eshell can be configured to route specific commands (and subcommands) to the regular terminal. See the documentation for visual commands. Whether or not this is worth the trouble, depends on how much getting a tool to perform in a way it was not really designed to perform is worth.
A good tool for interactive sessions with elisp is ...
Evaluating(princ 1) with C-x C-e (eval-last-sexp) displays the following in the echo area
11 (#o1 #x1 ?\C-a)
because (princ 1) prints 1 and returns the integer 1. And (pp 1) is the same as (princ "1"), it prints 1 and returns the string "1".
Try executing them in M-x ielm, it produces cleaner output.
*** Welcome to IELM *** Type (describe-mode) for help....
I'd use a macro just as @choroba did (with F3 in place of C-x ( and F4 instead of C-x e, for brevity and to be able to easily specifying a non-zero starting number, as @DoMiNeLa10 mentioned), but if you want a possibly more ergonomic solution, there is abo-abo's tiny package. You'd type m0, 9|var%d into your buffer, and then execute tiny-expand and it would ...
I'd probably use a different approach, using mapconcat to apply the function and concatenate the results:
(let ((range (number-sequence 1 20)))
(format "%03d" (* x y)))
range " "))
This returns the string that you can insert or whatever else.
The question is really more about printing Lisp sexps (including results of evaluation) than it is about macro expansion, per se. It's just that macro expansion typically results in a large Lisp sexp that can be difficult to work with or read, especially if parts of it are elided (...).
I use pp-eval-last-sexp, which I bind to C-x C-e. (With C-u it inserts ...
If you use lispy (https://github.com/abo-abo/lispy), you can do this:
Enter (s-join ", " (loop for i below 10 collect (format "var%s" i))) into your elisp buffer. At the end of the sexp, type xr which will evaluate and replace the sexp with a string in quotes. Type C-b to get the cursor on the last quote, then type C-u " to unquote the string.
One way is to use other tool to interpret the string, such as echo
bash-4.4$ emacsclient --eval '"hello\nworld"' | xargs echo -e
Another way is to change what the server will return, by default, the
server will returns a pp representation of a Lisp value, with the
following advice, for Strings, it use a princ representation