From 9937e9db3fc4244cbbdffc433247ec9b0f519866 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Mon, 13 Oct 2025 10:45:56 +0700 Subject: [PATCH] emacs: joe/org-clock-project-heading, expand-region keybindings, pyenv package --- .config/emacs/init.org | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.config/emacs/init.org b/.config/emacs/init.org index df47704..4386d76 100644 --- a/.config/emacs/init.org +++ b/.config/emacs/init.org @@ -267,9 +267,9 @@ Finish up '((dotenv :url "https://github.com/pkulev/dotenv.el") (gptel :url "https://github.com/karthink/gptel") (indent-bars :url "https://github.com/jdtsmith/indent-bars") + (pyenv :url "https://github.com/jorgenschaefer/pyvenv") (doom-themes :url "https://github.com/JosephFerano/doom-themes") (org-timeblock :url "https://github.com/ichernyshovvv/org-timeblock") - (org-roam-ui :url "https://github.com/org-roam/org-roam-ui") (dape :url "https://github.com/svaante/dape") (odin-mode :url "https://github.com/mattt-b/odin-mode") (app-launcher :url "https://github.com/SebastienWae/app-launcher"))) @@ -838,6 +838,8 @@ Fill region is great, except when you don't need it... (evil-global-set-key 'insert (kbd "C-M-e") #'er/expand-region) (evil-global-set-key 'insert (kbd "C-M-p") #'er/mark-inside-pairs) (evil-global-set-key 'insert (kbd "C-M-f") #'er/mark-method-call) +(define-key global-map (kbd "C-=") #'er/expand-region) +(define-key global-map (kbd "C-+") #'er/contract-region) #+end_src *** Boon #+begin_src emacs-lisp :tangle no @@ -2881,6 +2883,19 @@ instead of =org-files-list=. For each buffer in the list, we switch to it with process the clocks in that buffer as before. We find open clocks in the current buffer's associated file using =(buffer-file-name buffer)=. It's assumed that all Org mode buffers have associated files. + +#+begin_src emacs-lisp +(defun joe/org-clock-project-heading () + "Return the project name (level 2 heading)." + (save-excursion + ;; Keep going up until we reach level 2 (or can't go up anymore) + (while (and (> (org-current-level) 2) + (org-up-heading-safe))) + (substring-no-properties (org-get-heading t t t t)))) + +(setq org-clock-heading-function #'joe/org-clock-project-heading) + +#+end_src #+end_src *** Visuals #+begin_src emacs-lisp