all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: John Croix <jcroix@mac.com>
Cc: 12769@debbugs.gnu.org
Subject: bug#12769: 24.2; Files won't save on Macintosh/Mountain Lion
Date: Wed, 31 Oct 2012 08:41:32 +0100	[thread overview]
Message-ID: <5090D62C.8010207@gmx.at> (raw)
In-Reply-To: <928CF6C4-2604-4B9A-9DC6-CBED7ECD64B5@mac.com>

 > I tracked the problem down to the following (in red):
 > (setq-default indent-tabs-mode nil)
 > (add-hook 'write-file-hooks
 >   (lambda ()
 >     (if (not indent-tabs-mode)
 >       (untabify (point-min) (point-max))
 >       (delete-trailing-whitespace))))

 > So, is this a bug or is the untabify command no longer supported?  If
 > it's now a bug, this should now be reproducible.  If it's an obsolete
 > package, do you have any suggestions for a replacement?

Properly indented, the `add-hook' form above here appears as

(add-hook 'write-file-hooks
           (lambda ()
             (if (not indent-tabs-mode)
                 (untabify (point-min) (point-max))
               (delete-trailing-whitespace))))

so if `indent-tabs-mode' is on, you delete trailing whitespace and if
it's off, you untabify.  Is this what you really want?

Anyway, the problem seems that `untabify' returns non-nil and according
to the doc-string of `write-file-hooks' we know that this is a

   List of functions to be called before writing out a buffer to a file.
   If one of them returns non-nil, the file is considered already written
   and the rest are not called.

which is slightly ambiguous: One might think that if one of them returns
non-nil Emacs will "not call the rest" but nevertheless save the buffer
to its file.

In your case writing the file is aborted because `untabify' returns the
"current column `move-to-column' moved to" (whatever that is it seems to
be non-nil).  So maybe we should modify the return value of `untabify'
(like in `delete-trailing-whitespace') or you should use

(add-hook 'write-file-hooks
           (lambda ()
             (if (not indent-tabs-mode)
                 (progn
                   (untabify (point-min) (point-max))
                   nil)
               (delete-trailing-whitespace))))

still modulo your real intentions of what that lambda is supposed to do.

martin





  parent reply	other threads:[~2012-10-31  7:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-30 19:25 bug#12769: 24.2; Files won't save on Macintosh/Mountain Lion John Croix
2012-10-30 20:33 ` Jan Djärv
2012-10-30 20:37   ` John Croix
2012-10-30 21:07     ` Jan Djärv
2012-10-31  3:04       ` John Croix
2012-10-31  7:33         ` Andreas Schwab
2012-10-31  7:41         ` martin rudalics [this message]
2012-10-31  8:09           ` Andreas Schwab
2012-10-31 10:27             ` martin rudalics
2012-10-31 14:50               ` John Croix
2012-10-31 15:07                 ` John Croix
2012-10-31 16:09                   ` Stefan Monnier

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=5090D62C.8010207@gmx.at \
    --to=rudalics@gmx.at \
    --cc=12769@debbugs.gnu.org \
    --cc=jcroix@mac.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 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.