mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-06-14 12:21:20 +00:00
Compare commits
3 commits
26c05d08c4
...
d7192e0ac9
| Author | SHA1 | Date | |
|---|---|---|---|
| d7192e0ac9 | |||
| 769bd39690 | |||
| 6f4307601a |
9 changed files with 71 additions and 89 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
2
elpa
|
|
@ -1 +1 @@
|
|||
Subproject commit 6df853a359ff19a0a8fa40cc1dd52c0768a49129
|
||||
Subproject commit b12ed477b68f85a0df9057f8c7b6d717b5a14586
|
||||
|
|
@ -34,10 +34,10 @@
|
|||
(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))
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
target-options lang-options
|
||||
other-options optimization-level
|
||||
include-dirs)
|
||||
opts
|
||||
config
|
||||
(-->
|
||||
(list
|
||||
(or binary-path "")
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@
|
|||
(t (completing-read (format "Which %s? " prompt)
|
||||
collection nil nil initial-input)))))
|
||||
|
||||
(defun comp-dev/prompt-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)
|
||||
|
|
@ -171,6 +171,9 @@
|
|||
(let (;;(vertico-sort-function nil)
|
||||
)
|
||||
(my/completing-read tool-regexp
|
||||
(comp-dev/prompt-tool 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
|
||||
|
|
|
|||
|
|
@ -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 (comp-dev/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*"
|
||||
|
|
|
|||
|
|
@ -62,8 +62,8 @@
|
|||
'llvm-comp-dev-config
|
||||
:root-dir root-dir
|
||||
:target (completing-read "Which target? " '("X86" "ARM" "Hexagon" "AIE" "RISCV"))
|
||||
:tramp tramp-conn
|
||||
|
||||
;; :tramp tramp-conn
|
||||
;; :build-dirs-fun (lls/guess-build-dirs-fun root-dir)
|
||||
;; :cc #'lls/default-comp-fun
|
||||
;; :dc #'lls/default-dis-comm
|
||||
|
|
@ -74,47 +74,71 @@
|
|||
(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))
|
||||
(list
|
||||
"/usr/bin/"))
|
||||
(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)
|
||||
'((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)
|
||||
(assembly :key ?a :major-mode asm-mode :buffer-string "assembly" :description "[a]ssembly" :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 compiler file output flags)
|
||||
(pcase start
|
||||
(cl-defmethod comp-dev/process-file ((config llvm-comp-dev-config) start-type end-type tool file output flags)
|
||||
(pcase start-type
|
||||
('c
|
||||
(-->
|
||||
(list compiler
|
||||
(list tool
|
||||
(clang/get-clang-options)
|
||||
(string-join rest " ")
|
||||
file
|
||||
flags
|
||||
(pcase end-type
|
||||
('pp-c "-E")
|
||||
('llvm-ir "-S -emit-llvm")
|
||||
('asm "-S")
|
||||
('obj "-c")
|
||||
('exe (error "unimplemented")))
|
||||
flags
|
||||
"-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))
|
||||
|
|
@ -194,21 +218,6 @@
|
|||
(format "lldb %s"
|
||||
binary)))
|
||||
|
||||
(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"
|
||||
|
|
@ -225,9 +234,5 @@
|
|||
(format comm-temp directory build-type target))))
|
||||
(compile command)))
|
||||
|
||||
(provide 'lib-comp-dev)
|
||||
;;; lib-comp-dev.el ends here
|
||||
|
||||
|
||||
(provide 'llvm-comp-dev)
|
||||
;;; llvm-comp-dev.el ends here
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue