diff options
author | Case Duckworth | 2022-05-01 09:24:57 -0500 |
---|---|---|
committer | Case Duckworth | 2022-05-01 09:24:57 -0500 |
commit | 2cc59cf768b9586513a5cdcab81dbdff1ee1064c (patch) | |
tree | 42886fedde04dc61e414bd100c79ecd93e5818b4 | |
parent | Indentation (diff) | |
download | emacs-2cc59cf768b9586513a5cdcab81dbdff1ee1064c.tar.gz emacs-2cc59cf768b9586513a5cdcab81dbdff1ee1064c.zip |
Add +org-wrap-on-hyphens
-rw-r--r-- | init.el | 10 | ||||
-rw-r--r-- | 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 @@ | |||
629 | #'turn-off-auto-fill | 629 | #'turn-off-auto-fill |
630 | #'org-indent-mode | 630 | #'org-indent-mode |
631 | #'prettify-symbols-mode | 631 | #'prettify-symbols-mode |
632 | ;; TODO: This is only the beginning of a larger idea: I really want the | 632 | #'+org-wrap-on-hyphens) |
633 | ;; "buffer stats" section of the mode-line to change depending on the | 633 | (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→) |
634 | ;; mode. So like, org-mode would be a word count (maybe other text | ||
635 | ;; modes?), lui-modes could be .... something? etc. | ||
636 | (defun turn-off-column-number-mode () (setq-local column-number-mode nil))) | ||
637 | (:local-set prettify-symbols-alist '(("DEADLINE:" . ?→)✓ | ||
638 | ("SCHEDULED:" . ?↷) | 634 | ("SCHEDULED:" . ?↷) |
639 | ("CLOSED:" ?✓)) | 635 | ("CLOSED:" . ?✓)) |
640 | ;;+modeline-position-function #'+org-count-words-stupidly | 636 | ;;+modeline-position-function #'+org-count-words-stupidly |
641 | ) | 637 | ) |
642 | (:local-hook user-save-hook #'+org-before-save@prettify-buffer) | 638 | (: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'." | |||
649 | (while (re-search-forward "\n\u000c\n" to t) | 649 | (while (re-search-forward "\n\u000c\n" to t) |
650 | (org-flag-region (match-beginning 0) (match-end 0) t 'visible))))) | 650 | (org-flag-region (match-beginning 0) (match-end 0) t 'visible))))) |
651 | 651 | ||
652 | ;;; Emacs 28+: wrap on hyphens | ||
653 | ;; https://emacs.stackexchange.com/a/71342/37239 | ||
654 | |||
655 | (defcustom +org-category-table (let ((table (copy-category-table))) | ||
656 | (modify-category-entry ?- ?| table) | ||
657 | table) | ||
658 | "Character category table for `org-mode'." | ||
659 | :type 'sexp) | ||
660 | |||
661 | (defun +org-wrap-on-hyphens () | ||
662 | "Soft-wrap `org-mode' buffers on spaces and hyphens." | ||
663 | (set-category-table +org-category-table) | ||
664 | (setq-local word-wrap-by-category t)) | ||
665 | |||
652 | (provide '+org) | 666 | (provide '+org) |
653 | ;;; +org.el ends here | 667 | ;;; +org.el ends here |