Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-24 Thread Conal Elliott
why care about trailing whitespace?

On Nov 16, 2007 8:14 AM, Valery V. Vorotyntsev [EMAIL PROTECTED] wrote:

 Add the following lines to your ~/.emacs:

 --- BEGIN OF ELISP CODE ---
 ;(global-set-key (kbd f9 s) 'delete-trailing-whitespace)

 (defun delete-trailing-whitespace-if-confirmed ()
  Delete all the trailing whitespace across the current buffer,
 asking user for confirmation.
  (if (and (save-excursion (goto-char (point-min))
   (re-search-forward [[:space:]]$ nil t))
   (y-or-n-p Delete trailing whitespace? ))
  (delete-trailing-whitespace)))

 (add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)
 --- END OF ELISP CODE ---

 Have fun!

 --
 vvv
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-24 Thread Brent Yorgey
On Nov 24, 2007 10:55 PM, Conal Elliott [EMAIL PROTECTED] wrote:

 why care about trailing whitespace?


Probably because it looks bad in darcs patch summaries (trailing whitespace
-- little red dollar signs).  Unless there's another reason I don't know
about.

-Brent
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-24 Thread Jonathan Cast

On 24 Nov 2007, at 9:09 PM, Brent Yorgey wrote:

On Nov 24, 2007 10:55 PM, Conal Elliott [EMAIL PROTECTED] wrote:
why care about trailing whitespace?

Probably because it looks bad in darcs patch summaries (trailing  
whitespace -- little red dollar signs).  Unless there's another  
reason I don't know about.


It breaks C-e.  (Irreparably, of course).

jcc

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-22 Thread Greg Heartsfield
Additionally, I find this to be helpful for keeping out trailing
whitespace:

;; Highlight trailing whitespace in haskell files
(add-hook 'haskell-mode-hook
  '(lambda ()
 (setq show-trailing-whitespace t)))

Cheers,
-Greg Heartsfield

On Fri, Nov 16, 2007 at 06:14:57PM +0200, Valery V. Vorotyntsev wrote:
 Add the following lines to your ~/.emacs:
 
 --- BEGIN OF ELISP CODE ---
 ;(global-set-key (kbd f9 s) 'delete-trailing-whitespace)
 
 (defun delete-trailing-whitespace-if-confirmed ()
   Delete all the trailing whitespace across the current buffer,
 asking user for confirmation.
   (if (and (save-excursion (goto-char (point-min))
  (re-search-forward [[:space:]]$ nil t))
  (y-or-n-p Delete trailing whitespace? ))
   (delete-trailing-whitespace)))
 
 (add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)
 --- END OF ELISP CODE ---
 
 Have fun!
 
 --
 vvv
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Valery V. Vorotyntsev
On 11/16/07, Denis Bueno [EMAIL PROTECTED] wrote:
 For one thing, if you happen to write code shared with other people
 who do not use this hook, then you may end up causing *huge* numbers
 of spurious differences in diff(1) output.  There may be an easy way
 to deal with this, but, it is a problem.

Yes, you are right. That's why user is being asked for confirmation.
And `diff -w' removes the noise, but still, yes, that can be a problem.

:)

--
vvv
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Denis Bueno
On Nov 16, 2007 12:05 PM, Valery V. Vorotyntsev [EMAIL PROTECTED] wrote:
 On 11/16/07, Brent Yorgey [EMAIL PROTECTED] wrote:
  Nice!  Is there a way to have this only run if the current buffer is in
  haskell-mode?  I'd add it myself but I've not yet taken the plunge to being
  an elisp hacker.

 Try adding ``(eq major-mode 'haskell-mode)'' after the `and' ..
 .. but why would you tolerate whitespace in other modes?

For one thing, if you happen to write code shared with other people
who do not use this hook, then you may end up causing *huge* numbers
of spurious differences in diff(1) output.  There may be an easy way
to deal with this, but, it is a problem.


-- 
  Denis
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Brent Yorgey
On Nov 16, 2007 11:14 AM, Valery V. Vorotyntsev [EMAIL PROTECTED] wrote:

 Add the following lines to your ~/.emacs:

 --- BEGIN OF ELISP CODE ---
 ;(global-set-key (kbd f9 s) 'delete-trailing-whitespace)

 (defun delete-trailing-whitespace-if-confirmed ()
  Delete all the trailing whitespace across the current buffer,
 asking user for confirmation.
  (if (and (save-excursion (goto-char (point-min))
   (re-search-forward [[:space:]]$ nil t))
   (y-or-n-p Delete trailing whitespace? ))
  (delete-trailing-whitespace)))

 (add-hook 'before-save-hook 'delete-trailing-whitespace-if-confirmed)
 --- END OF ELISP CODE ---


Nice!  Is there a way to have this only run if the current buffer is in
haskell-mode?  I'd add it myself but I've not yet taken the plunge to being
an elisp hacker.

-Brent
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] emacs haskellers: r-stripping files becomes popular

2007-11-16 Thread Valery V. Vorotyntsev
On 11/16/07, Brent Yorgey [EMAIL PROTECTED] wrote:
 Nice!  Is there a way to have this only run if the current buffer is in
 haskell-mode?  I'd add it myself but I've not yet taken the plunge to being
 an elisp hacker.

Try adding ``(eq major-mode 'haskell-mode)'' after the `and' ..
.. but why would you tolerate whitespace in other modes?

--
vvv
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe