diff options
author | William Carroll <wpcarro@gmail.com> | 2018-09-10T18·51-0400 |
---|---|---|
committer | William Carroll <wpcarro@gmail.com> | 2018-09-10T18·53-0400 |
commit | 17ee0e400bef47c371afcae76037f9ea6a44ad13 (patch) | |
tree | 0e5efee6f00e402890e91f3eceb4b29408a498b6 /configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925 | |
parent | 8b2fadf4776b7ddb4a67b4bc8ff6463770e56028 (diff) |
Support Vim, Tmux, Emacs with Stow
After moving off of Meta, Dotfiles has a greater responsibility to manage configs. Vim, Tmux, and Emacs are now within Stow's purview.
Diffstat (limited to 'configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925')
6 files changed, 297 insertions, 0 deletions
diff --git a/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-autoloads.el b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-autoloads.el new file mode 100644 index 000000000000..229248f448d2 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-autoloads.el @@ -0,0 +1,45 @@ +;;; docker-tramp-autoloads.el --- automatically extracted autoloads +;; +;;; Code: +(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +;;;### (autoloads nil "docker-tramp" "docker-tramp.el" (23377 61612 +;;;;;; 469221 507000)) +;;; Generated autoloads from docker-tramp.el + +(defvar docker-tramp-docker-options nil "\ +List of docker options.") + +(custom-autoload 'docker-tramp-docker-options "docker-tramp" t) + +(defconst docker-tramp-completion-function-alist '((docker-tramp--parse-running-containers "")) "\ +Default list of (FUNCTION FILE) pairs to be examined for docker method.") + +(defconst docker-tramp-method "docker" "\ +Method to connect docker containers.") + +(autoload 'docker-tramp-cleanup "docker-tramp" "\ +Cleanup TRAMP cache for docker method. + +\(fn)" t nil) + +(autoload 'docker-tramp-add-method "docker-tramp" "\ +Add docker tramp method. + +\(fn)" nil nil) + +(eval-after-load 'tramp '(progn (docker-tramp-add-method) (tramp-set-completion-function docker-tramp-method docker-tramp-completion-function-alist))) + +;;;*** + +;;;### (autoloads nil nil ("docker-tramp-compat.el" "docker-tramp-pkg.el") +;;;;;; (23377 61612 467434 581000)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; End: +;;; docker-tramp-autoloads.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-compat.el b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-compat.el new file mode 100644 index 000000000000..070b151931ed --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-compat.el @@ -0,0 +1,87 @@ +;;; docker-tramp-compat.el --- TRAMP integration for docker containers -*- lexical-binding: t; -*- + +;; Copyright (C) 2015 Mario Rodas <marsam@users.noreply.github.com> + +;; Author: Mario Rodas <marsam@users.noreply.github.com> +;; URL: https://github.com/emacs-pe/docker-tramp.el +;; Keywords: docker, convenience +;; Version: 0.1 +;; Package-Requires: ((emacs "24")) + +;; This file is NOT part of GNU Emacs. + +;;; License: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: +(require 'tramp-sh) + +(when (version< tramp-version "2.3") +;; Overwrite `tramp-wait-for-output' to work with Alpine busy boxes in Tramp<2.3 +;; +;; See: +;; + https://lists.gnu.org/archive/html/tramp-devel/2016-05/msg00000.html +;; + http://git.savannah.gnu.org/cgit/tramp.git/commit/?id=98a511248a9405848ed44de48a565b0b725af82c +(defconst tramp-device-escape-sequence-regexp "\e[[0-9]+n" + "Terminal control escape sequences for device status.") + +(defun tramp-wait-for-output (proc &optional timeout) + "Wait for output from remote command." + (unless (buffer-live-p (process-buffer proc)) + (delete-process proc) + (tramp-error proc 'file-error "Process `%s' not available, try again" proc)) + (with-current-buffer (process-buffer proc) + (let* (;; Initially, `tramp-end-of-output' is "#$ ". There might + ;; be leading escape sequences, which must be ignored. + ;; Busyboxes built with the EDITING_ASK_TERMINAL config + ;; option send also escape sequences, which must be + ;; ignored. + (regexp (format "[^#$\n]*%s\\(%s\\)?\r?$" + (regexp-quote tramp-end-of-output) + tramp-device-escape-sequence-regexp)) + ;; Sometimes, the commands do not return a newline but a + ;; null byte before the shell prompt, for example "git + ;; ls-files -c -z ...". + (regexp1 (format "\\(^\\|\000\\)%s" regexp)) + (found (tramp-wait-for-regexp proc timeout regexp1))) + (if found + (let (buffer-read-only) + ;; A simple-minded busybox has sent " ^H" sequences. + ;; Delete them. + (goto-char (point-min)) + (when (re-search-forward "^\\(.\b\\)+$" (point-at-eol) t) + (forward-line 1) + (delete-region (point-min) (point))) + ;; Delete the prompt. + (goto-char (point-max)) + (re-search-backward regexp nil t) + (delete-region (point) (point-max))) + (if timeout + (tramp-error + proc 'file-error + "[[Remote prompt `%s' not found in %d secs]]" + tramp-end-of-output timeout) + (tramp-error + proc 'file-error + "[[Remote prompt `%s' not found]]" tramp-end-of-output))) + ;; Return value is whether end-of-output sentinel was found. + found))) +) + +(provide 'docker-tramp-compat) + +;;; docker-tramp-compat.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-compat.elc b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-compat.elc new file mode 100644 index 000000000000..bd97d27108c1 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-compat.elc Binary files differdiff --git a/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-pkg.el b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-pkg.el new file mode 100644 index 000000000000..66d64b4653be --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp-pkg.el @@ -0,0 +1,9 @@ +(define-package "docker-tramp" "20170206.1925" "TRAMP integration for docker containers" + '((emacs "24") + (cl-lib "0.5")) + :keywords + '("docker" "convenience") + :url "https://github.com/emacs-pe/docker-tramp.el") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp.el b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp.el new file mode 100644 index 000000000000..a5f690ab4b76 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp.el @@ -0,0 +1,156 @@ +;;; docker-tramp.el --- TRAMP integration for docker containers -*- lexical-binding: t; -*- + +;; Copyright (C) 2015 Mario Rodas <marsam@users.noreply.github.com> + +;; Author: Mario Rodas <marsam@users.noreply.github.com> +;; URL: https://github.com/emacs-pe/docker-tramp.el +;; Keywords: docker, convenience +;; Version: 0.1 +;; Package-Requires: ((emacs "24") (cl-lib "0.5")) + +;; This file is NOT part of GNU Emacs. + +;;; License: + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: +;; +;; `docker-tramp.el' offers a TRAMP method for Docker containers. +;; +;; > **NOTE**: `docker-tramp.el' relies in the `docker exec` command. Tested +;; > with docker version 1.6.x but should work with versions >1.3 +;; +;; ## Usage +;; +;; Offers the TRAMP method `docker` to access running containers +;; +;; C-x C-f /docker:user@container:/path/to/file +;; +;; where +;; user is the user that you want to use (optional) +;; container is the id or name of the container +;; +;; ## Troubleshooting +;; +;; ### Tramp hangs on Alpine container +;; +;; Busyboxes built with the `ENABLE_FEATURE_EDITING_ASK_TERMINAL' config option +;; send also escape sequences, which `tramp-wait-for-output' doesn't ignores +;; correctly. Tramp upstream fixed in [98a5112][] and is available since +;; Tramp>=2.3. +;; +;; For older versions of Tramp you can dump [docker-tramp-compat.el][] in your +;; `load-path' somewhere and add the following to your `init.el', which +;; overwrites `tramp-wait-for-output' with the patch applied: +;; +;; (require 'docker-tramp-compat) +;; +;; [98a5112]: http://git.savannah.gnu.org/cgit/tramp.git/commit/?id=98a511248a9405848ed44de48a565b0b725af82c +;; [docker-tramp-compat.el]: https://github.com/emacs-pe/docker-tramp.el/raw/master/docker-tramp-compat.el + +;;; Code: +(eval-when-compile (require 'cl-lib)) + +(require 'tramp) +(require 'tramp-cache) + +(defgroup docker-tramp nil + "TRAMP integration for Docker containers." + :prefix "docker-tramp-" + :group 'applications + :link '(url-link :tag "Github" "https://github.com/emacs-pe/docker-tramp.el") + :link '(emacs-commentary-link :tag "Commentary" "docker-tramp")) + +(defcustom docker-tramp-docker-executable "docker" + "Path to docker executable." + :type 'string + :group 'docker-tramp) + +;;;###autoload +(defcustom docker-tramp-docker-options nil + "List of docker options." + :type '(repeat string) + :group 'docker-tramp) + +(defcustom docker-tramp-use-names nil + "Whether use names instead of id." + :type 'boolean + :group 'docker-tramp) + +;;;###autoload +(defconst docker-tramp-completion-function-alist + '((docker-tramp--parse-running-containers "")) + "Default list of (FUNCTION FILE) pairs to be examined for docker method.") + +;;;###autoload +(defconst docker-tramp-method "docker" + "Method to connect docker containers.") + +(defun docker-tramp--running-containers () + "Collect docker running containers. + +Return a list of containers of the form: \(ID NAME\)" + (cl-loop for line in (cdr (ignore-errors (apply #'process-lines docker-tramp-docker-executable (append docker-tramp-docker-options (list "ps"))))) + for info = (split-string line "[[:space:]]+" t) + collect (cons (car info) (last info)))) + +(defun docker-tramp--parse-running-containers (&optional ignored) + "Return a list of (user host) tuples. + +TRAMP calls this function with a filename which is IGNORED. The +user is an empty string because the docker TRAMP method uses bash +to connect to the default user containers." + (cl-loop for (id name) in (docker-tramp--running-containers) + collect (list "" (if docker-tramp-use-names name id)))) + +;;;###autoload +(defun docker-tramp-cleanup () + "Cleanup TRAMP cache for docker method." + (interactive) + (let ((containers (apply 'append (docker-tramp--running-containers)))) + (maphash (lambda (key _) + (and (vectorp key) + (string-equal docker-tramp-method (tramp-file-name-method key)) + (not (member (tramp-file-name-host key) containers)) + (remhash key tramp-cache-data))) + tramp-cache-data)) + (setq tramp-cache-data-changed t) + (if (zerop (hash-table-count tramp-cache-data)) + (ignore-errors (delete-file tramp-persistency-file-name)) + (tramp-dump-connection-properties))) + +;;;###autoload +(defun docker-tramp-add-method () + "Add docker tramp method." + (add-to-list 'tramp-methods + `(,docker-tramp-method + (tramp-login-program ,docker-tramp-docker-executable) + (tramp-login-args (,docker-tramp-docker-options ("exec" "-it") ("-u" "%u") ("%h") ("sh"))) + (tramp-remote-shell "/bin/sh") + (tramp-remote-shell-args ("-i" "-c"))))) + +;;;###autoload +(eval-after-load 'tramp + '(progn + (docker-tramp-add-method) + (tramp-set-completion-function docker-tramp-method docker-tramp-completion-function-alist))) + +(provide 'docker-tramp) + +;; Local Variables: +;; indent-tabs-mode: nil +;; End: + +;;; docker-tramp.el ends here diff --git a/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp.elc b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp.elc new file mode 100644 index 000000000000..f78a3f40bbb6 --- /dev/null +++ b/configs/shared/emacs/.emacs.d/elpa/docker-tramp-20170206.1925/docker-tramp.elc Binary files differ |