From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Nicolas P. Rougier (inria)" Newsgroups: gmane.emacs.devel Subject: Re: ELPA: New package: nano-theme Date: Thu, 30 Sep 2021 09:21:37 +0200 Message-ID: References: <87bl4c6197.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23729"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.6; emacs 27.2 Cc: Philip Kaludercic , Stefan Kangas , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 30 09:27:01 2021 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 1mVqT7-0005xV-DK for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Sep 2021 09:27:01 +0200 Original-Received: from localhost ([::1]:58570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVqT6-0002G7-28 for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Sep 2021 03:27:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVqSP-0001F7-Se for emacs-devel@gnu.org; Thu, 30 Sep 2021 03:26:17 -0400 Original-Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:12056) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVqSN-000496-MO for emacs-devel@gnu.org; Thu, 30 Sep 2021 03:26:17 -0400 IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A+CNLT62HG2lgIMwF0A48jAqjBF8kLtp133Aq?= =?us-ascii?q?2lEZdPUzSL3nqynOpoVl6faQsl0ssR4b+OxoSJPrfZqxz/5ICPAqTNOftWrdyQ?= =?us-ascii?q?mVxeNZgrcKqgeIcxEWkNQttpuIG5IRNDSaNzRHZKjBjTVQa+xQuOVuH8iT9ILj?= =?us-ascii?q?J5oEd3AMV0mhhz0JdjqzIwlQfCwuP+tBKLOsovB6jFObCBIqR9X+C3EZV+jFqN?= =?us-ascii?q?ujruOaXTcWQxo+rAmW5AnYk4LSAlydxlMCWz0n+8ZZzVT4?= X-IronPort-AV: E=Sophos;i="5.84,326,1620684000"; d="scan'208";a="394428258" Original-Received: from wifi-ext-0075.univ-lyon1.fr (HELO wu-ext-00946.univ-lyon1.fr) ([134.214.214.76]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2021 09:26:10 +0200 In-reply-to: Received-SPF: pass client-ip=192.134.164.104; envelope-from=nicolas.rougier@inria.fr; helo=mail3-relais-sop.national.inria.fr X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:275862 Archived-At: I think it is possible by first setting the frame-background-mode (to 'dark or 'light in my case), then create a new frame and call frame-set-background-mode on the newly created frame. It seems to work consistently on my system but maybe this is a side effect. Here is the code: #+BEGIN_SRC elisp (defun nano-new-frame (&optional mode) (interactive) (let ((mode (or mode (frame-parameter nil 'background-mode))) (background-mode frame-background-mode) (selected-frame (selected-frame)) (new-frame nil)) ;; Set mode (setq frame-background-mode mode) (setq new-frame (make-frame-command)) (select-frame new-frame) ;; This forces recomputation of faces on the new frame (frame-set-background-mode (selected-frame)) (when (eq mode 'light) (set-foreground-color nano-light-foreground) (set-background-color nano-light-background)) (when (eq mode 'dark) (set-foreground-color nano-dark-foreground) (set-background-color nano-dark-background)) ;; Restore background mode (setq frame-background-mode background-mode) (frame-set-background-mode selected-frame) new-frame)) #+END_SRC Nicolas Stefan Monnier writes: >> I search for how to apply a theme to a single frame but did not >> find any >> obvious way. > > Custom themes are sets of user settings (i.e. affecting > typically > variables and faces), so they're naturally global. > > So you can't have that "single frame" effect directly by > specifying face > settings in the theme. > > What you can do instead is: > - You can have a custom theme set a particular minor mode > (provided as > part of the theme, for example) and arrange for that minor > mode to > affect faces in a single frame. > - You can use the DISPLAY spec of face settings to restrict your > face > settings to specific classes of frames. The DISPLAY specs > could be > extended to be more flexible if needed (file a bug report for > that). > > > Stefan