unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: 48351@debbugs.gnu.org
Subject: bug#48351: 28.0.50; custom-theme-summary doesn't find theme summary line reliably
Date: Tue, 11 May 2021 11:26:54 -0300	[thread overview]
Message-ID: <87lf8luz0x.fsf@tbb.theblackbeard.org> (raw)
In-Reply-To: <87o8dhuz8h.fsf@tbb.theblackbeard.org> (Mauro Aranda's message of "Tue, 11 May 2021 11:22:22 -0300")

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]

tags 48351 patch
quit


Mauro Aranda <maurooaranda@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?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1306 bytes --]

From dd65d7bf57e1cffc64af0f86282b0634b9216b20 Mon Sep 17 00:00:00 2001
From: Mauro Aranda <maurooaranda@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


  reply	other threads:[~2021-05-11 14:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 14:22 bug#48351: 28.0.50; custom-theme-summary doesn't find theme summary line reliably Mauro Aranda
2021-05-11 14:26 ` Mauro Aranda [this message]
2021-05-18 15:16   ` Lars Ingebrigtsen
2021-05-19 13:03     ` Mauro Aranda

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=87lf8luz0x.fsf@tbb.theblackbeard.org \
    --to=maurooaranda@gmail.com \
    --cc=48351@debbugs.gnu.org \
    /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).