Make gpolonkai/org-space-key customizable

This commit is contained in:
2023-10-15 06:47:33 +02:00
parent 4d7a2795a4
commit 3011905d2b
2 changed files with 12 additions and 6 deletions

View File

@@ -281,16 +281,22 @@ From [[http://emacs.stackexchange.com/a/31321/507][Emacs SE]].
(org-time-stamp '(16) arg))
#+end_src
*** Insert two spaces after specific characters
*** Insert two spaces after certain marks
#+begin_src emacs-lisp
(defun gpolonkai/org-space-key (&optional arg)
"Insert two spaces after a period.
(defcustom gpolonkai/org-dbl-space-punct-marks (list ?. ?! ?? ?…)
"Punctuation marks after which the space key should insert two space characters."
:type '(set character))
ARG will be passed down verbatim to `self-insert-command'"
(defun gpolonkai/org-space-key (&optional arg)
"Insert two spaces after certain markers.
ARG will be passed down verbatim to `self-insert-command'."
(interactive "p")
(when (looking-back "[.!?…]" nil)
(when (and
(not (org-in-block-p '("src")))
(looking-back (rx-to-string `(any,@ gpolonkai/org-dbl-space-punct-marks)) nil))
(call-interactively 'self-insert-command arg))
(call-interactively 'self-insert-command arg))
#+end_src