From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xebar Saram Subject: Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ? Date: Mon, 4 Nov 2013 09:14:06 +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> <87iow8ak4d.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b6740745c093e04ea54a92c Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdEMT-0005EI-EA for emacs-orgmode@gnu.org; Mon, 04 Nov 2013 02:14:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdEMR-0006lP-Aa for emacs-orgmode@gnu.org; Mon, 04 Nov 2013 02:14:09 -0500 Received: from mail-oa0-x236.google.com ([2607:f8b0:4003:c02::236]:56782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdEMR-0006lL-1c for emacs-orgmode@gnu.org; Mon, 04 Nov 2013 02:14:07 -0500 Received: by mail-oa0-f54.google.com with SMTP id o20so6778464oag.41 for ; Sun, 03 Nov 2013 23:14:06 -0800 (PST) In-Reply-To: <87iow8ak4d.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 --047d7b6740745c093e04ea54a92c Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable hehe, works like a charm now :) thx again Eric! have a great day Z On Mon, Nov 4, 2013 at 6:03 AM, Eric Abrahamsen wr= ote: > Xebar Saram writes: > > > 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)))) > > What!? You mean I should actually test my suggestions!? :) > > You've got one more typo I didn't see -- there's a spurious close > parenthesis at the end of the regexp, just inside the quote. I promise I > actually tried it this time, and taking that parenthesis out works! > > E > > > 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 < > > eric@ericabrahamsen.net> 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 = "#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 > >> > > > >> > > > >> > > >> > > >> > >> > > > --047d7b6740745c093e04ea54a92c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
hehe, works like a charm now :)

thx aga= in Eric!

have a great day

Z


On Mon, Nov 4, 2013 at 6:03 AM, Eric Abrahamsen <eric@ericabrahamse= n.net> wrote:
Xebar Saram <zeltakc@gmail.com> writes:

> 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 :foregro= un "#FF9800")
> t))))

What!? You mean I should actually test my suggestions!? :)

You've got one more typo I didn't see -- there's a spurious clo= se
parenthesis at the end of the regexp, just inside the quote. I promise I actually tried it this time, and taking that parenthesis out works!

E

> Jambunathan: =C2=A0hi-lock-mode looks interesting and i will investiga= te
> it soon, is it per file settings, or can you define a word/fg-bg rule<= br> > 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!
>> >
>> > 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 assista= nt
>> > 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
>> > =C2=A0'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<= br> > 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@ericabrahamse= n.net> wrote:
>> >
>> > =C2=A0 =C2=A0 Xebar Saram <zeltakc@gmail.com> writes:
>> >
>> > =C2=A0 =C2=A0 > Hi again all
>> > =C2=A0 =C2=A0 >
>> > =C2=A0 =C2=A0 > i have been using the before discussed fon= t 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 question i have from using it th= ourhgly is
> weather
>> > =C2=A0 =C2=A0 its
>> > =C2=A0 =C2=A0 > possible to color specific words , IE not = 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 p= ossible?
> currently i
>> > =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 '(:foreground "#
> 000000"
>> > =C2=A0 =C2=A0 > :underline t :background "#FF9AEA&quo= t; :weight ultra-bold)
> t))))
>> >
>> > =C2=A0 =C2=A0 At some point you're definitely going to wa= nt to read up on
>> > =C2=A0 =C2=A0 regular
>> > =C2=A0 =C2=A0 expressions!
>> >
>> > =C2=A0 =C2=A0 But in the meantime yes, it's entirely (mos= tly) possible. A
>> > =C2=A0 =C2=A0 regular
>> > =C2=A0 =C2=A0 expression is just a way of finding desired pie= ces of text in
> a
>> > =C2=A0 =C2=A0 larger
>> > =C2=A0 =C2=A0 run of text. Think of the regexp as an instruct= ion 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 wa= y 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 not a "p").
>> >
>> > =C2=A0 =C2=A0 In the most basic case, however, a regexp is si= mply the text
> you
>> > =C2=A0 =C2=A0 want to
>> > =C2=A0 =C2=A0 find: "Find all pieces of text that are &#= 39;server'". In this
> case,
>> > =C2=A0 =C2=A0 that's
>> > =C2=A0 =C2=A0 your regexp: "server".
>> >
>> > =C2=A0 =C2=A0 The reason regexps 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 te= lling them:
> _yes_
>> > =C2=A0 =C2=A0 this
>> > =C2=A0 =C2=A0 too, _no_ not that. In your case, you'd pro= bably 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 might be:
>> >
>> > =C2=A0 =C2=A0 "Find all pieces of text that are 'ser= ver' 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"
>> >
>> > =C2=A0 =C2=A0 Give that a shot. You're jumping into the m= iddle of something
>> > =C2=A0 =C2=A0 fairly
>> > =C2=A0 =C2=A0 complicated, so be patient and go slow!
>> >
>> > =C2=A0 =C2=A0 E
>> >
>> > =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 ul= tra-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 Abrah= amsen <
>> > =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> 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 w= ith 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 u= sed 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 :background "
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 #
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > DDFFDD" :foregroun= d "#000000") 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- this is a test of 1= x1 to show higlight -1-
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 >
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > it will kill the highli= ght, 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 works well, anyway a= round 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 seem= s it matches also just 1 by
> itself
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 >
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 > best wishes and thx aga= in
>> > =C2=A0 =C2=A0 >
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 Yup, the things inside the [= ^] construct, to _not_ be
>> > =C2=A0 =C2=A0 matched,
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 are
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 treated as a list of single = characters. 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 middle of
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 the line. If you want the hi= ghlighting 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 jus= t use [^\n] instead.
>> > =C2=A0 =C2=A0 >
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 At this point you'll pro= bably 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<= br> >> > =C2=A0 =C2=A0 >
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 I think you mentioned you do= n'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 great
>> > =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 so= mething 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 perf= ect. Then start at the top
> of
>> > =C2=A0 =C2=A0 the
>> > =C2=A0 =C2=A0 > =C2=A0 =C2=A0 introduction 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 >
>> >
>> >
>>
>>



--047d7b6740745c093e04ea54a92c--