mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 08:14:15 +00:00
Compare commits
55 commits
43f5e9669a
...
13fb053b3a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
13fb053b3a | ||
|
|
1d7d21bb7c | ||
|
|
1dc7a7f3a6 | ||
|
|
383a7b38ba | ||
|
|
0ecd08599a | ||
|
|
39e8e28017 | ||
|
|
4dae4bd3a6 | ||
|
|
deec3a6e86 | ||
|
|
88f3afa504 | ||
|
|
8cac2ded8c | ||
| ddba094cdb | |||
| 3637eece05 | |||
| 0abeb2cbbf | |||
|
|
42d2628694 | ||
|
|
7c9f742cfe | ||
|
|
c4be919a7d | ||
|
|
11cb27d934 | ||
|
|
27e8ddfd3e | ||
|
|
260d5df397 | ||
|
|
ee69ca8181 | ||
|
|
825ece2101 | ||
|
|
ec994b622d | ||
|
|
257d0c3fb0 | ||
|
|
a2837f7aef | ||
|
|
c654a394d4 | ||
|
|
de1606a4f1 | ||
|
|
5ba17df05e | ||
|
|
7645c4add5 | ||
|
|
a584bcc210 | ||
|
|
06d35358e4 | ||
|
|
263da35eca | ||
|
|
a9c88a72c0 | ||
|
|
7ae61d6389 | ||
|
|
6e534e9a1d | ||
|
|
e8bf01ccbf | ||
|
|
24e23653b6 | ||
|
|
96938c9663 | ||
|
|
7d63f38db6 | ||
|
|
d01f213f3f | ||
|
|
a054f3d709 | ||
|
|
6e328aca7f | ||
|
|
f2f7d8cbc2 | ||
|
|
9289f3e9e9 | ||
|
|
ccf0c782e6 | ||
|
|
4c794aea6a | ||
|
|
f01e0a6556 | ||
|
|
3b364368f8 | ||
|
|
99259fea39 | ||
|
|
adcd5f6a26 | ||
|
|
85f3578adf | ||
|
|
bdc912a956 | ||
|
|
d9b316db44 | ||
|
|
fe49eff907 | ||
|
|
af8fb088b8 | ||
|
|
157771e86e |
33 changed files with 856 additions and 288 deletions
|
|
@ -1,5 +1,12 @@
|
|||
#+PROPERTY: header-args:emacs-lisp :tangle "~/.emacs.d/config-ext.el" :comments both
|
||||
|
||||
* Augmentations
|
||||
|
||||
** vterm
|
||||
#+begin_src emacs-lisp
|
||||
(require 'vterm-aux)
|
||||
#+end_src
|
||||
|
||||
* posting source code
|
||||
#+begin_src emacs-lisp
|
||||
(use-package webpaste)
|
||||
|
|
@ -689,3 +696,9 @@
|
|||
|
||||
(define-key dired-mode-map (kbd "V") #'dired-open-with-vterm)
|
||||
#+end_src
|
||||
* direnv
|
||||
#+begin_src emacs-lisp
|
||||
(use-package direnv
|
||||
:config
|
||||
(direnv-mode))
|
||||
#+end_src
|
||||
|
|
|
|||
|
|
@ -483,7 +483,13 @@
|
|||
(corfu-auto t)
|
||||
:init
|
||||
(add-hook 'prog-mode-hook
|
||||
'corfu-mode))
|
||||
'corfu-mode)
|
||||
:config
|
||||
(unless window-system
|
||||
(use-package corfu-terminal)
|
||||
(corfu-terminal-mode 1))
|
||||
(when my-ec/enable-exwm
|
||||
(require 'corfu-hack)))
|
||||
|
||||
;; Magit
|
||||
(use-package magit)
|
||||
|
|
@ -672,10 +678,7 @@
|
|||
(define-key emacs-lisp-mode-map (kbd "C-c C-e") 'my/eval-and-replace)
|
||||
|
||||
;; Use cider's eval expression
|
||||
(let ((fetcher (if (or noninteractive my-ec/at-ti) "github" "github-ssh"))
|
||||
(quelpa-build-default-files-spec
|
||||
'("*.el" (:exclude ".dir-locals.el"))))
|
||||
(quelpa `(cider :repo "clojure-emacs/cider" :branch "master" :fetcher ,fetcher)))
|
||||
(use-package cider)
|
||||
(autoload 'cider--make-result-overlay "cider-overlays")
|
||||
|
||||
(defun endless/eval-overlay (value point)
|
||||
|
|
@ -762,8 +765,8 @@
|
|||
(or (ibuffer-buffer-file-name)
|
||||
""))))))
|
||||
(not
|
||||
(string-lessp (downcase (or (exwm-name-or-directory (car a)) ""))
|
||||
(downcase (or (exwm-name-or-directory (car b)) "")))))))
|
||||
(string-greaterp (downcase (or (exwm-name-or-directory (car a)) ""))
|
||||
(downcase (or (exwm-name-or-directory (car b)) "")))))))
|
||||
|
||||
(add-to-list 'ibuffer-never-show-predicates
|
||||
#'(lambda (buf)
|
||||
|
|
@ -901,12 +904,13 @@
|
|||
(if (eq system-type 'windows-nt)
|
||||
(define-key *root-map* "c" #'shell)
|
||||
(quelpa '(vterm))
|
||||
(require 'multi-vterm-tabs)
|
||||
(use-package vterm
|
||||
:ensure nil
|
||||
:commands vterm find-vterm vterm-kill
|
||||
:commands vterm vterm-kill
|
||||
:bind (("C-x 4 t" . #'find-vterm-other-window)
|
||||
:map *root-map*
|
||||
("c" . #'find-vterm))
|
||||
("c" . #'multi-vterm-tab))
|
||||
:config
|
||||
(add-to-list 'vterm-tramp-shells
|
||||
'("ssh" "/bin/bash"))
|
||||
|
|
@ -930,51 +934,7 @@
|
|||
|
||||
(define-key vterm-mode-map (kbd "C-k") #'vterm/delete-to-side)
|
||||
|
||||
(defun get-vterm-buffer (name)
|
||||
(if-let (buf (get-buffer name))
|
||||
buf
|
||||
(let ((buf (vterm--internal #'(lambda (_x) nil))))
|
||||
(with-current-buffer buf
|
||||
(rename-buffer name))
|
||||
buf)))
|
||||
|
||||
(defun get-tab-vterm-buffer ()
|
||||
(let* ((current-tab (alist-get 'name (tab-bar--current-tab)))
|
||||
(term-name (concat current-tab "-term")))
|
||||
(get-vterm-buffer term-name)))
|
||||
|
||||
(defun find-vterm ()
|
||||
(interactive)
|
||||
(display-buffer-same-window (get-tab-vterm-buffer) nil))
|
||||
|
||||
(defun find-vterm-other-window ()
|
||||
(interactive)
|
||||
(switch-to-buffer-other-window (get-tab-vterm-buffer)))
|
||||
|
||||
(setq vterm-kill-buffer-on-exit t)
|
||||
|
||||
(defun rename-vterm-with-tab (orig name &optional arg)
|
||||
(let ((current-tab-name (alist-get 'name (tab-bar--current-tab))))
|
||||
(funcall orig name arg)
|
||||
(when-let (b (get-buffer (concat current-tab-name "-term")))
|
||||
(with-current-buffer b
|
||||
(rename-buffer (concat (alist-get 'name (tab-bar--current-tab))
|
||||
"-term"))))))
|
||||
|
||||
(advice-add #'tab-bar-rename-tab
|
||||
:around
|
||||
#'rename-vterm-with-tab)
|
||||
|
||||
(defun close-vterm-with-tab (orig)
|
||||
(let ((current-tab-name (alist-get 'name (tab-bar--current-tab))))
|
||||
(when (funcall orig)
|
||||
(when-let (b (get-buffer (concat current-tab-name "-term")))
|
||||
(with-current-buffer b
|
||||
(vterm-send-C-d))))))
|
||||
|
||||
(advice-add #'close-tab-switch
|
||||
:around
|
||||
#'close-vterm-with-tab)))
|
||||
(setq vterm-kill-buffer-on-exit t)))
|
||||
#+end_src
|
||||
** wgrep
|
||||
#+begin_src emacs-lisp
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@
|
|||
#+end_src
|
||||
* Insert inactive timestamp after last org-datetree--find-create
|
||||
#+begin_src emacs-lisp
|
||||
(defun org-datetree--find-create-add-timestamp (regex-template year &optional month day insert)
|
||||
(defun org-datetree--find-create-add-timestamp (&rest args)
|
||||
(save-excursion
|
||||
(when day
|
||||
(let ((lnum (line-number-at-pos)))
|
||||
|
|
@ -666,6 +666,7 @@
|
|||
("i" . org-roam-node-insert)
|
||||
("w" . org-roam-refile)
|
||||
("j" . my/org-roam-logger-capture-current)
|
||||
("c" . org-roam-capture)
|
||||
:map org-mode-map
|
||||
("C-M-i" . completion-at-point))
|
||||
:init
|
||||
|
|
@ -690,6 +691,9 @@
|
|||
'(("d" "default" plain "%?" :target
|
||||
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
|
||||
:unnarrowed t)
|
||||
("j" "Journal" entry "* %<%H:%M> %?" :target
|
||||
(file+datetree "%<%Y%m%d%H%M%S>-${slug}.org" 'day)
|
||||
:unnarrowed t)
|
||||
("t" "tech tips" plain "%?" :target
|
||||
(file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: techtips\n")
|
||||
:unnarrowed t)))
|
||||
|
|
|
|||
|
|
@ -59,9 +59,11 @@
|
|||
:hook
|
||||
(lsp-completion-mode . my/lsp-mode-setup-completion)
|
||||
:config
|
||||
(require 'my-nprocs)
|
||||
(with-eval-after-load 'lsp-clangd
|
||||
(add-to-list 'lsp-clients-clangd-args
|
||||
"-j=16"))
|
||||
(format "-j=%d"
|
||||
(nprocs))))
|
||||
|
||||
(setq lsp-clangd-binary-path
|
||||
(executable-find "clangd"))
|
||||
|
|
@ -241,7 +243,7 @@
|
|||
* python
|
||||
#+begin_src emacs-lisp
|
||||
(use-package elpy)
|
||||
(elpy-enable)
|
||||
;; (elpy-enable)
|
||||
(use-package ein)
|
||||
(add-to-list 'exec-path
|
||||
"/home/benson/anaconda3/bin/" t)
|
||||
|
|
|
|||
2
elpa
2
elpa
|
|
@ -1 +1 @@
|
|||
Subproject commit 81ffc031f8d7728ee0ee169a7947f86451b5e80d
|
||||
Subproject commit 513ae0ba03f7aabf13d8874b47c7322be5bad58a
|
||||
4
init.el
4
init.el
|
|
@ -40,6 +40,8 @@
|
|||
(unless (package-installed-p package)
|
||||
(package-install package)))
|
||||
|
||||
(setq use-package-always-ensure t)
|
||||
|
||||
(require 'libs)
|
||||
|
||||
(require 'emacs-custom-load-or-ask)
|
||||
|
|
@ -56,8 +58,6 @@
|
|||
|
||||
(require 'term-compat)
|
||||
|
||||
(setq use-package-always-ensure t)
|
||||
|
||||
(when (native-comp-available-p)
|
||||
(require 'comp)
|
||||
(condition-case nil
|
||||
|
|
|
|||
81
lisp/corfu-hack.el
Normal file
81
lisp/corfu-hack.el
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
;;; corfu-hack.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2025 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2025-01-26 15:36]
|
||||
|
||||
;; 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 'exwm-screens)
|
||||
(require 'corfu)
|
||||
|
||||
;; (defun get-focused-monitor-geometry ()
|
||||
;; "Get the geometry of the monitor displaying the selected frame in EXWM."
|
||||
;; (let* ((name
|
||||
;; (-->
|
||||
;; (format "xrandr | grep %s"
|
||||
;; (exwm-workspace-current-monitor))
|
||||
;; (shell-command-to-string it))))
|
||||
;; (string-match (rx (+? nonl)
|
||||
;; (group (+ digit)) "x" (group (+ digit)) "+"
|
||||
;; (group (+ digit)) "+" (group (+ digit)))
|
||||
;; name)
|
||||
;; (list (string-to-number (match-string 3 name)) ; X
|
||||
;; (string-to-number (match-string 4 name)) ; Y
|
||||
;; (string-to-number (match-string 1 name)) ; Width
|
||||
;; (string-to-number (match-string 2 name)) ; Height
|
||||
;; )))
|
||||
|
||||
;; Requires libXrandr
|
||||
(defun get-focused-monitor-geometry ()
|
||||
"Get the geometry of the monitor displaying the selected frame in EXWM."
|
||||
(let* ((monitor-attrs (frame-monitor-attributes))
|
||||
(workarea (assoc 'workarea monitor-attrs))
|
||||
(geometry (cdr workarea)))
|
||||
(list (nth 0 geometry) ; X
|
||||
(nth 1 geometry) ; Y
|
||||
(nth 2 geometry) ; Width
|
||||
(nth 3 geometry) ; Height
|
||||
)))
|
||||
|
||||
;; (get-focused-monitor-geometry)
|
||||
|
||||
(defun advise-corfu-make-frame-with-monitor-awareness (orig-fun frame x y width height)
|
||||
"Advise `corfu--make-frame` to be monitor-aware, adjusting X and Y according to the focused monitor."
|
||||
;; Get the geometry of the currently focused monitor
|
||||
(let* ((monitor-geometry (get-focused-monitor-geometry))
|
||||
(monitor-x (nth 0 monitor-geometry))
|
||||
(monitor-y (nth 1 monitor-geometry))
|
||||
;; You may want to adjust the logic below if you have specific
|
||||
;; preferences on where on the monitor the posframe should
|
||||
;; appear. Currently, it places the posframe at its intended
|
||||
;; X and Y, but ensures it's within the bounds of the focused
|
||||
;; monitor.
|
||||
(new-x (+ monitor-x x))
|
||||
(new-y (+ monitor-y y)))
|
||||
|
||||
;; Call the original function with potentially adjusted coordinates
|
||||
(funcall orig-fun frame new-x new-y width height)))
|
||||
|
||||
|
||||
(advice-add 'corfu--make-frame :around #'advise-corfu-make-frame-with-monitor-awareness)
|
||||
|
||||
(provide 'corfu-hack)
|
||||
;;; corfu-hack.el ends here
|
||||
|
|
@ -38,6 +38,9 @@
|
|||
(let ((monitors (my/get-screens)))
|
||||
(setq exwm-workspace-number (length monitors))))
|
||||
|
||||
(defun exwm-workspace-current-monitor ()
|
||||
(plist-get exwm-randr-workspace-monitor-plist exwm-workspace-current-index))
|
||||
|
||||
(defun setup-workspace-monitors ()
|
||||
(setq exwm-randr/current-offset 0)
|
||||
(setq exwm-randr-workspace-monitor-plist
|
||||
|
|
|
|||
|
|
@ -71,11 +71,11 @@
|
|||
|
||||
;; Add these hooks in a suitable place (e.g., as done in exwm-config-default)
|
||||
|
||||
(defun simulate-C-t (arg)
|
||||
(interactive "P")
|
||||
(defun simulate-C-t ()
|
||||
(interactive)
|
||||
(if (eq major-mode 'exwm-mode)
|
||||
(exwm-input--fake-key ?\C-t)
|
||||
(transpose-chars arg)))
|
||||
(call-interactively #'transpose-chars)))
|
||||
|
||||
;; (key-binding (kbd "C-t C-t"))
|
||||
|
||||
|
|
|
|||
|
|
@ -151,7 +151,10 @@
|
|||
(output (ll/make-tmp-file
|
||||
file
|
||||
(cond
|
||||
((eq action 'assemble) ".S")
|
||||
((eq 'assemble
|
||||
(aml/get-map-prop ll/c-file-action-map action
|
||||
:compiler-action))
|
||||
".S")
|
||||
(t ".ll")))))
|
||||
(if (eq action 'diff)
|
||||
(ll/diff-c-on-two-compilations file action)
|
||||
|
|
|
|||
|
|
@ -24,24 +24,24 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(defun ll-tblgen/get-includes (file)
|
||||
(defun ll-tblgen/get-includes (file build-dir)
|
||||
(-->
|
||||
(list "llvm/include"
|
||||
"llvm/include/llvm/IR")
|
||||
(mapcar #'(lambda (x) (expand-file-name x (lls/get-llvm-root-dir))) it)
|
||||
;; TODO Hard coding this value
|
||||
(cons (lls/get-llvm-build-dir) it)
|
||||
(cons build-dir it)
|
||||
(reverse it)
|
||||
(cons (file-name-directory file) it)
|
||||
(mapcar #'(lambda (x) (concat "-I" (lls/un-trampify x))) it)
|
||||
(string-join it " ")))
|
||||
|
||||
(defun ll-tblgen/gen-command (file flags output-file)
|
||||
(let ((bin (car (lls/get-tool "llvm-tblgen$"))))
|
||||
(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))))))
|
||||
(format "%s %s %s %s"
|
||||
bin
|
||||
(lls/un-trampify file)
|
||||
(ll-tblgen/get-includes file)
|
||||
(ll-tblgen/get-includes file build-dir)
|
||||
(string-join
|
||||
(list
|
||||
"--write-if-changed"
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
)
|
||||
" "))))
|
||||
|
||||
(defun ll-tblgen/cmake-extract-tblgen-commands (&optional buffer)
|
||||
(defun ll-tblgen/cmake-extract-tblgen-commands (&optional buffer build-dir)
|
||||
(interactive
|
||||
(list (current-buffer)))
|
||||
(with-current-buffer buffer
|
||||
|
|
@ -108,13 +108,13 @@
|
|||
(file-name-directory (buffer-file-name buffer))
|
||||
(replace-regexp-in-string
|
||||
(expand-file-name "llvm" (lls/get-llvm-root-dir))
|
||||
(lls/get-llvm-build-dir)
|
||||
(or build-dir (lls/get-llvm-build-dir))
|
||||
it)
|
||||
(expand-file-name out it)))
|
||||
(set-text-properties 0 (length out) nil out)
|
||||
(set-text-properties 0 (length flags) nil flags)
|
||||
(push (list (string-join (list (file-name-nondirectory file) flags (file-name-nondirectory out)) " => ")
|
||||
(ll-tblgen/gen-command file (split-string flags " ") out)
|
||||
(ll-tblgen/gen-command file (split-string flags " ") out (or build-dir (lls/get-llvm-build-dir)))
|
||||
out)
|
||||
commands)))))
|
||||
|
||||
|
|
@ -131,9 +131,9 @@
|
|||
(let* ((action (read-key "[c]ompile [p]rint-records")))
|
||||
(when (not (member action '(?c ?p)))
|
||||
(error "Unknown action"))
|
||||
(let* ((commands (ll-tblgen/cmake-extract-tblgen-commands f))
|
||||
(let* ((build-dir (lls/prompt-llvm-build-dir))
|
||||
(commands (ll-tblgen/cmake-extract-tblgen-commands f build-dir))
|
||||
(key (completing-read "Which tablegen command? " (mapcar #'car commands)))
|
||||
(build-dir (lls/get-llvm-build-dir))
|
||||
(out-comm (alist-get key commands nil nil #'equal))
|
||||
(comm (car out-comm))
|
||||
(out (cadr out-comm)))
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@
|
|||
(setq fname (file-name-nondirectory (file-name-sans-extension file))
|
||||
temporary-file-directory (expand-file-name "tmp" file-directory)))
|
||||
|
||||
(make-directory temporary-file-directory)
|
||||
(unless (file-exists-p temporary-file-directory)
|
||||
(make-directory temporary-file-directory))
|
||||
(make-temp-file (concat fname "-")
|
||||
nil ext)))
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
;;; Code:
|
||||
(require 'llvm-shared)
|
||||
(require 'tmux-cmd)
|
||||
|
||||
(defvar lls/name-llvm-build-buffer
|
||||
(lambda (directory tools)
|
||||
|
|
@ -31,19 +32,31 @@
|
|||
(file-name-nondirectory directory)
|
||||
(string-join tools ","))))
|
||||
|
||||
(defun ll/llvm-build-tool (directory tools)
|
||||
(interactive
|
||||
(list
|
||||
(my/completing-read "build directory" (lls/get-llvm-build-dirs))
|
||||
(-->
|
||||
(completing-read-multiple "ninja -j X "
|
||||
'("clang"
|
||||
"llc")))))
|
||||
(let* ((buffer-name (funcall lls/name-llvm-build-buffer directory tools)))
|
||||
(compilation-start
|
||||
(lls/ninja-build-tools (lls/un-trampify directory) tools)
|
||||
nil
|
||||
(lambda (_) buffer-name))))
|
||||
;; (defun ll/llvm-build-tool (directory tools)
|
||||
;; (interactive
|
||||
;; (list
|
||||
;; (my/completing-read "build directory" (lls/get-llvm-build-dirs))
|
||||
;; (-->
|
||||
;; (completing-read-multiple "ninja -j X "
|
||||
;; '("clang"
|
||||
;; "llc")))))
|
||||
;; (let* ((buffer-name (funcall lls/name-llvm-build-buffer directory tools)))
|
||||
;; (compilation-start
|
||||
;; (lls/ninja-build-tools (lls/un-trampify directory) tools)
|
||||
;; nil
|
||||
;; (lambda (_) buffer-name))))
|
||||
|
||||
(defun-tmux-cmd-2 ll/llvm-build-tool (directory tools)
|
||||
(:tmux-type transient
|
||||
:interactive
|
||||
((list
|
||||
(my/completing-read "build directory" (lls/get-llvm-build-dirs))
|
||||
(completing-read-multiple "ninja -j X "
|
||||
'("clang"
|
||||
"llc")))))
|
||||
(name (funcall lls/name-llvm-build-buffer directory tools))
|
||||
|
||||
(lls/ninja-build-tools (lls/un-trampify directory) tools))
|
||||
|
||||
(provide 'llvm-build-tool)
|
||||
;;; llvm-build-tool.el ends here
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@
|
|||
(require 'eieio)
|
||||
(require 'load-llvm-mode)
|
||||
(require 'my-clang-options)
|
||||
(require 'my-nprocs)
|
||||
(require 'use-package)
|
||||
(use-package realgud-lldb)
|
||||
|
||||
;; =========================== LLVM Rebuild ==========================
|
||||
|
||||
(defvar llvm-core-count
|
||||
(--> "nproc"
|
||||
(shell-command-to-string it)
|
||||
(string-to-number it)
|
||||
(- it 16)))
|
||||
(nprocs))
|
||||
|
||||
(defun lls/ninja-build-tools (build-dir tools-list &optional verbose)
|
||||
(format "set -o pipefail && CLICOLOR_FORCE=1 ninja -C %s -j %d %s %s 2>&1 | tee ninja.log"
|
||||
|
|
@ -112,6 +112,11 @@
|
|||
localname)
|
||||
path))
|
||||
|
||||
(defun lls/default-initialize ()
|
||||
(interactive)
|
||||
(let ((lls/target-init-fun #'lls/default-target-init))
|
||||
(lls/initialize)))
|
||||
|
||||
(defun lls/initialize ()
|
||||
(interactive)
|
||||
(lls/set-llvm-config
|
||||
|
|
@ -183,6 +188,9 @@
|
|||
(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)))
|
||||
|
||||
|
|
@ -200,21 +208,26 @@
|
|||
|
||||
;; =============================== Misc ==============================
|
||||
|
||||
(defun my/completing-read (prompt collection)
|
||||
(defun my/completing-read (prompt collection &optional initial-input)
|
||||
(let ((len (length collection)))
|
||||
(cond ((< len 1)
|
||||
(user-error "Uhhh, no %ss? " prompt))
|
||||
((= len 1) (car collection))
|
||||
(t (completing-read (format "Which %s? " prompt)
|
||||
collection)))))
|
||||
collection nil nil initial-input)))))
|
||||
|
||||
(defun lls/prompt-tool (tool-regexp &optional directories)
|
||||
(lls/un-trampify
|
||||
(my/completing-read tool-regexp
|
||||
(lls/get-tool tool-regexp
|
||||
(or (and (eq 'string (type-of directories))
|
||||
(list directories))
|
||||
directories)))))
|
||||
(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)
|
||||
(cl-mapcan #'(lambda (dir)
|
||||
|
|
@ -290,6 +303,7 @@
|
|||
binary)))
|
||||
|
||||
(defun lls/default-target-init ()
|
||||
(interactive)
|
||||
(let ((root-dir (lls/guess-root-dir-fun))
|
||||
tramp-conn)
|
||||
(when (tramp-tramp-file-p root-dir)
|
||||
|
|
@ -317,25 +331,20 @@
|
|||
#'lls/default-target-init))
|
||||
|
||||
(defun lls/guess-root-dir-fun ()
|
||||
(let ((repo-remotes
|
||||
'("https://github.com/llvm/llvm-project.git"
|
||||
"git@github.com:llvm/llvm-project"
|
||||
"https://github.com/MPACT-ORG/llvm-project"
|
||||
"https://github.com/Xilinx/llvm-aie")))
|
||||
(if (-->
|
||||
(shell-command-to-string "git remote get-url origin")
|
||||
(string-trim it)
|
||||
(member it repo-remotes))
|
||||
(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)))))
|
||||
(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 ()
|
||||
|
|
@ -362,7 +371,7 @@
|
|||
"RelWithDebInfo"))
|
||||
(lls/conf-get 'target)))
|
||||
(let* ((comm-temp
|
||||
"cmake %s -G Ninja -DCMAKE_BUILD_TYPE='%s' -DLLVM_ENABLE_PROJECTS='clang' -DLLVM_TARGETS_TO_BUILD='%s' -DCMAKE_C_COMPILER='clang' -DCMAKE_CXX_COMPILER='clang++'")
|
||||
"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))))
|
||||
|
|
|
|||
|
|
@ -55,12 +55,29 @@
|
|||
(magit-run-git-async "worktree" "add" (if force "-B" "-b")
|
||||
branch (magit--expand-worktree path) start-point))
|
||||
|
||||
(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 --first-parent"))
|
||||
(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)))))
|
||||
|
||||
(transient-append-suffix 'magit-worktree "b"
|
||||
'("B" "[async] worktree" my/magit-worktree-checkout))
|
||||
|
||||
(transient-append-suffix 'magit-worktree "c"
|
||||
'("C" "[async] branch and worktree" my/magit-worktree-branch))
|
||||
|
||||
(transient-append-suffix 'magit-log "s"
|
||||
'("A" "Ancestry path" magit-show-ancestor-merges))
|
||||
|
||||
(transient-append-suffix 'magit-fetch "-t"
|
||||
'("-f" "Force fetch" "--force"))
|
||||
|
||||
;; This is fixed in 5478d4e of magit/transient (committed )
|
||||
;; (require 'transient-bug)
|
||||
;; (with-eval-after-load 'vertico-multiform
|
||||
|
|
|
|||
|
|
@ -109,16 +109,6 @@
|
|||
|
||||
(add-hook 'mu4e-compose-pre-hook 'my-mu4e-set-account)
|
||||
|
||||
(if (not (string= mu4e-mu-version "1.12.5"))
|
||||
(warn "Remove this advice, bug has been fixed")
|
||||
(defun my/mu4e-run-pre-hook (compose-type compose-func &optional parent)
|
||||
(let ((mu4e-compose-parent-message parent)
|
||||
(mu4e-compose-type compose-type))
|
||||
(run-hooks 'mu4e-compose-pre-hook)))
|
||||
(advice-add #'mu4e--draft
|
||||
:before
|
||||
#'my/mu4e-run-pre-hook))
|
||||
|
||||
;; (setcar mu4e-headers-thread-last-child-prefix "╰┬►")
|
||||
;; (setcar mu4e-headers-thread-first-child-prefix "├┬►")
|
||||
;; (setcar mu4e-headers-thread-connection-prefix "│")
|
||||
|
|
@ -175,7 +165,18 @@
|
|||
|
||||
(advice-add #'mu4e~headers-thread-prefix
|
||||
:override
|
||||
#'my/mu4e~headers-thread-prefix))
|
||||
#'my/mu4e~headers-thread-prefix)
|
||||
|
||||
(defun mu4e-print-path ()
|
||||
(interactive)
|
||||
(-->
|
||||
(mu4e-message-at-point)
|
||||
(mu4e-message-field it :path)
|
||||
(progn
|
||||
(kill-new it)
|
||||
(message "Path Copied: %s" it))))
|
||||
|
||||
(define-key mu4e-search-minor-mode-map (kbd "l") #'mu4e-print-path))
|
||||
|
||||
(provide 'mu4e-configuration)
|
||||
;;; mu4e-config.el ends here
|
||||
|
|
|
|||
200
lisp/multi-vterm-tabs.el
Normal file
200
lisp/multi-vterm-tabs.el
Normal file
|
|
@ -0,0 +1,200 @@
|
|||
;;; multi-vterm-tabs.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2025 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2025-01-26 11:20]
|
||||
|
||||
;; 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 'cl-lib)
|
||||
(require 'dash)
|
||||
(require 'vterm)
|
||||
(require 'tab-bar)
|
||||
|
||||
(defclass multi-vterm-tab-info ()
|
||||
((free-numbers :type list :initform nil)
|
||||
(max-number :type number :initform -1)
|
||||
(recent-buffer :initform nil)))
|
||||
|
||||
(defvar mvt/info (make-hash-table))
|
||||
|
||||
(defun mvt/get-or-create-info (symbol)
|
||||
(or (gethash symbol mvt/info)
|
||||
(puthash symbol (make-instance 'multi-vterm-tab-info)
|
||||
mvt/info)))
|
||||
|
||||
;; (setq mvt/info nil)
|
||||
|
||||
(defun mvt/format-buffer-name (tab-name index)
|
||||
"Format vterm buffer name with INDEX."
|
||||
(format "*%s-vterm<%s>*" tab-name index))
|
||||
|
||||
(defvar mvt/regex
|
||||
(rx (and "*" (group (+ nonl)) "-vterm<" (group (+ digit)) ">" "*")))
|
||||
|
||||
(defun mvt/create-buffer (tab-name)
|
||||
(interactive
|
||||
(list (alist-get 'name (tab-bar--current-tab))))
|
||||
(let* ((mvti (gethash (intern tab-name) mvt/info))
|
||||
(index (or (pop (slot-value mvti 'free-numbers))
|
||||
(cl-incf (slot-value mvti 'max-number))))
|
||||
vterm-name)
|
||||
(setq vterm-name (mvt/format-buffer-name tab-name index))
|
||||
(-->
|
||||
(or (get-buffer vterm-name)
|
||||
(with-current-buffer (generate-new-buffer vterm-name)
|
||||
(vterm-mode)
|
||||
(mvt/minor-mode)
|
||||
(current-buffer)))
|
||||
(setf (slot-value mvti 'recent-buffer)
|
||||
it)
|
||||
(if (called-interactively-p)
|
||||
(switch-to-buffer it)
|
||||
it))))
|
||||
|
||||
(defun mvt/get-all-buffers (tab-name)
|
||||
(let* ((tab-sym (intern tab-name))
|
||||
(mvti (mvt/get-or-create-info tab-sym))
|
||||
(max-num (slot-value mvti 'max-number))
|
||||
buffs)
|
||||
(dotimes (i max-num)
|
||||
(awhen (get-buffer (mvt/format-buffer-name tab-name i))
|
||||
(push it buffs)))
|
||||
(reverse buffs)))
|
||||
|
||||
;; (mvt/get-all-buffers (alist-get 'name (tab-bar--current-tab)))
|
||||
|
||||
(defun mvt/compact-terminals (tab-name)
|
||||
(interactive
|
||||
(list (alist-get 'name (tab-bar--current-tab))))
|
||||
(let* ((tab-sym (intern tab-name))
|
||||
(mvti (mvt/get-or-create-info tab-sym))
|
||||
(all-buffers (mvt/get-all-buffers tab-name))
|
||||
(iter 0))
|
||||
(dolist (buff all-buffers)
|
||||
(with-current-buffer buff
|
||||
(rename-buffer (mvt/format-buffer-name tab-name iter)))
|
||||
(incf iter))
|
||||
(setf (slot-value mvti 'free-numbers) nil
|
||||
(slot-value mvti 'max-number) (1- iter))))
|
||||
|
||||
(defun mvt/extract-info ()
|
||||
(when mvt/minor-mode
|
||||
(let ((buffer-name (buffer-name)))
|
||||
(when (string-match mvt/regex buffer-name)
|
||||
(cons (match-string 1 buffer-name)
|
||||
(string-to-number (match-string 2 buffer-name)))))))
|
||||
|
||||
(defun mvt/next ()
|
||||
(interactive)
|
||||
(let* ((info (mvt/extract-info))
|
||||
(tab-name (car info))
|
||||
(start (cdr info))
|
||||
(mvt-info (mvt/get-or-create-info (intern tab-name)))
|
||||
(max-num
|
||||
(-->
|
||||
(slot-value mvt-info 'max-number)
|
||||
(1+ it)))
|
||||
last-buffer)
|
||||
(while (progn
|
||||
(when (not (= max-num 0))
|
||||
(setq start (mod (1+ start) max-num)))
|
||||
(not (setq last-buffer
|
||||
(get-buffer (mvt/format-buffer-name tab-name start))))))
|
||||
(setf (slot-value mvt-info 'recent-buffer)
|
||||
last-buffer)
|
||||
(switch-to-buffer last-buffer)
|
||||
(set-window-prev-buffers (selected-window)
|
||||
(cdr (window-prev-buffers (selected-window))))))
|
||||
|
||||
;; (gethash 'emacs-devel mvt/info)
|
||||
|
||||
(defun mvt/kill-hook ()
|
||||
(when mvt/minor-mode
|
||||
(let ((info (mvt/extract-info)))
|
||||
(push (cdr info)
|
||||
(slot-value (mvt/get-or-create-info (intern (car info)))
|
||||
'free-numbers))
|
||||
(mvt/next))))
|
||||
|
||||
(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)
|
||||
map))
|
||||
|
||||
(define-minor-mode mvt/minor-mode ""
|
||||
:global nil
|
||||
:keymap mvt/minor-mode-map
|
||||
(when mvt/minor-mode
|
||||
(add-hook 'kill-buffer-hook #'mvt/kill-hook)))
|
||||
|
||||
(defun multi-vterm-tab (arg)
|
||||
"Create new vterm buffer."
|
||||
(interactive "P")
|
||||
(let* ((tab-name (alist-get 'name (tab-bar--current-tab)))
|
||||
(tab-sym (intern tab-name))
|
||||
(mvti (mvt/get-or-create-info tab-sym)))
|
||||
(let ((buffer (slot-value mvti 'recent-buffer)))
|
||||
(switch-to-buffer
|
||||
(or (and buffer
|
||||
(buffer-live-p buffer)
|
||||
(not arg)
|
||||
buffer)
|
||||
(mvt/create-buffer tab-name))))))
|
||||
|
||||
(defun mvt/find-all-terms-in-tab (tab-name)
|
||||
(remove-if-not #'(lambda (b)
|
||||
(with-current-buffer b
|
||||
(let ((info (mvt/extract-info)))
|
||||
(and info
|
||||
(string= tab-name (car info))))))
|
||||
(buffer-list)))
|
||||
|
||||
(defun mvt/rename-tab (orig new-tab-name &optional arg)
|
||||
(let ((old-tab-name (alist-get 'name (tab-bar--current-tab))))
|
||||
(funcall orig new-tab-name arg)
|
||||
(let ((old-sym (intern old-tab-name))
|
||||
(new-sym (intern new-tab-name)))
|
||||
(puthash new-sym (gethash old-sym mvt/info)
|
||||
mvt/info)
|
||||
(remhash old-sym mvt/info))
|
||||
(dolist (b (mvt/find-all-terms-in-tab old-tab-name))
|
||||
(with-current-buffer b
|
||||
(let ((info (mvt/extract-info)))
|
||||
(rename-buffer (mvt/format-buffer-name new-tab-name (cdr info))))))))
|
||||
|
||||
(advice-add #'tab-bar-rename-tab
|
||||
:around
|
||||
#'mvt/rename-tab)
|
||||
|
||||
(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))
|
||||
(with-current-buffer b
|
||||
(vterm-send-C-d))))))
|
||||
|
||||
(advice-add #'close-tab-switch
|
||||
:around
|
||||
#'mvt/close-tab)
|
||||
|
||||
(provide 'multi-vterm-tabs)
|
||||
;;; multi-vterm-tabs.el ends here
|
||||
41
lisp/my-nprocs.el
Normal file
41
lisp/my-nprocs.el
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
;;; my-nprocs.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2024 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2024-12-27 10:07]
|
||||
|
||||
;; 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 'dash)
|
||||
|
||||
(defvar nprocs-cache nil)
|
||||
|
||||
(defun nprocs ()
|
||||
(or nprocs-cache
|
||||
(setq nprocs-cache
|
||||
(-->
|
||||
(shell-command-to-string "nproc")
|
||||
(string-to-number it)
|
||||
(let ((num it))
|
||||
(max (- num 16)
|
||||
(/ num 2)))))))
|
||||
|
||||
(provide 'my-nprocs)
|
||||
;;; my-nprocs.el ends here
|
||||
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
;;; Code:
|
||||
(require 'my-plaintext-files)
|
||||
(require 'org-roam-util)
|
||||
|
||||
(defconst my/org-folder
|
||||
(my/plaintext-file "org"))
|
||||
|
|
@ -69,6 +70,24 @@
|
|||
,(my/agenda-file "habits.org")
|
||||
,(my/agenda-file "calendars/production.org"))))
|
||||
|
||||
(defun my/update-org-agenda-files ()
|
||||
(interactive)
|
||||
(setq org-agenda-files
|
||||
(append
|
||||
`(,(my/agenda-file "plan.org")
|
||||
,(my/agenda-file "thoughts.org")
|
||||
,(my/agenda-file "refile.org")
|
||||
,(my/agenda-file "sandbox.org")
|
||||
,(my/agenda-file "dev.org")
|
||||
,(my/agenda-file "prod.org")
|
||||
,(my/agenda-file "habits.org")
|
||||
,(my/agenda-file "calendars/production.org"))
|
||||
(my/get-org-roam-files-by-tags '("Project" "active")))))
|
||||
|
||||
(advice-add #'org-agenda
|
||||
:before
|
||||
#'my/update-org-agenda-files)
|
||||
|
||||
(defconst my/all-agenda-files
|
||||
(cons (my/agenda-file "eternal.org")
|
||||
org-agenda-files))
|
||||
|
|
|
|||
|
|
@ -42,16 +42,18 @@
|
|||
|
||||
(defun my/org-capture-finalize-shouldnt-mess-windows (&rest args)
|
||||
(save-window-excursion
|
||||
;; This basically means that we don't change window configurations when
|
||||
;; there are previous buffers to be seen. IDK if this will have unintended
|
||||
;; consequences, because...
|
||||
(if (zerop (length (window-prev-buffers)))
|
||||
(delete-window)
|
||||
(previous-buffer))
|
||||
;; current-window-configuration will encode a buffer that's about to be
|
||||
;; deleted. I tested it, and it does what I want, so maybe there's no
|
||||
;; problem?
|
||||
(org-capture-put :return-to-wconf (current-window-configuration))))
|
||||
(let ((buffer (current-buffer)))
|
||||
;; This basically means that we don't change window configurations when
|
||||
;; there are previous buffers to be seen. IDK if this will have unintended
|
||||
;; consequences, because...
|
||||
(if (zerop (length (window-prev-buffers)))
|
||||
(delete-window)
|
||||
(previous-buffer))
|
||||
;; current-window-configuration will encode a buffer that's about to be
|
||||
;; deleted. I tested it, and it does what I want, so maybe there's no
|
||||
;; problem?
|
||||
(with-current-buffer buffer
|
||||
(org-capture-put :return-to-wconf (current-window-configuration))))))
|
||||
|
||||
(advice-add #'org-capture-finalize
|
||||
:before
|
||||
|
|
|
|||
|
|
@ -250,7 +250,10 @@
|
|||
:function my/org-find-journal
|
||||
:datetree t
|
||||
:template "* %U\n%?")
|
||||
("Programming Interview Prep Journal" :keys "p"
|
||||
("Puppet" :keys "p"
|
||||
:file ,(my/org-file "puppet.gpg")
|
||||
:template "* %T \n%?")
|
||||
("Programming Interview Prep Journal" :keys "P"
|
||||
:file ,(my/org-file "journal.gpg")
|
||||
:datetree t
|
||||
:template "* ")))
|
||||
|
|
|
|||
|
|
@ -43,5 +43,7 @@
|
|||
(require 'self-chat-mode)
|
||||
(require 'my-org-caldav)
|
||||
|
||||
(require 'org-table-convert)
|
||||
|
||||
(provide 'my-org)
|
||||
;;; my-org.el ends here
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ added as a link in the `ARCHIVED_AT' property."
|
|||
(make-directory directory)
|
||||
(let ((default-directory directory))
|
||||
(start-process "org-board-youtube-dl" "*org-board-youtube-dl*" youtube-dl-binary
|
||||
"-f 137+140" (car site))))
|
||||
"-f 135+140" (car site))))
|
||||
((and
|
||||
(= (length site) 1)
|
||||
(string-match-p "reddit" (car site)))
|
||||
|
|
|
|||
85
lisp/org-config/org-roam-convert-to-notes.el
Normal file
85
lisp/org-config/org-roam-convert-to-notes.el
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
;;; org-roam-convert-to-notes.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2024 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2024-12-25 13:53]
|
||||
|
||||
;; 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 my/org-roam-convert-to-notes ()
|
||||
(interactive)
|
||||
(org-back-to-heading)
|
||||
(let ((url (org-entry-get (point) "URL"))
|
||||
(heading (org-get-heading t t t t))
|
||||
(buff (current-buffer))
|
||||
notes-buffer
|
||||
heading-text
|
||||
node-title node)
|
||||
(string-match (rx "[[" (+ (not "]")) "][" (group (+ (not "]"))) "]]")
|
||||
heading)
|
||||
(setq heading-text (match-string 1 heading))
|
||||
|
||||
(setq node-title (concat "Web Notes: " heading-text))
|
||||
|
||||
(let ((candidates (org-roam-node-read--completions
|
||||
(lambda (node)
|
||||
(string-match-p (concat "^" node-title)
|
||||
(org-roam-node-title node))))))
|
||||
(when (> (length candidates) 0)
|
||||
(org-capture-kill)
|
||||
(org-roam-node-visit (cdar candidates))
|
||||
(user-error "Notes already exist on this URL!")))
|
||||
|
||||
(setq node (org-roam-node-create
|
||||
:title
|
||||
node-title))
|
||||
|
||||
(org-roam-capture-
|
||||
:node node
|
||||
:props '(:finalize find-file)
|
||||
:templates
|
||||
`(("d" "default" plain "%?" :target
|
||||
(file+head "%<%Y%m%d%H%M%S>-${slug}.org"
|
||||
,(string-join
|
||||
(list
|
||||
"#+title: ${title}"
|
||||
"#+filetags: web_notes"
|
||||
""
|
||||
(format "Link: %s" url)
|
||||
"Author: %^{Author? }"
|
||||
"")
|
||||
"\n"))
|
||||
:unnarrowed t)))
|
||||
|
||||
(setq notes-buffer (current-buffer))
|
||||
|
||||
(save-window-excursion
|
||||
(with-current-buffer buff
|
||||
(my/org-board-prompt)
|
||||
(org-cut-subtree)
|
||||
(with-current-buffer notes-buffer
|
||||
(save-excursion
|
||||
(goto-char (point-max))
|
||||
(yank)))
|
||||
(org-capture-kill)))))
|
||||
|
||||
(provide 'org-roam-convert-to-notes)
|
||||
;;; org-roam-convert-to-notes.el ends here
|
||||
|
|
@ -37,6 +37,13 @@
|
|||
(member tag tags))
|
||||
tag-name))))))
|
||||
|
||||
(defun my/get-org-roam-files-by-tags (tags)
|
||||
(->>
|
||||
(org-roam-node-list)
|
||||
(remove-if-not (my/org-roam-filter-by-tag tags))
|
||||
(mapcar #'org-roam-node-file)
|
||||
(-uniq)))
|
||||
|
||||
(defun my/org-roam-list-notes-by-tag (tag-name)
|
||||
(mapcar #'org-roam-node-file
|
||||
(seq-filter
|
||||
|
|
|
|||
148
lisp/org-config/org-table-convert.el
Normal file
148
lisp/org-config/org-table-convert.el
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
;;; org-table-convert.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2024 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2024-12-29 10:07]
|
||||
|
||||
;; 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)
|
||||
|
||||
(defun gdb-stacktrace-to-org-table ()
|
||||
(interactive)
|
||||
(let ((regexp (rx (and line-start
|
||||
"#"
|
||||
;; Stack Number
|
||||
(group (+? digit))
|
||||
(+ " ")
|
||||
(optional
|
||||
(and "0x"
|
||||
(+ alnum)
|
||||
" in "))
|
||||
;; Function Name
|
||||
(group (+? nonl))
|
||||
(optional " ")
|
||||
"("
|
||||
(*? nonl)
|
||||
") at "
|
||||
;; File name
|
||||
(group
|
||||
;;"/"
|
||||
(+? nonl))
|
||||
":"
|
||||
;; Line Number
|
||||
(group
|
||||
(+ digit))
|
||||
line-end
|
||||
))))
|
||||
(beginning-of-buffer)
|
||||
(save-excursion
|
||||
(while (re-search-forward regexp nil 'noerror)
|
||||
(replace-match
|
||||
(let ((path (match-string 3)))
|
||||
(save-match-data
|
||||
(format "|\\1|\\2|%s:\\4|[[\\3::\\4][Link]]|"
|
||||
(cond ((string-match (rx (and "/scratch/benson/tools"
|
||||
(* digit)
|
||||
"/llvm_cgt/llvm-project/"
|
||||
(group
|
||||
(+ nonl))))
|
||||
path)
|
||||
(format "$LLVM_PROJECT/%s" (match-string 1 path)))
|
||||
((string-match (rx (and "/scratch/benson/tools"
|
||||
(* digit)
|
||||
"/"
|
||||
(group
|
||||
(+ nonl))))
|
||||
path)
|
||||
(format "$SANDBOX/%s" (match-string 1 path)))
|
||||
(t path))))))))
|
||||
(org-table-sort-lines nil ?N)
|
||||
(save-excursion
|
||||
(insert "|-\n|#|Function Name|File & Line Number|Link|\n|-\n")
|
||||
(end-of-buffer)
|
||||
(insert "\n|-"))
|
||||
(org-table-align)))
|
||||
|
||||
(defun lldb-filename-to-org-link (filename)
|
||||
(setq filename
|
||||
(string-replace ":" "::" filename))
|
||||
(save-match-data
|
||||
(if (string-match (rx line-start "/scratch/benson/" (+ alphanumeric) "/llvm_cgt/llvm-project/"
|
||||
(group (+ nonl)))
|
||||
filename)
|
||||
(format "[[%s][LLVM/%s]]"
|
||||
filename
|
||||
(match-string 1 filename))
|
||||
(string-match (rx line-start (optional "/")
|
||||
(+ (and (+ (not "/")) "/" ))
|
||||
(group
|
||||
(+ nonl)))
|
||||
filename)
|
||||
(format "[[%s][%s]]"
|
||||
filename
|
||||
(match-string 1 filename)))))
|
||||
|
||||
(defun lldb-stacktrace-to-org-table ()
|
||||
(interactive)
|
||||
;; (narrow-to-region (point) (point))
|
||||
;; (save-excursion
|
||||
;; (yank))
|
||||
(let ((regexp
|
||||
(rx (and line-start (+ nonl)
|
||||
"frame #" (group (+ digit))
|
||||
": 0x" (= 16 alphanumeric) " " (+ nonl) "`"
|
||||
(group
|
||||
(+? nonl))
|
||||
(optional
|
||||
"(" (+? nonl) ")")
|
||||
(or
|
||||
line-end
|
||||
(and
|
||||
" at "
|
||||
(group
|
||||
(+ nonl))))))))
|
||||
(while (re-search-forward regexp
|
||||
nil t)
|
||||
(let ((num (match-string 1))
|
||||
(function (match-string 2))
|
||||
(filename (match-string 3)))
|
||||
|
||||
(save-match-data
|
||||
(while
|
||||
(when (string-match-p "<[^<>]+>" function)
|
||||
(setq function
|
||||
(replace-regexp-in-string "<[^<>]+>" "" function)))))
|
||||
|
||||
(when filename
|
||||
(setq filename
|
||||
(lldb-filename-to-org-link filename)))
|
||||
|
||||
(replace-match (format "|%s|%s|%s|" num function (or filename ""))))))
|
||||
(goto-char (point-min))
|
||||
(org-table-sort-lines nil ?N)
|
||||
(save-excursion
|
||||
(insert "|-\n|#|Function Name|File & Line Number|Link|\n|-\n")
|
||||
(end-of-buffer)
|
||||
(insert "\n|-"))
|
||||
(org-table-align))
|
||||
|
||||
(provide 'org-table-convert)
|
||||
;;; org-table-convert.el ends here
|
||||
|
|
@ -12,15 +12,15 @@
|
|||
"This is a mode where I become crazy and talk to myself."
|
||||
(setq font-lock-defaults '(self-chat-highlights)))
|
||||
|
||||
(modify-syntax-entry ?\" " " self-chat-mode-syntax-table)
|
||||
|
||||
(define-key self-chat-mode-map (kbd "RET") #'self-chat-insert-next)
|
||||
(define-key self-chat-mode-map (kbd "DEL") #'delete-self-chat-line)
|
||||
(define-key self-chat-mode-map (kbd "C-DEL") #'delete-self-chat-text)
|
||||
(define-key self-chat-mode-map (kbd "C-DEL") #'sc/delete-full-line)
|
||||
(define-key self-chat-mode-map (kbd "M-DEL") #'delete-self-chat-text)
|
||||
|
||||
(defun self-chat-insert-next ()
|
||||
(interactive)
|
||||
(when (not (bolp))
|
||||
(call-interactively #'newline)
|
||||
(call-interactively #'newline))
|
||||
(call-interactively #'user-chat/body))
|
||||
|
||||
(defun chat-pre ()
|
||||
|
|
@ -28,12 +28,29 @@
|
|||
(not (= self-chat-num self-chat-last)))
|
||||
(setq self-chat-last2 self-chat-last
|
||||
self-chat-last self-chat-num))
|
||||
;; Are we fixing up an old line, or creating a new one?
|
||||
(if (save-excursion
|
||||
(beginning-of-line)
|
||||
(not (looking-at (rx (+ nonl) ":"))))
|
||||
(progn
|
||||
(beginning-of-line)
|
||||
(kill-line))
|
||||
(call-interactively #'newline)
|
||||
(call-interactively #'newline))
|
||||
(insert "> "))
|
||||
|
||||
(defun chat-post ()
|
||||
(if-let ((name (alist-get self-chat-num self-chat-alist)))
|
||||
(insert name ": ")))
|
||||
|
||||
(defun sc/delete-full-line ()
|
||||
(interactive)
|
||||
(set-mark-command nil)
|
||||
(previous-line)
|
||||
(previous-line)
|
||||
(end-of-line)
|
||||
(call-interactively #'kill-region))
|
||||
|
||||
(defun delete-self-chat-text ()
|
||||
(interactive)
|
||||
(beginning-of-line)
|
||||
|
|
@ -51,12 +68,10 @@
|
|||
(call-interactively #'kill-ring-save))
|
||||
(cond ((= 0 (length (current-kill 0)))
|
||||
(call-interactively #'backward-char))
|
||||
((string-match-p "^> [A-z]*: $" (current-kill 0))
|
||||
(set-mark-command nil)
|
||||
(previous-line)
|
||||
(previous-line)
|
||||
(end-of-line)
|
||||
(call-interactively #'kill-region))
|
||||
((string-match-p
|
||||
(rx line-start ">" (optional " ") (optional (+ alpha) ":" (optional " ")) line-end)
|
||||
(current-kill 0))
|
||||
(sc/delete-full-line))
|
||||
(t
|
||||
(call-interactively #'delete-backward-char))))
|
||||
|
||||
|
|
@ -104,6 +119,7 @@
|
|||
("Coop" "c" "cornsilk")
|
||||
("Net" "n" "magenta")
|
||||
("Someone" "s" "dim gray")
|
||||
("Everyone" "e" "pale green")))
|
||||
("Everyone" "e" "pale green")
|
||||
("Note" "N" "dim gray")))
|
||||
|
||||
(provide 'self-chat-mode)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
(add-drawer "^http"
|
||||
"WEBSITE")
|
||||
(add-drawer "^English:"
|
||||
"ENGLISH")
|
||||
"ENGLISH_TRANSLATION")
|
||||
(goto-char (line-end-position))
|
||||
(insert "\n:PROPERTIES:")
|
||||
(re-search-forward "goo.gl" nil t)
|
||||
|
|
@ -24,9 +24,10 @@
|
|||
(insert "\n:END:")
|
||||
(widen)))
|
||||
|
||||
(defun my/populate-taiwan-fields (address website maps-url coordinates)
|
||||
(defun my/populate-taiwan-fields (english address website maps-url coordinates)
|
||||
(interactive
|
||||
(list
|
||||
(read-string "English? ")
|
||||
(read-string "Address? ")
|
||||
(read-string "Website? ")
|
||||
(read-string "Google Maps URL? ")
|
||||
|
|
@ -34,6 +35,7 @@
|
|||
(cl-flet ((add-valid (key value)
|
||||
(when (not (string-empty-p value))
|
||||
(org-entry-put (point) key value))))
|
||||
(add-valid "ENGLISH_TRANSLATION" english)
|
||||
(add-valid "ADDRESS" address)
|
||||
(add-valid "COORDINATES" coordinates)
|
||||
(add-valid "WEBSITE" website)
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 6eebb8486c8136c1e4b69a380e1756532ae02f57
|
||||
Subproject commit 5e5d4984816ace917f78190e04936b038c43365b
|
||||
|
|
@ -218,7 +218,7 @@
|
|||
(when (and (string-equal system-type "windows-nt")
|
||||
(>= (string-match-p
|
||||
(regexp-quote "utf-8")
|
||||
(format "%s" buffer-file-coding-system))) 0)
|
||||
(format "%s" buffer-file-coding-system))))
|
||||
(list
|
||||
"PYTHONIOENCODING=utf-8"
|
||||
"PYTHONLEGACYWINDOWSSTDIO=1")))))))
|
||||
|
|
@ -231,7 +231,8 @@
|
|||
:override
|
||||
#'my/elpy-patch)
|
||||
|
||||
(require 'work-mail)
|
||||
(when my-ec/enable-mail
|
||||
(require 'work-mail))
|
||||
|
||||
(provide 'work-config)
|
||||
;;; work-config.el ends here
|
||||
|
|
|
|||
|
|
@ -364,125 +364,7 @@
|
|||
;; (substring contents begin (match-end 0))))))
|
||||
;; (org-roam--get-title-or-slug file))))
|
||||
|
||||
(defun gdb-stacktrace-to-org-table ()
|
||||
(interactive)
|
||||
(let ((regexp (rx (and line-start
|
||||
"#"
|
||||
;; Stack Number
|
||||
(group (+? digit))
|
||||
(+ " ")
|
||||
(optional
|
||||
(and "0x"
|
||||
(+ alnum)
|
||||
" in "))
|
||||
;; Function Name
|
||||
(group (+? nonl))
|
||||
(optional " ")
|
||||
"("
|
||||
(*? nonl)
|
||||
") at "
|
||||
;; File name
|
||||
(group
|
||||
;;"/"
|
||||
(+? nonl))
|
||||
":"
|
||||
;; Line Number
|
||||
(group
|
||||
(+ digit))
|
||||
line-end
|
||||
))))
|
||||
(beginning-of-buffer)
|
||||
(save-excursion
|
||||
(while (re-search-forward regexp nil 'noerror)
|
||||
(replace-match
|
||||
(let ((path (match-string 3)))
|
||||
(save-match-data
|
||||
(format "|\\1|\\2|%s:\\4|[[\\3::\\4][Link]]|"
|
||||
(cond ((string-match (rx (and "/scratch/benson/tools"
|
||||
(* digit)
|
||||
"/llvm_cgt/llvm-project/"
|
||||
(group
|
||||
(+ nonl))))
|
||||
path)
|
||||
(format "$LLVM_PROJECT/%s" (match-string 1 path)))
|
||||
((string-match (rx (and "/scratch/benson/tools"
|
||||
(* digit)
|
||||
"/"
|
||||
(group
|
||||
(+ nonl))))
|
||||
path)
|
||||
(format "$SANDBOX/%s" (match-string 1 path)))
|
||||
(t path))))))))
|
||||
(org-table-sort-lines nil ?N)
|
||||
(save-excursion
|
||||
(insert "|-\n|#|Function Name|File & Line Number|Link|\n|-\n")
|
||||
(end-of-buffer)
|
||||
(insert "\n|-"))
|
||||
(org-table-align)))
|
||||
|
||||
(defun lldb-filename-to-org-link (filename)
|
||||
(setq filename
|
||||
(string-replace ":" "::" filename))
|
||||
(save-match-data
|
||||
(if (string-match (rx line-start "/scratch/benson/" (+ alphanumeric) "/llvm_cgt/llvm-project/"
|
||||
(group (+ nonl)))
|
||||
filename)
|
||||
(format "[[%s][LLVM/%s]]"
|
||||
filename
|
||||
(match-string 1 filename))
|
||||
(string-match (rx line-start (optional "/")
|
||||
(+ (and (+ (not "/")) "/" ))
|
||||
(group
|
||||
(+ nonl)))
|
||||
filename)
|
||||
(format "[[%s][%s]]"
|
||||
filename
|
||||
(match-string 1 filename)))))
|
||||
|
||||
(defun lldb-stacktrace-to-org-table ()
|
||||
(interactive)
|
||||
;; (narrow-to-region (point) (point))
|
||||
;; (save-excursion
|
||||
;; (yank))
|
||||
(let ((regexp
|
||||
(rx (and line-start (+ nonl)
|
||||
"frame #" (group (+ digit))
|
||||
": 0x" (= 16 alphanumeric) " " (+ nonl) "`"
|
||||
(group
|
||||
(+? nonl))
|
||||
(optional
|
||||
"(" (+? nonl) ")")
|
||||
(or
|
||||
line-end
|
||||
(and
|
||||
" at "
|
||||
(group
|
||||
(+ nonl))))))))
|
||||
(while (re-search-forward regexp
|
||||
nil t)
|
||||
(let ((num (match-string 1))
|
||||
(function (match-string 2))
|
||||
(filename (match-string 3)))
|
||||
|
||||
(save-match-data
|
||||
(while
|
||||
(when (string-match-p "<[^<>]+>" function)
|
||||
(setq function
|
||||
(replace-regexp-in-string "<[^<>]+>" "" function)))))
|
||||
|
||||
(when filename
|
||||
(setq filename
|
||||
(lldb-filename-to-org-link filename)))
|
||||
|
||||
(replace-match (format "|%s|%s|%s|" num function (or filename ""))))))
|
||||
(goto-char (point-min))
|
||||
(org-table-sort-lines nil ?N)
|
||||
(save-excursion
|
||||
(insert "|-\n|#|Function Name|File & Line Number|Link|\n|-\n")
|
||||
(end-of-buffer)
|
||||
(insert "\n|-"))
|
||||
(org-table-align))
|
||||
|
||||
(require 'org-table-convert)
|
||||
|
||||
(setq show-tab-bar-new-tab t)
|
||||
|
||||
|
|
@ -562,7 +444,9 @@
|
|||
("C-c n j" . my/org-roam-logger-capture-current)
|
||||
:map org-mode-map
|
||||
("C-M-i" . completion-at-point))
|
||||
:commands my/get-org-roam-files-by-tags
|
||||
:config
|
||||
(require 'org-roam-util)
|
||||
(org-roam-db-autosync-enable)
|
||||
(setq org-roam-capture-templates
|
||||
'(("d" "default" plain "%?" :target
|
||||
|
|
@ -575,6 +459,12 @@
|
|||
:target (file+head+olp "%<%Y-%m-%d>.org"
|
||||
"#+title: %<%Y-%m-%d>\n#+filetags: :dailies:%<%Y:%B:>\n"
|
||||
("Journal")))
|
||||
("J" "Journal with source" entry "* %<%H:%M> %?\n:PROPERTIES:\n:LOCATION: %a\n:END:"
|
||||
:unnarrowed t
|
||||
:target
|
||||
(file+head+olp "%<%Y-%m-%d>.org"
|
||||
"#+title: %<%Y-%m-%d>\n#+filetags: :dailies:%<%Y:%B:>\n"
|
||||
("Journal")))
|
||||
("E" "Entry Interrupt" entry (file "~/org/templates/entry-interrupt.org")
|
||||
:unnarrowed t
|
||||
:target (file+head+olp "%<%Y-%m-%d>.org"
|
||||
|
|
@ -633,17 +523,12 @@
|
|||
(my/org-roam-filter-by-tag '("Project" "active"))
|
||||
nil :templates my/project-templates))
|
||||
|
||||
(defun my/get-org-roam-files-by-tags (tags)
|
||||
(->>
|
||||
(org-roam-node-list)
|
||||
(remove-if-not (my/org-roam-filter-by-tag tags))
|
||||
(mapcar #'org-roam-node-file)
|
||||
(-uniq)))
|
||||
|
||||
(defun org-agenda-insert-breaks-between (str1 str2)
|
||||
(let ((r (rx line-start
|
||||
(= 18 nonl)
|
||||
(not ".")))
|
||||
" "
|
||||
(+ (not whitespace))
|
||||
(+ whitespace)
|
||||
(not (any whitespace "."))))
|
||||
begin end)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
|
|
|
|||
|
|
@ -29,11 +29,12 @@
|
|||
;;; Code:
|
||||
|
||||
(defmacro use-exwm (&rest body)
|
||||
`(use-package exwm
|
||||
`(when my-ec/enable-exwm
|
||||
(use-package exwm
|
||||
:ensure nil
|
||||
:defer t
|
||||
:quelpa (exwm :fetcher ,(if (or noninteractive my-ec/at-ti) "github" "github-ssh") :repo "pestctrl/exwm")
|
||||
,@body))
|
||||
,@body)))
|
||||
|
||||
(provide 'use-exwm)
|
||||
;;; use-exwm.el ends here
|
||||
|
|
|
|||
49
lisp/vterm-aux.el
Normal file
49
lisp/vterm-aux.el
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
;;; vterm-aux.el --- -*- lexical-binding: t -*-
|
||||
|
||||
;; Copyright (C) 2025 Benson Chu
|
||||
|
||||
;; Author: Benson Chu <bensonchu457@gmail.com>
|
||||
;; Created: [2025-05-14 14:08]
|
||||
|
||||
;; 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 'vterm)
|
||||
|
||||
(defun vterm-backup-path ()
|
||||
(interactive)
|
||||
(while
|
||||
(progn
|
||||
(re-search-backward (rx "/" (+ (or (not space) "\\ "))))
|
||||
(not (y-or-n-p "Did you want to kill this path? "))))
|
||||
(match-string 0))
|
||||
|
||||
(defun vterm-kill-save (thing)
|
||||
(interactive
|
||||
(list
|
||||
(read-key "Kill what? [c]urrent working directory | [p]ath")))
|
||||
(awhen
|
||||
(pcase thing
|
||||
('?c default-directory)
|
||||
('?p (vterm-backup-path)))
|
||||
(kill-new it)))
|
||||
|
||||
(define-key vterm-mode-map (kbd "M-w") #'vterm-kill-save)
|
||||
|
||||
(provide 'vterm-aux)
|
||||
;;; vterm-aux.el ends here
|
||||
Loading…
Reference in a new issue