all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xiha <xiha@laposte.net>
To: emacs-orgmode@gnu.org
Cc: John Kitchin <jkitchin@andrew.cmu.edu>
Subject: Re: Questions about exporting: subtitle, level formating, custom highlight markers error
Date: Wed, 29 Jul 2015 21:32:03 +0200	[thread overview]
Message-ID: <55B92A33.3040607@laposte.net> (raw)
In-Reply-To: <m2fv48z4w0.fsf@andrew.cmu.edu>

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

Hi John,

Yes, highlight-regexp looks good and simple, when I apply it manually to 
the buffer. No need even to define a new face as the default hi-yellow 
is what I want.

But: (how) can I call highlight-regexp from my .emacs file so that it 
automatically applies to every Org buffer? Or must it be called on a per 
buffer basis? Just putting (highlight-regexp "·[^·]*·") in my .emacs, as 
well as (global-hi-lock-mode 1) because Emacs throws a warning 
otherwise, didn't work.

Once I find time to go through this elisp/customization tutorial 
<http://emacslife.com/how-to-read-emacs-lisp.html> I may more fruitfully 
study your post!

thanks


On 07/28/2015 05:19 PM, John Kitchin wrote:
> You may find this post on highlighting text helpful:
> http://kitchingroup.cheme.cmu.edu/blog/2015/07/28/A-highlight-annotation-mode-for-Emacs-using-font-lock/
>
> I think it also lays the foundation for thinking about how to get it to
> export, although you would need to do this as a preprocessing step
> before the org export to replace highlighted regions by the appropriate markup.
>
> It also sounds like you could use the highlight-regexp function for what
> you want.
>
> Something like this might do what you want (use the face you prefer).
>
> (defface my-face3
>    `((t (:inherit org-link :foreground "red")))
>    "My face")
>
>
> (highlight-regexp "·[^·]*·" 'my-face3)
>
> (unhighlight-regexp "·[^·]*·")
>
>
>
> Xiha writes:
>
> ·test·
>
>> Thanks guys. Getting closer - but please don't overestimate my backgound
>> knowledge :)
>>
>> On 07/28/2015 02:05 PM, Eric S Fraga wrote:
>>> You need to differentiate between two aspects: highlighting of text
>>> within a org buffer and what happens to text when exported.
>> Yes. Principally, I want the former.
>>
>> As to the latter: (1) my custom highlighting shouldn't break exporting.
>> (2) /If/ highlighting can appear in the exported document, that's a
>> bonus. But clearly it's not trivial to do; so never mind.
>>
>>> In the new exporter, I don't think you can implement anything that covers
>>> both use cases.
>>>
>>> I am not entirely sure what it is you want.  If you want just one of
>>> these, for the former, font-lock-add-keywords is probably what you want
>>> to pursue.
>> Right, so grabbing code from the manual about font lock mode
>> <https://www.gnu.org/software/emacs/manual/html_node/emacs/Font-Lock.html>,
>> how do I adapt it? I tried putting this in my .emacs file
>>
>> ;; Highlight text between ·interpuncts·
>> (add-hook 'org-mode-hook
>>             (lambda ()
>>              (font-lock-add-keywords nil
>>               '(("·\w·" 1
>>                  font-lock-warning-face t)))))
>>
>> but that doesn't work. Probably that regexp is all wrong?
>>
>> Also, I don't want it to use font-lock-warning-face particularly. (How)
>> can I define a new face for this purpose?
>>
>> Nick Dokos wrote:
>>> Emphasis is detected in the parser, so it is indeed difficult to add new
>>> emphasis for export.
>>>
>>> Since you don't care about the added emphasis in the exported document
>>> (only in the org buffer), using latest org from git works OK,
>> So do I understand correctly that this is a completely different route
>> than the font-lock-add-keywords one above? I.e. using this latest git
>> version, I can define the highlight marker as I did and described
>> earlier, and there's no need for a new face, because it uses the
>> 'highlight' defined in the theme I'm using. Correct?
>>
>> I cloned the git files, but I'm wary of the next steps. If I just make
>> and make install, will it not half-overwrite my current stable Org, and
>> become a big mess? Sorry, this stuff is new to me and not really obvious.
>>
>> Also: I tried reinstalling Org via the menu, Options >> Manage Emacs
>> Packages in hopes that it would install the git version while taking
>> care of avoiding a mess. It now lists 20150727 as the version, so that's
>> recent, but is that the 'bleeding edge' version or the stable version at
>> that date? It didn't solve the problem, at any rate.
>>
>>> except
>>> that the marker characters are copied verbatim to the output, so you'll
>>> have some cleanup to do.
>> That's okay. It's not a problem for draft versions of the document; and
>> by the time the final document is ready, all this temporary highlighting
>> should be gone!
>>
>>> I also tried 8.2.9 and got an error, but the error is different from
>>> what you get (backtrace attached).
>> I am using 8.2.10 not 8.2.9 so that may explain the difference.
>>
>> cheers
> --
> 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


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

  reply	other threads:[~2015-07-29 19:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-26 13:04 Questions about exporting: subtitle, level formating, custom highlight markers error Xiha
2015-07-26 18:44 ` Rasmus
2015-07-27  8:34 ` Eric S Fraga
2015-07-27 13:55   ` Xiha
2015-07-27 15:02     ` Eric S Fraga
2015-07-28  7:24       ` Sebastien Vauban
2015-07-28  8:20         ` Eric S Fraga
2015-07-28 11:38       ` Xiha
2015-07-28 12:05         ` Eric S Fraga
2015-07-28 13:47           ` Xiha
2015-07-28 15:19             ` John Kitchin
2015-07-29 19:32               ` Xiha [this message]
2015-07-29 19:51                 ` Marcin Borkowski
2015-07-28 12:25         ` Nick Dokos

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

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

  git send-email \
    --in-reply-to=55B92A33.3040607@laposte.net \
    --to=xiha@laposte.net \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.