From 992eeddd44c6d91e9678e03c4161408ed8a91148 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Fri, 20 May 2022 19:38:37 -0400 Subject: [PATCH] Introduce ~org-smart-line-beginning~ to avoid issues Folded regions confuse the canonical implementation of smart-line-beginning --- global.org | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/global.org b/global.org index e0662c1..1bbc673 100644 --- a/global.org +++ b/global.org @@ -763,10 +763,17 @@ where I would not want to use this feature). Also, disable ~truncate-lines~ #+begin_src emacs-lisp + ;; assume that we are in a folded headline; move back to heading + ;; otherwise we will be trapped in the invisible region (add-hook 'org-mode-hook 'turn-on-auto-fill) + (defun org-smart-line-beginning () + (interactive) + (when (invisible-p (point)) + (org-back-to-heading)) + (smart-line-beginning)) + (define-key org-mode-map (kbd "C-a") 'org-smart-line-beginning) (setq org-starting-truncated nil org-startup-folded t) - #+end_src *** Cosmetics Change the default ellipsis ~...~ to the unicode ellipsis ~…~