0

I am using (insert "\n") to insert a newline in a specified buffer. Is this the recommended way to do it? I have seen (terpri) but cannot get it to make a newline.

(defun fire-clock (bufrn)
  "TODO."
  (interactive)

(let ( (ss (nth 0 (decode-time))) ; seconds (mm (nth 1 (decode-time))) ; minutes (hh (nth 2 (decode-time))) ) ; hours

(with-current-buffer (get-buffer-create bufrn)

  (text-mode)  
  (goto-char (point-min))

  (dotimes (i (/ ss 5))
    (firefly-ticker-second 'green))
  (insert "\n")
  (dotimes (i (% ss 5))
    (firefly-ticker-second 'blue)) )))

Dilna
  • 1
  • 3
  • 11
  • Show what you tried wrt using insert vs terpri -they don't do the same thing. Ask a specific question about something you tried that you think doesn't work as you expected. Start your recipe from emacs -Q. And of course, start by reading the doc for insert and terpri. – Drew Dec 04 '22 at 21:54
  • As shown in the example I am using (insert "\n"). I do not understand terpri very well and how to use it after reading the doc. – Dilna Dec 04 '22 at 22:01
  • What is PRINTCHARFUN? The doc seems to assume that all users know what things like PRINTCHARFUN mean. – Dilna Dec 04 '22 at 22:10
  • 1
    No: the doc tells you that the argument PRINTCHARFN is a stream and also tells you what happens if that argument is not provided. In general, doc-strings name arguments in upper case so they can be easily referred to in the succeeding description. – Fran Burstall Dec 04 '22 at 22:46
  • So I need a buffer (which excludes a buffer name). For this situation, insert seems to be the appropriate thing to call. If a buffer name is passed, how can I get that buffer to terpri. What do you think about the use of terpri in this instance? – Dilna Dec 04 '22 at 23:14

0 Answers0