unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: 20761@debbugs.gnu.org
Subject: bug#20761: 25.0.50.1, beginning-of-defun matches inside string
Date: Mon, 08 Jun 2015 11:09:35 +0200	[thread overview]
Message-ID: <55755BCF.4090606@easy-emacs.de> (raw)
In-Reply-To: <55747D98.9020103@easy-emacs.de>


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.






  parent reply	other threads:[~2015-06-08  9:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-07 17:21 bug#20761: 25.0.50.1, beginning-of-defun matches inside string Andreas Röhler
2015-06-07 18:13 ` Glenn Morris
2015-06-07 18:41   ` Andreas Röhler
2015-06-08  5:18     ` Nicolas Richard
2015-06-08  5:45       ` Andreas Röhler
2015-06-08  9:09 ` Andreas Röhler [this message]
2017-04-02  5:18   ` npostavs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55755BCF.4090606@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=20761@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).