From: Protesilaos Stavrou <info@protesilaos.com>
To: Mauro Aranda <maurooaranda@gmail.com>
Cc: "Basil L. Contovounesios" <contovob@tcd.ie>, 45068@debbugs.gnu.org
Subject: bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible)
Date: Mon, 01 Mar 2021 17:35:54 +0200 [thread overview]
Message-ID: <87h7luga3p.fsf@protesilaos.com> (raw)
In-Reply-To: <603d053a.1c69fb81.f4cb8.fb14@mx.google.com> (Mauro Aranda's message of "Mon, 01 Mar 2021 12:16:06 -0300")
[-- Attachment #1: Type: text/plain, Size: 498 bytes --]
On 2021-03-01, 12:16 -0300, Mauro Aranda <maurooaranda@gmail.com> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-require-theme-function.patch --]
[-- Type: text/x-patch, Size: 2702 bytes --]
From c3f0ee0ed8e79f9496a6cec1c9d3282b3231a6dc Mon Sep 17 00:00:00 2001
Message-Id: <c3f0ee0ed8e79f9496a6cec1c9d3282b3231a6dc.1614612728.git.info@protesilaos.com>
From: Protesilaos Stavrou <info@protesilaos.com>
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
next prev parent reply other threads:[~2021-03-01 15:35 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-06 12:23 bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible) Protesilaos Stavrou
2020-12-08 12:03 ` Basil L. Contovounesios
2020-12-09 21:58 ` Stefan Kangas
2020-12-10 7:57 ` Protesilaos Stavrou
2020-12-10 8:25 ` Stefan Kangas
2020-12-10 11:46 ` Protesilaos Stavrou
2020-12-11 9:37 ` Juri Linkov
2020-12-11 13:21 ` Stefan Kangas
2020-12-11 13:52 ` Eli Zaretskii
2020-12-11 14:16 ` Stefan Kangas
2020-12-11 14:32 ` Eli Zaretskii
2020-12-11 15:15 ` Stefan Kangas
2020-12-11 15:32 ` Eli Zaretskii
2020-12-11 15:42 ` Christopher Dimech
2020-12-11 15:53 ` Protesilaos Stavrou
2020-12-11 18:39 ` Eli Zaretskii
2020-12-11 18:56 ` Christopher Dimech
2020-12-11 20:16 ` Eli Zaretskii
2020-12-11 20:29 ` Christopher Dimech
2020-12-11 19:08 ` Stefan Kangas
2020-12-11 20:05 ` Christopher Dimech
2020-12-11 20:14 ` Eli Zaretskii
2020-12-11 20:21 ` Christopher Dimech
2021-01-25 8:49 ` bug#45068: Patch for Modus themes 1.1.1? (was: bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible)) Protesilaos Stavrou
2021-01-25 12:51 ` Christopher Dimech
2021-01-25 15:34 ` Eli Zaretskii
2021-02-25 6:09 ` bug#45068: Patch for Modus themes 1.1.1? Protesilaos Stavrou
2021-02-25 14:44 ` Eli Zaretskii
2021-02-27 2:35 ` Protesilaos Stavrou
2021-02-27 8:15 ` Eli Zaretskii
2021-02-27 8:53 ` Protesilaos Stavrou
2021-02-28 6:30 ` Protesilaos Stavrou
2021-02-28 11:41 ` bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible) Mauro Aranda
2021-02-28 12:45 ` Protesilaos Stavrou
[not found] ` <603b9b9d.1c69fb81.f37aa.cb7c@mx.google.com>
2021-02-28 13:56 ` Protesilaos Stavrou
2021-03-01 14:38 ` Eli Zaretskii
2021-03-01 14:52 ` Protesilaos Stavrou
2021-03-01 15:16 ` Mauro Aranda
2021-03-01 15:35 ` Protesilaos Stavrou [this message]
2021-03-01 19:58 ` Basil L. Contovounesios
2021-03-01 20:06 ` Mauro Aranda
2021-03-01 20:03 ` Mauro Aranda
2021-03-01 23:34 ` Basil L. Contovounesios
2021-03-02 5:47 ` Protesilaos Stavrou
2021-03-02 5:51 ` Eli Zaretskii
2021-03-02 10:35 ` Basil L. Contovounesios
2021-03-02 10:32 ` Basil L. Contovounesios
2021-03-02 10:59 ` Protesilaos Stavrou
2021-03-02 11:03 ` Mauro Aranda
2021-03-02 11:38 ` Basil L. Contovounesios
2021-03-02 11:56 ` Mauro Aranda
2021-03-03 16:31 ` Basil L. Contovounesios
2021-03-03 18:06 ` Protesilaos Stavrou
2021-03-04 2:04 ` Basil L. Contovounesios
2021-03-04 4:53 ` Protesilaos Stavrou
2021-03-04 12:32 ` Mauro Aranda
2021-03-04 14:54 ` bug#45068: [PATCH] Modus themes 1.2.0 (was: bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible)) Protesilaos Stavrou
2021-03-04 16:53 ` bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible) Mauro Aranda
2021-03-04 18:41 ` bug#45068: [PATCH] Modus themes 1.2.0 Basil L. Contovounesios
2021-03-04 20:57 ` Protesilaos Stavrou
2021-03-04 22:06 ` bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible) Mauro Aranda
2021-03-05 6:34 ` Protesilaos Stavrou
2021-03-05 17:11 ` Basil L. Contovounesios
2021-03-05 17:34 ` Protesilaos Stavrou
2021-03-04 22:40 ` Mauro Aranda
2021-03-05 6:07 ` Protesilaos Stavrou
2021-03-05 17:11 ` bug#45068: [PATCH] Modus themes 1.2.0 Basil L. Contovounesios
2021-03-05 17:50 ` Protesilaos Stavrou
2021-03-05 22:00 ` Basil L. Contovounesios
2021-03-06 5:13 ` Protesilaos Stavrou
2021-03-06 9:29 ` Basil L. Contovounesios
2021-03-05 21:11 ` Gregory Heytings
2021-03-06 13:24 ` Gregory Heytings
2021-03-06 15:22 ` Protesilaos Stavrou
2021-03-06 18:25 ` Gregory Heytings
2021-03-06 18:43 ` Protesilaos Stavrou
2021-03-04 15:47 ` bug#45068: [PATCH] 28.0.50; Update Modus themes 1.0.2 (backward-incompatible) Basil L. Contovounesios
[not found] ` <87lfb8l2wr.fsf@tcd.ie>
2021-02-28 14:13 ` Protesilaos Stavrou
[not found] ` <87a6roxou1.fsf@protesilaos.com>
[not found] ` <87im6cfcex.fsf@tcd.ie>
2021-02-28 15:57 ` Protesilaos Stavrou
2020-12-11 14:32 ` Christopher Dimech
2020-12-11 16:05 ` Protesilaos Stavrou
2020-12-11 16:31 ` Christopher Dimech
2020-12-11 14:25 ` Christopher Dimech
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.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7luga3p.fsf@protesilaos.com \
--to=info@protesilaos.com \
--cc=45068@debbugs.gnu.org \
--cc=contovob@tcd.ie \
--cc=maurooaranda@gmail.com \
/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.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).