mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
scripts: import: Skip existing definition for ‘--insert’ option.
* guix/scripts/import.scm (guix-import): Skip existing definition for ‘--insert’ option. Change-Id: I2c4242669f974b263a018ab0cf56538bd7c81d06
This commit is contained in:
parent
2ca0b957f2
commit
d9b767640c
1 changed files with 13 additions and 10 deletions
|
@ -152,16 +152,19 @@ PROC callback."
|
|||
(lambda (expr)
|
||||
(match expr
|
||||
(((? define-prefix? define-prefix) term _ ...)
|
||||
(let ((source-properties
|
||||
(find-definition-insertion-location
|
||||
file term #:define-prefix define-prefix)))
|
||||
(if source-properties
|
||||
(insert-expression source-properties expr)
|
||||
(let ((port (open-file file "a")))
|
||||
(pretty-print-with-comments port expr)
|
||||
(newline port)
|
||||
(newline port)
|
||||
(close-port port)))))))))
|
||||
;; Skip existing definition.
|
||||
(unless (find-definition-location
|
||||
file term #:define-prefix define-prefix)
|
||||
(let ((source-properties
|
||||
(find-definition-insertion-location
|
||||
file term #:define-prefix define-prefix)))
|
||||
(if source-properties
|
||||
(insert-expression source-properties expr)
|
||||
(let ((port (open-file file "a")))
|
||||
(pretty-print-with-comments port expr)
|
||||
(newline port)
|
||||
(newline port)
|
||||
(close-port port))))))))))
|
||||
(import-as-definitions importer
|
||||
(cons (string-append "--file-to-insert=" file)
|
||||
args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue