This method does not support user names.
@item @option{toolbox}
+@item @option{distrobox}
@cindex method @option{toolbox}
@cindex @option{toolbox} method
+@cindex method @option{distrobox}
+@cindex @option{distrobox} method
-Integration of Toolbox system containers. The host name may be either
-a container's name or ID, as returned by @samp{toolbox list -c}.
-Without a host name, the default Toolbox container for the host will
-be used.
+Integration of Toolbox or Distrobox system containers, respectively.
+The host name may be either a container's name or ID, as returned by
+@samp{toolbox list -c} or @samp{distrobox list}. Without a host name,
+the default Toolbox container for the host will be used. There is no
+such default for Distrobox.
-This is an optional method, @pxref{Optional methods}. It does not
+These are optional methods, @pxref{Optional methods}. They do not
support user names.
@item @option{flatpak}
+++
*** New user option 'which-func-update-delay'.
This replaces the user option 'idle-update-delay', which was previously
-used to control the delay before `which-function-mode` updated its
+used to control the delay before 'which-function-mode' updated its
display. The user option 'idle-update-delay', which was only used by
Which Function mode, is now obsolete.
+++
*** New optional connection methods for containers.
-Tere are new optional connection methods "toolbox", "flatpak",
-"apptainer" and "nspawn". They allow accessing system containers
-provided by Toolbox, sandboxes provided by Flatpak, instances managed by
-Apptainer, or accessing systemd-based light-weight containers..
+There are new optional connection methods "toolbox", "distrobox",
+"flatpak", "apptainer" and "nspawn". They allow accessing system
+containers provided by Toolbox or Distrobox, sandboxes provided by
+Flatpak, instances managed by Apptainer, or accessing systemd-based
+light-weight containers..
+++
*** Connection method "kubernetes" supports now optional container name.
and 'byte-code-function'.
Those new types come with the associated new predicates 'closurep' and
-`interpreted-function-p' as well as a new constructor
+'interpreted-function-p' as well as a new constructor
'make-interpreted-closure'.
** New function 'help-fns-function-name'.
;;
;;
;;
+;; Open a file on an existing Distrobox container:
+;;
+;; C-x C-f /distrobox:CONTAINER:/path/to/file
+;;
+;; Where:
+;; CONTAINER is the container to connect to.
+;;
+;; If the container is not running, it is started.
+;;
+;;
+;;
;; Open a file on a running Flatpak sandbox:
;;
;; C-x C-f /flatpak:SANDBOX:/path/to/file
:type '(choice (const "toolbox")
(string)))
+;;;###tramp-autoload
+(defcustom tramp-distrobox-program "distrobox"
+ "Name of the Distrobxx client program."
+ :group 'tramp
+ :version "30.1"
+ :type '(choice (const "distrobox")
+ (string)))
+
;;;###tramp-autoload
(defcustom tramp-flatpak-program "flatpak"
"Name of the Flatpak client program."
;;;###tramp-autoload
(defconst tramp-docker-method "docker"
- "Tramp method name to use to connect to Docker containers.")
+ "Tramp method name to connect to Docker containers.")
;;;###tramp-autoload
(defconst tramp-dockercp-method "dockercp"
- "Tramp method name to use to connect to Docker containers.
+ "Tramp method name to connect to Docker containers.
This is for out-of-band connections.")
;;;###tramp-autoload
(defconst tramp-podman-method "podman"
- "Tramp method name to use to connect to Podman containers.")
+ "Tramp method name to connect to Podman containers.")
;;;###tramp-autoload
(defconst tramp-podmancp-method "podmancp"
- "Tramp method name to use to connect to Podman containers.
+ "Tramp method name to connect to Podman containers.
This is for out-of-band connections.")
;;;###tramp-autoload
(defconst tramp-kubernetes-method "kubernetes"
- "Tramp method name to use to connect to Kubernetes containers.")
+ "Tramp method name to connect to Kubernetes containers.")
;;;###tramp-autoload
(defconst tramp-toolbox-method "toolbox"
- "Tramp method name to use to connect to Toolbox containers.")
+ "Tramp method name to connect to Toolbox containers.")
+
+;;;###tramp-autoload
+(defconst tramp-distrobox-method "distrobox"
+ "Tramp method name to connect to Distrobox containers.")
;;;###tramp-autoload
(defconst tramp-flatpak-method "flatpak"
- "Tramp method name to use to connect to Flatpak sandboxes.")
+ "Tramp method name to connect to Flatpak sandboxes.")
;;;###tramp-autoload
(defconst tramp-apptainer-method "apptainer"
- "Tramp method name to use to connect to Apptainer instances.")
+ "Tramp method name to connect to Apptainer instances.")
;;;###tramp-autoload
(defconst tramp-nspawn-method "nspawn"
- "Tramp method name to use to connect to systemd-nspawn containers.")
+ "Tramp method name to connect to systemd-nspawn containers.")
;;;###tramp-autoload
(defmacro tramp-skeleton-completion-function (method &rest body)
(when-let ((raw-list (shell-command-to-string (concat program " list -c")))
;; Ignore header line.
(lines (cdr (split-string raw-list "\n" 'omit)))
+ ;; We do not show container IDs.
(names (tramp-compat-seq-keep
(lambda (line)
(when (string-match
lines)))
(mapcar (lambda (name) (list nil name)) names))))
+;;;###tramp-autoload
+(defun tramp-distrobox--completion-function (method)
+ "List Distrobox containers available for connection.
+
+This function is used by `tramp-set-completion-function', please
+see its function help for a description of the format."
+ (tramp-skeleton-completion-function method
+ (when-let ((raw-list (shell-command-to-string (concat program " list")))
+ ;; Ignore header line.
+ (lines (cdr (split-string raw-list "\n" 'omit)))
+ ;; We do not show container IDs.
+ (names (tramp-compat-seq-keep
+ (lambda (line)
+ (when (string-match
+ (rx bol (1+ (not space))
+ (1+ space) "|" (1+ space)
+ (group (1+ (not space))) space)
+ line)
+ (match-string 1 line)))
+ lines)))
+ (mapcar (lambda (name) (list nil name)) names))))
+
;;;###tramp-autoload
(defun tramp-flatpak--completion-function (method)
"List Flatpak sandboxes available for connection.
tramp-toolbox-method
`((tramp-toolbox--completion-function ,tramp-toolbox-method))))
+;;;###tramp-autoload
+(defun tramp-enable-distrobox-method ()
+ "Enable connection to Distrobox containers."
+ (add-to-list 'tramp-methods
+ `(,tramp-distrobox-method
+ (tramp-login-program ,tramp-distrobox-program)
+ (tramp-login-args (("enter")
+ ("-n" "%h")
+ ("--" "%l")))
+ ;(tramp-direct-async (,tramp-default-remote-shell "-c"))
+ (tramp-remote-shell ,tramp-default-remote-shell)
+ (tramp-remote-shell-login ("-l"))
+ (tramp-remote-shell-args ("-c"))))
+
+ (add-to-list 'tramp-completion-multi-hop-methods tramp-distrobox-method)
+
+ (tramp-set-completion-function
+ tramp-distrobox-method
+ `((tramp-distrobox--completion-function ,tramp-distrobox-method))))
+
;;;###tramp-autoload
(defun tramp-enable-flatpak-method ()
"Enable connection to Flatpak sandboxes."
(not (and (tramp--test-adb-p)
(string-match-p (rx multibyte) default-directory)))))
+(defun tramp--test-box-p ()
+ "Check, whether the toolbox or distrobox method is used.
+This does not support `tramp-test45-asynchronous-requests'."
+ (string-match-p
+ (rx bol (| "toolbox" "distrobox") eol)
+ (file-remote-p ert-remote-temporary-file-directory 'method)))
+
(defun tramp--test-container-p ()
"Check, whether a container method is used.
This does not support some special file names."
(string-equal
"telnet" (file-remote-p ert-remote-temporary-file-directory 'method)))
-(defun tramp--test-toolbox-p ()
- "Check, whether the toolbox method is used.
-This does not support `tramp-test45-asynchronous-requests'."
- (string-equal
- "toolbox" (file-remote-p ert-remote-temporary-file-directory 'method)))
-
(defun tramp--test-windows-nt-p ()
"Check, whether the locale host runs MS Windows."
(eq system-type 'windows-nt))
(skip-unless (not (tramp--test-container-p)))
(skip-unless (not (tramp--test-sshfs-p)))
(skip-unless (not (tramp--test-telnet-p)))
- (skip-unless (not (tramp--test-toolbox-p)))
+ (skip-unless (not (tramp--test-box-p)))
(skip-unless (not (tramp--test-windows-nt-p)))
(with-timeout