~technomancy/fennel

Indent traceback frames with one tab instead of two spaces v1 PROPOSED

Rudolf Adamkovič: 1
 Indent traceback frames with one tab instead of two spaces

 1 files changed, 4 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~technomancy/fennel/patches/49066/mbox | git am -3
Learn more about email & git

[PATCH] Indent traceback frames with one tab instead of two spaces Export this patch

This is to improve tooling support.  For example, the Compilation mode in Emacs
fontifies Lua tracebacks, and with this change, we it works for Fennel too.
---
 src/fennel/compiler.fnl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/fennel/compiler.fnl b/src/fennel/compiler.fnl
index 879ffa8..60a902c 100644
--- a/src/fennel/compiler.fnl
+++ b/src/fennel/compiler.fnl
@@ -869,9 +869,9 @@ which we have to do if we don't know."

(fn traceback-frame [info]
  (if (and (= info.what :C) info.name)
      (string.format "  [C]: in function '%s'" info.name)
      (string.format "\t[C]: in function '%s'" info.name)
      (= info.what :C)
      "  [C]: in ?"
      "\t[C]: in ?"
      (let [remap (. sourcemap info.source)]
        (when (and remap (. remap info.currentline))
          ;; And some global info
@@ -883,12 +883,12 @@ which we have to do if we don't know."
          ;; Overwrite info with values from the mapping
          (set info.currentline (or (. remap info.currentline 2) -1)))
        (if (= info.what :Lua)
            (string.format "  %s:%d: in function %s" info.short_src
            (string.format "\t%s:%d: in function %s" info.short_src
                           info.currentline
                           (if info.name (.. "'" info.name "'") "?"))
            (= info.short_src "(tail call)")
            "  (tail call)"
            (string.format "  %s:%d: in main chunk" info.short_src
            (string.format "\t%s:%d: in main chunk" info.short_src
                           info.currentline)))))

(fn traceback [?msg ?start]
-- 
2.43.0
Rudolf Adamkovič <salutis@me.com> writes: