emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 990c062: Make edit-abbrevs parsing less brittle


From: Lars Ingebrigtsen
Subject: master 990c062: Make edit-abbrevs parsing less brittle
Date: Tue, 27 Oct 2020 07:19:47 -0400 (EDT)

branch: master
commit 990c0620cb9fee3f4779468662d8447c2b301156
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make edit-abbrevs parsing less brittle
    
    * lisp/abbrev.el (define-abbrevs): Make the parsing less brittle
    -- allow more blank lines (bug#42611).
---
 lisp/abbrev.el | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index dc52a22..f35c637 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -189,17 +189,21 @@ the ones defined from the buffer now."
             (table (read buf))
             abbrevs name hook exp count sys)
        (forward-line 1)
-       (while (progn (forward-line 1)
-                     (not (eolp)))
-         (setq name (read buf) count (read buf))
-         (if (equal count '(sys))
-             (setq sys t count (read buf))
-           (setq sys nil))
-         (setq exp (read buf))
-         (skip-chars-backward " \t\n\f")
-         (setq hook (if (not (eolp)) (read buf)))
-         (skip-chars-backward " \t\n\f")
-         (setq abbrevs (cons (list name exp hook count sys) abbrevs)))
+       (while (and (not (eobp))
+                    ;; Advance as long as we're looking at blank lines
+                    ;; or we have an abbrev.
+                    (looking-at "[ \t\n]\\|\\(\"\\)"))
+          (when (match-string 1)
+           (setq name (read buf) count (read buf))
+           (if (equal count '(sys))
+               (setq sys t count (read buf))
+             (setq sys nil))
+           (setq exp (read buf))
+           (skip-chars-backward " \t\n\f")
+           (setq hook (if (not (eolp)) (read buf)))
+           (skip-chars-backward " \t\n\f")
+           (setq abbrevs (cons (list name exp hook count sys) abbrevs)))
+          (forward-line 1))
        (define-abbrev-table table abbrevs)))))
 
 (defun read-abbrev-file (&optional file quietly)



reply via email to

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