mirror of
https://github.com/pestctrl/emacs-config.git
synced 2026-02-16 08:14:15 +00:00
Compare commits
4 commits
469f931fdf
...
ed12d6cb7b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed12d6cb7b | ||
|
|
67df435e83 | ||
|
|
f7785157b1 | ||
|
|
2b4cd50b24 |
3 changed files with 55 additions and 37 deletions
|
|
@ -28,42 +28,48 @@
|
|||
(require 'llvm-shared)
|
||||
(require 'anaphora)
|
||||
|
||||
(defun ll/get-cc1-command (file)
|
||||
(let* ((fname (file-name-nondirectory file))
|
||||
(buffer (format "*cc1-%s*" fname))
|
||||
(clang (lls/prompt-tool "clang$")))
|
||||
(save-window-excursion
|
||||
(let ((command (string-join
|
||||
(list (funcall
|
||||
lls/get-clang-command-fun
|
||||
clang file 'compile
|
||||
:output (make-temp-file nil nil ".o"))
|
||||
"-v")
|
||||
" ")))
|
||||
(while
|
||||
(progn
|
||||
(shell-command command buffer)
|
||||
(aprog1 (ll/buffer-has-include-error buffer)
|
||||
(when it
|
||||
(setq command
|
||||
(ll/add-include-folder-to-command command)))))))
|
||||
(with-current-buffer (get-buffer buffer)
|
||||
(beginning-of-buffer)
|
||||
(re-search-forward (rx "\"" (literal clang) "\" "
|
||||
(group "-cc1" (+ nonl))))
|
||||
(match-string 1)))))
|
||||
(defun ll/get-cc1-command (clang command)
|
||||
(let ((buffer (get-buffer-create "*cc1*")))
|
||||
(while
|
||||
(progn
|
||||
(shell-command command buffer)
|
||||
(aprog1 (ll/buffer-has-include-error buffer)
|
||||
(when it
|
||||
(setq command
|
||||
(ll/add-include-folder-to-command command))))))
|
||||
(with-current-buffer (get-buffer buffer)
|
||||
(beginning-of-buffer)
|
||||
(re-search-forward (rx "\"" (literal clang) "\" "
|
||||
(group "-cc1" (+ nonl))))
|
||||
(match-string 1))))
|
||||
|
||||
(defun ll/kill-gdb-command (file)
|
||||
(interactive
|
||||
(list
|
||||
(or (let ((fname (buffer-file-name (current-buffer))))
|
||||
(and (string= "c" (file-name-extension fname))
|
||||
fname))
|
||||
(read-file-name "Which file? "))))
|
||||
(let ((fname (file-name-nondirectory file)))
|
||||
(defun ll/get-clang-command-for-file (clang file)
|
||||
(string-join
|
||||
(list (funcall
|
||||
lls/get-clang-command-fun
|
||||
clang file 'compile
|
||||
:output (make-temp-file nil nil ".o"))
|
||||
"-v")
|
||||
" "))
|
||||
|
||||
(defun ll/kill-gdb-command ()
|
||||
(interactive)
|
||||
(let* ((buf (current-buffer))
|
||||
(fname (buffer-file-name buf))
|
||||
(clang (lls/prompt-tool "clang$"))
|
||||
(command
|
||||
(with-current-buffer buf
|
||||
(cond ((or compilation-minor-mode
|
||||
(eq major-mode 'compilation-mode))
|
||||
(concat (car compilation-arguments) " -v"))
|
||||
((string= "c" (file-name-extension fname))
|
||||
(ll/get-clang-command-for-file clang fname))
|
||||
(t
|
||||
(ll/get-clang-command-for-file clang
|
||||
(read-file-name "File? ")))))))
|
||||
(kill-new
|
||||
(format "r %s"
|
||||
(ll/get-cc1-command file)))))
|
||||
(ll/get-cc1-command clang command)))))
|
||||
|
||||
(provide 'llvm-gdb-command)
|
||||
;;; llvm-gdb-command.el ends here
|
||||
|
|
|
|||
|
|
@ -32,9 +32,11 @@ When Compilation minor mode is enabled, all the error-parsing
|
|||
commands of Compilation major mode are available. See
|
||||
`compilation-mode'."
|
||||
:lighter " Compilation" :keymap compilation-mode-map
|
||||
(if compilation-minor-mode
|
||||
(compilation-setup t)
|
||||
(compilation--unsetup)))
|
||||
(if (not compilation-minor-mode)
|
||||
(compilation--unsetup)
|
||||
(compilation-setup t)
|
||||
(font-lock-remove-keywords nil (compilation-mode-font-lock-keywords))
|
||||
(font-lock-flush)))
|
||||
|
||||
(defun my/enable-comp-keys-if-separate-mode (orig &rest args)
|
||||
(let ((hook compilation-finish-functions))
|
||||
|
|
|
|||
|
|
@ -84,6 +84,16 @@
|
|||
(defface llvm-separator-face `((t (:background "gray25" :extend t :inherit font-lock-warning-face)))
|
||||
nil)
|
||||
|
||||
(progn
|
||||
(-->
|
||||
llvm-font-lock-keywords
|
||||
(remove '("%[-a-zA-Z$._][-a-zA-Z$._0-9]*" . font-lock-variable-name-face) llvm-font-lock-keywords)
|
||||
(setq llvm-font-lock-keywords it))
|
||||
|
||||
(add-to-list 'llvm-font-lock-keywords
|
||||
`(,(rx "%" (+ (or "." "_" alphanumeric)) (optional (+ ":" (+ (or "." "_" alphanumeric)))))
|
||||
. font-lock-variable-name-face)))
|
||||
|
||||
(add-to-list 'llvm-font-lock-keywords
|
||||
`(,(rx line-start (optional "# ") "***" (+ nonl) "***" (optional ":") "\n") . 'llvm-separator-face))
|
||||
|
||||
|
|
@ -94,7 +104,7 @@
|
|||
`(,(rx "$" (+ alphanumeric)) . font-lock-variable-name-face))
|
||||
|
||||
(add-to-list 'llvm-font-lock-keywords
|
||||
`(,(rx (or "renamable" "implicit-def" "implicit")) . 'shadow))
|
||||
`(,(rx (or "renamable" "implicit-def" "implicit" "debug-location")) . 'shadow))
|
||||
|
||||
(add-to-list 'llvm-font-lock-keywords
|
||||
`(,(rx "!" (+ digit)) . 'font-lock-variable-name-face))
|
||||
|
|
|
|||
Loading…
Reference in a new issue