From: Philipp Stephani <p.stephani2@gmail.com>
To: 24998@debbugs.gnu.org
Subject: bug#24998: 25.1.50; Checkdoc ignores functions if there is no space before the argument list
Date: Wed, 23 Nov 2016 19:35:52 +0000 [thread overview]
Message-ID: <CAArVCkTYtV6CYb-7vMGLqUjDnZ1xQFqTx56XT3r0-cqeFXtPCg@mail.gmail.com> (raw)
In-Reply-To: <wvr44m2y4ib6.fsf@a.muc.corp.google.com>
[-- Attachment #1.1: Type: text/plain, Size: 459 bytes --]
Philipp Stephani <p.stephani2@gmail.com> schrieb am Mi., 23. Nov. 2016 um
11:11 Uhr:
>
> Create a small Elisp file such as (a.el):
>
> ;;; a.el --- aaa -*- lexical-binding: t; -*-
>
> ;;; Commentary:
>
> ;;; Code:
>
> (defun a--bar () 123)
>
> ;;; a.el ends here
>
> Run M-x checkdoc. It will complain about the missing docstring for
> `a--bar'.
>
> Now remove the space before () and run checkdoc again. It won't
> complain any more.
>
Attached a patch.
[-- Attachment #1.2: Type: text/html, Size: 1125 bytes --]
[-- Attachment #2: 0001-Checkdoc-Don-t-require-a-space-before-an-arg-list.txt --]
[-- Type: text/plain, Size: 2658 bytes --]
From 0a963d8e9053670c6f93803dc229adeb2d174081 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Wed, 23 Nov 2016 20:29:36 +0100
Subject: [PATCH] Checkdoc: Don't require a space before an arg list
See Bug#24998.
* lisp/emacs-lisp/checkdoc.el (checkdoc-defun-regexp): Don't require a
space before a argument list.
* test/lisp/emacs-lisp/checkdoc-tests.el (checkdoc-tests--bug-24998):
Add unit test.
---
lisp/emacs-lisp/checkdoc.el | 2 +-
test/lisp/emacs-lisp/checkdoc-tests.el | 40 ++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 1 deletion(-)
create mode 100644 test/lisp/emacs-lisp/checkdoc-tests.el
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 769c2fe..2c8bc02 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -296,7 +296,7 @@ checkdoc-diagnostic-buffer
(defvar checkdoc-defun-regexp
"^(def\\(un\\|var\\|custom\\|macro\\|const\\|subst\\|advice\\)\
-\\s-+\\(\\(\\sw\\|\\s_\\)+\\)[ \t\n]+"
+\\s-+\\(\\(\\sw\\|\\s_\\)+\\)[ \t\n]*"
"Regular expression used to identify a defun.
A search leaves the cursor in front of the parameter list.")
diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el b/test/lisp/emacs-lisp/checkdoc-tests.el
new file mode 100644
index 0000000..18b5a49
--- /dev/null
+++ b/test/lisp/emacs-lisp/checkdoc-tests.el
@@ -0,0 +1,40 @@
+;;; checkdoc-tests.el --- unit tests for checkdoc.el -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Google Inc.
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Unit tests for lisp/emacs-lisp/checkdoc.el.
+
+;;; Code:
+
+(require 'checkdoc)
+
+(require 'elisp-mode)
+(require 'ert)
+
+(ert-deftest checkdoc-tests--bug-24998 ()
+ "Checks that Bug#24998 is fixed."
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (insert "(defun foo())")
+ (should-error (checkdoc-defun) :type 'user-error)))
+
+;;; checkdoc-tests.el ends here
--
2.8.0.rc3.226.g39d4020
next prev parent reply other threads:[~2016-11-23 19:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-23 10:11 bug#24998: 25.1.50; Checkdoc ignores functions if there is no space before the argument list Philipp Stephani
2016-11-23 19:35 ` Philipp Stephani [this message]
2016-12-02 9:02 ` Eli Zaretskii
2016-12-26 20:17 ` Philipp Stephani
2016-12-29 4:28 ` bug#24998: Commit 'b5b997b95...' (Checkdoc: Don't require a space before an arg list) breaks defvar Vladimir Lomov
2016-12-29 6:42 ` Vladimir Lomov
2016-12-30 17:04 ` Philipp Stephani
2016-12-31 0:43 ` Vladimir Lomov
2016-12-31 16:35 ` Philipp Stephani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAArVCkTYtV6CYb-7vMGLqUjDnZ1xQFqTx56XT3r0-cqeFXtPCg@mail.gmail.com \
--to=p.stephani2@gmail.com \
--cc=24998@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).