From b7d8fbbe94195bbda21e03aec2812b0d027e5de8 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne Date: Sat, 22 Jul 2023 23:09:41 +0300 Subject: [PATCH] ci: fix some errors --- biome-api-parse.el | 1 - biome-api.el | 18 +++++++++--------- biome-query.el | 41 ++++++++++++++++++++++------------------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/biome-api-parse.el b/biome-api-parse.el index 491edc4..13a2c5e 100644 --- a/biome-api-parse.el +++ b/biome-api-parse.el @@ -375,7 +375,6 @@ fields attributes as cdr: (insert html-string) (libxml-parse-html-region (point-min) (point-max)))) (form (car (dom-by-tag html 'form))) - (endpoint (dom-attr form 'action)) (sections (cl-loop with section-name = nil with res = nil diff --git a/biome-api.el b/biome-api.el index fa0cc78..9181e1e 100644 --- a/biome-api.el +++ b/biome-api.el @@ -62,7 +62,7 @@ QUERY is a form as defined by `biome-query-current'." ((stringp item) (cons item "true")) ((member (car item) '("end_date" "start_date")) (cons (car item) - (format-time-string "%Y-%m-%d" (cdr item)))) + (format-time-string "%F" (cdr item)))) ((listp item) (cons (car item) @@ -96,16 +96,16 @@ QUERY is a form as defined by `biome-query-current'." (let ((buffer (generate-new-buffer "*biome-api-error*"))) (with-current-buffer buffer (insert - (concat "Open Meteo has returned an error.\n" - (propertize "Error: " 'face 'font-lock-warning-face) - (prin1-to-string error-thrown) - "\n")) + "Open Meteo has returned an error.\n" + (propertize "Error: " 'face 'font-lock-warning-face) + (prin1-to-string error-thrown) + "\n") (condition-case nil - (insert (concat (propertize "Reason: " 'face 'font-lock-warning-face) - (alist-get 'reason (request-response-data response))) + (insert (propertize "Reason: " 'face 'font-lock-warning-face) + (alist-get 'reason (request-response-data response)) "\n") - (insert "Can't parse reason. Raw response: ") - (insert (prin1-to-string response))) + (insert "Can't parse reason. Raw response: \n" + (prin1-to-string response))) (biome-api-error-mode)) (switch-to-buffer buffer))) diff --git a/biome-query.el b/biome-query.el index 3c43b20..6c06785 100644 --- a/biome-query.el +++ b/biome-query.el @@ -30,12 +30,15 @@ ;; These aren't meant to be used directly by the user. ;;; Code: -(require 'biome-api-data) -(require 'font-lock) -(require 'org) (require 'compat) +(require 'cl-lib) +(require 'font-lock) +(require 'generator) +(require 'org) (require 'transient) +(require 'biome-api-data) + (defcustom biome-query-max-fields-in-row 20 "Maximum number of fields in a row." :type 'integer @@ -164,7 +167,7 @@ KEY is the api key of the variable. VAR-NAMES is the output of (capitalize (replace-regexp-in-string (regexp-quote "_") " " key)))) -(cl-defmethod transient-format ((_ biome-query--transient-report)) +(cl-defmethod transient-format ((_obj biome-query--transient-report)) "Format the `biome-query-current'." (let ((group (alist-get :group biome-query-current)) (var-names (biome-query--get-var-names-cache)) @@ -221,7 +224,7 @@ KEY is the api key of the variable. VAR-NAMES is the output of (loc (seq-find (lambda (x) (equal (cdr x) (list lat lon))) biome-query-coords))) - (format " (%s)" (propertize (car loc) 'face 'transient-value)")")) + (format " (%s)" (propertize (car loc) 'face 'transient-value))) "\n" (when group (format "Group: %s\n" @@ -284,16 +287,16 @@ shouldn't exist.") OBJ is an instance of `biome-query--transient-switch-variable'." (oset obj value - (not - (null - (member - (oref obj api-key) - (if-let ((param (oref obj param))) - (cdr - (assoc - param - (alist-get :params biome-query-current))) - (alist-get :params biome-query-current))))))) + (and + (member + (oref obj api-key) + (if-let ((param (oref obj param))) + (cdr + (assoc + param + (alist-get :params biome-query-current))) + (alist-get :params biome-query-current))) + t))) (defmacro biome-query--update-list (item list-place add) "Add or remove ITEM from LIST-PLACE depending on ADD." @@ -530,7 +533,7 @@ The source of possible coordinates is `biome-query-coords'.") (lambda (c) (and (= lat (nth 1 c)) (= lon (nth 2 c)))) biome-query-coords)))) -(cl-defmethod transient-infix-read ((obj biome-query--transient-coords)) +(cl-defmethod transient-infix-read ((_ biome-query--transient-coords)) "Read the value of OBJ." (assoc (completing-read "Select a location" biome-query-coords nil t) biome-query-coords)) @@ -655,9 +658,9 @@ it sorts the cartesian product of all prefixes of each word, and it gets pretty slow at more than 3 words. Hence the words are truncated at 3." (let ((name-low (replace-regexp-in-string (rx (not alnum)) " " (downcase name))) - (generated-keys (make-hash-table :test 'equal)) - (max-weight (or max-weight 6)) - (max-words (or max-words 3))) + (generated-keys (make-hash-table :test 'equal))) + (unless max-weight (setq max-weight 6)) + (unless max-words (setq max-words 3)) (cl-loop for (key . value) in biome-query--split-items do (setq name-low (replace-regexp-in-string (regexp-quote key) value name-low)))