Compare commits

...

5 commits

Author SHA1 Message Date
Benson Chu
78ee56cf62 Hmmm, I can't fix this in a clean way, and I'm not sure why... 2025-07-08 14:47:14 -05:00
Benson Chu
cb3018c8f3 There's a bug in the original implementation 2025-07-08 09:39:59 -05:00
Benson Chu
7ce0237fd1 View org agenda files, for pruning 2025-07-08 09:39:48 -05:00
Benson Chu
a2692f2135 Gosh this is annoying 2025-07-08 09:37:45 -05:00
Benson Chu
030f1135e1 Use tabs to make this more specific 2025-07-08 09:37:06 -05:00
8 changed files with 139 additions and 54 deletions

View file

@ -508,8 +508,7 @@
'(display-buffer-in-side-window
(side . left)
(dedicated . t)
(inhibit-same-window . t)
(window-parameters (no-other-window . t))))
(inhibit-same-window . t)))
(global-set-key (kbd "C-x g") 'magit-status)
(global-set-key (kbd "C-x M-g") 'magit-dispatch)
(require 'magit-overrides)

View file

@ -53,7 +53,15 @@
(cl-position it llvm-font-lock-keywords)
(nth it llvm-font-lock-keywords)
(setf it
`(,(rx word-boundary (optional "-") )))))
`(,(rx word-boundary (optional "-") ))))
(pop c-mode-common-hook)
(add-hook 'c-mode-common-hook
(function
(lambda nil
(if (and buffer-file-name (string-match "llvm" buffer-file-name))
(progn
(c-set-style "llvm.org")))))))
(provide 'load-llvm-mode)
;;; load-llvm-mode.el ends here

View file

@ -163,9 +163,9 @@
transient-display-buffer-action)))
(when (window-live-p transient--window)
(with-selected-window transient--window
;; Save the previous value of the 'no-other-window window parameter.
(set-window-parameter nil 'prev--no-other-window
(window-parameter nil 'no-other-window))
(set-window-parameter nil 'no-other-window t)
(goto-char (point-min))
(when transient-enable-popup-navigation
(transient--goto-button focus))
@ -175,5 +175,42 @@
:override
#'my/transient--show)
;; What's so great about the above advice? Why can't the below work?!
;;
;; (defun my/transient--show-post ()
;; (let ((transient--shadowed-buffer (current-buffer))
;; (focus nil))
;; (setq transient--buffer (get-buffer-create transient--buffer-name))
;; (with-current-buffer transient--buffer
;; (when transient-enable-popup-navigation
;; (setq focus (or (button-get (point) 'command)
;; (and (not (bobp))
;; (button-get (1- (point)) 'command))
;; (transient--heading-at-point)))))
;; (when (window-live-p transient--window)
;; (with-selected-window transient--window
;; (set-window-parameter nil 'prev--no-other-window
;; (window-parameter nil 'no-other-window))
;; (set-window-parameter nil 'no-other-window t)
;; (goto-char (point-min))
;; (when transient-enable-popup-navigation
;; (transient--goto-button focus))
;; (transient--fit-window-to-buffer transient--window)))))
;; (advice-add #'transient--show
;; :after
;; #'my/transient--show-post)
(defun my/transient--delete-win-restore-window-param (&rest ignore)
(when (window-live-p transient--window)
(with-selected-window transient--window
;; Restore the value
(set-window-parameter nil 'no-other-window
(window-parameter nil 'prev--no-other-window)))))
(advice-add #'transient--delete-window
:before
#'my/transient--delete-win-restore-window-param)
(provide 'magit-overrides)
;;; magit-overrides.el ends here

View file

@ -70,14 +70,24 @@
it))))
(defun mvt/get-all-buffers (tab-name)
(let* ((tab-sym (intern tab-name))
(mvti (mvt/get-or-create-info tab-sym))
(max-num (slot-value mvti 'max-number))
buffs)
(dotimes (i max-num)
(awhen (get-buffer (mvt/format-buffer-name tab-name i))
(push it buffs)))
(reverse buffs)))
(->> (buffer-list)
(remove-if-not
(lambda (buff)
(with-current-buffer buff
(and (eq major-mode 'vterm-mode)
(string-match-p
(rx "*" (literal tab-name) "-vterm<" (+ digit) ">*")
(buffer-name buff))))))))
;; (defun mvt/get-all-buffers (tab-name)
;; (let* ((tab-sym (intern tab-name))
;; (mvti (mvt/get-or-create-info tab-sym))
;; (max-num (slot-value mvti 'max-number))
;; buffs)
;; (dotimes (i max-num)
;; (awhen (get-buffer (mvt/format-buffer-name tab-name i))
;; (push it buffs)))
;; (reverse buffs)))
;; (mvt/get-all-buffers (alist-get 'name (tab-bar--current-tab)))

View file

@ -26,7 +26,7 @@
(require 'org-roam)
(require 'org-roam-util)
(defvar my/current-logger-cache nil)
(defvar my/current-logger-cache (make-hash-table))
(defvar my/org-roam-logger-filter-fun nil)
(defvar my/org-roam-logger-templates
@ -51,36 +51,41 @@
(defun my/org-roam-logger-capture-current (arg)
(interactive "P")
(when (or (null my/current-logger-cache)
(equal arg '(16))
(equal arg '(64)))
(setq my/current-logger-cache
(org-roam-node-read
nil
(when (not (equal arg '(64)))
my/org-roam-logger-filter-fun))))
(let* ((tab-sym (intern (alist-get 'name (tab-bar--current-tab))))
(node
(or (and (not (equal arg '(16)))
(not (equal arg '(64)))
(gethash tab-sym my/current-logger-cache))
(puthash tab-sym
(org-roam-node-read
nil
(when (not (equal arg '(64)))
my/org-roam-logger-filter-fun))
my/current-logger-cache))))
;; On NEW nodes, org-roam-node-read generates an empty struct with
;; only a few things, one of which being an id. Do a sanity check to
;; make sure that we re-init the current node with a node that has
;; the file name. Only do this initialization if we have an ID for
;; the org-roam.
;;
;; ASSUMPTION: org-roam-capture- initializes node with
;; org-roam-node-id field.
;;
;; TODO: Ummm, this doesn't work in the case where the file gets deleted
;; after a first capture + capture abort.
(when (and (null (org-roam-node-file node))
(org-roam-node-id node))
(setq node
(org-roam-node-from-id (org-roam-node-id node))))
;; On NEW nodes, org-roam-node-read generates an empty struct with
;; only a few things, one of which being an id. Do a sanity check to
;; make sure that we re-init the current node with a node that has
;; the file name. Only do this initialization if we have an ID for
;; the org-roam.
;;
;; ASSUMPTION: org-roam-capture- initializes node with
;; org-roam-node-id field.
(when (and (null (org-roam-node-file my/current-logger-cache))
(org-roam-node-id my/current-logger-cache))
(setq my/current-logger-cache
(org-roam-node-from-id (org-roam-node-id my/current-logger-cache))))
(if (equal arg '(4))
(-> my/current-logger-cache
(org-roam-node-file)
(find-file-noselect)
(pop-to-buffer-same-window))
(org-roam-capture-
:node my/current-logger-cache
:templates my/org-roam-logger-templates)))
(if (equal arg '(4))
(-> node
(org-roam-node-file)
(find-file-noselect)
(pop-to-buffer-same-window))
(org-roam-capture-
:node node
:templates my/org-roam-logger-templates))))
(provide 'my-org-roam-logger)
;;; my-org-roam-logger.el ends here

View file

@ -38,5 +38,33 @@
:before
#'my/update-org-agenda-files)
(defun my/view-org-agenda-files ()
(interactive)
(find-file
(consult--read
org-agenda-files
:prompt "org-agenda-files: "
:sort nil ;; cands are already sorted
:require-match t
:state (consult--preview-org-agenda-files)
:category 'org-roam-node)))
(defun consult--preview-org-agenda-files ()
"Create preview function for nodes."
(let ((open (consult--temporary-files))
(preview (consult--buffer-preview))
(state (window-state-get)))
(lambda (action cand)
(when (eq action 'exit)
(progn
;; Restore saved window state
;; To move point to the original position
(window-state-put state)
(funcall open)))
(funcall preview action
(and cand
(eq action 'preview)
(funcall open cand))))))
(provide 'org-roam-update-agenda)
;;; org-roam-update-agenda.el ends here

View file

@ -108,14 +108,6 @@
(add-to-list 'auto-mode-alist '("\\.gel" . c-mode))
(pop c-mode-common-hook)
(add-hook 'c-mode-common-hook
(function
(lambda nil
(if (and buffer-file-name (string-match "llvm" buffer-file-name))
(progn
(c-set-style "llvm.org"))))))
(define-key *root-map* (kbd "u")
(lambda ()
(interactive)

View file

@ -261,6 +261,10 @@
(setq org-refile-targets `((nil :maxlevel . 9)
(org-agenda-files :maxlevel . 9)))
(global-set-key (kbd "C-c n a") #'my/view-org-agenda-files)
(setq org-agenda-sticky t)
(require 'org-protocol)
;; (defun wait-mark-blocking-tasks (change-plist)
@ -513,10 +517,12 @@
(defun my/org-roam-find-active-projects ()
(interactive)
;; Select a project file to open, creating it if necessary
(org-roam-node-find nil nil
(my/org-roam-filter-by-tag '("Project" "active"))
nil :templates my/project-templates))
(cl-letf (((symbol-function 'org-roam-node-read)
(symbol-function 'consult-org-roam-node-read)))
;; Select a project file to open, creating it if necessary
(org-roam-node-find nil nil
(my/org-roam-filter-by-tag '("Project" "active"))
nil :templates my/project-templates)))
(defun org-agenda-insert-breaks-between (str1 str2)
(let ((r (rx line-start