From 2cc59cf768b9586513a5cdcab81dbdff1ee1064c Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sun, 1 May 2022 09:24:57 -0500 Subject: Add +org-wrap-on-hyphens --- init.el | 10 +++------- lisp/+org.el | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/init.el b/init.el index 4ca4c3c..825ff9e 100644 --- a/init.el +++ b/init.el @@ -629,14 +629,10 @@ #'turn-off-auto-fill #'org-indent-mode #'prettify-symbols-mode - ;; TODO: This is only the beginning of a larger idea: I really want the - ;; "buffer stats" section of the mode-line to change depending on the - ;; mode. So like, org-mode would be a word count (maybe other text - ;; modes?), lui-modes could be .... something? etc. - (defun turn-off-column-number-mode () (setq-local column-number-mode nil))) - (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→)✓ + #'+org-wrap-on-hyphens) + (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→) ("SCHEDULED:" . ?↷) - ("CLOSED:" ?✓)) + ("CLOSED:" . ?✓)) ;;+modeline-position-function #'+org-count-words-stupidly ) (:local-hook user-save-hook #'+org-before-save@prettify-buffer) diff --git a/lisp/+org.el b/lisp/+org.el index 84b0288..252ee55 100644 --- a/lisp/+org.el +++ b/lisp/+org.el @@ -649,5 +649,19 @@ and POST-PROCESS are passed to `org-export-to-file'." (while (re-search-forward "\n\u000c\n" to t) (org-flag-region (match-beginning 0) (match-end 0) t 'visible))))) +;;; Emacs 28+: wrap on hyphens +;; https://emacs.stackexchange.com/a/71342/37239 + +(defcustom +org-category-table (let ((table (copy-category-table))) + (modify-category-entry ?- ?| table) + table) + "Character category table for `org-mode'." + :type 'sexp) + +(defun +org-wrap-on-hyphens () + "Soft-wrap `org-mode' buffers on spaces and hyphens." + (set-category-table +org-category-table) + (setq-local word-wrap-by-category t)) + (provide '+org) ;;; +org.el ends here -- cgit 1.4.1-21-gabe81