Commit b257d1037c16

Vincent Demeester <vincent@sbr.pm>
2020-08-19 14:48:57
tools/emacs: update org-mode config…
… and add diary Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent fd1c5f8
Changed files (2)
tools/emacs/config/config-org.el
@@ -530,17 +530,19 @@ and thus keeping the configuration source up-to-date"
   (org-journal-date-format "%A, %d %B %Y")
   (org-journal-enable-agenda-integration nil))
 (use-package org-id
-  :after (org)
+  :after org
+  :commands contrib/org-id-headlines
   :config
-  (setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id)
-  (defun eos/org-custom-id-get (&optional pom create prefix)
-    "Get the CUSTOM_ID property of the entry at point-or-marker POM.
-   If POM is nil, refer to the entry at point. If the entry does
-   not have an CUSTOM_ID, the function returns nil. However, when
-   CREATE is non nil, create a CUSTOM_ID if none is present
-   already. PREFIX will be passed through to `org-id-new'. In any
-   case, the CUSTOM_ID of the entry is returned."
-    (interactive)
+  (setq org-id-link-to-org-use-id
+        'create-if-interactive-and-no-custom-id)
+
+  (defun contrib/org-get-id (&optional pom create prefix)
+    "Get the CUSTOM_ID property of the entry at point-or-marker
+POM. If POM is nil, refer to the entry at point. If the entry
+does not have an CUSTOM_ID, the function returns nil. However,
+when CREATE is non nil, create a CUSTOM_ID if none is present
+already. PREFIX will be passed through to `org-id-new'. In any
+case, the CUSTOM_ID of the entry is returned."
     (org-with-point-at pom
       (let ((id (org-entry-get nil "CUSTOM_ID")))
         (cond
@@ -552,12 +554,12 @@ and thus keeping the configuration source up-to-date"
           (org-id-add-location id (buffer-file-name (buffer-base-buffer)))
           id)))))
 
-  (defun eos/org-add-ids-to-headlines-in-file ()
-    "Add CUSTOM_ID properties to all headlines in the
-   current file which do not already have one."
+  (defun contrib/org-id-headlines ()
+    "Add CUSTOM_ID properties to all headlines in the current
+file which do not already have one."
     (interactive)
-    (org-map-entries (lambda ()
-                       (eos/org-custom-id-get (point) 'create)))))
+    (org-map-entries
+     (funcall 'contrib/org-get-id (point) 'create))))
 (use-package org-crypt
   :after (org)
   :config
@@ -574,6 +576,34 @@ and thus keeping the configuration source up-to-date"
   :commands (org-publish org-publish-all org-publish-project org-publish-current-project org-publish-current-file)
   :config
   (setq org-html-coding-system 'utf-8-unix))
+(use-package diary-lib
+  :config
+  (setq diary-entry-marker "diary")
+  (setq diary-show-holidays-flag t)
+  (setq diary-header-line-flag nil)
+  (setq diary-mail-days 3)
+  (setq diary-number-of-entries 3)
+  (setq diary-comment-start ";")
+  (setq diary-comment-end "")
+  (setq diary-date-forms
+        '((day "/" month "[^/0-9]")
+          (day "/" month "/" year "[^0-9]")
+          (day " *" monthname " *" year "[^0-9]")
+          (monthname " *" day "[^,0-9]")
+          (monthname " *" day ", *" year "[^0-9]")
+          (year "[-/]" month "[-/]" day "[^0-9]")
+          (dayname "\\W"))))
+(use-package org
+  :config
+  (defun vde/tangle-all-notes ()
+    "Produce files from my notes folder.
+This function will attempt to tangle all org files from `org-notes-dir'. The
+assumption is that those will generate configuration file (in `~/src/home'),
+and thus keeping the configuration source up-to-date"
+    (mapc (lambda (x) (org-babel-tangle-file x))
+          (ignore-errors
+            (directory-files-recursively org-notes-dir "\.org$"))))
+  :hook ((kill-emacs-hook . vde/tangle-all-notes)))
 
 (use-package org
   :defer t
tools/emacs/config/config-search.el
@@ -79,6 +79,11 @@ confines of word boundaries (e.g. multiple words)."
          ("M-s r p" . rg-project)
          ("M-s r s" . rg-dwiw))
   :config
+  (setq rg-group-result t)
+  (setq rg-hide-command t)
+  (setq rg-show-columns nil)
+  (setq rg-show-header t)
+  (setq rg-default-alias-fallback "all")
   (cl-pushnew '("tmpl" . "*.tmpl") rg-custom-type-aliases)
   (cl-pushnew '("gotest" . "*_test.go") rg-custom-type-aliases)
   (with-eval-after-load 'projectile