* Re: switch off font lock mode with strings
2008-10-07 2:36 ` Xah
@ 2008-10-07 3:11 ` Stephan Ripke
2008-10-14 23:56 ` Xah
1 sibling, 0 replies; 4+ messages in thread
From: Stephan Ripke @ 2008-10-07 3:11 UTC (permalink / raw)
To: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 2974 bytes --]
Hi Xah,
thanks for your answer. I thought, nobody understands me. (Tear). You got me
totally right, only that I so not care about awk mode in my awk script. The
problem is, that my awk-script sometimes has 100 lines, and then all of them
are not highlighted.
Any highlighting would be great! But since the awk-mode is also highlighting
a string in a whole, it makes no differences.
If you have no other idea, I will have a look for multi-mode.
thanks,
Stephan
On Tue, Oct 7, 2008 at 4:36 AM, Xah <xahlee@gmail.com> wrote:
> On Oct 5, 5:38 pm, "Stephan Ripke" <ri...@mpipsykl.mpg.de> wrote:
> > Hi all,
> > I really love emacs, but I am not a Pro-User, so can you please help me
> out
> > of this problem:
> > I write many shell-scripts. When there are gaps to fill between output of
> > the one and input of the other program I use awk-scripts in between.
> Since
> > the awk-scripts are enclosed in single quotes, I loose the fontification
> of
> > these (sub)-scripts, because I write these scripts directly in the parent
> > shell-script and not in another file.
> > Since an editor like "gedit" is starting his fontification on every
> single
> > line, I start to use gedit for my scripts. But I don't like it. Is there
> a
> > possibility to stop emacs from seeing single quotes as a
> > fontification-marker. Or can I ask emacs to begin the fontification on
> the
> > beginnig of every line, or is ther some other way to solve this problem.
> > Many thanks, I hope that was not too much text...
> > Stephan
>
> if i understand u correctly, u are saying like u have a line like the
> following inside a shell script:
>
> cat x-log_200_GET.txt | grep '\.html HTTP' | awk '$12 ~ /stumbleupon
> \.com/ {print $12 , $7}' | sort | sed s/refer.php/url.php/ | uniq -c |
> sort -n -r > x-referral_stumble.html
>
> and you want the awk part syntax highlighted?
>
> am not sure there's a easy solution. There are few programs that does
> multi-modes, so that you can set it up such that inside single quotes
> it does awk mode... but i never tried them and i figure it'll take
> quite some time to get it to work. Search on emacswiki on multi-mode
> or similar name. There are a few of them.
>
> alternatively, you can define a key such as F6 that toggles between
> shell-mode and awkmode. So, when u are working on the awk part, press
> the key. When you are out, press again. This is what i do when doing
> html code mixed with php, css, javascript etc.
>
> Somethnig like:
>
> (defun toggle-awk-shell-mode ()
> "toggles between awk-mode and shell-mode"
> (interactive)
> (let ((didSwitch nil))
> (when (eq mode-name "awk-mode") (shell-mode) (setq didSwitch t))
> (if (and (eq mode-name "shell-mode") (not didSwitch)) (awk-mode)
> (shell-mode))
> )
> )
>
> (global-set-key (kbd "<F6>") 'toggle-awk-shell-mode)
>
> Xah
> ∑ http://xahlee.org/
>
> ☄
>
>
--
--
Dr. med. Stephan Ripke
c/o Chris Weller
160 Chestnut Str
02139 Cambridge MA
USA
Email: ripke@mpipsykl.mpg.de
[-- Attachment #2: Type: text/html, Size: 3767 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: switch off font lock mode with strings
2008-10-07 2:36 ` Xah
2008-10-07 3:11 ` Stephan Ripke
@ 2008-10-14 23:56 ` Xah
1 sibling, 0 replies; 4+ messages in thread
From: Xah @ 2008-10-14 23:56 UTC (permalink / raw)
To: help-gnu-emacs
here's the tested code:
(defun toggle-awk-sh-modes ()
"toggles between awk-mode and sh-mode."
(interactive)
(let ((switched-p nil))
(when (equal mode-name "AWK/l") (sh-mode) (setq switched-p t))
(if (and (equal mode-name "Shell-script") (not switched-p)) (awk-
mode)
(sh-mode))
)
)
(global-set-key (kbd "<F6>") 'toggle-awk-sh-modes)
Xah
∑ http://xahlee.org/
☄
On Oct 6, 7:36 pm, Xah <xah...@gmail.com> wrote:
> On Oct 5, 5:38 pm, "Stephan Ripke" <ri...@mpipsykl.mpg.de> wrote:
>
> > Hi all,
> > I really love emacs, but I am not a Pro-User, so can you please help me out
> > of this problem:
> > I write many shell-scripts. When there are gaps to fill between output of
> > the one and input of the other program I useawk-scripts in between. Since
> > theawk-scripts are enclosed in single quotes, I loose the fontification of
> > these (sub)-scripts, because I write these scripts directly in the parent
> > shell-script and not in another file.
> > Since an editor like "gedit" is starting his fontification on every single
> > line, I start to use gedit for my scripts. But I don't like it. Is there a
> > possibility to stop emacs from seeing single quotes as a
> > fontification-marker. Or can I ask emacs to begin the fontification on the
> > beginnig of every line, or is ther some other way to solve this problem.
> > Many thanks, I hope that was not too much text...
> > Stephan
>
> if i understand u correctly, u are saying like u have a line like the
> following inside a shell script:
>
> cat x-log_200_GET.txt | grep '\.html HTTP' |awk'$12 ~ /stumbleupon
> \.com/ {print $12 , $7}' | sort | sed s/refer.php/url.php/ | uniq -c |
> sort -n -r > x-referral_stumble.html
>
> and you want theawkpart syntax highlighted?
>
> am not sure there's a easy solution. There are few programs that does
> multi-modes, so that you can set it up such that inside single quotes
> it doesawkmode... but i never tried them and i figure it'll take
> quite some time to get it to work. Search on emacswiki on multi-mode
> or similar name. There are a few of them.
>
> alternatively, you can define a key such as F6 that toggles between
> shell-mode and awkmode. So, when u are working on theawkpart, press
> the key. When you are out, press again. This is what i do when doing
> html code mixed with php, css, javascript etc.
>
> Somethnig like:
>
> (defun toggle-awk-shell-mode ()
> "toggles betweenawk-mode and shell-mode"
> (interactive)
> (let ((didSwitch nil))
> (when (eq mode-name "awk-mode") (shell-mode) (setq didSwitch t))
> (if (and (eq mode-name "shell-mode") (not didSwitch)) (awk-mode)
> (shell-mode))
> )
> )
>
> (global-set-key (kbd "<F6>") 'toggle-awk-shell-mode)
>
> Xah
> ∑http://xahlee.org/
>
> ☄
^ permalink raw reply [flat|nested] 4+ messages in thread