emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Only set org-hide foreground if one is available
@ 2014-03-17 21:50 Nikolai Weibull
  2014-03-18 15:27 ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolai Weibull @ 2014-03-17 21:50 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Nikolai Weibull

* org.el (org-mode): Add guard around set-face-foreground.
(org-mode): When loading Org buffers through desktop, there will not be
a foreground set for org-hide.  Therefore, simply do not set the
foreground of org-hide unless there is one to set.
---
 lisp/org.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 5a02c66..b991692 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5509,7 +5509,9 @@ The following commands are available:
      (unless org-inhibit-startup-visibility-stuff
        (org-set-startup-visibility))))
   ;; Try to set org-hide correctly
-  (set-face-foreground 'org-hide (org-find-invisible-foreground)))
+  (let ((foreground (org-find-invisible-foreground)))
+    (if foreground
+        (set-face-foreground 'org-hide foreground))))
 
 ;; Update `customize-package-emacs-version-alist'
 (add-to-list 'customize-package-emacs-version-alist
-- 
1.8.5.4

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

* Re: [PATCH] Only set org-hide foreground if one is available
  2014-03-17 21:50 [PATCH] Only set org-hide foreground if one is available Nikolai Weibull
@ 2014-03-18 15:27 ` Bastien
  2014-03-18 18:12   ` Nikolai Weibull
  0 siblings, 1 reply; 4+ messages in thread
From: Bastien @ 2014-03-18 15:27 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: emacs-orgmode

Hi Nikolai,

Nikolai Weibull <now@disu.se> writes:

> (org-mode): When loading Org buffers through desktop

I'm not sure what the above means, can you explain it?
Also, what is exactly the bug this fixes (beyond setting
something that does not need setting)?

Thanks,

-- 
 Bastien

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

* Re: [PATCH] Only set org-hide foreground if one is available
  2014-03-18 15:27 ` Bastien
@ 2014-03-18 18:12   ` Nikolai Weibull
  2014-03-19  8:31     ` Bastien
  0 siblings, 1 reply; 4+ messages in thread
From: Nikolai Weibull @ 2014-03-18 18:12 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

On Tue, Mar 18, 2014 at 4:27 PM, Bastien <bzg@gnu.org> wrote:

> Nikolai Weibull <now@disu.se> writes:
>
>> (org-mode): When loading Org buffers through desktop
>
> I'm not sure what the above means, can you explain it?
> Also, what is exactly the bug this fixes (beyond setting
> something that does not need setting)?

Sorry, I realize that I was way too terse.

When loading Org buffers from a desktop file (see (desktop-save-mode))
when Emacs starts as a daemon (through, for example, emacsclient
--alternate-editor '' -t), org-hide (and I’m guessing other faces as
well – I’m not well versed with Emacs’ faces) will apparently not
contain any information.  My guess is that until a frame has been
created (or perhaps displayed), which won’t happen until after the Org
buffers have been created and thus Org mode has been initialized and
this code called, faces won’t be initialized, perhaps to account for
things such as rules relating to background/foreground (such as those
defined in (defface org-hide)).  Thus it’s not safe to simply assume
that (face-foreground 'org-hide) will return a non-nil value, which
means that (org-find-invisible-foreground) /can/ return nil.  If we
set (face-foreground 'org-hide nil) during initialization, for some
other reason that I’m similarly unfamiliar with, my themed setting of
org-hide (via (load-theme)) won’t be applied (and the default value
specified in the defface of org-hide will similarly not be used).

As should be painfully obvious from that description, I’m not sure why
(face-foreground 'org-hide) is returning nil and I’m not sure why
(set-face-foreground 'org-hide nil) prevents the themed setting to be
applied.  I am, however, sure that this solved the issue of org-hide
having an unspecified foreground.

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

* Re: [PATCH] Only set org-hide foreground if one is available
  2014-03-18 18:12   ` Nikolai Weibull
@ 2014-03-19  8:31     ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2014-03-19  8:31 UTC (permalink / raw)
  To: Nikolai Weibull; +Cc: emacs-orgmode

Hi Nikolai,

Nikolai Weibull <now@disu.se> writes:

> Sorry, I realize that I was way too terse.

No problem.

Thanks for the detailed explanations, makes sense.

I pushed your patch.  Thanks,

-- 
 Bastien

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

end of thread, other threads:[~2014-03-19  8:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-17 21:50 [PATCH] Only set org-hide foreground if one is available Nikolai Weibull
2014-03-18 15:27 ` Bastien
2014-03-18 18:12   ` Nikolai Weibull
2014-03-19  8:31     ` Bastien

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