emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
@ 2013-10-04  6:31 Xebar Saram
  2013-10-04  7:21 ` Bastien
  0 siblings, 1 reply; 20+ messages in thread
From: Xebar Saram @ 2013-10-04  6:31 UTC (permalink / raw)
  To: org mode

[-- Attachment #1: Type: text/plain, Size: 3433 bytes --]

hi all

so after struggling for weeks to figure out why i always get an error when
exporting i finally nailed the issue: org-emphasis-alist. i have alot of
them (see below) and use them in orgmode quite often. is this a bug or if
you want to use the exporter you should avoid using org-emphasis-alist?

thx alot

Z

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ac-dictionary-directories (quote
("/home/zeltak/.emacs.d/elpa/auto-complete-20130330.1836/dict"
"/home/zeltak/.emacs.d/dictionary")))
 '(bmkp-last-as-first-bookmark-file "/home/zeltak/.emacs.d/bookmarks")
 '(company-backends (quote (company-elisp company-nxml company-css
company-semantic company-clang company-eclim company-xcode company-ropemacs
(company-gtags company-etags company-dabbrev-code company-keywords
company-ispell) company-oddmuse company-files company-dabbrev)))
 '(custom-safe-themes (quote
("f57ee03c7fd6fb499bab560e376f824ee2193bf96af6ae67b3019e44ab6a72bd"
"2a7d75398789781fe7ae983110c1147bde702020f7bea8b25d9cf243d4fc5007"
"52079e380fbb333931e07e1ca7946c5eea7b737dd2c33dbfba7818ea70c4540e"
"9abb5a74b8789de4f8552a620ea65ce739d955715f446468ea04fd4e14d21488"
"a3f50a2d553d995b9328fd864c08cc6af60403a8a45abf95b9072f0f9c77898a"
"752b605b3db4d76d7d8538bbc6fe8828f6d92a720c0ea334b4e01cea44d4b7a9"
"9b6be33571491c7118e129a15cc5a92b28d414a9bb68e7b04c508e6107524ba0"
"c9d00d43bd5ad4eb7fa4c0e865b666216dfac4584eede68fbd20d7582013a703"
"5ce9c2d2ea2d789a7e8be2a095b8bc7db2e3b985f38c556439c358298827261c"
default)))
 '(org-emphasis-alist (quote (("?" (:weight ultra-bold :background
"#FFBF1E")) ("₆" (:foreground "#000000" :underline t :background "#FF9AEA"
:weight ultra-bold)) ("₅" (:weight ultra-bold :foreground "#1E00DE")) ("`"
(:foreground "#000000" :weight ultra-bold :background "#FBFF00")) ("₄"
(:weight ultra-bold :foreground "#FF9800")) ("♪" (:box t)) ("♩" default)
("«" (:foreground "#393D90")) ("^" (:foreground "#393D90" :weight
ultra-bold)) ("¶" (:underline t :height 1.3 :weight ultra-bold)) ("¡"
(:foreground "#FFA500" :weight ultra-bold)) ("'" (:background "#35FF00"
:weight ultra-bold)) ("-" (:foreground "#ffffff" :slant italic :height 1.3
:weight ultra-bold :background "#3f8c5c")) ("+" (:background "#59BD7F"
:foreground "#ffffff" :slant italic :height 1.2 :weight bold)) ("!"
(:weight ultra-bold :foreground "#B40000")) ("%" (:weight ultra-bold
:background "#DDFFDD" :foreground "#000000")) ("$" (nil nil :background
"#DDDDFF" :foreground "#000000" :weight ultra-bold)) ("₁" (:weight
ultra-bold :box t :background "#F6F9FF" :foreground "#000000" :height 1.6))
("₂" (:background "#F6F9FF" :box t :height 1.2 :weight ultra-bold)) ("₃"
(:weight ultra-bold :background "#F6F9FF" :height 1.1 :underline t)) ("@"
(:foreground "#B40000" :background "#FFDDDD" :weight bold)) (":" (:weight
bold :height\  2 :Foreground "#FFFFFF")) ("*" bold) ("/" italic) ("_"
underline) ("=" org-code verbatim) ("~" org-verbatim verbatim)))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

