comparison lisp/progmodes/python.el @ 54886:476bf87a815c

(run-python): Fix use of \n. (python-load-file): Remove `try' from Python fragment. (python-describe-symbol): Fix message.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 14 Apr 2004 20:16:05 +0000
parents fb2f71e89f5f
children 89ed55db7532
comparison
equal deleted inserted replaced
54885:fabac80da5ce 54886:476bf87a815c
1115 except: return None 1115 except: return None
1116 if inspect.isbuiltin (func): 1116 if inspect.isbuiltin (func):
1117 doc = func.__doc__ 1117 doc = func.__doc__
1118 if doc.find (' ->') != -1: 1118 if doc.find (' ->') != -1:
1119 print '_emacs_out', doc.split (' ->')[0] 1119 print '_emacs_out', doc.split (' ->')[0]
1120 elif doc.find ('\n') != -1: 1120 elif doc.find ('\\n') != -1:
1121 print '_emacs_out', doc.split ('\n')[0] 1121 print '_emacs_out', doc.split ('\\n')[0]
1122 return None 1122 return None
1123 if inspect.ismethod (func): func = func.im_func 1123 if inspect.ismethod (func): func = func.im_func
1124 if not inspect.isfunction (func): 1124 if not inspect.isfunction (func):
1125 return None 1125 return None
1126 (args, varargs, varkw, defaults) = inspect.getargspec (func) 1126 (args, varargs, varkw, defaults) = inspect.getargspec (func)
1245 (let ((module (file-name-sans-extension 1245 (let ((module (file-name-sans-extension
1246 (file-name-nondirectory file-name)))) 1246 (file-name-nondirectory file-name))))
1247 (set (make-local-variable 'python-orig-file) nil) 1247 (set (make-local-variable 'python-orig-file) nil)
1248 (set (make-local-variable 'python-orig-start-line) nil) 1248 (set (make-local-variable 'python-orig-start-line) nil)
1249 (format "\ 1249 (format "\
1250 try: 1250 if globals().has_key(%S): reload(%s)
1251 if globals().has_key(%S): reload(%s) 1251 else: import %s
1252 else: import %s
1253 except: None
1254 " module module module)) 1252 " module module module))
1255 (set (make-local-variable 'python-orig-file) file-name) 1253 (set (make-local-variable 'python-orig-file) file-name)
1256 (set (make-local-variable 'python-orig-start-line) 1) 1254 (set (make-local-variable 'python-orig-start-line) 1)
1257 (format "execfile('%s')" file-name)))) 1255 (format "execfile('%s')" file-name))))
1258 (set-marker compilation-parsing-end end) 1256 (set-marker compilation-parsing-end end)
1287 (let ((symbol (with-syntax-table python-dotty-syntax-table 1285 (let ((symbol (with-syntax-table python-dotty-syntax-table
1288 (current-word))) 1286 (current-word)))
1289 (enable-recursive-minibuffers t) 1287 (enable-recursive-minibuffers t)
1290 val) 1288 val)
1291 (setq val (read-string (if symbol 1289 (setq val (read-string (if symbol
1292 (format "Describe variable (default %s): " 1290 (format "Describe symbol (default %s): "
1293 symbol) 1291 symbol)
1294 "Describe symbol: ") 1292 "Describe symbol: ")
1295 nil nil symbol)) 1293 nil nil symbol))
1296 (list (or val symbol)))) 1294 (list (or val symbol))))
1297 (if (equal symbol "") (error "No symbol")) 1295 (if (equal symbol "") (error "No symbol"))