* char syntax of the $ in $var
@ 2005-03-22 23:03 David Hansen
2005-03-23 0:05 ` Miles Bader
0 siblings, 1 reply; 5+ messages in thread
From: David Hansen @ 2005-03-22 23:03 UTC (permalink / raw)
Hello,
in sh-mode: the $ in $test has syntax 2 = word in perl-mode
syntax 10 = character quote and in cperl-mode it's 9 = escape.
I think it should at least be unique (I prefer the sh-mode
version as you can move the point across variables with M-f and
M-b).
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: char syntax of the $ in $var
2005-03-22 23:03 char syntax of the $ in $var David Hansen
@ 2005-03-23 0:05 ` Miles Bader
2005-03-23 0:43 ` David Hansen
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Miles Bader @ 2005-03-23 0:05 UTC (permalink / raw)
On Wed, 23 Mar 2005 00:03:51 +0100, David Hansen <david.hansen@gmx.net> wrote:
> in sh-mode: the $ in $test has syntax 2 = word in perl-mode
> syntax 10 = character quote and in cperl-mode it's 9 = escape.
>
> I think it should at least be unique (I prefer the sh-mode
> version as you can move the point across variables with M-f and
> M-b).
Perl and sh are not identical in the way they treat the "$" in
variable names -- indeed it seems that the current state of things is
_backwards_: In sh, the $ is not really part of the name, so having
emacs think it is can be quite annoying (the case that drives me nuts
is that dynamic-abbrev won't complete `$FO' based on a previous
`FOO_BAR=...'); this argues for giving the $ a non-word syntax. In
perl, on the other hand, the $ is treated much more as if it's
actually part of the variable name (e.g., you write `$foo = 3'), so
giving the $ word syntax might the right thing to do for perl.
-Miles
--
Do not taunt Happy Fun Ball.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: char syntax of the $ in $var
2005-03-23 0:05 ` Miles Bader
@ 2005-03-23 0:43 ` David Hansen
2005-03-23 9:57 ` Kim F. Storm
2005-03-23 13:27 ` Stefan
2 siblings, 0 replies; 5+ messages in thread
From: David Hansen @ 2005-03-23 0:43 UTC (permalink / raw)
On Wed, 23 Mar 2005 09:05:18 +0900 Miles Bader wrote:
> On Wed, 23 Mar 2005 00:03:51 +0100, David Hansen wrote:
>> in sh-mode: the $ in $test has syntax 2 = word in perl-mode
>> syntax 10 = character quote and in cperl-mode it's 9 = escape.
>>
> In sh, the $ is not really part of the name, so having emacs
> think it is can be quite annoying (the case that drives me nuts
> is that dynamic-abbrev won't complete `$FO' based on a previous
> `FOO_BAR=...'); this argues for giving the $ a non-word syntax.
Sounds reasonable.
> In perl, on the other hand, the $ is treated much more as if
> it's actually part of the variable name (e.g., you write `$foo
> = 3'), so giving the $ word syntax might the right thing to do
> for perl.
You'll run into the same completion problems with e.g %foo and
$foo{'bar'}. So probably all non-word syntax...
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: char syntax of the $ in $var
2005-03-23 0:05 ` Miles Bader
2005-03-23 0:43 ` David Hansen
@ 2005-03-23 9:57 ` Kim F. Storm
2005-03-23 13:27 ` Stefan
2 siblings, 0 replies; 5+ messages in thread
From: Kim F. Storm @ 2005-03-23 9:57 UTC (permalink / raw)
Cc: emacs-devel, miles
Miles Bader <snogglethorpe@gmail.com> writes:
> In sh, the $ is not really part of the name, so having
> emacs think it is can be quite annoying (the case that drives me nuts
> is that dynamic-abbrev won't complete `$FO' based on a previous
> `FOO_BAR=...'); this argues for giving the $ a non-word syntax.
Agree 100%.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: char syntax of the $ in $var
2005-03-23 0:05 ` Miles Bader
2005-03-23 0:43 ` David Hansen
2005-03-23 9:57 ` Kim F. Storm
@ 2005-03-23 13:27 ` Stefan
2 siblings, 0 replies; 5+ messages in thread
From: Stefan @ 2005-03-23 13:27 UTC (permalink / raw)
Cc: emacs-devel, miles
>> in sh-mode: the $ in $test has syntax 2 = word in perl-mode
>> syntax 10 = character quote and in cperl-mode it's 9 = escape.
>>
>> I think it should at least be unique (I prefer the sh-mode
>> version as you can move the point across variables with M-f and M-b).
I decided the quote syntax for perl-mode, so I'm biased. But in any case
word-syntax for $ is wrong, just like it is wrong for _ or - or any other
non-alphabetic char. Strangely, tho, $ has word syntax in fundamental mode
(which is from where sh-script inherits it, oddly enough). Shouldn't it be
changed to quote syntax or symbol syntax (in fundamental-mode)?
In general, in Perl, $ plays many different roles and it should sometimes
have word/symbol/quote syntax, sometimes have escape syntax, perl-mode and
cperl-mode chose different defaults, and then tweak them on a case by case
basis with font-lock-syntactic-keywords.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-03-23 13:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-22 23:03 char syntax of the $ in $var David Hansen
2005-03-23 0:05 ` Miles Bader
2005-03-23 0:43 ` David Hansen
2005-03-23 9:57 ` Kim F. Storm
2005-03-23 13:27 ` Stefan
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.