[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/vlf cedd0b4 059/310: Fix spaces and indent.
From: |
Stefan Monnier |
Subject: |
[elpa] externals/vlf cedd0b4 059/310: Fix spaces and indent. |
Date: |
Sat, 28 Nov 2020 00:32:47 -0500 (EST) |
branch: externals/vlf
commit cedd0b4e82f8e4473b4fd245481eb91c2290ef41
Author: Andrey Kotlarski <m00naticus@gmail.com>
Commit: Andrey Kotlarski <m00naticus@gmail.com>
Fix spaces and indent.
---
vlfi.el | 278 ++++++++++++++++++++++++++++++++--------------------------------
1 file changed, 139 insertions(+), 139 deletions(-)
diff --git a/vlfi.el b/vlfi.el
index 2945039..703fde1 100644
--- a/vlfi.el
+++ b/vlfi.el
@@ -58,8 +58,8 @@
(define-key map "+" 'vlfi-change-batch-size)
(define-key map "-"
(lambda () "Decrease vlfi batch size by factor of 2."
- (interactive)
- (vlfi-change-batch-size t)))
+ (interactive)
+ (vlfi-change-batch-size t)))
(define-key map "s" 'vlfi-re-search-forward)
(define-key map "r" 'vlfi-re-search-backward)
(define-key map "[" 'vlfi-beginning-of-file)
@@ -92,18 +92,18 @@ with the prefix argument DECREASE it is halved."
(or (assq 'vlfi-batch-size (buffer-local-variables))
(error "%s is not local in this buffer" 'vlfi-batch-size))
(setq vlfi-batch-size (if decrease
- (/ vlfi-batch-size 2)
- (* vlfi-batch-size 2)))
+ (/ vlfi-batch-size 2)
+ (* vlfi-batch-size 2)))
(vlfi-move-to-batch vlfi-start-pos))
(defun vlfi-format-buffer-name ()
"Return format for vlfi buffer name."
(format "%s(%s)[%d/%d](%d)"
- (file-name-nondirectory buffer-file-name)
- (file-size-human-readable vlfi-file-size)
- (/ vlfi-end-pos vlfi-batch-size)
- (/ vlfi-file-size vlfi-batch-size)
- vlfi-batch-size))
+ (file-name-nondirectory buffer-file-name)
+ (file-size-human-readable vlfi-file-size)
+ (/ vlfi-end-pos vlfi-batch-size)
+ (/ vlfi-file-size vlfi-batch-size)
+ vlfi-batch-size))
(defun vlfi-update-buffer-name ()
"Update the current buffer name."
@@ -117,24 +117,24 @@ When prefix argument is negative
append next APPEND number of batches to the existing buffer."
(interactive "p")
(let ((end (+ vlfi-end-pos (* vlfi-batch-size
- (abs append)))))
+ (abs append)))))
(when (< vlfi-file-size end) ; re-check file size
(setq vlfi-file-size (nth 7 (file-attributes buffer-file-name)))
(cond ((= vlfi-end-pos vlfi-file-size)
- (error "Already at EOF"))
- ((< vlfi-file-size end)
- (setq end vlfi-file-size))))
+ (error "Already at EOF"))
+ ((< vlfi-file-size end)
+ (setq end vlfi-file-size))))
(let ((inhibit-read-only t)
- (do-append (< append 0))
- (pos (point)))
+ (do-append (< append 0))
+ (pos (point)))
(if do-append
- (goto-char (point-max))
- (setq vlfi-start-pos (- end vlfi-batch-size))
- (erase-buffer))
+ (goto-char (point-max))
+ (setq vlfi-start-pos (- end vlfi-batch-size))
+ (erase-buffer))
(insert-file-contents buffer-file-name nil (if do-append
- vlfi-end-pos
- vlfi-start-pos)
- end)
+ vlfi-end-pos
+ vlfi-start-pos)
+ end)
(goto-char pos))
(setq vlfi-end-pos end))
(set-visited-file-modtime)
@@ -151,18 +151,18 @@ When prefix argument is negative
(if (zerop vlfi-start-pos)
(error "Already at BOF"))
(let ((inhibit-read-only t)
- (start (max 0 (- vlfi-start-pos (* vlfi-batch-size
- (abs prepend)))))
- (do-prepend (< prepend 0))
- (pos (- (point-max) (point))))
+ (start (max 0 (- vlfi-start-pos (* vlfi-batch-size
+ (abs prepend)))))
+ (do-prepend (< prepend 0))
+ (pos (- (point-max) (point))))
(if do-prepend
- (goto-char (point-min))
+ (goto-char (point-min))
(setq vlfi-end-pos (+ start vlfi-batch-size))
(erase-buffer))
(insert-file-contents buffer-file-name nil start
- (if do-prepend
- vlfi-start-pos
- vlfi-end-pos))
+ (if do-prepend
+ vlfi-start-pos
+ vlfi-end-pos))
(goto-char (- (point-max) pos))
(setq vlfi-start-pos start))
(set-visited-file-modtime)
@@ -173,17 +173,17 @@ When prefix argument is negative
"Move to batch determined by START.
Adjust according to file start/end and show `vlfi-batch-size' bytes."
(setq vlfi-start-pos (max 0 start)
- vlfi-end-pos (+ vlfi-start-pos vlfi-batch-size))
+ vlfi-end-pos (+ vlfi-start-pos vlfi-batch-size))
(if (< vlfi-file-size vlfi-end-pos) ; re-check file size
(setq vlfi-file-size
- (nth 7 (file-attributes buffer-file-name))
- vlfi-end-pos (min vlfi-end-pos vlfi-file-size)
- vlfi-start-pos (max 0 (- vlfi-end-pos vlfi-batch-size))))
+ (nth 7 (file-attributes buffer-file-name))
+ vlfi-end-pos (min vlfi-end-pos vlfi-file-size)
+ vlfi-start-pos (max 0 (- vlfi-end-pos vlfi-batch-size))))
(let ((inhibit-read-only t)
- (pos (point)))
+ (pos (point)))
(erase-buffer)
(insert-file-contents buffer-file-name nil
- vlfi-start-pos vlfi-end-pos)
+ vlfi-start-pos vlfi-end-pos)
(goto-char pos))
(set-visited-file-modtime)
(set-buffer-modified-p nil)
@@ -193,14 +193,14 @@ Adjust according to file start/end and show
`vlfi-batch-size' bytes."
"Move to chunk determined by START END."
(if (< vlfi-file-size end) ; re-check file size
(setq vlfi-file-size (nth 7
- (file-attributes buffer-file-name))))
+ (file-attributes buffer-file-name))))
(setq vlfi-start-pos (max 0 start)
- vlfi-end-pos (min end vlfi-file-size))
+ vlfi-end-pos (min end vlfi-file-size))
(let ((inhibit-read-only t)
- (pos (point)))
+ (pos (point)))
(erase-buffer)
(insert-file-contents buffer-file-name nil
- vlfi-start-pos vlfi-end-pos)
+ vlfi-start-pos vlfi-end-pos)
(goto-char pos))
(set-visited-file-modtime)
(set-buffer-modified-p nil)
@@ -211,9 +211,9 @@ Adjust according to file start/end and show
`vlfi-batch-size' bytes."
With FROM-END prefix, start from the back."
(if from-end
(setq vlfi-start-pos (max 0 (- vlfi-file-size vlfi-batch-size))
- vlfi-end-pos vlfi-file-size)
+ vlfi-end-pos vlfi-file-size)
(setq vlfi-start-pos 0
- vlfi-end-pos (min vlfi-batch-size vlfi-file-size)))
+ vlfi-end-pos (min vlfi-batch-size vlfi-file-size)))
(vlfi-move-to-chunk vlfi-start-pos vlfi-end-pos))
(defun vlfi-beginning-of-file ()
@@ -235,7 +235,7 @@ buffer. You can customize number of bytes displayed by
customizing
(interactive "fFile to open: \nP")
(with-current-buffer (generate-new-buffer "*vlfi*")
(setq buffer-file-name file
- vlfi-file-size (nth 7 (file-attributes file)))
+ vlfi-file-size (nth 7 (file-attributes file)))
(vlfi-insert-file from-end)
(vlfi-mode)
(switch-to-buffer (current-buffer))))
@@ -264,25 +264,25 @@ OP-TYPE specifies the file operation being performed over
FILENAME."
(and large-file-warning-threshold size
(> size large-file-warning-threshold)
(let ((char nil))
- (while (not (memq (setq char
- (read-event
- (propertize
- (format
- "File %s is large (%s): \
+ (while (not (memq (setq char
+ (read-event
+ (propertize
+ (format
+ "File %s is large (%s): \
%s normally (o), %s with vlfi (v) or abort (a)"
- (if filename
- (file-name-nondirectory filename)
- "")
- (file-size-human-readable size)
- op-type op-type)
- 'face 'minibuffer-prompt)))
- '(?o ?O ?v ?V ?a ?A))))
- (cond ((memq char '(?o ?O)))
- ((memq char '(?v ?V))
- (vlfi filename nil)
- (error ""))
- ((memq char '(?a ?A))
- (error "Aborted"))))))
+ (if filename
+ (file-name-nondirectory filename)
+ "")
+ (file-size-human-readable size)
+ op-type op-type)
+ 'face 'minibuffer-prompt)))
+ '(?o ?O ?v ?V ?a ?A))))
+ (cond ((memq char '(?o ?O)))
+ ((memq char '(?v ?V))
+ (vlfi filename nil)
+ (error ""))
+ ((memq char '(?a ?A))
+ (error "Aborted"))))))
;;; hijack `abort-if-file-too-large'
;;;###autoload
@@ -292,66 +292,66 @@ OP-TYPE specifies the file operation being performed over
FILENAME."
(defun vlfi-re-search (regexp count backward)
"Search for REGEXP COUNT number of times forward or BACKWARD."
(let* ((match-start-pos (+ vlfi-start-pos (point)))
- (match-end-pos match-start-pos)
- (to-find count)
- (search-reporter (make-progress-reporter
- (concat "Searching for " regexp)
- (if backward
- (- vlfi-file-size vlfi-end-pos)
- vlfi-start-pos)
- vlfi-file-size))
- (batch-step (/ vlfi-batch-size 8))) ; amount of chunk overlap
+ (match-end-pos match-start-pos)
+ (to-find count)
+ (search-reporter (make-progress-reporter
+ (concat "Searching for " regexp)
+ (if backward
+ (- vlfi-file-size vlfi-end-pos)
+ vlfi-start-pos)
+ vlfi-file-size))
+ (batch-step (/ vlfi-batch-size 8))) ; amount of chunk overlap
(unwind-protect
- (catch 'end-of-file
- (if backward
- (while (not (zerop to-find))
- (cond ((re-search-backward regexp nil t)
- (setq to-find (1- to-find)
- match-start-pos (+ vlfi-start-pos
- (match-beginning 0))
- match-end-pos (+ vlfi-start-pos
- (match-end 0))))
- ((zerop vlfi-start-pos)
- (throw 'end-of-file nil))
- (t (let ((batch-move (- vlfi-start-pos
- (- vlfi-batch-size
- batch-step))))
- (vlfi-move-to-batch
- (if (< match-start-pos batch-move)
- (- match-start-pos vlfi-batch-size)
- batch-move)))
- (goto-char (if (< match-start-pos
- vlfi-end-pos)
- (- match-start-pos
- vlfi-start-pos)
- (point-max)))
- (progress-reporter-update search-reporter
- vlfi-start-pos))))
- (while (not (zerop to-find))
- (cond ((re-search-forward regexp nil t)
- (setq to-find (1- to-find)
- match-start-pos (+ vlfi-start-pos
- (match-beginning 0))
- match-end-pos (+ vlfi-start-pos
- (match-end 0))))
- ((= vlfi-end-pos vlfi-file-size)
- (throw 'end-of-file nil))
- (t (let ((batch-move (- vlfi-end-pos batch-step)))
- (vlfi-move-to-batch
- (if (< batch-move match-end-pos)
- match-end-pos
- batch-move)))
- (goto-char (if (< vlfi-start-pos match-end-pos)
- (- match-end-pos vlfi-start-pos)
- (point-min)))
- (progress-reporter-update search-reporter
- vlfi-end-pos)))))
- (progress-reporter-done search-reporter))
+ (catch 'end-of-file
+ (if backward
+ (while (not (zerop to-find))
+ (cond ((re-search-backward regexp nil t)
+ (setq to-find (1- to-find)
+ match-start-pos (+ vlfi-start-pos
+ (match-beginning 0))
+ match-end-pos (+ vlfi-start-pos
+ (match-end 0))))
+ ((zerop vlfi-start-pos)
+ (throw 'end-of-file nil))
+ (t (let ((batch-move (- vlfi-start-pos
+ (- vlfi-batch-size
+ batch-step))))
+ (vlfi-move-to-batch
+ (if (< match-start-pos batch-move)
+ (- match-start-pos vlfi-batch-size)
+ batch-move)))
+ (goto-char (if (< match-start-pos
+ vlfi-end-pos)
+ (- match-start-pos
+ vlfi-start-pos)
+ (point-max)))
+ (progress-reporter-update search-reporter
+ vlfi-start-pos))))
+ (while (not (zerop to-find))
+ (cond ((re-search-forward regexp nil t)
+ (setq to-find (1- to-find)
+ match-start-pos (+ vlfi-start-pos
+ (match-beginning 0))
+ match-end-pos (+ vlfi-start-pos
+ (match-end 0))))
+ ((= vlfi-end-pos vlfi-file-size)
+ (throw 'end-of-file nil))
+ (t (let ((batch-move (- vlfi-end-pos batch-step)))
+ (vlfi-move-to-batch
+ (if (< batch-move match-end-pos)
+ match-end-pos
+ batch-move)))
+ (goto-char (if (< vlfi-start-pos match-end-pos)
+ (- match-end-pos vlfi-start-pos)
+ (point-min)))
+ (progress-reporter-update search-reporter
+ vlfi-end-pos)))))
+ (progress-reporter-done search-reporter))
(if backward
- (vlfi-goto-match match-end-pos match-start-pos
- count to-find)
- (vlfi-goto-match match-start-pos match-end-pos
- count to-find)))))
+ (vlfi-goto-match match-end-pos match-start-pos
+ count to-find)
+ (vlfi-goto-match match-start-pos match-end-pos
+ count to-find)))))
(defun vlfi-goto-match (match-pos-start match-pos-end count to-find)
"Move to chunk surrounding MATCH-POS-START and MATCH-POS-END.
@@ -359,41 +359,41 @@ According to COUNT and left TO-FIND, show if search has
been
successful. Return nil if nothing found."
(let ((success (zerop to-find)))
(or success
- (vlfi-move-to-batch (- match-pos-start
- (/ vlfi-batch-size 2))))
+ (vlfi-move-to-batch (- match-pos-start
+ (/ vlfi-batch-size 2))))
(let* ((match-end (- match-pos-end vlfi-start-pos))
- (overlay (make-overlay (- match-pos-start vlfi-start-pos)
- match-end)))
+ (overlay (make-overlay (- match-pos-start vlfi-start-pos)
+ match-end)))
(overlay-put overlay 'face 'region)
(or success (goto-char match-end))
(prog1 (cond (success t)
- ((< to-find count)
- (message "Moved to the %d match which is last"
- (- count to-find))
- t)
- (t (message "Not found")
- nil))
- (sit-for 0.1)
- (delete-overlay overlay)))))
+ ((< to-find count)
+ (message "Moved to the %d match which is last"
+ (- count to-find))
+ t)
+ (t (message "Not found")
+ nil))
+ (sit-for 0.1)
+ (delete-overlay overlay)))))
(defun vlfi-re-search-forward (regexp count)
"Search forward for REGEXP prefix COUNT number of times.
Search is performed chunk by chunk in `vlfi-batch-size' memory."
(interactive (list (read-regexp "Search whole file"
- (if regexp-history
- (car regexp-history))
- 'regexp-history)
- (or current-prefix-arg 1)))
+ (if regexp-history
+ (car regexp-history))
+ 'regexp-history)
+ (or current-prefix-arg 1)))
(vlfi-re-search regexp count nil))
(defun vlfi-re-search-backward (regexp count)
"Search backward for REGEXP prefix COUNT number of times.
Search is performed chunk by chunk in `vlfi-batch-size' memory."
(interactive (list (read-regexp "Search whole file backward"
- (if regexp-history
- (car regexp-history))
- 'regexp-history)
- (or current-prefix-arg 1)))
+ (if regexp-history
+ (car regexp-history))
+ 'regexp-history)
+ (or current-prefix-arg 1)))
(vlfi-re-search regexp count t))
;;; editing
@@ -410,7 +410,7 @@ Search is performed chunk by chunk in `vlfi-batch-size'
memory."
(setq buffer-read-only nil)
(buffer-enable-undo)
(message (substitute-command-keys
- "Editing: Type \\[vlfi-write] to write chunk \
+ "Editing: Type \\[vlfi-write] to write chunk \
or \\[vlfi-discard-edit] to discard changes.")))
(defun vlfi-file-shift-back (size-change)
- [elpa] externals/vlf 8a33dbf 036/310: Add something like edit minor mode., (continued)
- [elpa] externals/vlf 8a33dbf 036/310: Add something like edit minor mode., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 56134a8 050/310: Make vlfi usable under GNU Emacs 23., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 24675d8 054/310: Manage modification times when attempting to save., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c4f87f9 048/310: Move save interception to vlfi-mode., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf c14c7f0 058/310: Add shift forward of file contents when edited chunk grows in size., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf e115e7e 053/310: Add custom revert function., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2edbb6b 004/310: Add vlf as an option when opening large files., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 80ca6b6 037/310: Fix vlfi invocation when prompted for large files., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 03f3233 039/310: Don't reinsert content and move on successful search., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 2525ebf 049/310: Improvements to file saving., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf cedd0b4 059/310: Fix spaces and indent.,
Stefan Monnier <=
- [elpa] externals/vlf 6ea7a2a 065/310: Add macro for file size determination., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 91fecb7 023/310: Simplify key-bindings., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8e65e13 029/310: Refactor and simplify search procedures. Always use batch sized, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf db3d2af 043/310: Update version, README and commentary section., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 467154a 047/310: Add documentation., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf a3c405f 051/310: Make detection of buffer size change on save more correct when dealing, Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 7985f0f 052/310: Fix `vlfi-if-file-too-large' to be more tolerable on GNU Emacs 23., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 8637ce5 062/310: Update README and version., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 4cbefde 067/310: Optimize chunk save buffers for multiple insert/erase operations., Stefan Monnier, 2020/11/28
- [elpa] externals/vlf 473536e 073/310: Add adjust command for cases where chunk starts with part of multibyte symbol., Stefan Monnier, 2020/11/28