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 14:50:48 +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> <8761sbkt3q.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e013d0dc0cc7dcb04ea312154 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcafC-0002Jq-S3 for emacs-orgmode@gnu.org; Sat, 02 Nov 2013 08:50:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VcafB-0004u7-3A for emacs-orgmode@gnu.org; Sat, 02 Nov 2013 08:50:50 -0400 Received: from mail-ob0-x236.google.com ([2607:f8b0:4003:c01::236]:49364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcafA-0004u3-Rn for emacs-orgmode@gnu.org; Sat, 02 Nov 2013 08:50:49 -0400 Received: by mail-ob0-f182.google.com with SMTP id wn1so5550682obc.41 for ; Sat, 02 Nov 2013 05:50:48 -0700 (PDT) In-Reply-To: <8761sbkt3q.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 , org mode --089e013d0dc0cc7dcb04ea312154 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks Eric , really appreciate the continuous help! i do plan to get into rexeg on the future (i promise :)) but real life now just allow me to allocate time (i started an assistant professor position and time is at a huge premium..). i tried using this as i tried to understand from your email, but i guess im again doing something wrong. shouldn't the below example color "salt", it dosent see to work. ;test (font-lock-add-keywords 'org-mode '(("\b[Ss]alt\\b)" (0 '(:weight ultra-bold :foregroun "#FF9800") t)))) thank you for all your help On Sat, Nov 2, 2013 at 12:15 PM, Eric Abrahamsen w= rote: > Xebar Saram writes: > > > 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)))) > > At some point you're definitely going to want to read up on regular > expressions! > > But in the meantime yes, it's entirely (mostly) possible. A regular > expression is just a way of finding desired pieces of text in a larger > run of text. Think of the regexp as an instruction that starts: "Find > all pieces of text that are..." > > All the special regexp characters are just a way of making the > instruction general (_any_ number, four of _any_ character, _anything_ > that's not a "p"). > > In the most basic case, however, a regexp is simply the text you want to > find: "Find all pieces of text that are 'server'". In this case, that's > your regexp: "server". > > The reason regexps are difficult, of course, is that they can't read > your mind, and will find things you didn't want, and not find things you > did want. So much of messing with regexps is telling them: _yes_ this > too, _no_ not that. In your case, you'd probably want to put word > boundaries around the regexp ("\b" on either side), and find both > capitalized and lowercase instances of the word. So your instruction > might be: > > "Find all pieces of text that are 'server' or 'Server', but only as a > complete word." > > Which would look like > > "\\b[Ss]erver\\b" > > Give that a shot. You're jumping into the middle of something fairly > complicated, so be patient and go slow! > > E > > > instead of the original > > > > (font-lock-add-keywords > > 'org-mode > > '(("\\(=E2=82=86[^=E2=82=86\n]+=E2=82=86\\)" (0 '(:foreground "#000000"= :underline 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 < > > eric@ericabrahamsen.net> wrote: > > > > 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 > > > > > > > --089e013d0dc0cc7dcb04ea312154 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Thanks Eric , really appreciate the continu= ous help!

i do plan to get into rexeg on the future (i p= romise :)) but real life now just allow me to allocate time (i started an a= ssistant professor position and time is at a huge premium..).

i tried using this as i tried to understand from your e= mail, but i guess im again doing something wrong. shouldn't the below e= xample color "salt", it dosent see to work.

;test
(font-lock-add-keywords
=C2=A0'org-= mode
'(("\b[Ss]alt\\b)" (0 '(:weight ultra-bold= :foregroun "#FF9800") t))))

thank you for all your help



On Sa= t, Nov 2, 2013 at 12:15 PM, Eric Abrahamsen <eric@ericabrahamsen.n= et> wrote:
Xebar Saram <zeltakc@gmail.com> writes:

> 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 t= he
> word server appear with blue FG. is this possible? currently i tried= =C2=A0
>
> (font-lock-add-keywords
> =C2=A0'org-mode
> '(("\\(server[^server\n]+server\\)" (0 '(:foreground= "#000000"
> :underline t :background "#FF9AEA" :weight ultra-bold) t))))=

At some point you're definitely going to want to read up on regul= ar
expressions!

But in the meantime yes, it's entirely (mostly) possible. A regular
expression is just a way of finding desired pieces of text in a larger
run of text. Think of the regexp as an instruction that starts: "Find<= br> all pieces of text that are..."

