diff --git a/global.org b/global.org index 1bbc673..7bede73 100644 --- a/global.org +++ b/global.org @@ -760,18 +760,26 @@ #+end_src *** Hooks Enable ~auto-fill-mode~ (see [[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Fill.html][the manual]]]: honestly I do not see - where I would not want to use this feature). Also, disable - ~truncate-lines~ + where I would not want to use this feature). #+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) + #+end_src + It sometimes happen (e.g. when opening org files from magit) that + the point is in an invisible region; then the usual + ~smart-line-beginning~ would get upset. This variation takes care + of the problem. + #+begin_src emacs-lisp (defun org-smart-line-beginning () (interactive) (when (invisible-p (point)) + ;; assume that we are in a folded headline; move back to heading + ;; otherwise we will be trapped in the invisible region (org-back-to-heading)) (smart-line-beginning)) (define-key org-mode-map (kbd "C-a") 'org-smart-line-beginning) + #+end_src + Disable ~truncate-lines~ + #+begin_src emacs-lisp (setq org-starting-truncated nil org-startup-folded t) #+end_src @@ -1152,8 +1160,8 @@ #+end_src *** Automate saving Save all org buffers with the auto-save-hook. Avoid saving the - buffer that is currently being edited; doing so it removes - trailing whitespace, which is undesirable while writing. + buffer that is currently being edited; doing so removes trailing + whitespace, which is undesirable while writing. #+begin_src emacs-lisp (defun org-save-all-org-buffers-except-current () "Save all Org buffers without user confirmation."