From: David Z Maze <dmaze@mit.edu>
To: info-gnus-english@gnu.org
Subject: Re: another simple question about hooks
Date: Mon, 12 Nov 2007 13:14:57 -0500 [thread overview]
Message-ID: <y681wavbaam.fsf@contents-vnder-pressvre.mit.edu> (raw)
In-Reply-To: <upryis46l.fsf@tiscali.co.uk>
David Rod <angel_ov_north@tiscali.co.uk> 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
You probably got a better response on how to call
canonically-space-region with point-min and point-max, but it's good
style to call elisp code that indirectly manipulates the point or mark
inside a save-excursion block as well. (text-mode-hook might get called
in a context where the point is assumed to be somewhere else, like the
start of the message body.) The help I have for `C-h f
mark-whole-buffer' states that "it is usually a mistake for a Lisp
function to use any subrouten that uses or sets the mark".
> Also another question. is there a hook by killing a buffer which
> contains a file with the extension as .txt ?
Not a Gnus question per se, but kill-buffer-hook gets called with the
buffer being killed as the current buffer, so you can look at
buffer-local variables like major-mode to see.
--dzm
next prev parent reply other threads:[~2007-11-12 18:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-10 11:58 David Rod
2007-11-11 9:43 ` Tassilo Horn
2007-11-12 18:14 ` David Z Maze [this message]
2007-11-12 23:05 ` David Rod
2007-11-13 7:50 ` Tassilo Horn
[not found] ` <mailman.3249.1194774209.18990.info-gnus-english@gnu.org>
2007-11-12 22:57 ` David Rod
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=y681wavbaam.fsf@contents-vnder-pressvre.mit.edu \
--to=dmaze@mit.edu \
--cc=info-gnus-english@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).