emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christopher Dimech <dimech@gmx.com>
To: Tim Cross <theophilusx@gmail.com>, bzg@bzg.fr
Cc: emacs-orgmode@gnu.org
Subject: Re: Highlighting and Background Colour for Source Code
Date: Tue, 11 May 2021 08:39:48 +0200	[thread overview]
Message-ID: <trinity-f07ff012-6275-4164-ab3c-1aa59db794be-1620715188745@3c-app-mailcom-bs03> (raw)
In-Reply-To: <87wns5byeu.fsf@gmail.com>


> Sent: Tuesday, May 11, 2021 at 5:50 PM
> From: "Tim Cross" <theophilusx@gmail.com>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: emacs-orgmode@gnu.org
> Subject: Re: Highlighting and Background Colour for Source Code
>
>
> 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.

I agree that some features of org-mode (e.ge heading folding, code folding)
would be good to have available in emacs-lisp-mode, texinfo-mode, ...
The use of general minor-mode such as outline-minor-mode would be a good place
to handle the various programming languages.

Currently, there in outline-minor-mode and various others (outline-magic, outshine).
Things are all over the place.  I know that Carsten was keen to persuade for ideas in
org-mode to be included in outline-minor-mode.  This has not happened.  I am convinced
that the developers of org-mode could make valuable contributions to outline-minor-mode,
because currently the ideas there are extremely convoluted and writing an outline setup
is difficult.

There will be a number of capabilities to consider

1. Heading Levels using comment lines (e.g. ";;; * Heahding", ";;; ** Subheading", ...)

2. Folding of headings and subheadings only (cycling using single key)

3. Folding of code structures only (cycling using single key)

That would be valuable for starters.  Then we can look at more beef later
on.

What do you think?  Would the org-team be willing and able to assist a re-development
of outline-minor-mode?

> --
> Tim Cross
>


  reply	other threads:[~2021-05-11  6:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  3:48 Christopher Dimech
2021-05-11  4:50 ` Tim Cross
2021-05-11  5:13   ` Christopher Dimech
2021-05-11  5:50     ` Tim Cross
2021-05-11  6:39       ` Christopher Dimech [this message]
2021-05-12 12:08     ` Ihor Radchenko
2021-05-12 12:11       ` Christopher Dimech
2021-05-12 12:27         ` Christopher Dimech

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=trinity-f07ff012-6275-4164-ab3c-1aa59db794be-1620715188745@3c-app-mailcom-bs03 \
    --to=dimech@gmx.com \
    --cc=bzg@bzg.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=theophilusx@gmail.com \
    --subject='Re: Highlighting and Background Colour for Source Code' \
    /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

Code repositories for project(s) associated with this 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).