unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Preserving trailing spaces
@ 2007-04-17  3:41 jgombos
  2007-04-17 20:34 ` Dieter Wilhelm
  0 siblings, 1 reply; 6+ messages in thread
From: jgombos @ 2007-04-17  3:41 UTC (permalink / raw)
  To: Help-gnu-emacs


I know it's a strange request to want to preserve trailing spaces; most folks
want to nuke them.  I'm working on a project where trailing spaces actually
have meaning (it's how the developer prevents the automated semantecize tool
from concatenating a long line of code that's intended to span multiple
lines for readability).

They have (probably inadvertently) installed Apex Emacs (aka aemacs), which
is essentially plain old emacs 20.7.1 with Rational's Apex functionality
integrated into the menu.  I'm glad they provided it, but I'm the only emacs
user on the team, as everyone else is using the Rational's proprietary and
very basic editor.

So to get to the issue, emacs wipes out the trailing whitespace on every
file I make a change to, and the semantizer rearranges code that I didn't
touch, adding substantial noise to the diffs - which could frustrate
reviewers.  How do I prevent emacs from nuking the trailing whitespace?  

Everything I've read indicates that emacs automatically preserves
whitespace, and that it must be proactively configured to delete trailing
whitespace.  My .emacs file is clean.  So somewhere in this aemacs
installation, there must be a hook or something that I need to override. 
How would I discover where that's happening?  Is it the lisp code for
Ada-mode?
-- 
View this message in context: http://www.nabble.com/Preserving-trailing-spaces-tf3588636.html#a10028734
Sent from the Emacs - Help mailing list archive at Nabble.com.

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

* Re: Preserving trailing spaces
  2007-04-17  3:41 Preserving trailing spaces jgombos
@ 2007-04-17 20:34 ` Dieter Wilhelm
  2007-04-18 13:14   ` jgombos
  0 siblings, 1 reply; 6+ messages in thread
From: Dieter Wilhelm @ 2007-04-17 20:34 UTC (permalink / raw)
  To: jgombos; +Cc: Help-gnu-emacs

jgombos <nabble.forum.jog@spamgourmet.com> writes:

> Everything I've read indicates that emacs automatically preserves
> whitespace, and that it must be proactively configured to delete trailing
> whitespace.  My .emacs file is clean.  So somewhere in this aemacs
> installation, there must be a hook or something that I need to override. 
> How would I discover where that's happening?  Is it the lisp code for
> Ada-mode?

I've seen in ada-mode.el.gz (Emacs 22.0.95, in /lisp/progmodes) a
variable which seem to control this, please try:

(setq ada-clean-buffer-before-saving nil)

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

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

* Re: Preserving trailing spaces
  2007-04-17 20:34 ` Dieter Wilhelm
@ 2007-04-18 13:14   ` jgombos
  0 siblings, 0 replies; 6+ messages in thread
From: jgombos @ 2007-04-18 13:14 UTC (permalink / raw)
  To: Help-gnu-emacs



Dieter Wilhelm wrote:
> 
> (setq ada-clean-buffer-before-saving nil)
> 
Yes!  That was it!  

Thank you!
-- 
View this message in context: http://www.nabble.com/Preserving-trailing-whitespace-tf3588636.html#a10058457
Sent from the Emacs - Help mailing list archive at Nabble.com.

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

* Re: Preserving trailing spaces
       [not found] <mailman.2168.1176801350.7795.help-gnu-emacs@gnu.org>
@ 2007-04-18 23:34 ` Giorgos Keramidas
  2007-04-19 13:32   ` jgombos
       [not found]   ` <mailman.2260.1176989843.7795.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Giorgos Keramidas @ 2007-04-18 23:34 UTC (permalink / raw)
  To: help-gnu-emacs

