bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16297: 24.3; Maybe wrong regexp in python.el (24.3)


From: Fabián Ezequiel Gallina
Subject: bug#16297: 24.3; Maybe wrong regexp in python.el (24.3)
Date: Mon, 30 Dec 2013 01:06:38 -0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]