[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109130: New utility functions + pyth
From: |
Fabián Ezequiel Gallina |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109130: New utility functions + python-info-ppss-context fix. |
Date: |
Tue, 17 Jul 2012 17:27:49 -0300 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109130
fixes bug: http://debbugs.gnu.org/11910
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: trunk
timestamp: Tue 2012-07-17 17:27:49 -0300
message:
New utility functions + python-info-ppss-context fix.
* progmodes/python.el (python-info-beginning-of-block-statement-p)
(python-info-ppss-comment-or-string-p): New functions.
(python-info-ppss-context): Small fix for string check.
modified:
lisp/ChangeLog
lisp/progmodes/python.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-07-17 18:40:15 +0000
+++ b/lisp/ChangeLog 2012-07-17 20:27:49 +0000
@@ -1,3 +1,10 @@
+2012-07-17 Fabián Ezequiel Gallina <address@hidden>
+
+ New utility functions + python-info-ppss-context fix (Bug#11910).
+ * progmodes/python.el (python-info-beginning-of-block-statement-p)
+ (python-info-ppss-comment-or-string-p): New functions.
+ (python-info-ppss-context): Small fix for string check.
+
2012-07-17 Juri Linkov <address@hidden>
* dired-aux.el (dired-do-async-shell-command): Doc fix.
=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el 2012-07-17 18:02:53 +0000
+++ b/lisp/progmodes/python.el 2012-07-17 20:27:49 +0000
@@ -2584,6 +2584,12 @@
(when names
(mapconcat (lambda (string) string) names "."))))
+(defsubst python-info-beginning-of-block-statement-p ()
+ "Return non-nil if current statement opens a block."
+ (save-excursion
+ (python-nav-beginning-of-statement)
+ (looking-at (python-rx block-start))))
+
(defun python-info-closing-block ()
"Return the point of the block the current line closes."
(let ((closing-word (save-excursion
@@ -2736,7 +2742,8 @@
(and (nth 4 ppss)
(nth 8 ppss)))
('string
- (nth 8 ppss))
+ (and (not (nth 4 ppss))
+ (nth 8 ppss)))
('paren
(nth 1 ppss))
(t nil))))
@@ -2755,6 +2762,10 @@
'paren)
(t nil))))
+(defsubst python-info-ppss-comment-or-string-p ()
+ "Return non-nil if point is inside 'comment or 'string."
+ (car (member (python-info-ppss-context-type) '(string comment))))
+
(defun python-info-looking-at-beginning-of-defun (&optional syntax-ppss)
"Check if point is at `beginning-of-defun' using SYNTAX-PPSS."
(and (not (python-info-ppss-context-type (or syntax-ppss (syntax-ppss))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109130: New utility functions + python-info-ppss-context fix.,
Fabián Ezequiel Gallina <=