0

I would like to have the ability to interactively change the highlighting settings using a single function (named outline-activate). How can I adapt it for the task described?

(defun outline-activate ()
  "Activates 'outline-minor-mode' on current buffer."

  ;; Controls how outlines are highlighted

  ;; Outline Typefaces applied only if Major-Mode.
  (setq outline-minor-mode-highlight t)

  ;; Outline Typefaces appended to Major-Mode Settings.
  (setq outline-minor-mode-highlight 'append)

  ;; Outline Typefaces overrid Major-Mode Settings.
  (setq outline-minor-mode-highlight 'override)

  (outline-minor-mode 1)
  (outline-hide-body))
Drew
  • 75,699
  • 9
  • 109
  • 225
Dilna
  • 1,173
  • 3
  • 10

1 Answers1

0

You can prompt the user for the highlight type, I think this post will help you.

  • Although I could use `(list (completing-read "Outline-Highlight: " '("t" "Append" "Override") nil t))`, the variable `outline-minor-mode-highlight` takes symbols. – Dilna Jun 06 '23 at 13:45
  • You can parse the user's choice using a `cond` statement and `string-equal` to properly set `outline-minor-mode-highlight`. @Pampalula – Tristan Riehs Jun 06 '23 at 14:05
  • Could `completing-read` pass the symbol directly so there is just one call `(setq outline-minor-mode-highlight csym)` ? – Dilna Jun 06 '23 at 14:22
  • I quickly tried it before writing my first comment and I did not manage to direclty get a symbol from `completing-read` to give to `outline-minor-mode-highlight`. But there might be a way to do it. As you seem to begin with Emacs-lisp (just like me), I think you are fine with a `cond`. You will be able to improve `outline-activate` later. – Tristan Riehs Jun 06 '23 at 16:10
  • @Pampalula if this worked for you, please mark the answer as accepted. – Trevoke Jun 19 '23 at 02:30