+2012-07-17 Fabián Ezequiel Gallina <fgallina@cuca>
+
+ 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 <juri@jurta.org>
* dired-aux.el (dired-do-async-shell-command): Doc fix.
(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
(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))))
'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))))