emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Max Mikhanosha <max@openchat.com>
To: Bastien <bzg@altern.org>
Cc: emacs-orgmode@gnu.org,
	"Arne Babenhauserheide (IMK)" <arne.babenhauserheide@kit.edu>
Subject: Re: Bug: startup: hidestars does not use the real window	background color [7.8.11]
Date: Fri, 28 Sep 2012 11:56:15 -0400	[thread overview]
Message-ID: <87pq56ta3k.wl%max@openchat.com> (raw)
In-Reply-To: <87627b630a.fsf@bzg.ath.cx>

At Tue, 18 Sep 2012 12:25:04 +0200,
Bastien wrote:
> 
> Hi Arne,
> 
> "Arne Babenhauserheide (IMK)" <arne.babenhauserheide@kit.edu> writes:
> 
> > Dear org Hackers,
> >
> > I use a custom color scheme in KDE with brown window background color,
> > and when I activate #+STARTUP: hidestars, the first stars are white
> > instead of brown.
> >
> > My color scheme is Antiford
> > ? http://opendesktop.org/content/show.php/Antiford?content=142571
> 
> This is now fixed: the `org-hide' face is a bit more clever when trying
> the get the background color.

Just updated org, and this fix a problem for me in multi-tty emacs. On
the tty frames, the my default face background is "unspecified-bg",
which leaves background color alone (ie its whatever default
background xterm or other emulator uses)

This allows to have different xterm's with similar but differently
shaded backgrounds for different tasks, without changing background in
Emacs.

With this new fix, when org-mode file is visited on tty, it sets
'org-hide face foreground to "unspecified-bg" which makes all leading
stars reverse color.

Patch to fix this is pasted below.


From 1f0ef1241acd7c22fff275ae65a6bf2a9fd84f06 Mon Sep 17 00:00:00 2001
From: Max Mikhanosha <max@openchat.com>
Date: Fri, 28 Sep 2012 11:48:05 -0400
Subject: [PATCH] * lisp/org.el (org-mode): don't set org-hide foreground to
 "invisible-bg" (org-find-invisible-foreground): new
 function

---
 lisp/org.el | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index c47e2ad..7f09d15 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5144,14 +5144,7 @@ (define-derived-mode org-mode outline-mode "Org"
     (unless org-inhibit-startup-visibility-stuff
       (org-set-startup-visibility)))
   ;; Try to set org-hide correctly
-  (set-face-foreground
-   'org-hide
-   (or (face-background 'default)
-       (face-background 'org-default)
-       (cdr (assoc 'background-color default-frame-alist))
-       (cdr (assoc 'background-color initial-frame-alist))
-       (cdr (assoc 'background-color window-system-default-frame-alist))
-       (face-foreground 'org-hide))))
+  (set-face-foreground 'org-hide (org-find-invisible-foreground)))
 
 (when (fboundp 'abbrev-table-put)
   (abbrev-table-put org-mode-abbrev-table
@@ -5159,6 +5152,19 @@ (define-derived-mode org-mode outline-mode "Org"
 
 (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify)
 
+
+(defun org-find-invisible-foreground ()
+  (let ((candidates (remove
+		     "unspecified-bg" 
+		     (list 
+		      (face-background 'default) 
+		      (face-background 'org-default) 
+		      (cdr (assoc 'background-color default-frame-alist)) 
+		      (cdr (assoc 'background-color initial-frame-alist)) 
+		      (cdr (assoc 'background-color window-system-default-frame-alist)) 
+		      (face-foreground 'org-hide))))) 
+    (car (remove nil candidates))))
+
 (defun org-current-time ()
   "Current time, possibly rounded to `org-time-stamp-rounding-minutes'."
   (if (> (car org-time-stamp-rounding-minutes) 1)
-- 
1.7.11.rc0.100.g5498c5f

  parent reply	other threads:[~2012-09-28 15:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04  6:19 Bug: startup: hidestars does not use the real window background color [7.8.11] Arne Babenhauserheide (IMK)
2012-09-18 10:25 ` Bastien
2012-09-18 13:07   ` Arne Babenhauserheide (IMK)
2012-09-28 15:56   ` Max Mikhanosha [this message]
2012-09-28 16:06     ` Bastien

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=87pq56ta3k.wl%max@openchat.com \
    --to=max@openchat.com \
    --cc=arne.babenhauserheide@kit.edu \
    --cc=bzg@altern.org \
    --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).