unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Luc Teirlinck <teirllm@dms.auburn.edu>
Cc: emacs-devel@gnu.org, jas@extundo.com
Subject: Re: Defcustom write-file-functions and write-contents-functions?
Date: Sun, 4 Jan 2004 18:14:20 -0600 (CST)	[thread overview]
Message-ID: <200401050014.i050EKf05803@raven.dms.auburn.edu> (raw)
In-Reply-To: <jwv3cavnvf6.fsf-monnier+emacs/devel@asado.iro.umontreal.ca> (message from Stefan Monnier on 04 Jan 2004 18:33:45 -0500)

Stefan Monnier wrote:

   Please don't.  There are already plenty of hooks run at that place
   and the code is hairy enough as it is.

It would add a line to the code, but it would not increase complexity.
Complexity is not measured in number of lines of code.

   > 	* emacs-lisp/copyright.el: Use before-save-hook instead of
   > 	write-file-functions.

   Better provide a copyright-auto-update-mode that will do the
   hook manipulation.

There might be other things users might want to have done before
saving a file and the proposed hook would very much _simplify_ this.
I realize that one always has to be extremely careful when running
something before saving _any_ file under _any_ conditions.  I
personally would not want to add, say, `delete-trailing-whitespace' to
`before-save-hook', because it would be too dangerous and would remove
wanted indentation in files that are saved while still being edited.
But certain things might be safe.  Certainly, anything that queries
the user is.  For instance, _detecting_ trailing whitespace and asking
the user is safe.

The only thing that _might_ work with the current hooks is to add
something to the front of `write-contents-functions'.  (The other
hooks in the `or' form are not guaranteed to run.)  But that solution
is not very solid, because `write-contents-functions' is not a normal
hook and something else (major modes for instance) might be playing
games with it.

Sincerely,

Luc.

  reply	other threads:[~2004-01-05  0:14 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-31 14:38 Defcustom write-file-functions and write-contents-functions? Simon Josefsson
2003-12-31 16:57 ` Luc Teirlinck
2003-12-31 17:26   ` Simon Josefsson
2003-12-31 19:27     ` Luc Teirlinck
2003-12-31 19:56       ` Simon Josefsson
2003-12-31 20:10         ` Luc Teirlinck
2004-01-01  5:52         ` Eli Zaretskii
2004-01-01 12:22           ` Simon Josefsson
2004-01-01 14:45             ` Eli Zaretskii
2004-01-04 23:33         ` Stefan Monnier
2004-01-05  0:14           ` Luc Teirlinck [this message]
2004-01-05  0:31             ` Miles Bader
2004-01-05  0:46           ` Simon Josefsson
2004-01-05 17:56             ` Richard Stallman
2004-01-05 18:38               ` Simon Josefsson
2004-01-04 14:54   ` Per Abrahamsen
2004-01-05  4:41     ` Luc Teirlinck
2004-01-07  2:07     ` Luc Teirlinck
2004-01-07  3:03       ` Luc Teirlinck
2004-01-07 15:05       ` Richard Stallman

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200401050014.i050EKf05803@raven.dms.auburn.edu \
    --to=teirllm@dms.auburn.edu \
    --cc=emacs-devel@gnu.org \
    --cc=jas@extundo.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).