emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Xebar Saram <zeltakc@gmail.com>
To: Eric Abrahamsen <eric@ericabrahamsen.net>,
	org mode <emacs-orgmode@gnu.org>
Subject: Re: custom emacs org-emphasis-alist breaks EXPORT, help ;-) ?
Date: Sat, 2 Nov 2013 14:50:48 +0200	[thread overview]
Message-ID: <CAOQHXPqr1rQcXQrLZnR6pdSKs3jrFwn+XUOAx1hMdwRfNheUxQ@mail.gmail.com> (raw)
In-Reply-To: <8761sbkt3q.fsf@ericabrahamsen.net>

[-- 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 --]

  reply	other threads:[~2013-11-02 12:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOQHXPqr1rQcXQrLZnR6pdSKs3jrFwn+XUOAx1hMdwRfNheUxQ@mail.gmail.com \
    --to=zeltakc@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric@ericabrahamsen.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).