diff options
Diffstat (limited to 'src/guile/skribilo/location.scm')
-rw-r--r-- | src/guile/skribilo/location.scm | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/guile/skribilo/location.scm b/src/guile/skribilo/location.scm index 6c23f76..e4583ff 100644 --- a/src/guile/skribilo/location.scm +++ b/src/guile/skribilo/location.scm @@ -79,19 +79,21 @@ (define (invocation-location . depth) ;; Return a location object denoting the place of invocation of this - ;; function's caller. - (let ((depth (if (null? depth) 4 (car depth)))) - (let* ((stack (make-stack #t)) - (frame (stack-ref stack depth)) - (source (frame-source frame))) - (and source - (let ((file (source-property source 'filename)) - (line (source-property source 'line)) - (col (source-property source 'column))) - (and file - (make <location> :file file - :line (and line (+ line 1)) - :column col))))))) + ;; function's caller. Debugging must be enable for this to work, via + ;; `(debug-enable 'debug)', otherwise `#f' is returned. + (let ((depth (if (null? depth) 4 (car depth))) + (stack (make-stack #t))) + (and stack + (let* ((frame (stack-ref stack depth)) + (source (frame-source frame))) + (and source + (let ((file (source-property source 'filename)) + (line (source-property source 'line)) + (col (source-property source 'column))) + (and file + (make <location> :file file + :line (and line (+ line 1)) + :column col)))))))) ;;; arch-tag: d68fa45d-a200-465e-a3c2-eb2861907f83 |