* bug#12963: Fwd: Small modification to sh-script, to cover unsupported case label
[not found] <20121122155324.GC29552@ip-10-228-174-15.eu-west-1.compute.internal>
@ 2012-11-22 22:31 ` Daniel Pfeiffer
2012-11-23 2:16 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Pfeiffer @ 2012-11-22 22:31 UTC (permalink / raw)
To: 12963; +Cc: Ivan Kelly
[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]
-------- Original Message --------
Subject: Small modification to sh-script, to cover unsupported case label
Date: Thu, 22 Nov 2012 15:53:25 +0000
From: Ivan Kelly <ivan@ivankelly.net>
To: Daniel Pfeiffer <occitan@esperanto.org>
Hi,
I ran into an issue with the sh-mode today with case labels.
case $X in
foo)
do_something
;;
arg=*)
do_something_else_based_on_arg
;;
*)
default
;;
esac
Indention will mess up on the second label, due to the =
This can be fixed by adding a = to the skip-chars-backwards in
sh-font-lock-parens;
i.e.
(defun sh-font-lock-paren (start)
(save-excursion
(goto-char start)
;; Skip through all patterns
(while
(progn
(forward-comment (- (point-max)))
;; Skip through one pattern
(while
(or (/= 0 (skip-syntax-backward "w_"))
(/= 0 (skip-chars-backward "?[]*@/\\="))
(and (sh-is-quoted-p (1- (point)))
...
Also, I'm finding indent-tabs-mode is being reset by sh-mode. Do you
know what could be causing this?
Regards
Ivan
[-- Attachment #2: Type: text/html, Size: 2202 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#12963: Fwd: Small modification to sh-script, to cover unsupported case label
2012-11-22 22:31 ` bug#12963: Fwd: Small modification to sh-script, to cover unsupported case label Daniel Pfeiffer
@ 2012-11-23 2:16 ` Stefan Monnier
2012-11-23 9:04 ` Ivan Kelly
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-11-23 2:16 UTC (permalink / raw)
To: occitan; +Cc: Ivan Kelly, 12963
> Indention will mess up on the second label, due to the =
> This can be fixed by adding a = to the skip-chars-backwards in
> sh-font-lock-parens;
This already works correctly in Emacs-24, so I suggest you upgrade.
> Also, I'm finding indent-tabs-mode is being reset by sh-mode. Do you
> know what could be causing this?
AFAICT sh-script.el does not touch indent-tabs-mode (neither the most
recent version, nor the version in Emacs-23). But I'm not exactly sure
what you mean by "being reset".
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#12963: Fwd: Small modification to sh-script, to cover unsupported case label
2012-11-23 2:16 ` Stefan Monnier
@ 2012-11-23 9:04 ` Ivan Kelly
2012-11-23 15:53 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Ivan Kelly @ 2012-11-23 9:04 UTC (permalink / raw)
To: Stefan Monnier; +Cc: occitan, 12963
On Thu, Nov 22, 2012 at 09:16:48PM -0500, Stefan Monnier wrote:
> > Indention will mess up on the second label, due to the =
> > This can be fixed by adding a = to the skip-chars-backwards in
> > sh-font-lock-parens;
>
> This already works correctly in Emacs-24, so I suggest you upgrade.
Ah ok, I'm using Emacs-23 here, and was pulling trunk from bzr but it
was taking a long time, so I just decided to email the fix.
>
> > Also, I'm finding indent-tabs-mode is being reset by sh-mode. Do you
> > know what could be causing this?
>
> AFAICT sh-script.el does not touch indent-tabs-mode (neither the most
> recent version, nor the version in Emacs-23). But I'm not exactly sure
> what you mean by "being reset".
By being reset, I mean I have a hook
(add-hook 'sh-mode-hook '(lambda () (setq indent-tabs-mode nil)))
I open a sh file, and when I look at the value of indent-tabs-mode,
it's t.
It may be something else that's borking it, but it works fine in other
modes (java, c++). Is there a way to instrument a variable so that I
can see when it gets changed?
-Ivan
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#12963: Fwd: Small modification to sh-script, to cover unsupported case label
2012-11-23 9:04 ` Ivan Kelly
@ 2012-11-23 15:53 ` Stefan Monnier
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2012-11-23 15:53 UTC (permalink / raw)
To: Ivan Kelly; +Cc: occitan, 12963
> By being reset, I mean I have a hook
> (add-hook 'sh-mode-hook '(lambda () (setq indent-tabs-mode nil)))
> I open a sh file, and when I look at the value of indent-tabs-mode,
> it's t.
I just tried
% emacs23 -Q --eval "(add-hook 'sh-mode-hook (lambda () (setq indent-tabs-mode nil)))" test/indent/shell.sh
and C-h v indent-tabs-mode tells me it's nil in this buffer.
I suggest you add a (message "here I am") inside the above lambda (and
I also suggest you don't quote your lambdas with "'") to make sure it's
actually run.
> It may be something else that's borking it, but it works fine in other
> modes (java, c++). Is there a way to instrument a variable so that I
> can see when it gets changed?
No, but a binary search in your .emacs should quickly find the culprit.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-11-23 15:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20121122155324.GC29552@ip-10-228-174-15.eu-west-1.compute.internal>
2012-11-22 22:31 ` bug#12963: Fwd: Small modification to sh-script, to cover unsupported case label Daniel Pfeiffer
2012-11-23 2:16 ` Stefan Monnier
2012-11-23 9:04 ` Ivan Kelly
2012-11-23 15:53 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).