jgombos <nabble.forum.jog@spamgourmet.com> writes:
> I know it's a strange request to want to preserve trailing spaces;
> most folks want to nuke them.  I'm working on a project where trailing
> spaces actually have meaning (it's how the developer prevents the
> automated semantecize tool from concatenating a long line of code
> that's intended to span multiple lines for readability).
>
> They have (probably inadvertently) installed Apex Emacs (aka aemacs),
> which is essentially plain old emacs 20.7.1 with Rational's Apex
> functionality integrated into the menu.  I'm glad they provided it,
> but I'm the only emacs user on the team, as everyone else is using the
> Rational's proprietary and very basic editor.
>
> So to get to the issue, emacs wipes out the trailing whitespace on
> every file I make a change to, and the semantizer rearranges code that
> I didn't touch, adding substantial noise to the diffs - which could
> frustrate reviewers.  How do I prevent emacs from nuking the trailing
> whitespace?
>
> Everything I've read indicates that emacs automatically preserves
> whitespace, and that it must be proactively configured to delete
> trailing whitespace.  My .emacs file is clean.  So somewhere in this
> aemacs installation, there must be a hook or something that I need to
> override.  How would I discover where that's happening?  Is it the
> lisp code for Ada-mode?

It looks like your `write-file-hooks' deletes whitespace.

Can you check the value of this variable when you have opened a buffer
with your source code?  I don't have any local write-file-hooks loaded
right now, so when I type `M-: (list write-file-hooks)' my message
buffer shows:

    (nil)

If yours shows a non-nil list of hooks, you should examine the hooks to
see if one (or more) of them calls `delete-trailing-whitespace' or some
other custom function with a similar effect.

- Giorgos

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

* Re: Preserving trailing spaces
  2007-04-18 23:34 ` Giorgos Keramidas
@ 2007-04-19 13:32   ` jgombos
       [not found]   ` <mailman.2260.1176989843.7795.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 6+ messages in thread
From: jgombos @ 2007-04-19 13:32 UTC (permalink / raw)
  To: Help-gnu-emacs



Giorgos Keramidas wrote:
> 
> It looks like your `write-file-hooks' deletes whitespace.
> 
> Can you check the value of this variable when you have opened a buffer
> with your source code?  I don't have any local write-file-hooks loaded
> right now, so when I type `M-: (list write-file-hooks)' my message
> buffer shows:
> 
>     (nil)
> 
> If yours shows a non-nil list of hooks, you should examine the hooks to
> see if one (or more) of them calls `delete-trailing-whitespace' or some
> other custom function with a similar effect.
> 
Thanks for the tip.  That's useful to know.  I listed the write-file-hooks,
and the result was (nil).
Dieter Wilhelm's solution worked [which was to add (setq
ada-clean-buffer-before-saving nil) to .emacs], so it must have been a major
mode hook that removed the trailing whitespace.
-- 
View this message in context: http://www.nabble.com/Preserving-trailing-whitespace-tf3588636.html#a10077833
Sent from the Emacs - Help mailing list archive at Nabble.com.

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

* Re: Preserving trailing spaces
       [not found]   ` <mailman.2260.1176989843.7795.help-gnu-emacs@gnu.org>
@ 2007-04-19 15:37     ` Giorgos Keramidas
  0 siblings, 0 replies; 6+ messages in thread
From: Giorgos Keramidas @ 2007-04-19 15:37 UTC (permalink / raw)
  To: help-gnu-emacs

jgombos <nabble.forum.jog@spamgourmet.com> writes:
> Giorgos Keramidas wrote:
>> It looks like your `write-file-hooks' deletes whitespace.
>> 
>> Can you check the value of this variable when you have opened
>> a buffer with your source code?  I don't have any local
>> write-file-hooks loaded right now, so when I type `M-: (list
>> write-file-hooks)' my message buffer shows:
>> 
>>     (nil)
>> 
>> If yours shows a non-nil list of hooks, you should examine the
>> hooks to see if one (or more) of them calls
>> `delete-trailing-whitespace' or some other custom function
>> with a similar effect.
> 
> Thanks for the tip.  That's useful to know.  I listed the
> write-file-hooks, and the result was (nil).  Dieter Wilhelm's
> solution worked
> [which was to add (setq ada-clean-buffer-before-saving nil) to
> .emacs], so it must have been a major mode hook that removed
> the trailing whitespace.

Nice.  I didn't know about `ada-clean-buffer-before-saving' :)

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

end of thread, other threads:[~2007-04-19 15:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-17  3:41 Preserving trailing spaces jgombos
2007-04-17 20:34 ` Dieter Wilhelm
2007-04-18 13:14   ` jgombos
     [not found] <mailman.2168.1176801350.7795.help-gnu-emacs@gnu.org>
2007-04-18 23:34 ` Giorgos Keramidas
2007-04-19 13:32   ` jgombos
     [not found]   ` <mailman.2260.1176989843.7795.help-gnu-emacs@gnu.org>
2007-04-19 15:37     ` Giorgos Keramidas

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