flexibeast / ebuku

Emacs interface to the buku Web bookmark manager.
92 stars 7 forks source link

ebuku--search-helper: Args out of range: " # ", 6155, 6171 #16

Closed idmyn closed 4 years ago

idmyn commented 4 years ago

Hello again 😅

This isn't a disastrous issue, but I'm consistently finding that the first time I call M-x ebuku I get the above error in *Messages* (debugger output below). It opens the *Ebuku* buffer in the background, but doesn't open it. If I manually open the *Ebuku* buffer I can see all my bookmarks listed there. If I call ebuku again, then the buffer is opened without error.

What's going on here?

Thanks!

Debugger entered--Lisp error: (args-out-of-range "   # " 6155 6171)
  match-string(1 "   # ")
  ebuku--search-helper("--print" "[all]" "-1000" "")
  ebuku-show-all()
  ebuku()
  funcall-interactively(ebuku)
  call-interactively(ebuku record nil)
  command-execute(ebuku record)
  counsel-M-x-action("ebuku")
flexibeast commented 4 years ago

Not disastrous, but clearly not satisfactory behaviour. :-)

Could you please M-x toggle-debug-on-error before your first M-x ebuku? That should then take you to the line in ebuku.el where the error is occurring.

idmyn commented 4 years ago

The code block at the bottom of my initial comment was the output of M-x toggle-debug-on-error

flexibeast commented 4 years ago

Ah, sorry. Basically what i need is to find the actual line on which the error is occurring, because ebuku--search-helper has a number of calls to match-string, and i need to find which one is producing the error.

Please open ebuku.el, move point to the ebuku--search-helper function, then instrument that function via C-u M-C-x. When you call M-x ebuku, that should take you to the source, showing the line about to be executed; at this point, press g. The code should then execute until the point at which the error occurs.

idmyn commented 4 years ago

Ooh, very cool! Thanks for explaining that process :)

It brought me to line 519.

flexibeast commented 4 years ago

Thanks. :-)

Could you please try changing the \\(.+\\) on line 518 to \\(.*\\), reevaluating ebuku--search-helper with C-M-x, and restarting Ebuku to see if that fixes the problem?

idmyn commented 4 years ago

Yup, that's done the trick!

What was the problem, out of interest? Do I have some malformed tags?

flexibeast commented 4 years ago

Excellent. :-) i just pushed the fix. Thanks for helping me track down the problem!

It looks like at least one of your bookmarks had an empty tag field - the previous ebuku.el code incorrectly assumed that if a tag field is present, it must be non-empty.