The World

13/03/2015

Sometimes we forget that despite what observation of the emacs-devel mailing list might suggest[1], Emacs core contributors are aware that there is something outside the ecosystem controlled by GNU.

I’ve found the most apparent proof for this fact when strolling through tramp-sh.el for debugging the tramp-open-connection-setup-interactive-shell function.

;; IRIX64 bash expands "!" even when in single quotes.  This
;; destroys our shell functions, we must disable it.  See
;; <http://stackoverflow.com/questions/3291692/irix-bash-shell-expands-expression-in-single-quotes-yet-shouldnt>.

How unexpected to not only see a fair amount of commentary explaining the probing done, but even a stackoverflow.com URL backing up one of the applied hacks. I personally wouldn’t have bothered as IRIX is an obsolete operating system and support for it will be removed in a future Emacs Release[2], however the TRAMP developers either haven’t got the memo yet or think otherwise (which is understandable, while they may not want to use obsolete operating systems, they might need to).

Another proof for my heretic theory can be found in subr.el in the sources of shell-quote-argument, the gate keeper of everything that wants to interact with shells in an orderly manner:

;; First, quote argument so that CommandLineToArgvW will
;; understand it.  See
;; http://msdn.microsoft.com/en-us/library/17w5ykft%28v=vs.85%29.aspx
;; After we perform that level of quoting, escape shell
;; metacharacters so that cmd won't mangle our argument.  If the
;; argument contains no double quote characters, we can just
;; surround it with double quotes.  Otherwise, we need to prefix
;; each shell metacharacter with a caret.

MSDN for Windows references? Very good!

[1]See the LLDB support discussion which is based on the assumption that inclusion of such code could only happen in Emacs and the GNU ELPA package repository.
[2]See the 25.1 NEWS