help-gnu-emacs
[Top][All Lists]
Advanced

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

Post buffer initialisation hook?


From: Noah Slater
Subject: Post buffer initialisation hook?
Date: Thu, 15 Jun 2006 23:53:44 +0100

Hello,

I would like to attach a function to a hook which is called after
buffer initialisation - but have run into some major problems.

I am using `python-mode' which defins a function call `py-shell` -
this opens a new buffer and loads up the python interpreter.

`python-mode' is automatic for ".py" files and I have tried in vain to
add `py-shell' to the `python-mode-hook' and get the python
interpreter buffer hidden revealing just the buffer for the file you
visited.

This is what I tried (from memory):

(defun background-py-shell ()
(py-shell)
(delete-window)
)

(add-hook 'python-mode 'background-py-shell)

This results in the single empty buffer "*scratch*" and both the
python interpreter and the file just visited in hidden. In addition
the python interpreter seems a little sluggish this way.

My suspicion is that this hook is getting called before the main file
buffer is opened, displayed and/or initialised - which is why things
get weird.

I have tried the `find-files-hook' and various others to no effect.

Does anyone know what's going on - or more importantly (to me at
least) know how to achieve the desired results, that being to have a
python interpreter (from `'py-shell') loaded into a background buffer
automatically when opening a python file.

Thanks guys,
Noah

--
"Creativity can be a social contribution, but only in so
far as society is free to use the results." - R. Stallman




reply via email to

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