From d8dba5d2fe7d73d6e7e4120e4e1f1d76fe0181f0 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 22 Dec 2024 13:22:00 +0100 Subject: [PATCH] update vterm Signed-off-by: Andreas Gerler --- elpa/vterm-20240520.231/vterm-pkg.el | 14 --- .../CMakeLists.txt | 0 .../elisp.c | 0 .../elisp.h | 0 .../emacs-module.h | 0 .../etc/emacs-vterm-bash.sh | 0 .../etc/emacs-vterm-zsh.sh | 0 .../etc/emacs-vterm.fish | 0 .../utf8.c | 0 .../utf8.h | 0 .../vterm-autoloads.el | 0 .../vterm-module.c | 10 +- .../vterm-module.h | 0 elpa/vterm-20241218.331/vterm-pkg.el | 10 ++ .../vterm.el | 91 +++++++++++++++++-- 15 files changed, 99 insertions(+), 26 deletions(-) delete mode 100644 elpa/vterm-20240520.231/vterm-pkg.el rename elpa/{vterm-20240520.231 => vterm-20241218.331}/CMakeLists.txt (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/elisp.c (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/elisp.h (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/emacs-module.h (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/etc/emacs-vterm-bash.sh (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/etc/emacs-vterm-zsh.sh (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/etc/emacs-vterm.fish (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/utf8.c (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/utf8.h (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/vterm-autoloads.el (100%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/vterm-module.c (99%) rename elpa/{vterm-20240520.231 => vterm-20241218.331}/vterm-module.h (100%) create mode 100644 elpa/vterm-20241218.331/vterm-pkg.el rename elpa/{vterm-20240520.231 => vterm-20241218.331}/vterm.el (94%) diff --git a/elpa/vterm-20240520.231/vterm-pkg.el b/elpa/vterm-20240520.231/vterm-pkg.el deleted file mode 100644 index c64fcbf4..00000000 --- a/elpa/vterm-20240520.231/vterm-pkg.el +++ /dev/null @@ -1,14 +0,0 @@ -(define-package "vterm" "20240520.231" "Fully-featured terminal emulator" - '((emacs "25.1")) - :commit "df057b1af2bb89a1deb288086f13be296af42090" :authors - '(("Lukas Fürmetz" . "fuermetz@mailbox.org")) - :maintainers - '(("Lukas Fürmetz" . "fuermetz@mailbox.org")) - :maintainer - '("Lukas Fürmetz" . "fuermetz@mailbox.org") - :keywords - '("terminals") - :url "https://github.com/akermu/emacs-libvterm") -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/vterm-20240520.231/CMakeLists.txt b/elpa/vterm-20241218.331/CMakeLists.txt similarity index 100% rename from elpa/vterm-20240520.231/CMakeLists.txt rename to elpa/vterm-20241218.331/CMakeLists.txt diff --git a/elpa/vterm-20240520.231/elisp.c b/elpa/vterm-20241218.331/elisp.c similarity index 100% rename from elpa/vterm-20240520.231/elisp.c rename to elpa/vterm-20241218.331/elisp.c diff --git a/elpa/vterm-20240520.231/elisp.h b/elpa/vterm-20241218.331/elisp.h similarity index 100% rename from elpa/vterm-20240520.231/elisp.h rename to elpa/vterm-20241218.331/elisp.h diff --git a/elpa/vterm-20240520.231/emacs-module.h b/elpa/vterm-20241218.331/emacs-module.h similarity index 100% rename from elpa/vterm-20240520.231/emacs-module.h rename to elpa/vterm-20241218.331/emacs-module.h diff --git a/elpa/vterm-20240520.231/etc/emacs-vterm-bash.sh b/elpa/vterm-20241218.331/etc/emacs-vterm-bash.sh similarity index 100% rename from elpa/vterm-20240520.231/etc/emacs-vterm-bash.sh rename to elpa/vterm-20241218.331/etc/emacs-vterm-bash.sh diff --git a/elpa/vterm-20240520.231/etc/emacs-vterm-zsh.sh b/elpa/vterm-20241218.331/etc/emacs-vterm-zsh.sh similarity index 100% rename from elpa/vterm-20240520.231/etc/emacs-vterm-zsh.sh rename to elpa/vterm-20241218.331/etc/emacs-vterm-zsh.sh diff --git a/elpa/vterm-20240520.231/etc/emacs-vterm.fish b/elpa/vterm-20241218.331/etc/emacs-vterm.fish similarity index 100% rename from elpa/vterm-20240520.231/etc/emacs-vterm.fish rename to elpa/vterm-20241218.331/etc/emacs-vterm.fish diff --git a/elpa/vterm-20240520.231/utf8.c b/elpa/vterm-20241218.331/utf8.c similarity index 100% rename from elpa/vterm-20240520.231/utf8.c rename to elpa/vterm-20241218.331/utf8.c diff --git a/elpa/vterm-20240520.231/utf8.h b/elpa/vterm-20241218.331/utf8.h similarity index 100% rename from elpa/vterm-20240520.231/utf8.h rename to elpa/vterm-20241218.331/utf8.h diff --git a/elpa/vterm-20240520.231/vterm-autoloads.el b/elpa/vterm-20241218.331/vterm-autoloads.el similarity index 100% rename from elpa/vterm-20240520.231/vterm-autoloads.el rename to elpa/vterm-20241218.331/vterm-autoloads.el diff --git a/elpa/vterm-20240520.231/vterm-module.c b/elpa/vterm-20241218.331/vterm-module.c similarity index 99% rename from elpa/vterm-20240520.231/vterm-module.c rename to elpa/vterm-20241218.331/vterm-module.c index 05f40f0a..2294ef47 100644 --- a/elpa/vterm-20240520.231/vterm-module.c +++ b/elpa/vterm-20241218.331/vterm-module.c @@ -1345,12 +1345,14 @@ emacs_value Fvterm_write_input(emacs_env *env, ptrdiff_t nargs, emacs_value args[], void *data) { Term *term = env->get_user_ptr(env, args[0]); ptrdiff_t len = string_bytes(env, args[1]); - char bytes[len]; - env->copy_string_contents(env, args[1], bytes, &len); + if (len > 0) { + char bytes[len]; + env->copy_string_contents(env, args[1], bytes, &len); - vterm_input_write(term->vt, bytes, len); - vterm_screen_flush_damage(term->vts); + vterm_input_write(term->vt, bytes, len); + vterm_screen_flush_damage(term->vts); + } return env->make_integer(env, 0); } diff --git a/elpa/vterm-20240520.231/vterm-module.h b/elpa/vterm-20241218.331/vterm-module.h similarity index 100% rename from elpa/vterm-20240520.231/vterm-module.h rename to elpa/vterm-20241218.331/vterm-module.h diff --git a/elpa/vterm-20241218.331/vterm-pkg.el b/elpa/vterm-20241218.331/vterm-pkg.el new file mode 100644 index 00000000..945d6e20 --- /dev/null +++ b/elpa/vterm-20241218.331/vterm-pkg.el @@ -0,0 +1,10 @@ +;; -*- no-byte-compile: t; lexical-binding: nil -*- +(define-package "vterm" "20241218.331" + "Fully-featured terminal emulator." + '((emacs "25.1")) + :url "https://github.com/akermu/emacs-libvterm" + :commit "f64729ed8b59e46ce827d28222c4087c538de562" + :revdesc "f64729ed8b59" + :keywords '("terminals") + :authors '(("Lukas Fürmetz" . "fuermetz@mailbox.org")) + :maintainers '(("Lukas Fürmetz" . "fuermetz@mailbox.org"))) diff --git a/elpa/vterm-20240520.231/vterm.el b/elpa/vterm-20241218.331/vterm.el similarity index 94% rename from elpa/vterm-20240520.231/vterm.el rename to elpa/vterm-20241218.331/vterm.el index 04c90587..ee452b23 100644 --- a/elpa/vterm-20240520.231/vterm.el +++ b/elpa/vterm-20241218.331/vterm.el @@ -3,7 +3,8 @@ ;; Copyright (C) 2017-2020 by Lukas Fürmetz & Contributors ;; ;; Author: Lukas Fürmetz -;; Version: 0.0.2 +;; Package-Version: 20241218.331 +;; Package-Revision: f64729ed8b59 ;; URL: https://github.com/akermu/emacs-libvterm ;; Keywords: terminals ;; Package-Requires: ((emacs "25.1")) @@ -172,11 +173,26 @@ the executable." :type 'string :group 'vterm) -(defcustom vterm-tramp-shells '(("docker" "/bin/sh")) +(defcustom vterm-tramp-shells + '(("ssh" login-shell) ("scp" login-shell) ("docker" "/bin/sh")) "The shell that gets run in the vterm for tramp. `vterm-tramp-shells' has to be a list of pairs of the format: -\(TRAMP-METHOD SHELL)" +\(TRAMP-METHOD SHELL) + +Use t as TRAMP-METHOD to specify a default shell for all methods. +Specific methods always take precedence over t. + +Set SHELL to \\='login-shell to use the user's login shell on the host. +The login-shell detection currently works for POSIX-compliant remote +hosts that have the getent command (regular GNU/Linux distros, *BSDs, +but not MacOS X unfortunately). + +You can specify an additional second SHELL command as a fallback +that is used when the login-shell detection fails, e.g., +\\='((\"ssh\" login-shell \"/bin/bash\") ...) +If no second SHELL command is specified with \\='login-shell, vterm will +fall back to tramp's shell." :type '(alist :key-type string :value-type string) :group 'vterm) @@ -813,16 +829,72 @@ Exceptions are defined by `vterm-keymap-exceptions'." (vterm--set-pty-name vterm--term (process-tty-name vterm--process)) (process-put vterm--process 'adjust-window-size-function #'vterm--window-adjust-process-window-size) + + ;; Set the truncation slot for 'buffer-display-table' to the ASCII code for a + ;; space character (32) to make the vterm buffer display a space instead of + ;; the default truncation character ($) when a line is truncated. + (let* ((display-table (or buffer-display-table (make-display-table)))) + (set-display-table-slot display-table 'truncation 32) + (setq buffer-display-table display-table)) + ;; Support to compilation-shell-minor-mode ;; Is this necessary? See vterm--compilation-setup (setq next-error-function 'vterm-next-error-function) (setq-local bookmark-make-record-function 'vterm--bookmark-make-record)) +(defun vterm--tramp-get-shell (method) + "Get the shell for a remote location as specified in `vterm-tramp-shells'. +The argument METHOD is the method string (as used by tramp) to get the shell +for, or t to get the default shell for all methods." + (let* ((specs (cdr (assoc method vterm-tramp-shells))) + (first (car specs)) + (second (cadr specs))) + ;; Allow '(... login-shell) or '(... 'login-shell). + (if (or (eq first 'login-shell) + (and (consp first) (eq (cadr first) 'login-shell))) + ;; If the first element is 'login-shell, try to determine the user's + ;; login shell on the remote host. This should work for all + ;; POSIX-compliant systems with the getent command in PATH. This + ;; includes regular GNU/Linux distros, *BSDs, but not MacOS X. If + ;; the login-shell determination fails at any point, the second + ;; element in the shell spec is used (if present, otherwise nil is + ;; returned). + (let* ((entry (ignore-errors + (with-output-to-string + (with-current-buffer standard-output + ;; The getent command returns the passwd entry + ;; for the specified user independently of the + ;; used name service (i.e., not only for static + ;; passwd files, but also for LDAP, etc). + ;; + ;; Use a shell command here to get $LOGNAME. + ;; Using the tramp user does not always work as + ;; it can be nil, e.g., with ssh host configs. + ;; $LOGNAME is defined in all POSIX-compliant + ;; systems. + (unless (= 0 (process-file-shell-command + "getent passwd $LOGNAME" + nil (current-buffer) nil)) + (error "Unexpected return value")) + ;; If we have more than one line, the output is + ;; not the expected single passwd entry. + ;; Most likely, $LOGNAME is not set. + (when (> (count-lines (point-min) (point-max)) 1) + (error "Unexpected output")))))) + (shell (when entry + ;; The returned Unix passwd entry is a colon- + ;; separated line. The 6th (last) element specifies + ;; the user's shell. + (nth 6 (split-string entry ":" nil "[ \t\n\r]+"))))) + (or shell second)) + first))) + (defun vterm--get-shell () "Get the shell that gets run in the vterm." (if (ignore-errors (file-remote-p default-directory)) (with-parsed-tramp-file-name default-directory nil - (or (cadr (assoc method vterm-tramp-shells)) + (or (vterm--tramp-get-shell method) + (vterm--tramp-get-shell t) (with-connection-local-variables shell-file-name) vterm-shell)) vterm-shell)) @@ -872,7 +944,8 @@ it to the bookmarked directory if needed." `'compilation-shell-minor-mode' would change the value of local variable `next-error-function', so we should call this function in `compilation-shell-minor-mode-hook'." - (when (eq major-mode 'vterm-mode) + (when (or (eq major-mode 'vterm-mode) + (derived-mode-p 'vterm-mode)) (setq next-error-function 'vterm-next-error-function))) (add-hook 'compilation-shell-minor-mode-hook #'vterm--compilation-setup) @@ -928,7 +1001,8 @@ A conventient way to exit `vterm-copy-mode' is with :group 'vterm :lighter " VTermCopy" :keymap vterm-copy-mode-map - (if (equal major-mode 'vterm-mode) + (if (or (equal major-mode 'vterm-mode) + (derived-mode-p 'vterm-mode)) (if vterm-copy-mode (vterm--enter-copy-mode) (vterm--exit-copy-mode)) @@ -1522,7 +1596,7 @@ Then triggers a redraw from the module." (- count 1 partial))) 'eight-bit)) (cl-incf partial)) - (when (> count partial 0) + (when (> (1+ count) partial 0) (setq vterm--undecoded-bytes (substring decoded-substring (- partial))) (setq decoded-substring @@ -1549,7 +1623,8 @@ Argument EVENT process event." (defun vterm--text-scale-mode (&optional _argv) "Fix `line-number' height for scaled text." (and text-scale-mode - (equal major-mode 'vterm-mode) + (or (equal major-mode 'vterm-mode) + (derived-mode-p 'vterm-mode)) (boundp 'display-line-numbers) (let ((height (expt text-scale-mode-step text-scale-mode-amount))) -- 2.47.3