I have a command that semi-automates the insertion of numbered chapter headings in an org-mode file.
(defun reset-counter ()
(interactive)
(setq n 1))
(defun insert-numbered-chapter-headings ()
"Insert **** 第x章 at cursor point."
(interactive)
(insert (format "**** 第%s章"
n))
(setq n (+ n 1)))
(define-key org-mode-map (kbd "<S-return>") 'insert-numbered-chapter-headings)
(define-key org-mode-map (kbd "C-c C-x r") 'reset-counter)
Currently, reset-counter
just sets variable n
back to 1.
How do I modify the function so that I can be prompted to enter any number other than 1
, with 1
as the default when left blank?
(message "String is %s" (read-char "Enter number:")