all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: whitespace issues
Date: Wed, 01 Jul 2015 01:25:42 +0200	[thread overview]
Message-ID: <87mvzgye15.fsf@nl106-137-147.student.uu.se> (raw)
In-Reply-To: c2dba062-9719-41dc-805d-91a376cf1eaa@googlegroups.com

Rusi <rustompmody@gmail.com> writes:

> 1. Is it possible to have some sort of save-hook so
> that all leading (indentation) whitespace is cleaned
> up to space alone and tabs are removed?

Do this and indentation will be in whitespaces only:

    (setq-default indent-tabs-mode nil)

Only in Makefiles you still get tabs - otherwise they
(the Makefiles) won't work.

But to answer your question, yes, you can use
`before-save-hook' and `untabify'.

If you want to add exceptions, it could look like
this:

    (defun untab-all ()
      (unless (member major-mode '(makefile-gmake-mode
                                   makefile-mode) ) ; exceptions
        (untabify (point-min) (point-max)))
      nil) ; tell 'did not write buffer to disk'

But I think it is better to have the file as you edit
it be as close to the finished form as possible, and
not have it post-processed like that.

-- 
underground experts united
http://user.it.uu.se/~embe8573




  parent reply	other threads:[~2015-06-30 23:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 14:17 whitespace issues Rusi
2015-06-30 14:54 ` tomas
     [not found] ` <mailman.6025.1435676084.904.help-gnu-emacs@gnu.org>
2015-06-30 14:57   ` Rusi
2015-06-30 15:03 ` Jorge A. Alfaro-Murillo
2015-06-30 15:06 ` Óscar Fuentes
2015-06-30 15:24 ` Ian Zimmerman
     [not found] ` <mailman.6026.1435676539.904.help-gnu-emacs@gnu.org>
2015-06-30 16:21   ` Rusi
2015-06-30 16:35     ` Rasmus
2015-06-30 16:27 ` Dan Espen
2015-06-30 23:25 ` Emanuel Berg [this message]
     [not found] ` <mailman.6027.1435676795.904.help-gnu-emacs@gnu.org>
2015-07-01  2:37   ` Rusi
2015-07-01  8:06     ` tomas
     [not found] ` <mailman.6071.1435706838.904.help-gnu-emacs@gnu.org>
2015-07-01  2:50   ` Rusi
2015-07-01 14:33     ` Jorge A. Alfaro-Murillo
2015-07-01 17:14     ` Emanuel Berg

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=87mvzgye15.fsf@nl106-137-147.student.uu.se \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.