twmr / gerrit.el

gerrit integration in emacs
44 stars 5 forks source link

dashboard buttons only work if they have not been opened previously #40

Open rmmanseau opened 2 years ago

rmmanseau commented 2 years ago

steps to reproduce:

  1. open gerrit dashboard
  2. click on one of the repo buttons, ie abc ( opens buffer called gerrit:project:abc)
  3. click on one of the owner buttons, ie xyz (open buffer called gerrit:owner:xyz)
  4. click on a button pointing to repo abc

expected behavior: gerrit:project:abc buffer opens and the contents reflect the abc repo

actual behavior: gerrit:project:abc buffer opens but the contents never update, they still reflect the contest of gerrit:owner:xyz

the only way to get the proper contents of gerrit:project:abc to show is to delete the buffer that already exists before clicking on the button again.

its not a huge issue but its kind of inconvenient to have to be aware of which gerrit dashboards are open. itd be nice to be able to click the buttons and have them work as expected regardless of which buffers are currently open.

thanks for the project btw! upload & such work perfectly and have been very helpful : )

rmmanseau commented 2 years ago

ive fixed this issue for myself by overwriting gerrit-query in my config.

(defun gerrit-query (query)
  "Perform a query QUERY and display it in a dashboard buffer."
  ;; TODO offer completion in interactive ...
  ;; TODO offer a list of candidates (history)
  (interactive "sEnter a query string: ")
  (let* ((buffer (format "gerrit:%s" query))
         (is-new (not (get-buffer buffer))))
    (switch-to-buffer buffer)
    (if is-new
        (progn
          (setq gerrit-dashboard-query-alist
              ;; if car is nil gerrit.el will not display a section line
                `((nil . ,(concat query " limit:50"))))
          (gerrit-dashboard-mode)))))
twmr commented 2 years ago

Thx for the bug report @rmmanseau. I can reproduce the issue. There seems to be an issue with the buffer local variable gerrit-dasbhoard-query-alist, which is not always correctly set. Let me check if I can provide a proper fix.