emacs: tweak where some blocks start and end in the Org section

This commit is contained in:
Protesilaos Stavrou 2024-03-17 06:08:14 +02:00
parent 504664ee51
commit 8521cdfd59
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
2 changed files with 93 additions and 45 deletions

View file

@ -1,7 +1,6 @@
(prot-emacs-configure
(:delay 5)
;;; Calendar
(prot-emacs-package calendar
(:delay 5)
(setq calendar-mark-diary-entries-flag nil)
(setq calendar-mark-holidays-flag t)
(setq calendar-mode-line-format nil)
@ -18,9 +17,11 @@
(require 'cal-dst)
(setq calendar-standard-time-zone-name "+0200")
(setq calendar-daylight-time-zone-name "+0300")
(setq calendar-daylight-time-zone-name "+0300"))
;;; Appt (appointment reminders which also integrate with Org agenda)
(prot-emacs-package appt
(:delay 5)
(setq appt-display-diary nil
appt-display-format nil
appt-display-mode-line t
@ -36,9 +37,14 @@
;; `org-agenda-to-appt' to various relevant hooks.
;;
;; Create reminders for tasks with a due date when this file is read.
(org-agenda-to-appt))
(org-agenda-to-appt)))
;;; Org-mode (personal information manager)
;; Some of these settings need to be eva;uated before the `org'
;; feature is loaded, so I am using `prot-emacs-configure' and then
;; simply `require' the feature at the right spot.
(prot-emacs-configure
(:delay 5)
;; NOTE 2023-05-20: Must be evaluated before Org is loaded,
;; otherwise we have to use the Custom UI. No thanks!
(setq org-export-backends '(html texinfo md))
@ -74,9 +80,11 @@
(setq org-modules '(ol-info ol-eww))
(setq org-use-sub-superscripts '{})
(setq org-insert-heading-respect-content t)
(setq org-read-date-prefer-future 'time)
(setq org-read-date-prefer-future 'time))
;;;; refile, todo
(prot-emacs-configure
(:delay 5)
(setq org-refile-targets
'((org-agenda-files . (:maxlevel . 2))
(nil . (:maxlevel . 2))))
@ -111,9 +119,11 @@
(setq org-track-ordered-property-with-tag t)
(setq org-highest-priority ?A)
(setq org-lowest-priority ?C)
(setq org-default-priority ?A)
(setq org-default-priority ?A))
;;;; tags
(prot-emacs-configure
(:delay 5)
(setq org-tag-alist ; I don't really use those, but whatever
'(("meeting")
("admin")
@ -131,20 +141,26 @@
("website")))
(setq org-auto-align-tags nil)
(setq org-tags-column 0)
(setq org-tags-column 0))
;;;; log
(prot-emacs-configure
(:delay 5)
(setq org-log-done 'time)
(setq org-log-into-drawer t)
(setq org-log-note-clock-out nil)
(setq org-log-redeadline 'time)
(setq org-log-reschedule 'time)
(setq org-log-reschedule 'time))
;;;; links
(setq org-link-keep-stored-after-insertion nil)
(prot-emacs-configure
(:delay 5)
(setq org-link-keep-stored-after-insertion nil))
;; TODO 2021-10-15 org-link-make-description-function
;;;; capture
(prot-emacs-configure
(:delay 5)
(setq org-capture-templates
`(("b" "Basic task for future review" entry
(file+headline "tasks.org" "Tasks to be reviewed")
@ -212,9 +228,11 @@
(setq org-capture-templates-contexts
'(("e" ((in-mode . "notmuch-search-mode")
(in-mode . "notmuch-show-mode")
(in-mode . "notmuch-tree-mode")))))
(in-mode . "notmuch-tree-mode"))))))
;;;; agenda
(prot-emacs-configure
(:delay 5)
;;;;; Basic agenda setup
(setq org-default-notes-file (make-temp-file "emacs-org-notes-")) ; send it to oblivion
(setq org-agenda-files `(,org-directory))
@ -384,31 +402,37 @@
;; ;; Always show the habit graph, even if there are no habits for
;; ;; today.
;; (setq org-habit-show-all-today t)
)
;;;; code blocks
(prot-emacs-configure
(:delay 5)
(setq org-confirm-babel-evaluate nil)
(setq org-src-window-setup 'current-window)
(setq org-edit-src-persistent-message nil)
(setq org-src-fontify-natively t)
(setq org-src-preserve-indentation t)
(setq org-src-tab-acts-natively t)
(setq org-edit-src-content-indentation 0)
(setq org-edit-src-content-indentation 0))
;;;; export
(prot-emacs-configure
(:delay 5)
(setq org-export-with-toc t)
(setq org-export-headline-levels 8)
(setq org-export-dispatch-use-expert-ui nil)
(setq org-html-htmlize-output-type nil)
(setq org-html-head-include-default-style nil)
(setq org-html-head-include-scripts nil)
;; (require 'ox-texinfo)
;; (require 'ox-md)
(setq org-html-head-include-scripts nil))
;;;; IDs
(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)
(prot-emacs-configure
(:delay 5)
(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id))
;;;; Hooks and key bindings
(prot-emacs-configure
(:delay 5)
;; See my `pulsar' package, defined elsewhere in this setup.
(with-eval-after-load 'pulsar
(dolist (hook '(org-agenda-after-show-hook org-follow-link-hook))
@ -421,6 +445,8 @@
"C-c l" #'org-store-link
"C-c o" #'org-open-at-point-global)
;; Notice it is down here where the feature is actually loaded.
;; This is because some settings need to be set before this call.
(require 'org)
(prot-emacs-keybind org-mode-map
@ -443,10 +469,11 @@
(prot-emacs-keybind narrow-map
"b" #'org-narrow-to-block
"e" #'org-narrow-to-element
"s" #'org-narrow-to-subtree)
"s" #'org-narrow-to-subtree))
;;; Custom extensions (prot-org.el)
(require 'prot-org)
(prot-emacs-package prot-org
(:delay 5)
(setq org-agenda-format-date #'prot-org-agenda-format-date-aligned)
;; Check the variable `prot-org-custom-daily-agenda' in prot-org.el

View file

@ -6971,15 +6971,6 @@ This section covers the relevant configurations. You will notice that
it is not limited to Org, as some other built-in features are also
relevant here.
Given that I am setting up lots of built-in symbols, I do not need the
~prot-emacs-package~ macro at this stage, switching to its simplified
~prot-emacs-configure~ counterpart ([[#h:54a4cb92-e7f8-4291-abe6-6e7dfdfd6200][The =init.el= macro to evaluate arbitrary Elisp (~prot-emacs-configure~)]]).
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el" :mkdirp yes
(prot-emacs-configure
(:delay 5)
#+end_src
*** The =prot-emacs-org.el= section on the ~calendar~
:PROPERTIES:
:CUSTOM_ID: h:94d48381-1711-4d6b-8449-918bc1e3836c
@ -6993,8 +6984,10 @@ heading. All I do here is set some stylistic preferences.
Note that Emacs also has a ~diary~ command. I used it for a while, but
Org is far more capable, so I switched to it completely.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el" :mkdirp yes
;;; Calendar
(prot-emacs-package calendar
(:delay 5)
(setq calendar-mark-diary-entries-flag nil)
(setq calendar-mark-holidays-flag t)
(setq calendar-mode-line-format nil)
@ -7011,7 +7004,7 @@ Org is far more capable, so I switched to it completely.
(require 'cal-dst)
(setq calendar-standard-time-zone-name "+0200")
(setq calendar-daylight-time-zone-name "+0300")
(setq calendar-daylight-time-zone-name "+0300"))
#+end_src
*** The =prot-emacs-org.el= section about appointment reminders (=appt.el=)
@ -7041,6 +7034,8 @@ done at a specific time, such as coaching sessions ([[#h:f8f06938-0dfe-45c3-b4cf
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;; Appt (appointment reminders which also integrate with Org agenda)
(prot-emacs-package appt
(:delay 5)
(setq appt-display-diary nil
appt-display-format nil
appt-display-mode-line t
@ -7056,7 +7051,7 @@ done at a specific time, such as coaching sessions ([[#h:f8f06938-0dfe-45c3-b4cf
;; `org-agenda-to-appt' to various relevant hooks.
;;
;; Create reminders for tasks with a due date when this file is read.
(org-agenda-to-appt))
(org-agenda-to-appt)))
#+end_src
*** The =prot-emacs-org.el= section with basic Org settings
@ -7098,6 +7093,11 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;; Org-mode (personal information manager)
;; Some of these settings need to be eva;uated before the `org'
;; feature is loaded, so I am using `prot-emacs-configure' and then
;; simply `require' the feature at the right spot.
(prot-emacs-configure
(:delay 5)
;; NOTE 2023-05-20: Must be evaluated before Org is loaded,
;; otherwise we have to use the Custom UI. No thanks!
(setq org-export-backends '(html texinfo md))
@ -7133,7 +7133,7 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
(setq org-modules '(ol-info ol-eww))
(setq org-use-sub-superscripts '{})
(setq org-insert-heading-respect-content t)
(setq org-read-date-prefer-future 'time)
(setq org-read-date-prefer-future 'time))
#+end_src
*** TODO The =prot-emacs-org.el= Org to-do and refile settings
@ -7143,6 +7143,8 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; refile, todo
(prot-emacs-configure
(:delay 5)
(setq org-refile-targets
'((org-agenda-files . (:maxlevel . 2))
(nil . (:maxlevel . 2))))
@ -7177,7 +7179,7 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
(setq org-track-ordered-property-with-tag t)
(setq org-highest-priority ?A)
(setq org-lowest-priority ?C)
(setq org-default-priority ?A)
(setq org-default-priority ?A))
#+end_src
*** TODO The =prot-emacs-org.el= Org heading tags
@ -7187,6 +7189,8 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; tags
(prot-emacs-configure
(:delay 5)
(setq org-tag-alist ; I don't really use those, but whatever
'(("meeting")
("admin")
@ -7204,7 +7208,7 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
("website")))
(setq org-auto-align-tags nil)
(setq org-tags-column 0)
(setq org-tags-column 0))
#+end_src
*** TODO The =prot-emacs-org.el= Org time/state logging
@ -7214,11 +7218,13 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; log
(prot-emacs-configure
(:delay 5)
(setq org-log-done 'time)
(setq org-log-into-drawer t)
(setq org-log-note-clock-out nil)
(setq org-log-redeadline 'time)
(setq org-log-reschedule 'time)
(setq org-log-reschedule 'time))
#+end_src
*** TODO The =prot-emacs-org.el= Org link settings
@ -7228,7 +7234,9 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; links
(setq org-link-keep-stored-after-insertion nil)
(prot-emacs-configure
(:delay 5)
(setq org-link-keep-stored-after-insertion nil))
;; TODO 2021-10-15 org-link-make-description-function
#+end_src
@ -7239,6 +7247,8 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; capture
(prot-emacs-configure
(:delay 5)
(setq org-capture-templates
`(("b" "Basic task for future review" entry
(file+headline "tasks.org" "Tasks to be reviewed")
@ -7306,7 +7316,7 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
(setq org-capture-templates-contexts
'(("e" ((in-mode . "notmuch-search-mode")
(in-mode . "notmuch-show-mode")
(in-mode . "notmuch-tree-mode")))))
(in-mode . "notmuch-tree-mode"))))))
#+end_src
*** TODO The =prot-emacs-org.el= Org agenda settings
@ -7316,6 +7326,8 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; agenda
(prot-emacs-configure
(:delay 5)
;;;;; Basic agenda setup
(setq org-default-notes-file (make-temp-file "emacs-org-notes-")) ; send it to oblivion
(setq org-agenda-files `(,org-directory))
@ -7485,6 +7497,7 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
;; ;; Always show the habit graph, even if there are no habits for
;; ;; today.
;; (setq org-habit-show-all-today t)
)
#+end_src
*** TODO The =prot-emacs-org.el= Org code block settings
@ -7494,13 +7507,15 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; code blocks
(prot-emacs-configure
(:delay 5)
(setq org-confirm-babel-evaluate nil)
(setq org-src-window-setup 'current-window)
(setq org-edit-src-persistent-message nil)
(setq org-src-fontify-natively t)
(setq org-src-preserve-indentation t)
(setq org-src-tab-acts-natively t)
(setq org-edit-src-content-indentation 0)
(setq org-edit-src-content-indentation 0))
#+end_src
*** TODO The =prot-emacs-org.el= Org export settings
@ -7510,14 +7525,14 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; export
(prot-emacs-configure
(:delay 5)
(setq org-export-with-toc t)
(setq org-export-headline-levels 8)
(setq org-export-dispatch-use-expert-ui nil)
(setq org-html-htmlize-output-type nil)
(setq org-html-head-include-default-style nil)
(setq org-html-head-include-scripts nil)
;; (require 'ox-texinfo)
;; (require 'ox-md)
(setq org-html-head-include-scripts nil))
#+end_src
*** TODO The =prot-emacs-org.el= Org ID settings
@ -7527,7 +7542,9 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; IDs
(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)
(prot-emacs-configure
(:delay 5)
(setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id))
#+end_src
*** TODO The =prot-emacs-org.el= section about Org hooks and key bindings
@ -7537,7 +7554,8 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;;; Hooks and key bindings
(prot-emacs-configure
(:delay 5)
;; See my `pulsar' package, defined elsewhere in this setup.
(with-eval-after-load 'pulsar
(dolist (hook '(org-agenda-after-show-hook org-follow-link-hook))
@ -7550,6 +7568,8 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
"C-c l" #'org-store-link
"C-c o" #'org-open-at-point-global)
;; Notice it is down here where the feature is actually loaded.
;; This is because some settings need to be set before this call.
(require 'org)
(prot-emacs-keybind org-mode-map
@ -7572,7 +7592,7 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
(prot-emacs-keybind narrow-map
"b" #'org-narrow-to-block
"e" #'org-narrow-to-element
"s" #'org-narrow-to-subtree)
"s" #'org-narrow-to-subtree))
#+end_src
*** TODO The =prot-emacs-org.el= custom Org extensions (=prot-org.el=)
@ -7587,7 +7607,8 @@ any configuration. *NOTE 2024-03-16 06:55 +0200:* To be continued.
#+begin_src emacs-lisp :tangle "prot-emacs-modules/prot-emacs-org.el"
;;; Custom extensions (prot-org.el)
(require 'prot-org)
(prot-emacs-package prot-org
(:delay 5)
(setq org-agenda-format-date #'prot-org-agenda-format-date-aligned)
;; Check the variable `prot-org-custom-daily-agenda' in prot-org.el