> M-x run-python RET
> import os RET
> help(os) RET

> Fontification gets very confused when, for example, single quotes are
> used as apostrophes rather than delimiting strings.  It makes the
> output really difficult to read.

Indeed, using the programming language's syntax-table for the inferior
process's buffer is often a bad idea since that buffer mixes code with
arbitrary program output.

The patch below tries to fix just this one case you complain about, but
maybe we should go a few steps further?


        Stefan


--- python.el   25 oct 2006 01:34:35 -0400      1.50
+++ python.el   14 nov 2006 10:29:15 -0500      
@@ -1194,6 +1194,15 @@
     ;; (define-key map "\C-c\C-f" 'python-describe-symbol)
     map))
 
+(defvar inferior-python-mode-syntax-table
+  (let ((st (make-syntax-table python-mode-syntax-table)))
+    ;; Don't get confused by apostrophes in the process's output (e.g. if
+    ;; you execute "help(os)").
+    (modify-syntax-entry ?\' "." st)
+    ;; Maybe we should do the same for double quotes?
+    ;; (modify-syntax-entry ?\" "." st)
+    st))
+
 ;; Fixme: This should inherit some stuff from `python-mode', but I'm
 ;; not sure how much: at least some keybindings, like C-c C-f;
 ;; syntax?; font-locking, e.g. for triple-quoted strings?
@@ -1216,7 +1225,6 @@
 
 \\{inferior-python-mode-map}"
   :group 'python
-  (set-syntax-table python-mode-syntax-table)
   (setq mode-line-process '(":%s"))
   (set (make-local-variable 'comint-input-filter) 'python-input-filter)
   (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter


_______________________________________________
emacs-pretest-bug mailing list
emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to