browse-at-remote icon indicating copy to clipboard operation
browse-at-remote copied to clipboard

browse-at-remote broken in MELPA / on master with 28.1

Open gigawhitlocks opened this issue 1 year ago • 9 comments

Hi I'm using Emacs 28.1 and I recently updated all my packages, and noticed that browse-at-remote is completely broken on master and in the version on MELPA. Whenever I run browse-at-remote I get the following traceback on the version from master manually installed, or the latest from MELPA fetched w/ use-package or package-install

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  browse-at-remote--get-remote-type("github.com")
  browse-at-remote--file-url("/home/iwhitlock/.emacs.d/ian.org" 3043)
  browse-at-remote-get-url()
  browse-at-remote()
  funcall-interactively(browse-at-remote)
  call-interactively(browse-at-remote nil nil)
  command-execute(browse-at-remote)

nota bene that this occurs even with a completely vanilla GitHub repository -- this one isn't doing anything fancy and merely points to my Emacs configs here on GitHub.

I am able to work around this issue by installing the last tagged release, so something between that and master appears to be breaking things.

I hope this report helps bring your attention to the issue and sorry that I don't know what else info might be helpful to resolve it!

gigawhitlocks avatar Mar 21 '23 18:03 gigawhitlocks

Hello, I'm wondering if you have something specific set in your config.

  1. Can you please share output of
git config --get browseAtRemote.type
  1. I assume if you call (setq debug-on-error '(wrong-type-argument) debug-on-signal t) before reproducing it will provide more details trace.

  2. Also curious what is in 'git remote'

I also just checked master from MELPA and it works fine for me. I guess it may be a local issue

rmuslimov avatar Mar 21 '23 20:03 rmuslimov

  1. nothing set:
.emacs.d master ✓ ➜ git config --get browseAtRemote.type
.emacs.d master ✓ ➜ 
  1. Traceback looks the same w/ that flag set, unfortunately:
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  browse-at-remote--get-remote-type("github.com")
  browse-at-remote--file-url("/home/iwhitlock/.emacs.d/ian.org" 3281)
  browse-at-remote-get-url()
  browse-at-remote()
  funcall-interactively(browse-at-remote)
  call-interactively(browse-at-remote nil nil)
  command-execute(browse-at-remote)
  1. Just the remote here on GitHub:
.emacs.d master ✓ ➜ git remote -v
origin  [email protected]:gigawhitlocks/emacs-configs.git (fetch)
origin  [email protected]:gigawhitlocks/emacs-configs.git (push)

Full Emacs version: GNU Emacs 28.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2022-12-27

gigawhitlocks avatar Mar 21 '23 20:03 gigawhitlocks

Oh okay, I found some additional info.

I have this setting for another repo (censored slightly):

  (add-to-list 'browse-at-remote-remote-type-regexps '("^bitbucket.private\\.tld$" . "stash"))

Having this setting breaks browse-at-remote across all repos, but it used to be a valid setting. I guess it was deprecated in favor of git config --get browseAtRemote.type?

In any case, removing this setting allows browse-at-remote to work again. Up to you if you want to call that a regression or a deprecated feature. Thanks for the attention to the issue. Sorry if I'm reporting a not-bug.

gigawhitlocks avatar Mar 21 '23 20:03 gigawhitlocks

I dont't it was deprecated, but i'm seeing that format of this defcustom is slightly diff from what you're adding https://github.com/rmuslimov/browse-at-remote/blob/master/browse-at-remote.el#L76

Can you try adjusting to format with :host / :type fields as in the example above

rmuslimov avatar Mar 21 '23 20:03 rmuslimov

That does fix it! How strange. I wish I could remember where I got the first config line; it worked as expected for a long time. Thank you so much for helping out, I never really expect that from community maintainers :heart:

Hopefully this issue will help someone in the future searching Google and save you the trouble.

For future reference the working config line looks like:

  (add-to-list 'browse-at-remote-remote-type-regexps '(:host "^bitbucket.private\\.tld$" :type "stash"))

gigawhitlocks avatar Mar 21 '23 20:03 gigawhitlocks

I think this sort of breaking change could have been handled a bit more gracefully by this package... as it breaks all users who have customized browse-at-remote-remote-type-regexps.

The problem seems to be here: (string-match-p (plist-get plist :host) host). (plist-get plist :host) will return nil for old-style definitions, which will not be accepted by string-match-p.

FYI @ilmotta (73c45265a1488f59bbd31ade780197727cc0bb21)