GNU bug report logs -
#20761
beginning-of-defun matches column 0 paren inside string literal
Previous Next
Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>
Date: Sun, 7 Jun 2015 17:22:02 UTC
Severity: wishlist
Tags: fixed
Merged with 20284,
26642
Found in versions 25.0.50, 25.0.50.1, 25.1, 25.2
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Am 07.06.2015 um 19:21 schrieb Andreas Röhler:
> emacs -Q
>
> With cursor at end of string below:
>
> (defun asdf ()
> "
> (defun foo1 (&optional beg end)
> sdsd"
> )
>
> ;;;
>
> C-M-a stops inside string at "(defun foo1"
>
> GNU Emacs 25.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.24.23) of
> 2015-06-07
>
> Solution:
>
> beginning-of-defun-raw must check if being inside string.
>
>
>
This should fix it:
(defun ar-beginning-of-defun (&optional arg)
"Move to the beginning of a function definition.
Returns position, if successful, nil otherwise
Calls `beginning-of-defun-function', when set "
(interactive "P")
(unless (bobp)
(skip-chars-backward " \t\r\n\f")
(forward-char -1)
(let ((pos (car-safe (nth 9 (parse-partial-sexp (point-min)
(point))))))
(if beginning-of-defun-function
(funcall beginning-of-defun-function arg)
(and pos
(goto-char pos))))))
Optional arg here is for special needs, switches between class and
method defs for example.
This bug report was last modified 7 years and 104 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.