[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 33c687fae5 151/323: Implement helpers for com
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 33c687fae5 151/323: Implement helpers for compile_commands parsing |
Date: |
Thu, 9 Mar 2023 10:58:26 -0500 (EST) |
branch: externals/beardbolt
commit 33c687fae541fdd88df19af6e422bc0ba166dc24
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Implement helpers for compile_commands parsing
---
rmsbolt.el | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/rmsbolt.el b/rmsbolt.el
index 8e50fd3b84..04062ee9f9 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -72,6 +72,7 @@
(require 'cc-defs)
(require 'compile)
(require 'disass)
+(require 'json)
(require 'rmsbolt-java)
@@ -626,6 +627,34 @@ https://github.com/derickr/vld";
(and (1+ (1+ lower) (opt (or "64" "32" "8" "16")) (opt "_"))))
eol))
+;;;;; Language Integrations
+(defun rmsbolt--parse-compile-commands (comp-cmds file)
+ "Parse COMP-CMDS and extract a compilation dir and command for FILE."
+ (when-let* ((json-object-type 'alist)
+ (json-array-type 'vector)
+ (cmds (json-read-file comp-cmds))
+ (stripped-file (file-name-nondirectory file))
+ (entry (cl-find-if
+ (lambda (elt)
+ (string=
+ stripped-file
+ (file-name-nondirectory
+ (alist-get 'file elt ""))))
+ cmds))
+ (dir (alist-get 'directory entry))
+ (cmd (alist-get 'command entry)))
+ (list dir cmd)))
+(defun rmsbolt--default-c-compile-cmd (src-buffer)
+ "Handle compile_commands.json for c/c++ for a given SRC-BUFFER."
+ (when-let* ((ccj "compile_commands.json")
+ (compile-cmd-file
+ (locate-dominating-file
+ (buffer-file-name src-buffer)
+ ccj))
+ (compile-cmd-file (expand-file-name ccj compile-cmd-file))
+ (to-ret (rmsbolt--parse-compile-commands
+ compile-cmd-file (buffer-file-name src-buffer))))
+ to-ret))
;;;; Language Definitions
(defvar rmsbolt-languages)
(setq
- [elpa] externals/beardbolt a5855171f8 120/323: Fix byte-compilation warnings, (continued)
- [elpa] externals/beardbolt a5855171f8 120/323: Fix byte-compilation warnings, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0d5774397b 124/323: Update README, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt be3f92821e 140/323: Clean up PHP exporter slightly, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a4e0b8a805 134/323: Optimize disassembly function, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3527f2fa3a 123/323: Fix source code highlighting when multiple files are provided, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d564f9def8 131/323: Update README.org, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ebc56d81b0 127/323: Disable automatic recompile for buffers larger than 500 lines, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5f998f34d7 137/323: Update README, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4679974da1 141/323: Add documentation and starter file for PHP support, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 345dd21d24 145/323: Fix typo in docstring, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 33c687fae5 151/323: Implement helpers for compile_commands parsing,
ELPA Syncer <=
- [elpa] externals/beardbolt 708260ac56 163/323: Add sharplab to README, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 79de946e68 161/323: Add IRC channel to README, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt cc4347908c 179/323: Inline demo screencast, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b6e105190c 168/323: Actually use hidden-func-zig, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 10b70ca151 181/323: Add custom logic for finding swiftc, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 565d4a44ee 180/323: Convert if chain into cond, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2bb741e6f1 183/323: Merge branch 'add-swift-support' into 'master', ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 73a547856c 182/323: Remove rmsbolt-command from local variables in starter file, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 7045b8116a 185/323: Fixed spelling mistake, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 8ad27e8490 176/323: Added basic documentation for Go support, ELPA Syncer, 2023/03/09