[-- Attachment #2: Type: text/html, Size: 4372 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-04  6:31 custom emacs org-emphasis-alist breaks EXPORT, help ;-) ? Xebar Saram
@ 2013-10-04  7:21 ` Bastien
  2013-10-04  7:50   ` Xebar Saram
  0 siblings, 1 reply; 20+ messages in thread
From: Bastien @ 2013-10-04  7:21 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

Hi Xebar,

Xebar Saram <zeltakc@gmail.com> writes:

> so after struggling for weeks to figure out why i always get an error
> when exporting i finally nailed the issue: org-emphasis-alist. i have
> alot of them (see below) and use them in orgmode quite often. is this
> a bug or if you want to use the exporter you should avoid using
> org-emphasis-alist?

You use org-emphasis-alist to do simple highlighting, right?

In that case, using you should better use `font-lock-add-keywords'.

See http://www.emacswiki.org/emacs/AddKeywords for details.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-04  7:21 ` Bastien
@ 2013-10-04  7:50   ` Xebar Saram
  2013-10-04  8:02     ` Bastien
  0 siblings, 1 reply; 20+ messages in thread
From: Xebar Saram @ 2013-10-04  7:50 UTC (permalink / raw)
  To: Bastien; +Cc: org mode

[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

Thx Bastien!

i look at it but it seemed highly complex (im an academic and dont know
much (well nothing tbh :) ) about programming. is there a simple way of
defining these like the GUI for org-emphasis-alist  (i used
customize-variables )
as you said i just want to highlight (BG/FG) specific areas/lines.
any help would be greatly appreciated!

best guys

Itai


On Fri, Oct 4, 2013 at 10:21 AM, Bastien <bzg@gnu.org> wrote:

> Hi Xebar,
>
> Xebar Saram <zeltakc@gmail.com> writes:
>
> > so after struggling for weeks to figure out why i always get an error
> > when exporting i finally nailed the issue: org-emphasis-alist. i have
> > alot of them (see below) and use them in orgmode quite often. is this
> > a bug or if you want to use the exporter you should avoid using
> > org-emphasis-alist?
>
> You use org-emphasis-alist to do simple highlighting, right?
>
> In that case, using you should better use `font-lock-add-keywords'.
>
> See http://www.emacswiki.org/emacs/AddKeywords for details.
>
> HTH,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 1871 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-04  7:50   ` Xebar Saram
@ 2013-10-04  8:02     ` Bastien
  2013-10-04  8:23       ` Xebar Saram
  0 siblings, 1 reply; 20+ messages in thread
From: Bastien @ 2013-10-04  8:02 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

Xebar Saram <zeltakc@gmail.com> writes:

> as you said i just want to highlight (BG/FG) specific areas/lines.
> any help would be greatly appreciated!

E.g. you can do this to highlight ♩ with '(:weight
ultra-bold :background "#FFBF1E") :

(font-lock-add-keywords
 'org-mode
 '(("♩" (0 '(:weight ultra-bold :background "#FFBF1E") t))))

"♩" is actually a regular expression, so you can use [♩©] to highlight
both ♩ and ©.

0 means to highlight the entire matching text.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-04  8:02     ` Bastien
@ 2013-10-04  8:23       ` Xebar Saram
  2013-10-04  8:27         ` Bastien
  2013-10-04  9:15         ` Eric Abrahamsen
  0 siblings, 2 replies; 20+ messages in thread
From: Xebar Saram @ 2013-10-04  8:23 UTC (permalink / raw)
  To: Bastien; +Cc: org mode

[-- Attachment #1: Type: text/plain, Size: 997 bytes --]

Thank you again

that works well but i think it dosent cover what i had in org. in org i use
the ♩ symbol to highlight all the text between the 2 ♩, IE

♩ALL THIS TEXT IS HIGHLIGHTED♩, currently with the above code the ♩ is
highlighted but not the text between, is it possible to do achive that with
font-lock?

i really appreciate your help!

z


On Fri, Oct 4, 2013 at 11:02 AM, Bastien <bzg@gnu.org> wrote:

> Xebar Saram <zeltakc@gmail.com> writes:
>
> > as you said i just want to highlight (BG/FG) specific areas/lines.
> > any help would be greatly appreciated!
>
> E.g. you can do this to highlight ♩ with '(:weight
> ultra-bold :background "#FFBF1E") :
>
> (font-lock-add-keywords
>  'org-mode
>  '(("♩" (0 '(:weight ultra-bold :background "#FFBF1E") t))))
>
> "♩" is actually a regular expression, so you can use [♩©] to highlight
> both ♩ and ©.
>
> 0 means to highlight the entire matching text.
>
> HTH,
>
> --
>  Bastien
>

