magit / forge

Work with Git forges from the comfort of Magit
GNU General Public License v3.0
1.32k stars 117 forks source link

`Invalid function: string>` during git pull #591

Closed hexmode closed 1 year ago

hexmode commented 1 year ago

If I eval or load color-moccur (which defines string> using defmacro) after forge-topic.el, I get a backtrace like the following:

Debugger entered--Lisp error: (invalid-function string>)
  string>("2023-07-18T14:28:29Z" "2023-06-14T01:59:02Z")
  funcall(string> "2023-07-18T14:28:29Z" "2023-06-14T01:59:02Z")
  (closure ((cl-pred . string>)) (cl-x cl-y) (funcall cl-pred (funcall cl-key cl-x) (funcall cl-key cl-y)))(#<forge-pullreq forge-pullreq-155cc3f23b58> #<forge-pullreq forge-pullreq-155cc3ea04e8>)
  sort((#<forge-pullreq forge-pullreq-155cc3ea04e8> #<forge-pullreq forge-pullreq-155cc3f23b58> #<forge-pullreq forge-pullreq-155cc3f2b7f4> #<forge-pullreq forge-pullreq-155cc3f3c8dc> #<forge-pullreq forge-pullreq-155cc19b576c> #<forge-pullreq forge-pullreq-155cc2e565b8> #<forge-pullreq forge-pullreq-155cc1ce1680>) (closure ((cl-pred . string>)) (cl-x cl-y) (funcall cl-pred (funcall cl-key cl-x) (funcall cl-key cl-y))))
  (if (memq cl-key '(nil identity)) (sort cl-seq cl-pred) (sort cl-seq #'(lambda (cl-x cl-y) (funcall cl-pred (funcall cl-key cl-x) (funcall cl-key cl-y)))))
  (let* ((cl-key (car (cdr (memq ':key cl-keys))))) (let ((cl-keys-temp cl-keys)) (while cl-keys-temp (or (memq (car cl-keys-temp) '(:key)) (car (cdr (memq ':allow-other-keys cl-keys))) (error "Bad keyword argument %s" (car cl-keys-temp))) (setq cl-keys-temp (cdr (cdr cl-keys-temp))))) (if (memq cl-key '(nil identity)) (sort cl-seq cl-pred) (sort cl-seq #'(lambda (cl-x cl-y) (funcall cl-pred (funcall cl-key cl-x) (funcall cl-key cl-y))))))
  (if (nlistp cl-seq) (cl-replace cl-seq (apply 'cl-sort (append cl-seq nil) cl-pred cl-keys)) (let* ((cl-key (car (cdr (memq ':key cl-keys))))) (let ((cl-keys-temp cl-keys)) (while cl-keys-temp (or (memq (car cl-keys-temp) '(:key)) (car (cdr (memq ... cl-keys))) (error "Bad keyword argument %s" (car cl-keys-temp))) (setq cl-keys-temp (cdr (cdr cl-keys-temp))))) (if (memq cl-key '(nil identity)) (sort cl-seq cl-pred) (sort cl-seq #'(lambda (cl-x cl-y) (funcall cl-pred (funcall cl-key cl-x) (funcall cl-key cl-y)))))))
  cl-sort((#<forge-pullreq forge-pullreq-155cc3ea04e8> #<forge-pullreq forge-pullreq-155cc3f23b58> #<forge-pullreq forge-pullreq-155cc3f2b7f4> #<forge-pullreq forge-pullreq-155cc3f3c8dc> #<forge-pullreq forge-pullreq-155cc19b576c> #<forge-pullreq forge-pullreq-155cc2e565b8> #<forge-pullreq forge-pullreq-155cc1ce1680>) string> :key (closure (t) (it) (eieio-oref it (car forge-topic-list-order))))
  (let* ((id (eieio-oref repo 'id)) (limit forge-topic-list-limit) (open-limit (if (consp limit) (car limit) limit)) (closed-limit (if (consp limit) (cdr limit) limit)) (topics (forge-sql [:select * :from $i1 :where (and (= repository $s2) (notnull unread-p))] table id))) (mapc #'(lambda (row) (setq topics (if (member row topics) topics (cons row topics)))) (if (consp limit) (forge-sql [:select * :from $i1 :where (and (= repository $s2) (isnull closed)) :order-by [(desc updated)] :limit $s3] table id open-limit) (forge-sql [:select * :from $i1 :where (and (= repository $s2) (isnull closed))] table id))) (if (> closed-limit 0) (progn (mapc #'(lambda (row) (setq topics (if ... topics ...))) (forge-sql [:select * :from $i1 :where (and (= repository $s2) (notnull closed)) :order-by [(desc updated)] :limit $s3] table id closed-limit)))) (cl-sort (mapcar (let ((class (if (eq table ...) 'forge-pullreq 'forge-issue))) #'(lambda (row) (closql--remake-instance class (forge-db) row))) topics) (cdr forge-topic-list-order) :key #'(lambda (it) (eieio-oref it (car forge-topic-list-order)))))
  (let ((v (let* ((id (eieio-oref repo 'id)) (limit forge-topic-list-limit) (open-limit (if (consp limit) (car limit) limit)) (closed-limit (if (consp limit) (cdr limit) limit)) (topics (forge-sql [:select * :from $i1 :where ...] table id))) (mapc #'(lambda (row) (setq topics ...)) (if (consp limit) (forge-sql [:select * :from $i1 :where ... :order-by ... :limit $s3] table id open-limit) (forge-sql [:select * :from $i1 :where ...] table id))) (if (> closed-limit 0) (progn (mapc #'... (forge-sql ... table id closed-limit)))) (cl-sort (mapcar (let (...) #'...) topics) (cdr forge-topic-list-order) :key #'(lambda (it) (eieio-oref it ...)))))) (magit-repository-local-set G33 v) v)
  (if kv (cdr kv) (let ((v (let* ((id (eieio-oref repo ...)) (limit forge-topic-list-limit) (open-limit (if ... ... limit)) (closed-limit (if ... ... limit)) (topics (forge-sql ... table id))) (mapc #'(lambda ... ...) (if (consp limit) (forge-sql ... table id open-limit) (forge-sql ... table id))) (if (> closed-limit 0) (progn (mapc ... ...))) (cl-sort (mapcar (let ... ...) topics) (cdr forge-topic-list-order) :key #'(lambda ... ...))))) (magit-repository-local-set G33 v) v))
  (let* ((kv (and t (magit-repository-local-exists-p G33)))) (if kv (cdr kv) (let ((v (let* ((id ...) (limit forge-topic-list-limit) (open-limit ...) (closed-limit ...) (topics ...)) (mapc #'... (if ... ... ...)) (if (> closed-limit 0) (progn ...)) (cl-sort (mapcar ... topics) (cdr forge-topic-list-order) :key #'...)))) (magit-repository-local-set G33 v) v)))
  (let ((G33 (list 'forge-ls-recent-topics table))) (let* ((kv (and t (magit-repository-local-exists-p G33)))) (if kv (cdr kv) (let ((v (let* (... ... ... ... ...) (mapc ... ...) (if ... ...) (cl-sort ... ... :key ...)))) (magit-repository-local-set G33 v) v))))
  (progn (let ((G33 (list 'forge-ls-recent-topics table))) (let* ((kv (and t (magit-repository-local-exists-p G33)))) (if kv (cdr kv) (let ((v (let* ... ... ... ...))) (magit-repository-local-set G33 v) v)))))
  (closure (t) (repo table) (progn (let ((G33 (list 'forge-ls-recent-topics table))) (let* ((kv (and t ...))) (if kv (cdr kv) (let (...) (magit-repository-local-set G33 v) v))))))(#<forge-github-repository forge-github-repository-155cc3583c26> pullreq)
  apply((closure (t) (repo table) (progn (let ((G33 (list 'forge-ls-recent-topics table))) (let* ((kv (and t ...))) (if kv (cdr kv) (let (...) (magit-repository-local-set G33 v) v)))))) #<forge-github-repository forge-github-repository-155cc3583c26> pullreq)
  forge-ls-recent-topics(#<forge-github-repository forge-github-repository-155cc3583c26> pullreq)
  forge-insert-pullreqs()
  magit-run-section-hook(magit-status-sections-hook)
  magit-status-refresh-buffer()
  magit-refresh-buffer()
  magit-refresh()
  magit-process-sentinel(#<process git> "finished\n")

To fix, I re-eval forge-topic.el.

Found solution on this reddit thread.

hexmode commented 1 year ago

bleh... The color-moccur reference is old. Found the defalias in subr.el.