style: '-f' reads input files as UTF-8 by default.
Reported by mirai on #guix. * guix/scripts/style.scm (format-whole-file): Wrap body in 'with-fluids'. Pass #:guess-encoding to 'call-with-input-file'.
This commit is contained in:
		
							parent
							
								
									238d983b4e
								
							
						
					
					
						commit
						82bde985f4
					
				
					 1 changed files with 9 additions and 7 deletions
				
			
		|  | @ -335,13 +335,15 @@ PACKAGE." | ||||||
| 
 | 
 | ||||||
| (define* (format-whole-file file #:rest rest) | (define* (format-whole-file file #:rest rest) | ||||||
|   "Reformat all of FILE." |   "Reformat all of FILE." | ||||||
|   (let ((lst (call-with-input-file file read-with-comments/sequence))) |   (with-fluids ((%default-port-encoding "UTF-8")) | ||||||
|     (with-atomic-file-output file |     (let ((lst (call-with-input-file file read-with-comments/sequence | ||||||
|       (lambda (port) |                                      #:guess-encoding #t))) | ||||||
|         (apply pretty-print-with-comments/splice port lst |       (with-atomic-file-output file | ||||||
|                #:format-comment canonicalize-comment |         (lambda (port) | ||||||
|                #:format-vertical-space canonicalize-vertical-space |           (apply pretty-print-with-comments/splice port lst | ||||||
|                rest))))) |                  #:format-comment canonicalize-comment | ||||||
|  |                  #:format-vertical-space canonicalize-vertical-space | ||||||
|  |                  rest)))))) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
| ;;; | ;;; | ||||||
|  |  | ||||||
		Reference in a new issue