Compare commits

...

16 commits

Author SHA1 Message Date
Benson Chu
04cd529642 Conditionally show battery 2026-04-05 18:03:55 -05:00
Benson Chu
2a27705094 Removed mu 2026-04-05 18:03:46 -05:00
Benson Chu
4dd3b8fef7 oops 2026-04-05 16:26:34 -05:00
d7192e0ac9 Fixup home stuff 2026-04-05 10:29:24 -05:00
769bd39690 Oops 2026-04-05 10:06:17 -05:00
6f4307601a Updated packages 2026-04-05 10:06:10 -05:00
26c05d08c4 Renames 2026-04-04 17:02:59 -05:00
2a0f9fef64 Moved some stuff around 2026-04-04 16:58:21 -05:00
cf32daf8ce Let's not do tramp for now 2026-04-04 16:57:49 -05:00
a4e62fe73e Move this to TI config 2026-04-04 16:52:45 -05:00
16c218cc25 Rename function build target 2026-04-04 15:57:29 -05:00
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
30 changed files with 520 additions and 426 deletions

3
.gitmodules vendored
View file

@ -1,6 +1,3 @@
[submodule "submodule/mu"]
path = submodule/mu
url = https://github.com/djcb/mu
[submodule "submodule/youtube-dl-emacs"]
path = submodule/youtube-dl-emacs
url = https://github.com/skeeto/youtube-dl-emacs

View file

