Subject: Re: bug#38718: Emacs `compile' command does not handle remote (over TRAMP) file name correctly

From: Duncan Greatwood <[email-masked]>
Date: Wed, 1 Jan 2020 20:03:42 -0800

Michael,

I can confirm that the patch of Emacs 27.0.50 for bug#38648 applied to
Emacs 26.2
<
http://git.savannah.gnu.org/cgit/emacs.git/patch/lisp/progmodes/compile.el?id=0a10795d0bf4fe21997f907b7d6b1fe13517912b
works.

This is macOS Catalina (10.15.2). Emacs 26.2 is the version currently
installed on my Macbook by brew/cask.

I rebuilt from patched version of the sources at emacsformacosx.com, which
I believe reproduces the Emacs version used by and installed by brew. I
hadn't done that before, and leave some notes here on what I did. May not
be the best way, but it did work for me.

So:
To build and patch the brew version of Emacs on macOS (including Catalina):

brew update
brew upgrade
Install https://www.java.com/en/download/mac_download.jsp (if not
already installed)
Install xcode command line tools, if not already present:
  xcode-select --install
Downloaded emacs sources from https://emacsformacosx.com/builds
  Expand the emacs sources (double click in Finder)
Download build tools from https://github.com/caldwell/build-emacs
  Expand the build tools (double click in Finder)
  cd build-emacs-master
  Move the expanded emacs sources folder into the build-emacs-master folder
Patch the code you want to change in emacs sources
  For instance, to patch lisp/progmodes/compile.el
    cd emacs-source/lisp/progmodes
    Create your patch file ("patch.diff") here
    Copy patch contents from Internet patch file to patch.diff
    In the patch.diff file, edit the --- and +++ lines to simplify thus:
      --- compile.el
      +++ compile.el
    patch -p0 <patch.diff
    (This will rename old compile.el to compile.el.orig, create new
compile.el)
    cd ../../..
    (Back to build-emacs-master folder)
tar the emacs sources back up again:
  tar -cvjSf emacs-<XX.Y>.tar.bz2 emacs-<XX.Y>
  (substitute in real emacs sources version number)
Per the build tools' github page:
  To fix the build issue (Catalina fix), do as follows:
      If not installed already:
        brew install libxml2
      Then:
        export LDFLAGS="-L/usr/local/opt/libxml2/lib"
        export CPPFLAGS="-I/usr/local/opt/libxml2/include"
        export PKG_CONFIG_PATH="/usr/local/opt/libxml2/lib/pkgconfig"
  ./build-emacs-from-tar -v -j 4 emacs-<XX.Y>.tar.bz2 release
  (Substitute in the correct emacs sources version number)
  (Note: The build will take a long time)
  ./combine-and-package -v Emacs-<XX.Y>-<AA.BB>-x86_64.tar.bz2
  (Substitute in emacs sources version for XX.Y; substitute in macos
  version - 10.15 for Catalina - for AA.BB)
On success, Emacs-<XX.Y>-universal.dmg is created
Double click Emacs-<XX.Y>-universal.dmg in Finder to install

On Mon, Dec 23, 2019 at 9:34 AM Duncan Greatwood <[email-masked]> wrote:

> > Could you pls confirm, that <remote path to file> starts with "/home"?
> [DG] Yes, that's correct
>
> > And that on your local machine, "/home" is a symlink to
> > "/System/Volumes/Data/home"?
> [DG] Yes, that's also correct
>
> > If yes, your error is exactly the same as
> > bug#38648.
> [DG] OK, makes sense
>
> Regarding the discussion between Michael and Eli on the most efficient way
> to proceed, if you have a patch that can be applied to 26.2 I could
> certainly give it a try. Or I can try next version of emacs once released.
>
> If you want to try to prompt the relevant binary distributors to patch, I
> believe I am pretty typical for current macos emacs users in that emacs is
> installed via "brew cask install emacs" which I understand obtains its
> binary from https://emacsformacosx.com/.
>
> Thanks.
>
>