comparison lisp/progmodes/python.el @ 55511:5dbde1bf6cad

(help-buffer): Autoload when compiling. (python-after-info-look): Don't assume Info-goto-node returns non-nil. (run-python): Prepend to any existing PYTHONPATH.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 10 May 2004 18:34:41 +0000
parents 4e81c5df6c36
children 0cecb3d4d566
comparison
equal deleted inserted replaced
55510:2b15e893127e 55511:5dbde1bf6cad
1136 (setq python-command cmd) 1136 (setq python-command cmd)
1137 ;; Fixme: Consider making `python-buffer' buffer-local as a buffer 1137 ;; Fixme: Consider making `python-buffer' buffer-local as a buffer
1138 ;; (not a name) in Python buffers from which `run-python' &c is 1138 ;; (not a name) in Python buffers from which `run-python' &c is
1139 ;; invoked. Would support multiple processes better. 1139 ;; invoked. Would support multiple processes better.
1140 (unless (comint-check-proc python-buffer) 1140 (unless (comint-check-proc python-buffer)
1141 (let ((cmdlist (append (python-args-to-list cmd) '("-i"))) 1141 (let* ((cmdlist (append (python-args-to-list cmd) '("-i")))
1142 (process-environment ; to import emacs.py 1142 (path (getenv "PYTHONPATH"))
1143 (push (concat "PYTHONPATH=" data-directory) 1143 (process-environment ; to import emacs.py
1144 process-environment))) 1144 (push (concat "PYTHONPATH=" data-directory
1145 (if path (concat ":" path)))
1146 process-environment)))
1145 (set-buffer (apply 'make-comint "Python" (car cmdlist) nil 1147 (set-buffer (apply 'make-comint "Python" (car cmdlist) nil
1146 (cdr cmdlist))) 1148 (cdr cmdlist)))
1147 (setq python-buffer "*Python*")) 1149 (setq python-buffer "*Python*"))
1148 (inferior-python-mode) 1150 (inferior-python-mode)
1149 ;; Load function defintions we need. 1151 ;; Load function defintions we need.
1274 (let ((proc (python-proc))) ;Make sure we have a process. 1276 (let ((proc (python-proc))) ;Make sure we have a process.
1275 (with-current-buffer python-buffer 1277 (with-current-buffer python-buffer
1276 ;; Fixme: I'm not convinced by this logic from python-mode.el. 1278 ;; Fixme: I'm not convinced by this logic from python-mode.el.
1277 (python-send-command 1279 (python-send-command
1278 (if (string-match "\\.py\\'" file-name) 1280 (if (string-match "\\.py\\'" file-name)
1279 ;; Fixme: make sure the directory is in the path list
1280 (let ((module (file-name-sans-extension 1281 (let ((module (file-name-sans-extension
1281 (file-name-nondirectory file-name)))) 1282 (file-name-nondirectory file-name))))
1282 (format "emacs.eimport(%S,%S)" 1283 (format "emacs.eimport(%S,%S)"
1283 module (file-name-directory file-name))) 1284 module (file-name-directory file-name)))
1284 (format "execfile(%S)" file-name))) 1285 (format "execfile(%S)" file-name)))
1305 table) 1306 table)
1306 "Syntax table giving `.' symbol syntax. 1307 "Syntax table giving `.' symbol syntax.
1307 Otherwise inherits from `python-mode-syntax-table'.") 1308 Otherwise inherits from `python-mode-syntax-table'.")
1308 1309
1309 (defvar view-return-to-alist) 1310 (defvar view-return-to-alist)
1311 (eval-when-compile (autoload 'help-buffer "help-fns"))
1310 1312
1311 ;; Fixme: Should this actually be used instead of info-look, i.e. be 1313 ;; Fixme: Should this actually be used instead of info-look, i.e. be
1312 ;; bound to C-h S? Can we use other pydoc stuff before python 2.2? 1314 ;; bound to C-h S? Can we use other pydoc stuff before python 2.2?
1313 (defun python-describe-symbol (symbol) 1315 (defun python-describe-symbol (symbol)
1314 "Get help on SYMBOL using `help'. 1316 "Get help on SYMBOL using `help'.
1390 (with-no-warnings (Info-mode)) 1392 (with-no-warnings (Info-mode))
1391 (condition-case () 1393 (condition-case ()
1392 ;; Don't use `info' because it would pop-up a *info* buffer. 1394 ;; Don't use `info' because it would pop-up a *info* buffer.
1393 (with-no-warnings 1395 (with-no-warnings
1394 (Info-goto-node (format "(python%s-lib)Miscellaneous Index" 1396 (Info-goto-node (format "(python%s-lib)Miscellaneous Index"
1395 version))) 1397 version))
1398 t)
1396 (error nil))))) 1399 (error nil)))))
1397 (info-lookup-maybe-add-help 1400 (info-lookup-maybe-add-help
1398 :mode 'python-mode 1401 :mode 'python-mode
1399 :regexp "[[:alnum:]_]+" 1402 :regexp "[[:alnum:]_]+"
1400 :doc-spec 1403 :doc-spec