From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Protesilaos Stavrou Newsgroups: gmane.emacs.bugs Subject: bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible) Date: Mon, 01 Mar 2021 17:35:54 +0200 Message-ID: <87h7luga3p.fsf@protesilaos.com> References: <87im9fgm27.fsf@protesilaos.com> <83v9d81khh.fsf@gnu.org> <83mtyk1hq3.fsf@gnu.org> <87czzgbapt.fsf@protesilaos.com> <83lfe4192f.fsf@gnu.org> <83im9814oh.fsf@gnu.org> <87sg6po0yd.fsf_-_@protesilaos.com> <83czxt2fpd.fsf@gnu.org> <87h7m0n0em.fsf@protesilaos.com> <83v9agryuz.fsf@gnu.org> <87tupyw83e.fsf@protesilaos.com> <83zgzqncxx.fsf@gnu.org> <874khwn1qf.fsf@protesilaos.com> <603b8171.1c69fb81.aa664.7f40@mx.google.com> <87mtvoxsvs.fsf@protesilaos.com> <603b9b9d.1c69fb81.f37aa.cb7c@mx.google.com> <83eegz7xcx.fsf@gnu.org> <87o8g3exjv.fsf@protesilaos.com> <603d053a.1c69fb81.f4cb8.fb14@mx.google.com> 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="12492"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: "Basil L. Contovounesios" , 45068@debbugs.gnu.org To: Mauro Aranda Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 01 16:37:10 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lGkbe-00039E-2M for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Mar 2021 16:37:10 +0100 Original-Received: from localhost ([::1]:53884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lGkbd-0005Rp-1U for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 Mar 2021 10:37:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGkbW-0005QK-14 for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 10:37:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lGkbV-0004E4-Pp for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 10:37:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lGkbV-0007Fh-M7 for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2021 10:37:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Protesilaos Stavrou Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Mar 2021 15:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45068 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 45068-submit@debbugs.gnu.org id=B45068.161461296727813 (code B ref 45068); Mon, 01 Mar 2021 15:37:01 +0000 Original-Received: (at 45068) by debbugs.gnu.org; 1 Mar 2021 15:36:07 +0000 Original-Received: from localhost ([127.0.0.1]:50440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lGkac-0007EX-CB for submit@debbugs.gnu.org; Mon, 01 Mar 2021 10:36:06 -0500 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:52859) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lGkaa-0007E2-6J for 45068@debbugs.gnu.org; Mon, 01 Mar 2021 10:36:05 -0500 X-Originating-IP: 94.46.225.161 Original-Received: from kronos (unknown [94.46.225.161]) (Authenticated sender: public@protesilaos.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 28706240009; Mon, 1 Mar 2021 15:35:56 +0000 (UTC) In-Reply-To: <603d053a.1c69fb81.f4cb8.fb14@mx.google.com> (Mauro Aranda's message of "Mon, 01 Mar 2021 12:16:06 -0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:201111 Archived-At: --=-=-= Content-Type: text/plain On 2021-03-01, 12:16 -0300, Mauro Aranda wrote: > Since there's agreement about this, could you send it as a patch? Please find it attached. I did not know how to mention you as co-authors, so please do so. As for the original topic of this bug report, I will prepare a new version for the themes within the next few days (version 1.2.0). Then I will update this thread with a new patch. Thank you for your help and patience! -- Protesilaos Stavrou protesilaos.com --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Add-require-theme-function.patch >From c3f0ee0ed8e79f9496a6cec1c9d3282b3231a6dc Mon Sep 17 00:00:00 2001 Message-Id: From: Protesilaos Stavrou Date: Mon, 1 Mar 2021 17:31:44 +0200 Subject: [PATCH] Add 'require-theme' function * etc/NEWS: Document new function. * lisp/custom.el (require-theme): Add function. This follows from the discussion on bug#45068 where it became apparent that there was no equivalent mechanism to 'require' that read through the 'custom-theme-load-path'. --- etc/NEWS | 6 ++++++ lisp/custom.el | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index f8f41e21e2..c2bb0820af 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2495,6 +2495,12 @@ region's (or buffer's) end. This function can be used by modes to add elements to the 'choice' customization type of a variable. +--- +** New function 'require-theme'. +This function is used to load a theme or library stored in the +'custom-theme-load-path'. It is intended to work as a substitute for +'require' in those cases where that cannot be used. + +++ ** New function 'file-modes-number-to-symbolic' to convert a numeric file mode specification into symbolic form. diff --git a/lisp/custom.el b/lisp/custom.el index 833810718b..35ac4d8564 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1200,6 +1200,30 @@ provide-theme (custom-check-theme theme) (provide (get theme 'theme-feature))) +(defun require-theme (theme &optional path) + "Load THEME stored in `custom-theme-load-path'. + +THEME is a symbol that corresponds to the file name without its file +type extension. That is assumed to be either '.el' or '.elc'. + +When THEME is an element of `custom-available-themes', load it and ask +for confirmation if it is not considered safe by `custom-safe-themes'. +Otherwise load the file indicated by THEME, if present. In the latter +case, the file is intended to work as the basis of a theme declared +with `deftheme'. + +If optional PATH is non-nil, it should be a list of directories +to search for THEME in, instead of `custom-theme-load-path'. +PATH should have the same form as `load-path' or `exec-path'." + (cond + ((memq theme (custom-available-themes)) + (load-theme theme)) + ((let* ((dirs (or path (custom-theme--load-path))) + (file (unless (featurep theme) + (locate-file (symbol-name theme) dirs '(".el" ".elc"))))) + (when file + (load-file file)))))) + (defcustom custom-safe-themes '(default) "Themes that are considered safe to load. If the value is a list, each element should be either the SHA-256 -- 2.30.1 --=-=-=--