unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: fgallina@gnu.org (Fabián Ezequiel Gallina)
To: 16297@debbugs.gnu.org
Subject: bug#16297: 24.3; Maybe wrong regexp in python.el (24.3)
Date: Mon, 30 Dec 2013 01:06:38 -0300	[thread overview]
Message-ID: <87bnzzkmhr.fsf@tata.lan> (raw)
In-Reply-To: <87zjnj3z78.fsf@iro.umontreal.ca> ("François Pinard"'s message of "Sun, 29 Dec 2013 20:27:39 -0500")

François Pinard <pinard@iro.umontreal.ca> writes:

> Well, I was adapting some of my Emacs Lisp from python-mode.el to use
> Fabian Gallina's python.el instead.  After loading python.el in Emacs
> 24.3, the value of python-nav-beginning-of-defun-regexp is:
>
> "^[[:space:]]*\\_<\\(?:class\\|def\\)\\_>[[:space:]]+\\([_[:alpha:]][_[:word:]]*\\)"
>
> Maybe I merely miss the meaning of "?:" in this regexp, if any.  Yet, by
> removing "?:" from the above value solved my problem, so maybe the value
> as defined by Emacs has problem?
>
> François
>

The "?:" meaning is that the grouping will not be accessible by
`match-string' and friends and that's intended. It doesn't change
regexp's behavior for matching a beginning of defun, but you can't get
the type easily.

If getting the type is the issue for you, one way to do it is:

   (when (looking-at python-nav-beginning-of-defun)
     (let* ((match (split-string (match-string-no-properties 0)))
            (type (car match)))
            (name (cadr match))
       (list type name)))


Regards,
Fabián.





      parent reply	other threads:[~2013-12-30  4:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-30  1:27 bug#16297: 24.3; Maybe wrong regexp in python.el (24.3) François Pinard
2013-12-30  3:06 ` Glenn Morris
2013-12-30  6:03   ` François Pinard
2013-12-30 19:27     ` Fabián Ezequiel Gallina
2013-12-30  4:06 ` Fabián Ezequiel Gallina [this message]

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=87bnzzkmhr.fsf@tata.lan \
    --to=fgallina@gnu.org \
    --cc=16297@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).