Subject: Re: 23.1.50; checkdoc allow uncapitalized info node links

From: Kevin Ryde <[email-masked]>
Date: Sun, 25 Oct 2009 10:38:26 +1100

reopen 3921
thanks

Chong Yidong <[email-masked]> writes:
>
> I checked in a slightly different fix.

Reopening as I believe the looking-back limit prevents line-wrapped
links working, like the foo.el below.

But why not help-xref-info-regexp?  Less code, no duplication of
patterns.  For a lisp tool there's no need to hold back on what
libraries are loaded -- in fact letting someone else do the work is a
very good thing! :-)

(The worst duplication I struck lately was a while ago in info.el when
digging around some node names.  I recall unlovely duplication of
patterns, making life hard if looking to tighten or loosen.)

I thought of the URL links only afterwards, and didn't do anything about
it.  help-xref-url-regexp would again seem good as an authoritative
pattern.

--- checkdoc.el.~1.78.~	2009-10-25 08:57:10.000000000 +1100
+++ checkdoc.el	2009-10-25 10:05:53.000000000 +1100
@@ -173,6 +173,9 @@
 (defvar checkdoc-version "0.6.1"
   "Release version of checkdoc you are currently running.")
 
+(require 'help-mode) ;; for help-xref-info-regexp
+(require 'thingatpt) ;; for handy thing-at-point-looking-at
+
 (defvar compilation-error-regexp-alist)
 (defvar compilation-mode-font-lock-keywords)
 
@@ -2017,11 +2020,11 @@
 			 (not (and (= ?/ (char-after e))
 				   (= ?/ (char-before b))))
 			 (not (checkdoc-in-example-string-p begin end))
-			 ;; info node
-			 (not (save-excursion
-				(goto-char b)
-				(looking-back "\\<[Ii]nfo[ \t\n]+\\(node\\|anchor\\)[ \t\n]+`("
-					      (line-beginning-position)))))
+			 ;; info or url links left alone
+ 			 (not (thing-at-point-looking-at
+ 			       help-xref-info-regexp))
+			 (not (thing-at-point-looking-at
+ 			       help-xref-url-regexp)))
 		    (if (checkdoc-autofix-ask-replace
 			 b e (format "Text %s should be capitalized.  Fix? "
 				     text)