Subject: Re: bug#20761: 25.0.50.1, beginning-of-defun matches inside string

From: [email-masked]
Date: Sun, 02 Apr 2017 01:18:06 -0400

retitle 20761 beginning-of-defun matches column 0 paren inside string literal
forcemerge 20761 20284
tags 20761 wontfix
quit

Andreas Röhler <[email-masked]> writes:

> 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))))))

M-x find-library org RET
M->
(benchmark 1 '(ar-beginning-of-defun)) ; Elapsed time: 0.414771s, also it puts point in the wrong place
(benchmark 1 '(beginning-of-defun))    ; Elapsed time: 0.000126s
M-: (setq open-paren-in-column-0-is-defun-start nil)
(benchmark 1 '(beginning-of-defun))    ; Elapsed time: 0.002505s