emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* dynamically set face [was: semi-visible stars?]
@ 2016-12-01 18:58 Matt Price
  2016-12-01 19:07 ` John Kitchin
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Price @ 2016-12-01 18:58 UTC (permalink / raw)
  To: Org Mode

[-- Attachment #1: Type: text/plain, Size: 3132 bytes --]

On Thu, Dec 1, 2016 at 10:22 AM, Matt Price <moptop99@gmail.com> wrote:

>
>
> On Wed, Nov 30, 2016 at 3:41 PM, Matt Price <moptop99@gmail.com> wrote:
>
>> I have been fooling around a little bit with color-themes and also the
>> new emacs 24+ custom themes, and find that (perhaps because of using
>> desktop-mode) there are certain traces of the theming that get left behind
>> in the display even when I've restarted Emacs after trying hard to erase
>> them.
>>
>> One of these is the frequent appearance of pale stars even when
>> org-indent-mode is turned on.  See the attached screenshot for details.
>> The initial stars in a lower-level headline are visible, as are leading
>> stars in front of the indented text.  I find this quite distracting! Does
>> anyone know what might be causing this, how I can get rid of them, and also
>> how I would in general go about figuring out how to identify the cause of
>> similar appearance-related issues in Emacs?
>>
>
> I just navigated to org-faces.el and executed M-C-x on this defface:
>
> (defface org-hide
>   '((((background light)) (:foreground "white"))
>     (((background dark)) (:foreground "black")))
>   "Face used to hide leading stars in headlines.
> The foreground color of this face should be equal to the background
> color of the frame."
>   :group 'org-faces)
>
> problem solved.  Sorry for the noise.
>
> OK, not solved, exactly. I have (setq color-theme-is-global t) in order to
differentiate between different frames (one for mail, one for code, one for
org).  When I switch between the mail frame (using the 'wheat' theme) and
the org frame (which uses a default theme), the color of org-hide seems to
get set to the light golden brown color that 'wheat' ueses as its
background color.  Here's the extremely short definition of the wheat
color-theme:

(defun color-theme-wheat ()
  "Default colors on a wheat background.
Calls the standard color theme function `color-theme-standard' in order
to reset all faces."
  (interactive)
  (color-theme-standard)
  (let ((color-theme-is-cumulative t))
    (color-theme-install
     '(color-theme-wheat
       ((background-color . "Wheat"))))))

I'm not sure why this messes up the other frames, but clearly it does.  I'm
thinking that if I can dynamically set the :foreground color to *whatever
the background color is in the frame*, that might fix the issue.  So I
tried this:


(defface org-hide
  '((((background light)) (:foreground (format (face-attribute 'default
:background)) ))
    (((background dark)) (:foreground (format (face-attribute 'default
:background)))))
  "Face used to hide leading stars in headlines.
The foreground color of this face should be equal to the background
color of the frame."
  :group 'org-faces)

but I get this error:

set-face-attribute: Wrong type argument: stringp, (format (face-attribute
(quote default) :background))

Obviously my understanding of lisp types is a little weak, but (type-of
(format (face-attribute 'default :background))) returns "string".  So
what's wrong here? And am I going about this the right way?

Thank you!
m



>
>> Thank you!
>>
>> Matt
>>
>>
>

[-- Attachment #2: Type: text/html, Size: 4821 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: dynamically set face [was: semi-visible stars?]
  2016-12-01 18:58 dynamically set face [was: semi-visible stars?] Matt Price
@ 2016-12-01 19:07 ` John Kitchin
  0 siblings, 0 replies; 2+ messages in thread
From: John Kitchin @ 2016-12-01 19:07 UTC (permalink / raw)
  To: Matt Price; +Cc: Org Mode

Try:

`((((background light)) (:foreground ,(format (face-attribute 'default :background)) ))
    (((background dark)) (:foreground ,(format (face-attribute 'default :background)))))

Note the backtick and the commas. The functions in your list are treated
like data and not evaluated. The backtick and commas will evaluate the
format sexps and might do what you want. 

I am pretty sure this won't be dynamic though, it will only define the
face when it is loaded in your init files.

For that, it seems like you might need to use set-face-attribute in a
hook function.

As for the persistence, I guess something is getting saved in your
custom.el file which gets reloaded after a restart.

Matt Price writes:

> On Thu, Dec 1, 2016 at 10:22 AM, Matt Price <moptop99@gmail.com> wrote:
>
>>
>>
>> On Wed, Nov 30, 2016 at 3:41 PM, Matt Price <moptop99@gmail.com> wrote:
>>
>>> I have been fooling around a little bit with color-themes and also the
>>> new emacs 24+ custom themes, and find that (perhaps because of using
>>> desktop-mode) there are certain traces of the theming that get left behind
>>> in the display even when I've restarted Emacs after trying hard to erase
>>> them.
>>>
>>> One of these is the frequent appearance of pale stars even when
>>> org-indent-mode is turned on.  See the attached screenshot for details.
>>> The initial stars in a lower-level headline are visible, as are leading
>>> stars in front of the indented text.  I find this quite distracting! Does
>>> anyone know what might be causing this, how I can get rid of them, and also
>>> how I would in general go about figuring out how to identify the cause of
>>> similar appearance-related issues in Emacs?
>>>
>>
>> I just navigated to org-faces.el and executed M-C-x on this defface:
>>
>> (defface org-hide
>>   '((((background light)) (:foreground "white"))
>>     (((background dark)) (:foreground "black")))
>>   "Face used to hide leading stars in headlines.
>> The foreground color of this face should be equal to the background
>> color of the frame."
>>   :group 'org-faces)
>>
>> problem solved.  Sorry for the noise.
>>
>> OK, not solved, exactly. I have (setq color-theme-is-global t) in order to
> differentiate between different frames (one for mail, one for code, one for
> org).  When I switch between the mail frame (using the 'wheat' theme) and
> the org frame (which uses a default theme), the color of org-hide seems to
> get set to the light golden brown color that 'wheat' ueses as its
> background color.  Here's the extremely short definition of the wheat
> color-theme:
>
> (defun color-theme-wheat ()
>   "Default colors on a wheat background.
> Calls the standard color theme function `color-theme-standard' in order
> to reset all faces."
>   (interactive)
>   (color-theme-standard)
>   (let ((color-theme-is-cumulative t))
>     (color-theme-install
>      '(color-theme-wheat
>        ((background-color . "Wheat"))))))
>
> I'm not sure why this messes up the other frames, but clearly it does.  I'm
> thinking that if I can dynamically set the :foreground color to *whatever
> the background color is in the frame*, that might fix the issue.  So I
> tried this:
>
>
> (defface org-hide
>   '((((background light)) (:foreground (format (face-attribute 'default
> :background)) ))
>     (((background dark)) (:foreground (format (face-attribute 'default
> :background)))))
>   "Face used to hide leading stars in headlines.
> The foreground color of this face should be equal to the background
> color of the frame."
>   :group 'org-faces)
>
> but I get this error:
>
> set-face-attribute: Wrong type argument: stringp, (format (face-attribute
> (quote default) :background))
>
> Obviously my understanding of lisp types is a little weak, but (type-of
> (format (face-attribute 'default :background))) returns "string".  So
> what's wrong here? And am I going about this the right way?
>
> Thank you!
> m
>
>
>
>>
>>> Thank you!
>>>
>>> Matt
>>>
>>>
>>


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-01 19:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-01 18:58 dynamically set face [was: semi-visible stars?] Matt Price
2016-12-01 19:07 ` John Kitchin

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).