emacs-elpa-diffs
[Top][All Lists]
Advanced

[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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]