1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

Make edit-abbrevs parsing less brittle

* lisp/abbrev.el (define-abbrevs): Make the parsing less brittle
-- allow more blank lines (bug#42611).
This commit is contained in:
Lars Ingebrigtsen 2020-10-27 12:18:27 +01:00
parent 281524943f
commit 990c0620cb

View File

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