I have a function `my/tex-command` that relies on the package `tex` and which I want to bind to some key. I handle this with `use-package` as follows:
```
(use-package tex
:bind ("C-c C-o C-o" . my/tex-command)
:config
(defun my/tex-command ()
(interactive)
;; Stuff
))
```
This works since `tex` is automatically auto-loaded when `my/tex-command` is called. Moreover, the function is defined correctly when `tex` is loaded.
However, if I run `(symbol-file 'my/tex-command)` I get back the file `tex.el` instead of the file where I actually defined the function. This is because `load-history` has several entries for `my/tex-command` including ones that associate it to `tex.el` and ones that associate it to the correct files. The result is that my helpful buffers show the wrong file when I look up `my/tex-command`.
How do I correctly deal with this situation? I know of two solutions that I want to avoid:
- Define a new module which includes `my/tex-command` and which requires `tex` when loaded. This is fine, but it does mean that I have to create many custom modules and I want to have a simpler configuration.
- Include `(require tex)` in `my/tex-command` and define it outside the `use-package` statement. I want to avoid having to call `require` commands in functions.