From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Dario Gjorgjevski <dario.gjorgjevski@gmail.com>,
Stefan Monnier <monnier@iro.umontreal.ca>,
44592@debbugs.gnu.org
Subject: bug#44592: In sh-script-mode, should the syntax of . and / be made symbol?
Date: Sat, 28 Aug 2021 11:44:59 +0200 [thread overview]
Message-ID: <87zgt1ucmc.fsf@gmail.com> (raw)
In-Reply-To: <87fsuun7bj.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 27 Aug 2021 19:09:04 +0200")
[-- Attachment #1: Type: text/plain, Size: 555 bytes --]
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I've now applied Dario's change to Emacs 28 (and added a test case).
I wonder, would it make sense to also add ){ and (} to handle cases with
${braces}? E.g. I'd like this indentation:
${path_to_root}/configure --prefix=$prefix\
--with-x
but right now (55e77a811) I am getting this:
${path_to_root}/configure --prefix=$prefix\
--with-x
I'm don't know all that much about syntax classes and SMIE; still,
here's a "monkey see; monkey do" patch that works for me:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: further.patch --]
[-- Type: text/x-patch, Size: 1468 bytes --]
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 201d1fd164..2d095c2a13 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1775,7 +1775,7 @@ sh-smie--default-backward-token
(goto-char p)
nil))))
(while
- (progn (skip-syntax-backward ".w_'")
+ (progn (skip-syntax-backward ".w_'){(}")
(or (not (zerop (skip-syntax-backward "\\")))
(when (eq ?\\ (char-before (1- (point))))
(let ((p (point)))
diff --git a/test/lisp/progmodes/sh-script-tests.el b/test/lisp/progmodes/sh-script-tests.el
index 5bdce6260a..82c2d5168c 100644
--- a/test/lisp/progmodes/sh-script-tests.el
+++ b/test/lisp/progmodes/sh-script-tests.el
@@ -35,6 +35,17 @@ test-sh-script-indentation
(should (equal
(buffer-substring-no-properties (point-min) (point-max))
"relative-path/to/configure --prefix=$prefix\\
- --with-x"))))
+ --with-x")))
+ (with-temp-buffer
+ (insert "${path_to_root}/configure --prefix=$prefix\\
+ --with-x")
+ (shell-script-mode)
+ (goto-char (point-min))
+ (forward-line 1)
+ (indent-for-tab-command)
+ (should (equal
+ (buffer-substring-no-properties (point-min) (point-max))
+ "${path_to_root}/configure --prefix=$prefix\\
+ --with-x"))))
;;; sh-script-tests.el ends here
next prev parent reply other threads:[~2021-08-28 9:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-12 13:49 bug#44592: In sh-script-mode, should the syntax of . and / be made symbol? Dario Gjorgjevski
2020-11-14 16:44 ` Lars Ingebrigtsen
2020-12-23 16:05 ` Dario Gjorgjevski
2020-12-23 22:24 ` Lars Ingebrigtsen
2020-12-24 3:59 ` Stefan Monnier
2021-08-27 17:09 ` Lars Ingebrigtsen
2021-08-28 9:44 ` Kévin Le Gouguec [this message]
2021-08-29 18:29 ` Lars Ingebrigtsen
2021-08-29 21:22 ` Kévin Le Gouguec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zgt1ucmc.fsf@gmail.com \
--to=kevin.legouguec@gmail.com \
--cc=44592@debbugs.gnu.org \
--cc=dario.gjorgjevski@gmail.com \
--cc=larsi@gnus.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.