* sh mode for region only ?
@ 2012-05-09 13:25 Alexandre Oberlin
2012-05-09 13:40 ` XeCycle
` (4 more replies)
0 siblings, 5 replies; 19+ messages in thread
From: Alexandre Oberlin @ 2012-05-09 13:25 UTC (permalink / raw)
To: help-gnu-emacs
Hi all,
Is there a possibility to benefit of sh (or whatever) syntax
highlighting on a region only?
This could be useful when editing a list of instructions containing codes.
Alexandre
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 13:25 sh mode for region only ? Alexandre Oberlin
@ 2012-05-09 13:40 ` XeCycle
2012-05-09 14:04 ` Richard Riley
2012-05-09 14:19 ` Doug Lewan
` (3 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: XeCycle @ 2012-05-09 13:40 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 458 bytes --]
Alexandre Oberlin <please@nospam.com> writes:
> Hi all,
>
> Is there a possibility to benefit of sh (or whatever) syntax
> highlighting on a region only?
>
> This could be useful when editing a list of instructions containing codes.
C-x n n
Or a more complex C-x 4 c.
--
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 13:40 ` XeCycle
@ 2012-05-09 14:04 ` Richard Riley
2012-05-09 14:32 ` XeCycle
0 siblings, 1 reply; 19+ messages in thread
From: Richard Riley @ 2012-05-09 14:04 UTC (permalink / raw)
To: help-gnu-emacs
XeCycle <XeCycle@Gmail.com> writes:
> Alexandre Oberlin <please@nospam.com> writes:
>
>> Hi all,
>>
>> Is there a possibility to benefit of sh (or whatever) syntax
>> highlighting on a region only?
>>
>> This could be useful when editing a list of instructions containing codes.
>
> C-x n n
>
> Or a more complex C-x 4 c.
How does that address the question? Is there some way to then have it
auto mode to the correct syntax hiliting in the narrowed region?
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 14:19 ` Doug Lewan
@ 2012-05-09 14:19 ` Richard Riley
2012-05-09 14:56 ` Doug Lewan
[not found] ` <mailman.850.1336573196.855.help-gnu-emacs@gnu.org>
1 sibling, 1 reply; 19+ messages in thread
From: Richard Riley @ 2012-05-09 14:19 UTC (permalink / raw)
To: help-gnu-emacs
Doug Lewan <dougl@shubertticketing.com> writes:
> At my last job I had to work with HTML that was heavily laden with JavaScript, so something similar was very useful for me.
> I wrote a post-command-hook to see if the point had moved into a region of JavaScript and, if it had, then change to JavaScript mode.
>
> If your regions of shell code have reasonably consistent delimiters, then doing the same thing should not be too difficult.
>
> ,Doug
nxhtml might be good for you too.
>
>> -----Original Message-----
>> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
>> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
>> Behalf Of Alexandre Oberlin
>> Sent: Wednesday, 2012 May 09 09:26
>> To: help-gnu-emacs@gnu.org
>> Subject: sh mode for region only ?
>>
>> Hi all,
>>
>> Is there a possibility to benefit of sh (or whatever) syntax
>> highlighting on a region only?
>>
>> This could be useful when editing a list of instructions containing
>> codes.
>>
>> Alexandre
>>
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: sh mode for region only ?
2012-05-09 13:25 sh mode for region only ? Alexandre Oberlin
2012-05-09 13:40 ` XeCycle
@ 2012-05-09 14:19 ` Doug Lewan
2012-05-09 14:19 ` Richard Riley
[not found] ` <mailman.850.1336573196.855.help-gnu-emacs@gnu.org>
[not found] ` <mailman.847.1336571158.855.help-gnu-emacs@gnu.org>
` (2 subsequent siblings)
4 siblings, 2 replies; 19+ messages in thread
From: Doug Lewan @ 2012-05-09 14:19 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
At my last job I had to work with HTML that was heavily laden with JavaScript, so something similar was very useful for me.
I wrote a post-command-hook to see if the point had moved into a region of JavaScript and, if it had, then change to JavaScript mode.
If your regions of shell code have reasonably consistent delimiters, then doing the same thing should not be too difficult.
,Doug
> -----Original Message-----
> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
> Behalf Of Alexandre Oberlin
> Sent: Wednesday, 2012 May 09 09:26
> To: help-gnu-emacs@gnu.org
> Subject: sh mode for region only ?
>
> Hi all,
>
> Is there a possibility to benefit of sh (or whatever) syntax
> highlighting on a region only?
>
> This could be useful when editing a list of instructions containing
> codes.
>
> Alexandre
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 14:04 ` Richard Riley
@ 2012-05-09 14:32 ` XeCycle
0 siblings, 0 replies; 19+ messages in thread
From: XeCycle @ 2012-05-09 14:32 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 816 bytes --]
Richard Riley <rileyrg@gmail.com> writes:
> XeCycle <XeCycle@Gmail.com> writes:
>
>> Alexandre Oberlin <please@nospam.com> writes:
>>
>>> Hi all,
>>>
>>> Is there a possibility to benefit of sh (or whatever) syntax
>>> highlighting on a region only?
>>>
>>> This could be useful when editing a list of instructions containing codes.
>>
>> C-x n n
>>
>> Or a more complex C-x 4 c.
>
> How does that address the question? Is there some way to then have it
> auto mode to the correct syntax hiliting in the narrowed region?
Of course you can do something to narrow functions, but running
them manually is not very hard.
--
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
[not found] ` <mailman.847.1336571158.855.help-gnu-emacs@gnu.org>
@ 2012-05-09 14:55 ` Alexandre Oberlin
2012-05-10 3:44 ` XeCycle
[not found] ` <mailman.878.1336621531.855.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 19+ messages in thread
From: Alexandre Oberlin @ 2012-05-09 14:55 UTC (permalink / raw)
To: help-gnu-emacs
Thanks for your suggestion.
I tried to check if one of those solutions would work at least while
editing but none does. Actually in the narrowed region or cloned buffer
the syntax highlighting seems to take into account the unseen text to
set the highlighting. I need to copy the sh region to a new file to get
the correct syntax highlighting.
Alexandre
( On 05/09/2012 03:40 PM, XeCycle wrote:
> Alexandre Oberlin<please@nospam.com> writes:
>
>> Hi all,
>>
>> Is there a possibility to benefit of sh (or whatever) syntax
>> highlighting on a region only?
>>
>> This could be useful when editing a list of instructions containing codes.
>
> C-x n n
>
> Or a more complex C-x 4 c.
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* RE: sh mode for region only ?
2012-05-09 14:19 ` Richard Riley
@ 2012-05-09 14:56 ` Doug Lewan
0 siblings, 0 replies; 19+ messages in thread
From: Doug Lewan @ 2012-05-09 14:56 UTC (permalink / raw)
To: help-gnu-emacs@gnu.org
Well, dang!
Gotta love emacs. If you need something, someone else has almost certainly thought of it and probably already built it.
,Doug
Richard Riley wrote:
>
> nxhtml might be good for you too.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
[not found] ` <mailman.849.1336573028.855.help-gnu-emacs@gnu.org>
@ 2012-05-09 15:05 ` Alexandre Oberlin
2012-05-09 15:40 ` Alexandre Oberlin
0 siblings, 1 reply; 19+ messages in thread
From: Alexandre Oberlin @ 2012-05-09 15:05 UTC (permalink / raw)
To: help-gnu-emacs
Thanks Doug for your answer.
Actually changing the mode of the buffer (be it narrowed, cloned or not)
does not consistently help, because even if it is not seen, the non code
text impacts on the code highlighting.
Even with standalone code blocks or delimiters, I can't see how to get
this to work without commenting out the non code sections.
Alexandre
On 05/09/2012 04:19 PM, Doug Lewan wrote:
> At my last job I had to work with HTML that was heavily laden with JavaScript, so something similar was very useful for me.
> I wrote a post-command-hook to see if the point had moved into a region of JavaScript and, if it had, then change to JavaScript mode.
>
> If your regions of shell code have reasonably consistent delimiters, then doing the same thing should not be too difficult.
>
> ,Doug
>
>
>> -----Original Message-----
>> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
>> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
>> Behalf Of Alexandre Oberlin
>> Sent: Wednesday, 2012 May 09 09:26
>> To: help-gnu-emacs@gnu.org
>> Subject: sh mode for region only ?
>>
>> Hi all,
>>
>> Is there a possibility to benefit of sh (or whatever) syntax
>> highlighting on a region only?
>>
>> This could be useful when editing a list of instructions containing
>> codes.
>>
>> Alexandre
>>
>
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
[not found] ` <mailman.850.1336573196.855.help-gnu-emacs@gnu.org>
@ 2012-05-09 15:19 ` Alexandre Oberlin
2012-05-09 16:42 ` Barry Margolin
0 siblings, 1 reply; 19+ messages in thread
From: Alexandre Oberlin @ 2012-05-09 15:19 UTC (permalink / raw)
To: help-gnu-emacs
On 05/09/2012 04:19 PM, Richard Riley wrote:
> nxhtml might be good for you too.
The concept should be generalized...
Alexandre
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 15:05 ` Alexandre Oberlin
@ 2012-05-09 15:40 ` Alexandre Oberlin
2012-05-09 16:11 ` Andreas Röhler
0 siblings, 1 reply; 19+ messages in thread
From: Alexandre Oberlin @ 2012-05-09 15:40 UTC (permalink / raw)
To: help-gnu-emacs
I noticed another problem when switching even temporarily to sh mode:
the Enriched mode formatting goes away and does not come back.
Alexandre
On 05/09/2012 05:05 PM, Alexandre Oberlin wrote:
> Thanks Doug for your answer.
>
> Actually changing the mode of the buffer (be it narrowed, cloned or not)
> does not consistently help, because even if it is not seen, the non code
> text impacts on the code highlighting.
>
> Even with standalone code blocks or delimiters, I can't see how to get
> this to work without commenting out the non code sections.
>
> Alexandre
>
>
> On 05/09/2012 04:19 PM, Doug Lewan wrote:
>> At my last job I had to work with HTML that was heavily laden with
>> JavaScript, so something similar was very useful for me.
>> I wrote a post-command-hook to see if the point had moved into a
>> region of JavaScript and, if it had, then change to JavaScript mode.
>>
>> If your regions of shell code have reasonably consistent delimiters,
>> then doing the same thing should not be too difficult.
>>
>> ,Doug
>>
>>
>>> -----Original Message-----
>>> From: help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org
>>> [mailto:help-gnu-emacs-bounces+dougl=shubertticketing.com@gnu.org] On
>>> Behalf Of Alexandre Oberlin
>>> Sent: Wednesday, 2012 May 09 09:26
>>> To: help-gnu-emacs@gnu.org
>>> Subject: sh mode for region only ?
>>>
>>> Hi all,
>>>
>>> Is there a possibility to benefit of sh (or whatever) syntax
>>> highlighting on a region only?
>>>
>>> This could be useful when editing a list of instructions containing
>>> codes.
>>>
>>> Alexandre
>>>
>>
>>
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 15:40 ` Alexandre Oberlin
@ 2012-05-09 16:11 ` Andreas Röhler
0 siblings, 0 replies; 19+ messages in thread
From: Andreas Röhler @ 2012-05-09 16:11 UTC (permalink / raw)
To: help-gnu-emacs
[ ... ]
maybe try this:
https://github.com/purcell/mmm-mode
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 13:25 sh mode for region only ? Alexandre Oberlin
` (3 preceding siblings ...)
[not found] ` <mailman.849.1336573028.855.help-gnu-emacs@gnu.org>
@ 2012-05-09 16:37 ` Pascal J. Bourguignon
4 siblings, 0 replies; 19+ messages in thread
From: Pascal J. Bourguignon @ 2012-05-09 16:37 UTC (permalink / raw)
To: help-gnu-emacs
Alexandre Oberlin <please@nospam.com> writes:
> Is there a possibility to benefit of sh (or whatever) syntax
> highlighting on a region only?
>
> This could be useful when editing a list of instructions containing codes.
There are mmm-mode and mumamo-mode (plus perhaps a few others)
http://emacswiki.org/emacs/MultipleModes
--
__Pascal Bourguignon__ http://www.informatimago.com/
A bad day in () is better than a good day in {}.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 15:19 ` Alexandre Oberlin
@ 2012-05-09 16:42 ` Barry Margolin
2012-05-09 21:01 ` Alexandre Oberlin
0 siblings, 1 reply; 19+ messages in thread
From: Barry Margolin @ 2012-05-09 16:42 UTC (permalink / raw)
To: help-gnu-emacs
In article <eWvqr.501$9Q6.344@newsfe18.iad>,
Alexandre Oberlin <please@nospam.com> wrote:
> On 05/09/2012 04:19 PM, Richard Riley wrote:
> > nxhtml might be good for you too.
>
> The concept should be generalized...
>
> Alexandre
There's something called mmm-mode, for multiple major modes. I use it
with PHP embedded in HTML.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 16:42 ` Barry Margolin
@ 2012-05-09 21:01 ` Alexandre Oberlin
0 siblings, 0 replies; 19+ messages in thread
From: Alexandre Oberlin @ 2012-05-09 21:01 UTC (permalink / raw)
To: help-gnu-emacs
With 3 advises I must try it.
Sounds great.
Thanks a lot,
Alexandre
On 05/09/2012 06:42 PM, Barry Margolin wrote:
> In article<eWvqr.501$9Q6.344@newsfe18.iad>,
> Alexandre Oberlin<please@nospam.com> wrote:
>
>> On 05/09/2012 04:19 PM, Richard Riley wrote:
>>> nxhtml might be good for you too.
>>
>> The concept should be generalized...
>>
>> Alexandre
>
> There's something called mmm-mode, for multiple major modes. I use it
> with PHP embedded in HTML.
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-09 14:55 ` Alexandre Oberlin
@ 2012-05-10 3:44 ` XeCycle
[not found] ` <mailman.878.1336621531.855.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 19+ messages in thread
From: XeCycle @ 2012-05-10 3:44 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
Alexandre Oberlin <please@nospam.com> writes:
> Thanks for your suggestion.
>
> I tried to check if one of those solutions would work at least
> while editing but none does. Actually in the narrowed region or
> cloned buffer the syntax highlighting seems to take into account
> the unseen text to set the highlighting. I need to copy the sh
> region to a new file to get the correct syntax highlighting.
Apart from multiple modes, you can try working with Org mode,
which gives a nice way of embedding source code in documents.
--
Carl Lei (XeCycle)
Department of Physics, Shanghai Jiao Tong University
OpenPGP public key: 7795E591
Fingerprint: 1FB6 7F1F D45D F681 C845 27F7 8D71 8EC4 7795 E591
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
[not found] ` <mailman.878.1336621531.855.help-gnu-emacs@gnu.org>
@ 2012-05-13 3:26 ` rusi
2012-05-13 5:19 ` rusi
2012-05-14 20:33 ` Alexandre Oberlin
1 sibling, 1 reply; 19+ messages in thread
From: rusi @ 2012-05-13 3:26 UTC (permalink / raw)
To: help-gnu-emacs
On May 10, 8:44 am, XeCycle <XeCy...@Gmail.com> wrote:
> Alexandre Oberlin <ple...@nospam.com> writes:
> > Thanks for your suggestion.
>
> > I tried to check if one of those solutions would work at least
> > while editing but none does. Actually in the narrowed region or
> > cloned buffer the syntax highlighting seems to take into account
> > the unseen text to set the highlighting. I need to copy the sh
> > region to a new file to get the correct syntax highlighting.
>
> Apart from multiple modes, you can try working with Org mode,
> which gives a nice way of embedding source code in documents.
Yes orgmode, specifically babel, is probably the most stable and
sophisticated solution
http://orgmode.org/worg/org-contrib/babel/intro.html
More lightweight is eepitch http://angg.twu.net/eev-current/eepitch.el.html
If you dont mind hackish and not heavily documented
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
2012-05-13 3:26 ` rusi
@ 2012-05-13 5:19 ` rusi
0 siblings, 0 replies; 19+ messages in thread
From: rusi @ 2012-05-13 5:19 UTC (permalink / raw)
To: help-gnu-emacs
On May 13, 8:26 am, rusi <rustompm...@gmail.com> wrote:
<snipped>
> More lightweight is eepitchhttp://angg.twu.net/eev-current/eepitch.el.html
> If you dont mind hackish and not heavily documented
Sorry jumped in without thinking.
OP asked about syntax highlighting.
eepitch does not do this at all (as far as I know).
And orgmode uses indirect buffers for that. One may or may not like
this as much as a (working) multiple mode.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: sh mode for region only ?
[not found] ` <mailman.878.1336621531.855.help-gnu-emacs@gnu.org>
2012-05-13 3:26 ` rusi
@ 2012-05-14 20:33 ` Alexandre Oberlin
1 sibling, 0 replies; 19+ messages in thread
From: Alexandre Oberlin @ 2012-05-14 20:33 UTC (permalink / raw)
To: help-gnu-emacs
org mode indeed seems to offer a realm of possibilities I still have to
explore:
http://emacs-fu.blogspot.it/2009/05/writing-and-blogging-with-org-mode.html
Cheers,
Alexandre
On 05/10/2012 05:44 AM, XeCycle wrote:
> Alexandre Oberlin<please@nospam.com> writes:
>
>> Thanks for your suggestion.
>>
>> I tried to check if one of those solutions would work at least
>> while editing but none does. Actually in the narrowed region or
>> cloned buffer the syntax highlighting seems to take into account
>> the unseen text to set the highlighting. I need to copy the sh
>> region to a new file to get the correct syntax highlighting.
>
> Apart from multiple modes, you can try working with Org mode,
> which gives a nice way of embedding source code in documents.
>
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2012-05-14 20:33 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-09 13:25 sh mode for region only ? Alexandre Oberlin
2012-05-09 13:40 ` XeCycle
2012-05-09 14:04 ` Richard Riley
2012-05-09 14:32 ` XeCycle
2012-05-09 14:19 ` Doug Lewan
2012-05-09 14:19 ` Richard Riley
2012-05-09 14:56 ` Doug Lewan
[not found] ` <mailman.850.1336573196.855.help-gnu-emacs@gnu.org>
2012-05-09 15:19 ` Alexandre Oberlin
2012-05-09 16:42 ` Barry Margolin
2012-05-09 21:01 ` Alexandre Oberlin
[not found] ` <mailman.847.1336571158.855.help-gnu-emacs@gnu.org>
2012-05-09 14:55 ` Alexandre Oberlin
2012-05-10 3:44 ` XeCycle
[not found] ` <mailman.878.1336621531.855.help-gnu-emacs@gnu.org>
2012-05-13 3:26 ` rusi
2012-05-13 5:19 ` rusi
2012-05-14 20:33 ` Alexandre Oberlin
[not found] ` <mailman.849.1336573028.855.help-gnu-emacs@gnu.org>
2012-05-09 15:05 ` Alexandre Oberlin
2012-05-09 15:40 ` Alexandre Oberlin
2012-05-09 16:11 ` Andreas Röhler
2012-05-09 16:37 ` Pascal J. Bourguignon
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.