All the special regexp characters are just a way of making the
instruction general (_any_ number, four of _any_ character, _anything_
that's not a "p").

In the most basic case, however, a regexp is simply the text you want to find: "Find all pieces of text that are 'server'". In thi= s case, that's
your regexp: "server".

The reason regexps are difficult, of course, is that they can't read your mind, and will find things you didn't want, and not find things yo= u
did want. So much of messing with regexps is telling them: _yes_ this
too, _no_ not that. In your case, you'd probably want to put word
boundaries around the regexp ("\b" on either side), and find both=
capitalized and lowercase instances of the word. So your instruction
might be:

"Find all pieces of text that are 'server' or 'Server'= , but only as a
complete word."

Which would look like

"\\b[Ss]erver\\b"

Give that a shot. You're jumping into the middle of something fairly complicated, so be patient and go slow!

E

> instead of the original
>
> (font-lock-add-keywords
> =C2=A0'org-mode
> '(("\\(=E2=82=86[^=E2=82=86\n]+=E2=82=86\\)" (0 '(:f= oreground "#000000" :underline 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 <
> eric@ericabrahamsen.net= > wrote:
>
> =C2=A0 =C2=A0 Xebar Saram <zel= takc@gmail.com> writes:
>
> =C2=A0 =C2=A0 > thx again Eric
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > i still have an issue with this when one of the sym= bols used to
> =C2=A0 =C2=A0 start
> =C2=A0 =C2=A0 > /end the highlight is used in a sentence, for examp= le using
> =C2=A0 =C2=A0 your
> =C2=A0 =C2=A0 > code:
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > (font-lock-add-keywords
> =C2=A0 =C2=A0 > =C2=A0'org-mode
> =C2=A0 =C2=A0 > =C2=A0'(("-1-\\([^-1-]+\\)-1-" (0 = 9;(:weight ultra-bold :background "
> =C2=A0 =C2=A0 #
> =C2=A0 =C2=A0 > DDFFDD" :foreground "#000000") t))))=
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > if i write this:
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > -1- this is a test of 1x1 to show higlight -1-
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > it will kill the highlight, if i use the same text = omitting the
> =C2=A0 =C2=A0 '1'
> =C2=A0 =C2=A0 > it works well, anyway around this issue? i thought = it would
> =C2=A0 =C2=A0 have
> =C2=A0 =C2=A0 > matcehd -1- but it seems it matches also just 1 by = itself
> =C2=A0 =C2=A0 >
> =C2=A0 =C2=A0 > best wishes and thx again
>
> =C2=A0 =C2=A0 Yup, the things inside the [^] construct, to _not_ be ma= tched,
> =C2=A0 =C2=A0 are
> =C2=A0 =C2=A0 treated as a list of single characters. So you're sa= ying
> =C2=A0 =C2=A0 "anything
> =C2=A0 =C2=A0 that's not a '1' or a '-'," but= then you've got a '1' in the
> =C2=A0 =C2=A0 middle of
> =C2=A0 =C2=A0 the line. If you want the highlighting to include any ch= aracter,
> =C2=A0 =C2=A0 but not
> =C2=A0 =C2=A0 span newlines, you could just use [^\n] instead.
>
> =C2=A0 =C2=A0 At this point you'll probably want to read the regul= ar expression
> =C2=A0 =C2=A0 part
> =C2=A0 =C2=A0 of the manual:
>
> =C2=A0 =C2=A0 (elisp) Regular Expressions
>
> =C2=A0 =C2=A0 I think you mentioned you don't have a lot of progra= mming
> =C2=A0 =C2=A0 experience.
> =C2=A0 =C2=A0 That's a bit unfortunate, since regexps aren't a= great place to
> =C2=A0 =C2=A0 start!
> =C2=A0 =C2=A0 I'd recommend getting something that's "clo= se enough", and not
> =C2=A0 =C2=A0 going
> =C2=A0 =C2=A0 down the rabbit hole of perfect. Then start at the top o= f the
> =C2=A0 =C2=A0 introduction to elisp...
>
> =C2=A0 =C2=A0 Good luck,
> =C2=A0 =C2=A0 Eric
>
>



--089e013d0dc0cc7dcb04ea312154--