From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ? Date: Sun, 3 Nov 2013 11:48:01 +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> <878ux6azoe.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0158a92efa62f604ea42b10b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcuHt-00029t-WF for emacs-orgmode@gnu.org; Sun, 03 Nov 2013 04:48:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VcuHs-0000VE-2I for emacs-orgmode@gnu.org; Sun, 03 Nov 2013 04:48:05 -0500 Received: from mail-oa0-x22b.google.com ([2607:f8b0:4003:c02::22b]:36352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VcuHr-0000V0-Ih for emacs-orgmode@gnu.org; Sun, 03 Nov 2013 04:48:03 -0500 Received: by mail-oa0-f43.google.com with SMTP id m1so6154172oag.2 for ; Sun, 03 Nov 2013 01:48:01 -0800 (PST) In-Reply-To: <878ux6azoe.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 , kjambunathan@gmail.com --089e0158a92efa62f604ea42b10b Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thank you Eric and Jambunathan Eric: i tried with the added backslash but that dosent seem to work as well, would you mind testing the snippet below on your system? is it still something wrong im doing? ;test (font-lock-add-keywords 'org-mode '(("\\b[Ss]alt\\b)" (0 '(:weight ultra-bold :foregroun "#FF9800") t)))) Jambunathan: hi-lock-mode looks interesting and i will investigate it soon, is it per file settings, or can you define a word/fg-bg rule that will apply to all files? thanks alot guys, really appreciate it! On Sun, Nov 3, 2013 at 6:15 AM, Eric Abrahamsen wrote: > > Xebar Saram writes: > > > 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)))) > > Looks like you're missing a backslash at the beginning of the regexp -- > make sure it reads "\\b... > > E > > > thank you for all your help > > > > > > > > On Sat, Nov 2, 2013 at 12:15 PM, Eric Abrahamsen < > > eric@ericabrahamsen.net> wrote: > > > > 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 "#0= 00000" :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 > > > > > > > > > > > > --089e0158a92efa62f604ea42b10b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thank you Eric and Jambunathan

Eric: i tried with t= he added backslash but that dosent seem to work as well, would you mind tes= ting the snippet below on your system? is it still something wrong im doing= ?

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

Jambunathan: =C2=A0hi-lock-mode looks interesting and i will = investigate it soon, is it per file settings, or can you define a word/fg-b= g rule that will apply to all files?

thanks alot guys, really appreciate it!



On Sun, Nov= 3, 2013 at 6:15 AM, Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>
> Xebar Saram= <zeltakc@gmail.com> writes:=
>
> > Thanks Eric , really appreciate the continuous help!
&= gt; >
> > i do plan to get into rexeg on the future (i promise = :)) but real
> > life now just allow me to allocate time (i starte= d 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.
> >
&g= t; > ;test
> > (font-lock-add-keywords
> > =C2=A0'= org-mode
> > '(("\b[Ss]alt\\b)" (0 '(:weight ult= ra-bold :foregroun "#FF9800")
> > t))))
>
> Looks like you're missing a backslash a= t the beginning of the regexp --
> make sure it reads "\\b...>
> E
>
> > thank you for all your help
> &g= t;
> >
> >
> > On Sat, Nov 2, 2013 at 12:15 PM, Eric A= brahamsen <
> > eric= @ericabrahamsen.net> wrote:
> >
> > =C2=A0 =C2=A0 = Xebar Saram <zeltakc@gmail.com&= gt; writes:
> >
> > =C2=A0 =C2=A0 > Hi again all
> > =C2=A0 = =C2=A0 >
> > =C2=A0 =C2=A0 > i have been using the before di= scussed font lock with great
> > =C2=A0 =C2=A0 success
> >= ; =C2=A0 =C2=A0 > over the past few weeks, thx alot for that tip!
> > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > one short ques= tion i have from using it thourhgly is weather
> > =C2=A0 =C2=A0 i= ts
> > =C2=A0 =C2=A0 > possible to color specific words , IE no= t just text bound
> > =C2=A0 =C2=A0 between
> > =C2=A0 =C2=A0 > symbols ( ie > !text! ) but rather lets say= i always want to
> > =C2=A0 =C2=A0 make the
> > =C2=A0 = =C2=A0 > word server appear with blue FG. is this possible? currently i<= br>> > =C2=A0 =C2=A0 tried
> > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > (font-lock-add= -keywords
> > =C2=A0 =C2=A0 > =C2=A0'org-mode
> > = =C2=A0 =C2=A0 > '(("\\(server[^server\n]+server\\)" (0 = 9;(:foreground "#000000"
> > =C2=A0 =C2=A0 > :underli= ne t :background "#FF9AEA" :weight ultra-bold) t))))
> >
> > =C2=A0 =C2=A0 At some point you're definitely go= ing to want to read up on
> > =C2=A0 =C2=A0 regular
> > = =C2=A0 =C2=A0 expressions!
> >
> > =C2=A0 =C2=A0 But in t= he meantime yes, it's entirely (mostly) possible. A
> > =C2=A0 =C2=A0 regular
> > =C2=A0 =C2=A0 expression is ju= st a way of finding desired pieces of text in a
> > =C2=A0 =C2=A0 = larger
> > =C2=A0 =C2=A0 run of text. Think of the regexp as an in= struction that starts:
> > =C2=A0 =C2=A0 "Find
> > =C2=A0 =C2=A0 all pieces of text that are..."
> >> > =C2=A0 =C2=A0 All the special regexp characters are just a way = of making the
> > =C2=A0 =C2=A0 instruction general (_any_ number,= four of _any_ character,
> > =C2=A0 =C2=A0 _anything_
> > =C2=A0 =C2=A0 that's no= t a "p").
> >
> > =C2=A0 =C2=A0 In the most bas= ic case, however, a regexp is simply the text you
> > =C2=A0 =C2= =A0 want to
> > =C2=A0 =C2=A0 find: "Find all pieces of text = that are 'server'". In this case,
> > =C2=A0 =C2=A0 that's
> > =C2=A0 =C2=A0 your regexp: = "server".
> >
> > =C2=A0 =C2=A0 The reason rege= xps are difficult, of course, is that they can't
> > =C2=A0 = =C2=A0 read
> > =C2=A0 =C2=A0 your mind, and will find things you = didn't want, and not find
> > =C2=A0 =C2=A0 things you
> > =C2=A0 =C2=A0 did want. So = much of messing with regexps is telling them: _yes_
> > =C2=A0 =C2= =A0 this
> > =C2=A0 =C2=A0 too, _no_ not that. In your case, you&#= 39;d probably want to put word
> > =C2=A0 =C2=A0 boundaries around= the regexp ("\b" on either side), and find both
> > =C2=A0 =C2=A0 capitalized and lowercase instances of the word. So= your
> > =C2=A0 =C2=A0 instruction
> > =C2=A0 =C2=A0 mig= ht be:
> >
> > =C2=A0 =C2=A0 "Find all pieces of tex= t that are 'server' or 'Server', but only
> > =C2=A0 =C2=A0 as a
> > =C2=A0 =C2=A0 complete word."= ;
> >
> > =C2=A0 =C2=A0 Which would look like
> >= ;
> > =C2=A0 =C2=A0 "\\b[Ss]erver\\b"
> >
&g= t; > =C2=A0 =C2=A0 Give that a shot. You're jumping into the middle = of something
> > =C2=A0 =C2=A0 fairly
> > =C2=A0 =C2=A0 complicated, so b= e patient and go slow!
> >
> > =C2=A0 =C2=A0 E
> &g= t;
> > =C2=A0 =C2=A0 > instead of the original
> > =C2= =A0 =C2=A0 >
> > =C2=A0 =C2=A0 > (font-lock-add-keywords
> > =C2=A0 =C2=A0 > =C2=A0'org-mode
> > =C2=A0 =C2=A0= > '(("\\(=E2=82=86[^=E2=82=86\n]+=E2=82=86\\)" (0 '(:= foreground "#000000" :underline t
> > =C2=A0 =C2=A0 >= :background "#FF9AEA" :weight ultra-bold) t))))
> > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 >
> > = =C2=A0 =C2=A0 > again i apologize for my regrex ignorance :)
> >= ; =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > best
> > =C2= =A0 =C2=A0 >
> > =C2=A0 =C2=A0 > Z
> > =C2=A0 =C2= =A0 >
> > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 >
> > = =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > On Sun, Oct 6, 2013 at 8= :04 AM, Eric Abrahamsen <
> > =C2=A0 =C2=A0 > eric@ericabrahamsen.net> wrote:
> > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 = Xebar Saram <zeltakc@gmail.com&= gt; writes:
> > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 >= =C2=A0 =C2=A0 > thx again Eric
> > =C2=A0 =C2=A0 > =C2=A0 = =C2=A0 >
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > i still have an issue with = this when one of the symbols
> > =C2=A0 =C2=A0 used to
> >= ; =C2=A0 =C2=A0 > =C2=A0 =C2=A0 start
> > =C2=A0 =C2=A0 > = =C2=A0 =C2=A0 > /end the highlight is used in a sentence, for example > > =C2=A0 =C2=A0 using
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0= your
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > code:
> >= =C2=A0 =C2=A0 > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > =C2= =A0 =C2=A0 > (font-lock-add-keywords
> > =C2=A0 =C2=A0 > =C2= =A0 =C2=A0 > =C2=A0'org-mode
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > =C2=A0'(("-1-\\([^= -1-]+\\)-1-" (0 '(:weight ultra-bold
> > =C2=A0 =C2=A0 :b= ackground "
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 #
> &g= t; =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > DDFFDD" :foreground "#00= 0000") t))))
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 = > =C2=A0 =C2=A0 > if i write this:
> > =C2=A0 =C2=A0 > = =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > -1- t= his is a test of 1x1 to show higlight -1-
> > =C2=A0 =C2=A0 > = =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > it wi= ll kill the highlight, if i use the same text
> > =C2=A0 =C2=A0 omitting the
> > =C2=A0 =C2=A0 > =C2=A0= =C2=A0 '1'
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > it w= orks well, anyway around this issue? i thought it
> > =C2=A0 =C2= =A0 would
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 have
> > = =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > matcehd -1- but it seems it matches a= lso just 1 by itself
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 = > =C2=A0 =C2=A0 > best wishes and thx again
> > =C2=A0 =C2= =A0 >
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 Yup, the things insi= de the [^] construct, to _not_ be
> > =C2=A0 =C2=A0 matched,
&g= t; > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 are
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 treated as a list of single char= acters. So you're saying
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 = "anything
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 that's not= a '1' or a '-'," but then you've got a '1'= ; in
> > =C2=A0 =C2=A0 the
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 m= iddle of
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 the line. If you wan= t the highlighting to include any
> > =C2=A0 =C2=A0 character,
= > > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 but not
> > =C2=A0 =C2= =A0 > =C2=A0 =C2=A0 span newlines, you could just use [^\n] instead.
> > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 = At this point you'll probably want to read the regular
> > =C2= =A0 =C2=A0 expression
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 part> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 of the manual:
> > =C2= =A0 =C2=A0 >
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 (elisp) Regular Expressions
&= gt; > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 I= think you mentioned you don't have a lot of programming
> > = =C2=A0 =C2=A0 > =C2=A0 =C2=A0 experience.
> > =C2=A0 =C2=A0 >= ; =C2=A0 =C2=A0 That's a bit unfortunate, since regexps aren't a gr= eat
> > =C2=A0 =C2=A0 place to
> > =C2=A0 =C2=A0 > =C2=A0 =C2= =A0 start!
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 I'd recommend = getting something that's "close enough", and
> > =C2= =A0 =C2=A0 not
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 going
> = > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 down the rabbit hole of perfect. Then= start at the top of
> > =C2=A0 =C2=A0 the
> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 i= ntroduction to elisp...
> > =C2=A0 =C2=A0 >
> > =C2=A0= =C2=A0 > =C2=A0 =C2=A0 Good luck,
> > =C2=A0 =C2=A0 > =C2= =A0 =C2=A0 Eric
> > =C2=A0 =C2=A0 >
> > =C2=A0 =C2=A0 = >
> >
> >
>
>
--089e0158a92efa62f604ea42b10b--