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

---
 lisp/+org.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

(limited to 'lisp')

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