Compare commits

...

40 commits

Author SHA1 Message Date
Benson Chu
665acffffb Change font 2026-04-04 14:41:53 -05:00
Benson Chu
b5a2eaecff My first attempt for org-create-hierarchy 2026-04-04 14:41:53 -05:00
247c2011f2 These are the colors that prot uses, but I don't want to change yet 2026-04-04 14:41:53 -05:00
Benson Chu
b80bd6a333 Apparently the program has been renamed 2026-04-04 14:41:53 -05:00
Benson Chu
83e2ca5a95 Make that function interactive 2026-04-04 14:41:53 -05:00
Benson Chu
354ce4041e Comp dev 2026-04-02 10:30:16 -05:00
Benson Chu
f41ec5e15b Don't wrap lines olivetti 2026-04-02 10:03:39 -05:00
Benson Chu
e4b4c9f8b4 llvm-lib 3.0! 2026-04-02 10:03:38 -05:00
Benson Chu
e8fc49a0e3 !fixup pdb 2026-04-01 17:14:32 -05:00
Benson Chu
fafd3b8572 Renamed file 2026-04-01 15:21:49 -05:00
Benson Chu
3197b406af Add check for initialized 2026-03-31 16:40:00 -05:00
Benson Chu
78b2de42bf Rename this function 2026-03-27 10:35:49 -05:00
Benson Chu
b961c7e779 mu4e update interval 2026-03-23 13:10:09 -05:00
Benson Chu
790b4666f3 Haha, I can write claude's conversation to a file 2026-03-20 16:06:41 -05:00
Benson Chu
a33ad42fbe Please play nice with the garbage collector 2026-03-20 15:33:24 -05:00
Benson Chu
5e1a286b07 Helper functions for invoking rr 2026-03-20 09:19:57 -05:00
Benson Chu
d2c0089f0f More compatibility with terminal 2026-03-19 13:16:56 -05:00
Benson Chu
176a46b6c1 More font stuff 2026-03-19 13:16:42 -05:00
Benson Chu
e71e963a75 New manager, new workflow 2026-03-19 13:16:06 -05:00
Benson Chu
645198ca3a Go to mail 2026-03-19 13:15:55 -05:00
Benson Chu
7d406db920 Look at commiters from all branches 2026-03-19 13:14:41 -05:00
Benson Chu
82d2a7dd1f [claude] mu4e keep the + indicators
This is a claude hack, I should better understand this later
2026-02-17 15:00:33 -06:00
Benson Chu
c8c246c21b mark all mail 2026-02-17 14:59:59 -06:00
Benson Chu
4a4dac15ee This is how it's supposed to work 2026-02-17 14:59:39 -06:00
Benson Chu
05aea425b8 put attachments there 2026-02-17 14:58:23 -06:00
Benson Chu
e8164a288d Don't need this 2026-02-17 14:57:56 -06:00
Benson Chu
a5ac8c80bb Those are not there anymore 2026-02-12 13:07:02 -06:00
Benson Chu
4fbd344317 More bookmarks for new folder structure 2026-02-12 13:06:17 -06:00
Benson Chu
73c182ea02 toggle thread folding 2026-02-12 13:05:54 -06:00
Benson Chu
e29ef493f5 That is so much better 2026-02-06 13:36:55 -06:00
Benson Chu
d9136aaf52 Let all of these be dedicated 2026-01-27 14:53:39 -06:00
Benson Chu
35b6a3e108 Track what date project is created 2026-01-27 14:51:01 -06:00
Benson Chu
eafeaccf5c I forgot why I did this refactor 2026-01-27 14:50:41 -06:00
Benson Chu
781190964a Return whether the tab was really closed 2026-01-27 14:50:13 -06:00
Benson Chu
56ff85b49a HOLD are similar to invisible 2026-01-27 14:49:51 -06:00
Benson Chu
45d329978e Oh, this should've been committed long ago 2026-01-27 14:49:00 -06:00
Benson Chu
ee7a2a8799 Gosh, get out of my way! 2026-01-27 14:48:00 -06:00
Benson Chu
69afeba124 Scroll only once 2025-11-24 15:50:08 -06:00
Benson Chu
98fcdff36e I want olivetti in conf-mode too 2025-11-20 14:39:22 -06:00
Benson Chu
115b3f977d Check for which branch naming style 2025-11-04 10:21:24 -06:00
32 changed files with 613 additions and 343 deletions

View file

