emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Highlighting and Background Colour for Source Code


From: Tim Cross
Subject: Re: Highlighting and Background Colour for Source Code
Date: Tue, 11 May 2021 15:50:17 +1000
User-agent: mu4e 1.5.13; emacs 28.0.50

Christopher Dimech <dimech@gmx.com> writes:

>> Sent: Tuesday, May 11, 2021 at 4:50 PM
>> From: "Tim Cross" <theophilusx@gmail.com>
>> To: emacs-orgmode@gnu.org
>> Subject: Re: Highlighting and Background Colour for Source Code
>>
>>
>> Christopher Dimech <dimech@gmx.com> writes:
>>
>> > Currently currently handles the highlighting of programming languages 
>> > through
>> > "Code Blocks".  Could org-mode have the capability of highlighting a whole 
>> > buffer
>> > with a particular language highlight typeface.
>> >
>>
>> Sorry, I don't quite understand what exactly your asking for?
>
> Suppose I have an elisp file and I change to org-mode by hitting "M-x 
> org-mode".
> The code does not get highlighted because it is not embedded within org-babel
> construct.
>
> If I have a programming language file with some org-mode heading commands in 
> it,
> and change to org-mode, it would be neat to have language highlighting 
> available.
>

OK, now I think I understand.

Basically, with full org-mode, this is not possible and I don't think it
is actually want you want. Once you switch modes, say from elisp mode to
org mode, a lot more changes than just the font locking. Keybindings,
various support minor modes and lots more.

The 'normal' Emacs way to handle what you are looking for is to add a
minor mode. A minor mode is used to add some level of functionality to a
buffer without losing the major mode settings. Normally, you only have
one major mode associated with a buffer and often that mode is augmented
with a bunch of minor modes. For example, outshine mode is a minor mode
which adds some org-like functionality to non org-mode buffers.

Have a look at

https://orgmode.org/worg/org-tutorials/org-outside-org.html

I think that might give you some ideas to get you started. You may need
a few different minor modes to get the full setup you want and you will
likely need to do some customisation of key bindings etc to get things
how you like it. 

-- 
Tim Cross



reply via email to

[Prev in Thread] Current Thread [Next in Thread]