diff --git a/doom/.config/doom/.gitignore b/doom/.config/doom/.gitignore new file mode 100644 index 0000000..751553b --- /dev/null +++ b/doom/.config/doom/.gitignore @@ -0,0 +1 @@ +*.bak diff --git a/doom/.config/doom/README.org b/doom/.config/doom/README.org index d841215..cdf2f2d 100644 --- a/doom/.config/doom/README.org +++ b/doom/.config/doom/README.org @@ -993,7 +993,7 @@ Broken for now.. (truncate p1) (1+ (truncate p2)) nil `(priority ,(setq elgantt-user-set-color-priority-counter (1- elgantt-user-set-color-priority-counter)) - :elgantt-user-overlay ,elgantt-org-id))))))))))) + :elgantt-user-overlay ,elgantt-org-id)))))))))) ;; --- Rule 3: Blocker Lines --- (elgantt-create-display-rule draw-blocker-lines @@ -2175,48 +2175,40 @@ If SESSION-ID is empty, show a menu of recent sessions to browse." (if (string-empty-p id) (let* ((output (shell-command-to-string "hermes sessions list --limit 50 2>&1")) (lines (split-string output "\n" t)) - (data-lines (nthcdr 2 lines)) ; skip header + separator - (id-re "[0-9]\\{8\\}_[0-9]\\{6\\}_[a-f0-9]\\{6\\}") - (items (delq nil - (mapcar (lambda (line) - (when (string-match (concat id-re "$") line) - (let* ((id (match-string 0 line)) - (before-id (substring line 0 (match-beginning 0))) - (full-preview (string-trim - (replace-regexp-in-string - "\\s-+[a-z][a-z0-9]*\\s-*$" "" before-id)))) - (cons full-preview id))) - data-lines)) + (data-lines (nthcdr 2 lines)) + (id-regex "[0-9]\\{8\\}_[0-9]\\{6\\}_[a-f0-9]\\{6\\}") + (sessions (delq nil + (mapcar + (lambda (line) + (when (string-match (concat id-regex "$") line) + (let* ((sid (match-string 0 line)) + (before (substring line 0 (match-beginning 0)))) + (list (string-trim before) sid)))) + data-lines))) + (items (mapcar (lambda (s) (cons (car s) (cadr s))) sessions)) (titles (delq nil - (mapcar (lambda (line) - (when (string-match (concat id-re "$") line) - (let* ((id (match-string 0 line)) - (before-id (substring line 0 (match-beginning 0))) - (full (string-trim + (mapcar + (lambda (s) + (let* ((sid (cadr s)) + (full (car s)) + (title (car (split-string full "\\s-\\{3,\\}" t))) + (clean (string-trim (replace-regexp-in-string - "\\s-+[a-z][a-z0-9]*\\s-*$" "" before-id))) - (clean (string-trim - (replace-regexp-in-string - "\\s-+\\(just now\\|[0-9]+[mhd] ago\\|[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)$" - "" full)))) - (cons id clean))) - data-lines)))) + "^\\[[^]]+\\]\\s-+" "" title)))) + (when sid (cons sid clean)))) + sessions)))) (if (null items) - (user-error "No recent sessions found") - (let* ((vertico-sort-function 'identity) ; keep vertico, no re-sort - (choice (completing-read "Session: " items nil t)) - (sid (cdr (assoc choice items))) - (default-title (cdr (assoc sid titles)))) - (list sid (read-string "Title: " default-title))))) + (user-error "No recent sessions found") + (let* ((vertico-sort-function 'identity) + (choice (completing-read "Session: " items nil t)) + (sid (cdr (assoc choice items))) + (default-title (cdr (assoc sid titles)))) + (list sid (read-string "Title: " default-title))))) (list id (read-string "Title: "))))) (pcase-let ((`(,root ,sfile ,name) (gortium/hermes--project-info))) (gortium/hermes--rename-session id (format "[%s] %s" name title)) (gortium/hermes-append-session sfile id title) (message "Session %s linked to project %s as \"%s\"" id name title))) - -;; ------------------------------------------------------------------- -;; Keybindings (under SPC p) -;; ------------------------------------------------------------------- (map! :leader :desc "New Hermes session" "p h" #'gortium/hermes-start :desc "Resume Hermes session" "p H" #'gortium/hermes-resume diff --git a/doom/.config/doom/config.el b/doom/.config/doom/config.el index 0ec798b..d5df5fd 100644 --- a/doom/.config/doom/config.el +++ b/doom/.config/doom/config.el @@ -1371,48 +1371,40 @@ If SESSION-ID is empty, show a menu of recent sessions to browse." (if (string-empty-p id) (let* ((output (shell-command-to-string "hermes sessions list --limit 50 2>&1")) (lines (split-string output "\n" t)) - (data-lines (nthcdr 2 lines)) ; skip header + separator - (id-re "[0-9]\\{8\\}_[0-9]\\{6\\}_[a-f0-9]\\{6\\}") - (items (delq nil - (mapcar (lambda (line) - (when (string-match (concat id-re "$") line) - (let* ((id (match-string 0 line)) - (before-id (substring line 0 (match-beginning 0))) - (full-preview (string-trim - (replace-regexp-in-string - "\\s-+[a-z][a-z0-9]*\\s-*$" "" before-id)))) - (cons full-preview id))) - data-lines)) + (data-lines (nthcdr 2 lines)) + (id-regex "[0-9]\\{8\\}_[0-9]\\{6\\}_[a-f0-9]\\{6\\}") + (sessions (delq nil + (mapcar + (lambda (line) + (when (string-match (concat id-regex "$") line) + (let* ((sid (match-string 0 line)) + (before (substring line 0 (match-beginning 0)))) + (list (string-trim before) sid)))) + data-lines))) + (items (mapcar (lambda (s) (cons (car s) (cadr s))) sessions)) (titles (delq nil - (mapcar (lambda (line) - (when (string-match (concat id-re "$") line) - (let* ((id (match-string 0 line)) - (before-id (substring line 0 (match-beginning 0))) - (full (string-trim + (mapcar + (lambda (s) + (let* ((sid (cadr s)) + (full (car s)) + (title (car (split-string full "\\s-\\{3,\\}" t))) + (clean (string-trim (replace-regexp-in-string - "\\s-+[a-z][a-z0-9]*\\s-*$" "" before-id))) - (clean (string-trim - (replace-regexp-in-string - "\\s-+\\(just now\\|[0-9]+[mhd] ago\\|[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)$" - "" full)))) - (cons id clean))) - data-lines)))) + "^\\[[^]]+\\]\\s-+" "" title)))) + (when sid (cons sid clean)))) + sessions)))) (if (null items) - (user-error "No recent sessions found") - (let* ((vertico-sort-function 'identity) ; keep vertico, no re-sort - (choice (completing-read "Session: " items nil t)) - (sid (cdr (assoc choice items))) - (default-title (cdr (assoc sid titles)))) - (list sid (read-string "Title: " default-title))))) + (user-error "No recent sessions found") + (let* ((vertico-sort-function 'identity) + (choice (completing-read "Session: " items nil t)) + (sid (cdr (assoc choice items))) + (default-title (cdr (assoc sid titles)))) + (list sid (read-string "Title: " default-title))))) (list id (read-string "Title: "))))) (pcase-let ((`(,root ,sfile ,name) (gortium/hermes--project-info))) (gortium/hermes--rename-session id (format "[%s] %s" name title)) (gortium/hermes-append-session sfile id title) (message "Session %s linked to project %s as \"%s\"" id name title))) - -;; ------------------------------------------------------------------- -;; Keybindings (under SPC p) -;; ------------------------------------------------------------------- (map! :leader :desc "New Hermes session" "p h" #'gortium/hermes-start :desc "Resume Hermes session" "p H" #'gortium/hermes-resume