I have made a minor mode that is supposed to customise outline-minor-mode
.
(defun tematika-tools ()
"Define Heading Patterns and Levels for different major modes"
(require 'tematika-elisp)
(tematika-elisp-launch)
(require 'tematika-bash)
(tematika-bash-launch))
;;;###autoload
(define-minor-mode tematika-minor-mode
"Enhances visibility of heading levels and text emphasis."
:lighter " Tematika"
(if tematika-minor-mode
(progn (tematika-tools)
(outline-minor-mode 1))
(outline-minor-mode 0)) )
The problem is that I have two files that are loaded, one for elisp
, the other for bash
.
(defvar tematika-elisp-hglevels
'( (";;; H1" . 1) (";;; H2" . 2) (";;; H3" . 3) (";;; H4" . 4)
(";;; H5" . 5) (";;; H6" . 6) (";;; H7" . 7) (";;; H8" . 8) )
"Set outline levels for standard (canonical) headings.")
(defvar tematika-elisp-mglevels
'( (";;; M1" . 1) (";;; M2" . 2) (";;; M3" . 3) (";;; M4" . 4)
(";;; M5" . 5) (";;; M6" . 6) (";;; M7" . 7) (";;; M8" . 8) )
"Set outline levels for Marginal headings.")
(defvar tematika-elisp-hrklevels
(append tematika-elisp-hglevels
tematika-elisp-mglevels)
"Set the hierarchical levels for outlines in Elisp Major-Mode.")
(defun tematika-elisp-outl ()
"Recognise elisp outlines and associate corresponding level."
(interactive)
(let ( (hrklevels tematika-elisp-hrklevels) )
(setq outline-regexp
(concat (regexp-opt (mapcar 'car hrklevels)) "\\>"))
(setq outline-heading-alist hrklevels)) )
I have the same thing for bash except that the outline patterns are different
(defvar tematika-bash-hglevels
'( ("## H1" . 1) ("## H2" . 2) ("## H3" . 3) ("## H4" . 4)
("## H5" . 5) ("## H6" . 6) ("## H7" . 7) ("## H8" . 8) )
"Set outline levels for for command shell outline headings.")
(defvar tematika-bash-mglevels
'( ("## M1" . 1) ("## M2" . 2) ("## M3" . 3) ("## M4" . 4)
("## M5" . 5) ("## M6" . 6) ("## M7" . 7) ("## M8" . 8) )
"Set outline levels for in Marginalia and levels for command
shell marginal headings.")
(defun tematika-bash-outl ()
"Recognise bash outlines and associate corresponding level."
(interactive)
(let ( (hrklevels tematika-bash-hrklevels) )
(setq outline-regexp
(concat (regexp-opt (mapcar 'car hrklevels)) "\\>"))
(setq outline-heading-alist hrklevels)) )
I have a problem devising a scheme that uses tematika-elisp-hglevels
or tematika-bash-hglevels
depending upon what type of file gets loaded. Somehow tematika-minor-mode
must understand the major mode and use either tematika-elisp-outl
or tematika-bash-outl
for setting the outline patterns via outline-regexp
and outline-heading-alist
.
major-mode
.(require 'tematika-elisp)
and then(require 'tematika-bash)
, the result would be thatoutline-regexp
andoutline-heading-alist
would get overwritten.cond
e.g.)tematika-outl
to replacetematika-elisp-outl
andtematika-bash-outl
?