GNU bug report logs -
#25585
25.1; shell-script mode not providing proper support for finding variables at point
Previous Next
Reported by: Bob Hepple <bob.hepple <at> gmail.com>
Date: Tue, 31 Jan 2017 00:40:01 UTC
Severity: normal
Tags: patch
Found in version 25.1
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25585 in the body.
You can then email your comments to 25585 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25585
; Package
emacs
.
(Tue, 31 Jan 2017 00:40:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Bob Hepple <bob.hepple <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 31 Jan 2017 00:40:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
One of the GNU Emacs maintainers eli-zaretski suggested that I post my
problem as a bug report:
https://www.reddit.com/r/emacs/comments/5qz6en/ctags_and_bash/:
'Report a bug against Shell-script Mode. It sounds like it doesn't
define proper support for finding variables at point, so xref uses a
generic facility, which is only mostly correct in this case.'
My original problem is as follows: (confirm that it also fails with emacs
-Q):
So I've now got ctags(1) to understand bash variables as well as
functions.
Now I can jump to the defining location with M-. (ref-find-definitions)-
all fine and dandy.
The only fly in the ointment is that when a bash variable is
concatenated with literal text, M-. wants to look for the entire text.
eg if I M-. on the variable in:
$foobar/bar/foo
... then it wants to search for foobar/bar/foo instead of just foobar.
It wouldn't be so bad if I could repeat-complex-command and edit the
search string but M-. doesn't appear to push the command there.
Short of re-writing all the code as "$foobar"/bar/foo is there something
I can set to fix this?
In case it's interesting, this is how I build TAGS:
DIRS=(
dir1
dir2
)
ctags_opts='--regex-sh=/^[ \t]*(local|export|declare)?[
\t]*([A-Za-z0-9_-]+)=/\2/v,variable,variables/'
find ${DIRS[@]} -name .svn -prune -o -print | while read F; do
file -i "$F" | egrep -q 'shellscript|text/plain' && ctags -e
--languages=sh -a "$ctags_opts" "$F"
done
In GNU Emacs 25.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.20.9)
of 2016-10-13 built on buildvm-05.phx2.fedoraproject.org
Windowing system distributor 'Fedora Project', version 11.0.11804000
System Description: Fedora release 24 (Twenty Four)
Configured using:
'configure --build=x86_64-redhat-linux-gnu
--host=x86_64-redhat-linux-gnu --program-prefix=
--disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
--datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
--libexecdir=/usr/libexec --localstatedir=/var
--sharedstatedir=/var/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
--with-rsvg --with-tiff --with-xft --with-xpm --with-x-toolkit=gtk3
--with-gpm=no --with-xwidgets build_alias=x86_64-redhat-linux-gnu
host_alias=x86_64-redhat-linux-gnu 'CFLAGS=-DMAIL_USE_LOCKF -O2 -g
-pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-m64 -mtune=generic' LDFLAGS=-Wl,-z,relro
PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig'
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XWIDGETS
Important settings:
value of $LC_ALL: en_AU.utf8
value of $LANG: C
locale-coding-system: utf-8-unix
Major mode: Help
Minor modes in effect:
global-flycheck-mode: t
helm-mode: t
shell-dirtrack-mode: t
async-bytecomp-package-mode: t
diff-auto-refine-mode: t
delete-selection-mode: t
show-paren-mode: t
recentf-mode: t
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-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
buffer-read-only: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent messages:
Setting up indent for shell type bash
Indentation variables are now local.
Indentation setup for shell type bash
ARCH appears unused. Verify it or export it. [SC2034]
Setting up indent for shell type sh
Indentation variables are now local.
Indentation setup for shell type sh
TARGET_ARCH appears unused. Verify it or export it. [SC2034] [3 times]
Type C-x 4 C-o RET to restore the other window.
Type "q" to restore previous buffer.
Load-path shadows:
/usr/share/emacs/site-lisp/gnus-bonus/nnir hides
/usr/share/emacs/25.1/lisp/gnus/nnir
/usr/share/emacs/site-lisp/gnus-bonus/nnnil hides
/usr/share/emacs/25.1/lisp/gnus/nnnil
/usr/share/emacs/site-lisp/gnus-bonus/spam-stat hides
/usr/share/emacs/25.1/lisp/gnus/spam-stat
/usr/share/emacs/site-lisp/goodies/browse-kill-ring hides
~/.config/emacs/browse-kill-ring
/usr/share/emacs/25.1/lisp/vc/vc-svn hides ~/.config/emacs/vc-svn
Features:
(shadow sort mail-extr emacsbug sendmail warnings apropos jka-compr
helm-command helm-elisp helm-eval edebug eieio-opt dabbrev pulse
ibuf-ext ibuffer locate find-dired ido winner grep etags xref project
misearch multi-isearch vc-svn hideshow sh-script smie executable
flycheck json map find-func subr-x dash indent-tools yafolding hydra lv
indent-tools-indentation-of helm-mode helm-files rx image-dired tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
dired-x dired-aux ffap thingatpt helm-buffers helm-elscreen helm-tags
helm-bookmark helm-adaptive helm-info bookmark helm-locate helm-grep
helm-regexp helm-external helm-net browse-url xml url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util url-parse auth-source url-vars mailcap helm-utils compile
comint ansi-color helm-help helm-types helm-config helm-easymenu
async-bytecomp async helm helm-source cl-seq eieio-compat eieio
eieio-core helm-multi-match helm-lib finder-inf info package seq
browse-kill-ring hide-comnt psvn byte-opt bytecomp byte-compile cl-extra
cconv advice derived edmacro kmacro cl-macs cl gv log-edit message idna
format-spec rfc822 mml mml-sec password-cache epg epg-config gnus-util
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mm-util help-fns help-mode mail-prsvr mailabbrev mail-utils
gmm-utils mailheader ring pcvs-util add-log diff-mode pp elp ediff-merg
ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util dired
highline speedbar sb-image ezimage dframe ps-ccrypt delsel server paren
recentf tree-widget wid-edit xcscope easymenu vc cl-loaddefs pcase
cl-lib vc-dispatcher emacs-goodies-loaddefs easy-mmode time-date
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame 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 charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded 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 dbusbind inotify dynamic-setting
system-font-setting font-render-setting xwidget-internal move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 526407 64788)
(symbols 48 40045 0)
(miscs 40 3384 1255)
(strings 32 86658 8760)
(string-bytes 1 2653873)
(vectors 16 61835)
(vector-slots 8 1055224 27352)
(floats 8 479 585)
(intervals 56 17632 351)
(buffers 976 59)
(heap 1024 153739 47906))
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25585
; Package
emacs
.
(Wed, 01 Feb 2017 23:33:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 25585 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This patch (suggested by https://reddit.com/u/hvis) works for me ...
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index a0bbf55..dc296a2 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -483,6 +483,7 @@ sh-mode-syntax-table
?~ "_"
?, "_"
?= "."
+ ?/ "."
?\; "."
?| "."
?& "."
[Message part 2 (text/html, inline)]
Added tag(s) patch.
Request was from
Stefan Kangas <stefan <at> marxist.se>
to
control <at> debbugs.gnu.org
.
(Tue, 11 Aug 2020 08:01:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25585
; Package
emacs
.
(Wed, 19 Aug 2020 11:50:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 25585 <at> debbugs.gnu.org (full text, mbox):
Bob Hepple <bob.hepple <at> gmail.com> writes:
> This patch (suggested by https://reddit.com/u/hvis) works for me ...
>
> diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
>
> index a0bbf55..dc296a2 100644
> --- a/lisp/progmodes/sh-script.el
> +++ b/lisp/progmodes/sh-script.el
> @@ -483,6 +483,7 @@ sh-mode-syntax-table
> ?~ "_"
> ?, "_"
> ?= "."
> + ?/ "."
> ?\; "."
> ?| "."
> ?& "."
I've respun the patch below...
So this would change the / character into a punctuation character in
shell buffers? It fixes the reported problem, and it does seem
reasonable to have / classified like that.
Does anybody object to applying this patch? There may be unwanted side
effects...
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 5a47594878..8cd3aad268 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -386,6 +386,7 @@ sh-mode-syntax-table
?~ "_"
?, "_"
?= "."
+ ?/ "."
?\; "."
?| "."
?& "."
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25585
; Package
emacs
.
(Wed, 19 Aug 2020 12:01:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 25585 <at> debbugs.gnu.org (full text, mbox):
On 19.08.2020 14:49, Lars Ingebrigtsen wrote:
> Does anybody object to applying this patch? There may be unwanted side
> effects...
I object to the use of tab character for indentation in a newly added
line. ;-)
That patch was from me, BTW.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25585
; Package
emacs
.
(Wed, 19 Aug 2020 12:08:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 25585 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dgutov <at> yandex.ru> writes:
> On 19.08.2020 14:49, Lars Ingebrigtsen wrote:
>> Does anybody object to applying this patch? There may be unwanted side
>> effects...
>
> I object to the use of tab character for indentation in a newly added
> line. ;-)
And I worked to hard on "fixing" the patch to match the surrounding
lines! :-)
> That patch was from me, BTW.
Oh, sorry. Didn't follow the link.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25585
; Package
emacs
.
(Wed, 19 Aug 2020 12:13:02 GMT)
Full text and
rfc822 format available.
Message #22 received at 25585 <at> debbugs.gnu.org (full text, mbox):
On 19.08.2020 15:07, Lars Ingebrigtsen wrote:
> And I worked to hard on "fixing" the patch to match the surrounding
> lines!:-)
We either hope the indentation converges on one style over the years, or
keep islands of consistent styling (which will break at the edges
anyway). Can't have both.
> Oh, sorry. Didn't follow the link.
It was under a pseudonym anyway.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#25585
; Package
emacs
.
(Fri, 02 Oct 2020 05:14:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 25585 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> Does anybody object to applying this patch? There may be unwanted side
> effects...
>
> diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
> index 5a47594878..8cd3aad268 100644
> --- a/lisp/progmodes/sh-script.el
> +++ b/lisp/progmodes/sh-script.el
> @@ -386,6 +386,7 @@ sh-mode-syntax-table
> ?~ "_"
> ?, "_"
> ?= "."
> + ?/ "."
> ?\; "."
> ?| "."
> ?& "."
No objections (except the indentation), so I went ahead and pushed this
to Emacs 28. If there are regressions, we'll have to revert.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug marked as fixed in version 28.1, send any further explanations to
25585 <at> debbugs.gnu.org and Bob Hepple <bob.hepple <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Fri, 02 Oct 2020 05:14:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 30 Oct 2020 11:24:13 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 248 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.