From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Basil L. Contovounesios" Newsgroups: gmane.emacs.devel Subject: Re: Byte-compilation of custom themes Date: Fri, 11 May 2018 21:43:42 +0100 Message-ID: <877eo9kjnl.fsf@tcd.ie> References: <87efmk2qk0.fsf@tcd.ie> <87vafjhu04.fsf@tcd.ie> <87po5po7ul.fsf@tcd.ie> <87o9hoxm0w.fsf@tcd.ie> <83fu2ynvda.fsf@gnu.org> <87zi169q9y.fsf@tcd.ie> <83a7t6nlmf.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1526071807 16539 195.159.176.226 (11 May 2018 20:50:07 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 May 2018 20:50:07 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: monnier@IRO.UMontreal.CA, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 11 22:50:03 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 1fHEzK-00047g-St for ged-emacs-devel@m.gmane.org; Fri, 11 May 2018 22:50:03 +0200 Original-Received: from localhost ([::1]:44100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHF1Q-0003tP-56 for ged-emacs-devel@m.gmane.org; Fri, 11 May 2018 16:52:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52798) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fHF0n-0003jL-4v for emacs-devel@gnu.org; Fri, 11 May 2018 16:51:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fHF0m-0002cP-2D for emacs-devel@gnu.org; Fri, 11 May 2018 16:51:33 -0400 Original-Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35938) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fHF0l-0002bv-Qs for emacs-devel@gnu.org; Fri, 11 May 2018 16:51:31 -0400 Original-Received: by mail-wm0-x244.google.com with SMTP id n10-v6so5340583wmc.1 for ; Fri, 11 May 2018 13:51:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:references:mail-followup-to:date:in-reply-to :message-id:user-agent:mime-version; bh=Gn9i4fvrG5aN76Zu8NBO9wuNfsa8FJIsjDJsVgYnJPk=; b=l/I1oHiVcTk/S3ACBSkLFjAzE02A5PYicuo98kM02I8cU8C47pPM/J/WaQwvyfMKWY bPUdAykBni9C01v5X+cZGDuxM6PUWvyCPhl6Agow3irESxdyiHqIVaX2iCCiJAVFDQq+ rsRky+zR7/tvWJ5rnFpOCNijytHa/KdKK+2trQcqLryjSwHDOq1eqwAF8yGlBiUiex2Z l+HD2F4V6cqxqy3xH72VlCYwapwa9wHxOroRG8ehTg6Bn15KFthhjo+DBZ04R64G52uz 6UPpDxc53PuBSeB8nSZBOcvOa62fgpQOlvu2HYB6iB3Ys3wKVWdc/XN7TGnQEoilv19n A+tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-followup-to :date:in-reply-to:message-id:user-agent:mime-version; bh=Gn9i4fvrG5aN76Zu8NBO9wuNfsa8FJIsjDJsVgYnJPk=; b=CvgA76G8ul2oQiMaHvN9ONRTR+Ah+DXJ6VmoAv84OXjwXC/er6cA77MxiJYxY+/OEO bJJAQYYwCSfNUxGxfBqCdJVrctgJsnh0QG8KDQ0J0V3zDEnP8z1Lm7R6gAIZmJqhgFnO TeBCJTowYpW5Q33D3CttzAvRy/NRmTQn7qxgAZlTtnLZuAL99s1u42/V6QlQY/roOhx4 oi6NzObOh3GI8MTRM5f/xMiJQbAAY0USkj5ct3swZtZpY3+pIIDn4VrT1l1Q9N1bQPZk ChI1Zz+UqmefUL1rsOm8Fad4CLknOCZOsVPIADiwhqKAwaEb2AVFkCcvQgN4xo9yF+LC dUIQ== X-Gm-Message-State: ALKqPwchEH1byh9TPGWJMc3S/PPBVvDi+7R1q9vV9gXBiozJsy+/74XY j0ou1ZwNmShfK3ZNAwreqZp+Pg== X-Google-Smtp-Source: AB8JxZpPsbvfc89iJG2aWXt4UXSXH6ta2M9BX7KfDin7or4xbliOy0PgNUFfJISUq2zN3ge2irjmCg== X-Received: by 2002:aa7:c702:: with SMTP id i2-v6mr344649edq.144.1526071424967; Fri, 11 May 2018 13:43:44 -0700 (PDT) Original-Received: from localhost ([2a02:8084:4f41:8c80:9c34:da08:a010:edfc]) by smtp.gmail.com with ESMTPSA id y7-v6sm2007719edq.8.2018.05.11.13.43.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 13:43:43 -0700 (PDT) Mail-Followup-To: Eli Zaretskii , , In-Reply-To: <83a7t6nlmf.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 11 May 2018 20:32:56 +0300") X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 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:225249 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: "Basil L. Contovounesios" >> Cc: , >> Date: Fri, 11 May 2018 16:16:09 +0100 >> >> > 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. >> >> The function custom-theme--load-path already incorporates the >> file-directory-p check, so it is technically redundant here. >> Would you rather it be kept regardless? > > We should at least have a comment there that we are relying on > custom-theme--load-path to do the test, and perhaps also an assertion. Do you mean a cl-assertion, or an emulation thereof? E.g.: (unless (file-directory-p dir) (signal 'file-missing (list "`custom-theme-load-path'" "No such directory" dir))) (I'm unsure on the convention for file-missing errors.) Either way, what is the benefit of barfing before directory-files does? Wouldn't a docstring for custom-theme--load-path and a comment in custom-available-themes suffice for the reader (they do for me)? E.g.: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=custom.diff diff --git a/lisp/custom.el b/lisp/custom.el index b3311a1783..d21e398646 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1292,6 +1292,7 @@ custom-available-themes (let ((suffix "-theme\\.el\\'") themes) (dolist (dir (custom-theme--load-path)) + ;; `custom-theme--load-path' promises DIR exists. (dolist (file (directory-files dir nil suffix)) (let ((theme (intern (substring file 0 (string-match-p suffix file))))) (and (custom-theme-name-valid-p theme) @@ -1300,6 +1301,8 @@ custom-available-themes (nreverse themes))) (defun custom-theme--load-path () + "Expand `custom-theme-load-path' into list of directories. +Only existing directories are included in the path returned." (let (lpath) (dolist (f custom-theme-load-path) (cond ((eq f 'custom-theme-directory) --=-=-= Content-Type: text/plain >> >> - (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? >> >> Though I personally prefer to consistently #'-quote function symbols in >> my own code, both for the extra byte-compiler check and narrower >> in-buffer completion, I have no strong opinion here; I was simply making >> the change in a sweeping fashion, in line with what I had perceived as a >> welcome style. Out of curiosity, though, what makes key bindings >> special w.r.t. quoting? > > Stefan gave one reason (with which I agree). From POV, it's another > stab into my heart of a veteran reader of Emacs Lisp code. I recently > find the code harder and harder to read due to all the new syntax and > unfamiliar functions. You can ignore me on that, though. No, it's a respectable point and I appreciate it. Besides, my original intent was to change how themes are loaded, not how their libraries are quoted; I simply got carried away, and I'm sure there's precedent on the latter elsewhere. Let me know whether any heart stabs remain in the last patchset and I'll gladly revert them. Thanks, -- Basil --=-=-=--