From 649a52822f207e1d302f0e089010b84d5e882281 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Harald=20J=C3=B6rg?= Date: Fri, 28 Aug 2020 16:33:13 +0200 Subject: [PATCH] Fix indent-region for identifiers with underscores in cperl-mode * lisp/progmodes/cperl-mode.el (cperl-fix-line-spacing): Fix Bug#18985. Hash keys or function names starting with a Perl keyword followed by an underscore (as in "for_me" are no longer split into two words by M-x indent-region. --- lisp/progmodes/cperl-mode.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index c47aa2ea8c2..44579cfd386 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -4876,7 +4876,7 @@ Returns some position at the last line." ;; }? continue ;; blah; } (if (not - (or (looking-at "[ \t]*\\(els\\(e\\|if\\)\\|continue\\|if\\|while\\|for\\(each\\)?\\|until\\)") + (or (looking-at "[ \t]*\\(els\\(e\\|if\\)\\|continue\\|if\\|while\\|for\\(each\\)?\\|unless\\|until\\)\\_>") (setq have-brace (save-excursion (search-forward "}" ee t))))) nil ; Do not need to do anything ;; Looking at: @@ -4884,7 +4884,7 @@ Returns some position at the last line." ;; else (if cperl-merge-trailing-else (if (looking-at - "[ \t]*}[ \t]*\n[ \t\n]*\\(els\\(e\\|if\\)\\|continue\\)\\>") + "[ \t]*}[ \t]*\n[ \t\n]*\\(els\\(e\\|if\\)\\|continue\\)\\_>") (progn (search-forward "}") (setq p (point)) @@ -4892,7 +4892,7 @@ Returns some position at the last line." (delete-region p (point)) (insert (make-string cperl-indent-region-fix-constructs ?\s)) (beginning-of-line))) - (if (looking-at "[ \t]*}[ \t]*\\(els\\(e\\|if\\)\\|continue\\)\\>") + (if (looking-at "[ \t]*}[ \t]*\\(els\\(e\\|if\\)\\|continue\\)\\_>") (save-excursion (search-forward "}") (delete-horizontal-space) @@ -4904,7 +4904,7 @@ Returns some position at the last line." (setq ret (point))))))) ;; Looking at: ;; } else - (if (looking-at "[ \t]*}\\(\t*\\|[ \t][ \t]+\\)\\<\\(els\\(e\\|if\\)\\|continue\\)\\>") + (if (looking-at "[ \t]*}\\(\t*\\|[ \t][ \t]+\\)\\<\\(els\\(e\\|if\\)\\|continue\\)\\_>") (progn (search-forward "}") (delete-horizontal-space) -- 2.39.2