Hot answers tagged

7

The fastest way is to use the macro counter: C-x( starts recording a macro varF3,space inserts 0 as the initial value of the counter M-1M-0 repeat the following 10 times C-xe execute the macro


7

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" :url "https://stackoverflow.com/") ;; => #s(website "StackOverflow" nil "https://stackoverflow.com/" nil) (...


6

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.


6

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 ...


6

Just bind print-quoted to a non-nil value around the call to prin1(-to-string).


6

'list and "list" are different datatypes: ELISP> (type-of 'list) symbol ELISP> (type-of "list") string 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. ...


4

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")))) UPDATE I think you're also confused about how dotimes works. From the doc string: (...


4

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 ...


4

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: '(pdf-misc-print-programm "/usr/bin/lpr") '(pdf-misc-...


4

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 ...


4

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 () (interactive) (test-fn)) Then call M-x test-test-fn RET to test....


3

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)


3

C-h v print-quoted: print-quoted is a variable defined in C source code. Its value is nil Documentation: Non-nil means print quoted forms with reader syntax. I.e., (quote foo) prints as 'foo, (function foo) as #'foo.


3

The printing happens to the printer name set in the environment variable PRINTER. For example: 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


3

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 of these: - a buffer, in which case output ...


3

... = 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


2

Put (just) this in "hello.el": (prin1 "Hello, world!") Then from the eshell prompt: ~/temp $ eshell-source-file "hello.el" Hello, world! ~/temp $ 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 ...


2

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 ...


2

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") M-x ps-print-buffer does in fact generate a PDF file via Emacs. The list of names in the "Control Panel" is confirmed by: cscript.exe ...


2

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 (...


2

Nowhere. See the docstring (C-h f eval-buffer): (eval-buffer &optional BUFFER PRINTFLAG FILENAME UNIBYTE DO-ALLOW-PRINT) 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 ...


2

I'd probably use a different approach, using mapconcat to apply the function and concatenate the results: (let ((range (number-sequence 1 20))) (mapconcat (lambda (y) (mapconcat (lambda (x) (format "%03d" (* x y))) range " ")) range "\n")) This returns the string that you can insert or whatever else.


2

Change (print (format "[[./%s]]" pngname)) to (princ (format "[[./%s]]" pngname))


2

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....


2

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 ...


1

This is how Emacs displays a propertized string. It contains of the text "marge", but also has the properties fontified and face applied from position 0 to 5. If you pass it to other string handling functions, it will be handled the same, with the exception of those that look up string properties (such as equal-including-properties which compares them, ...


1

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. ...


1

One way is to use other tool to interpret the string, such as echo bash-4.4$ emacsclient --eval '"hello\nworld"' | xargs echo -e hello world bash-4.4$ 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 (define-...


1

Here's the code for evaluate-print-last-sexp, minus the docstring. (Note: I found this with C-h f evaluate-print-last-sexp, and following the link to the source code.) (defun eval-print-last-sexp (&optional eval-last-sexp-arg-internal) "(DOCSTRING HERE)" (interactive "P") (let ((standard-output (current-buffer))) (terpri) (eval-last-sexp (...


1

Print with: asks you for a command to print with. In most Linux distros you could use lp or lpr command to send files to printer. More about lp: http://linux.die.net/man/1/lp


Only top voted, non community-wiki answers of a minimum length are eligible