inherit-org icon indicating copy to clipboard operation
inherit-org copied to clipboard

Inherit Org Faces to non-org buffers

#+TITLE: INHERIT-ORG #+DATE: May 3, 2020 #+SINCE: {replace with next tagged release version} #+STARTUP: inlineimages nofold

  • Table of Contents :TOC_3:noexport:
  • [[#description][Description]]
  • [[#screenshots][Screenshots]]
    • [[#w3m][w3m]]
    • [[#info][Info]]
    • [[#helpful][helpful]]
    • [[#fundamental-mode-or-other-modes][Fundamental mode or other modes]]
  • [[#prerequisites][Prerequisites]]
  • [[#before-the-installation][Before the installation]]
  • [[#installation][Installation]]
    • [[#install-inherit-orgel][Install inherit-org.el]]
      • [[#ues-package][ues-package]]
      • [[#doom-emacs][Doom Emacs]]
      • [[#spacemacs-or-other-emacs-distributions][Spacemacs or other emacs distributions]]
  • [[#configuration][Configuration]]
    • [[#enable-inherit-orgel][Enable inherit-org.el]]
    • [[#inherit-org-fontify-buffer][inherit-org-fontify-buffer]]
  • Description =inherit-org=: Inherit org faces to non-org buffers.

The following major modes are supported at this moment:

  1. [[https://github.com/emacs-w3m/emacs-w3m][w3m mode]]

    • Inherit org faces
    • Minor mode: =inherit-org-mode=
      • =imenu=
      • =outline-minor-mode=
      • =org-indent-mode=
  2. [[https://www.emacswiki.org/emacs/InfoMode][Info mode]]

    • Only Inherit org faces
  3. [[https://github.com/Wilfred/helpful][helpful mode]]

    • Inherit org faces
    • Minor mode: =inherit-org-mode=
      • =imenu=
      • =outline-minor-mode=
      • =org-indent-mode=
  4. Any other modes

    • Function: =inherit-org-fontify-buffer=
  • Screenshots ** w3m [[img/w3m.png]] ** Info [[img/Info.png]] ** helpful [[img/helpful.png]] ** Fundamental mode or other modes [[img/Fundamental.png]] [[img/Fundamental-2.png]] [[img/Programming.png]]

  • Prerequisites This package uses =org=, =imenu=, =outline=

  • Before the installation This package would not give you 100% org features to non-org buffers, but it can give you a more nature/similar interface just like org mode. Some major modes can support more org features, some can not, because different packages have different design, hacking all non-org library is difficult and a long way to go.

Anyway, please go ahead~

  • Installation

Then install this package:

** Install inherit-org.el Choose one of the following installation methods based on your needs:

*** ues-package

#+BEGIN_SRC emacs-lisp (use-package inherit-org :quelpa (inherit-org :repo "chenyanming/inherit-org" :fetcher github)) #+END_SRC

*** Doom Emacs Add the following line to =package.el= #+BEGIN_SRC emacs-lisp (package! inherit-org :recipe (:host github :repo "chenyanming/inherit-org")) #+END_SRC

Run =./.emacs.d/bin/doom sync=

*** Spacemacs or other emacs distributions Put =inherit-org.el= to your load-path. Here is example of ~spacemacs~

#+BEGIN_SRC sh git clone [email protected]:chenyanming/inherit-org.git ~/.emacs.d/private/inherit-org #+END_SRC

#+BEGIN_SRC emacs-lisp (add-to-list 'load-path (expand-file-name "~/.emacs.d/private/inherit-org")) (require 'inherit-org) #+END_SRC

  • Configuration

** Enable inherit-org.el

#+BEGIN_SRC emacs-lisp (with-eval-after-load 'org (require 'inherit-org)

(with-eval-after-load 'info (add-hook 'Info-mode-hook 'inherit-org-mode))

(with-eval-after-load 'helpful (add-hook 'helpful-mode-hook 'inherit-org-mode))

(with-eval-after-load 'w3m (add-hook 'w3m-fontify-before-hook 'inherit-org-w3m-headline-fontify) ;only one level is supported (add-hook 'w3m-fontify-after-hook 'inherit-org-mode)))

#+END_SRC

PS: =inherit-org-mode= is a minor mode that supports =imenu=, =outline-minor-mode= and =org-indent-mode= You can choose =add-hook= to enable globally for specific modes or just enable/disable via =M-x= =inherit-mode= on the fly.

** inherit-org-fontify-buffer #+BEGIN_SRC emacs-lisp M-x inherit-org-fontify-buffer #+END_SRC

Fontify any bufffers just like org mode. For Programming modes, after comment start, insert =/+/-= followed by a space. For Text modes, fundemental mode, you can just insert =/+/-= as starting just like org mode.

This feature is not perfect.

I found it is useful when I want to make some comments stand out than others, by just adding some =*= [[img/Demo.gif]]