From b5f11df3be25677f88ac86bedecbf3836fc92f0e Mon Sep 17 00:00:00 2001 From: Thierry Pouplier Date: Fri, 17 Jul 2026 21:15:34 -0400 Subject: [PATCH] cleanup: remove 3 unused Plan-file bookmark functions --- doom/.config/doom/README.org | 66 ++---------------------------------- doom/.config/doom/config.el | 66 ++---------------------------------- 2 files changed, 6 insertions(+), 126 deletions(-) diff --git a/doom/.config/doom/README.org b/doom/.config/doom/README.org index 5d11fc4..cc8b11a 100644 --- a/doom/.config/doom/README.org +++ b/doom/.config/doom/README.org @@ -3556,52 +3556,8 @@ to .org files under the project root." (let ((default-directory (projectile-project-root))) (gortium/read-dir-local 'gortium/project-tag)))) -(defun gortium/read-plan-bookmarks () - "Parse * Bookmarks from the Plan file. -Returns alist ((NAME . URL) ...) where URL is the link target." - (when-let* ((plan-file (gortium/project-plan-file)) - (_ (file-exists-p plan-file))) - (with-temp-buffer - (insert-file-contents plan-file) - (goto-char (point-min)) - (when (re-search-forward "^\* Bookmarks" nil t) - (forward-line 1) - (let ((bookmarks '())) - (while (not (or (eobp) (looking-at "^\* "))) - (cond - ;; ** Name\n[[file:path][Name]] - ((looking-at "^\*\* \(.+\) -\[\[file:\(.+\)\]\[\(.+\)\]\]") - (push (cons (match-string 1) (match-string 2)) bookmarks) - (forward-line 2)) - ;; standalone [[url][name]] - ((looking-at "\[\[\(.+\)\]\[\(.+\)\]\]") - (unless (string-prefix-p "mu4e:" (match-string 1)) - (push (cons (match-string 2) (match-string 1)) bookmarks)) - (forward-line 1)) - (t (forward-line 1)))) - (setq gortium/project-bookmark-names (mapcar #'car bookmarks)) - (nreverse bookmarks)))))) - - - -(defun gortium/remove-bookmark-from-plan (name) - "Remove a bookmark entry from * Bookmarks in the Plan file." - (when-let* ((plan-file (gortium/project-plan-file))) - (with-temp-buffer - (insert-file-contents plan-file) - (goto-char (point-min)) - (when (re-search-forward (format "^\*\* %s -" (regexp-quote name)) nil t) - (forward-line -1) - (let ((start (point))) - (forward-line 2) - (delete-region start (point))) - (write-region (point-min) (point-max) plan-file nil 'silent) - (message "Bookmark '%s' removed from Plan file" name) - (setq gortium/project-bookmark-names - (delete name gortium/project-bookmark-names)))))) - +( +( (defun gortium/bookmark-set () "Save a bookmark. Prompts: (g)lobal or (p)roject. Project bookmarks go to .bookmarks file in project root." @@ -3661,23 +3617,7 @@ Project bookmarks are deleted from the .bookmarks file in the project root." (bookmark-save nil proj-file t) (message "Deleted project bookmark: %s" bm-name)))))))))))) -(defun gortium/sync-plan-to-bookmark-file (bookmarks) - "Write BOOKMARKS alist back to the Plan file under * Bookmarks." - (when-let* ((plan-file (gortium/project-plan-file))) - (with-temp-buffer - (insert-file-contents plan-file) - (when (re-search-forward "^\* Bookmarks" nil t) - (forward-line 1) - (let ((start (point))) - (if (re-search-forward "^\* " nil t) - (forward-line -1) - (goto-char (point-max))) - (delete-region start (point))) - (dolist (bm (nreverse (copy-tree bookmarks))) - (insert (format "[[%s][%s]] -" (cdr bm) (car bm)))) - (write-region (point-min) (point-max) plan-file nil 'silent))))) - +( (defun gortium/transfer-to-project () "Transfer a global bookmark to the current project's .bookmarks." (interactive) diff --git a/doom/.config/doom/config.el b/doom/.config/doom/config.el index 1163ae1..e5f4ffc 100644 --- a/doom/.config/doom/config.el +++ b/doom/.config/doom/config.el @@ -2623,52 +2623,8 @@ to .org files under the project root." (let ((default-directory (projectile-project-root))) (gortium/read-dir-local 'gortium/project-tag)))) -(defun gortium/read-plan-bookmarks () - "Parse * Bookmarks from the Plan file. -Returns alist ((NAME . URL) ...) where URL is the link target." - (when-let* ((plan-file (gortium/project-plan-file)) - (_ (file-exists-p plan-file))) - (with-temp-buffer - (insert-file-contents plan-file) - (goto-char (point-min)) - (when (re-search-forward "^\* Bookmarks" nil t) - (forward-line 1) - (let ((bookmarks '())) - (while (not (or (eobp) (looking-at "^\* "))) - (cond - ;; ** Name\n[[file:path][Name]] - ((looking-at "^\*\* \(.+\) -\[\[file:\(.+\)\]\[\(.+\)\]\]") - (push (cons (match-string 1) (match-string 2)) bookmarks) - (forward-line 2)) - ;; standalone [[url][name]] - ((looking-at "\[\[\(.+\)\]\[\(.+\)\]\]") - (unless (string-prefix-p "mu4e:" (match-string 1)) - (push (cons (match-string 2) (match-string 1)) bookmarks)) - (forward-line 1)) - (t (forward-line 1)))) - (setq gortium/project-bookmark-names (mapcar #'car bookmarks)) - (nreverse bookmarks)))))) - - - -(defun gortium/remove-bookmark-from-plan (name) - "Remove a bookmark entry from * Bookmarks in the Plan file." - (when-let* ((plan-file (gortium/project-plan-file))) - (with-temp-buffer - (insert-file-contents plan-file) - (goto-char (point-min)) - (when (re-search-forward (format "^\*\* %s -" (regexp-quote name)) nil t) - (forward-line -1) - (let ((start (point))) - (forward-line 2) - (delete-region start (point))) - (write-region (point-min) (point-max) plan-file nil 'silent) - (message "Bookmark '%s' removed from Plan file" name) - (setq gortium/project-bookmark-names - (delete name gortium/project-bookmark-names)))))) - +( +( (defun gortium/bookmark-set () "Save a bookmark. Prompts: (g)lobal or (p)roject. Project bookmarks go to .bookmarks file in project root." @@ -2728,23 +2684,7 @@ Project bookmarks are deleted from the .bookmarks file in the project root." (bookmark-save nil proj-file t) (message "Deleted project bookmark: %s" bm-name)))))))))))) -(defun gortium/sync-plan-to-bookmark-file (bookmarks) - "Write BOOKMARKS alist back to the Plan file under * Bookmarks." - (when-let* ((plan-file (gortium/project-plan-file))) - (with-temp-buffer - (insert-file-contents plan-file) - (when (re-search-forward "^\* Bookmarks" nil t) - (forward-line 1) - (let ((start (point))) - (if (re-search-forward "^\* " nil t) - (forward-line -1) - (goto-char (point-max))) - (delete-region start (point))) - (dolist (bm (nreverse (copy-tree bookmarks))) - (insert (format "[[%s][%s]] -" (cdr bm) (car bm)))) - (write-region (point-min) (point-max) plan-file nil 'silent))))) - +( (defun gortium/transfer-to-project () "Transfer a global bookmark to the current project's .bookmarks." (interactive)