From ef1432f064abeb9f902c6917c540e143492a5de4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 21 Jun 2021 12:21:19 +0200 Subject: 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'. --- guix/packages.scm | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'guix/packages.scm') 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 @@ (define (deprecated-package old-name p) (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) (($ file line column) (match (search-path %load-path file) @@ -529,7 +523,7 @@ (define (goto port line column) ;; 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))) -- cgit v1.2.3