Monthly Archives: August 2009

python syntax warning in emacs

One of the best feature to have with Emacs when doing python development is to have a real time syntax error/warning check highlighted in your code to avoid many errors or superfluous code.

This code is taken from the brillant Emacswiki python page.

You need to install pyflakes first which should be available on your linux distro by default in a package or for the other OS you may follow the procedure from the pyflakes webpage.

and add this configuration to your .emacs :

(when (load "flymake" t)
(defun flymake-pyflakes-init ()
  (let* ((temp-file (flymake-init-create-temp-buffer-copy
                     'flymake-create-temp-inplace))
         (local-file (file-relative-name
                      temp-file
                      (file-name-directory buffer-file-name))))
    (list "pyflakes" (list local-file))))
(add-to-list 'flymake-allowed-file-name-masks
             '("\\.py\\'" flymake-pyflakes-init)))

make sure pyflakes is in your path and enable flymake-mode by default if you like for all python mode :


(add-hook 'python-mode-hook 'my-python-mode-hook)

go by M-x customize flymake as well if you like to customise some variables.

emacs daemon and Xdefaults

It does not seems that emacs started with –daemon read the .Xdefauls resource it seems that the only way setting it is by the default-frame-alist variable.

I have my setup like this :

(setq default-frame-alist '((font-backend . "xft")
                            (font . "Inconsolata-14")
                            (vertical-scroll-bars)
                            (left-fringe . -1)
                            (right-fringe . -1)
                            (fullscreen . fullboth)
                            (menu-bar-lines . 0)
                            (tool-bar-lines . 0)
                            ))

PS: inconsolata font can be installed from the package ttf-inconsolata