@ -23,12 +23,14 @@
;; System tray
(require 'exwm-systemtray)
(exwm-systemtray-enable)
(exwm-systemtray-mode t)
;; Multi monitor support
(require 'exwm-randr)
(exwm-enable)
(exwm-randr-enable)
(exwm-randr-mode t)
(add-hook 'emacs-startup-hook
'exwm-wm-mode)
;; This is a new-frame hack. Don't copy faces for floating windows
(require 'face-copier)
@ -77,9 +79,6 @@
(require 'exwm-startup)
(add-hook 'exwm-init-hook 'call-startup-programs)
(require 'exwm-systemtray)
(exwm-systemtray-enable)
;; Setup screens before anything else
(require 'exwm-screens)
(add-hook 'exwm-init-hook 'my/setup-screens)

View file

@ -64,7 +64,8 @@
(setq global-mode-string '(" "))
(setq display-time-day-and-date t)
(display-battery-mode t)
(when (ec/load-or-ask-pred 'my-ec/display-battery "Display battery? ")
(display-battery-mode t))
(display-time-mode t)
(unless (or (eq 'windows-nt system-type)
(not (executable-find "df")))

View file

@ -111,32 +111,6 @@
(use-package affe
:config
(defun my/affe-find (&optional dir initial)
"Fuzzy find in DIR with optional INITIAL input."
(interactive "P")
(pcase-let* ((`(,prompt ,paths ,dir) (consult--directory-prompt "Fuzzy find" dir))
(default-directory dir))
(consult--read
(thread-first (consult--async-sink)
(consult--async-refresh-timer 0.05)
(consult--async-map (lambda (x) (string-remove-prefix "./" x)))
(affe--async (affe--command affe-find-command paths))
(consult--async-split #'consult--split-nil))
:prompt prompt
:sort nil
:require-match t
:history '(:input affe--find-history)
:initial initial
:category 'file
:add-history (thing-at-point 'filename)
:state (lambda (action cand)
(when (and cand (eq action 'return))
(find-file (expand-file-name cand dir)))))))
(advice-add #'affe-find
:override
#'my/affe-find)
(with-eval-after-load 'projectile
(define-key projectile-command-map (kbd "F") #'affe-find)
(define-key projectile-command-map (kbd "s G") #'affe-grep))

2
elpa

@ -1 +1 @@
Subproject commit 6df853a359ff19a0a8fa40cc1dd52c0768a49129
Subproject commit b12ed477b68f85a0df9057f8c7b6d717b5a14586

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

@ -1,4 +1,4 @@
;;; compiler-option-sets.el --- -*- lexical-binding: t -*-
;;; c-compiler-option-sets.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2024 Benson Chu
@ -34,25 +34,27 @@
(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)
(defmacro register-prebaked-optionset (hashmap type target-str key &rest options)
(declare (indent 3))
`(puthash ',key
(make-instance 'compiler-option-config
(make-instance ,type
:target-str ,target-str
,@options)
,hashmap))
(defun cos/edit-compiler-options (optionset current-name)
(cl-defgeneric cos/to-string (config))
(defun cos/edit-compiler-options (prefix 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))))
(slot-val (and (slot-boundp optionset slot-sym)
(slot-value optionset 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)
(setf (slot-value optionset slot-sym)
(read
(read-string (format "Edit '%s' for optionset '%s': "
(symbol-name slot-sym)
@ -61,11 +63,11 @@
('string
(when (or prefix
(not (string= slot-val "")))
(setf (slot-value optionsset slot-sym)
(setf (slot-value optionset 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
(provide 'c-compiler-option-sets)
;;; c-compiler-option-sets.el ends here

View file

@ -23,11 +23,32 @@
;;; Commentary:
;;; Code:
(require 'compiler-option-sets)
(require 'c-compiler-option-sets)
(defclass clang-option-config (compiler-option-config)
nil)
(cl-defmethod cos/to-string ((config clang-option-config))
(with-slots
(binary-path
target-options lang-options
other-options optimization-level
include-dirs)
config
(-->
(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-subtargets
(make-hash-table :test #'equal))
@ -68,7 +89,7 @@
primary extensions)
(setq primary
(my/completing-read-formatter
#'clang/clang-options->string
#'cos/to-string
"Primary Subtarget? "
(remove-if-not (lambda (x)
(string= target
@ -83,7 +104,7 @@
(alist-get option-name target-options nil nil #'equal))))
(defun clang/reinitialize-clang-options (target)
(interactive (list (intern (lls/conf-get 'target))))
(interactive (list (intern (comp-dev/conf-get 'target))))
(let ((option-name (or (gethash target clang/current-target-optionset)
(puthash target "default" clang/current-target-optionset))))
(aprog1 (clang/make-clang-option-set target)
@ -103,21 +124,21 @@
;; (defun clang/new-clang-option-set (target name &optional optionset)
;; (interactive
;; (list (intern (lls/conf-get 'target))
;; (list (intern (comp-dev/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))
;; (list (intern (comp-dev/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))))
;; (list (intern (comp-dev/conf-get 'target))))
;; ;; TODO: might need to garbage collect these
;; (or (gethash (buffer-file-name)
;; clang/file-specific-options)
@ -130,7 +151,7 @@
(defun clang/switch-clang-option-set (target name)
(interactive
(let ((target lls/conf-get 'target))
(let ((target comp-dev/conf-get 'target))
(list target
(--> (intern target)
(gethash it clang/all-target-options)
@ -143,7 +164,7 @@
(defun clang/edit-clang-options (prefix)
(interactive "P")
(let* ((target (intern (lls/conf-get 'target)))
(let* ((target (intern (comp-dev/conf-get 'target)))
(options-config
(->>
target
@ -153,7 +174,7 @@
(or (and (gethash (buffer-file-name) clang/file-specific-options )
"file-specific")
(gethash target clang/current-target-optionset))))
(cos/edit-compiler-options options-config current-name)))
(cos/edit-compiler-options prefix options-config current-name)))
(defun clang/clang-options-merge (primary secondary)
(make-instance
@ -181,40 +202,19 @@
(slot-value x 'include-dirs)))
it)))))
(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-str (comp-dev/conf-get 'target))
(target (intern target-str))
(options-config
(clang/get-clang-options-for-target target))
(detected-extensions
(awhen clang/detect-extensions-function
(funcall it compiler action filename target-str))))
(clang/clang-options->string
(cos/to-string
(clang/clang-options-merge
(car options-config)
(append detected-extensions (cdr options-config))))))

View file

@ -26,25 +26,25 @@
(require 'magit)
(require 'eieio)
(require 'load-llvm-mode)
(require 'my-clang-options)
(require 'my-nprocs)
(require 'use-package)
(use-package realgud-lldb)
;; =========================== LLVM Rebuild ==========================
;; =========================== Rebuild ==========================
(defvar llvm-core-count
(defvar comp-dev/default-parallelism
(nprocs))
(defun lls/run-build-command (build-dir targets &optional verbose)
(defun comp-dev/build-target (build-dir targets &optional verbose)
(let ((cmake-make-program
(if (string= "Makefile" (car (directory-files build-dir nil "^\\(build\\.ninja$\\|Makefile\\)$")))
(if (string= "Makefile" (car (directory-files build-dir nil
(rx line-start (or "build.ninja" "Makefile") line-end))))
"make"
"ninja")))
(format "set -o pipefail && CLICOLOR_FORCE=1 %s -C %s -j %d %s %s 2>&1 | tee ninja.log"
cmake-make-program
build-dir llvm-core-count
build-dir comp-dev/default-parallelism
(if verbose "-v" "")
(string-join targets " "))))
@ -53,7 +53,7 @@
(defclass comp-dev-config ()
((root-dir :initarg :root-dir :type string)
(target :initarg :target :type string)
(tramp-connection :initarg :tramp :type list :initform nil)
;; (tramp-connection :initarg :tramp :type list :initform nil)
(aux-props :initarg :aux-props :type list :initform nil)))
@ -66,68 +66,35 @@
(cl-defgeneric comp-dev/process-file (config start-type end-type compiler file output flags))
(cl-defgeneric comp-dev/tool-name (config tool))
;; =============================== Tabs ===============================
(defvar comp-dev/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 ()
(defun comp-dev/get-active-configs ()
(hash-table-values comp-dev/configs))
(defun lls/set-llvm-config (conf &optional tab-name)
(defvar comp-dev/init-functions nil)
(defun comp-dev/set-config (conf &optional tab-name)
(puthash (or tab-name (alist-get 'name (tab-bar--current-tab)))
conf
comp-dev/configs))
;; (defvar lls/llvm-config nil)
(defun lls/conf-get (sym)
(comp-dev/ensure-initialized)
(slot-value (comp-dev/get-config) sym))
(defun lls/conf-get-safe (sym)
(if-let ((conf (comp-dev/get-config)))
(slot-value conf sym)
nil))
(defun lls/conf-aux-get (sym)
(comp-dev/ensure-initialized)
(-->
(lls/conf-get 'aux-props)
(alist-get sym it)))
(defun lls/conf-set (key val)
(defun comp-dev/conf-set (key val)
(comp-dev/ensure-initialized)
(setf (slot-value (comp-dev/get-config) key)
val))
(defun lls/tramp-connection ()
(lls/conf-get 'tramp-connection))
(defun lls/trampify (path)
(if-let ((vec (lls/tramp-connection)))
(tramp-make-tramp-file-name vec path)
path))
(defun lls/un-trampify (path)
(if-let ((vec (lls/tramp-connection)))
(with-parsed-tramp-file-name path nil
localname)
path))
(defun lls/default-initialize ()
(interactive)
(let ((lls/target-init-fun #'lls/default-target-init))
(comp-dev/initialize)))
;; ====== External ======
(defun comp-dev/initialize ()
(interactive)
(lls/set-llvm-config
(comp-dev/set-config
(or
(let ((active-conf (lls/get-active-configs)))
(let ((active-conf (comp-dev/get-active-configs)))
(and (not (zerop (length active-conf)))
(y-or-n-p "Would you like to reuse a configuration? ")
(let ((tab-name
@ -137,10 +104,26 @@
(mapcar #'(lambda (x) (alist-get 'name x)))
(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))
(funcall (intern
(completing-read "Which initialization function would you like to use? "
comp-dev/init-functions)))))
(message "comp-dev initialize!"))
(defun comp-dev/conf-get (sym)
(comp-dev/ensure-initialized)
(slot-value (comp-dev/get-config) sym))
(defun comp-dev/conf-get-safe (sym)
(if-let ((conf (comp-dev/get-config)))
(slot-value conf sym)
nil))
(defun comp-dev/conf-aux-get (sym)
(comp-dev/ensure-initialized)
(-->
(comp-dev/conf-get 'aux-props)
(alist-get sym it)))
(defun comp-dev/initialized? ()
(and (comp-dev/get-config)
(typep (comp-dev/get-config) 'comp-dev-config)))
@ -151,65 +134,19 @@
(error "Please register an init function for llvm")
(comp-dev/initialize))))
(defun lls/get-cached-value (key fun)
(or (lls/conf-get key)
(lls/conf-set key (funcall fun))))
;; (defun lls/tramp-connection ()
;; (comp-dev/conf-get 'tramp-connection))
(require 'projectile)
;; (defun lls/trampify (path)
;; (if-let ((vec (lls/tramp-connection)))
;; (tramp-make-tramp-file-name vec path)
;; path))
(defun projectile-dont-switch-when-conf-available (x)
(if-let ((dir (lls/conf-get-safe 'root-dir))
(tools-dir
(when (string-match (rx line-start
"/scratch"
(group "/benson/_repos-work/tools" (* (not "/")) "/"))
dir)
(match-string 1 dir))))
(remove-if #'(lambda (path)
(and (string-match-p (rx "/benson/_repos-work/tools")
path)
(not (string-match-p tools-dir path))))
x)
x))
(when my-ec/at-ti
(advice-add 'projectile-relevant-known-projects
:filter-return
#'projectile-dont-switch-when-conf-available))
;;===---------------------------------------------------------------------===;;
(defun lls/get-llvm-root-dir ()
(comp-dev/ensure-initialized)
(lls/conf-get 'root-dir))
(defun lls/get-llvm-build-dirs ()
(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 ()
(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))))
(defun lls/prompt-llvm-build-dir ()
(completing-read "Which directory? " (lls/get-llvm-build-dirs)))
(defun lls/get-llvm-build-dir ()
(car (lls/get-llvm-build-dirs)))
(defun lls/add-llvm-build-dir (dir)
(interactive
(list (read-file-name "Where? ")))
(comp-dev/ensure-initialized)
(lls/conf-set 'build-dirs
(cons dir
(lls/conf-get 'build-dirs))))
;; (defun lls/un-trampify (path)
;; (if-let ((vec (lls/tramp-connection)))
;; (with-parsed-tramp-file-name path nil
;; localname)
;; path))
;; =============================== Misc ==============================
@ -221,20 +158,7 @@
(t (completing-read (format "Which %s? " prompt)
collection nil nil initial-input)))))
(defun lls/prompt-tool (tool-regexp &optional directories)
(lls/un-trampify
(let (;;(vertico-sort-function nil)
)
(my/completing-read tool-regexp
(lls/get-tool tool-regexp
(or (and (eq 'string (type-of directories))
(list directories))
directories))
(awhen (ti/current-tools-directory)
(concat (file-name-nondirectory it)
" "))))))
(defun lls/get-tool (tool-regexp &optional directories)
(defun comp-dev/get-tools (tool-regexp &optional directories)
(cl-mapcan #'(lambda (dir)
(when (file-exists-p dir)
(when (string-match-p "/sim/sds11.*" dir)
@ -243,148 +167,13 @@
(or directories
(comp-dev/get-bin-dirs (comp-dev/get-config)))))
(defun lls/get-clang-command-fun (&rest args)
(apply (lls/conf-get 'compile-command-fun)
args))
(defun lls/get-llc-command-fun (&rest args)
(apply (lls/conf-get 'llc-command-fun) args))
(defun lls/get-dis-command-fun (&rest args)
(apply (lls/conf-get 'dis-command-fun) args))
;; ========================= LLVM Build Dirs =========================
(cl-defun lls/default-comp-fun (&key compiler file action output flags)
(-->
(list compiler
(lls/get-clang-options)
(string-join rest " ")
file
(pcase action
('compile "-c")
('assemble "-S")
('preprocess "-E")
('llvm-ir "-S -emit-llvm")
('executable ""))
flags
"-o -"
(or (and output
(format "| tee %s" output))
""))
(flatten-list it)
(string-join it " ")))
(defun ll/read-pass ()
(completing-read "Which pass? "
'("finalize-isel"
"machine-scheduler"
"greedy")))
(cl-defun lls/default-llc-comm (&key llc file action output pass)
(let ((llc (or llc "llc")))
(concat
(cond
((member action '(run-pass stop-before stop-after start-before start-after))
(format "%s %s -o - -%s=%s"
llc file (symbol-name action) pass))
(t
(read-string
"llc invocation: "
(string-join
(list
llc
file
"-o -")
" "))))
(or (and output
(format " | tee %s" output))
""))))
(defun lls/default-dis-comm (file _action)
(concat "llvm-objdump --disassemble "
file " "))
(defun lls/lldb (binary)
(interactive
(list (lls/prompt-tool (rx (or "clang" "llc") line-end))))
(realgud--lldb
(format "lldb %s"
binary)))
(defun lls/default-target-init ()
(interactive)
(let ((root-dir (lls/guess-root-dir-fun))
tramp-conn)
(when (tramp-tramp-file-p root-dir)
(with-parsed-tramp-file-name root-dir nil
(setf tramp-conn v)))
(make-instance
'llvm-config
:tramp tramp-conn
:root-dir root-dir
:build-dirs-fun (lls/guess-build-dirs-fun root-dir)
:target (completing-read "Which target? " '("X86" "ARM" "Hexagon" "AIE" "RISCV"))
:bin-dirs-fun (lambda ()
(list
(--> "/usr/bin/"
(if (not tramp-conn) it
(tramp-make-tramp-file-name tramp-conn it)))))
:cc #'lls/default-comp-fun
:dc #'lls/default-dis-comm
:llc #'lls/default-llc-comm
:clang-opts-fun #'cc/get-clang-options)))
(when (not lls/target-init-fun)
(setq lls/target-init-fun
;; TODO: load llvm-mode
#'lls/default-target-init))
(defun lls/guess-root-dir-fun ()
(if (-->
(shell-command-to-string "git remote get-url origin")
(string-trim it)
(string-match-p ".*llvm.*" it))
(vc-root-dir)
(--> (directory-files "~/workspace" t "^[^.]")
(remove-if-not #'(lambda (it)
(let ((default-directory it))
(-->
(shell-command-to-string "git remote get-url origin")
(string-trim it)
(member it repo-remotes))))
it)
(completing-read "Repo directory? " it))))
(defun lls/guess-build-dirs-fun (root-dir)
(lambda ()
(let ((build-dir (expand-file-name "build" root-dir)))
(when (file-exists-p build-dir)
(--> build-dir
(directory-files it t)
(remove-if-not #'(lambda (dir)
(file-exists-p
(expand-file-name "build.ninja" dir)))
it)
(sort it #'(lambda (x y)
(cond ((string-match-p "^Release$" (file-name-nondirectory y)) nil)
((string-match-p "^Release$" (file-name-nondirectory x)) t)
(t (string< x y))))))))))
(defun lls/cmake-here (directory build-type target)
(interactive
(list (expand-file-name "llvm"
(projectile-project-root))
(completing-read "Build Type? "
'("Release"
"Debug"
"RelWithDebInfo"))
(lls/conf-get 'target)))
(let* ((comm-temp
"cmake %s -G Ninja -DCMAKE_BUILD_TYPE='%s' -DLLVM_ENABLE_PROJECTS='clang;llvm' -DLLVM_TARGETS_TO_BUILD='%s' -DCMAKE_C_COMPILER='clang' -DCMAKE_CXX_COMPILER='clang++' -DLLVM_ENABLE_ASSERTIONS=On")
(command (read-string
"CMake Command? "
(format comm-temp directory build-type target))))
(compile command)))
(defun comp-dev/prompt-tool (tool-regexp &optional directories)
(let (;;(vertico-sort-function nil)
)
(my/completing-read tool-regexp
(comp-dev/get-tools tool-regexp
(or (and (eq 'string (type-of directories))
(list directories)))))))
(provide 'lib-comp-dev)
;;; lib-comp-dev.el ends here

View file

@ -37,14 +37,14 @@
(list
(string-join
(list
(lls/prompt-tool "clang$")
(comp-dev/prompt-tool "clang$")
file
"-target c29 -c -o"
temp-file)
" ")
(string-join
(list
(lls/prompt-tool "objdump$")
(comp-dev/prompt-tool "objdump$")
"-d"
temp-file)
" "))

View file

@ -38,7 +38,7 @@
(defun ll/ensure-clang-binary-built (dir)
;; TODO: assumed build-dir constant, should take as argument and prompt
;; further up
(lls/run-build-command dir '("clang")))
(comp-dev/build-target dir '("clang")))
(defun ll/get-c-action-map ()
(append
@ -47,7 +47,7 @@
ll/c-file-action-map))
(defun ll/clang-output-disassemble-command (file)
(let ((compiler (lls/prompt-tool "clang$"))
(let ((compiler (comp-dev/prompt-tool "clang$"))
(tmp-file (make-temp-file (file-name-sans-extension (file-name-nondirectory file)))))
(string-join
(list (lls/get-clang-command-fun :compiler compiler
@ -76,7 +76,7 @@
(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))))
(compiler (comp-dev/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`? ")
@ -122,7 +122,7 @@
(call-interactively #'recompile)))))
(defun ll/diff-on-optionset (file action)
(let ((comm (ll/build-clang-command (lls/un-trampify file) action))
(let ((comm (ll/build-clang-command file action))
(extra-option (read-string "Extra option? "))
(pipe (if (y-or-n-p "Diff assembly (y) or debug (n)? ")
">" "2>")))
@ -134,8 +134,8 @@
(ediff-files "/tmp/no-option.asm" "/tmp/yes-option.asm")))
(defun ll/diff-on-compiler (file action)
(let ((comm (ll/build-clang-command (lls/un-trampify file) action))
(second-command (ll/build-clang-command (lls/un-trampify file) action))
(let ((comm (ll/build-clang-command file action))
(second-command (ll/build-clang-command file action))
(pipe (if (y-or-n-p "Diff assembly (y) or debug (n)? ")
">" "2>")))
(when (save-window-excursion
@ -165,7 +165,7 @@
(t ".ll")))))
(if (eq action 'diff)
(ll/diff-c-on-two-compilations file action)
(let ((comm (ll/build-clang-command (lls/un-trampify file) action output)))
(let ((comm (ll/build-clang-command file action output)))
(aprog1
(compilation-start
comm

View file

@ -28,17 +28,17 @@
(require 'make-tmp-output-file)
(defvar ll/ll-file-action-map
'((assembly :key ?a :major-mode asm-mode :buffer-string "assembly" :description "[a]ssembly")
(run-pass :key ?o :major-mode llvm-mode :buffer-string "run-%s" :description "run-[o]ne-pass")
(run-pass-diff :key ?d :major-mode llvm-mode :buffer-string "diff-%s" :description "[d]iff-one-pass")
(stop-after :key ?a :major-mode llvm-mode :buffer-string "stop-after-%s" :description "stop-[a]fter")
(stop-before :key ?b :major-mode llvm-mode :buffer-string "stop-before-%s" :description "stop-[b]efore")
(start-after :key ?A :major-mode llvm-mode :buffer-string "start-after-%s" :description "start-[A]fter")
(start-before :key ?B :major-mode llvm-mode :buffer-string "start-before-%s" :description "start-[B]efore")))
'((assembly :key ?a :major-mode asm-mode :end-state 'asm :buffer-string "assembly" :description "[a]ssembly")
(run-pass :key ?o :major-mode llvm-mode :end-state 'llvm-ir :buffer-string "run-%s" :description "run-[o]ne-pass")
(run-pass-diff :key ?d :major-mode llvm-mode :end-state 'llvm-ir :buffer-string "diff-%s" :description "[d]iff-one-pass")
(stop-after :key ?a :major-mode llvm-mode :end-state 'llvm-ir :buffer-string "stop-after-%s" :description "stop-[a]fter")
(stop-before :key ?b :major-mode llvm-mode :end-state 'llvm-ir :buffer-string "stop-before-%s" :description "stop-[b]efore")
(start-after :key ?A :major-mode llvm-mode :end-state 'llvm-ir :buffer-string "start-after-%s" :description "start-[A]fter")
(start-before :key ?B :major-mode llvm-mode :end-state 'llvm-ir :buffer-string "start-before-%s" :description "start-[B]efore")))
(defun ll/build-llc-command (file action &optional output pass)
(lls/get-llc-command-fun :file file :action action :output output :pass pass
:llc (lls/prompt-tool "llc$")))
(defun ll/build-llc-command (file end-state &optional output pass)
(comp-dev/process-file
(comp-dev/get-config) 'llvm-ir end-state (comp-dev/prompt-tool "llc$") file output nil))
(defun ll/ll-file-diff-action (file action) )
@ -57,7 +57,8 @@
(t ".mir")))))
(aprog1
(compilation-start
(ll/build-llc-command file action output pass)
(ll/build-llc-command
file (aml/get-map-prop ll/ll-file-action-map action :end-state) output pass)
(aml/get-map-prop ll/ll-file-action-map action :major-mode)
(lambda (_)
(format "*%s-%s*"

View file

@ -56,7 +56,7 @@
(defun ll/act-on-llvm-dump-file (fname)
(let* ((action (aml/read-action-map ll/dump-file-action-map))
(command-flags (ll/dump-extract-command-flags (ll/dump-to-sh-file fname)))
(clang (lls/prompt-tool "clang$")))
(clang (comp-dev/prompt-tool "clang$")))
(compilation-start
(concat
(when (y-or-n-p "Would you like to `rr record`? ")

View file

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

View file

@ -33,14 +33,14 @@
(cons build-dir it)
(reverse it)
(cons (file-name-directory file) it)
(mapcar #'(lambda (x) (concat "-I" (lls/un-trampify x))) it)
(mapcar #'(lambda (x) (concat "-I" x)) it)
(string-join it " ")))
(defun ll-tblgen/gen-command (file flags output-file build-dir)
(let ((bin (car (lls/get-tool "llvm-tblgen$" (list (expand-file-name "bin" build-dir))))))
(let ((bin (car (comp-dev/prompt-tool "llvm-tblgen$" (list (expand-file-name "bin" build-dir))))))
(format "%s %s %s %s"
bin
(lls/un-trampify file)
file
(ll-tblgen/get-includes file build-dir)
(string-join
(list
@ -142,11 +142,11 @@
(setq comm (concat comm " --print-records")))
((eq action ?c)
(setq comm (concat (format "mkdir -p %s"
(lls/un-trampify (diredp-parent-dir out)))
(diredp-parent-dir out))
" && "
comm
(format " -o %s"
(lls/un-trampify out))))))
out)))))
(compilation-start
comm

View file

@ -72,11 +72,11 @@
;; further up
(let ((dir (lls/get-llvm-build-dir))
(tools (ll/get-required-binaries-for-test file)))
(lls/run-build-command dir tools)))
(comp-dev/build-target dir tools)))
(defun ll/build-lit-command (file action)
(format "%s %s %s"
(lls/prompt-tool "llvm-lit")
(comp-dev/prompt-tool "llvm-lit")
(pcase action
('verbose "-v")
('all "-a")
@ -121,7 +121,7 @@
(resolved
(save-match-data
(or (gethash tool lookups)
(aprog1 (lls/prompt-tool (concat tool "$"))
(aprog1 (comp-dev/prompt-tool (concat tool "$"))
(puthash tool it lookups))))))
(replace-match resolved nil nil res 1))))
it)
@ -164,7 +164,7 @@
(when tools
(-->
;; TODO: Assuming debug folder, (lls/get-llvm-build-dir) doesn't work
(lls/run-build-command "/scratch/benson/tools3/llvm_cgt/build/Debug/llvm" (seq-uniq tools))
(comp-dev/build-target "/scratch/benson/tools3/llvm_cgt/build/Debug/llvm" (seq-uniq tools))
(compilation-start
it
nil

View file

@ -46,24 +46,24 @@
(let ((file (or (buffer-file-name)
(aprog1 (make-temp-file nil nil ".ll")
(write-file it)))))
(when-let ((vec (lls/tramp-connection))
((not (file-remote-p file))))
;; If there's a cache entry, and the cache timestamp matches,
;; then we just reuse the file
(-->
(if-let* ((cache (gethash file ll/buffer-map))
(time (visited-file-modtime))
((equal time (car cache))))
(cdr cache)
;; Otherwise, generate a new tmp file, copy that over, and
;; update the cache.
(let ((tmp (concat (tramp-make-tramp-temp-name vec)
"." (file-name-extension file))))
(puthash file (cons time tmp) ll/buffer-map)
(copy-file file tmp)
tmp))
(setq file it)))
;; Let further compilation-commands be run over tramp
;; (when-let ((vec (lls/tramp-connection))
;; ((not (file-remote-p file))))
;; ;; If there's a cache entry, and the cache timestamp matches,
;; ;; then we just reuse the file
;; (-->
;; (if-let* ((cache (gethash file ll/buffer-map))
;; (time (visited-file-modtime))
;; ((equal time (car cache))))
;; (cdr cache)
;; ;; Otherwise, generate a new tmp file, copy that over, and
;; ;; update the cache.
;; (let ((tmp (concat (tramp-make-tramp-temp-name vec)
;; "." (file-name-extension file))))
;; (puthash file (cons time tmp) ll/buffer-map)
;; (copy-file file tmp)
;; tmp))
;; (setq file it)))
;; ;; Let further compilation-commands be run over tramp
(let ((default-directory (file-name-directory file)))
(pcase (file-name-extension file)
((and _ (guard (ll/is-test-file file)))

View file

@ -37,7 +37,7 @@
(compilation-start (-->
(list
(format "touch %s" file)
(lls/run-build-command
(comp-dev/build-target
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/run-build-command (lls/un-trampify directory) tools)
;; (comp-dev/build-target directory tools)
;; nil
;; (lambda (_) buffer-name))))
@ -56,7 +56,7 @@
"llc")))))
(name (funcall lls/name-llvm-build-buffer directory tools))
(lls/run-build-command (lls/un-trampify directory) tools))
(comp-dev/build-target directory tools))
(provide 'llvm-build-tool)
;;; llvm-build-tool.el ends here

View file

@ -0,0 +1,238 @@
;;; llvm-comp-dev.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2026 Benson Chu
;; Author: Benson Chu <bensonchu457@gmail.com>
;; Created: [2026-04-04 15:16]
;; 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:
(require 'lib-comp-dev)
(require 'load-llvm-mode)
(require 'clang-command)
(defclass llvm-comp-dev-config (comp-dev-config)
nil)
(cl-defgeneric comp-dev/tool-name ((config llvm-comp-dev-config) tool)
(pcase tool
('compiler "clang$")))
(defun lls/guess-root-dir-fun ()
(if (-->
(shell-command-to-string "git remote get-url origin")
(string-trim it)
(string-match-p ".*llvm.*" it))
(projectile-project-root)
(--> (directory-files "~/workspace" t "^[^.]")
(remove-if-not #'(lambda (it)
(let ((default-directory it))
(-->
(shell-command-to-string "git remote get-url origin")
(string-trim it)
(member it repo-remotes))))
it)
(completing-read "Repo directory? " it))))
(defun llvm/default-target-init ()
(interactive)
(let ((root-dir (lls/guess-root-dir-fun))
tramp-conn)
(when (tramp-tramp-file-p root-dir)
(with-parsed-tramp-file-name root-dir nil
(setf tramp-conn v)))
(load-llvm-mode root-dir)
(make-instance
'llvm-comp-dev-config
:root-dir root-dir
:target (completing-read "Which target? " '("X86" "ARM" "Hexagon" "AIE" "RISCV"))
;; :tramp tramp-conn
;; :build-dirs-fun (lls/guess-build-dirs-fun root-dir)
;; :cc #'lls/default-comp-fun
;; :dc #'lls/default-dis-comm
;; :llc #'lls/default-llc-comm
;; :clang-opts-fun #'cc/get-clang-options
)))
(add-to-list 'comp-dev/init-functions
'llvm/default-target-init)
(defun lls/llvm-build-dirs (root-dir)
(let ((build-dir (expand-file-name "build" root-dir)))
(when (file-exists-p build-dir)
(--> build-dir
(directory-files it t)
(remove-if-not #'(lambda (dir)
(file-exists-p
(expand-file-name "build.ninja" dir)))
it)
(sort it #'(lambda (x y)
(cond ((string-match-p "^Release$" (file-name-nondirectory y)) nil)
((string-match-p "^Release$" (file-name-nondirectory x)) t)
(t (string< x y)))))))))
(defun lls/llvm-bin-dirs (root-dir)
(mapcar #'(lambda (dir)
(expand-file-name "bin" dir))
(lls/llvm-build-dirs root-dir)))
(cl-defmethod comp-dev/get-bin-dirs ((config llvm-comp-dev-config))
(cons
"/usr/bin/"
(lls/llvm-bin-dirs (comp-dev/conf-get 'root-dir))))
(cl-defmethod comp-dev/get-file-types ((config llvm-comp-dev-config))
'(c pp-c llvm-ir asm obj exe))
(cl-defmethod comp-dev/get-c-action-table ((config llvm-comp-dev-config))
'((assembly :key ?a :major-mode asm-mode :buffer-string "assembly" :description "[a]ssembly" :end-state asm)
(debug :key ?d :major-mode llvm-mode :buffer-string "debug" :description "[d]ebug pass" :end-state asm)
(LLVMIR :key ?l :major-mode llvm-mode :buffer-string "llvm-ir" :description "[l]lvm-ir" :end-state llvm-ir)
(before-after :key ?p :major-mode llvm-mode :buffer-string "print-before-after" :description "[p]rint before/after" :end-state asm)
(changed :key ?P :major-mode llvm-mode :buffer-string "print-changed" :description "[P]rint before/after all" :end-state asm)))
(cl-defmethod comp-dev/tool-name ((config llvm-comp-dev-config) type)
(pcase type
('compiler "clang")))
;; (output-dis :key ?A :major-mode asm-mode :buffer-string "dissasembly" :description "output-dis[A]ssemble" :end-state nil)
(cl-defmethod comp-dev/process-file ((config llvm-comp-dev-config) start-type end-type tool file output flags)
(pcase start-type
('c
(-->
(list tool
(clang/get-clang-options)
file
flags
(pcase end-type
('pp-c "-E")
('llvm-ir "-S -emit-llvm")
('asm "-S")
('obj "-c")
('exe (error "unimplemented")))
"-o -"
(or (and output
(format "| tee %s" output))
""))
(flatten-list it)
(string-join it " ")))
('llvm-ir
(-->
(list tool file "-o -")
(string-join it " ")))))
(defun lls/get-llvm-root-dir ()
(comp-dev/ensure-initialized)
(comp-dev/conf-get 'root-dir))
(defun lls/get-llvm-build-dirs ()
(comp-dev/ensure-initialized)
(funcall (comp-dev/conf-get 'build-dirs-fun)))
(defun lls/get-llvm-bin-dir ()
(car (lls/get-llvm-bin-dirs)))
(defun lls/get-llvm-bin-dirs ()
(comp-dev/ensure-initialized)
(append (mapcar #'(lambda (x) (expand-file-name "bin" x))
(lls/get-llvm-build-dirs))
(funcall (comp-dev/conf-get 'bin-dirs-fun))))
(defun lls/prompt-llvm-build-dir ()
(completing-read "Which directory? " (lls/get-llvm-build-dirs)))
(defun lls/get-llvm-build-dir ()
(car (lls/get-llvm-build-dirs)))
(defun lls/add-llvm-build-dir (dir)
(interactive
(list (read-file-name "Where? ")))
(comp-dev/ensure-initialized)
(comp-dev/conf-set 'build-dirs
(cons dir
(comp-dev/conf-get 'build-dirs))))
(defun lls/get-clang-command-fun (&rest args)
(apply (comp-dev/conf-get 'compile-command-fun)
args))
(defun lls/get-llc-command-fun (&rest args)
(apply (comp-dev/conf-get 'llc-command-fun) args))
(defun lls/get-dis-command-fun (&rest args)
(apply (comp-dev/conf-get 'dis-command-fun) args))
;; ========================= LLVM Build Dirs =========================
(defun ll/read-pass ()
(completing-read "Which pass? "
'("finalize-isel"
"machine-scheduler"
"greedy")))
(cl-defun lls/default-llc-comm (&key llc file action output pass)
(let ((llc (or llc "llc")))
(concat
(cond
((member action '(run-pass stop-before stop-after start-before start-after))
(format "%s %s -o - -%s=%s"
llc file (symbol-name action) pass))
(t
(read-string
"llc invocation: "
(string-join
(list
llc
file
"-o -")
" "))))
(or (and output
(format " | tee %s" output))
""))))
(defun lls/default-dis-comm (file _action)
(concat "llvm-objdump --disassemble "
file " "))
(defun lls/lldb (binary)
(interactive
(list (comp-dev/prompt-tool (rx (or "clang" "llc") line-end))))
(realgud--lldb
(format "lldb %s"
binary)))
(defun lls/cmake-here (directory build-type target)
(interactive
(list (expand-file-name "llvm"
(projectile-project-root))
(completing-read "Build Type? "
'("Release"
"Debug"
"RelWithDebInfo"))
(comp-dev/conf-get 'target)))
(let* ((comm-temp
"cmake %s -G Ninja -DCMAKE_BUILD_TYPE='%s' -DLLVM_ENABLE_PROJECTS='clang;llvm' -DLLVM_TARGETS_TO_BUILD='%s' -DCMAKE_C_COMPILER='clang' -DCMAKE_CXX_COMPILER='clang++' -DLLVM_ENABLE_ASSERTIONS=On")
(command (read-string
"CMake Command? "
(format comm-temp directory build-type target))))
(compile command)))
(provide 'llvm-comp-dev)
;;; llvm-comp-dev.el ends here

View file

@ -55,7 +55,7 @@
(interactive)
(let* ((buf (current-buffer))
(fname (buffer-file-name buf))
(clang (lls/prompt-tool "clang$"))
(clang (comp-dev/prompt-tool "clang$"))
(command
(with-current-buffer buf
(cond ((or compilation-minor-mode

View file

@ -28,7 +28,8 @@
(require 'llvm-gdb-command)
(require 'llvm-show-instr-info)
(require 'llvm-jump-to-tablegen)
(require 'lib-comp-dev)
(require 'llvm-comp-dev)
(define-prefix-command '*llvm-map*)
(define-key *root-map* (kbd "C-w") '*llvm-map*)

View file

@ -25,7 +25,7 @@
;;; Code:
(defun load-llvm-mode (root-dir)
(interactive (list (lls/conf-get 'root-dir)))
(interactive (list (comp-dev/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)

View file

@ -25,29 +25,29 @@
;;; Code:
(require 'clang-command)
(register-prebaked-optionset clang-subtargets "ARM" cortex-r4-soft-float
(register-prebaked-optionset clang-subtargets 'clang-option-config "ARM" cortex-r4-soft-float
:target "-target arm -mcpu=cortex-r4 -mfpu=none -mfloat-abi=soft -mlittle-endian")
(register-prebaked-optionset clang-subtargets "ARM" cortex-hard-float
(register-prebaked-optionset clang-subtargets 'clang-option-config "ARM" cortex-hard-float
:target "-target arm -mcpu=cortex-r4 -mfpu=vfpv3-d16 -mfloat-abi=hard -mlittle-endian")
(register-prebaked-optionset clang-subtargets "ARM" cortex-hard-float-tmu
(register-prebaked-optionset clang-subtargets 'clang-option-config "ARM" cortex-hard-float-tmu
:target "-target arm -mcpu=cortex-r4 -mfpu=vfpv3-d16 -mfloat-abi=hard -mlittle-endian")
(register-prebaked-optionset clang-subtargets "ARM" cortex-m0
(register-prebaked-optionset clang-subtargets 'clang-option-config "ARM" cortex-m0
:target "-target arm -mcpu=cortex-m0 -mlittle-endian -mthumb")
(register-prebaked-optionset clang-subtargets "ARM" cortex-m4
(register-prebaked-optionset clang-subtargets 'clang-option-config "ARM" cortex-m4
:target "-target arm -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16")
(register-prebaked-optionset clang-subtargets "ARM" cortex-m33
(register-prebaked-optionset clang-subtargets 'clang-option-config "ARM" cortex-m33
:target "-target arm -mcpu=cortex-m33 -mfpu=vfpv3-d16 -mfloat-abi=hard -mlittle-endian")
(register-prebaked-optionset clang-subtargets "RISCV" rv32im
(register-prebaked-optionset clang-subtargets 'clang-option-config "RISCV" rv32im
:target "-target riscv32-unknown-elf -march=rv32im -mabi=ilp32"
:optimization "-O3")
(register-prebaked-optionset clang-subtargets "RISCV" rv32imafc
(register-prebaked-optionset clang-subtargets 'clang-option-config "RISCV" rv32imafc
:target "-target riscv32-unknown-elf -march=rv32imafc -mabi=ilp32f -mno-relax"
:optimization "-O3")

View file

@ -0,0 +1,45 @@
;;; my-org-date-refile.el --- -*- lexical-binding: t -*-
;; Copyright (C) 2025 Benson Chu
;; Author: Benson Chu <bensonchu457@gmail.com>
;; Created: [2025-09-08 15:51]
;; 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:
(require 'org)
;; (format-time-string "%d" (org-read-date t t))
(defun modr/parse-timestamp (string)
(org-read-date t t string))
(defun modr/create-single-datetree (subtree-marker modr)
(with-current-buffer (marker-buffer subtree-marker)
(save-excursion
(goto-char (marker-position subtree-marker))
(save-restriction
(org-narrow-to-subtree)
(if (re-search-forward (rx "** "
(literal
(format-time-string "%b %d, %Y" modr))))
(point))))))
(provide 'my-org-date-refile)
;;; my-org-date-refile.el ends here

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

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

@ -1 +1 @@
Subproject commit 5e5d4984816ace917f78190e04936b038c43365b
Subproject commit 034ae31a6faa5c70b22d647c63f495b63d4bcee7

@ -1 +0,0 @@
Subproject commit e978a58400f6c5ebc9de13f52dd5d13e1d7820e6