From b781990890e5cf4d4ffcfc75445ad6b7401adb4c Mon Sep 17 00:00:00 2001 From: conao3 Date: Sat, 15 Feb 2020 18:08:26 +0900 Subject: [PATCH 1/3] indent buffer --- aqi.el | 70 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/aqi.el b/aqi.el index e0148cb..4b9c62e 100644 --- a/aqi.el +++ b/aqi.el @@ -160,7 +160,7 @@ (defun aqi-search (name) "Search for the nearest stations (if any) matching a given NAME." - (request + (request (format "https://api.waqi.info/search/?keyword=%s&" name) :sync t :params `(("token" . ,aqi-api-key)) @@ -180,28 +180,28 @@ (defun aqi-report-brief (&optional place) "General air quality info from PLACE as a string." (let ((city (if (and (string< "" place) place) place "here"))) - (if aqi-use-cache - (aqi-request-cached city) - (aqi-request city)) - (let-alist (aqi--city-cache-get city) - (format "Air Quality Index in %s is %s and the dominant pollutant is %s%s" - .city.name .aqi .dominentpol - (if aqi-use-cache " (cached)" ""))))) + (if aqi-use-cache + (aqi-request-cached city) + (aqi-request city)) + (let-alist (aqi--city-cache-get city) + (format "Air Quality Index in %s is %s and the dominant pollutant is %s%s" + .city.name .aqi .dominentpol + (if aqi-use-cache " (cached)" ""))))) ;;;###autoload (defun aqi-report-full (&optional place) "Detailed air quality info from PLACE as a string." (let ((city (if (and (string< "" place) place) place "here"))) - (if aqi-use-cache - (aqi-request-cached city) - (aqi-request city)) - (let ((data (aqi--city-cache-get city))) - ;; simple typecheck -> error handling since semantic errors are cached as strings. - (if (stringp data) - (format "%s (%s)" data city) - (let-alist data - (format - "Air Quality index in %s is %s as of %s (UTC%s). + (if aqi-use-cache + (aqi-request-cached city) + (aqi-request city)) + (let ((data (aqi--city-cache-get city))) + ;; simple typecheck -> error handling since semantic errors are cached as strings. + (if (stringp data) + (format "%s (%s)" data city) + (let-alist data + (format + "Air Quality index in %s is %s as of %s (UTC%s). \nDominant pollutant is %s PM2.5 (fine particulate matter): %s PM10 (respirable particulate matter): %s @@ -213,23 +213,23 @@ Air pressure: %s Wind: %s \nFurther details can be found at %s \nData provided by %s and %s%s" - .city.name - .aqi - .time.s - .time.tz - .dominentpol - .iaqi.pm25.v - .iaqi.pm10.v - .iaqi.no2.v - .iaqi.co.v - .iaqi.t.v - .iaqi.h.v - .iaqi.p.v - .iaqi.wg.v - .city.url - (let-alist (elt .attributions 0) .name) - (let-alist (elt .attributions 1) .name) - (if aqi-use-cache " (cached)" ""))))))) + .city.name + .aqi + .time.s + .time.tz + .dominentpol + .iaqi.pm25.v + .iaqi.pm10.v + .iaqi.no2.v + .iaqi.co.v + .iaqi.t.v + .iaqi.h.v + .iaqi.p.v + .iaqi.wg.v + .city.url + (let-alist (elt .attributions 0) .name) + (let-alist (elt .attributions 1) .name) + (if aqi-use-cache " (cached)" ""))))))) ;;;###autoload (defun aqi-report (&optional place type) -- 2.39.5 From 8f9f1a00744a82d05a2551b915ccb1387a1fc1ac Mon Sep 17 00:00:00 2001 From: conao3 Date: Sat, 15 Feb 2020 18:08:43 +0900 Subject: [PATCH 2/3] remove period from oneline package summary --- aqi.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aqi.el b/aqi.el index 4b9c62e..e6f4830 100644 --- a/aqi.el +++ b/aqi.el @@ -1,4 +1,4 @@ -;;; aqi.el --- Air quality data from the World Air Quality Index. -*- lexical-binding: t; -*- +;;; aqi.el --- Air quality data from the World Air Quality Index -*- lexical-binding: t; -*- ;; Copyright 2020 FoAM ;; -- 2.39.5 From 9a592a3e1d67017b634a1d5d59228d53e4e57d5f Mon Sep 17 00:00:00 2001 From: conao3 Date: Sat, 15 Feb 2020 18:09:39 +0900 Subject: [PATCH 3/3] remove unneeded progn --- aqi.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aqi.el b/aqi.el index e6f4830..c0d80cf 100644 --- a/aqi.el +++ b/aqi.el @@ -77,9 +77,9 @@ (defun aqi--city-cache-update (city) "Add or update cached data for a given CITY." - (progn (aqi--city-cache-clear city) - (push (cons city (aqi-request city)) - aqi-cached-data))) + (aqi--city-cache-clear city) + (push (cons city (aqi-request city)) + aqi-cached-data)) (defun aqi--city-cache-get (city) "Add or update cached data for a given CITY." -- 2.39.5