emacs: inline notmuch-sexp-eof into only caller

This function had a few issues.
- Neither its name nor the old comment before it is called made it
  clear what it does.
- It took one argument but didn't do anything with it.
- It's doc-string made a few claims, which are untrue and generally
  focused on details instead of that its purpose is.
This commit is contained in:
Jonas Bernoulli 2021-01-10 15:00:50 +01:00 committed by David Bremner
parent 9be8c6802f
commit 93c95802a4

View file

@ -140,15 +140,6 @@ beginning of a list, throw invalid-read-syntax."
(forward-char) (forward-char)
(signal 'invalid-read-syntax (list (string (char-before))))))) (signal 'invalid-read-syntax (list (string (char-before)))))))
(defun notmuch-sexp-eof (sp)
"Signal an error if there is more data in SP's buffer.
Moves point to the beginning of any trailing data or to the end
of the buffer if there is only trailing whitespace."
(skip-chars-forward " \n\r\t")
(unless (eobp)
(error "Trailing garbage following expression")))
(defvar notmuch-sexp--parser nil (defvar notmuch-sexp--parser nil
"The buffer-local notmuch-sexp-parser instance. "The buffer-local notmuch-sexp-parser instance.
@ -187,8 +178,11 @@ move point in the input buffer."
(t (with-current-buffer result-buffer (t (with-current-buffer result-buffer
(funcall result-function result)))))) (funcall result-function result))))))
(end (end
;; Any trailing data is unexpected ;; Skip over trailing whitespace.
(notmuch-sexp-eof notmuch-sexp--parser) (skip-chars-forward " \n\r\t")
;; Any trailing data is unexpected.
(unless (eobp)
(error "Trailing garbage following expression"))
(setq done t))))) (setq done t)))))
;; Clear out what we've parsed ;; Clear out what we've parsed
(delete-region (point-min) (point))) (delete-region (point-min) (point)))