mirror of
				https://github.com/m00natic/vlfi.git
				synced 2025-11-04 09:01:37 +00:00 
			
		
		
		
	Plug option for vlf when opening files on package load.
This commit is contained in:
		
							
								
								
									
										11
									
								
								README.org
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								README.org
									
									
									
									
									
								
							@@ -2,14 +2,3 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
An Emacs mode that allows viewing files in chunks.  This is a fork
 | 
					An Emacs mode that allows viewing files in chunks.  This is a fork
 | 
				
			||||||
that builds on the GNU ELPA vlf.el.
 | 
					that builds on the GNU ELPA vlf.el.
 | 
				
			||||||
 | 
					 | 
				
			||||||
* Usage tips
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
When opening file, by default Emacs checks its size against
 | 
					 | 
				
			||||||
`large-file-warning-threshold' and if larger asks for confirmation.
 | 
					 | 
				
			||||||
To add vlf as an option in these cases:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#+BEGIN_SRC emacs-lisp
 | 
					 | 
				
			||||||
(if (fboundp 'vlf-if-file-too-large)
 | 
					 | 
				
			||||||
    (fset 'abort-if-file-too-large 'vlf-if-file-too-large))
 | 
					 | 
				
			||||||
#+END_SRC
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										27
									
								
								vlf.el
									
									
									
									
									
								
							
							
						
						
									
										27
									
								
								vlf.el
									
									
									
									
									
								
							@@ -185,8 +185,6 @@ With FROM-END prefix, view from the back."
 | 
				
			|||||||
(eval-after-load "dired"
 | 
					(eval-after-load "dired"
 | 
				
			||||||
  '(define-key dired-mode-map "V" 'dired-vlf))
 | 
					  '(define-key dired-mode-map "V" 'dired-vlf))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;; use this to hijack `abort-if-file-too-large'
 | 
					 | 
				
			||||||
;;;###autoload
 | 
					 | 
				
			||||||
(defun vlf-if-file-too-large (size op-type filename)
 | 
					(defun vlf-if-file-too-large (size op-type filename)
 | 
				
			||||||
  "If file SIZE larger than `large-file-warning-threshold', \
 | 
					  "If file SIZE larger than `large-file-warning-threshold', \
 | 
				
			||||||
allow user to view file with `vlf', open it normally or abort.
 | 
					allow user to view file with `vlf', open it normally or abort.
 | 
				
			||||||
@@ -210,29 +208,8 @@ OP-TYPE specifies the file operation being performed over  FILENAME."
 | 
				
			|||||||
            ((memq char '(?a ?A))
 | 
					            ((memq char '(?a ?A))
 | 
				
			||||||
             (error "Aborted"))))))
 | 
					             (error "Aborted"))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;;;; ChangeLog:
 | 
					;;; hijack `abort-if-file-too-large'
 | 
				
			||||||
 | 
					(fset 'abort-if-file-too-large 'vlf-if-file-too-large)
 | 
				
			||||||
;; 2012-11-29  Sam Steingold  <sds@gnu.org>
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 	hook into dired
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 2012-06-17  Chong Yidong  <cyd@gnu.org>
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 	vlf.el: Improve commentary.
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 2012-06-15  Sam Steingold  <sds@gnu.org>
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 	fix vlf-change-batch-size binding
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 2012-06-14  Sam Steingold  <sds@gnu.org>
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 	complete rewrite by Sam Steingold
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 2012-06-14  Sam Steingold  <sds@gnu.org>
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; 	View Large Files from Mathias Dahl
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(provide 'vlf)
 | 
					(provide 'vlf)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user