]> git.eshelyaron.com Git - emacs.git/commit
Fix an infinite loop in c-beginning-of-defun-1
authorAlan Mackenzie <acm@muc.de>
Sat, 14 Oct 2023 19:14:57 +0000 (19:14 +0000)
committerAlan Mackenzie <acm@muc.de>
Sat, 14 Oct 2023 19:16:45 +0000 (19:16 +0000)
commit64850eaf989cdf3a69abc9b0c2fa37e098e7b0b9
treea26d2b645fd5ed96774a5e2590bcb843bc440bab
parentfe62315ef35c301d1fa0e1614d6bbbc83dbeef81
Fix an infinite loop in c-beginning-of-defun-1

This fixes bug#61436.

The loop manifested itself in c-get-fallback-scan-pos as the
position returned wasn't at a {, so the search back in
c-beginning-of-defun-1 with a defun-prompt-regexp found the
same BOL and moved forward to after the match, repeat.

* lisp/progmodes/cc-defs.el (c-beginning-of-defun-1): Accept a
position found by beginning-of-defun (which uses
defun-prompt-regexp) only when the \\s( following it is a {.
Repeat the backward search when this isn't the case.
lisp/progmodes/cc-defs.el