diff options
author | Ludovic Courtès <ludo@gnu.org> | 2021-06-21 12:21:19 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2021-07-11 00:49:15 +0200 |
commit | ef1432f064abeb9f902c6917c540e143492a5de4 (patch) | |
tree | 913591a3994d936e79997716d4f0d0af562619ca /guix/packages.scm | |
parent | 4dcc6067661c261cd9c5663e20b291a7eccaab75 (diff) |
utils: Add 'go-to-location' with source location caching.
* guix/utils.scm (%source-location-map): New variable.
(go-to-location): New procedure.
(edit-expression): Use it instead of custom loop.
* guix/packages.scm (package-field-location)[goto]: Remove.
Use 'go-to-location' instead of 'goto'.
Diffstat (limited to 'guix/packages.scm')
-rw-r--r-- | guix/packages.scm | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/guix/packages.scm b/guix/packages.scm index 2df4c79672..610683575c 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -514,12 +514,6 @@ object." (define (package-field-location package field) "Return the source code location of the definition of FIELD for PACKAGE, or #f if it could not be determined." - (define (goto port line column) - (unless (and (= (port-column port) (- column 1)) - (= (port-line port) (- line 1))) - (unless (eof-object? (read-char port)) - (goto port line column)))) - (match (package-location package) (($ <location> file line column) (match (search-path %load-path file) @@ -529,7 +523,7 @@ object." ;; In general we want to keep relative file names for modules. (call-with-input-file file-found (lambda (port) - (goto port line column) + (go-to-location port line column) (match (read port) (('package inits ...) (let ((field (assoc field inits))) |