From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: Re: switch off font lock mode with strings Date: Tue, 14 Oct 2008 16:56:08 -0700 (PDT) Organization: http://groups.google.com Message-ID: <84a3650b-43fb-4a8d-9319-9d14a7c2f491@z18g2000prn.googlegroups.com> References: <7951b92b-d09c-4306-9e19-64a324212f9c@a3g2000prm.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1224031289 31072 80.91.229.12 (15 Oct 2008 00:41:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 15 Oct 2008 00:41:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Oct 15 02:42:29 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KpuT7-0002Sd-7y for geh-help-gnu-emacs@m.gmane.org; Wed, 15 Oct 2008 02:42:29 +0200 Original-Received: from localhost ([127.0.0.1]:42573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KpuS2-0001Kc-NL for geh-help-gnu-emacs@m.gmane.org; Tue, 14 Oct 2008 20:41:22 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!z18g2000prn.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 88 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1224028568 26614 127.0.0.1 (14 Oct 2008 23:56:08 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 14 Oct 2008 23:56:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z18g2000prn.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:163445 comp.emacs:97159 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:58787 Archived-At: 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 "") 'toggle-awk-sh-modes) Xah =E2=88=91 http://xahlee.org/ =E2=98=84 On Oct 6, 7:36=C2=A0pm, Xah wrote: > On Oct 5, 5:38 pm, "Stephan Ripke" 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. Sin= ce > > theawk-scripts are enclosed in single quotes, I loose the fontification= of > > these (sub)-scripts, because I write these scripts directly in the pare= nt > > shell-script and not in another file. > > Since an editor like "gedit" is starting his fontification on every sin= gle > > line, I start to use gedit for my scripts. But I don't like it. Is ther= e 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 "") 'toggle-awk-shell-mode) > > =C2=A0 Xah > =E2=88=91http://xahlee.org/ > > =E2=98=84