discussion and development of Emacs Snakemake mode
 help / color / mirror / code / Atom feed
* shell/bash highlighting? (#25)
@ 2018-02-12  2:19 Elmar Pruesse
  2018-02-12  3:41 ` Kyle Meyer
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Elmar Pruesse @ 2018-02-12  2:19 UTC (permalink / raw)
  To: kyleam/snakemake-mode; +Cc: Subscribed

[-- Attachment #1: Type: text/plain, Size: 551 bytes --]

Since it's already supported for embedded R, any chance to do this for embedded bash?

It may make sense for not just the `shell:` field, but for all strings as they are likely to be passed through the shell at some point. Although that might be too slow, considering the number of small pieces.

Alternatively, highlighting the `{wildcard}` parts of the strings would be neat.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/25

[-- Attachment #2: Type: text/html, Size: 2115 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell/bash highlighting? (#25)
  2018-02-12  2:19 shell/bash highlighting? (#25) Elmar Pruesse
@ 2018-02-12  3:41 ` Kyle Meyer
  2018-02-12  8:46 ` Endre Bakken Stovner
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Kyle Meyer @ 2018-02-12  3:41 UTC (permalink / raw)
  To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Your activity

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

> Since it's already supported for embedded R, any chance to do this for embedded bash?

Thanks for the suggestion.  The thought hadn't occurred to me.  (Well,
the embedded R fontification didn't occur to me either.  @endrebak
added that feature.)

The R highlighting depends on finding triple quote markers like
`R("""`.  I'm not sure if doing that for a `shell: ".*` with mmm-mode
would be more complicated to handle or more expensive to process.
Worth looking into.

> Alternatively, highlighting the {wildcard} parts of the strings would be neat.

Yeah, I think that'd be nice to add.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/25#issuecomment-364822250

[-- Attachment #2: Type: text/html, Size: 3190 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell/bash highlighting? (#25)
  2018-02-12  2:19 shell/bash highlighting? (#25) Elmar Pruesse
  2018-02-12  3:41 ` Kyle Meyer
@ 2018-02-12  8:46 ` Endre Bakken Stovner
  2018-02-12  8:48 ` Endre Bakken Stovner
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Endre Bakken Stovner @ 2018-02-12  8:46 UTC (permalink / raw)
  To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Comment

[-- Attachment #1: Type: text/plain, Size: 504 bytes --]

This sounds like a good idea, but I do not use the R syntax highlighting anymore since using scripts or wrappers is recommended.

There were some hiccups mixing modes with mmm for me. R indentation in Snakemake buffers became weird for example. If you’ve had no problems using it you should attempt to implement this :)

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/25#issuecomment-364859637

[-- Attachment #2: Type: text/html, Size: 2402 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell/bash highlighting? (#25)
  2018-02-12  2:19 shell/bash highlighting? (#25) Elmar Pruesse
  2018-02-12  3:41 ` Kyle Meyer
  2018-02-12  8:46 ` Endre Bakken Stovner
@ 2018-02-12  8:48 ` Endre Bakken Stovner
  2018-02-12 20:44 ` Elmar Pruesse
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Endre Bakken Stovner @ 2018-02-12  8:48 UTC (permalink / raw)
  To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Comment

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

“It may make sense for not just the shell: field, but for all strings as they are likely to be passed through the shell at some point.”

This I do not understand? Shell highlighting for all strings?

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/25#issuecomment-364860085

[-- Attachment #2: Type: text/html, Size: 2164 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell/bash highlighting? (#25)
  2018-02-12  2:19 shell/bash highlighting? (#25) Elmar Pruesse
                   ` (2 preceding siblings ...)
  2018-02-12  8:48 ` Endre Bakken Stovner
@ 2018-02-12 20:44 ` Elmar Pruesse
  2018-02-13  1:32 ` Kyle Meyer
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Elmar Pruesse @ 2018-02-12 20:44 UTC (permalink / raw)
  To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Comment

[-- Attachment #1: Type: text/plain, Size: 871 bytes --]

> This I do not understand? Shell highlighting for all strings?

Yep :)

I tried implementing this with `polymode` a while back -- it sort of worked but was slow enough to be annoying, although that's perhaps my lack of skill with lisp. I eventually got stuck when I realized that the "bash parts" are actually "bash + python format mini language": the curly braces kept messing things up. Deriving  a python-string-shell-mode from shell-mode was beyond me.

Perhaps the low hanging fruit - just applying font locks to the python format mini language parts - would suffice. Although that one should probably just be implemented in python-mode? Curious that python-mode doesn't do that already...

-- 
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/25#issuecomment-365055718

[-- Attachment #2: Type: text/html, Size: 3223 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell/bash highlighting? (#25)
  2018-02-12  2:19 shell/bash highlighting? (#25) Elmar Pruesse
                   ` (3 preceding siblings ...)
  2018-02-12 20:44 ` Elmar Pruesse
@ 2018-02-13  1:32 ` Kyle Meyer
  2018-02-17  1:37 ` Kyle Meyer
  2020-04-13 23:52 ` Kyle Meyer
  6 siblings, 0 replies; 8+ messages in thread
From: Kyle Meyer @ 2018-02-13  1:32 UTC (permalink / raw)
  To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Your activity

[-- Attachment #1: Type: text/plain, Size: 2007 bytes --]

>> This I do not understand? Shell highlighting for all strings?
>
> Yep :)
>
> I tried implementing this with `polymode` a while back -- it sort of worked but was slow enough to be annoying, although that's perhaps my lack of skill with lisp. I eventually got stuck when I realized that the "bash parts" are actually "bash + python format mini language": the curly braces kept messing things up. Deriving  a python-string-shell-mode from shell-mode was beyond me.

I share @endrebak's confusion on the "all strings" bit.  It doesn't seem
like it'd be useful to highlight fields like input/output/threads as
bash.

> Perhaps the low hanging fruit - just applying font locks to the python
> format mini language parts - would suffice.

I see them as mostly orthogonal, at least in implementation.  The
mini-language parts would be highlighted via
snakemake-font-lock-keywords; the shell string would need mmm-mode (or
or another similar mode).  The mini-language parts would be highlighted
by default; for the shell string, users would have to install/activate
mmm-mode, like they now have to do for R bits, and I believe it'd
override any other fontification.

Anyway, I'll plan to add highlighting for at least some mini-language
parts.  For the shell mmm-mode stuff, I may find time to play around
with it (I don't use mmm-mode/wouldn't use this feature personally), but
I'd certainly welcome a PR adding it if you get something working
nicely.

> Although that one should probably just be implemented in python-mode? Curious that python-mode doesn't do that already...

Dunno.  I suppose I can't think of any programming modes that have
special fontification of formatting specs (e.g., emacs-lisp-mode:
(format "all string %s" "font")), but there are of course lots out
there, so there may be good examples.


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/25#issuecomment-365121740

[-- Attachment #2: Type: text/html, Size: 5754 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell/bash highlighting? (#25)
  2018-02-12  2:19 shell/bash highlighting? (#25) Elmar Pruesse
                   ` (4 preceding siblings ...)
  2018-02-13  1:32 ` Kyle Meyer
@ 2018-02-17  1:37 ` Kyle Meyer
  2020-04-13 23:52 ` Kyle Meyer
  6 siblings, 0 replies; 8+ messages in thread
From: Kyle Meyer @ 2018-02-17  1:37 UTC (permalink / raw)
  To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Your activity

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

OK, so I've played around with adding the different fontification for the minilanguage parts, and ... I really don't like it! :)  I think the thing is, my brain is so used to a break in the string fontfication signaling the end of a string, so all my strings just look broken.  Dunno, perhaps it's something I'd get used to.

To try this out yourself, you could do something like (changing `font-lock-variable-name-face` to whatever face you'd like):

```
(add-to-list 'snakemake-font-lock-keywords
             `("{[^}]+}" 0 font-lock-variable-name-face t))
```

What do others think?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/25#issuecomment-366404799

[-- Attachment #2: Type: text/html, Size: 3012 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: shell/bash highlighting? (#25)
  2018-02-12  2:19 shell/bash highlighting? (#25) Elmar Pruesse
                   ` (5 preceding siblings ...)
  2018-02-17  1:37 ` Kyle Meyer
@ 2020-04-13 23:52 ` Kyle Meyer
  6 siblings, 0 replies; 8+ messages in thread
From: Kyle Meyer @ 2020-04-13 23:52 UTC (permalink / raw)
  To: kyleam/snakemake-mode; +Cc: Kyle Meyer, Your activity

[-- Attachment #1: Type: text/plain, Size: 201 bytes --]

Closed #25.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kyleam/snakemake-mode/issues/25#event-3228955037

[-- Attachment #2: Type: text/html, Size: 1473 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-13 23:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12  2:19 shell/bash highlighting? (#25) Elmar Pruesse
2018-02-12  3:41 ` Kyle Meyer
2018-02-12  8:46 ` Endre Bakken Stovner
2018-02-12  8:48 ` Endre Bakken Stovner
2018-02-12 20:44 ` Elmar Pruesse
2018-02-13  1:32 ` Kyle Meyer
2018-02-17  1:37 ` Kyle Meyer
2020-04-13 23:52 ` Kyle Meyer

Code repositories for project(s) associated with this public inbox

	https://git.kyleam.com/snakemake-mode/

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).