From: Harald Jörg Date: Fri, 28 Aug 2020 14:33:13 +0000 (+0200) Subject: Fix indent-region for identifiers with underscores in cperl-mode X-Git-Tag: emacs-28.0.90~6345 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=649a52822f207e1d302f0e089010b84d5e882281;p=emacs.git 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. --- 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)