Subject: Re: bug#28889: 26.0.90; TRAMP and custom file location

From: Davor Rotim <[email-masked]>
Date: Mon, 23 Oct 2017 16:08:31 +0200

Hi Michael,

the fact that you don't have a "custom.el" written by the end of that init
is a bit mysterious.
Starting Emacs with the init file I posted will install "use-package" which
in turn will install SLIME
and at the end "use-package" will write the "package-selected-packages"
variable into "custom.el".
This has been the default behavior since GNU Emacs 25.1.
Using the same init file this is how my ~/emacs.d/elpa directory looks like:

--8<---------------cut here---------------start------------->8---
~ $ ls -l .emacs.d/elpa/
total 28K
drwxr-xr-x 4 drot drot 4.0K Oct 23 14:46 archives
drwxr-xr-x 2 drot drot 4.0K Oct 23 14:46 bind-key-20161218.1520
drwxr-xr-x 2 drot drot 4.0K Oct 23 14:46 diminish-20170419.1036
drwx------ 3 drot drot 4.0K Oct 23 14:46 gnupg
drwxr-xr-x 2 drot drot 4.0K Oct 23 14:46 macrostep-20161120.1306
drwxr-xr-x 5 drot drot 4.0K Oct 23 14:46 slime-20170929.1441
drwxr-xr-x 2 drot drot 4.0K Oct 23 14:46 use-package-20171013.1548
--8<---------------cut here---------------end------------->8---

And these are the contents of the custom.el file:

--8<---------------cut here---------------start------------->8---
~ $ cat .emacs.d/custom.el
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (slime use-package)))
 '(tramp-syntax (quote default) nil (tramp)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
--8<---------------cut here---------------end--------------->8---

The TRAMP line still gets added.
Even if I try without "use-package" the results are the same:

--8<---------------cut here---------------start------------->8---
(package-initialize)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))

(unless (package-installed-p 'slime)
  (package-refresh-contents)
  (package-install 'slime))

(setq custom-file (locate-user-emacs-file "custom.el"))
(load custom-file 'noerror)
--8<---------------cut here---------------end--------------->8---

The only "cure" for this is to use the new approach introduced with GNU
Emacs 25.1:

--8<---------------cut here---------------start------------->8---
(package-initialize)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))

(setq package-selected-packages '(slime))

(unless package-archive-contents
  (package-refresh-contents))
(package-install-selected-packages)

(setq custom-file (locate-user-emacs-file "custom.el"))
(load custom-file 'noerror)
--8<---------------cut here---------------end--------------->8---

This will avoid writing the custom.el file with the
"package-selected-packages" variable since it's already there
and no TRAMP variable will be added to the custom.el file.
So in short, it seems that the "tramp-syntax" variable gets caught along
with "package-selected-packages"
and it gets written to the custom file whenever we use "package-install" or
"use-package" (which also uses "package-install")
instead of "package-install-selected-packages".
This didn't happen wtih GNU Emacs 25.3, why it happens now I don't know.

Thank you again,

Davor Rotim