Compare commits

..

5 commits

Author SHA1 Message Date
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
9 changed files with 70 additions and 9 deletions

View file

@ -386,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

@ -43,7 +43,7 @@
(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/clang-output-disassemble-command (file)
(let ((compiler (lls/prompt-tool "clang$"))

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

@ -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

@ -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

@ -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

@ -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"

View file

@ -164,9 +164,27 @@
(setq realgud:pdb-command-name "python3 -m pdb"
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)
@ -251,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

@ -29,6 +29,8 @@
(require 'ti-mail-identity)
(require 'gnus-article-hack)
(setq mu4e-update-interval (* 60 5))
(defun my/goto-mail ()
(interactive)
(switch-or-create-tab "mail")