unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* delete-trailing-whitespace on save
@ 2007-11-28 13:21 martin rudalics
  0 siblings, 0 replies; 5+ messages in thread
From: martin rudalics @ 2007-11-28 13:21 UTC (permalink / raw)
  To: jdh2358; +Cc: help-gnu-emacs

Your `basic-save-buffer' should give you three ways to do that:

	    (or (run-hook-with-args-until-success 'write-contents-hooks)
		(run-hook-with-args-until-success 'local-write-file-hooks)
		(run-hook-with-args-until-success 'write-file-hooks)

^ permalink raw reply	[flat|nested] 5+ messages in thread
* delete-trailing-whitespace on save
@ 2007-11-27 14:34 jdh2358
  2007-11-27 14:42 ` Joost Kremers
  2007-11-27 17:27 ` Will Parsons
  0 siblings, 2 replies; 5+ messages in thread
From: jdh2358 @ 2007-11-27 14:34 UTC (permalink / raw)
  To: help-gnu-emacs

I would like to automatically call delete-trailing-whitespace in
python-mode when I execute save-buffer.  I assume there is some way
using advice, but my emacs lisp skills are very rusty!  At first I
thought I could use an after-save-hook


(add-hook 'python-mode-hook
          (lambda ()
	    (setq show-trailing-whitespace t)
	    (make-local-hook 'after-save-hook)
	    (add-hook 'after-save-hook 'delete-trailing-whitespace)))

but that deletes the whitespace *after* saving.  I need something like
a before-save-hook.  I googled before-save-hook and it appears there
was once such a beast, but it does not appear to be a variable in my
version of emacs (GNU Emacs 21.3.1)

Thanks,
JDH

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-11-28 13:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-28 13:21 delete-trailing-whitespace on save martin rudalics
  -- strict thread matches above, loose matches on Subject: below --
2007-11-27 14:34 jdh2358
2007-11-27 14:42 ` Joost Kremers
2007-11-27 14:56   ` jdh2358
2007-11-27 17:27 ` Will Parsons

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).