From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ? Date: Sat, 2 Nov 2013 09:48:45 +0200 Message-ID: References: <87r4c1mrh1.fsf@bzg.ath.cx> <87d2nlzcoo.fsf@bzg.ath.cx> <878uy99z28.fsf@ericabrahamsen.net> <87r4c08h21.fsf@ericabrahamsen.net> <87wqlr6ld5.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8ff1cefea1db1b04ea2ce9ed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcVwu-0000Vc-Ey for emacs-orgmode@gnu.org; Sat, 02 Nov 2013 03:48:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VcVwt-0002VV-9E for emacs-orgmode@gnu.org; Sat, 02 Nov 2013 03:48:48 -0400 Received: from mail-oa0-x234.google.com ([2607:f8b0:4003:c02::234]:37549) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcVwt-0002VR-2i for emacs-orgmode@gnu.org; Sat, 02 Nov 2013 03:48:47 -0400 Received: by mail-oa0-f52.google.com with SMTP id j1so5426301oag.39 for ; Sat, 02 Nov 2013 00:48:46 -0700 (PDT) In-Reply-To: <87wqlr6ld5.fsf@ericabrahamsen.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Abrahamsen Cc: org mode --e89a8ff1cefea1db1b04ea2ce9ed Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi again all i have been using the before discussed font lock with great success over the past few weeks, thx alot for that tip! one short question i have from using it thourhgly is weather its possible to color specific words , IE not just text bound between symbols ( ie > !text! ) but rather lets say i always want to make the word server appear with blue FG. is this possible? currently i tried (font-lock-add-keywords 'org-mode '(("\\(server[^server\n]+server\\)" (0 '(:foreground "#000000" :underline t :background "#FF9AEA" :weight ultra-bold) t)))) instead of the original (font-lock-add-keywords 'org-mode '(("\\(=E2=82=86[^=E2=82=86\n]+=E2=82=86\\)" (0 '(:foreground "#000000" :un= derline t :background "#FF9AEA" :weight ultra-bold) t)))) again i apologize for my regrex ignorance :) best Z On Sun, Oct 6, 2013 at 8:04 AM, Eric Abrahamsen wr= ote: > Xebar Saram writes: > > > thx again Eric > > > > i still have an issue with this when one of the symbols used to start > > /end the highlight is used in a sentence, for example using your > > code: > > > > (font-lock-add-keywords > > 'org-mode > > '(("-1-\\([^-1-]+\\)-1-" (0 '(:weight ultra-bold :background "# > > DDFFDD" :foreground "#000000") t)))) > > > > if i write this: > > > > -1- this is a test of 1x1 to show higlight -1- > > > > it will kill the highlight, if i use the same text omitting the '1' > > it works well, anyway around this issue? i thought it would have > > matcehd -1- but it seems it matches also just 1 by itself > > > > best wishes and thx again > > Yup, the things inside the [^] construct, to _not_ be matched, are > treated as a list of single characters. So you're saying "anything > that's not a '1' or a '-'," but then you've got a '1' in the middle of > the line. If you want the highlighting to include any character, but not > span newlines, you could just use [^\n] instead. > > At this point you'll probably want to read the regular expression part > of the manual: > > (elisp) Regular Expressions > > I think you mentioned you don't have a lot of programming experience. > That's a bit unfortunate, since regexps aren't a great place to start! > I'd recommend getting something that's "close enough", and not going > down the rabbit hole of perfect. Then start at the top of the > introduction to elisp... > > Good luck, > Eric > > > --e89a8ff1cefea1db1b04ea2ce9ed Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi again all

i have been using the befo= re discussed font lock with great success over the past few weeks, thx alot= for that tip!

one short question i have from usin= g it thourhgly is weather its possible to color specific words , IE not jus= t text bound between symbols ( ie > !text! ) but rather lets say i alway= s want to make the word server appear with blue FG. is this possible? curre= ntly i tried=C2=A0

(font-lock-add-keywords
=C2=A0'org-m= ode
'(("\\(server[^server\n]+server\\)" (0 '(:f= oreground "#000000" :underline t :background "#FF9AEA" = :weight ultra-bold) t))))

instead of the original

=
(font-lock-add-keywords
=C2=A0'org-mode
'(= ("\\(=E2=82=86[^=E2=82=86\n]+=E2=82=86\\)" (0 '(:foreground &= quot;#000000" :underline t :background "#FF9AEA" :weight ult= ra-bold) t))))


again i apologize for my regrex ig= norance :)

best

Z




On Sun, Oct 6, 2013 at 8:04 AM, Eric Abrahamsen <eric@ericabrahamsen= .net> wrote:
Xebar Saram <zelt= akc@gmail.com> writes:

> thx again Eric
>
> i still have an issue with this when one of the symbols used to start<= br> > /end the highlight is used in a sentence, for example using your
> code:
>
> (font-lock-add-keywords
> =C2=A0'org-mode
> =C2=A0'(("-1-\\([^-1-]+\\)-1-" (0 '(:weight ultra-bo= ld :background "#
> DDFFDD" :foreground "#000000") t))))
>
> if i write this:
>
> -1- this is a test of 1x1 to show higlight -1-
>
> it will kill the highlight, if i use the same text omitting the '1= '
> it works well, anyway around this issue? i thought it would have
> matcehd -1- but it seems it matches also just 1 by itself
>
> best wishes and thx again

Yup, the things inside the [^] construct, to _not_ be matched, are treated as a list of single characters. So you're saying "anything=
that's not a '1' or a '-'," but then you've go= t a '1' in the middle of
the line. If you want the highlighting to include any character, but not span newlines, you could just use [^\n] instead.

At this point you'll probably want to read the regular expression part<= br> of the manual:

(elisp) Regular Expressions

I think you mentioned you don't have a lot of programming experience. That's a bit unfortunate, since regexps aren't a great place to sta= rt!
I'd recommend getting something that's "close enough", an= d not going
down the rabbit hole of perfect. Then start at the top of the
introduction to elisp...

Good luck,
Eric



--e89a8ff1cefea1db1b04ea2ce9ed--