Make gpolonkai/org-space-key customizable

This commit is contained in:
Gergely Polonkai 2023-10-15 06:47:33 +02:00
parent 4d7a2795a4
commit 3011905d2b
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
2 changed files with 12 additions and 6 deletions

View File

@ -19,6 +19,7 @@
gpolonkai/duplicate-line gpolonkai/duplicate-line
gpolonkai/move-to-beginning-of-line gpolonkai/move-to-beginning-of-line
gpolonkai/move-to-end-of-line gpolonkai/move-to-end-of-line
gpolonkai/org-space-key
hungry-delete-backward hungry-delete-backward
hungry-delete-forward hungry-delete-forward
indent-for-tab-command indent-for-tab-command
@ -35,7 +36,6 @@
org-meta-return org-meta-return
org-return org-return
org-self-insert-command org-self-insert-command
org-space-key
org-yank org-yank
overwrite-mode overwrite-mode
sp-backward-delete-char sp-backward-delete-char

View File

@ -281,16 +281,22 @@ From [[http://emacs.stackexchange.com/a/31321/507][Emacs SE]].
(org-time-stamp '(16) arg)) (org-time-stamp '(16) arg))
#+end_src #+end_src
*** Insert two spaces after specific characters *** Insert two spaces after certain marks
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun gpolonkai/org-space-key (&optional arg) (defcustom gpolonkai/org-dbl-space-punct-marks (list ?. ?! ?? ?…)
"Insert two spaces after a period. "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") (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))
(call-interactively 'self-insert-command arg)) (call-interactively 'self-insert-command arg))
#+end_src #+end_src