unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org
Subject: Re: Byte-compilation of custom themes
Date: Fri, 11 May 2018 17:02:25 +0300	[thread overview]
Message-ID: <83fu2ynvda.fsf@gnu.org> (raw)
In-Reply-To: <87o9hoxm0w.fsf@tcd.ie> (contovob@tcd.ie)

> From: "Basil L. Contovounesios" <contovob@tcd.ie>
> 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.



  parent reply	other threads:[~2018-05-11 14:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20 21:01 Byte-compilation of custom themes Basil L. Contovounesios
2018-01-24 16:16 ` Stefan Monnier
2018-01-30 22:16   ` Basil L. Contovounesios
2018-01-31  2:26     ` Stefan Monnier
2018-02-01  0:45       ` Basil L. Contovounesios
2018-02-02 14:25         ` Stefan Monnier
2018-05-10  2:49           ` Basil L. Contovounesios
2018-05-10  2:54             ` Basil L. Contovounesios
2018-05-11 14:07               ` Eli Zaretskii
2018-05-11 14:02             ` Eli Zaretskii [this message]
2018-05-11 15:16               ` Basil L. Contovounesios
2018-05-11 16:03                 ` Stefan Monnier
2018-05-11 20:03                   ` Basil L. Contovounesios
2018-05-11 17:32                 ` Eli Zaretskii
2018-05-11 20:43                   ` Basil L. Contovounesios
2018-05-12  7:04                     ` Eli Zaretskii
2018-06-01 20:48                       ` Basil L. Contovounesios
2018-06-01 21:07                         ` Basil L. Contovounesios
2018-06-02 11:24                         ` Eli Zaretskii
2018-06-02 18:53                           ` Basil L. Contovounesios
2018-06-02 19:32                             ` Eli Zaretskii
2018-06-02 20:02                               ` Basil L. Contovounesios
2018-06-03  3:52                               ` Stefan Monnier
2018-06-03 11:21                                 ` Basil L. Contovounesios
2018-06-03 15:11                                   ` Eli Zaretskii
2018-06-03 16:08                                     ` Basil L. Contovounesios
2018-06-03 16:16                                       ` Eli Zaretskii
2018-06-03 17:48                                         ` Basil L. Contovounesios
2018-06-03 20:22                                           ` Stefan Monnier
2018-06-04  1:33                                             ` Basil L. Contovounesios
2018-07-03  7:57                                               ` Basil L. Contovounesios
2018-07-11  1:40                                                 ` Stefan Monnier
2018-07-11  6:05                                                   ` Basil L. Contovounesios

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=83fu2ynvda.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /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).