From 5ef2a988585231cf01c3952e4d44e5f6a07ab6f4 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 21 Oct 2016 23:02:22 +0200 Subject: [PATCH] Create function org-space-key and bind it to SPC in org-mode All it does is inserting the space character twice after a period. --- init.el | 7 ++++++- lisp/text-manip.el | 7 +++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 lisp/text-manip.el diff --git a/init.el b/init.el index 5e790a6..29ac557 100644 --- a/init.el +++ b/init.el @@ -371,6 +371,7 @@ ;; Org mode (use-package org :ensure t + :demand :init (require 'xdg-paths) (setq-default org-crypt-key "B0740C4C" @@ -399,7 +400,10 @@ '("p" "Blog post" entry (file+datetree (concat org-directory "blog.org")) "* %^{Title} :blog:\n :PROPERTIES:\n :on: %T\n :END:\n %i%?")) - (setq org-time-stamp-formats '("<%Y-%m-%d>" . "<%Y-%m-%d %H:%M>"))) + (setq org-time-stamp-formats '("<%Y-%m-%d>" . "<%Y-%m-%d %H:%M>")) + :bind + (:map org-mode-map + ("SPC" . org-space-key))) (use-package org-bullets :init @@ -658,6 +662,7 @@ (load "enclose-string.el") (load "buf-manipulation.el") (load "package-manip") +(load "text-manip") ;; Define aliases (defalias 'yes-or-no-p 'y-or-n-p) diff --git a/lisp/text-manip.el b/lisp/text-manip.el new file mode 100644 index 0000000..06e6291 --- /dev/null +++ b/lisp/text-manip.el @@ -0,0 +1,7 @@ +(defun org-space-key (&optional arg) + "Insert two spaces after a period." + (interactive "p") + + (when (looking-back "\\.") + (call-interactively 'self-insert-command arg)) + (call-interactively 'self-insert-command arg))