Subject: Re: bug#31148: 26.1; require w32 errors

From: Eli Zaretskii <[email-masked]>
Date: Fri, 13 Apr 2018 20:54:53 +0300

> From: Alex Branham <[email-masked]>
> Cc: [email-masked]
> Date: Fri, 13 Apr 2018 12:45:37 -0500
> 
> (if (not (w32-shell-dos-semantics))
>       (add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh))
> 
> Which causes errors on non-windows machines unless you wrap the call to
> w32-shell-dos-semantics in (and (fboundp ...)), which looks weird to me:
> 
> (if (not (and
>            (fboundp 'w32-shell-dos-semantics)
>            (w32-shell-dos-semantics)))
>       (add-hook 'comint-output-filter-functions 'ess-bugs-exit-notify-sh))
> 
> They also have code like:
> 
> (if (ess-microsoft-p)
>   (w32-short-file-name ...))
> 
> which causes byte compiler warnings about w32 being undefined. I guess
> the best/only way to get rid of these is to (declare-function ... ),
> right?

Yes, declare-function should solve at least some of those.

As for the rest, I suggest to define a variable/function (seems like
ess-microsoft-p is already doing that) to tell you whether you are on
MS-Windows, e.g., by looking at system-type, and then condition all
the calls to w32-specific functions on that variable/function.