Some function lookups using `helpful-function' yield `args-out-of-range'
When I do a lookup on certain functions I consistently get this error.
One example is org-edit-special:
Debugger entered--Lisp error: (args-out-of-range 0 10)
replace-match(#("ffap" 0 4 (button (t) category helpful-describe-button-button symbol ffap)) t t "`ffap'" nil)
replace-regexp-in-string("`\\_<\\(?:.\\|\n\\)+?\\_>'" #f(compiled-function (it) #<bytecode 0x1fdcbab>) "Call a special editor for the element at point.\n\nWhen at a table, call the formula editor with `org-table-edit-formulas'.\nWhen in a source code block, call `org-edit-src-code'.\nWhen in a fixed-width region, call `org-edit-fixed-width-region'.\nWhen in an export block, call `org-edit-export-block'.\nWhen at an #+INCLUDE keyword, visit the included file.\nWhen at a footnote reference, call `org-edit-footnote-reference'\nOn a link, call `ffap' to visit the link at point.\nOtherwise, return a user error." t t)
helpful--format-docstring("Call a special editor for the element at point.\nWhen at a table, call the formula editor with `org-table-edit-formulas'.\nWhen in a source code block, call `org-edit-src-code'.\nWhen in a fixed-width region, call `org-edit-fixed-width-region'.\nWhen in an export block, call `org-edit-export-block'.\nWhen at an #+INCLUDE keyword, visit the included file.\nWhen at a footnote reference, call `org-edit-footnote-reference'\nOn a link, call `ffap' to visit the link at point.\nOtherwise, return a user error.")
helpful-update()
helpful-function(org-edit-special)
funcall-interactively(helpful-function org-edit-special)
call-interactively(helpful-function nil nil)
command-execute(helpful-function)
Could it be related to some function being byte-compiled? Or is this some obvious error?
I'm unable to reproduce this with org-edit-special. Are you seeing it with other commands? Could you report your Emacs and org-mode versions, or better yet describe how to reproduce starting from emacs -Q?
It was tricky but I finally boiled it down to what it was, it is related to my setup and you can achieve it with the following steps:
- M-:
(setq debug-on-error t) - M-:
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") ("melpa" . "https://melpa.org/packages/"))) - M-x
package-installorg-mode - M-x
package-installhelpful - M-:
(defun +is-useful-buffer (buffer) (not (string-match "^ ?\\*.*\\*\\(<[0-9]+>\\)?$" (buffer-name buffer)))) - M-:
(push '(buffer-predicate . +is-useful-buffer) default-frame-alist) - C-x 5 2
- In the new frame run M-x
helpful-functionorg-edit-special
So looking at this it is quite obvious since obviously the package expects some buffer with *...* to show up. I haven't experienced any issues with other things however with this buffer predicate (that I know of...)
Thank you for your help, perhaps I should look into alternatives to the buffer-predicate.
Thanks, I can reproduce. I'm not sure what's causing it yet though.