GNU bug report logs -
#36103
24.5; Blank spaces around parentheses in history expansion in shell mode
Previous Next
To reply to this bug, email your comments to 36103 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36103
; Package
emacs
.
(Wed, 05 Jun 2019 14:42:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Enric Rodríguez Carbonell <erodri <at> cs.upc.edu>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 05 Jun 2019 14:42:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
I would like to report what I think is a bug in the history expansion in
shell mode.
This is the sequence of steps:
$ emacs -Q
Once in emacs:
M-x shell
Then I type in the command line of the shell window:
$ for file in $(ls); do echo $file; done
Then I type at the prompt:
$ !for
and then run command:
M-x comint-replace-by-expanded-history
which replaces the
$ !for
by
$ for file in $ ( ls ) ; do echo $file ; done
The blank spaces around the parentheses should not be there.
Because of these blank spaces, this command cannot be executed,
as "$ (" should be "$(".
Best regards,
Enric
****************************************************************
In GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
of 2017-09-20 on lcy01-07, modified by Debian
Windowing system distributor `The X.Org Foundation', version 11.0.11804000
System Description: Ubuntu 16.04.6 LTS
Configured using:
`configure --build x86_64-linux-gnu --prefix=/usr
--sharedstatedir=/var/lib --libexecdir=/usr/lib
--localstatedir=/var/lib --infodir=/usr/share/info
--mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
--build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
--libexecdir=/usr/lib --localstatedir=/var/lib
--infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
--enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.5/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.5/site-lisp:/usr/share/emacs/site-lisp
--with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
'CFLAGS=-g -O2 -fstack-protector-strong -Wformat
-Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
-D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro''
Important settings:
value of $LC_MONETARY: es_ES.UTF-8
value of $LC_NUMERIC: es_ES.UTF-8
value of $LC_TIME: es_ES.UTF-8
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8-unix
Major mode: Shell
Minor modes in effect:
shell-dirtrack-mode: t
tooltip-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
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
History item: 1
Load-path shadows:
None found.
Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils shell pcomplete comint ansi-color
ring time-date tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt
fringe tabulated-list newcomment lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
gfilenotify dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty emacs)
Memory information:
((conses 16 75917 7030)
(symbols 48 18019 0)
(miscs 40 45 149)
(strings 32 11232 4144)
(string-bytes 1 311767)
(vectors 16 9670)
(vector-slots 8 389946 11489)
(floats 8 63 219)
(intervals 56 308 19)
(buffers 960 12)
(heap 1024 16912 853))
--
_______________________________________
Enric Rodriguez Carbonell
Technical University of Catalonia (UPC)
www.cs.upc.edu/~erodri
+34-93-4137815
Office 113 - Omega Building
Department of Computer Science (CS)
Jordi Girona 1, 08034 Barcelona, Spain
_______________________________________
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36103
; Package
emacs
.
(Thu, 06 Jun 2019 01:03:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 36103 <at> debbugs.gnu.org (full text, mbox):
merge 36103 8027
quit
Enric Rodríguez Carbonell <erodri <at> cs.upc.edu> writes:
> $ for file in $(ls); do echo $file; done
> $ !for
> M-x comint-replace-by-expanded-history
> $ for file in $ ( ls ) ; do echo $file ; done
>
> The blank spaces around the parentheses should not be there.
> Because of these blank spaces, this command cannot be executed,
> as "$ (" should be "$(".
Yes, the problem is in comint-arguments which attempts to parse a shell
line into separate arguments, using just a bunch of regexps. This is
doomed to failure I think. But the alternative would be a full blown
shell parser, so I don't know how feasible it will be to fix this bug.
It's been with us a long time.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36103
; Package
emacs
.
(Sun, 08 May 2022 14:02:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 36103 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
relson <at> osage writes:
> Within an emacs bash shell, using "!!" to re-execute a command with
> "$( ... )" in it results in a space inserted between the dollar sign
> and the left paren. The inserted space should _not_ be present.
(I'm going through old bug reports that unfortunately weren't resolved
at the time.)
I'm unable to reproduce this in any Emacs versions I have (Emacs 25.1
and up):
[Message part 2 (image/png, inline)]
[Message part 3 (text/plain, inline)]
Are you still seeing this problem in recent Emacs versions?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36103
; Package
emacs
.
(Tue, 03 Oct 2023 10:56:01 GMT)
Full text and
rfc822 format available.
Message #16 received at 36103 <at> debbugs.gnu.org (full text, mbox):
Noam Postavsky <npostavs <at> gmail.com> writes:
> Enric Rodríguez Carbonell <erodri <at> cs.upc.edu> writes:
>
>> $ for file in $(ls); do echo $file; done
>
>> $ !for
>
>> M-x comint-replace-by-expanded-history
>
>> $ for file in $ ( ls ) ; do echo $file ; done
>>
>> The blank spaces around the parentheses should not be there.
>> Because of these blank spaces, this command cannot be executed,
>> as "$ (" should be "$(".
>
> Yes, the problem is in comint-arguments which attempts to parse a shell
> line into separate arguments, using just a bunch of regexps. This is
> doomed to failure I think. But the alternative would be a full blown
> shell parser, so I don't know how feasible it will be to fix this bug.
> It's been with us a long time.
I just wanted to point out that since we now have treesitter support for
bash, this bug might be easier to fix, at least partially...
A first idea (trying to be backward-compatible and non-intrusive) is to
define a new variable, comint-arguments-function, turn the current
comint-arguments function into a comint-arguments-default function, and
set comint-arguments-function to that by default. From now on,
comint-arguments would just call the comint-arguments-function and
return whatever that returns.
Then, shell.el can set comint-arguments-function to a new function,
that, if there is treesitter support for the program being run by shell
(bash or sh, AFAICS), tries to do a better job than comint-arguments as
of now. If there's no treesitter support, or something fails, then it
can just punt to comint-arguments-default-function.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36103
; Package
emacs
.
(Sat, 07 Oct 2023 13:41:02 GMT)
Full text and
rfc822 format available.
Message #19 received at 36103 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Here's a draft of my idea.
[0001-Give-comint-derived-modes-a-way-to-specialize-comint.patch (text/x-patch, attachment)]
This bug report was last modified 1 year and 249 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.