[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to develop a local fork of a package?
From: |
Alessandro Bertulli |
Subject: |
Re: How to develop a local fork of a package? |
Date: |
Mon, 05 Sep 2022 00:20:01 +0200 |
User-agent: |
mu4e 1.8.9; emacs 29.0.50 |
Akib Azmain Turja <akib@disroot.org> writes:
>> Alessandro Bertulli wrote:
>>
>>> (add-to-list 'load-path (expand-file-name "git_packages/org-ref/"))
>
> (expand-file-name "git_packages/org-ref/")? Relative to what? If the
> directory is in your ".emacs.d", then it should be (add-to-list
> 'load-path (expand-file-name "git_packages/org-ref/"
> user-emacs-directory)).
Yes, but if not specified the user-emacs-directory is the default, so I
don't think that's a problem (will try tho, just in case).
>>> (delete "/home/alessandro/.emacs.d/elpa/org-ref-20220830.1210" load-path)
>>> (package-initialize)
>
> Why? This would break whenever package.el updates org-ref.
Yes, it was just an hack to try with the current package.
> And this won't ever work because that directory is not in load-path
> before (package-initialize), and after (package-initialize) org-ref
> will be on load-path.
You're right, I didn't know the functioning of package-initialize. I'll
try and let you know.
> Your best option is to delete the package with M-x package-delete.
Aren't there any other methods? Like, if you want to make a PR, do you
uninstall the package every time?
> And the "delete" call may not work. You set load-path to the return
> value of "delete", for example:
>
> (setq load-path
> (delete "/home/alessandro/.emacs.d/elpa/org-ref-20220830.1210"
> load-path))
Well, it works for me actually. Also, delete uses side effects, if I
wanted to use setq, I should use remove, right?
>>>
>>> But then, no matter which one of these I use
>>>
>>> (require 'org-ref)
>
> Unless org-ref is in load-path, this will always error.
I suspect this is given by my wrong usage of package-initialize.
>>> (load "~/.emacs.d/git_packages/org-ref/org-ref")
>
> Where is the ".el" suffix? Did you mean (load
> "~/.emacs.d/git_packages/org-ref/org-ref.el")?
Wait, shouldn't I omit the suffix on purpose? Looking at the docstring
of load: "First try FILE with .elc appended, then try with .el".
> Loading directly will probably work for single file packages, but you
> should always add the package directory to load-path.
Aside from the directory part, that file is the one containing the
(provide 'org-ref) call. Shouldn't loading that achieve the same result
of the (require 'org-ref) I normally use? Since the other code files are
loaded inside it.
>>> (use-package org-ref
>>> :ensure nil
>>> :load-path "~/.emacs.d/git_packages/org-ref/org-ref.el")
>
> I think the error is because you specify a file as load-path instead of
> a directory. I think the load-path should be probably
> "~/.emacs.d/git_packages/org-ref/". However, I have never used
> :load-path keyword of use-package, so my assumptions may be wrong.
If the above doesn't work, I'll try and I'll let you know. Thanks!
Alessandro