[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] hidestarsfile: "hidestars" for file

From: Michael Brand
Subject: Re: [O] hidestarsfile: "hidestars" for file
Date: Thu, 16 Feb 2012 18:53:08 +0100

Hi all

For the case that anyone should be interested in this, still only a

On Thu, Feb 9, 2012 at 19:57, Michael Brand <address@hidden> wrote:
> Now I see that for testing how a hidestarsfile looks like in a file
> viewer or simple editor, preferred over switching the major mode is:
> Just stay in Org mode and with org-hide-leading-stars still enabled
> from before, temporarily change only the look:
> #+BEGIN_SRC emacs-lisp
>  (visible-mode 1)
>  (my-disable-font-lock-except-org-hide)
> I have not yet much of an idea how to do this: Disable font lock for
> all faces except the face org-hide. What possibilities are there?

After an adventurous, instructive and funny "proof of concept" to
backup, overwrite with the face "default" and restore again one of the
Org faces (extensible to all) with the help of "copy-face",
"symbol-name" and "intern" I decided to study font-lock and now am
starting to use this simple possibility to disable all faces except

#+BEGIN_SRC emacs-lisp
  (defun my-org-lookout-face-defaults ()
    "Reset font lock of faces back to `org-set-font-lock-defaults'.
  Derived from `font-lock-add-keywords'."
    (if (eq major-mode 'org-mode)
          (setq font-lock-keywords
                (font-lock-compile-keywords org-font-lock-keywords))
      (message "ERR: not in Org mode")

  (defun my-org-lookout-face-hide ()
    "Leave `org-hide' for leading stars and disable all other faces.
  Derived from `font-lock-add-keywords' and
  `org-set-font-lock-defaults'. Does not adapt font-lock-defaults and
  sets font-lock-keywords directly"
    (if (eq major-mode 'org-mode)
          (setq font-lock-keywords
                 '(("^\\(\\**\\)\\(\\* \\)\\(.*\\)"
                    (1 (if org-hide-leading-stars
      (message "ERR: not in Org mode")


reply via email to

[Prev in Thread] Current Thread [Next in Thread]