[PATCH 1/3] emacs: Adapt the logo background colour to that of the frame
[notmuch-archives.git] / 57 / 35b51cc0a558b32e7e50dcd916b6c50fbcb1fc
diff --git a/57/35b51cc0a558b32e7e50dcd916b6c50fbcb1fc b/57/35b51cc0a558b32e7e50dcd916b6c50fbcb1fc
new file mode 100644 (file)
index 0000000..fbef205
--- /dev/null
@@ -0,0 +1,110 @@
+Return-Path: <dme@dme.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id AB2C74196F3\r
+       for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 02:25:31 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+       tests=[BAYES_00=-1.9] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id DO7auzRM50XU for <notmuch@notmuchmail.org>;\r
+       Mon, 26 Apr 2010 02:25:30 -0700 (PDT)\r
+Received: from mail-ww0-f53.google.com (mail-ww0-f53.google.com\r
+ [74.125.82.53])       by olra.theworths.org (Postfix) with ESMTP id 392924196F0       for\r
+ <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 02:25:30 -0700 (PDT)\r
+Received: by wwi18 with SMTP id 18so277984wwi.26\r
+       for <notmuch@notmuchmail.org>; Mon, 26 Apr 2010 02:25:29 -0700 (PDT)\r
+Received: by 10.216.160.8 with SMTP id t8mr4606196wek.101.1272273926512;\r
+       Mon, 26 Apr 2010 02:25:26 -0700 (PDT)\r
+Received: from ut.hh.sledj.net (host83-217-165-81.dsl.vispa.com\r
+       [83.217.165.81])\r
+       by mx.google.com with ESMTPS id d16sm833411wej.21.2010.04.26.02.25.24\r
+       (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+       Mon, 26 Apr 2010 02:25:25 -0700 (PDT)\r
+Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
+       id 800B1594135; Mon, 26 Apr 2010 10:25:35 +0100 (BST)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/3] emacs: Adapt the logo background colour to that of the\r
+       frame\r
+Date: Mon, 26 Apr 2010 10:25:28 +0100\r
+Message-Id: <1272273930-30997-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.0\r
+In-Reply-To: <87iq7i2aia.fsf@yoom.home.cworth.org>\r
+References: <87iq7i2aia.fsf@yoom.home.cworth.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 26 Apr 2010 09:25:31 -0000\r
+\r
+The notmuch logo uses transparency. That can display poorly when\r
+inserting the image into an emacs buffer (black logo on a black\r
+background), so force the background colour of the image. We use a\r
+face (`notmuch-hello-logo-background') to represent the colour so that\r
+`defface' can be used to declare the different possible colours, which\r
+depend on whether the frame has a light or dark background.\r
+---\r
+ emacs/notmuch-hello.el |   25 +++++++++++++++++--------\r
+ 1 files changed, 17 insertions(+), 8 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 482ef68..3a74ebd 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -55,9 +55,14 @@\r
+   :type 'boolean\r
+   :group 'notmuch)\r
\r
+-(defcustom notmuch-hello-logo-background "#5f5f5f"\r
++(defface notmuch-hello-logo-background\r
++  '((((class color)\r
++      (background dark))\r
++     (:background "#5f5f5f"))\r
++    (((class color)\r
++      (background light))\r
++     (:background "white")))\r
+   "Background colour for the notmuch logo."\r
+-  :type 'color\r
+   :group 'notmuch)\r
\r
+ (defcustom notmuch-hello-jump-to-search t\r
+@@ -209,12 +214,16 @@ diagonal."\r
\r
+   (when notmuch-hello-show-logo\r
+     (let ((image notmuch-hello-logo))\r
+-      ;; dme: Sorry, I don't know any other way to achieve this :-( The\r
+-      ;; notmuch logo uses transparency. That works out badly when\r
+-      ;; inserting the image into an emacs buffer, so force the\r
+-      ;; background colour of the image.\r
+-      (setq image (cons 'image (append (cdr image)\r
+-                                     `(:background ,notmuch-hello-logo-background))))\r
++      ;; The notmuch logo uses transparency. That can display poorly\r
++      ;; when inserting the image into an emacs buffer (black logo on\r
++      ;; a black background), so force the background colour of the\r
++      ;; image. We use a face to represent the colour so that\r
++      ;; `defface' can be used to declare the different possible\r
++      ;; colours, which depend on whether the frame has a light or\r
++      ;; dark background.\r
++      (setq image (cons 'image\r
++                      (append (cdr image)\r
++                              (list :background (face-background 'notmuch-hello-logo-background)))))\r
+       (insert-image image))\r
+     (widget-insert "  "))\r
\r
+-- \r
+1.7.0\r
+\r