Skip to content

Commit

Permalink
[org-roam] Fix evil org-roam-node-insert spacing (#15008)
Browse files Browse the repository at this point in the history
When we're adding links, without this they get smooshed together under the
curser. Tested to work; resolves #14137

Co-authored-by: Richard Kim <emacs18@gmail.com>
  • Loading branch information
bhipple and emacs18 committed Aug 23, 2021
1 parent 2a0a261 commit 1441dcc
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion layers/+emacs/org/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,21 @@ Headline^^ Visit entry^^ Filter^^ Da
:mode org-roam-mode
:bindings
"o" 'link-hint-open-link
"r" 'org-roam-buffer-refresh))))
"r" 'org-roam-buffer-refresh))

; Workaround an upstream issue with evil, as described in https://github.com/syl20bnr/spacemacs/issues/14137
(defadvice org-roam-node-insert (around append-if-in-evil-normal-mode activate compile)
"If in evil normal mode and cursor is on a whitespace character, then go into
append mode first before inserting the link. This is to put the link after the
space rather than before."
(let ((is-in-evil-normal-mode (and (bound-and-true-p evil-mode)
(not (bound-and-true-p evil-insert-state-minor-mode))
(looking-at "[[:blank:]]"))))
(if (not is-in-evil-normal-mode)
ad-do-it
(evil-append 0)
ad-do-it
(evil-normal-state))))))

(defun org/init-org-sticky-header ()
(use-package org-sticky-header
Expand Down

0 comments on commit 1441dcc

Please sign in to comment.