Subject: 26.1; connection-local-variables do not match as described

From: Christopher Cooper <[email-masked]>
Date: Sun, 8 Jul 2018 00:10:48 -0400

According to the docstring for 'connection-local-criteria-alist',
"CRITERIA is a plist identifying a connection and the application
using this connection. ... All properties are optional; if
CRITERIA is nil, it always applies."

This does not appear to be true. In fact, this is plainly evident by
simple visual inspection of 'connection-local-get-profiles'. Only
:application seems to be optional.

Reproduction is quite simple. Run emacs -Q and eval the following elisp:

(defvar test--var nil)
(setf enable-connection-local-variables t)
(connection-local-set-profile-variables 'test-profile '((test--var . t)))
(connection-local-set-profiles nil 'test-profile)

Now open any TRAMP connection. Switch to the TRAMP buffer (where
connection-local-variables should have taken effect) and do
M-: test--var. The result is nil.

If you conduct the same test, but specify the :protocol, :user, and
:machine as part of the criteria in the 'connection-local-set-profiles'
call, test--var will evaluate to t, which is correct.

At best this is a case of misleading documentation, and at worst it is a
feature that never got implemented. Connection-local variables would be
very useful to me if they worked as described. I am glad to provide more
info or help in any capacity.

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12000000
System -e Description:    Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Magit

Minor modes in effect:
  erc-truncate-mode: t
  erc-spelling-mode: t
  erc-notify-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  global-magit-file-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  ido-vertical-mode: t
  smartparens-global-mode: t
  editorconfig-mode: t
  global-auto-complete-mode: t
  counsel-mode: t
  ivy-mode: t
  show-paren-mode: t
  global-anzu-mode: t
  anzu-mode: t
  volatile-highlights-mode: t
  global-linum-mode: t
  shell-dirtrack-mode: t
  recentf-mode: t
  diff-auto-refine-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/home/cooperc/.emacs.d/elpa/git-commit-2.13.0/git-commit hides
/home/cooperc/.emacs.d/elpa/magit-2.13.0/git-commit

Features:
(sort mail-extr emacsbug sendmail shr svg xml dom cus-edit pcase avy
browse-url jka-compr erc-truncate erc-autoaway erc-spelling flyspell
ispell erc-log eieio-opt speedbar sb-image ezimage dframe help-fns
cl-print cus-start cus-load erc-notify apropos two-column iso-transl
erc-list erc-menu erc-join erc-ring erc-networks erc-pcomplete erc-track
erc-match erc-button erc-fill erc-stamp erc-netsplit erc-goodies erc
erc-backend erc-compat mm-archive network-stream starttls url-cache smex
magit-bookmark bookmark vc vc-dispatcher windmove misearch multi-isearch
bug-reference git-rebase editorconfig-core editorconfig-core-handle
editorconfig-fnmatch magit-version magit-obsolete magit-blame
magit-stash magit-bisect magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-tag magit-merge magit-branch
magit-reset magit-collab ghub let-alist magit-files magit-refs
magit-status magit magit-repos magit-apply magit-wip magit-log
which-func imenu magit-diff smerge-mode magit-core magit-autorevert
autorevert filenotify magit-process magit-margin magit-mode git-commit
magit-git magit-section magit-utils crm magit-popup log-edit message
rfc822 mml mml-sec epa derived epg gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log with-editor async-bytecomp async colir color
material-theme server paredit hl-todo highlight-symbol time dot-tests
buttercup ert pp ewoc debug buttercup-compat shadow kotct-loaddefs
user-hub machine-local user-config-system cg505-hub ido-vertical-mode
system-hub darwin code-hub language-hub tex go web-c sh java rust ruby
fish fish-mode elixir smartparens-elixir elixir-mode pkg-info url-http
tls gnutls url url-proxy url-privacy url-expand url-methods url-history
mailcap url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-cookie url-domsuf url-util url-gw nsm rmc puny epl
elixir-smie smie elisp csharp c smart-tabs-mode code-navigation
indentation smartparens-c smartparens-config smartparens-text
smartparens magit-c editorconfig-c editorconfig behavior-hub text
window-management pane-management completion-c flycheck json map
find-func rx subr-x dash flymake-proc flymake warnings
auto-complete-config auto-complete edmacro kmacro popup ido-grid-mode
ido counsel dired dired-loaddefs compile esh-util swiper ivy delsel
ivy-overlay ffap visual-hub theme text-visuals paren anzu thingatpt
etags xref project volatile-highlights frame-c startup-c linum-c
linum-off linum file-hub file-content tramp-c recentf-c tramp-cache
tramp-sh tramp tramp-compat tramp-loaddefs trampver ucs-normalize shell
pcomplete comint ansi-color ring parse-time format-spec advice recentf
tree-widget wid-edit backup package-hub cl-extra help-mode verification
cl repositories dependencies vc-git diff-mode easy-mmode time-date
elec-pair autoload radix-tree lisp-mnt finder-inf info package easymenu
epg-config url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-loaddefs cl-lib mule-util tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 1489394 166969)
 (symbols 48 46723 1)
 (miscs 40 4164 3342)
 (strings 32 243899 19322)
 (string-bytes 1 6360239)
 (vectors 16 100112)
 (vector-slots 8 2176130 110892)
 (floats 8 409 1000)
 (intervals 56 139320 3213)
 (buffers 992 46))