From c3b27f55cf0556e1fd451eb20e879609a90721f1 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Fri, 13 Mar 2020 20:56:05 +0530 Subject: Simplify picking of default settings. * ennu.el (ennu-setting): Combine picking of all default settings into one clause. --- ennu.el | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/ennu.el b/ennu.el index 46b3f42..954ee75 100644 --- a/ennu.el +++ b/ennu.el @@ -270,38 +270,28 @@ last form in BODY." (defun ennu-setting (property) (pcase property - (:blog-scheme - (or (plist-get ennu-blog :blog-scheme) - "https")) - (:atom-feed-file - (or (plist-get ennu-blog :atom-feed-file) - "blog.atom")) - (:index-posts-per-page - (or (plist-get ennu-blog :index-posts-per-page) - 12)) - (:atom-feed-number-of-posts - (or (plist-get ennu-blog :atom-feed-number-of-posts) - 12)) - (:thumbnail-image-width - (or (plist-get ennu-blog :thumbnail-image-width) - 320)) - (:default-image-width - (or (plist-get ennu-blog :default-image-width) - 640)) - (:image-link-width - (or (plist-get ennu-blog :image-link-width) - 1024)) - (:tag-directory - (or (plist-get ennu-blog :tag-directory) - "tag")) ((or :blog-domain :blog-license :blog-title :images-directory :output-directory :posts-directory :static-directory :tag-directory :video-directory :working-directory) (or (plist-get ennu-blog property) (user-error "Property %s not defined" property))) - (:other-files-directory - (plist-get ennu-blog property)) + ((or :atom-feed-number-of-posts :atom-feed-file + :blog-scheme :default-image-width + :image-link-width :index-posts-per-page + :other-files-directory :tag-directory + :thumbnail-image-width) + (plist-get (org-combine-plists + (list :atom-feed-number-of-posts 12 + :atom-feed-file "blog.atom" + :blog-scheme "https" + :default-image-width 640 + :image-link-width 1024 + :index-posts-per-page 12 + :tag-directory "tag" + :thumbnail-image-width 320) + ennu-blog) + property)) (_ (error "Unknown property %s" property)))) (defun ennu-image-output-filename (image width) -- cgit v1.2.3