13

I see

;; Local Variables:
;; mangle-whitespace: t
;; End:

in many Elisp source files by various experienced Emacs programmers.

But when I describe-variable, Emacs 24.3 says no variable mangle-whitespace is defined.

Is mangle-whitespace provided by Emacs 24.4? Or by some popular package? (I don't see any on MELPA named "mangle".)

What does mangle-whitespace do?

Note: I searched for this both here and on SO under the emacs tag. I also tried both DuckDuckGo and Google, and the search results are just more examples of .el files using this. Ergo asking here.

Greg Hendershott
  • 1,483
  • 12
  • 17
  • 1
    I agree -- nothing pops up on Google except setting file-local variable that is illusive. – lawlist Feb 22 '15 at 03:51
  • 3
    No matches grepping the source code for the in-development Emacs `25.1`. Also no matches grepping the ancient Emacs `22.1`. – PythonNut Feb 22 '15 at 04:18

1 Answers1

9

I've grepped my ~/.emacs.d/elpa for mangle-whitespace and noticed it's used in a few packages which are all written by Roland Walker. Then I proceeded downloading the tarballs for Emacs 22.1 to Emacs 24.4 (because these are the Emacs version Roland Walker supports with his packages) and grepped them for this variable, but without any luck.

That's why I've opened an issue to find out the reasons for it. I'll update this answer as soon as there is a response.

edit: The author of these packages confirmed that it's a variable respected by his own Emacs config which instructs it to unconditionally require a final newline. He also expressed interest in turning it into a directory-local variable to avoid pushing it to Github.

wasamasa
  • 21,803
  • 1
  • 65
  • 97
  • So, to clarify, it's not part of Emacs, and it's not part of a third-party package, but rather it's someone's personal customization, correct? – Dan Feb 23 '15 at 15:58
  • This was an impressive amount of sleuthing, by the way. – Dan Feb 23 '15 at 15:59
  • Well, this is the case for all packages exhibiting this fairly unique file-local variable written by Roland Walker. If you find any by other authors, please tell me. – wasamasa Feb 23 '15 at 16:02
  • 2
    On a side-note. This variable could be replaced with `;; require-final-newline: t`. This should provide a similar result with a built-in variable. – Jonathan Leech-Pepin Feb 23 '15 at 16:19
  • @wasamasa Other examples: [exec-path-from-shell](https://github.com/purcell/exec-path-from-shell/blob/master/exec-path-from-shell.el#L222) and [magit-find-file](https://github.com/bradleywright/magit-find-file.el/blob/master/magit-find-file.el#L84). – Greg Hendershott Feb 23 '15 at 17:12
  • OK, so it seems this is just a personal setting. (Maybe some other packages used it "accidentally".) I'll mark your answer as accepted. Thanks! – Greg Hendershott Feb 23 '15 at 17:14
  • BTW the situation with `.dir-locals` seems confusing. The Emacs manual says it's a way to set file local vars in an entire directory -- and mentions the example of an open source project with many files. However, I've seen a few people express the (incompatible) idea that `.dir-locals` should be reserved for personal/local settings and `.gitignore`d. – Greg Hendershott Feb 23 '15 at 17:19