[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt e18e3ee5ae 289/323: Support compile_commands.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt e18e3ee5ae 289/323: Support compile_commands.json |
Date: |
Thu, 9 Mar 2023 10:58:44 -0500 (EST) |
branch: externals/beardbolt
commit e18e3ee5ae6636c624a457934cc4a8606e6e9b5d
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Support compile_commands.json
* beardbolt.el (bb--split-rm-single, bb--split-rm-double): Rename
from bb-split-*.
(bb--c/c++-compile-specs): Use bb--guess-from-ccj.
(bb--guess-from-ccj): New helper.
---
beardbolt.el | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/beardbolt.el b/beardbolt.el
index eedcd5771a..72e035fda9 100644
--- a/beardbolt.el
+++ b/beardbolt.el
@@ -212,14 +212,14 @@ Useful if you have multiple objdumpers and want to select
between them")
(:conc-name bb--lang-))
(base-cmd nil :documentation "") (compile-specs nil :documentation ""))
-(defun bb-split-rm-single (cmd flag &optional test)
+(defun bb--split-rm-single (cmd flag &optional test)
"Remove a single FLAG from CMD. Test according to TEST."
(mapconcat #'identity (cl-remove flag (split-string cmd)
:test (or test #'string=))
" "))
-(defun bb-split-rm-double (cmd flag)
- "Remove a single FLAG and arg from CMD."
+(defun bb--split-rm-double (cmd flag)
+ "Remove a FLAG and subsequent arg from CMD."
(cl-loop while split with split = (split-string cmd)
for i from 0
for probe = (car split)
@@ -247,6 +247,7 @@ Returns a list (SPEC ...) where SPEC looks like (WHAT FN
CMD)."
(let* ((direct-asm-out (tmp "beardbolt" "s"))
(disass-asm-out (tmp "beardbolt" "out"))
(base-command (ensure-list (or bb-command
+ (bb--guess-from-ccj)
(bb--lang-base-cmd (bb--get-lang)))))
(debug `("-g1"))
(stdin-process `("-x" ,(if (derived-mode-p 'c++-mode) "c++" "c")
"-"))
@@ -705,6 +706,23 @@ With prefix argument, choose from starter files in
`bb-starter-files'."
(defun bb--on-change-timer ()
(bb-compile (bb--get-lang)))
+(defun bb--guess-from-ccj ()
+ (if-let* ((ccj-basename "compile_commands.json")
+ (ccj-dir (locate-dominating-file default-directory ccj-basename))
+ (ccj-file (expand-file-name ccj-basename ccj-dir))
+ (ccj (with-temp-buffer
+ (insert-file-contents ccj-file)
+ (goto-char (point-min))
+ (json-parse-buffer :object-type 'plist)))
+ (cmd (cl-loop for e across ccj
+ for file = (plist-get e :file)
+ when (equal file buffer-file-name)
+ return (plist-get e :command)))
+ (cmd (bb--split-rm-double cmd "-o"))
+ (cmd (bb--split-rm-double cmd "-c"))
+ (cmd (bb--split-rm-single cmd "-flto" #'string-prefix-p)))
+ cmd))
+
;;;; Mode Definition:
;;;###autoload
- [elpa] externals/beardbolt 264b614805 264/323: * beardbolt.el (bb-compile): Better handling of hack-local-variables., (continued)
- [elpa] externals/beardbolt 264b614805 264/323: * beardbolt.el (bb-compile): Better handling of hack-local-variables., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ed99686703 267/323: Handle TTYs with unknown background color, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 715f132d0e 263/323: Started rewriting. Too many changes to mention., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 325327bc70 273/323: Use inhibit-modification-hooks when modifying buffer, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5131185d13 272/323: Add a Makefile, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 9aba82b6cd 271/323: Update starter/test files, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b6958c3e0a 277/323: * beardbolt.el: preserve-library-functions -> preserve-weak-symbols, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2a11095c75 281/323: Rethink and simplify asm-processing algorithm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 7ff619c375 283/323: Add some benchmarks, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 11a19cfa66 282/323: Simplify line correspondence and overlay management, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e18e3ee5ae 289/323: Support compile_commands.json,
ELPA Syncer <=
- [elpa] externals/beardbolt 3b7a5bc85a 288/323: Simplify M-x beardbolt-starter. Less tmp directory cruft., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2e9abdbcbf 293/323: fixup README tweak, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 93778d8391 298/323: Don't try any window scrolling heroics on recompile, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 12e926f66b 300/323: Correct local variable section of benchmark file, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 782febee77 307/323: Add new option bb-execute and simplify more code, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 13c51a99e0 309/323: Rework window management again. Not more like godbolt, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 27f10327f3 308/323: Rework window management. Not a bad alternative., ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f260a62397 312/323: Refactor some behaviour for easier language definition, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3b88b18029 316/323: Update README.md, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 08227684f5 317/323: Provide better local variable defaults for starter examples, ELPA Syncer, 2023/03/09