]> git.eshelyaron.com Git - emacs.git/commitdiff
(checkdoc-file-comments-engine): When
authorKevin Ryde <user42@zip.com.au>
Wed, 21 Oct 2009 22:05:34 +0000 (22:05 +0000)
committerKevin Ryde <user42@zip.com.au>
Wed, 21 Oct 2009 22:05:34 +0000 (22:05 +0000)
inserting ";;; Code" put it before any ";;;###autoload" cookie on
the first form.  And insert a blank line after ";;; Code" since
that's usual style.  (My Bug#4612.)

lisp/emacs-lisp/checkdoc.el

index 226ee17ce518e09f9241d01bc5ddf89136cbcc83..0d63ed79d0a71cf70d7d23296731be3b42199b6c 100644 (file)
@@ -2307,15 +2307,24 @@ Code:, and others referenced in the style guide."
        (or
        ;; * Code section
        (if (not (lm-code-mark))
-           (let ((cont t))
+           (let ((cont t)
+                 pos)
              (goto-char (point-min))
-             (while (and cont (re-search-forward "^(" nil t))
-               (setq cont (looking-at "require\\s-+")))
+             ;; match ";;;###autoload" cookie to keep it with the form
+             (require 'autoload)
+             (while (and cont (re-search-forward
+                               (concat "^\\("
+                                       (regexp-quote generate-autoload-cookie)
+                                       "\n\\)?"
+                                       "(")
+                               nil t))
+               (setq pos (match-beginning 0)
+                     cont (looking-at "require\\s-+")))
              (if (and (not cont)
                       (checkdoc-y-or-n-p
                        "There is no ;;; Code: marker.  Insert one? "))
-                 (progn (beginning-of-line)
-                        (insert ";;; Code:\n")
+                 (progn (goto-char pos)
+                        (insert ";;; Code:\n\n")
                         nil)
                (checkdoc-create-error
                 "You should have a section marked \";;; Code:\""