emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: hidestarsfile: "hidestars" for file
Date: Thu, 16 Feb 2012 18:53:08 +0100	[thread overview]
Message-ID: <CALn3zogYawYMw6dbNLU8Z7i_aa8GC8A=3T0wryP=43sDMjHAuA@mail.gmail.com> (raw)
In-Reply-To: <CALn3zohjDs4QePv50BK_0HfmxSE=2gytErwCAGabzazjD1XJXw@mail.gmail.com>

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 <michael.ch.brand@gmail.com> 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	other threads:[~2012-02-16 17:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03 16:43 hidestarsfile: "hidestars" for file Michael Brand
2012-02-09 18:57 ` Michael Brand
2012-02-16 17:53   ` Michael Brand [this message]
2012-02-26 15:50     ` Michael Brand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALn3zogYawYMw6dbNLU8Z7i_aa8GC8A=3T0wryP=43sDMjHAuA@mail.gmail.com' \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).