emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: python.el update


From: Dave Love
Subject: Re: python.el update
Date: Mon, 10 May 2004 18:42:03 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.2 (gnu/linux)

This fixes a couple of things you pointed out and a couple of others.

Note that there appears to be a byte-compiler bug: the mis-application
of `help-setup-xref' wasn't warned about for some reason.

2004-05-10  Dave Love  <address@hidden>

        * progmodes/python.el (python-comment-line-p): Doc fix.
        (inferior-python-mode-map): Remove C-c C-z.
        (python-after-info-look): Don't assume Info-goto-node returns
        non-nil.
        (help-buffer): Autoload when compiling.
        (python-describe-symbol): Call help-setup-xref correctly.
        (run-python): Prepend to any existing PYTHONPATH.

Index: python.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/python.el,v
retrieving revision 1.12
diff -u -p -u -r1.12 python.el
--- python.el   6 May 2004 20:22:30 -0000       1.12
+++ python.el   10 May 2004 17:38:50 -0000
@@ -297,10 +297,9 @@ comments and strings, or that the bracke
               (syntax-ppss (line-beginning-position)))))))
 
 (defun python-comment-line-p ()
-  "Return non-nil if current line has only a comment or is blank."
+  "Return non-nil if current line has only a comment."
   (save-excursion
     (end-of-line)
-    ;; FIXME: This looks wrong because it returns nil for empty lines.  --Stef
     (when (eq 'comment (syntax-ppss-context (syntax-ppss)))
       (back-to-indentation)
       (looking-at (rx (or (syntax comment-start) line-end))))))
@@ -1025,7 +1024,6 @@ et al.")
   (let ((map (make-sparse-keymap)))
     ;; This will inherit from comint-mode-map.
     (define-key map "\C-c\C-l" 'python-load-file)
-    (define-key map "\C-c\C-z" 'python-switch-to-python) ;What for?  --Stef
     (define-key map "\C-c\C-v" 'python-check)
     ;; Note that we _can_ still use these commands which send to the
     ;; Python process even at the prompt iff we have a normal prompt,
@@ -1140,10 +1138,12 @@ to this as appropriate.  Runs the hook `
   ;; (not a name) in Python buffers from which `run-python' &c is
   ;; invoked.  Would support multiple processes better.
   (unless (comint-check-proc python-buffer)
-    (let ((cmdlist (append (python-args-to-list cmd) '("-i")))
-         (process-environment          ; to import emacs.py
-          (push (concat "PYTHONPATH=" data-directory)
-                process-environment)))
+    (let* ((cmdlist (append (python-args-to-list cmd) '("-i")))
+          (path (getenv "PYTHONPATH"))
+          (process-environment         ; to import emacs.py
+           (push (concat "PYTHONPATH=" data-directory
+                         (if path (concat ":" path)))
+                 process-environment)))
       (set-buffer (apply 'make-comint "Python" (car cmdlist) nil
                         (cdr cmdlist)))
       (setq python-buffer "*Python*"))
@@ -1278,7 +1278,6 @@ module-qualified names."
       ;; Fixme: I'm not convinced by this logic from python-mode.el.
       (python-send-command
        (if (string-match "\\.py\\'" file-name)
-          ;; Fixme: make sure the directory is in the path list
           (let ((module (file-name-sans-extension
                          (file-name-nondirectory file-name))))
             (format "emacs.eimport(%S,%S)"
@@ -1309,6 +1308,7 @@ See variable `python-buffer'.  Starts a 
 Otherwise inherits from `python-mode-syntax-table'.")
 
 (defvar view-return-to-alist)
+(eval-when-compile (autoload 'help-buffer "help-fns"))
 
 ;; Fixme: Should this actually be used instead of info-look, i.e. be
 ;; bound to C-h S?  Can we use other pydoc stuff before python 2.2?
@@ -1343,7 +1343,7 @@ don't support `help'."
             (toggle-read-only 1)
             (setq view-return-to-alist
                   (list (cons (selected-window) help-return-method))))))
-      (help-setup-xref (list 'python-describe-symbol symbol))
+      (help-setup-xref (list 'python-describe-symbol symbol) t)
       (with-output-to-temp-buffer (help-buffer)
        (with-current-buffer standard-output
          (set (make-local-variable 'comint-redirect-subvert-readonly) t)
@@ -1387,14 +1387,15 @@ Used with `eval-after-load'."
                    (string-match "^Python \\([0-9]+\\.[0-9]+\\>\\)" s)
                    (match-string 1 s)))
         ;; Whether info files have a Python version suffix, e.g. in Debian.
-        (versioned 
+        (versioned
          (with-temp-buffer
            (with-no-warnings (Info-mode))
            (condition-case ()
                ;; Don't use `info' because it would pop-up a *info* buffer.
                (with-no-warnings
                 (Info-goto-node (format "(python%s-lib)Miscellaneous Index"
-                                        version)))
+                                        version))
+                t)
              (error nil)))))
     (info-lookup-maybe-add-help
      :mode 'python-mode

reply via email to

[Prev in Thread] Current Thread [Next in Thread]