Update org mode configuration (cleanup/add ANSI color escaping management)

Remove unused org-chef package.
Set the number of lines for block outputs from which begin_exemple is used (100 lines).
Add ANSI color escaping management for the org babel ouput blocks.
Update org-fancy-priorities.
This commit is contained in:
2022-06-13 08:16:01 +02:00
parent 6699148ed9
commit af497c8391

View File

@@ -2,6 +2,8 @@
;;; Commentary: ;;; Commentary:
;;; Code: ;;; Code:
(require 'ob)
(defconst *user-org-data-directory* (defconst *user-org-data-directory*
(path-join *user-data-directory* "org") (path-join *user-data-directory* "org")
"Path to user's org data store.") "Path to user's org data store.")
@@ -128,6 +130,17 @@
;; (interactive) ;; (interactive)
;; (cancel-timer user/org-mobile-sync-timer)) ;; (cancel-timer user/org-mobile-sync-timer))
;; From https://emacs.stackexchange.com/questions/44664/apply-ansi-color-escape-sequences-for-org-babel-results
(defun user--babel-ansi ()
"Add ANSI escaping commands."
(when-let ((beg (org-babel-where-is-src-block-result nil nil)))
(save-excursion
(goto-char beg)
(when (looking-at org-babel-result-regexp)
(let ((end (org-babel-result-end))
(ansi-color-context-region nil))
(ansi-color-apply-on-region beg end))))))
(use-package org (use-package org
:init :init
@@ -336,6 +349,14 @@
org-id-locations-file org-id-locations-file
(path-join *user-org-data-directory* "org-id-locations"))) (path-join *user-org-data-directory* "org-id-locations")))
;; https://github.com/rougier/svg-tag-mode
;; A minor mode for Emacs that replace keywords with nice SVG labels
;; (use-package svg-tag-mode
;; :ensure t
;; :config
;; (setq svg-tag-tags '(("TODO" . ((lambda (tag) (svg-tag-make "TODO"))))))
;; )
;; https://github.com/grugrut/helm-books/tree/625aadec1541a5ca36951e4ce1301f4b6fe2bf3f ;; https://github.com/grugrut/helm-books/tree/625aadec1541a5ca36951e4ce1301f4b6fe2bf3f
;; Book search interface for emacs helm. ;; Book search interface for emacs helm.
(use-package helm-books (use-package helm-books
@@ -347,18 +368,6 @@
(file (concat org-directory "book.org")) (file (concat org-directory "book.org"))
"* %(helm-books)"))) "* %(helm-books)")))
;; https://github.com/Chobbes/org-chef
;; A package for making a cookbook and managing recipes with org-mode.
(use-package org-chef
:disabled
:config
(add-to-list
'org-capture-templates
`("c" "Cookbook" entry
(file ,(path-join *user-org-data-directory* "cookbook.org"))
"%(org-chef-get-recipe-from-url)"
:empty-lines 1)))
;; https://github.com/waymondo/org-repo-todo ;; https://github.com/waymondo/org-repo-todo
;; Simple repository todo management with org-mode ;; Simple repository todo management with org-mode
(use-package org-repo-todo)) (use-package org-repo-todo))
@@ -367,10 +376,15 @@
;; Working with Code Blocks ;; Working with Code Blocks
(use-package ob-core (use-package ob-core
:ensure nil :ensure nil
:hook
((org-babel-after-execute-hook . user--babel-ansi))
:config :config
(validate-setq (validate-setq
;; Don't ask for validation. ;; Don't ask for validation.
org-confirm-babel-evaluate nil) org-confirm-babel-evaluate nil
;; Set the number of lines for block outputs from which it'll placed
;; in a #+begin_example...#+end_example block
org-babel-min-lines-for-block-output 100)
(add-many-to-list (add-many-to-list
'org-babel-load-languages 'org-babel-load-languages
@@ -394,6 +408,8 @@
(push '(latex . t) to-load)) (push '(latex . t) to-load))
(with-executable 'perl (with-executable 'perl
(push '(perl . t) to-load)) (push '(perl . t) to-load))
(with-executable 'php
(push '(php . t) to-load))
(with-executable 'python (with-executable 'python
(push '(python . t) to-load)) (push '(python . t) to-load))
(with-executable 'R (with-executable 'R
@@ -658,7 +674,10 @@
;; https://github.com/harrybournis/org-fancy-priorities ;; https://github.com/harrybournis/org-fancy-priorities
;; Display Org Mode priorities as custom strings ;; Display Org Mode priorities as custom strings
(use-package org-fancy-priorities (use-package org-fancy-priorities
:hook (org-mode-hook . org-fancy-priorities-mode)) :hook
(org-mode-hook . org-fancy-priorities-mode)
:config
(setq org-fancy-priorities-list '("HIGH" "MID" "LOW" "OPTIONAL")))
;; https://github.com/calvinwyoung/org-autolist ;; https://github.com/calvinwyoung/org-autolist
;; Making it even easier to edit lists in org-mode! ;; Making it even easier to edit lists in org-mode!
(use-package org-autolist (use-package org-autolist