mirror of
				https://github.com/m00natic/vlfi.git
				synced 2025-11-04 09:01:37 +00:00 
			
		
		
		
	Make custom revert function local only for vlfi buffers.
This commit is contained in:
		
							
								
								
									
										13
									
								
								vlfi.el
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								vlfi.el
									
									
									
									
									
								
							@@ -76,6 +76,7 @@
 | 
				
			|||||||
  (set-buffer-modified-p nil)
 | 
					  (set-buffer-modified-p nil)
 | 
				
			||||||
  (buffer-disable-undo)
 | 
					  (buffer-disable-undo)
 | 
				
			||||||
  (add-hook 'write-contents-functions 'vlfi-write)
 | 
					  (add-hook 'write-contents-functions 'vlfi-write)
 | 
				
			||||||
 | 
					  (make-local-variable 'revert-buffer-function)
 | 
				
			||||||
  (setq revert-buffer-function 'vlfi-revert)
 | 
					  (setq revert-buffer-function 'vlfi-revert)
 | 
				
			||||||
  (make-local-variable 'vlfi-batch-size)
 | 
					  (make-local-variable 'vlfi-batch-size)
 | 
				
			||||||
  (put 'vlfi-batch-size 'permanent-local t)
 | 
					  (put 'vlfi-batch-size 'permanent-local t)
 | 
				
			||||||
@@ -222,10 +223,14 @@ With FROM-END prefix, start from the back."
 | 
				
			|||||||
  (interactive)
 | 
					  (interactive)
 | 
				
			||||||
  (vlfi-insert-file t))
 | 
					  (vlfi-insert-file t))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun vlfi-revert (&rest args)
 | 
					(defun vlfi-revert (&optional ignore-auto noconfirm)
 | 
				
			||||||
  "Revert current chunk.  Ignore ARGS."
 | 
					  "Revert current chunk.  Ignore IGNORE-AUTO.
 | 
				
			||||||
  (ignore args)
 | 
					Ask for confirmation if NOCONFIRM is nil."
 | 
				
			||||||
  (vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos))
 | 
					  (ignore ignore-auto)
 | 
				
			||||||
 | 
					  (or noconfirm
 | 
				
			||||||
 | 
					      (yes-or-no-p (format "Revert buffer from file %s? "
 | 
				
			||||||
 | 
					                           buffer-file-name))
 | 
				
			||||||
 | 
					      (vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(defun vlfi-jump-to-chunk (n)
 | 
					(defun vlfi-jump-to-chunk (n)
 | 
				
			||||||
  "Go to to chunk N."
 | 
					  "Go to to chunk N."
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user