From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Byte-compilation of custom themes Date: Fri, 11 May 2018 17:02:25 +0300 Message-ID: <83fu2ynvda.fsf@gnu.org> References: <87efmk2qk0.fsf@tcd.ie> <87vafjhu04.fsf@tcd.ie> <87po5po7ul.fsf@tcd.ie> <87o9hoxm0w.fsf@tcd.ie> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1526049913 14864 195.159.176.226 (11 May 2018 14:45:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 May 2018 14:45:13 +0000 (UTC) Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: "Basil L. Contovounesios" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 11 16:45:08 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fH9I7-0003Tq-9T for ged-emacs-devel@m.gmane.org; Fri, 11 May 2018 16:45:03 +0200 Original-Received: from localhost ([::1]:46583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fH8e9-00044C-H8 for ged-emacs-devel@m.gmane.org; Fri, 11 May 2018 10:03:45 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fH8dI-0003vV-Gp for emacs-devel@gnu.org; Fri, 11 May 2018 10:02:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fH8cy-0003hX-9P for emacs-devel@gnu.org; Fri, 11 May 2018 10:02:52 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36988) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fH8cy-0003hO-5o; Fri, 11 May 2018 10:02:32 -0400 Original-Received: from [176.228.60.248] (port=3722 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fH8cx-0005uB-Fp; Fri, 11 May 2018 10:02:32 -0400 In-reply-to: <87o9hoxm0w.fsf@tcd.ie> (contovob@tcd.ie) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225231 Archived-At: > From: "Basil L. Contovounesios" > Date: Thu, 10 May 2018 03:49:35 +0100 > Cc: emacs-devel@gnu.org > > diff --git a/lisp/custom.el b/lisp/custom.el > index 1fed5dce53..b286f49ff9 100644 > --- a/lisp/custom.el > +++ b/lisp/custom.el > @@ -1299,17 +1299,15 @@ custom-available-themes > loaded, and no effort is made to check that the files contain > valid Custom themes. For a list of loaded themes, check the > variable `custom-known-themes'." > - (let (sym themes) > + (let ((suffix "-theme\\.el\\'") > + themes) > (dolist (dir (custom-theme--load-path)) > - (when (file-directory-p dir) > - (dolist (file (file-expand-wildcards > - (expand-file-name "*-theme.el" dir) t)) > - (setq file (file-name-nondirectory file)) > - (and (string-match "\\`\\(.+\\)-theme.el\\'" file) > - (setq sym (intern (match-string 1 file))) > - (custom-theme-name-valid-p sym) > - (push sym themes))))) > - (nreverse (delete-dups themes)))) > + (dolist (file (directory-files dir nil suffix)) The original code carefully verified that the members in custom-theme--load-path are directories, whereas your proposal calls directory-files on each member unconditionally, which will barf if a file is not a directory. > - (define-key map "\C-x\C-s" 'custom-theme-write) > - (define-key map "q" 'Custom-buffer-done) > - (define-key map "n" 'widget-forward) > - (define-key map "p" 'widget-backward) > + (define-key map "\C-x\C-s" #'custom-theme-write) > + (define-key map "q" #'Custom-buffer-done) > + (define-key map "n" #'widget-forward) > + (define-key map "p" #'widget-backward) Really? Are we going to switch to #'foo even in key bindings? > diff --git a/lisp/custom.el b/lisp/custom.el > index b8004cfd74..ae917c0292 100644 > --- a/lisp/custom.el > +++ b/lisp/custom.el > @@ -633,14 +633,10 @@ custom-load-symbol > (let ((custom-load-recursion t)) > ;; Load these files if not already done, > ;; to make sure we know all the dependencies of SYMBOL. > - (condition-case nil > - (require 'cus-load) > - (error nil)) > - (condition-case nil > - (require 'cus-start) > - (error nil)) > + (require 'cus-load nil t) > + (require 'cus-start nil t) > (dolist (load (get symbol 'custom-loads)) > - (cond ((symbolp load) (condition-case nil (require load) (error nil))) > + (cond ((symbolp load) (require load nil t)) > ;; This is subsumed by the test below, but it's much faster. > ((assoc load load-history)) > ;; This was just (assoc (locate-library load) load-history) > @@ -658,7 +654,7 @@ custom-load-symbol > ;; We are still loading it when we call this, > ;; and it is not in load-history yet. > ((equal load "cus-edit")) > - (t (condition-case nil (load load) (error nil)))))))) > + (t (load load t))))))) Why are we dropping the safety nets here? Thanks.