Mercurial > emacs
comparison lisp/progmodes/python.el @ 94740:464e6f78f756
(python-comment-line-p, python-blank-line-p, python-skip-out,
python-check-comint-prompt): Don't use `iff' in docstrings.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Thu, 08 May 2008 03:42:10 +0000 |
parents | 52b7a8c22af5 |
children | 5f56382dc026 |
comparison
equal
deleted
inserted
replaced
94739:58cf3761a803 | 94740:464e6f78f756 |
---|---|
405 (condition-case () | 405 (condition-case () |
406 (progn (backward-up-list) t) ; actually within brackets | 406 (progn (backward-up-list) t) ; actually within brackets |
407 (error nil)))))))) | 407 (error nil)))))))) |
408 | 408 |
409 (defun python-comment-line-p () | 409 (defun python-comment-line-p () |
410 "Return non-nil iff current line has only a comment." | 410 "Return non-nil if and only if current line has only a comment." |
411 (save-excursion | 411 (save-excursion |
412 (end-of-line) | 412 (end-of-line) |
413 (when (eq 'comment (syntax-ppss-context (syntax-ppss))) | 413 (when (eq 'comment (syntax-ppss-context (syntax-ppss))) |
414 (back-to-indentation) | 414 (back-to-indentation) |
415 (looking-at (rx (or (syntax comment-start) line-end)))))) | 415 (looking-at (rx (or (syntax comment-start) line-end)))))) |
416 | 416 |
417 (defun python-blank-line-p () | 417 (defun python-blank-line-p () |
418 "Return non-nil iff current line is blank." | 418 "Return non-nil if and only if current line is blank." |
419 (save-excursion | 419 (save-excursion |
420 (beginning-of-line) | 420 (beginning-of-line) |
421 (looking-at "\\s-*$"))) | 421 (looking-at "\\s-*$"))) |
422 | 422 |
423 (defun python-beginning-of-string () | 423 (defun python-beginning-of-string () |
993 | 993 |
994 (defun python-skip-out (&optional forward syntax) | 994 (defun python-skip-out (&optional forward syntax) |
995 "Skip out of any nested brackets. | 995 "Skip out of any nested brackets. |
996 Skip forward if FORWARD is non-nil, else backward. | 996 Skip forward if FORWARD is non-nil, else backward. |
997 If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. | 997 If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. |
998 Return non-nil iff skipping was done." | 998 Return non-nil if and only if skipping was done." |
999 (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) | 999 (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) |
1000 (forward (if forward -1 1))) | 1000 (forward (if forward -1 1))) |
1001 (unless (zerop depth) | 1001 (unless (zerop depth) |
1002 (if (> depth 0) | 1002 (if (> depth 0) |
1003 ;; Skip forward out of nested brackets. | 1003 ;; Skip forward out of nested brackets. |
1803 (null python-preoutput-result))) | 1803 (null python-preoutput-result))) |
1804 (prog1 python-preoutput-result | 1804 (prog1 python-preoutput-result |
1805 (kill-local-variable 'python-preoutput-result)))))) | 1805 (kill-local-variable 'python-preoutput-result)))))) |
1806 | 1806 |
1807 (defun python-check-comint-prompt (&optional proc) | 1807 (defun python-check-comint-prompt (&optional proc) |
1808 "Return non-nil iff there's a normal prompt in the inferior buffer. | 1808 "Return non-nil if and only if there's a normal prompt in the inferior buffer. |
1809 If there isn't, it's probably not appropriate to send input to return | 1809 If there isn't, it's probably not appropriate to send input to return Eldoc |
1810 Eldoc information etc. If PROC is non-nil, check the buffer for that | 1810 information etc. If PROC is non-nil, check the buffer for that process." |
1811 process." | |
1812 (with-current-buffer (process-buffer (or proc (python-proc))) | 1811 (with-current-buffer (process-buffer (or proc (python-proc))) |
1813 (save-excursion | 1812 (save-excursion |
1814 (save-match-data (re-search-backward ">>> \\=" nil t))))) | 1813 (save-match-data (re-search-backward ">>> \\=" nil t))))) |
1815 | 1814 |
1816 ;; Fixme: Is there anything reasonable we can do with random methods? | 1815 ;; Fixme: Is there anything reasonable we can do with random methods? |