Subject: bug#60083: closed (Re: bug#60083: 29.0.60; eshell-elecslash when in the root directory of a remote host)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 21 Dec 2022 22:28:02 +0000

Your bug report

#60083: 29.0.60; eshell-elecslash when in the root directory of a remote host

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
60083: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60083
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#60083: 29.0.60; eshell-elecslash when in the root directory of a remote host
From: Jim Porter <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Wed, 21 Dec 2022 14:27:45 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

On 12/21/2022 4:42 AM, Eli Zaretskii wrote:
>> Date: Tue, 20 Dec 2022 22:55:24 -0800
>> Cc: [email-masked]
>> From: Jim Porter <[email-masked]>
>>
>> On 12/19/2022 3:29 AM, montag451 via Bug reports for GNU Emacs, the
>> Swiss army knife of text editors wrote:
>>> Thanks for looking into this. I've attached to this email a new patch
>>> which fixes the compilation warning.
>>
>> Thanks. This looks good to me now.
>>
>> Eli, should I merge this to the release branch then?
> 
> Yes, please.  But don't forget the Copyright-paperwork-exempt thingy
> in the log message.

Ok, merged to emacs-29 as 777b383dd0f61488ba4e43756cf43521f994f906.

Thanks again for the bug report/patch. Closing this bug now.

Subject: 29.0.60; eshell-elecslash when in the root directory of a remote host
From: montag451 <[email-masked]>
To: [email-masked]
Date: Thu, 15 Dec 2022 00:46:50 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

While testing the new eshell module 'eshell-elecslash' I found a bug
when the default-directory is the root of a remote host. To reproduce
the problem type the following in a eshell buffer (replacing "method"
and "host" by appropriate values):

$ cd /method:host:/
$ cd / <--- here the "/" should be replaced by "/method:host:/" but
instead nothing happen

I've attached a patch to this email which fixes this issue.

In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.35, cairo version 1.16.0) of 2022-12-15 built on vincent-laptop
Repository revision: fbf0d3b796ac1b891be35b642878a1fd412ee5ea
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version
11.0.12201005
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --prefix /tmp/emacs-29'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM GTK3
ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  blink-cursor-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-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 mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg
rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd 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 seq simple cl-generic
indonesian philippine 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
theme-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
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 38765 9013)
 (symbols 48 5124 0)
 (strings 32 13223 1378)
 (string-bytes 1 378252)
 (vectors 16 9327)
 (vector-slots 8 148424 13521)
 (floats 8 22 18)
 (intervals 56 369 2)
 (buffers 976 12))

diff --git a/lisp/eshell/em-elecslash.el b/lisp/eshell/em-elecslash.el
index 091acb9a86..63de9da679 100644
--- a/lisp/eshell/em-elecslash.el
+++ b/lisp/eshell/em-elecslash.el
@@ -74,8 +74,9 @@ eshell-electric-forward-slash
           (command (save-excursion
                      (eshell-bol)
                      (skip-syntax-forward " ")
-                     (thing-at-point 'sexp))))
-      (if (and (file-remote-p default-directory)
+                     (thing-at-point 'sexp)))
+          (prefix (file-remote-p default-directory)))
+      (if (and prefix
                ;; We can't formally parse the input.  But if there is
                ;; one of these operators behind us, then looking at
                ;; the first command would not be sensible.  So be
@@ -98,9 +99,7 @@ eshell-electric-forward-slash
                  (tramp-file-name-localname
                   (tramp-dissect-file-name default-directory))))
 	    (when tilde-before (delete-char -1))
-	    (insert
-             (substring default-directory 0
-                        (string-search localname default-directory)))
+	    (insert prefix)
 	    (unless tilde-before (insert "/"))
 	    ;; Typing a second slash undoes the insertion, for when
 	    ;; you really do want to type a local absolute file name.