emacs-orgmode
[Top][All Lists]
Advanced

[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
monolog:

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)
> #+END_SRC
>
> 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
org-hide:

#+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'."
    (interactive)
    (if (eq major-mode 'org-mode)
        (progn
          (setq font-lock-keywords
                (font-lock-compile-keywords org-font-lock-keywords))
          (font-lock-fontify-buffer))
      (message "ERR: not in Org mode")
      (ding)))

  (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"
    (interactive)
    (if (eq major-mode 'org-mode)
        (progn
          (setq font-lock-keywords
                (font-lock-compile-keywords
                 '(("^\\(\\**\\)\\(\\* \\)\\(.*\\)"
                    (1 (if org-hide-leading-stars
                           'org-hide
                         'org-default))))))
          (font-lock-fontify-buffer))
      (message "ERR: not in Org mode")
      (ding)))
#+END_SRC

Michael



reply via email to

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