[-- Attachment #2: Type: text/html, Size: 2538 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-04  8:23       ` Xebar Saram
@ 2013-10-04  8:27         ` Bastien
  2013-10-04  9:15         ` Eric Abrahamsen
  1 sibling, 0 replies; 20+ messages in thread
From: Bastien @ 2013-10-04  8:27 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

Xebar Saram <zeltakc@gmail.com> writes:

> ♩ALL THIS TEXT IS HIGHLIGHTED♩, currently with the above code the ♩
> is highlighted but not the text between, is it possible to do achive
> that with font-lock?

Not with font-lock-add-keywords, which I think is just for one-liner
highlights (as the name suggests.)

There might be other solutions, but it's definitely more complicated,
sorry I can't dive into this now.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-04  8:23       ` Xebar Saram
  2013-10-04  8:27         ` Bastien
@ 2013-10-04  9:15         ` Eric Abrahamsen
  2013-10-04 19:12           ` Xebar Saram
  1 sibling, 1 reply; 20+ messages in thread
From: Eric Abrahamsen @ 2013-10-04  9:15 UTC (permalink / raw)
  To: emacs-orgmode

Xebar Saram <zeltakc@gmail.com> writes:

> Thank you again
>
> that works well but i think it dosent cover what i had in org. in org
> i use the ♩ symbol to highlight all the text between the 2 ♩, IE
>
> ♩ALL THIS TEXT IS HIGHLIGHTED♩, currently with the above code the ♩
> is highlighted but not the text between, is it possible to do achive
> that with font-lock?
>
> i really appreciate your help!
>
> z

Yup, it's pretty much the exact same thing, just with a different
regexp.

(font-lock-add-keywords
 'org-mode
 '(("\\(♩[^♩]+♩\\)" (0 '(:weight ultra-bold :background "#FFBF1E") t))))

You can use "♩\\([^♩]+\\)♩" instead, if you only want the text between
the symbols to be highlighted.

It might be a good idea to somehow limit the number of newlines that
the regexp can match, I'm not sure.

Yours,
Eric

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-04  9:15         ` Eric Abrahamsen
@ 2013-10-04 19:12           ` Xebar Saram
  2013-10-05  4:42             ` Eric Abrahamsen
  0 siblings, 1 reply; 20+ messages in thread
From: Xebar Saram @ 2013-10-04 19:12 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: org mode

[-- Attachment #1: Type: text/plain, Size: 1245 bytes --]

Thank you so much Eric

that works well apart from as you said it sometime "spills" over to other
uneeded lines. any idea of how to limit the number of newlines that
the regexp can match?

really appreciate the help

z.


On Fri, Oct 4, 2013 at 12:15 PM, Eric Abrahamsen <eric@ericabrahamsen.net>wrote:

> Xebar Saram <zeltakc@gmail.com> writes:
>
> > Thank you again
> >
> > that works well but i think it dosent cover what i had in org. in org
> > i use the ♩ symbol to highlight all the text between the 2 ♩, IE
> >
> > ♩ALL THIS TEXT IS HIGHLIGHTED♩, currently with the above code the ♩
> > is highlighted but not the text between, is it possible to do achive
> > that with font-lock?
> >
> > i really appreciate your help!
> >
> > z
>
> Yup, it's pretty much the exact same thing, just with a different
> regexp.
>
> (font-lock-add-keywords
>  'org-mode
>  '(("\\(♩[^♩]+♩\\)" (0 '(:weight ultra-bold :background "#FFBF1E") t))))
>
> You can use "♩\\([^♩]+\\)♩" instead, if you only want the text between
> the symbols to be highlighted.
>
> It might be a good idea to somehow limit the number of newlines that
> the regexp can match, I'm not sure.
>
> Yours,
> Eric
>
>
>

