]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix reading the tail of a file in shorthands.el
authorEli Zaretskii <eliz@gnu.org>
Sun, 3 Oct 2021 11:34:08 +0000 (14:34 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sun, 3 Oct 2021 11:34:08 +0000 (14:34 +0300)
* lisp/shorthands.el (hack-elisp-shorthands): Fix reading past
3000-character limit from EOF.  (Bug#50946)

lisp/shorthands.el

index b8204d62a2e7267a0d5e30fa00be3e21c704f1db..6162efd6095a37c07b00aebf35b84b46ca45473f 100644 (file)
@@ -40,7 +40,10 @@ except for extraction of the buffer-local value of
     (with-temp-buffer
       (while (and (< (buffer-size) 3000) (>= from 0))
         (insert-file-contents fullname nil from to)
-        (setq to from from (- from 100)))
+        (setq to from
+              from (cond
+                    ((= from 0) -1)
+                    (t (max 0 (- from 100))))))
       ;; FIXME: relies on the `hack-local-variables--find-variables'
       ;; detail of files.el.  That function should be exported,
       ;; possibly be refactored into two parts, since we're only