Giter VIP home page Giter VIP logo

Comments (2)

unhammer avatar unhammer commented on July 28, 2024 1

Well, another way to make it happen is to C-M-x one statement at a time in the buffer. Then my-foo defined inside the use-package will not have a location, while if it's defined outside use-package it'll have a location. I think that may be how I originally encountered it, writing use-package statements and doing C-M-x on them (though I have a feeling I've seen it too often for that to be the only situation).

from helpful.

Wilfred avatar Wilfred commented on July 28, 2024

OK, so I think this is due to load-history. We call find-function-noselect, which calls find-function-library and that inspects load-history with symbol-file.

When you run eval-buffer on a file foo.el, load-history will contain:

("/tmp/foo.el"
  (require . finder-inf)
  (defun . my-foo)
  (require . counsel)
  (require . helpful))

However, it looks like load-history is only updated once eval-buffer is finished. Since you're running helpful-function in the same file, eval-buffer isn't finished and load-history doesn't contain foo.el.

If you put the following in an elisp file:

(package-initialize)
(use-package counsel
  :defer t
  :config
  (defun my-foo4 (x)
    (with-ivy-window
      (insert x))))
(require 'counsel)

M-x eval-buffer and then M-x helpful-function my-foo shows the position as expected.

That solves the example you've given, but I imagine you're not actually running helpful-function from the same file as you've written use-package. How did you originally encounter this issue?

from helpful.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.