@@ 2,7 2,7 @@
;;;
;;;; Hacking perl mode.
;;;
-;;; Copyright (C) 1996-2011 Robert G. Rogers Jr
+;;; Copyright (C) 1996-2024 Robert G. Rogers Jr
;;;
;;; This file is not part of GNU Emacs, but it customizes perl-mode, which is.
;;; Accordingly, it is distributed under the same terms as GNU Emacs:
@@ 633,11 633,20 @@ and too impatient to wait. -- rgr, 1-Jul-13.]")
;; defined-names. -- rgr, 12-Nov-19.]
(not (eobp)))
(let* ((name (car tail))
- (name-regexp (format "\n=head3 %s\n" name)))
- (while (and (looking-at "\n=head3 \\(.+\\)\n")
- (string-lessp (match-string 1) name))
- (let ((new-name (match-string-no-properties 1)))
- (unless (or (= (aref new-name 0) ?_)
+ (name-regexp (format "\n=head3 %s\n" name))
+ (level 0))
+ (while (and (looking-at "\n=head\\([0-9]\\) \\(.+\\)\n")
+ (setq level (string-to-int (match-string 1)))
+ ;; Keep going past subheadings, or if we're
+ ;; alphabetically before the name of interest.
+ ;; (We don't worry about documented names that
+ ;; aren't defined in the code; they may be for API
+ ;; methods that have no default implementation.)
+ (or (> level 3)
+ (string-lessp (match-string 2) name)))
+ (let ((new-name (match-string-no-properties 2)))
+ (unless (or (> level 3)
+ (= (aref new-name 0) ?_)
(member (intern new-name)
rgr-perl-sub-names-to-ignore))
(message "%s is no longer implemented, %s"