all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#54885: 29.0.50; Tramp completion support for top-level sshconfig include
@ 2022-04-12 13:53 Bartosz Kaczyński
  2022-04-13  7:13 ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Bartosz Kaczyński @ 2022-04-12 13:53 UTC (permalink / raw)
  To: 54885

emacs -Q

Hi, I noticed that TRAMP hostname complation doesn't support my 
top-level sshconfig like below:

tree ~/.ssh/conf.d/
/home/bk/.ssh/conf.d/
├── domainX
├── domainY
└── personal

My ~/.ssh/config contains only one line

Include conf.d/*

and it's work perfectly from the shell by Emacs can't parse this Include 
directive. It would be very useful enhancement if the built-in 
completion frameworks (I use icomplete with vertical mode) can handle 
that structure which I first saw on counsel-tramp package(1).

1. 
https://github.com/masasam/emacs-counsel-tramp#support-for-top-level-sshconfig-include


In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 
3.24.33, cairo version 1.16.0)
  of 2022-04-12 built on RSQ-P030.rsq.local
Repository revision: 78784ccfadaee1c86207ecc360db7236285713f5
Repository branch: master
System Description: openSUSE MicroOS

Configured using:
  'configure --with-native-compilation --with-json --with-pgtk'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG SECCOMP
SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM GTK3 ZLIB

Important settings:
   value of $LC_CTYPE: en_US.UTF-8
   value of $LANG: en_US.UTF-8
   locale-coding-system: utf-8

Major mode: Helpful

Minor modes in effect:
   windmove-mode: t
   yas-global-mode: t
   yas-minor-mode: t
   shell-dirtrack-mode: t
   which-key-mode: t
   save-place-mode: t
   savehist-mode: t
   recentf-mode: t
   icomplete-vertical-mode: t
   icomplete-mode: t
   global-display-line-numbers-mode: t
   display-line-numbers-mode: t
   global-eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   buffer-read-only: t
   column-number-mode: t
   line-number-mode: t
   transient-mark-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message yank-media rmc puny rfc822 mml
mml-sec epa epg rfc6068 epg-config gnus-util text-property-search
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils mule-util jka-compr dired-aux dired dired-loaddefs tramp-sh
tramp-cache tramp tramp-loaddefs trampver tramp-integration cus-start
tramp-compat parse-time ls-lisp helpful imenu trace edebug backtrace
info-look f help-fns radix-tree elisp-refs s rainbow-delimiters vc-git
diff-mode vc-dispatcher server init init-locales init-tools
init-navigation windmove init-misc init-devel smartparens thingatpt dash
init-snippets yasnippet-snippets yasnippet init-gnus init-org ob-python
python ob-plantuml ob-restclient restclient ob-sql ob-shell shell org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src
ob-comint org-pcomplete pcomplete comint ansi-color ring org-list
org-faces org-entities noutline outline easy-mmode org-version
ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex iso8601
time-date ol org-keys oc org-compat advice org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs init-restclient
init-command-lines init-c-cpp init-config-files init-erc init-pass
init-tramp cus-edit pp cus-load files-x init-dired init-minibuffer
which-key saveplace savehist recentf tree-widget wid-edit icomplete
init-defaults modus-vivendi-theme modus-themes pcase
display-line-numbers init-exec-path exec-path-from-shell init-elpa
fullframe finder-inf info package browse-url url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap url-handlers url-parse auth-source eieio eieio-core
eieio-loaddefs password-cache json map url-vars init-site-lisp
init-utils init-benchmarking derived comp comp-cstr warnings rx cl-seq
cl-macs cl-extra help-mode seq gv subr-x byte-opt cl-loaddefs cl-lib
bytecomp byte-compile cconv early-init iso-transl tooltip eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/pgtk-win pgtk-win term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice simple 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 emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs faces cus-face macroexp files window
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget keymap hashtable-print-readable backquote threads dbusbind
inotify dynamic-setting system-font-setting font-render-setting cairo
gtk pgtk multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 552105 260802)
  (symbols 48 30739 3)
  (strings 32 145715 35356)
  (string-bytes 1 4211779)
  (vectors 16 50703)
  (vector-slots 8 888993 274160)
  (floats 8 371 1031)
  (intervals 56 1767 509)
  (buffers 992 17))






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#54885: 29.0.50; Tramp completion support for top-level sshconfig include
  2022-04-12 13:53 bug#54885: 29.0.50; Tramp completion support for top-level sshconfig include Bartosz Kaczyński
@ 2022-04-13  7:13 ` Michael Albinus
  2022-04-13 14:44   ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2022-04-13  7:13 UTC (permalink / raw)
  To: Bartosz Kaczyński; +Cc: 54885

Bartosz Kaczyński <bk@asterio.cloud> writes:

Hi Bartosz,

> Hi, I noticed that TRAMP hostname complation doesn't support my
> top-level sshconfig like below:
>
> tree ~/.ssh/conf.d/
> /home/bk/.ssh/conf.d/
> ├── domainX
> ├── domainY
> └── personal
>
> My ~/.ssh/config contains only one line
>
> Include conf.d/*
>
> and it's work perfectly from the shell by Emacs can't parse this
> Include directive. It would be very useful enhancement if the built-in
> completion frameworks (I use icomplete with vertical mode) can handle
> that structure which I first saw on counsel-tramp package(1).
>
> 1. https://github.com/masasam/emacs-counsel-tramp#support-for-top-level-sshconfig-include

Tramp doesn't handle sshconfig includes. However, you can emulate it
yourself with the following snippet in your .emacs (untested):

--8<---------------cut here---------------start------------->8---
(defvar my-tramp-completion-function-alist-ssh nil)

(dolist (file (directory-files "~/.ssh/conf.d/" 'full directory-files-no-dot-files-regexp))
  (add-to-list 'my-tramp-completion-function-alist-ssh
	       `(tramp-parse-sconfig ,file)))

(tramp-set-completion-function "scp" tramp-completion-function-alist-ssh)
(tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh)
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#54885: 29.0.50; Tramp completion support for top-level sshconfig include
  2022-04-13  7:13 ` Michael Albinus
@ 2022-04-13 14:44   ` Michael Albinus
  2022-04-13 15:22     ` Bartosz Kaczyński
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2022-04-13 14:44 UTC (permalink / raw)
  To: Bartosz Kaczyński; +Cc: 54885

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Bartosz,

> Tramp doesn't handle sshconfig includes. However, you can emulate it
> yourself with the following snippet in your .emacs (untested):

Hmm, there was an error in the snipptet. I've reworked it, and added to
the Tramp manual (pushed to master):

--8<---------------cut here---------------start------------->8---
4.18.1 Using ssh config include for host name completion
--------------------------------------------------------

OpenSSH configuration files can use an ‘Include’ option for further
configuration files.  Default TRAMP host name completion ignores this
option.  However, you can configure this yourself.

   Given, your ‘~/.ssh/config’ file contains the following option:

     Include ~/.ssh/conf.d/*

   The following code snippet in your ‘.emacs’ uses all files in that
directory for host name completion:

     (tramp-set-completion-function
      "ssh" (append (tramp-get-completion-function "ssh")
                    (mapcar (lambda (file) `(tramp-parse-sconfig ,file))
                            (directory-files
                             "~/.ssh/conf.d/"
                             'full directory-files-no-dot-files-regexp))))

   This code snippet does it for the ‘ssh’ method.  If you replace
"ssh" by "scp", it does it also for that method (or any other method
you like).
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#54885: 29.0.50; Tramp completion support for top-level sshconfig include
  2022-04-13 14:44   ` Michael Albinus
@ 2022-04-13 15:22     ` Bartosz Kaczyński
  2022-04-13 15:29       ` Michael Albinus
  0 siblings, 1 reply; 5+ messages in thread
From: Bartosz Kaczyński @ 2022-04-13 15:22 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 54885

Hi Michael,

thank you. These few lines made my work lot easier and it's huge 
improvement.

Best regards, Bartosz.

On 4/13/22 16:44, Michael Albinus wrote:
> Michael Albinus <michael.albinus@gmx.de> writes:
>
> Hi Bartosz,
>
>> Tramp doesn't handle sshconfig includes. However, you can emulate it
>> yourself with the following snippet in your .emacs (untested):
> Hmm, there was an error in the snipptet. I've reworked it, and added to
> the Tramp manual (pushed to master):
>
> --8<---------------cut here---------------start------------->8---
> 4.18.1 Using ssh config include for host name completion
> --------------------------------------------------------
>
> OpenSSH configuration files can use an ‘Include’ option for further
> configuration files.  Default TRAMP host name completion ignores this
> option.  However, you can configure this yourself.
>
>     Given, your ‘~/.ssh/config’ file contains the following option:
>
>       Include ~/.ssh/conf.d/*
>
>     The following code snippet in your ‘.emacs’ uses all files in that
> directory for host name completion:
>
>       (tramp-set-completion-function
>        "ssh" (append (tramp-get-completion-function "ssh")
>                      (mapcar (lambda (file) `(tramp-parse-sconfig ,file))
>                              (directory-files
>                               "~/.ssh/conf.d/"
>                               'full directory-files-no-dot-files-regexp))))
>
>     This code snippet does it for the ‘ssh’ method.  If you replace
> "ssh" by "scp", it does it also for that method (or any other method
> you like).
> --8<---------------cut here---------------end--------------->8---
>
> Best regards, Michael.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#54885: 29.0.50; Tramp completion support for top-level sshconfig include
  2022-04-13 15:22     ` Bartosz Kaczyński
@ 2022-04-13 15:29       ` Michael Albinus
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Albinus @ 2022-04-13 15:29 UTC (permalink / raw)
  To: Bartosz Kaczyński; +Cc: 54885-done

Version: 29.1

Bartosz Kaczyński <bk@asterio.cloud> writes:

> Hi Michael,

Hi Bartosz,

> thank you. These few lines made my work lot easier and it's huge
> improvement.

Thanks for the feedback, I'm closing the bug.

> Best regards, Bartosz.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-04-13 15:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-12 13:53 bug#54885: 29.0.50; Tramp completion support for top-level sshconfig include Bartosz Kaczyński
2022-04-13  7:13 ` Michael Albinus
2022-04-13 14:44   ` Michael Albinus
2022-04-13 15:22     ` Bartosz Kaczyński
2022-04-13 15:29       ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.