diff options
| author | Lars Ingebrigtsen | 2019-07-09 18:24:26 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-09 18:45:18 +0200 |
| commit | 547800dade11a1517c0f9a3007baf9df1bceeb5f (patch) | |
| tree | 9a3d5019be0f1598d76a4266c170a7275c5b4ae2 | |
| parent | 29fc4622631b8269b9a0f16dc2f9f2c16a138a4f (diff) | |
| download | emacs-547800dade11a1517c0f9a3007baf9df1bceeb5f.tar.gz emacs-547800dade11a1517c0f9a3007baf9df1bceeb5f.zip | |
Checkdoc would bug out on empty files
* lisp/emacs-lisp/checkdoc.el (checkdoc--next-docstring): Don't
bug out on malformed Emacs Lisp (bug#34760).
(checkdoc-file-comments-engine): Don't bug out on empty buffers.
| -rw-r--r-- | lisp/emacs-lisp/checkdoc.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el index 3e3246352a2..830743f5f89 100644 --- a/lisp/emacs-lisp/checkdoc.el +++ b/lisp/emacs-lisp/checkdoc.el | |||
| @@ -929,7 +929,10 @@ don't move point." | |||
| 929 | (pcase (save-excursion (condition-case nil | 929 | (pcase (save-excursion (condition-case nil |
| 930 | (read (current-buffer)) | 930 | (read (current-buffer)) |
| 931 | ;; Conservatively skip syntax errors. | 931 | ;; Conservatively skip syntax errors. |
| 932 | (invalid-read-syntax))) | 932 | (invalid-read-syntax) |
| 933 | ;; Don't bug out if the file is empty (or a | ||
| 934 | ;; definition ends prematurely. | ||
| 935 | (end-of-file))) | ||
| 933 | (`(,(or 'defun 'defvar 'defcustom 'defmacro 'defconst 'defsubst 'defadvice) | 936 | (`(,(or 'defun 'defvar 'defcustom 'defmacro 'defconst 'defsubst 'defadvice) |
| 934 | ,(pred symbolp) | 937 | ,(pred symbolp) |
| 935 | ;; Require an initializer, i.e. ignore single-argument `defvar' | 938 | ;; Require an initializer, i.e. ignore single-argument `defvar' |
| @@ -2250,7 +2253,10 @@ Code:, and others referenced in the style guide." | |||
| 2250 | (re-search-forward "^(require" nil t) | 2253 | (re-search-forward "^(require" nil t) |
| 2251 | (re-search-forward "^(" nil t)) | 2254 | (re-search-forward "^(" nil t)) |
| 2252 | (beginning-of-line)) | 2255 | (beginning-of-line)) |
| 2253 | (t (re-search-forward ";;; .* --- .*\n"))) | 2256 | ((not (re-search-forward ";;; .* --- .*\n" nil t)) |
| 2257 | (checkdoc-create-error | ||
| 2258 | "You should have a summary line (\";;; .* --- .*\")" | ||
| 2259 | nil nil t))) | ||
| 2254 | (if (checkdoc-y-or-n-p | 2260 | (if (checkdoc-y-or-n-p |
| 2255 | "You should have a \";;; Commentary:\", add one? ") | 2261 | "You should have a \";;; Commentary:\", add one? ") |
| 2256 | (insert "\n;;; Commentary:\n;; \n\n") | 2262 | (insert "\n;;; Commentary:\n;; \n\n") |