[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 67238e0272 138/323: Add rmsbolt-default-direc
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 67238e0272 138/323: Add rmsbolt-default-directory customization |
Date: |
Thu, 9 Mar 2023 10:58:24 -0500 (EST) |
branch: externals/beardbolt
commit 67238e02721f417662e48b967a7122488f6047ec
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Add rmsbolt-default-directory customization
Issue #10
Issue #4
---
README.org | 3 +++
rmsbolt.el | 30 ++++++++++++++++++++++++++----
2 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index 877befcc23..4a9dde26cc 100644
--- a/README.org
+++ b/README.org
@@ -82,6 +82,7 @@ Notable options:
| Option | Description
|
|-------------------------------+-------------------------------------------------------------------------------------------------------------------------------|
| ~rmsbolt-command~ | determines the prefix of the compilation
command to use. Use this to switch between compilers or pass flags to your
compiler. |
+| ~rmsbolt-default-directory~ | determines the default-drectory to compile
from.
|
| ~rmsbolt-disassemble~ | disassemble from a compiled binary with
objdump, if supported.
|
| ~rmsbolt-filter-*~ | Tweak filtering of binary output
|
| ~rmsbolt-intel-x86~ | Toggle between intel and att syntax if
supported
|
@@ -167,6 +168,8 @@ available in the compiled form if they exist.
- The compile-cmd-function is a function that will turn local variable
settings into a valid command which will take in a filename and output
assembly or an executable. See ~rmsbolt--c-compile-cmd~ for an example.
+ - When building compilation commands, please make sure to use absolute
paths,
+ as the default-directory is not guaranteed to be stable.
- If the assembly is not in a standard format, you will need to define a
~process-asm-custom-fn~ as well (see python/java for examples).
- If you would like to add language tweaks in your own config (ie: take full
diff --git a/rmsbolt.el b/rmsbolt.el
index e5b399fa8d..adc8cc78b0 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -45,10 +45,11 @@
;; change compiler and rmsbolt options simply by editing a local variable
block.
;;
;; Notable options:
-;; `rmsbolt-command': determines the prefix of the compilation command to use
+;; `rmsbolt-command': determines the prefix of the compilation command to use.
+;; `rmsbolt-default-directory': determines the default-drectory to compile
from.
;; `rmsbolt-disassemble': disassemble from a compiled binary with objdump, if
supported.
-;; `rmsbolt-filter-*': Tweak filtering of binary output
-;; `rmsbolt-intel-x86': Toggle between intel and att syntax if supported
+;; `rmsbolt-filter-*': Tweak filtering of binary output.
+;; `rmsbolt-intel-x86': Toggle between intel and att syntax if supported.
;; `rmsbolt-demangle': Demangle the output, if supported.
;;
;; Please see the readme at https://gitlab.com/jgkamat/rmsbolt for
@@ -112,6 +113,14 @@ This setting is automatically disabled on large buffers,
use
;; nil means use default command
:safe (lambda (v) (or (booleanp v) (stringp v)))
:group 'rmsbolt)
+(defcustom rmsbolt-default-directory nil
+ "The default directory to compile from.
+This must be an absolute path if set.
+Some exporters (such as pony) may not work with this set."
+ :type 'string
+ ;; nil means use default command
+ :safe (lambda (v) (or (booleanp v) (stringp v)))
+ :group 'rmsbolt)
(defcustom rmsbolt-intel-x86 t
"Whether to use intel x86 format or att."
:type 'boolean
@@ -297,6 +306,11 @@ This function does NOT quote the return value for use in
inferior shells."
:type 'string
:documentation "Default compilation command to use if none is provided.
If provided a function, call that function with the source buffer to determine
the compile command.")
+ (default-directory
+ nil
+ :type 'string
+ :documentation "Default directory to run compilation in. By default, use
rmsbolt--temp-dir.
+If provided a function, call that function with the source buffer to determine
the default directory.")
(compile-cmd-function
nil
:type 'function
@@ -1032,6 +1046,7 @@ Argument OVERRIDE-BUFFER use this buffer instead of
reading from the output file
(let* ((lang (rmsbolt--get-lang))
(src-buffer (current-buffer))
(cmd rmsbolt-command)
+ (dir rmsbolt-default-directory)
(force-disass (not (rmsbolt-l-supports-asm lang)))
(force-asm (not (rmsbolt-l-supports-disass lang))))
(when (and force-disass force-asm)
@@ -1040,6 +1055,12 @@ Argument OVERRIDE-BUFFER use this buffer instead of
reading from the output file
(setq-local rmsbolt-disassemble t))
(when force-asm
(setq-local rmsbolt-disassemble nil))
+ (when (not dir)
+ (setq-local rmsbolt-default-directory
+ (let ((new-dir (rmsbolt-l-default-directory lang)))
+ (pcase new-dir
+ ((pred functionp) (funcall new-dir src-buffer))
+ (_ new-dir)))))
(when (not cmd)
(setq-local rmsbolt-command
(let ((new-cmd (rmsbolt-l-compile-cmd lang)))
@@ -1089,7 +1110,8 @@ Argument OVERRIDE-BUFFER use this buffer instead of
reading from the output file
;; Generate command
(cmd (funcall func :src-buffer src-buffer))
- (default-directory rmsbolt--temp-dir))
+ (default-directory (or rmsbolt-default-directory
+ rmsbolt--temp-dir)))
(when (buffer-local-value 'rmsbolt-disassemble src-buffer)
(pcase
(rmsbolt-l-objdumper lang)
- [elpa] externals/beardbolt 0ed6a01cd1 119/323: Fix initial run of emacs-lisp disassembler, (continued)
- [elpa] externals/beardbolt 0ed6a01cd1 119/323: Fix initial run of emacs-lisp disassembler, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 77842a5f78 126/323: Add elisp support to docs, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt c00d09a850 122/323: Use hashtables instead of lists as sets for labels used, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt c009c2df44 130/323: Trim left side of strings to activate 'starting with period' opt, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 9e38f2238b 135/323: Add support for functions as arguments to :compile-cmd, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 1cc069a121 132/323: Quote filenames before passing them as shell arguments, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 495d481a94 136/323: Move rmsbolt-command initialization to end, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 39055a3dc4 133/323: Fix disassembly of partial files in C/C++, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 27e7bb714f 139/323: Add suppport for PHP, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4b6abc5ef8 129/323: Optimize rmsbolt-process-src-asm-lines, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 67238e0272 138/323: Add rmsbolt-default-directory customization,
ELPA Syncer <=
- [elpa] externals/beardbolt 9b2c85397c 149/323: Add texinfo version of docs, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ec99a1aa31 146/323: Attempt to fix whitespace clearing on hot recompiles, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5e389a88d9 152/323: Add rmsbolt splitter for splitting and mutating commands, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0fbc3d3f09 153/323: Enable compile_commands.json parsing for c/cpp, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 743f9a68ec 158/323: Handle non absolute .file paths, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 609f781b3a 165/323: Fix usages of when-let, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt c9f3b839e9 156/323: Add support for D, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a4f794666d 160/323: Add D to commentary, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt b7d318dfe1 178/323: Add Swift language support, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 98e984493b 170/323: Prevent hot recompile on deleted buffers, ELPA Syncer, 2023/03/09