Add +org-wrap-on-hyphens

This commit is contained in:
Case Duckworth 2022-05-01 09:24:57 -05:00
parent 02b8882f54
commit 2cc59cf768
2 changed files with 17 additions and 7 deletions

10
init.el
View File

@ -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)

View File

@ -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