Patch removing spaces
Hello all,
If anyone is interested: a patch which removes spaces from the end of the lines. Compressed because it's rather big.
Best regards.
__________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
Balazs Attila-Mihaly \(Cd-MaN\) writes ("[Qemu-devel] Patch removing
Quoted 2 lines
spaces"): If anyone is interested: a patch which removes spaces from the end of the lines. Compressed because it's rather big.
Please don't apply this patch!
Spaces at the ends of lines are indeed irritating and we should avoid them. But going out of our way to remove them is definitely wrong - it's reformatting, which is nearly always wrong in Free Software.
See for example the CVS usage guidelines that Tony Finch recommends for use in the FreeBSD project
http://dotat.at/writing/cvs-guidelines.html
section 3.1.
Ian.
Hi,
Quoted 5 lines · Ian Jackson
Balazs Attila-Mihaly \(Cd-MaN\) writes ("[Qemu-devel] Patch removing
Quoted 2 lines
spaces"): If anyone is interested: a patch which removes spaces from the end of the lines. Compressed because it's rather big.
Please don't apply this patch!
In any case, _if_ something like this should be committed, I'd _rather_ have a small script that is easily verifyable, instead of a big patch that can hide too many things.
Don't get me wrong, I do not distrust "Cd-MaN", but, well, better be safe than sorry, right?
Ciao,
Dscho
Quoted 9 lines · Ian Jackson
Balazs Attila-Mihaly \(Cd-MaN\) writes ("[Qemu-devel] Patch removing
Quoted 2 lines
spaces"): If anyone is interested: a patch which removes spaces from the end of the lines. Compressed because it's rather big.
Please don't apply this patch!
Spaces at the ends of lines are indeed irritating and we should avoid them. But going out of our way to remove them is definitely wrong - it's reformatting, which is nearly always wrong in Free Software.
Reformatting code according to some well established coding style is surely _not_ wrong - for whatever kind of software. Tools are smart enough to ignore plain whitespace changes. But even if rewrapping is required, a clear commit comment will keep people away from searching for functional changes (and that there are non can be checked beforehand at binary level).
Reformatting sometimes also means re-reviewing (though I guess not in this case) with the chance to discover yet hidden bugs. Happened quite a few times for Linux during recent coding style fixes. Of course, bug fixes were not merged with style fixes.
But such changes are indeed pointless if there is no decision to strictly enforce the coding style from that point on. And if there is no clearly documented style guide (e.g. in form of a indent script + a few relaxation rules).
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux
Quoted 10 lines · Ian Jackson
Balazs Attila-Mihaly \(Cd-MaN\) writes ("[Qemu-devel] Patch removing
Quoted 2 lines
spaces"): If anyone is interested: a patch which removes spaces from the end of the lines. Compressed because it's rather big.
Please don't apply this patch!
Spaces at the ends of lines are indeed irritating and we should avoid them. But going out of our way to remove them is definitely wrong - it's reformatting, which is nearly always wrong in Free Software.
[..snip..]
Preventive measure that makes the code look sufficiently ugly when tabs or trailing whitespace is present. Hands almost reflectively reach for M-x nuke-trailing-whitespace' and C-x h M-x untabify'
(defface font-lock-ws-face
'((((class color) (background dark)) (:background "white"))
(((class color) (background light)) (:background "black")) (t (:bold t)))
"Font Lock mode face used to highlight unwated whitespace." :group 'font-lock-faces)
(setq font-lock-ws-face 'font-lock-ws-face)
(defun font-lock-mode-hook-fn ()
(setq old-font-lock-keywords font-lock-keywords) (make-variable-buffer-local 'font-lock-keywords) (let ((elem
(list
(list "\\([ \t]+$\\)\\|\\(\t\\)"
(list 0 font-lock-ws-face)))))
(setq font-lock-keywords (append font-lock-keywords elem))))(add-hook 'font-lock-mode-hook 'font-lock-mode-hook-fn)
Signature · 1 line
mailto:[email protected]
Quoted 17 lines · malc
Quoted 6 lines · Ian Jackson
Balazs Attila-Mihaly \(Cd-MaN\) writes ("[Qemu-devel] Patch removing
Quoted 3 lines
spaces"): If anyone is interested: a patch which removes spaces from the end of the lines. Compressed because it's rather big.
Quoted 7 lines
Please don't apply this patch!
Spaces at the ends of lines are indeed irritating and we should avoid them. But going out of our way to remove them is definitely wrong - it's reformatting, which is nearly always wrong in Free Software.
Quoted 5 lines
[..snip..]
Preventive measure that makes the code look sufficiently ugly when tabs or trailing whitespace is present. Hands almost reflectively reach for
M-x nuke-trailing-whitespace' andC-x h M-x untabify'
No match for M-x nuke-trailing-whitespace, where is that?
Quoted 12 lines
(defface font-lock-ws-face
'((((class color) (background dark)) (:background "white"))
(((class color) (background light)) (:background "black")) (t (:bold t)))
"Font Lock mode face used to highlight unwated whitespace." :group 'font-lock-faces)
(setq font-lock-ws-face 'font-lock-ws-face)(defun font-lock-mode-hook-fn ()
(setq old-font-lock-keywords font-lock-keywords) (make-variable-buffer-local 'font-lock-keywords) (let ((elem
Quoted 6 lines
(list (list "\\([ \t]+$\\)\\|\\(\t\\)" (list 0 font-lock-ws-face))))) (setq font-lock-keywords (append font-lock-keywords elem))))(add-hook 'font-lock-mode-hook 'font-lock-mode-hook-fn)
Thanks, it's ugly!
Quoted 1 line · Blue Swirl
Thanks, it's ugly!
Ugly, but neat! :)
BTW, for those using VIM, place this in your .vimrc:
highlight WhiteSpaceEOL ctermbg=darkgreen guibg=lightgreen match WhiteSpaceEOL /\s\+$/
autocmd WinEnter * match WhiteSpaceEOL /\s\+$/
Taken from http://www.vim.org/tips/tip.php?tip_id=1040, and modified not to highlight leading spaces -- perhaps highlighting groups of eight or more leading spaces would be useful, though?
HTH,
Signature · 1 line
Stuart Brady
Quoted 3 lines
Taken from http://www.vim.org/tips/tip.php?tip_id=1040, and modified not to highlight leading spaces -- perhaps highlighting groups of eight or more leading spaces would be useful, though?
No. Qemu uses spaces, not tabs, so you'd want to highlight tab characters if anything.
Paul
Quoted 2 lines · Paul Brook
No. Qemu uses spaces, not tabs, so you'd want to highlight tab characters if
anything.
I use this for emacs:
(setq-default indent-tabs-mode nil)
(setq-default show-trailing-whitespace t)
Laurent
Quoted 18 lines · Blue Swirl
Quoted 17 lines · malc
Quoted 13 lines · Ian Jackson
Balazs Attila-Mihaly \(Cd-MaN\) writes ("[Qemu-devel] Patch removing
Quoted 3 lines
spaces"): If anyone is interested: a patch which removes spaces from the end of the lines. Compressed because it's rather big.
Please don't apply this patch!
Spaces at the ends of lines are indeed irritating and we should avoid them. But going out of our way to remove them is definitely wrong - it's reformatting, which is nearly always wrong in Free Software.
Quoted 7 lines
Quoted 5 lines
[..snip..]
Preventive measure that makes the code look sufficiently ugly when tabs or trailing whitespace is present. Hands almost reflectively reach for
M-x nuke-trailing-whitespace' andC-x h M-x untabify'No match for M-x nuke-trailing-whitespace, where is that?
Oh, i have had it in my elisp collection for so long that forgot that it's not included in XEmacs (not sure about FSF Emacs)
That's the one i use:
;; whitespace.el --- strip trailing whitespace from buffers ;; Author: Noah Friedman <[email protected]> ;; Created: 1995-02-11
Quoted 17 lines
Quoted 17 lines
(defface font-lock-ws-face
'((((class color) (background dark)) (:background "white"))
(((class color) (background light)) (:background "black")) (t (:bold t)))
"Font Lock mode face used to highlight unwated whitespace." :group 'font-lock-faces)
(setq font-lock-ws-face 'font-lock-ws-face)(defun font-lock-mode-hook-fn ()
(setq old-font-lock-keywords font-lock-keywords) (make-variable-buffer-local 'font-lock-keywords) (let ((elem(list (list "\\([ \t]+$\\)\\|\\(\t\\)" (list 0 font-lock-ws-face))))) (setq font-lock-keywords (append font-lock-keywords elem))))
Quoted 3 lines
Quoted 1 line
(add-hook 'font-lock-mode-hook 'font-lock-mode-hook-fn)
Thanks, it's ugly!
You are welcome :)
Signature · 1 line
mailto:[email protected]