0

I would like to change the pattern for heading in outline-minor-mode. Have came up with the following implementation for emacs-lisp-mode that uses a minor-mode called taxocask-minor-mode.

(defvar taxocask-elisp-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 taxocask-elisp-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.")

(defvar taxocask-elisp-hklevels
  (append taxocask-elisp-hglevels
          taxocask-elisp-mglevels)
  "Set the hierarchical levels for outlines in elisp Major-Mode.")

(defun taxocask-elisp-headings ()
  "Sets elisp headings for outline mode."
  (interactive)

  (let ( (hklevels taxocask-elisp-hklevels) )

    (setq outline-regexp
           (concat (regexp-opt (mapcar 'car hklevels)) "\\>"))
    (setq outline-heading-alist hklevels)) )

(defun taxocask-elisp-addhooks ()
   "Sets the headings function to the elisp hook."

   (add-hook 'emacs-lisp-mode-hook #'taxocask-elisp-headings))

How can I activate these tools in the minor-mode.

1 Answer 1

1

Are you asking how to invoke those functions when you turn on the minor mode? If so then use the minor mode's hook, e.g., outline-minor-mode-hook.

(defun foo ()
  "..."
  (taxocask-elisp-headings)
  (taxocask-elisp-addhooks))

(add-hook 'outline-minor-mode-hook 'foo)
4
  • Yes I want to see how the functions should be invoked.
    – Dilna
    Jun 7 at 4:22
  • 1
    What does that mean? I showed you how to invoke them.
    – Drew
    Jun 7 at 14:07
  • taxocask-elisp-addhooks already hooks taxocask-elisp-headings.
    – Dilna
    Jun 21 at 14:05
  • @konmi: So? If it hurts then don't do that...
    – Drew
    Jun 21 at 15:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.