From: Harald Jörg Date: Mon, 30 Oct 2023 16:19:42 +0000 (+0100) Subject: ; cperl-mode.el: Obey comment conventions X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=31acbcd405c5bfb3a2d2b1bcde54fbf0d3fe8901;p=emacs.git ; cperl-mode.el: Obey comment conventions * lisp/progmodes/cperl-mode.el: Use ;;; only for "chapter headings". Eliminate some redundant and misleading comments. Fix an over-wide line. --- diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index 1a2ad15f5b2..5b3395b77d2 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -2710,7 +2710,7 @@ PRESTART is the position basing on which START was found." (defun cperl-beginning-of-property (p prop &optional lim) "Given that P has a property PROP, find where the property starts. Will not look before LIM." -;;; XXXX What to do at point-max??? +;; XXXX What to do at point-max??? (or (previous-single-property-change (cperl-1+ p) prop lim) (point-min)) ;; (cond ((eq p (point-min)) @@ -3061,7 +3061,7 @@ and closing parentheses and brackets." (error nil)) (current-column)) ((eq 'indentable (elt i 0)) ; Indenter for REGEXP qw() etc - (cond ;;; [indentable terminator start-pos is-block] + (cond ; [indentable terminator start-pos is-block] ((eq 'terminator (elt i 1)) ; Lone terminator of "indentable string" (goto-char (elt i 2)) ; After opening parens (1- (current-column))) @@ -3948,8 +3948,6 @@ recursive calls in starting lines of here-documents." "\\|" ;; Second variant: Identifier or \ID (same as 'ID') "\\\\?\\(\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\)" ; 5 + 1, 6 + 1 - ;; Do not have <<= or << 30 or <<30 or << $blah. - ;; "\\([^= \t0-9$@%&]\\|[ \t]+[^ \t\n0-9$@%&]\\)" ; 6 + 1 "\\)" "\\|" ;; -------- format capture groups 8-9 @@ -4137,20 +4135,10 @@ recursive calls in starting lines of here-documents." ;; Here document ;; We can do many here-per-line; ;; but multiline quote on the same line as < (point) max) (setq tmpend tb)) (put-text-property b (point) 'syntax-type 'format)) - ;; qq-like String or Regexp: + ;; quotelike operator or regexp: capture groups 10 or 11 + ;; matches some false postives, to be eliminated here ((or (match-beginning 10) (match-beginning 11)) - ;; 1+6+2=9 extra () before this: - ;; "\\<\\(q[wxqr]?\\|[msy]\\|tr\\)\\>" - ;; "\\|" - ;; "\\([/<]\\)" ; /blah/ or (setq b1 (if (match-beginning 10) 10 11) argument (buffer-substring (match-beginning b1) (match-end b1)) @@ -4281,13 +4264,23 @@ recursive calls in starting lines of here-documents." (and (eq (char-syntax (preceding-char)) ?w) (progn (forward-sexp -1) -;; After these keywords `/' starts a RE. One should add all the -;; functions/builtins which expect an argument, but ... + ;; After these keywords `/' + ;; starts a RE. One should + ;; add all the + ;; functions/builtins which + ;; expect an argument, but + ;; ... (and (not (memq (preceding-char) '(?$ ?@ ?& ?%))) (looking-at - "\\(while\\|if\\|unless\\|until\\|for\\(each\\)?\\|and\\|or\\|not\\|xor\\|split\\|grep\\|map\\|print\\|say\\|return\\)\\>")))) + (regexp-opt + '("while" "if" "unless" + "until" "for" "foreach" + "and" "or" "not" + "xor" "split" "grep" "map" + "print" "say" "return") + 'symbols))))) (and (eq (preceding-char) ?.) (eq (char-after (- (point) 2)) ?.)) (bobp)) @@ -4487,12 +4480,13 @@ recursive calls in starting lines of here-documents." (1- e) e 'face my-cperl-delimiters-face))) (if (and is-REx cperl-regexp-scan) ;; Process RExen: embedded comments, charclasses and ] -;;;/\3333\xFg\x{FFF}a\ppp\PPP\qqq\C\99f(?{ foo })(??{ foo })/; -;;;/a\.b[^a[:ff:]b]x$ab->$[|$,$ab->[cd]->[ef]|$ab[xy].|^${a,b}{c,d}/; -;;;/(?<=foo)(?$[|$,$ab->[cd]->[ef]|$ab[xy].|^${a,b}{c,d}/; + ;;/(?<=foo)(?