[-- Attachment #2: Type: text/html, Size: 2368 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-04 19:12           ` Xebar Saram
@ 2013-10-05  4:42             ` Eric Abrahamsen
  2013-10-05 17:09               ` Xebar Saram
  0 siblings, 1 reply; 20+ messages in thread
From: Eric Abrahamsen @ 2013-10-05  4:42 UTC (permalink / raw)
  To: emacs-orgmode

Xebar Saram <zeltakc@gmail.com> writes:

> Thank you so much Eric
>
> that works well apart from as you said it sometime "spills" over to
> other uneeded lines. any idea of how to limit the number of newlines
> that
> the regexp can match?
>
> really appreciate the help

The easiest thing would be to add a newline to the list of non-matching
characters, like this: "\\(♩[^♩\n]+♩\\)". That won't match _anything_
that goes longer than one line, though -- is that what you want? I'm
actually not sure how to make the regexp match a specific number of
newlines without things getting much more complicated... 

> On Fri, Oct 4, 2013 at 12:15 PM, Eric Abrahamsen <
> eric@ericabrahamsen.net> wrote:
>
>     Xebar Saram <zeltakc@gmail.com> writes:
>    
>     > Thank you again
>     >
>     > that works well but i think it dosent cover what i had in org.
>     in org
>     > i use the ♩ symbol to highlight all the text between the 2 ♩,
>     IE
>     >
>     > ♩ALL THIS TEXT IS HIGHLIGHTED♩, currently with the above code
>     the ♩
>     > is highlighted but not the text between, is it possible to do
>     achive
>     > that with font-lock?
>     >
>     > i really appreciate your help!
>     >
>     > z
>    
>     Yup, it's pretty much the exact same thing, just with a different
>     regexp.
>    
>     (font-lock-add-keywords
>      'org-mode
>      '(("\\(♩[^♩]+♩\\)" (0 '(:weight ultra-bold :background "#
>     FFBF1E") t))))
>    
>     You can use "♩\\([^♩]+\\)♩" instead, if you only want the text
>     between
>     the symbols to be highlighted.
>    
>     It might be a good idea to somehow limit the number of newlines
>     that
>     the regexp can match, I'm not sure.
>    
>     Yours,
>     Eric
>    
>    

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-05  4:42             ` Eric Abrahamsen
@ 2013-10-05 17:09               ` Xebar Saram
  2013-10-06  5:04                 ` Eric Abrahamsen
  0 siblings, 1 reply; 20+ messages in thread
From: Xebar Saram @ 2013-10-05 17:09 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: org mode

[-- Attachment #1: Type: text/plain, Size: 2614 bytes --]

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

Z





On Sat, Oct 5, 2013 at 7:42 AM, Eric Abrahamsen <eric@ericabrahamsen.net>wrote:

> Xebar Saram <zeltakc@gmail.com> writes:
>
> > Thank you so much Eric
> >
> > that works well apart from as you said it sometime "spills" over to
> > other uneeded lines. any idea of how to limit the number of newlines
> > that
> > the regexp can match?
> >
> > really appreciate the help
>
> The easiest thing would be to add a newline to the list of non-matching
> characters, like this: "\\(♩[^♩\n]+♩\\)". That won't match _anything_
> that goes longer than one line, though -- is that what you want? I'm
> actually not sure how to make the regexp match a specific number of
> newlines without things getting much more complicated...
>
> > On Fri, Oct 4, 2013 at 12:15 PM, Eric Abrahamsen <
> > eric@ericabrahamsen.net> wrote:
> >
> >     Xebar Saram <zeltakc@gmail.com> writes:
> >
> >     > Thank you again
> >     >
> >     > that works well but i think it dosent cover what i had in org.
> >     in org
> >     > i use the ♩ symbol to highlight all the text between the 2 ♩,
> >     IE
> >     >
> >     > ♩ALL THIS TEXT IS HIGHLIGHTED♩, currently with the above code
> >     the ♩
> >     > is highlighted but not the text between, is it possible to do
> >     achive
> >     > that with font-lock?
> >     >
> >     > i really appreciate your help!
> >     >
> >     > z
> >
> >     Yup, it's pretty much the exact same thing, just with a different
> >     regexp.
> >
> >     (font-lock-add-keywords
> >      'org-mode
> >      '(("\\(♩[^♩]+♩\\)" (0 '(:weight ultra-bold :background "#
> >     FFBF1E") t))))
> >
> >     You can use "♩\\([^♩]+\\)♩" instead, if you only want the text
> >     between
> >     the symbols to be highlighted.
> >
> >     It might be a good idea to somehow limit the number of newlines
> >     that
> >     the regexp can match, I'm not sure.
> >
> >     Yours,
> >     Eric
> >
> >
>
>
>

[-- Attachment #2: Type: text/html, Size: 3875 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-05 17:09               ` Xebar Saram
@ 2013-10-06  5:04                 ` Eric Abrahamsen
  2013-11-02  7:48                   ` Xebar Saram
  0 siblings, 1 reply; 20+ messages in thread
From: Eric Abrahamsen @ 2013-10-06  5:04 UTC (permalink / raw)
  To: emacs-orgmode

Xebar Saram <zeltakc@gmail.com> 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

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-10-06  5:04                 ` Eric Abrahamsen
@ 2013-11-02  7:48                   ` Xebar Saram
  2013-11-02 10:15                     ` Eric Abrahamsen
  0 siblings, 1 reply; 20+ messages in thread
From: Xebar Saram @ 2013-11-02  7:48 UTC (permalink / raw)
  To: Eric Abrahamsen; +Cc: org mode

[-- Attachment #1: Type: text/plain, Size: 2455 bytes --]

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
'(("\\(₆[^₆\n]+₆\\)" (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 <zeltakc@gmail.com> 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
>
>
>

[-- Attachment #2: Type: text/html, Size: 3472 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-11-02  7:48                   ` Xebar Saram
@ 2013-11-02 10:15                     ` Eric Abrahamsen
  2013-11-02 12:50                       ` Xebar Saram
  0 siblings, 1 reply; 20+ messages in thread
From: Eric Abrahamsen @ 2013-11-02 10:15 UTC (permalink / raw)
  To: emacs-orgmode

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 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
> '(("\\(₆[^₆\n]+₆\\)" (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 <zeltakc@gmail.com> 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
>    
>    

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-11-02 10:15                     ` Eric Abrahamsen
@ 2013-11-02 12:50                       ` Xebar Saram
  2013-11-02 15:12                         ` Jambunathan K
  2013-11-03  4:15                         ` Eric Abrahamsen
  0 siblings, 2 replies; 20+ messages in thread
From: Xebar Saram @ 2013-11-02 12:50 UTC (permalink / raw)
  To: Eric Abrahamsen, org mode

[-- Attachment #1: Type: text/plain, Size: 5051 bytes --]

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 <eric@ericabrahamsen.net>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 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
> > '(("\\(₆[^₆\n]+₆\\)" (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 <zeltakc@gmail.com> 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
> >
> >
>
>
>

[-- Attachment #2: Type: text/html, Size: 6801 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-11-02 12:50                       ` Xebar Saram
@ 2013-11-02 15:12                         ` Jambunathan K
  2013-11-03  4:15                         ` Eric Abrahamsen
  1 sibling, 0 replies; 20+ messages in thread
From: Jambunathan K @ 2013-11-02 15:12 UTC (permalink / raw)
  To: Xebar Saram; +Cc: Eric Abrahamsen, org mode


Working with font-lock keywords is quite messy.  The good news is that
you don't have to do it.  

If you want highlighting in the buffer or a file (and but not in the
exported buffer), just go with hi-lock-mode.

The relevant manual page is at

    C-h K C-x w b

In your Org file do this,

    C-x C-f somefile.org
    M-x hi-lock-mode RET
    C-x w p server 
    M->
    C-x w b
    C-x C-s
    C-x k
    C-x C-f somefile.org

When you reopen the file hi-lock may ask some confusing questions.
Answer those.

You will see that now whenever you open the file, the word `server' is
always highlighted.

If you are adventurous, you can do

   C-h v font-lock-keywords 

within the org file and examine how it looks like for specific keywords
you have added.



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 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
> <eric@ericabrahamsen.net> 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 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
>     > '(("\\(₆[^₆\n]+₆\\)" (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 <zeltakc@gmail.com> 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
>     >
>     >
>     
>     
>     

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-11-03  9:48                           ` Xebar Saram
@ 2013-11-03  0:16                             ` Jambunathan K
  2013-11-04  4:03                             ` Eric Abrahamsen
  1 sibling, 0 replies; 20+ messages in thread
From: Jambunathan K @ 2013-11-03  0:16 UTC (permalink / raw)
  To: Xebar Saram; +Cc: org mode

Xebar Saram <zeltakc@gmail.com> writes:

> 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?

IIRC, The patterns are per-file.  There are some 6 or so hi-lock faces
that you can customize.  

If you are running development version of Emacs you can further
customize `hi-lock-auto-select-face'.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-11-02 12:50                       ` Xebar Saram
  2013-11-02 15:12                         ` Jambunathan K
@ 2013-11-03  4:15                         ` Eric Abrahamsen
  2013-11-03  9:48                           ` Xebar Saram
  1 sibling, 1 reply; 20+ messages in thread
From: Eric Abrahamsen @ 2013-11-03  4:15 UTC (permalink / raw)
  To: emacs-orgmode

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 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 <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 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
>     > '(("\\(₆[^₆\n]+₆\\)" (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 <zeltakc@gmail.com> 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
>     >
>     >
>    
>    

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-11-03  4:15                         ` Eric Abrahamsen
@ 2013-11-03  9:48                           ` Xebar Saram
  2013-11-03  0:16                             ` Jambunathan K
  2013-11-04  4:03                             ` Eric Abrahamsen
  0 siblings, 2 replies; 20+ messages in thread
From: Xebar Saram @ 2013-11-03  9:48 UTC (permalink / raw)
  To: Eric Abrahamsen, org mode, kjambunathan

[-- Attachment #1: Type: text/plain, Size: 6943 bytes --]

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 <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 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 <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 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
> >     > '(("\\(₆[^₆\n]+₆\\)" (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 <zeltakc@gmail.com> 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
> >     >
> >     >
> >
> >
>
>

[-- Attachment #2: Type: text/html, Size: 10057 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-11-03  9:48                           ` Xebar Saram
  2013-11-03  0:16                             ` Jambunathan K
@ 2013-11-04  4:03                             ` Eric Abrahamsen
  2013-11-04  7:14                               ` Xebar Saram
  1 sibling, 1 reply; 20+ messages in thread
From: Eric Abrahamsen @ 2013-11-04  4:03 UTC (permalink / raw)
  To: emacs-orgmode

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 :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 <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 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 <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 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
>> >     > '(("\\(₆[^₆\n]+₆\\)" (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 <zeltakc@gmail.com> 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
>> >     >
>> >     >
>> >
>> >
>>
>>

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
  2013-11-04  4:03                             ` Eric Abrahamsen
@ 2013-11-04  7:14                               ` Xebar Saram
  0 siblings, 0 replies; 20+ messages in thread
From: Xebar Saram @ 2013-11-04  7:14 UTC (permalink / raw)
  To: Eric Abrahamsen, org mode

[-- Attachment #1: Type: text/plain, Size: 8246 bytes --]

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 <eric@ericabrahamsen.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 :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 <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 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 <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 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
> >> >     > '(("\\(₆[^₆\n]+₆\\)" (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 <zeltakc@gmail.com> 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
> >> >     >
> >> >     >
> >> >
> >> >
> >>
> >>
>
>
>

[-- Attachment #2: Type: text/html, Size: 12561 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-11-04  7:14 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-04  6:31 custom emacs org-emphasis-alist breaks EXPORT, help ;-) ? Xebar Saram
2013-10-04  7:21 ` Bastien
2013-10-04  7:50   ` Xebar Saram
2013-10-04  8:02     ` Bastien
2013-10-04  8:23       ` Xebar Saram
2013-10-04  8:27         ` Bastien
2013-10-04  9:15         ` Eric Abrahamsen
2013-10-04 19:12           ` Xebar Saram
2013-10-05  4:42             ` Eric Abrahamsen
2013-10-05 17:09               ` Xebar Saram
2013-10-06  5:04                 ` Eric Abrahamsen
2013-11-02  7:48                   ` Xebar Saram
2013-11-02 10:15                     ` Eric Abrahamsen
2013-11-02 12:50                       ` Xebar Saram
2013-11-02 15:12                         ` Jambunathan K
2013-11-03  4:15                         ` Eric Abrahamsen
2013-11-03  9:48                           ` Xebar Saram
2013-11-03  0:16                             ` Jambunathan K
2013-11-04  4:03                             ` Eric Abrahamsen
2013-11-04  7:14                               ` Xebar Saram

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).