@ -37,7 +37,8 @@
display-buffer-in-side-window
(side . right)
(slot . 1)
(window-parameters . ((no-delete-other-windows . t)))
(window-parameters . ((no-delete-other-windows . t)
(dedicated . t)))
(window-width . 80)))
(add-to-list 'display-buffer-alist
@ -45,7 +46,8 @@
display-buffer-in-side-window
(side . right)
(slot . 2)
(window-parameters . ((no-delete-other-windows . t)))
(window-parameters . ((no-delete-other-windows . t)
(dedicated . t)))
(window-width . 100)))
;; TODO: This should be fixed in future versions of emacs
@ -60,7 +62,8 @@
display-buffer-in-side-window
(side . right)
(slot . 3)
(window-parameters . ((no-delete-other-windows . t)))
(window-parameters . ((no-delete-other-windows . t)
(dedicated . t)))
(window-width . 100)))
(add-to-list 'display-buffer-alist
@ -68,7 +71,8 @@
display-buffer-in-side-window
(side . right)
(slot . 4)
(window-parameters . ((no-delete-other-windows . t)))
(window-parameters . ((no-delete-other-windows . t)
(dedicated . t)))
(window-width . 80)))
(add-to-list 'display-buffer-alist
@ -382,3 +386,35 @@
#+begin_src emacs-lisp
(require 'rgrep-patch)
#+end_src
* Delete-region
#+begin_src emacs-lisp
(defun my/delete-region (beg end &optional region)
;; Pass mark first, then point, because the order matters when
;; calling `kill-append'.
(interactive (progn
(let ((beg (mark))
(end (point)))
(unless (and beg end)
(user-error "The mark is not set now, so there is no region"))
(list beg end 'region))))
(condition-case nil
(let ((string (if region
(funcall region-extract-function 'delete-only)
(filter-buffer-substring beg end 'delete))))
(when (or string (eq last-command 'kill-region))
(setq this-command 'kill-region))
(setq deactivate-mark t)
nil)
((buffer-read-only text-read-only)
;; Set this-command now, so it will be set even if we get an error.
(setq this-command 'kill-region)
;; This should barf, if appropriate, and give us the correct error.
(if kill-read-only-ok
(progn (message "Read only text copied to kill ring") nil)
;; Signal an error if the buffer is read-only.
(barf-if-buffer-read-only)
;; If the buffer isn't read-only, the text is.
(signal 'text-read-only (list (current-buffer)))))))
(global-set-key (kbd "C-M-w") #'my/delete-region)
#+end_src

View file

@ -319,6 +319,9 @@
:after
'update-window-third-height)
;; (global-set-key (kbd "C-V") #'(lambda () (interactive "") (scroll-down-command 1)))
;; (global-set-key (kbd "M-V") #'(lambda () (interactive) (scroll-up-command 1)))
;; Word navigation
(global-set-key (kbd "M-f") 'forward-to-word)
(global-set-key (kbd "M-F") 'forward-word)
@ -974,6 +977,7 @@
(use-package olivetti
:commands (olivetti-mode)
:hook ((prog-mode . olivetti-mode)
(conf-mode . olivetti-mode)
(org-mode . olivetti-mode)
(dired-mode . olivetti-mode)
(org-agenda-mode . olivetti-mode)
@ -981,6 +985,8 @@
(message-mode . olivetti-mode)
(markdown-mode . olivetti-mode))
:config
(setq olivetti-mode-on-hook nil)
(add-to-list 'window-persistent-parameters
'(spilt-window . t))

View file

@ -26,7 +26,7 @@
(defvar exwm-startup-programs
'(("megasync" "QT_SCALE_FACTOR=1 megasync")
"/usr/lib/kdeconnectd"
("compton" "compton -f -i .7 -b")
("compton" "picom --backend=glx -f -i .7 -b")
;; ("compton -f -i .7 -b --backend glx --blur-background --blur-method kawase --blur-strength 2")
"start-pulseaudio-x11;pactl upload-sample /usr/share/sounds/gnome/default/alerts/drip.ogg beep; pactl load-module module-x11-bell sample=beep; xset b 100"
"kdeconnect-indicator"
@ -46,6 +46,7 @@
(start-process-shell-command (file-name-nondirectory program) nil program))))
(defun call-startup-programs ()
(interactive)
(start-minimum-programs)
(when (y-or-n-p "Run startup programs? ")
(dolist (program exwm-startup-programs)

View file

@ -51,8 +51,8 @@
(set-fontset-font "fontset-default"
(cons
(decode-char 'ucs #x2500)
(decode-char 'ucs #x257F))
(font-spec :name "Latin Modern Math" :size 12))
(decode-char 'ucs #x25CF))
(font-spec :name "DejaVu Sans"))
(set-fontset-font "fontset-default"
(cons
(decode-char 'ucs #x2997)

View file

@ -23,7 +23,10 @@
;;; Commentary:
;;; Code:
(require 'clang-option-sets)
(require 'compiler-option-sets)
(defclass clang-option-config (compiler-option-config)
nil)
(defvar clang-subtargets
(make-hash-table :test #'equal))
@ -31,23 +34,23 @@
(defvar clang-options-extensions
(make-hash-table :test #'equal))
(defvar cc/all-target-options
(defvar clang/all-target-options
(make-hash-table))
(defvar cc/current-target-optionset
(defvar clang/current-target-optionset
(make-hash-table))
(defun cc/push-new-target-option (target name option-set)
(defun clang/push-new-target-option (target name option-set)
(puthash target
(cons (cons name option-set)
(gethash target cc/all-target-options))
cc/all-target-options))
(gethash target clang/all-target-options))
clang/all-target-options))
(defun cc/add-and-set-target-option (target name option-set)
(puthash target name cc/current-target-optionset)
(cc/push-new-target-option target name option-set))
(defun clang/add-and-set-target-option (target name option-set)
(puthash target name clang/current-target-optionset)
(clang/push-new-target-option target name option-set))
(defvar cc/file-specific-options
(defvar clang/file-specific-options
(make-hash-table :test #'equal))
(defun my/completing-read-formatter (formatter prompt list)
@ -60,12 +63,12 @@
alist
nil nil #'equal)))
(defun cc/make-clang-option-set (target)
(defun clang/make-clang-option-set (target)
(let ((subtargets (hash-table-values clang-subtargets))
primary extensions)
(setq primary
(my/completing-read-formatter
#'cos/clang-options->string
#'clang/clang-options->string
"Primary Subtarget? "
(remove-if-not (lambda (x)
(string= target
@ -73,121 +76,146 @@
subtargets)))
(cons primary extensions)))
(defun cc/get-named-target-clang-optionset (target option-name)
(defun clang/get-named-target-clang-optionset (target option-name)
(when-let ((target-options
(gethash target cc/all-target-options)))
(gethash target clang/all-target-options)))
(and target-options
(alist-get option-name target-options nil nil #'equal))))
(defun cc/reinitialize-clang-options (target)
(defun clang/reinitialize-clang-options (target)
(interactive (list (intern (lls/conf-get 'target))))
(let ((option-name (or (gethash target cc/current-target-optionset)
(puthash target "default" cc/current-target-optionset))))
(aprog1 (cc/make-clang-option-set target)
(cc/push-new-target-option target option-name it))))
(let ((option-name (or (gethash target clang/current-target-optionset)
(puthash target "default" clang/current-target-optionset))))
(aprog1 (clang/make-clang-option-set target)
(clang/push-new-target-option target option-name it))))
;;; THE function
(defun cc/get-clang-options-for-target (target &optional option-name)
(defun clang/get-clang-options-for-target (target &optional option-name)
(let ((option-name (or option-name
(gethash target cc/current-target-optionset)
(puthash target "default" cc/current-target-optionset))))
(or (gethash (buffer-file-name) cc/file-specific-options)
(cc/get-named-target-clang-optionset target option-name)
(aprog1 (cc/make-clang-option-set target)
(cc/push-new-target-option target option-name it)))))
(gethash target clang/current-target-optionset)
(puthash target "default" clang/current-target-optionset))))
(or (gethash (buffer-file-name) clang/file-specific-options)
(clang/get-named-target-clang-optionset target option-name)
(aprog1 (clang/make-clang-option-set target)
(clang/push-new-target-option target option-name it)))))
;; (cc/get-clang-options-for-target "c29")
;; (clang/get-clang-options-for-target "c29")
(defun cc/new-clang-option-set (target name &optional optionset)
;; (defun clang/new-clang-option-set (target name &optional optionset)
;; (interactive
;; (list (intern (lls/conf-get 'target))
;; (read-string "Name for new optionset? ")))
;; (let ((optionset (or optionset (clang/make-clang-option-set target))))
;; (clang/add-and-set-target-option target name optionset)))
;; (defun clang/copy-clang-option-set (target name &optional optionset)
;; (interactive
;; (list (intern (lls/conf-get 'target))
;; (read-string "Name for new optionset? ")))
;; (let ((optionset (clang/get-clang-options-for-target target)))
;; (clang/add-and-set-target-option target name optionset)))
;; (defun clang/file-specific-option-set (target &optional optionset)
;; (interactive
;; (list (intern (lls/conf-get 'target))))
;; ;; TODO: might need to garbage collect these
;; (or (gethash (buffer-file-name)
;; clang/file-specific-options)
;; (let ((optionset (clang/get-clang-options-for-target target)))
;; (puthash (buffer-file-name)
;; optionset
;; clang/file-specific-options))))
;; (clang/new-clang-option-set "c29" "toyota")
(defun clang/switch-clang-option-set (target name)
(interactive
(list (intern (lls/conf-get 'target))
(read-string "Name for new optionset? ")))
(let ((optionset (or optionset (cc/make-clang-option-set target))))
(cc/add-and-set-target-option target name optionset)))
(defun cc/copy-clang-option-set (target name &optional optionset)
(interactive
(list (intern (lls/conf-get 'target))
(read-string "Name for new optionset? ")))
(let ((optionset (cc/get-clang-options-for-target target)))
(cc/add-and-set-target-option target name optionset)))
(defun cc/file-specific-option-set (target &optional optionset)
(interactive
(list (intern (lls/conf-get 'target))))
;; TODO: might need to garbage collect these
(or (gethash (buffer-file-name)
cc/file-specific-options)
(let ((optionset (cc/get-clang-options-for-target target)))
(puthash (buffer-file-name)
optionset
cc/file-specific-options))))
;; (cc/new-clang-option-set "c29" "toyota")
(defun cc/switch-clang-option-set (target name)
(interactive
(let ((target (lls/conf-get 'target)))
(let ((target lls/conf-get 'target))
(list target
(--> (intern target)
(gethash it cc/all-target-options)
(gethash it clang/all-target-options)
(mapcar #'car it)
(completing-read "Optionset? " it)))))
(remhash (buffer-file-name)
cc/file-specific-options)
(cc/get-clang-options-for-target target name)
(puthash (intern target) name cc/current-target-optionset))
clang/file-specific-options)
(clang/get-clang-options-for-target target name)
(puthash (intern target) name clang/current-target-optionset))
(defun cc/edit-clang-options (prefix)
(defun clang/edit-clang-options (prefix)
(interactive "P")
(let* ((target (intern (lls/conf-get 'target)))
(options-config
(->>
target
(cc/get-clang-options-for-target)
(clang/get-clang-options-for-target)
(car)))
(current-name
(or (and (gethash (buffer-file-name) cc/file-specific-options )
(or (and (gethash (buffer-file-name) clang/file-specific-options )
"file-specific")
(gethash target cc/current-target-optionset))))
(dolist (slot (cddr (eieio-class-slots 'clang-option-config)))
(let* ((slot-sym (eieio-slot-descriptor-name slot))
(slot-val (and (slot-boundp options-config slot-sym)
(slot-value options-config slot-sym))))
(when slot-val
(pcase (cl--slot-descriptor-type slot)
('list
(when (or prefix
(not (zerop (length slot-val))))
(setf (slot-value options-config slot-sym)
(read
(read-string (format "Edit '%s' for optionset '%s': "
(symbol-name slot-sym)
current-name)
(prin1-to-string slot-val))))))
('string
(when (or prefix
(not (string= slot-val "")))
(setf (slot-value options-config slot-sym)
(read-string (format "Edit '%s' for optionset '%s': "
(symbol-name slot-sym)
current-name)
slot-val))))))))))
(gethash target clang/current-target-optionset))))
(cos/edit-compiler-options options-config current-name)))
(defvar cc/detect-extensions-function nil)
(defun clang/clang-options-merge (primary secondary)
(make-instance
'clang-option-config
:target-str (slot-value primary 'target-str)
:binary (or (slot-value primary 'binary-path)
(car (mapcar #'(lambda (x) (slot-value x 'binary-path))) ))
:target (slot-value primary 'target-options)
:lang (slot-value primary 'lang-options)
:optimization (slot-value primary 'optimization-level)
:other (-->
(cons primary secondary)
(mapconcat
(lambda (x)
(when (slot-boundp x 'other-options)
(slot-value x 'other-options)))
it
" "))
:include-dirs (-->
(cons primary secondary)
(apply #'append
(mapcar
(lambda (x)
(when (slot-boundp x 'include-dirs)
(slot-value x 'include-dirs)))
it)))))
(cl-defun cc/get-clang-options (&key filename compiler action)
(defun clang/clang-options->string (opts)
(with-slots
(binary-path
target-options lang-options
other-options optimization-level
include-dirs)
opts
(-->
(list
(or binary-path "")
target-options
lang-options
optimization-level
other-options
(mapconcat (lambda (x)
(format "-I\"%s\"" x))
include-dirs
" "))
(remove-if #'string-empty-p it)
(string-join it " "))))
(defvar clang/detect-extensions-function nil)
(cl-defun clang/get-clang-options (&key filename compiler action)
(interactive)
(let* ((filename (or filename (buffer-file-name)))
(target-str (lls/conf-get 'target))
(target (intern target-str))
(options-config
(cc/get-clang-options-for-target target))
(clang/get-clang-options-for-target target))
(detected-extensions
(awhen cc/detect-extensions-function
(awhen clang/detect-extensions-function
(funcall it compiler action filename target-str))))
(cos/clang-options->string
(cos/clang-options-merge
(clang/clang-options->string
(clang/clang-options-merge
(car options-config)
(append detected-extensions (cdr options-config))))))

View file

@ -1,93 +0,0 @@
;;; clang-option-sets.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2024 Benson Chu
;; Author: Benson Chu <bensonchu457@gmail.com>
;; Created: [2024-05-05 15:13]
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(defclass clang-option-config ()
((target-str :initarg :target-str :type string :initform "")
(binary-path :initarg :binary :type string :initform "")
(target-options :initarg :target :type string :initform "")
(lang-options :initarg :lang :type string :initform "")
(other-options :initarg :other :type string :initform "")
(optimization-level :initarg :optimization :type string :initform "")
(include-dirs :initarg :include-dirs :type list :initform nil)
(system-include-dirs :initarg :isystem :type list :initform nil)))
(defmacro register-prebaked-optionset (hashmap target-str key &rest options)
(declare (indent 3))
`(puthash ',key
(make-instance 'clang-option-config
:target-str ,target-str
,@options)
,hashmap))
(defun cos/clang-options-merge (primary secondary)
(make-instance
'clang-option-config
:target-str (slot-value primary 'target-str)
:binary (or (slot-value primary 'binary-path)
(car (mapcar #'(lambda (x) (slot-value x 'binary-path))) ))
:target (slot-value primary 'target-options)
:lang (slot-value primary 'lang-options)
:optimization (slot-value primary 'optimization-level)
:other (-->
(cons primary secondary)
(mapconcat
(lambda (x)
(when (slot-boundp x 'other-options)
(slot-value x 'other-options)))
it
" "))
:include-dirs (-->
(cons primary secondary)
(apply #'append
(mapcar
(lambda (x)
(when (slot-boundp x 'include-dirs)
(slot-value x 'include-dirs)))
it)))))
(defun cos/clang-options->string (opts)
(with-slots
(binary-path
target-options lang-options
other-options optimization-level
include-dirs)
opts
(-->
(list
(or binary-path "")
target-options
lang-options
optimization-level
other-options
(mapconcat (lambda (x)
(format "-I\"%s\"" x))
include-dirs
" "))
(remove-if #'string-empty-p it)
(string-join it " "))))
(provide 'clang-option-sets)
;;; clang-option-sets.el ends here

View file

@ -0,0 +1,71 @@
;;; compiler-option-sets.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2024 Benson Chu
;; Author: Benson Chu <bensonchu457@gmail.com>
;; Created: [2024-05-05 15:13]
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(defclass compiler-option-config ()
((target-str :initarg :target-str :type string :initform "")
(binary-path :initarg :binary :type string :initform "")
(target-options :initarg :target :type string :initform "")
(lang-options :initarg :lang :type string :initform "")
(other-options :initarg :other :type string :initform "")
(optimization-level :initarg :optimization :type string :initform "")
(include-dirs :initarg :include-dirs :type list :initform nil)
(system-include-dirs :initarg :isystem :type list :initform nil)))
(defmacro register-prebaked-optionset (hashmap target-str key &rest options)
(declare (indent 3))
`(puthash ',key
(make-instance 'compiler-option-config
:target-str ,target-str
,@options)
,hashmap))
(defun cos/edit-compiler-options (optionset current-name)
(dolist (slot (cddr (eieio-class-slots 'compiler-option-config)))
(let* ((slot-sym (eieio-slot-descriptor-name slot))
(slot-val (and (slot-boundp optionsset slot-sym)
(slot-value optionsset slot-sym))))
(when slot-val
(pcase (cl--slot-descriptor-type slot)
('list
(when (or prefix
(not (zerop (length slot-val))))
(setf (slot-value optionsset slot-sym)
(read
(read-string (format "Edit '%s' for optionset '%s': "
(symbol-name slot-sym)
current-name)
(prin1-to-string slot-val))))))
('string
(when (or prefix
(not (string= slot-val "")))
(setf (slot-value optionsset slot-sym)
(read-string (format "Edit '%s' for optionset '%s': "
(symbol-name slot-sym)
current-name)
slot-val)))))))))
(provide 'compiler-option-sets)
;;; compiler-option-sets.el ends here

View file

@ -1,4 +1,4 @@
;;; llvm-shared.el --- -*- lexical-binding: t -*-
;;; lib-comp-dev.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2022 Benson Chu
@ -37,7 +37,7 @@
(defvar llvm-core-count
(nprocs))
(defun lls/ninja-build-tools (build-dir targets &optional verbose)
(defun lls/run-build-command (build-dir targets &optional verbose)
(let ((cmake-make-program
(if (string= "Makefile" (car (directory-files build-dir nil "^\\(build\\.ninja$\\|Makefile\\)$")))
"make"
@ -50,57 +50,58 @@
;; =============================== Init ==============================
(defclass llvm-config ()
(defclass comp-dev-config ()
((root-dir :initarg :root-dir :type string)
(bin-dirs-fun :initarg :bin-dirs-fun :type function)
(build-dirs-fun :initarg :build-dirs-fun :type function)
(build-release-dir :initarg :build-release-dir :type string)
(build-debug-dir :initarg :build-debug-dir :type string)
(target :initarg :target :type string)
(compile-command-fun :initarg :cc :type function :initform (lambda ()))
(dis-command-fun :initarg :dc :type function :initform (lambda ()))
(llc-command-fun :initarg :llc :type function :initform (lambda ()))
(tramp-connection :initarg :tramp :type list :initform nil)
;; Target + CPU -> compilation command options
(target-clang-opts-fun :initarg :clang-opts-fun :type function :initform (lambda ()))
(aux-props :initarg :aux-props :type list :initform nil)))
;; (defvar lls/llvm-config nil)
(cl-defgeneric comp-dev/get-bin-dirs (config))
(cl-defgeneric comp-dev/get-build-dirs (config))
(cl-defgeneric comp-dev/get-file-types (config))
(cl-defgeneric comp-dev/get-c-action-table (config))
(cl-defmethod comp-dev/get-c-action-table (config)
nil)
(cl-defgeneric comp-dev/process-file (config start-type end-type compiler file output flags))
(cl-defgeneric comp-dev/tool-name (config tool))
(defvar lls/llvm-configs (make-hash-table :test #'equal))
(defun comp-dev/get-config (&optional tab-name)
(let ((tab-name (or tab-name (alist-get 'name (tab-bar--current-tab)))))
(gethash tab-name comp-dev/configs)))
(defvar comp-dev/configs (make-hash-table :test #'equal))
(defvar lls/target-init-fun nil)
(defun lls/get-active-configs ()
(hash-table-values lls/llvm-configs))
(defun lls/get-llvm-config (&optional tab-name)
(let ((tab-name (or tab-name (alist-get 'name (tab-bar--current-tab)))))
(gethash tab-name lls/llvm-configs)))
(hash-table-values comp-dev/configs))
(defun lls/set-llvm-config (conf &optional tab-name)
(puthash (or tab-name (alist-get 'name (tab-bar--current-tab)))
conf
lls/llvm-configs))
comp-dev/configs))
;; (defvar lls/llvm-config nil)
(defun lls/conf-get (sym)
(lls/ensure-initialized)
(slot-value (lls/get-llvm-config) sym))
(comp-dev/ensure-initialized)
(slot-value (comp-dev/get-config) sym))
(defun lls/conf-get-safe (sym)
(if-let ((conf (lls/get-llvm-config)))
(if-let ((conf (comp-dev/get-config)))
(slot-value conf sym)
nil))
(defun lls/conf-aux-get (sym)
(lls/ensure-initialized)
(comp-dev/ensure-initialized)
(-->
(lls/conf-get 'aux-props)
(alist-get sym it)))
(defun lls/conf-set (key val)
(lls/ensure-initialized)
(setf (slot-value (lls/get-llvm-config) key)
(comp-dev/ensure-initialized)
(setf (slot-value (comp-dev/get-config) key)
val))
(defun lls/tramp-connection ()
@ -120,9 +121,9 @@
(defun lls/default-initialize ()
(interactive)
(let ((lls/target-init-fun #'lls/default-target-init))
(lls/initialize)))
(comp-dev/initialize)))
(defun lls/initialize ()
(defun comp-dev/initialize ()
(interactive)
(lls/set-llvm-config
(or
@ -134,18 +135,21 @@
(->>
(tab-bar-tabs)
(mapcar #'(lambda (x) (alist-get 'name x)))
(remove-if-not #'(lambda (x) (lls/get-llvm-config x)))))))
(lls/get-llvm-config tab-name))))
(remove-if-not #'(lambda (x) (comp-dev/get-config x)))))))
(comp-dev/get-config tab-name))))
(funcall lls/target-init-fun)))
(load-llvm-mode (lls/conf-get 'root-dir))
(message "llvm-lib initialize!"))
(message "comp-dev initialize!"))
(defun lls/ensure-initialized ()
(when (or (not (lls/get-llvm-config))
(not (llvm-config-p (lls/get-llvm-config))))
(defun comp-dev/initialized? ()
(and (comp-dev/get-config)
(typep (comp-dev/get-config) 'comp-dev-config)))
(defun comp-dev/ensure-initialized ()
(when (not (comp-dev/initialized?))
(if (not (functionp lls/target-init-fun))
(error "Please register an init function for llvm")
(lls/initialize))))
(comp-dev/initialize))))
(defun lls/get-cached-value (key fun)
(or (lls/conf-get key)
@ -177,18 +181,18 @@
;;===---------------------------------------------------------------------===;;
(defun lls/get-llvm-root-dir ()
(lls/ensure-initialized)
(comp-dev/ensure-initialized)
(lls/conf-get 'root-dir))
(defun lls/get-llvm-build-dirs ()
(lls/ensure-initialized)
(comp-dev/ensure-initialized)
(funcall (lls/conf-get 'build-dirs-fun)))
(defun lls/get-llvm-bin-dir ()
(car (lls/get-llvm-bin-dirs)))
(defun lls/get-llvm-bin-dirs ()
(lls/ensure-initialized)
(comp-dev/ensure-initialized)
(append (mapcar #'(lambda (x) (expand-file-name "bin" x))
(lls/get-llvm-build-dirs))
(funcall (lls/conf-get 'bin-dirs-fun))))
@ -202,15 +206,11 @@
(defun lls/add-llvm-build-dir (dir)
(interactive
(list (read-file-name "Where? ")))
(lls/ensure-initialized)
(comp-dev/ensure-initialized)
(lls/conf-set 'build-dirs
(cons dir
(lls/conf-get 'build-dirs))))
(defun lls/get-clang-options (&rest args)
(apply (lls/conf-get 'target-clang-opts-fun)
args))
;; =============================== Misc ==============================
(defun my/completing-read (prompt collection &optional initial-input)
@ -241,7 +241,7 @@
(message "Checking %s..." dir))
(directory-files dir t tool-regexp)))
(or directories
(lls/get-llvm-bin-dirs))))
(comp-dev/get-bin-dirs (comp-dev/get-config)))))
(defun lls/get-clang-command-fun (&rest args)
(apply (lls/conf-get 'compile-command-fun)
@ -386,5 +386,5 @@
(format comm-temp directory build-type target))))
(compile command)))
(provide 'llvm-shared)
;;; llvm-shared.el ends here
(provide 'lib-comp-dev)
;;; lib-comp-dev.el ends here

View file

@ -23,7 +23,7 @@
;;; Commentary:
;;; Code:
(require 'llvm-shared)
(require 'lib-comp-dev)
(require 'action-map-lib)
(defvar ll/asm-file-action-map

View file

@ -24,26 +24,27 @@
;;; Code:
(require 'llvm-ir-mode)
(require 'llvm-shared)
(require 'lib-comp-dev)
(require 'action-map-lib)
(require 'anaphora)
(require 'make-tmp-output-file)
(defvar ll/c-file-action-map
'((debug :key ?d :major-mode llvm-mode :buffer-string "debug" :description "[d]ebug pass" :compiler-action assemble)
(assembly :key ?a :major-mode asm-mode :buffer-string "assembly" :description "[a]ssembly" :compiler-action assemble)
(output-dis :key ?A :major-mode asm-mode :buffer-string "dissasembly" :description "output-dis[A]ssemble" :compiler-action nil)
(preprocess :key ?e :major-mode c-mode :buffer-string "preprocess" :description "pr[e]process" :compiler-action preprocess)
(LLVMIR :key ?l :major-mode llvm-mode :buffer-string "llvm-ir" :description "[l]lvm-ir" :compiler-action llvm-ir)
(before-after :key ?p :major-mode llvm-mode :buffer-string "print-before-after" :description "[p]rint before/after" :compiler-action assemble)
(changed :key ?P :major-mode llvm-mode :buffer-string "print-changed" :description "[P]rint before/after all" :compiler-action assemble)
(executable :key ?\^M :major-mode nil :buffer-string "executable" :description "[RET]Executable" :compiler-action executable)
(diff :key ?D :major-mode nil :buffer-string "diff" :description "[D]iff" :compiler-action assemble)))
'((preprocess :key ?e :major-mode c-mode :buffer-string "preprocess" :description "pr[e]process" :end-state pp-c)
(diff :key ?D :major-mode nil :buffer-string "diff" :description "[D]iff" :end-state asm)))
;; (executable :key ?\^M :major-mode nil :buffer-string "executable" :description "[RET]Executable" :compiler-action executable)
(defun ll/ensure-clang-binary-built (dir)
;; TODO: assumed build-dir constant, should take as argument and prompt
;; further up
(lls/ninja-build-tools dir '("clang")))
(lls/run-build-command dir '("clang")))
(defun ll/get-c-action-map ()
(append
(comp-dev/get-c-action-table
(comp-dev/get-config))
ll/c-file-action-map))
(defun ll/clang-output-disassemble-command (file)
(let ((compiler (lls/prompt-tool "clang$"))
@ -72,25 +73,25 @@
(defun ll/build-clang-command (file action &optional output)
(if (eq action 'output-dis)
(ll/clang-output-disassemble-command file)
(let ((compiler-action (aml/get-map-prop ll/c-file-action-map action :compiler-action))
(compiler (lls/prompt-tool "clang$")))
(let ((end (aml/get-map-prop
(ll/get-c-action-map)
action :end-state))
(compiler (lls/prompt-tool (comp-dev/tool-name (comp-dev/get-config) 'compiler))))
(string-join
(list
(when (y-or-n-p "Would you like to `rr record`? ")
"rr record ")
(lls/get-clang-command-fun
:compiler compiler
:file file
:action compiler-action
:output output
:flags
(list
(pcase action
('debug (format "-mllvm -debug-only=%s" (ll/read-pass-name "Which pass? ")))
('before-after (let ((pass (ll/read-pass-name "Which pass? ")))
(format "-mllvm -print-before=%s -mllvm -print-after=%s" pass pass)))
('changed "-mllvm -print-before-all"))))
" ")
(-->
(comp-dev/get-config)
(comp-dev/process-file
it 'c end compiler file output
(list
(pcase action
('debug (format "-mllvm -debug-only=%s" (ll/read-pass-name "Which pass? ")))
('before-after (let ((pass (ll/read-pass-name "Which pass? ")))
(format "-mllvm -print-before=%s -mllvm -print-after=%s" pass pass)))
('changed "-mllvm -print-before-all")))))
" ")
" "))))
(defun ll/buffer-has-include-error (buffer)
@ -152,13 +153,14 @@
(_ (error "Invalid choice")))))
(defun ll/act-on-c-file (file)
(let* ((action (aml/read-action-map ll/c-file-action-map))
(let* ((action-map (ll/get-c-action-map))
(action (aml/read-action-map action-map))
(output (ll/make-tmp-file
file
(cond
((eq 'assemble
(aml/get-map-prop ll/c-file-action-map action
:compiler-action))
((eq 'asm
(aml/get-map-prop action-map action
:end-state))
".S")
(t ".ll")))))
(if (eq action 'diff)
@ -167,11 +169,11 @@
(aprog1
(compilation-start
comm
(aml/get-map-prop ll/c-file-action-map action :major-mode)
(aml/get-map-prop action-map action :major-mode)
(lambda (x)
(format "*%s-%s*"
(file-name-nondirectory file)
(aml/get-map-prop ll/c-file-action-map action
(aml/get-map-prop action-map action
:buffer-string))))
(with-current-buffer it
(setq ll/act-on-file-output output)))))))

View file

@ -23,7 +23,7 @@
;;; Commentary:
;;; Code:
(require 'llvm-shared)
(require 'lib-comp-dev)
(require 'action-map-lib)
(require 'make-tmp-output-file)

View file

@ -36,7 +36,7 @@
(let ((dir (lls/get-llvm-build-dir)))
(--> file
(list (format "touch %s" it)
(lls/ninja-build-tools dir (list (concat it "^")) t))
(lls/run-build-command dir (list (concat it "^")) t))
(string-join it " && ")
(compilation-start it nil
(lambda (_)

View file

@ -23,7 +23,7 @@
;;; Commentary:
;;; Code:
(require 'llvm-shared)
(require 'lib-comp-dev)
(require 'action-map-lib)
(require 'anaphora)

View file

@ -23,7 +23,7 @@
;;; Commentary:
;;; Code:
(require 'llvm-shared)
(require 'lib-comp-dev)
(require 'action-map-lib)
(require 'dash)
@ -72,7 +72,7 @@
;; further up
(let ((dir (lls/get-llvm-build-dir))
(tools (ll/get-required-binaries-for-test file)))
(lls/ninja-build-tools dir tools)))
(lls/run-build-command dir tools)))
(defun ll/build-lit-command (file action)
(format "%s %s %s"
@ -164,7 +164,7 @@
(when tools
(-->
;; TODO: Assuming debug folder, (lls/get-llvm-build-dir) doesn't work
(lls/ninja-build-tools "/scratch/benson/tools3/llvm_cgt/build/Debug/llvm" (seq-uniq tools))
(lls/run-build-command "/scratch/benson/tools3/llvm_cgt/build/Debug/llvm" (seq-uniq tools))
(compilation-start
it
nil

View file

@ -23,7 +23,7 @@
;;; Commentary:
;;; Code:
(require 'llvm-shared)
(require 'lib-comp-dev)
(require 'my-comp-minor-mode)
(require 'act-on-test-file)
(require 'act-on-c-file)

View file

@ -23,7 +23,7 @@
;;; Commentary:
;;; Code:
(require 'llvm-shared)
(require 'lib-comp-dev)
(defun ll/get-llvm-source-build-command (file)
(interactive
@ -37,7 +37,7 @@
(compilation-start (-->
(list
(format "touch %s" file)
(lls/ninja-build-tools
(lls/run-build-command
build-dir (list (format "%s^" file)) t))
(string-join it " && "))
nil

View file

@ -23,7 +23,7 @@
;;; Commentary:
;;; Code:
(require 'llvm-shared)
(require 'lib-comp-dev)
(require 'tmux-cmd)
(defvar lls/name-llvm-build-buffer
@ -42,7 +42,7 @@
;; "llc")))))
;; (let* ((buffer-name (funcall lls/name-llvm-build-buffer directory tools)))
;; (compilation-start
;; (lls/ninja-build-tools (lls/un-trampify directory) tools)
;; (lls/run-build-command (lls/un-trampify directory) tools)
;; nil
;; (lambda (_) buffer-name))))
@ -56,7 +56,7 @@
"llc")))))
(name (funcall lls/name-llvm-build-buffer directory tools))
(lls/ninja-build-tools (lls/un-trampify directory) tools))
(lls/run-build-command (lls/un-trampify directory) tools))
(provide 'llvm-build-tool)
;;; llvm-build-tool.el ends here

View file

@ -25,7 +25,7 @@
;;; Code:
(require 'act-on-c-file)
(require 'llvm-shared)
(require 'lib-comp-dev)
(require 'anaphora)
(defun ll/get-cc1-command (clang command)

View file

@ -28,7 +28,7 @@
(require 'llvm-gdb-command)
(require 'llvm-show-instr-info)
(require 'llvm-jump-to-tablegen)
(require 'llvm-shared)
(require 'lib-comp-dev)
(define-prefix-command '*llvm-map*)
(define-key *root-map* (kbd "C-w") '*llvm-map*)
@ -37,7 +37,7 @@
(define-key *llvm-map* (kbd "c") #'ll/llvm-build-tool)
(define-key *llvm-map* (kbd "M-w") #'ll/kill-gdb-command)
(define-key *llvm-map* (kbd "i") #'ll/prompt-for-instr-info)
(define-key *llvm-map* (kbd "I") #'lls/initialize)
(define-key *llvm-map* (kbd "I") #'comp-dev/initialize)
(define-key *llvm-map* (kbd "t") #'ll/jump-to-tablegen)
(provide 'llvm-lib)

View file

@ -28,6 +28,7 @@
(interactive (list (lls/conf-get 'root-dir)))
(when (not (require 'my-tablegen-mode nil t))
(load-file (expand-file-name "llvm/utils/emacs/tablegen-mode.el" root-dir)))
(define-key tablegen-mode-map (kbd "M-s") nil)
(when (not (require 'my-llvm-mode nil t))
(load-file (expand-file-name "llvm/utils/emacs/llvm-mode.el" root-dir)))
(load-file (expand-file-name "llvm/utils/emacs/emacs.el" root-dir))

View file

@ -58,13 +58,22 @@
(defun magit-show-ancestor-merges (revs &optional args files)
(interactive (cons (magit-read-starting-point "Ancestry path for: ")
(magit-diff-arguments)))
(let ((flags "--merges --oneline --reverse --ancestry-path"))
(let ((flags "--merges --oneline --reverse --ancestry-path")
(tip (->>
(magit-list-remote-branches)
(remove-if-not
(lambda (x)
(string-match-p "origin/master\\|main" x)))
(car))))
(async-shell-command
(shell-and
(format "git --no-pager log --oneline %s~1..%s"
revs revs)
(format "git --no-pager log %s %s..origin/main | cut -c -70 | head -n 10"
flags revs)))))
(format "git --no-pager log %s %s..%s -- | cut -c -70 | head -n 10"
flags revs
(progn
(string-match "^refs/remotes/\\(.*\\)" tip)
(match-string 1 tip)))))))
(transient-append-suffix 'magit-worktree "b"
'("B" "[async] worktree" my/magit-worktree-checkout))
@ -107,7 +116,7 @@
(save-excursion
(and (string-match "\\`[\s\t]+[0-9]+\t" line)
(list (substring line (match-end 0))))))
(magit-git-lines "shortlog" "-n" "-s" "-e" "HEAD"))
(magit-git-lines "shortlog" "-n" "-s" "-e" "--all"))
my/magit-authors)))
(defun my/magit-transient-read-person (prompt initial-input history)

View file

@ -49,6 +49,36 @@
(defvar mvt/regex
(rx (and "*" (group (+ nonl)) "-vterm<" (group (+ digit)) ">" "*")))
;; Maybe instead of this, we should do an add-buffer instead
(defun mvt/find-available-name (tab-name)
(let ((mvti (gethash (intern tab-name) mvt/info))
final-name)
(while (not final-name)
(let* ((index (or (pop (slot-value mvti 'free-numbers))
(cl-incf (slot-value mvti 'max-number))))
(name (mvt/format-buffer-name tab-name index)))
(when (not (get-buffer name))
(setq final-name name))))
final-name))
(defun mvt/add-buffer (tab-name vterm-buffer)
(interactive
(list (alist-get 'name (tab-bar--current-tab))
(vterm--internal #'ignore)))
(let* ((mvti (gethash (intern tab-name) mvt/info))
(name (mvt/find-available-name tab-name))
vterm-name)
(with-current-buffer vterm-buffer
(mvt/minor-mode)
(rename-buffer name))
(-->
vterm-buffer
(setf (slot-value mvti 'recent-buffer)
it)
(if (called-interactively-p)
(switch-to-buffer it)
it))))
(defun mvt/create-buffer (tab-name)
(interactive
(list (alist-get 'name (tab-bar--current-tab))))
@ -70,14 +100,23 @@
it))))
(defun mvt/get-all-buffers (tab-name)
(->> (buffer-list)
(--> (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))))))))
(buffer-name buff)))))
it)
(sort
it
:key
(lambda (buff)
(let ((name (buffer-name buff)))
(string-match (rx "*" (literal tab-name) "-vterm<" (group (+ digit)) ">*")
name)
(string-to-number (match-string 1 name)))))))
;; (defun mvt/get-all-buffers (tab-name)
;; (let* ((tab-sym (intern tab-name))
@ -147,7 +186,7 @@
(defvar mvt/minor-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "M-n") #'mvt/next)
(define-key map (kbd "M-c") #'mvt/create-buffer)
(define-key map (kbd "M-c") #'mvt/add-buffer)
map))
(define-minor-mode mvt/minor-mode ""
@ -168,7 +207,7 @@
(buffer-live-p buffer)
(not arg)
buffer)
(mvt/create-buffer tab-name))))))
(call-interactively #'mvt/add-buffer))))))
(defun mvt/find-all-terms-in-tab (tab-name)
(remove-if-not #'(lambda (b)
@ -198,7 +237,7 @@
(defun mvt/close-tab (orig)
(let ((current-tab-name (alist-get 'name (tab-bar--current-tab))))
(when (funcall orig)
(dolist (b (mvt/find-all-terms-in-tab old-tab-name))
(dolist (b (mvt/find-all-terms-in-tab current-tab-name))
(with-current-buffer b
(vterm-send-C-d))))))

View file

@ -0,0 +1,47 @@
;;; org-create-hierarchy.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2025 Benson Chu
;; Author: Benson Chu <bensonchu457@gmail.com>
;; Created: [2025-12-26 10:33]
;; This file is not part of GNU Emacs
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(defun org-create-hierarchy (time format-strings &optional depth reverse)
(cl-labels ((create-hierarchy (time format-strings depth)
(when-let* ((fmt (car format-strings))
(timestr (format-time-string fmt time)))
(let ((str (concat (make-string depth ?*) " " timestr)))
(or (prog1 (search-forward str nil t)
(end-of-line))
(progn
(unless reverse
(when (org-get-next-sibling)
(previous-line)
(end-of-line)))
(insert "\n" str)))
(create-hierarchy time (cdr format-strings) (1+ depth))))))
(goto-char (point-min))
(create-hierarchy time format-strings (or depth 1))))
;; (org-create-hierarchy (current-time) '("%Y" "%B"))
(provide 'org-create-hierarchy)
;;; org-create-hierarchy.el ends here

View file

@ -51,7 +51,7 @@
;; All todo children are done? Stuck!
(not (olc/any-todo-children?
(not (member (cdr (opr/get-type-and-state))
'(done wait invis))))))
'(done wait invis hold))))))
'stuck
'active)))

View file

@ -62,13 +62,17 @@
(let ((type (opr/get-type)))
(pcase type
('project
(when (eq 'stuck (opr/type-of-project))
(let ((res (-> (point)
(org-element-headline-parser)
(org-ql--add-markers)
(my/get-project-stuck-displayables)
(reverse))))
(setf display (append res display)))))
(pcase (opr/type-of-project)
('stuck
(let ((res (-> (point)
(org-element-headline-parser)
(org-ql--add-markers)
(my/get-project-stuck-displayables)
(reverse))))
(setf display (append res display))))
('hold
(push (org-ql--add-markers (org-element-headline-parser (point)))
nothing))))
('task
(cond
((eq 'stuck (opr/type-of-task))

View file

@ -74,9 +74,10 @@
(defun close-tab-switch ()
(interactive)
(let ((old-name (alist-get 'name (tab-bar--current-tab))))
(when (y-or-n-p (format "Close tab \"%s\"? "
old-name))
(tab-bar-close-tab))))
(aprog1 (y-or-n-p (format "Close tab \"%s\"? "
old-name))
(when it
(tab-bar-close-tab)))))
(defun tab-bar-report ()
(interactive)

View file

@ -26,13 +26,24 @@
(require 'term/xterm)
(let ((ascii-start ? )
(M-start ?\M-\s)
(C-M-start ?\C-\M-\s)
(M-S-start ?\M-\S-\s))
(dotimes (n (1+ (- ?~ ? )))
))
(let ((ascii-start 97)
(M-start ?\M-a)
(C-M-start ?\C-\M-a)
(M-S-start ?\M-\S-a))
(dotimes (n 26)
(define-key xterm-function-map
(format "\e[27;5;%d~" (+ ascii-start n))
(vector (1+ n)))
(define-key xterm-function-map
(format "\e[27;3;%d~" (+ ascii-start n))
(vector (+ n M-start)))
(define-key xterm-function-map
(format "\e[27;4;%d~" (+ ascii-start n))
(vector (+ n M-S-start)))
@ -61,19 +72,43 @@
"\e[27;2;32~"
[?\S-\s])
(defun tmux-wrap-escape-sequence (sequence)
(concat "\ePtmux;"
(-->
sequence
(replace-regexp-in-string "\e" "\e\e" it))
"\e\\"))
(defun tmux-p ()
(not (string-empty-p (getenv "TMUX")))
nil)
;; (xterm--init-modify-other-keys)
(defun my/xterm--init-modify-other-keys ()
"Terminal initialization for xterm's modifyOtherKeys support."
(send-string-to-terminal "\e[>4;2m")
(push "\e[>4m" (terminal-parameter nil 'tty-mode-reset-strings))
(push "\e[>4;2m" (terminal-parameter nil 'tty-mode-set-strings)))
(let ((set-modify-other-keys
(if (not (tmux-p))
"\e[>4;2m"
(tmux-wrap-escape-sequence "\e[>4;2m")))
(unset-modify-other-keys
(if (not (tmux-p))
"\e[>4m"
(tmux-wrap-escape-sequence "\e[>4m"))))
(send-string-to-terminal set-modify-other-keys)
(push unset-modify-other-keys (terminal-parameter nil 'tty-mode-reset-strings))
(push set-modify-other-keys (terminal-parameter nil 'tty-mode-set-strings))))
(advice-add #'xterm--init-modify-other-keys
:override
#'my/xterm--init-modify-other-keys)
(xterm-mouse-mode 1)
(terminal-init-xterm)
(setq xterm-extra-capabilities
'(modifyOtherKeys))
(add-hook 'emacs-startup-hook
(lambda ()
(xterm-mouse-mode 1)
(terminal-init-xterm)))
(defun my/org--mks-read-key-use-read-key (orig &rest args)
(cl-letf (((symbol-function 'read-char-exclusive)

View file

@ -27,15 +27,15 @@
(deftheme dark-default)
(let ((rainbow-purple "#9E1CB2")
(rainbow-green "#47B04B")
(rainbow-blue "#1194f6")
(rainbow-red "#C90067")
(rainbow-yellow "#FFED18")
(rainbow-orange "#E7B500")
(rainbow-7 "#00AA5D")
(rainbow-8 "#FE7380"))
(let* ((rainbow-purple "#9E1CB2")
(rainbow-green "#47B04B")
(rainbow-red "#C90067")
(rainbow-blue "#1194f6")
(rainbow-yellow "#FFED18")
(rainbow-white "#FFFFFF")
(rainbow-pink "#FE7380")
(rainbow-cyan "Cyan")
(rainbow-orange "#E7B500"))
(custom-theme-set-faces
'dark-default
@ -56,7 +56,7 @@
`(rainbow-delimiters-depth-5-face ((t :foreground ,rainbow-yellow)))
`(rainbow-delimiters-depth-6-face ((t :foreground ,rainbow-blue)))
`(rainbow-delimiters-depth-7-face ((t :foreground ,rainbow-red)))
`(rainbow-delimiters-depth-8-face ((t :foreground ,rainbow-8)))
`(rainbow-delimiters-depth-8-face ((t :foreground ,rainbow-pink)))
;; '(vertico-current ((t :foreground "black" :background "#65a7e2")))
'(vertico-current ((t :background "gray30")))

View file

@ -31,14 +31,14 @@
(custom-theme-set-faces
'same-defaults
`(default ((t (:family "Roboto Mono" :height ,my/fixed-pitch-height
`(default ((t (:family "Commit Mono" :height ,my/fixed-pitch-height
))))
`(fixed-pitch ((t (:family "Roboto Mono" :height ,my/fixed-pitch-height
`(fixed-pitch ((t (:family "Commit Mono" :height ,my/fixed-pitch-height
))))
`(variable-pitch ((t (:family "Linux Libertine" :height ,my/variable-pitch-height
))))
`(mode-line ((t (:family "Roboto Mono" :height ,my/fixed-pitch-height))))
`(mode-line-inactive ((t (:family "Roboto Mono" :height ,my/fixed-pitch-height))))
`(mode-line ((t (:family "Commit Mono" :height ,my/fixed-pitch-height))))
`(mode-line-inactive ((t (:family "Commit Mono" :height ,my/fixed-pitch-height))))
`(tab-bar-tab ((t (:box (:line-width 2 :color "gray6")))))
;; '(org-todo ((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t :inherit fixed-pitch))
;; (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t :inherit fixed-pitch))

View file

@ -28,7 +28,7 @@
(require 'work-commentor)
(require 'work-asm-config)
(require 'ti-keymap)
(require 'ti-lib)
(require 'ti-comp-dev)
(require 'ti-tools-backup)
(require 'argo-fastsim-dump-mode)
(require 'machine-scheduler-debug-mode)
@ -36,6 +36,9 @@
(require 'ti-config)
(require 'bisect-mode)
(require 'deadgrep-rejump-mode)
(require 'ti-asm)
(require 'work-mail)
(use-package editorconfig
:config
@ -159,8 +162,29 @@
(use-package realgud
:config
(setq realgud-window-split-orientation 'horizontal)
(setq realgud:pdb-command-name "python3 -m pdb"
realgud:remake-command-name "/db/sds/packages2/remake/bin/remake"))
(setq realgud:remake-command-name "/db/sds/packages2/remake/bin/remake")
(defun rename-gdb-replay-buffer ()
(when-let ((buff (get-buffer "*gdb replay shell*")))
(let ((i 1)
name)
(while (progn
(setq name
(format "*gdb replay shell<%d>*" i))
(get-buffer name))
(cl-incf i))
(with-current-buffer buff
(rename-buffer name)))))
(defun realgud:rr ()
(interactive)
(rename-gdb-replay-buffer)
(call-interactively #'realgud:gdb))
(defun realgud:rr-replay ()
(interactive)
(rename-gdb-replay-buffer)
(realgud:gdb "rr replay")))
(use-package realgud-lldb)
@ -245,5 +269,14 @@
:around
#'always-expand-mail-abbrevs-in-commit-buffer)
(use-package claude-code
:config
(defun claude-code-write-to-file ()
(interactive)
(let ((str (buffer-string)))
(with-temp-buffer
(insert str)
(call-interactively #'write-file)))))
(provide 'work-config)
;;; work-config.el ends here

View file

@ -24,12 +24,20 @@
;;; Code:
(add-to-list 'load-path
"/usr/local/share/emacs/site-lisp/mu4e")
(require 'mu4e)
(require 'ti-mail-identity)
(require 'gnus-article-hack)
(setq mu4e-update-interval (* 60 5))
(defun my/goto-mail ()
(interactive)
(switch-or-create-tab "mail")
(delete-other-windows)
(mu4e))
(global-set-key (kbd "C-x m") #'my/goto-mail)
(with-eval-after-load 'mu4e-view
(add-hook 'mu4e-view-mode-hook
@ -55,17 +63,24 @@
(setq mu4e-maildir-shortcuts
'((:key ?i :maildir "/work/INBOX")
(:key ?c :maildir "/work/INBOX/C29")
(:key ?j :maildir "/work/INBOX/Jira")
(:key ?a :maildir "/work/Done")))
(setq mu4e-bookmarks
'(( :name "Unread messages"
:query "flag:unread AND NOT flag:trashed"
:query "flag:unread AND NOT maildir:/work/INBOX/llvm* AND NOT flag:trashed"
:key ?u)
( :name "Inbox"
:query "maildir:/work/INBOX AND NOT flag:trashed"
:key ?i)
( :name "mailing_lists"
:query "maildir:/work/INBOX/mailing_lists* AND NOT flag:trashed"
:key ?m)
( :name "Services"
:query "maildir:/work/INBOX/Services* AND NOT flag:trashed"
:key ?s)
( :name "automation"
:query "maildir:/work/INBOX/automation* AND NOT flag:trashed"
:key ?a)
( :name "Today's messages"
:query "date:today..now"
:key ?t)
@ -73,9 +88,10 @@
:query "date:7d..now"
:hide-unread t
:key ?w)
( :name "Messages with images"
:query "mime:image/*"
:key ?p)))
;; ( :name "Messages with images"
;; :query "mime:image/*"
;; :key ?p)
))
(setq mu4e-bookmarks
(mapcar (lambda (x)
@ -170,5 +186,34 @@
:override
#'my/mu4e-compose-edit-ignore-draft)
(add-hook 'mu4e-headers-found-hook #'mu4e-thread-fold-all)
(define-key mu4e-headers-mode-map (kbd "C-M-a") #'mu4e-view-thread-goto-root)
(define-key mu4e-thread-mode-map (kbd "<tab>") #'mu4e-thread-fold-toggle)
(setq mu4e-attachment-dir "/scratch/benson/mail_attachments")
(require 'mu4e-contrib)
(define-key mu4e-headers-mode-map (kbd "M") #'mu4e-headers-mark-all)
;; Prevent automatic baseline resets to keep (+x) indicators persistent
(defvar my/mu4e-allow-baseline-reset nil
"When non-nil, allow baseline resets. Otherwise, preserve the baseline.")
(defun my/mu4e--query-items-refresh-no-auto-reset (orig-fun &optional reset-baseline)
"Advice for `mu4e--query-items-refresh' to prevent automatic baseline resets.
Only reset the baseline if `my/mu4e-allow-baseline-reset' is non-nil."
(funcall orig-fun (and reset-baseline my/mu4e-allow-baseline-reset)))
(advice-add 'mu4e--query-items-refresh :around
#'my/mu4e--query-items-refresh-no-auto-reset)
(defun my/mu4e-reset-baseline ()
"Manually reset the mu4e baseline to clear all (+x) indicators."
(interactive)
(let ((my/mu4e-allow-baseline-reset t))
(mu4e--query-items-refresh 'reset-baseline))
(message "mu4e baseline reset - (+x) indicators cleared"))
(provide 'work-mail)
;;; work-mail.el ends here

View file

@ -157,9 +157,9 @@
((org-ql-block-header "Active Projects")
(org-ql-indent-levels t)))
(agenda ""
((org-agenda-span (car (work/last-week-wednesday)))
(org-agenda-start-day (cdr (work/last-week-wednesday)))
(org-agenda-start-on-weekday 3)
((org-agenda-span ,(car (work/last-week-monday)))
(org-agenda-start-day ,(cdr (work/last-week-monday)))
(org-agenda-start-on-weekday 1)
(org-agenda-show-log t)
(org-agenda-include-inactive-timestamps t)
(org-agenda-hide-tags-regexp ".*")
@ -174,6 +174,11 @@
;; (outline-next-heading)))))
))))
(defun work/last-week-monday ()
(let ((num (+ 6 (string-to-number (format-time-string "%u")))))
(cons (1+ num)
(format "-%dd" num))))
(defun work/last-week-wednesday ()
(let ((num (+ 4 (string-to-number (format-time-string "%u")))))
(cons (1+ num)
@ -540,11 +545,11 @@
(defvar my/project-templates
'(("p" "project" plain ""
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}: %^{Description}\n#+category: ${title}\n#+filetags: Project active")
"#+title: ${title}: %^{Description}\n#+category: ${title}\n#+date: %t\n#+filetags: Project active")
:unnarrowed t)
("s" "sandbox" plain ""
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org"
"#+title: ${title}: %^{Description}\n#+category: ${title}\n#+filetags: Project active\n#+PROPERTY: header-args:bash :dir /scratch/benson/sandbox/${title} :results output verbatim :exports results :noweb yes"))))
"#+title: ${title}: %^{Description}\n#+category: ${title}\n#+date: %t\n#+filetags: Project active\n#+PROPERTY: header-args:bash :dir /scratch/benson/sandbox/${title} :results output verbatim :exports results :noweb yes"))))
(defun my/org-roam-find-projects ()
(interactive)