branch: externals/csv-mode
commit 0e9a5ac6b37a1e661c142a9586603874429053ac
Author: Stefan Monnier <monn...@iro.umontreal.ca>
Commit: Stefan Monnier <monn...@iro.umontreal.ca>

    csv-mode.el: Cosmetic changes
    
    * csv-mode.el (csv-guess-set-separator): Obey `point-min`.
    (csv--separator-candidates): Consolidate two `=` into a `memq`; hoist
    three `not`s out of an `and`; Strength-reduce `member` to `memq`.
    (csv--separator-score): Use `eobp`.
---
 csv-mode.el | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/csv-mode.el b/csv-mode.el
index b29019f6be..3dc6ddd9d5 100644
--- a/csv-mode.el
+++ b/csv-mode.el
@@ -1879,7 +1879,7 @@ separator automatically when visiting a buffer:
                ;; or so chars, but take more than we probably need to
                ;; minimize the chance of breaking the input in the
                ;; middle of a (long) row.
-               (min 8192 (point-max)))
+               (min (+ 8192 (point-min)) (point-max)))
               2048)))
     (when sep
       (csv-set-separator sep))))
@@ -1907,12 +1907,11 @@ When CUTOFF is passed, look only at the first CUTOFF 
number of characters."
                     (substring text 0 (min cutoff (length text)))
                   text)))
       (when (and (not (gethash c chars))
-                 (or (= c ?\t)
-                     (= c ?\C-_)
-                     (and (not (member c '(?. ?/ ?\" ?')))
-                          (not (= c (string-to-char csv-comment-start)))
-                          (not (member (get-char-code-property c 
'general-category)
-                                       '(Lu Ll Lt Lm Lo Nd Nl No Ps Pe Cc 
Co))))))
+                 (or (memq c '(?\t ?\C-_))
+                     (not (or (memq c '(?. ?/ ?\" ?'))
+                              (= c (string-to-char csv-comment-start))
+                              (memq (get-char-code-property c 
'general-category)
+                                    '(Lu Ll Lt Lm Lo Nd Nl No Ps Pe Cc Co))))))
         (puthash c t chars)))
     (hash-table-keys chars)))
 
@@ -1937,7 +1936,7 @@ Nazábal, and Charles Sutton: 
https://arxiv.org/abs/1811.11242.";
              (insert text))
            (let ((groups (make-hash-table))
                  (chars-read 0))
-             (while (and (/= (point) (point-max))
+             (while (and (not (eobp))
                          (or (not cutoff)
                              (< chars-read cutoff)))
                (let* ((lep (line-end-position))

Reply via email to