Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

helpful-callable hangs on hippie-expand with smartparens required #179

Closed
6AA4FD opened this issue Dec 26, 2018 · 8 comments
Closed

helpful-callable hangs on hippie-expand with smartparens required #179

6AA4FD opened this issue Dec 26, 2018 · 8 comments

Comments

@6AA4FD
Copy link

6AA4FD commented Dec 26, 2018

with helpful and smartparens loaded, emacs hangs after evaling (helpful-callable 'hippie-expand)
these logs are from emacs --version 27.0.50 -Q
the only other code run in the instance was adding melpa and installing the packages

i'm not too good at bug reports, so please tell me if i can help more

btrace.txt
profile.txt

EDIT: i realize that the profile file could be hard to read, so here's an image
profile_img

@6AA4FD 6AA4FD changed the title helpful hangs on hippie-expand with smartparens required helpful-callable hangs on hippie-expand with smartparens required Dec 26, 2018
@Wilfred
Copy link
Owner

Wilfred commented Dec 29, 2018

I can't reproduce this on Emacs 26.1. Can you?

Looking at the backtrace, I wonder if find-function-advised-original is behaving differently in Emacs 27. What happens if you run the following?

M-x ielm
(find-function-advised-original 'hippie-expand)

Does it hang, or does it show output?

@6AA4FD
Copy link
Author

6AA4FD commented Dec 30, 2018

it outputs (autoload "hippie-exp" 1203003 t nil) on 26 and something similar on 27
and (helpful-callable 'hippie-expand) also doesn't hang on 26
i want to mention that it's perfectly cool if you don't want to bother with supporting 27 yet, though i like your software and would obviously prefer it work better on my setup

@nickdrozd
Copy link
Contributor

I can reproduce it. I can also work around it with the following sequence:

  1. Run (helpful-callable 'hippie-expand). This will hang as described.
  2. Run (describe-function 'hippie-expand). This will run successfully.
  3. Run (helpful-callable 'hippie-expand) again. This time it will work.

I think this is because the builtin help functions do autoloading when needed, but Helpful doesn't. This seems to be the same underlying issue as #117.

@6AA4FD
Copy link
Author

6AA4FD commented Jan 1, 2019

i get the same behaviour on my end

@Wilfred
Copy link
Owner

Wilfred commented Mar 3, 2019

I think this is probably a duplicate of #117, which is now fixed :)

Let me know if not.

@Wilfred Wilfred closed this as completed Mar 3, 2019
@hlissner
Copy link

hlissner commented Jan 7, 2020

This appears to still be a problem on Emacs 26.3. helpful-callable hangs indefinitely (or so it seems) on any function that has been autoloaded and advised. The issue goes away once the function has a concrete definition.

It can be reproduced with the following on vanilla Emacs:

(require 'helpful)
;; I've tested on functions and commands that exist as well
(autoload 'x "x" nil t)
(defun myadvice (orig-fn &rest args)
  (apply orig-fn args))
;; I've tried :after, :before, and :override with the same results
(advice-add 'x :around #'myadvice)
(helpful-callable 'x)

With debug-on-quit on, I've produced this backtrace after waiting a minute or so (I was experimenting on org-clock-in at the time):

Debugger entered--Lisp error: (quit)
  advice--p(#f(advice-wrapper :around nil myadvice))
  advice--cd*r(#f(advice-wrapper :around nil myadvice))
  find-function-advised-original(org-clock-in)
  find-function-library(org-clock-in)
  helpful--definition(org-clock-in t)
  helpful-update()
  helpful-callable(org-clock-in)
  (progn (require (quote helpful)) (autoload (quote org-clock-in) "org-clock" nil t) (defalias (quote myadvice) (function (lambda (orig-fn &rest args) (apply orig-fn args)))) (advice-add (quote org-clock-in) :around (function myadvice)) (setq debug-on-quit t) (helpful-callable (quote org-clock-in)))
  (unwind-protect (progn (require (quote helpful)) (autoload (quote org-clock-in) "org-clock" nil t) (defalias (quote myadvice) (function (lambda (orig-fn &rest args) (apply orig-fn args)))) (advice-add (quote org-clock-in) :around (function myadvice)) (setq debug-on-quit t) (helpful-callable (quote org-clock-in))) (delete-file "/tmp/doom-sandbox-TSLf3x"))
  eval-buffer(#<buffer  *load*> nil "/tmp/doom-sandbox-TSLf3x" nil t)  ; Reading at buffer position 20133
  load-with-code-conversion("/tmp/doom-sandbox-TSLf3x" "/tmp/doom-sandbox-TSLf3x" nil t)
  load("/tmp/doom-sandbox-TSLf3x" nil t)
  command-line-1(("-l" "/tmp/doom-sandbox-TSLf3x"))
  command-line()
  normal-top-level()

It appears to be trapped in advice--cd*r:

;; in nadvice.el.gz, L70
(defun advice--cd*r (f)
  (while (advice--p f)
    (setq f (advice--cdr f)))
  f)

I am on the latest commit of helpful: 982dd49

@hlissner
Copy link

Should I open a new issue for this?

@Wilfred
Copy link
Owner

Wilfred commented Mar 23, 2020

Looks like #191 is the same issue, but thanks for the great repro!

Wilfred added a commit that referenced this issue Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants