Comment 4 for bug 835868

Revision history for this message
tlroche (tom-roche) wrote : Re: [Bug 835868] Re: not finding pymacs/pymacs.el

Andreas Röhler Wed, 31 Aug 2011 19:40:33 -0000
> Does pycomplete work for you?

Apparently not. Here's how I tested:

0 Open setup.py (distributed with python-mode) in buffer.

1 In the first line

- from distutils.core import setup

  backspace to

+ from distutils.core imp

2 Test keys: if I press

* Tab -> nothing. Press Tab again: line indents. `C-x u` to restore.

* C-Tab -> buffer splits (lower buffer name="*anything*") and in minibuffer I get prompt=

> pattern:

  with text=

> imp

  `C-g` to restore.

* C-M-i -> I get the minibuffer message

> No completions available; use M-T or M-x semantic-mode

I suspect the above behavior is due to:

0 I am

> Using `python-mode' version 6.0.2

1 I don't have pymacs, and pycomplete requires pymacs (no?)

2 I do have `anything`, but I can delete that.

The python-related stuff called from my init.el follows to end of post.
Your suggestions for its improvements (at least for testing purposes)
are appreciated.------------------------------------------------------

(defconst LOCAL-PYTHON-LISP-DIR (concat LOCAL-EMACS-LISP-DIR "/python"))
(setq load-path
  (append
    (list
      LOCAL-PYTHON-LISP-DIR
      (concat LOCAL-PYTHON-LISP-DIR "/python-mode")
      (concat LOCAL-PYTHON-LISP-DIR "/anything")
      (concat LOCAL-PYTHON-LISP-DIR "/pylookup")
    )
  load-path)
) ; end (setq load-path

(require 'python-mode)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))

(require 'ipython)

(require 'anything)
(require 'anything-ipython)
(when (require 'anything-show-completion nil t)
   (use-anything-show-completion 'anything-ipython-complete
                                 '(length initial-pattern)))
;;; begin adaptation from header comments to anything-ipython.el
;;; use C-Tab, not M-Tab (which changes windows)
(add-hook 'python-mode-hook #'(lambda ()
          (define-key py-mode-map (kbd "C-<tab>") 'anything-ipython-complete)))
(add-hook 'ipython-shell-hook #'(lambda ()
          (define-key py-mode-map (kbd "C-<tab>") 'anything-ipython-complete)))
;;; end adaptation from header comments to anything-ipython.el

(require 'comint)
(define-key comint-mode-map (kbd "M-") 'comint-next-input)
(define-key comint-mode-map (kbd "M-") 'comint-previous-input)
(define-key comint-mode-map [down] 'comint-next-matching-input-from-input)
(define-key comint-mode-map [up] 'comint-previous-matching-input-from-input)

;;; pylookup
(autoload 'pylookup-lookup "pylookup")
(autoload 'pylookup-update "pylookup")
;;; TODO: reuse load-path above
(setq pylookup-program "~/.emacs.d/site-lisp/python/pylookup/pylookup.py")
(setq pylookup-db-file "~/.emacs.d/site-lisp/python/pylookup/pylookup.db")
(global-set-key "\C-ch" 'pylookup-lookup)

;;; autopair
(autoload 'autopair-global-mode "autopair" nil t)
(autopair-global-mode)
(add-hook 'lisp-mode-hook
          #'(lambda () (setq autopair-dont-activate t)))
(add-hook 'python-mode-hook
          #'(lambda ()
              (push '(?' . ?')
                    (getf autopair-extra-pairs :code))
              (setq autopair-handle-action-fns
                    (list #'autopair-default-handle-action
                          #'autopair-python-triple-quote-action))))

(require 'python-pep8)
(require 'python-pylint)
(add-hook 'before-save-hook 'delete-trailing-whitespace)

;;; yasnippet
(require 'yasnippet-bundle)
(yas/initialize)
(yas/load-directory "~/.emacs.d/site-lisp/python/my-snippets/")

;;; nose support (for testing): see
;;; .../site-lisp/python/nose.el
;;; from
;;; https://bitbucket.org/jpellerin/nosemacs/src/0192bf439dc9/nose.el
(require 'nose)
;;; default keybindings from nose.el
(add-hook 'python-mode-hook
          (lambda ()
            (local-set-key "\C-ca" 'nosetests-all)
            (local-set-key "\C-cm" 'nosetests-module)
            (local-set-key "\C-c." 'nosetests-one)
            (local-set-key "\C-cpa" 'nosetests-pdb-all)
            (local-set-key "\C-cpm" 'nosetests-pdb-module)
            (local-set-key "\C-cp." 'nosetests-pdb-one)))