emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to colorize text in square brackets?
@ 2019-02-11 14:51 Sharon Kimble
  2019-02-14  9:05 ` SOLUTION - " Sharon Kimble
  0 siblings, 1 reply; 3+ messages in thread
From: Sharon Kimble @ 2019-02-11 14:51 UTC (permalink / raw)
  To: emacs-orgmode

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


How can I colorize text within square brackets please, like [fu] ?

I need them colorized as they will hold reminders for myself at that position whilst I'm writing.

Thanks
Sharon.
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 9.5, fluxbox 1.3.7, emacs 26.1.91, org 9.2.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* SOLUTION - Re:  How to colorize text in square brackets?
  2019-02-11 14:51 How to colorize text in square brackets? Sharon Kimble
@ 2019-02-14  9:05 ` Sharon Kimble
  2019-02-14 13:30   ` John Kitchin
  0 siblings, 1 reply; 3+ messages in thread
From: Sharon Kimble @ 2019-02-14  9:05 UTC (permalink / raw)
  To: emacs-orgmode

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

Sharon Kimble <boudiccas@skimble.plus.com> writes:

> How can I colorize text within square brackets please, like [fu] ?
>
> I need them colorized as they will hold reminders for myself at that position whilst I'm writing.
>

When I posted this question I knew that the answer would probably lie somewhere within font-lock-add-keywords, but I was unable to find it until I started googling for 'font-lock-keyword-face' which I was already using. This search then lead me to these two pages [1] and [2].

And that lead to this code which achieves what I was trying to accomplish, the text within the square boxes to be coloured totally different from its surrounding text, meaning that now I can write my book and leave myself reminders of various questions, which when I've found the answers can then be deleted.

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC emacs-lisp
(font-lock-add-keywords 'org-mode
                        '(("\\[\\(.*\\)\\]"
                                 1 font-lock-type-face prepend)))
#+END_SRC
--8<---------------cut here---------------end--------------->8---

Thanks
Sharon.

[1] - https://stackoverflow.com/questions/7401787/emacs-mode-how-to-specify-that-thing-in-square-brackets-should-be-colored
[2] - https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html
-- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 9.5, fluxbox 1.3.7, emacs 26.1.91, org 9.2.1

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: SOLUTION - Re:  How to colorize text in square brackets?
  2019-02-14  9:05 ` SOLUTION - " Sharon Kimble
@ 2019-02-14 13:30   ` John Kitchin
  0 siblings, 0 replies; 3+ messages in thread
From: John Kitchin @ 2019-02-14 13:30 UTC (permalink / raw)
  To: Sharon Kimble; +Cc: emacs-orgmode

I have been using
https://github.com/jkitchin/scimax/blob/master/scimax-editmarks.org

for something like this. It allows me to put comments with a little
markup that are colored as you describe. There is also support to show a
listing of all those comments, so that you don't overlook them by
accident. Of course, you can always use occur on the regexp you are
fontifying to find those too.

Sharon Kimble <boudiccas@skimble.plus.com> writes:

> Sharon Kimble <boudiccas@skimble.plus.com> writes:
>
>> How can I colorize text within square brackets please, like [fu] ?
>>
>> I need them colorized as they will hold reminders for myself at that position whilst I'm writing.
>>
>
> When I posted this question I knew that the answer would probably lie somewhere within font-lock-add-keywords, but I was unable to find it until I started googling for 'font-lock-keyword-face' which I was already using. This search then lead me to these two pages [1] and [2].
>
> And that lead to this code which achieves what I was trying to accomplish, the text within the square boxes to be coloured totally different from its surrounding text, meaning that now I can write my book and leave myself reminders of various questions, which when I've found the answers can then be deleted.
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_SRC emacs-lisp
> (font-lock-add-keywords 'org-mode
>                         '(("\\[\\(.*\\)\\]"
>                                  1 font-lock-type-face prepend)))
> #+END_SRC
> --8<---------------cut here---------------end--------------->8---
>
> Thanks
> Sharon.
>
> [1] - https://stackoverflow.com/questions/7401787/emacs-mode-how-to-specify-that-thing-in-square-brackets-should-be-colored
> [2] - https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

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

end of thread, other threads:[~2019-02-14 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-11 14:51 How to colorize text in square brackets? Sharon Kimble
2019-02-14  9:05 ` SOLUTION - " Sharon Kimble
2019-02-14 13:30   ` John Kitchin

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).