Mercurial > emacs
comparison lisp/progmodes/python.el @ 82365:e5a68f18fcb9
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-851
| author | Miles Bader <miles@gnu.org> |
|---|---|
| date | Mon, 13 Aug 2007 13:41:28 +0000 |
| parents | bda0322e3767 419c5c316b51 |
| children | 745fc321a3b4 424b655804ca |
comparison
equal
deleted
inserted
replaced
| 82364:0c34fdde692c | 82365:e5a68f18fcb9 |
|---|---|
| 346 (condition-case () | 346 (condition-case () |
| 347 (progn (backward-up-list) t) ; actually within brackets | 347 (progn (backward-up-list) t) ; actually within brackets |
| 348 (error nil)))))))) | 348 (error nil)))))))) |
| 349 | 349 |
| 350 (defun python-comment-line-p () | 350 (defun python-comment-line-p () |
| 351 "Return non-nil iff current line has only a comment." | 351 "Return non-nil if current line has only a comment." |
| 352 (save-excursion | 352 (save-excursion |
| 353 (end-of-line) | 353 (end-of-line) |
| 354 (when (eq 'comment (syntax-ppss-context (syntax-ppss))) | 354 (when (eq 'comment (syntax-ppss-context (syntax-ppss))) |
| 355 (back-to-indentation) | 355 (back-to-indentation) |
| 356 (looking-at (rx (or (syntax comment-start) line-end)))))) | 356 (looking-at (rx (or (syntax comment-start) line-end)))))) |
| 357 | 357 |
| 358 (defun python-blank-line-p () | 358 (defun python-blank-line-p () |
| 359 "Return non-nil iff current line is blank." | 359 "Return non-nil if current line is blank." |
| 360 (save-excursion | 360 (save-excursion |
| 361 (beginning-of-line) | 361 (beginning-of-line) |
| 362 (looking-at "\\s-*$"))) | 362 (looking-at "\\s-*$"))) |
| 363 | 363 |
| 364 (defun python-beginning-of-string () | 364 (defun python-beginning-of-string () |
| 848 | 848 |
| 849 (defun python-skip-out (&optional forward syntax) | 849 (defun python-skip-out (&optional forward syntax) |
| 850 "Skip out of any nested brackets. | 850 "Skip out of any nested brackets. |
| 851 Skip forward if FORWARD is non-nil, else backward. | 851 Skip forward if FORWARD is non-nil, else backward. |
| 852 If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. | 852 If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point. |
| 853 Return non-nil iff skipping was done." | 853 Return non-nil if skipping was done." |
| 854 (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) | 854 (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss)))) |
| 855 (forward (if forward -1 1))) | 855 (forward (if forward -1 1))) |
| 856 (unless (zerop depth) | 856 (unless (zerop depth) |
| 857 (if (> depth 0) | 857 (if (> depth 0) |
| 858 ;; Skip forward out of nested brackets. | 858 ;; Skip forward out of nested brackets. |
| 1197 (let ((map (make-sparse-keymap))) | 1197 (let ((map (make-sparse-keymap))) |
| 1198 ;; This will inherit from comint-mode-map. | 1198 ;; This will inherit from comint-mode-map. |
| 1199 (define-key map "\C-c\C-l" 'python-load-file) | 1199 (define-key map "\C-c\C-l" 'python-load-file) |
| 1200 (define-key map "\C-c\C-v" 'python-check) | 1200 (define-key map "\C-c\C-v" 'python-check) |
| 1201 ;; Note that we _can_ still use these commands which send to the | 1201 ;; Note that we _can_ still use these commands which send to the |
| 1202 ;; Python process even at the prompt iff we have a normal prompt, | 1202 ;; Python process even at the prompt provided we have a normal prompt, |
| 1203 ;; i.e. '>>> ' and not '... '. See the comment before | 1203 ;; i.e. '>>> ' and not '... '. See the comment before |
| 1204 ;; python-send-region. Fixme: uncomment these if we address that. | 1204 ;; python-send-region. Fixme: uncomment these if we address that. |
| 1205 | 1205 |
| 1206 ;; (define-key map [(meta ?\t)] 'python-complete-symbol) | 1206 ;; (define-key map [(meta ?\t)] 'python-complete-symbol) |
| 1207 ;; (define-key map "\C-c\C-f" 'python-describe-symbol) | 1207 ;; (define-key map "\C-c\C-f" 'python-describe-symbol) |
