From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: [PATCH] tab-line-alternate-colors Date: Sun, 13 Dec 2020 00:04:57 -0600 Message-ID: <87360autpy.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31967"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 13 07:06:14 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1koKWL-0008C0-D7 for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Dec 2020 07:06:13 +0100 Original-Received: from localhost ([::1]:38070 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1koKWK-0003mT-F5 for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Dec 2020 01:06:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koKVH-00032d-52 for emacs-devel@gnu.org; Sun, 13 Dec 2020 01:05:07 -0500 Original-Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:46202 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1koKVF-0007Y6-HQ for emacs-devel@gnu.org; Sun, 13 Dec 2020 01:05:06 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1koKVC-0006go-Cd for emacs-devel@gnu.org; Sun, 13 Dec 2020 07:05:02 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:260751 Archived-At: --=-=-= Content-Type: text/plain Hi, This patch adds a new option and face which makes inactive tab-line tabs display in alternating colors, which makes them easier to distinguish between. Assuming that the idea is acceptable, please let me know if any further changes to the patch are required. Thanks, Adam --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-New-option-tab-line-alternate-colors-and-associated-.patch Content-Description: patch >From d1bebe1441f728b6da6bd44bc2a78a943594dafe Mon Sep 17 00:00:00 2001 From: Adam Porter Date: Sun, 13 Dec 2020 05:54:28 +0000 Subject: [PATCH] New option `tab-line-alternate-colors` and associated face * lisp/tab-line.el: (tab-line-alternate-colors): New option. (tab-line-tab-inactive-alternate): New face. (tab-line-format-template): Use them. --- lisp/tab-line.el | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/lisp/tab-line.el b/lisp/tab-line.el index 46bf89f14e..b8fcb737b9 100644 --- a/lisp/tab-line.el +++ b/lisp/tab-line.el @@ -35,6 +35,14 @@ tab-line :group 'convenience :version "27.1") +(defcustom tab-line-alternate-colors t + "Alternate background colors of inactive tabs. +When non-nil, alternating tabs use the face +`tab-line-tab-inactive-alternate'." + :type 'boolean + :group 'tab-line + :version "28.1") + (defgroup tab-line-faces '((tab-line custom-face)) ; tab-line is defined in faces.el "Faces used in the tab line." :group 'tab-line @@ -63,6 +71,14 @@ tab-line-tab-inactive :version "27.1" :group 'tab-line-faces) +(defface tab-line-tab-inactive-alternate + (let ((mode-line-bg (face-background 'mode-line nil t))) + `((t (:inherit tab-line-tab-inactive :background ,mode-line-bg)))) + "Alternate face for inactive tab-line tabs. +Used on alternating tabs when `tab-line-alternate-colors' is non-nil." + :version "28.1" + :group 'tab-line-faces) + (defface tab-line-tab-current '((default :inherit tab-line-tab) @@ -403,6 +419,7 @@ tab-line-format-template (let* ((selected-buffer (window-buffer)) (separator (or tab-line-separator (if window-system " " "|"))) (hscroll (window-parameter nil 'tab-line-hscroll)) + (tab-number 0) (strings (mapcar (lambda (tab) @@ -412,7 +429,16 @@ tab-line-format-template (cdr (assq 'selected tab)))) (name (if buffer-p (funcall tab-line-tab-name-function tab tabs) - (cdr (assq 'name tab))))) + (cdr (assq 'name tab)))) + (face (cond (selected-p + (if (eq (selected-window) (old-selected-window)) + 'tab-line-tab-current + 'tab-line-tab)) + ((and tab-line-alternate-colors + (cl-evenp (cl-incf tab-number))) + 'tab-line-tab-inactive-alternate) + (t + 'tab-line-tab-inactive)))) (concat separator (apply 'propertize @@ -425,11 +451,7 @@ tab-line-format-template `( tab ,tab ,@(if selected-p '(selected t)) - face ,(if selected-p - (if (eq (selected-window) (old-selected-window)) - 'tab-line-tab-current - 'tab-line-tab) - 'tab-line-tab-inactive) + face ,face mouse-face tab-line-highlight))))) tabs)) (hscroll-data (tab-line-auto-hscroll strings hscroll))) -- 2.20.1 --=-=-=--