David Rod <[EMAIL PROTECTED]> writes:
> (defun david-r-turn-on-text-stuff ()
> (flyspell-mode 1)
> (abbrev-mode 1)
> )
>
> (add-hook 'text-mode-hook 'david-r-turn-on-text-stuff)
>
> this works fine. I want to add a (mark-whole-buffer)
> (canonically-space-region)
> Whenever I try this, this renders new messages and follow-ups
> by gnus inoperable
The problem is that message-mode is derived from text-mode, so when a
buffer switches to message-mode text-mode-hook is run, too.
Try this one. It should run canonically-space-region only if you're not
in message-mode.
--8<---------------cut here---------------start------------->8---
(defun david-r-turn-on-text-stuff ()
(flyspell-mode 1)
(abbrev-mode 1)
(unless (eq major-mode 'message-mode)
(canonically-space-region (point-min)
(point-max))))
--8<---------------cut here---------------end--------------->8---
> Also another question. is there a hook by killing a buffer which
> contains a file with the extension as .txt ?
No, but you can check that in the hook's function.
--8<---------------cut here---------------start------------->8---
(defun foo ()
(if (and buffer-file-name
(string= (file-name-extension buffer-file-name) "txt"))
(do-stuff-for-text-files)
(do-stuff-for-non-text-files)))
(add-hook 'kill-buffer-hook 'foo)
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
_______________________________________________
info-gnus-english mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/info-gnus-english