Re: PATCH: solution for rogue whitespace in ChangeLog

Jacob Bachmeyer <[email protected]>
Newsgroups gmane.comp.sysutils.dejagnu.general
Message-ID <[email protected]>
Ben Elliston wrote:
> On Thu, Dec 13, 2018 at 06:47:21PM -0600, Jacob Bachmeyer wrote:
>   
>> A bit of rogue whitespace has slipped into ChangeLog again.  I spent
>> some time reading the Emacs manual and found that Emacs can
>> automatically fix the issue if the "whitespace-auto-cleanup"
>> variable is set.
>>     
>
> It's a good idea. I am just concerned that it doesn't work for me. ;-)
> Which Emacs version are you using?

An ancient 22.1.1 that has been kept because it works for my purposes.  
;-)  (There was an upgrade attempt that went very wrong in the past; 
"once bitten, twice shy" but I tend to occasionally find odd bugs 
because of an unusual version mix.)  (A complete rebuild to modern 
software has been "planned" for some years, but that will be its own 
irritation -- some of the larger programs I use are configured with some 
very nice extensions that do not work in the newer versions.)

>  apropos whitespace-auto-cleanup
> finds nothing on my GNU Emacs 25.2.2 installation. Does this depend on
> another Emacs package?
>   
No, it is part of whitespace.el in the old version.

Apparently, the new version of whitespace.el has rolled the old 
whitespace-auto-cleanup into a new whitespace-action variable, so 
changing "whitespace-auto-cleanup: t" to "whitespace-action: 
'(auto-cleanup)" looks like it should work.  Too bad that there does not 
seem to be an actually stable interface for specifying this in a file.  :-/

The other (probably better) option is to add something to your .emacs 
file along the lines of:  (warning: untested)

(add-hook 'find-file-hook
    (lambda ()
       (when (string= (file-name-nondirectory (buffer-file-name)) 
"ChangeLog")
          (set (make-local-variable 'whitespace-action) '(auto-cleanup)))))

That will of course have to be updated when the "whitespace" internals 
change again.  :-/


-- Jacob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.