mirror of
				https://github.com/m00natic/vlfi.git
				synced 2025-10-30 22:53:37 +00:00 
			
		
		
		
	Make chunk adjusting automatic.
This commit is contained in:
		
							
								
								
									
										18
									
								
								vlfi.el
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								vlfi.el
									
									
									
									
									
								
							| @@ -461,16 +461,22 @@ Search is performed chunk by chunk in `vlfi-batch-size' memory." | |||||||
|         (vlfi-move-to-chunk start-pos end-pos) |         (vlfi-move-to-chunk start-pos end-pos) | ||||||
|         (goto-char pos))))) |         (goto-char pos))))) | ||||||
|  |  | ||||||
| (defun vlfi-adjust-chunk (bytes) | (defun vlfi-adjust-chunk () | ||||||
|   "Adjust chunk beginning by BYTES." |   "Adjust chunk beginning until content can be properly decoded." | ||||||
|   (interactive "p") |   (interactive) | ||||||
|   (or (zerop vlfi-start-pos) |   (or (zerop vlfi-start-pos) | ||||||
|       (let ((pos (+ (point) bytes))) |       (let ((pos (point))) | ||||||
|         (setq vlfi-start-pos (- vlfi-start-pos bytes)) |         (while (/= (- vlfi-end-pos vlfi-start-pos) | ||||||
|  |                    (length (encode-coding-region | ||||||
|  |                             (point-min) (point-max) | ||||||
|  |                             buffer-file-coding-system t))) | ||||||
|  |  | ||||||
|  |           (setq pos (1- pos) | ||||||
|  |                 vlfi-start-pos (1- vlfi-start-pos)) | ||||||
|           (let ((inhibit-read-only t)) |           (let ((inhibit-read-only t)) | ||||||
|             (erase-buffer) |             (erase-buffer) | ||||||
|             (insert-file-contents buffer-file-name nil |             (insert-file-contents buffer-file-name nil | ||||||
|                                 vlfi-start-pos vlfi-end-pos)) |                                   vlfi-start-pos vlfi-end-pos))) | ||||||
|         (set-buffer-modified-p nil) |         (set-buffer-modified-p nil) | ||||||
|         (goto-char pos)))) |         (goto-char pos)))) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user