diff --git a/config.org b/config.org index 5db54f3..59a8c96 100644 --- a/config.org +++ b/config.org @@ -1163,31 +1163,6 @@ https://github.com/jwiegley/use-package/issues/319 #+end_src #+BEGIN_SRC emacs-lisp -(defun my--buffer-prop-set (name value) - "Set a file property called NAME to VALUE in buffer file. -If the property is already set, replace its value." - (setq name (downcase name)) - (org-with-point-at 1 - (let ((case-fold-search t)) - (if (re-search-forward (concat "^#\\+" name ":\\(.*\\)") - (point-max) t) - (replace-match (concat "#+" name ": " value) 'fixedcase) - (while (and (not (eobp)) - (looking-at "^[#:]")) - (if (save-excursion (end-of-line) (eobp)) - (progn - (end-of-line) - (insert "\n")) - (forward-line) - (beginning-of-line))) - (insert "#+" name ": " value "\n"))))) - - (defun my--buffer-prop-remove (name) - "Remove a buffer property called NAME." - (org-with-point-at 1 - (when (re-search-forward (concat "\\(^#\\+" name ":.*\n?\\)") - (point-max) t) - (replace-match "")))) (use-package org :ensure t @@ -1381,6 +1356,32 @@ org-roam-db-sync ;(use-package emacsql-sqlite-builtin ; :ensure t) +(defun my--buffer-prop-set (name value) + "Set a file property called NAME to VALUE in buffer file. +If the property is already set, replace its value." + (setq name (downcase name)) + (org-with-point-at 1 + (let ((case-fold-search t)) + (if (re-search-forward (concat "^#\\+" name ":\\(.*\\)") + (point-max) t) + (replace-match (concat "#+" name ": " value) 'fixedcase) + (while (and (not (eobp)) + (looking-at "^[#:]")) + (if (save-excursion (end-of-line) (eobp)) + (progn + (end-of-line) + (insert "\n")) + (forward-line) + (beginning-of-line))) + (insert "#+" name ": " value "\n"))))) + + (defun my--buffer-prop-remove (name) + "Remove a buffer property called NAME." + (org-with-point-at 1 + (when (re-search-forward (concat "\\(^#\\+" name ":.*\n?\\)") + (point-max) t) + (replace-match "")))) + (use-package org-roam ; :requires emacsql-sqlite-builtin :ensure t