>>> "ESF" == Eric S Fraga writes: > On Monday, 30 Aug 2021 at 18:01, Uwe Brauer wrote: >> Does not work since the counter is not saved when increased. > Why not save it then? I.e. something like this: > (defun my-insert-add-counter () > (interactive) > (setq my-subject-counter (+ my-subject-counter 1)) > (insert (int-to-string my-subject-counter))) Thanks very much, recursion, sigh, I should have thought about it. So I cooked up that (defun my-reset-subject-counter () "Reset the counter to ZERO!" (interactive) (setq my-subject-counter 0) (message "Now my-subject counter has been reset to ZERO!")) (defun my-new-insert-subject-counter () "Insert a string of the form [`counter/Total'] " (interactive) (save-excursion (setq my-subject-counter (+ my-subject-counter 1)) (let ((total (read-string "Total number: " ))) (message-carefully-insert-headers (list (cons 'Subject (concat "[" (int-to-string my-subject-counter) "/" total "]"))))))) Which is very useful for my workflow, thanks again. Uwe