@end example
@end defmac
+@defvar connection-local-default-application
+The default application, a symbol, to be applied in
+@code{with-connection-local-variables}. It defaults to @code{tramp},
+but in case you want to overwrite Tramp's settings temporarily, you
+could let-bind it like
+
+@example
+@group
+(connection-local-set-profile-variables
+ 'my-remote-perl
+ '((perl-command-name . "/usr/local/bin/perl5")
+ (perl-command-switch . "-e %s")))
+@end group
+
+@group
+(connection-local-set-profiles
+ '(:application 'my-app :protocol "ssh" :machine "remotehost")
+ 'my-remote-perl)
+@end group
+
+@group
+(let ((default-directory "/ssh:remotehost:/working/dir/")
+ (connection-local-default-application 'my-app))
+ (with-connection-local-variables
+ do something useful))
+@end group
+@end example
+
+This variable must not be changed globally.
+@end defvar
+
@defvar enable-connection-local-variables
If @code{nil}, connection-local variables are ignored. This variable
shall be changed temporarily only in special modes.
existing GTK-specific option 'x-gtk-use-system-tooltips' is now an
alias of this new option.
+** Connection-local variables
+
+++
-** Some connection-local variables are now user options.
+*** Some connection-local variables are now user options.
The variables 'connection-local-profile-alist' and
'connection-local-criteria-alist' are now user options, in order to
make it more convenient to inspect and modify them.
++++
+*** The default connection-local application can be changed temporarily.
+Running 'with-connection-local-variables' defaults to application
+'tramp'. This can be changed by let-binding
+'connection-local-default-application' to another symbol. This is
+useful when running code in a buffer, where Tramp has already set some
+connection local variables.
+
---
** New minor mode 'pixel-scroll-precision-mode'.
When enabled, and if your mouse supports it, you can scroll the
+++
*** 'eudc-expansion-overwrites-query' to 'eudc-expansion-save-query-as-kill'.
-Rename 'eudc-expansion-overwrites-query' to
+'eudc-expansion-overwrites-query' is renamed to
'eudc-expansion-save-query-as-kill' to reflect the actual behaviour of
the customization variable.
** Dired
*** New user option 'dired-mouse-drag-files'.
-If non-nil, dragging filenames with the mouse in a Dired buffer will
+If non-nil, dragging file names with the mouse in a Dired buffer will
initiate a drag-and-drop session allowing them to be opened in other
programs.
---
*** Tramp supports abbreviating remote home directories now.
-When calling 'abbreviate-file-name' on a Tramp filename, the result
+When calling 'abbreviate-file-name' on a Tramp file name, the result
will abbreviate the user's home directory, for example by abbreviating
"/ssh:user@host:/home/user" to "/ssh:user@host:~".
(copy-tree connection-local-variables-alist)))
(hack-local-variables-apply)))
+(defvar connection-local-default-application 'tramp
+ "Default application in connection-local functions, a symbol.
+This variable must not be changed globally.")
+
(defsubst connection-local-criteria-for-default-directory (&optional application)
"Return a connection-local criteria, which represents `default-directory'.
-If APPLICATION is nil, the symbol `tramp' is used."
+If APPLICATION is nil, `connection-local-default-application' is used."
(when (file-remote-p default-directory)
- `(:application ,(or application 'tramp)
- :protocol ,(file-remote-p default-directory 'method)
- :user ,(file-remote-p default-directory 'user)
- :machine ,(file-remote-p default-directory 'host))))
+ `(:application ,(or application connection-local-default-application)
+ :protocol ,(file-remote-p default-directory 'method)
+ :user ,(file-remote-p default-directory 'user)
+ :machine ,(file-remote-p default-directory 'host))))
;;;###autoload
(defmacro with-connection-local-variables (&rest body)
(should-not (boundp 'remote-shell-file-name))
(should (string-equal (symbol-value 'remote-null-device) "null"))
+ (connection-local-set-profiles
+ files-x-test--application 'remote-bash)
+
(with-connection-local-variables
;; All connection-local variables are set. They apply in
;; reverse order in `connection-local-variables-alist'.
(should (local-variable-p 'remote-shell-file-name))
(should (local-variable-p 'remote-null-device))
;; The proper variable values are set.
+ (should
+ (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh"))
+ (should
+ (string-equal (symbol-value 'remote-null-device) "/dev/null"))
+
+ ;; Run another instance of `with-connection-local-variables'
+ ;; with a different application.
+ (let ((connection-local-default-application (cadr files-x-test--application)))
+ (with-connection-local-variables
+ ;; The proper variable values are set.
+ (should
+ (string-equal (symbol-value 'remote-shell-file-name) "/bin/bash"))
+ (should
+ (string-equal (symbol-value 'remote-null-device) "/dev/null"))))
+ ;; The variable values are reset.
(should
(string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh"))
(should