[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 646ecec0ec9: ; cperl-mode.el: Fix indentation issues after a form
From: |
Harald Jörg |
Subject: |
master 646ecec0ec9: ; cperl-mode.el: Fix indentation issues after a format declaration. |
Date: |
Wed, 18 Oct 2023 10:30:44 -0400 (EDT) |
branch: master
commit 646ecec0ec97cbe6bb7efc1a553d37c403851680
Author: Harald Jörg <haj@posteo.de>
Commit: Harald Jörg <haj@posteo.de>
; cperl-mode.el: Fix indentation issues after a format declaration.
* lisp/progmodes/cperl-mode.el (cperl-sniff-for-indent): Recognize
the end of a format declaration as a statement boundary. This fixes
indentation if several format declarations immediately follow each
other.
(cperl-find-pods-heres): use the correct capture group for the
name of an unterminated format declaration. Fix an out of
boundary error when a format declaration is typed at the end of a
buffer (Bug#66139).
---
lisp/progmodes/cperl-mode.el | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 6ef552137a7..d525b069407 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -2853,6 +2853,7 @@ Will not look before LIM."
;; in which case this line is the first argument decl.
(skip-chars-forward " \t")
(cperl-backward-to-noncomment (or old-indent (point-min)))
+ ;; Determine whether point is between statements
(setq state
(or (bobp)
(eq (point) old-indent) ; old-indent was at comment
@@ -2871,7 +2872,8 @@ Will not look before LIM."
(looking-at
(rx (sequence (0+ blank)
(eval cperl--label-rx))))))
- (get-text-property (point) 'first-format-line)))
+ (get-text-property (1- (point)) 'first-format-line)
+ (equal (get-text-property (point) 'syntax-type)
'format)))
;; Look at previous line that's at column 0
;; to determine whether we are in top-level decls
@@ -4201,9 +4203,8 @@ recursive calls in starting lines of here-documents."
;; 1+6=7 extra () before this:
;;"^[ \t]*\\(format\\)[ \t]*\\([a-zA-Z0-9_]+\\)?[ \t]*=[ \t]*$"
(setq b (point)
- name (if (match-beginning 8) ; 7 + 1
- (buffer-substring (match-beginning 8) ; 7 + 1
- (match-end 8)) ; 7 + 1
+ name (if (match-beginning 9) ; 7 + 2
+ (match-string-no-properties 9) ; 7 + 2
"")
tb (match-beginning 0))
(setq argument nil)
@@ -4236,10 +4237,10 @@ recursive calls in starting lines of here-documents."
(if (looking-at "^\\.$") ; ";" is not supported yet
(progn
;; Highlight the ending delimiter
- (cperl-postpone-fontification (point) (+ (point) 2)
+ (cperl-postpone-fontification (point) (+ (point) 1)
'face font-lock-string-face)
- (cperl-commentify (point) (+ (point) 2) nil)
- (cperl-put-do-not-fontify (point) (+ (point) 2) t))
+ (cperl-commentify (point) (+ (point) 1) nil)
+ (cperl-put-do-not-fontify (point) (+ (point) 1) t))
(setq warning-message
(format "End of format `%s' not found." name))
(or (car err-l) (setcar err-l b)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 646ecec0ec9: ; cperl-mode.el: Fix indentation issues after a format declaration.,
Harald Jörg <=