ci: fix some errors

This commit is contained in:
Pavel Korytov 2023-07-22 23:09:41 +03:00
parent 6a9fb34061
commit b7d8fbbe94
3 changed files with 31 additions and 29 deletions

View file

@ -375,7 +375,6 @@ fields attributes as cdr:
(insert html-string) (insert html-string)
(libxml-parse-html-region (point-min) (point-max)))) (libxml-parse-html-region (point-min) (point-max))))
(form (car (dom-by-tag html 'form))) (form (car (dom-by-tag html 'form)))
(endpoint (dom-attr form 'action))
(sections (sections
(cl-loop with section-name = nil (cl-loop with section-name = nil
with res = nil with res = nil

View file

@ -62,7 +62,7 @@ QUERY is a form as defined by `biome-query-current'."
((stringp item) (cons item "true")) ((stringp item) (cons item "true"))
((member (car item) '("end_date" "start_date")) ((member (car item) '("end_date" "start_date"))
(cons (car item) (cons (car item)
(format-time-string "%Y-%m-%d" (cdr item)))) (format-time-string "%F" (cdr item))))
((listp item) ((listp item)
(cons (cons
(car item) (car item)
@ -96,16 +96,16 @@ QUERY is a form as defined by `biome-query-current'."
(let ((buffer (generate-new-buffer "*biome-api-error*"))) (let ((buffer (generate-new-buffer "*biome-api-error*")))
(with-current-buffer buffer (with-current-buffer buffer
(insert (insert
(concat "Open Meteo has returned an error.\n" "Open Meteo has returned an error.\n"
(propertize "Error: " 'face 'font-lock-warning-face) (propertize "Error: " 'face 'font-lock-warning-face)
(prin1-to-string error-thrown) (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)))
"\n") "\n")
(insert "Can't parse reason. Raw response: ") (condition-case nil
(insert (prin1-to-string response))) (insert (propertize "Reason: " 'face 'font-lock-warning-face)
(alist-get 'reason (request-response-data response))
"\n")
(insert "Can't parse reason. Raw response: \n"
(prin1-to-string response)))
(biome-api-error-mode)) (biome-api-error-mode))
(switch-to-buffer buffer))) (switch-to-buffer buffer)))

View file

@ -30,12 +30,15 @@
;; These aren't meant to be used directly by the user. ;; These aren't meant to be used directly by the user.
;;; Code: ;;; Code:
(require 'biome-api-data)
(require 'font-lock)
(require 'org)
(require 'compat) (require 'compat)
(require 'cl-lib)
(require 'font-lock)
(require 'generator)
(require 'org)
(require 'transient) (require 'transient)
(require 'biome-api-data)
(defcustom biome-query-max-fields-in-row 20 (defcustom biome-query-max-fields-in-row 20
"Maximum number of fields in a row." "Maximum number of fields in a row."
:type 'integer :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 (capitalize (replace-regexp-in-string
(regexp-quote "_") " " key)))) (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'." "Format the `biome-query-current'."
(let ((group (alist-get :group biome-query-current)) (let ((group (alist-get :group biome-query-current))
(var-names (biome-query--get-var-names-cache)) (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 (loc (seq-find
(lambda (x) (equal (cdr x) (list lat lon))) (lambda (x) (equal (cdr x) (list lat lon)))
biome-query-coords))) biome-query-coords)))
(format " (%s)" (propertize (car loc) 'face 'transient-value)")")) (format " (%s)" (propertize (car loc) 'face 'transient-value)))
"\n" "\n"
(when group (when group
(format "Group: %s\n" (format "Group: %s\n"
@ -284,8 +287,7 @@ shouldn't exist.")
OBJ is an instance of `biome-query--transient-switch-variable'." OBJ is an instance of `biome-query--transient-switch-variable'."
(oset obj value (oset obj value
(not (and
(null
(member (member
(oref obj api-key) (oref obj api-key)
(if-let ((param (oref obj param))) (if-let ((param (oref obj param)))
@ -293,7 +295,8 @@ OBJ is an instance of `biome-query--transient-switch-variable'."
(assoc (assoc
param param
(alist-get :params biome-query-current))) (alist-get :params biome-query-current)))
(alist-get :params biome-query-current))))))) (alist-get :params biome-query-current)))
t)))
(defmacro biome-query--update-list (item list-place add) (defmacro biome-query--update-list (item list-place add)
"Add or remove ITEM from LIST-PLACE depending on 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)))) (lambda (c) (and (= lat (nth 1 c)) (= lon (nth 2 c))))
biome-query-coords)))) 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." "Read the value of OBJ."
(assoc (completing-read "Select a location" biome-query-coords nil t) (assoc (completing-read "Select a location" biome-query-coords nil t)
biome-query-coords)) 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 gets pretty slow at more than 3 words. Hence the words are truncated
at 3." at 3."
(let ((name-low (replace-regexp-in-string (rx (not alnum)) " " (downcase name))) (let ((name-low (replace-regexp-in-string (rx (not alnum)) " " (downcase name)))
(generated-keys (make-hash-table :test 'equal)) (generated-keys (make-hash-table :test 'equal)))
(max-weight (or max-weight 6)) (unless max-weight (setq max-weight 6))
(max-words (or max-words 3))) (unless max-words (setq max-words 3))
(cl-loop for (key . value) in biome-query--split-items (cl-loop for (key . value) in biome-query--split-items
do (setq name-low do (setq name-low
(replace-regexp-in-string (regexp-quote key) value name-low))) (replace-regexp-in-string (regexp-quote key) value name-low)))