GNU bug report logs - #48351
28.0.50; custom-theme-summary doesn't find theme summary line reliably

Previous Next

Package: emacs;

Reported by: Mauro Aranda <maurooaranda <at> gmail.com>

Date: Tue, 11 May 2021 14:23:01 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Fixed in version 28.1

Done: Mauro Aranda <maurooaranda <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #10 received at control <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: 48351 <at> debbugs.gnu.org
Subject: Re: bug#48351: 28.0.50; custom-theme-summary doesn't find theme
 summary line reliably
Date: Tue, 11 May 2021 11:26:54 -0300
[Message part 1 (text/plain, inline)]
tags 48351 patch
quit


Mauro Aranda <maurooaranda <at> gmail.com> writes:

> IMO, the restriction imposed by `custom-theme-summary' is too strict:
> the function currently requires that the deftheme form is the very first
> one in the file.

Here's a patch.  Any comments?

[0001-Lift-restriction-for-finding-theme-summary-line.patch (text/x-patch, inline)]
From dd65d7bf57e1cffc64af0f86282b0634b9216b20 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda <at> gmail.com>
Date: Tue, 11 May 2021 09:14:57 -0300
Subject: [PATCH] Lift restriction for finding theme summary line

* lisp/cus-theme.el (custom-theme-summary): Don't limit the file to
having the deftheme form as the very first form, rather look for the
deftheme form explicitly.
---
 lisp/cus-theme.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 13fb9f34fa..dfa2226403 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -657,10 +657,12 @@ custom-theme-summary
 	    (insert-file-contents fn)
 	    (let ((sexp (let ((read-circle nil))
 			  (condition-case nil
-			      (read (current-buffer))
-			    (end-of-file nil)))))
-              (and (eq (car-safe sexp) 'deftheme)
-		   (setq doc (nth 2 sexp))))))))
+                              (progn
+                                (re-search-forward "^(deftheme")
+                                (beginning-of-line)
+                                (read (current-buffer)))
+                            (error nil)))))
+              (setq doc (nth 2 sexp)))))))
     (cond ((null doc)
 	   "(no documentation available)")
 	  ((string-match ".*" doc)
-- 
2.31.1


This bug report was last modified 4 years and 2 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.