From 8e5efcab4043ef9824456e96f056bb99440b3ec4 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 26 May 2026 17:01:03 -0500 Subject: feat(projectile): open the project daily prep on C-c p d I added cj/open-project-daily-prep on C-c p d. It opens inbox/today-prep.org under the Projectile project root in another window, project-scoped, so a project without a prep file just reports it rather than erroring. The binding had only ever been eval'd live into the daemon in a past session and vanished on the next restart, so this persists it to the module. Freeing d meant reworking the deadgrep bindings. deadgrep-in-dir moves to C-c p G (replacing plain deadgrep, which stays M-x-callable), and deadgrep-here keeps C-c p g. Plain project-wide deadgrep dropped off the projectile prefix because it overlapped the context-aware and arbitrary-directory variants. Tests cover the open, missing-file, and not-in-a-project paths. --- modules/prog-general.el | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/prog-general.el b/modules/prog-general.el index 93a3a95c..369a8b08 100644 --- a/modules/prog-general.el +++ b/modules/prog-general.el @@ -146,13 +146,27 @@ buffer the user is looking at." (find-file file) (find-file-other-window file))) +(defun cj/open-project-daily-prep () + "Open the current Projectile project's daily prep in another window. +The prep file is inbox/today-prep.org under the project root (a stable +symlink to the dated prep doc). Project-scoped: a project without one gets a +message. Opens in another window so it sits beside the current work." + (interactive) + (if-let ((root (projectile-project-root))) + (let ((file (expand-file-name "inbox/today-prep.org" root))) + (if (file-exists-p file) + (find-file-other-window file) + (message "No inbox/today-prep.org in project: %s" root))) + (message "Not in a Projectile project"))) + (use-package projectile :bind-keymap ("C-c p" . projectile-command-map) :bind (:map projectile-command-map ("r" . projectile-replace-regexp) - ("t" . cj/open-project-root-todo)) + ("t" . cj/open-project-root-todo) + ("d" . cj/open-project-daily-prep)) :custom (projectile-auto-discover nil) (projectile-project-search-path `(,code-dir ,projects-dir)) @@ -219,9 +233,8 @@ If no such file exists there, display a message." :after projectile :bind (:map projectile-command-map - ("G" . deadgrep) ;; project-wide search - ("g" . cj/deadgrep-here) ;; search in context directory - ("d" . cj/deadgrep-in-dir)) ;; prompt for directory + ("G" . cj/deadgrep-in-dir) ;; prompt for any directory + ("g" . cj/deadgrep-here)) ;; search in context directory :config (require 'thingatpt) -- cgit v1.2.3