-
Notifications
You must be signed in to change notification settings - Fork 49
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
Duplicated #+transclude
line on file save
#257
Comments
From what I can understand until now - org-transclusion-keyword-remove is responsible for removing the #+transclude: keyword after the content is yanked from the target location. This function did not undergo a change from my version to yours, but the function is rather simple - The problem is some variable is being set to nil - but this shouldn't be the case, we do not know what variable is being set to nil or what is responsible for it. The first course of action should be to figure out what variable exactly is misbehaving like this
Try this function - it would report on the value of the variables.
|
To confirm, add the above function in e.g., my init.el, or elsewhere? |
Just evaluate it in a scratch buffer. no need to add it to your init.el and make it permanent - we are just debugging. |
eval-last-sexp in scratch prints |
@jpt4 That is correct. We have merely evaluated the new definition. When the function will run in the normal course of action it will print the debug messages we implanted. Try to trigger the error like before after you have evaluated our debug function. |
There is something more simple you can do -
Then simply run
It gives me an output such as this
As you can see so long as we have
The code will execute properly - my hunch is one of them is returning nil for some reason. You do not need to run any org-transclusion function to get this, this is supplied by org naturally. |
Thank you, attempting to reproduce the error results in:
|
Well - if this is the output then it shouldn't had thrown the error about something being nil-
Everything seems normal here - there is no error here. |
@nobiot can you comment on this when you have some time? Thanks. |
Can you let me know your org-version, please? |
With the following, I cannot reproduce the issue.
This works as expected and as before. No duplicate emacs-version: 29.3 |
I have just tried with what I believe to be the latest stable version of Org -- 9.7.11. I cannot reproduce the issue. |
@nobiot Since the remove keyword function is so simple - it only queries the org-element and uses the information to delete some words - I believe for OP there is some problem with org-element cache, in so far, nothing in org-transclusion can cause the error as reported. @jpt4 Try to reset the org-element-cache from your end - the function in question is extremely simple, it neither references any other external function nor is dependent on any other functionality than what is presented to us by org natively. If you face the issue again, then the debug function I provided should output atleast one of them as nil. |
Today I had the most craziest experience - I had the same problem but in another function that uses the org-element functions. I will cut the chase and give the solution directly then explain
Delete this folder and let emacs recompile. This problem is being caused due to stale caches!!! I was trying to get the newest version of org pre-9.8 and everytime I tried to run a function it would give me this error!! AND THE WEIRDEST PART IS THAT THE MOMENT I REEVALUATED THE FUNCTION THE PROBLEM WENT AWAY! Please report back if the problem goes away when you delete this folder!! |
I think the root issue is as described here: org-roam/org-roam#2361 (comment) As a fix, after upgrading Org, you'd need to recompile Org and all other libraries that use org-element (this includes Org-transclusion, Org-roam, etc.). To do this, you can run This should be another way of what @akashpal-21 did (deleting the eln directory). Here is the key detail:
|
@nobiot, my package versions are as follows: @akashpal-21, I have deleted .emacs.d/eln-cache, with no change in behavior. Upon saving, the #257 (comment)
Thank you both for your assistance thus far. |
Did you let emacs recompile the packages after you deleted the folder before trying? You'd have to restart the emacs daemon if you were using that.. As a last resort - I can only advice to reinstall everything from scratch - just take your init file and any custom packages you may have and just install everything fresh. There is no bugs in the function definitions, otherwise we could have recreated the errors ourselves too. Please try to restart the emacs daemon before trying if you hadn't done it earlier. |
What does this mean? You run (package-recompile-all) and you get the message about GitHub? This cannot be a correct message for package-recompile-all. There must be something else going on. Can you try Org-transclusion with I agree with @akashpal-21, saying this:
What we have seen so far is there is something wrong with your environment that causes the issue. Our hypothesis is that your compiled code (org and org-transclusion) is incorrect. So you need to re-compile the code. I don't know if this is possible with GuixSD or if Guix is interfering. I have no idea how it works. It is not the code of Org-transclusion as neither of us can reproduce the issue. So there will be no "fix" to the code. |
Just in case, another point.
After deleting it, you need to restart Emacs, so that Emacs is not running the compiled code that you have deleted. Or if you are running a daemon (or emacs-server), you need to restart them as @akashpal-21 is saying. |
Moving from: #177
Reporting a related issue: duplication of the #+transclude: line when saving a modified file.
To reproduce:
Introduce a transclusion: #+transclude:
Add the transclusion, such that the content is now visible in the file.
Modify the file somewhere else, outside of the transclusion.
Save the file.
Result:
The transclusion is removed (content disappears, transclude line remains), a duplicate #+transclude: line is placed above the original, and an error is reported to the minibuffer: Wrong type argument: number-or-marker-p, nil (This error also shows during other org-transclusion actions, like adding, but does not prevent the action from taking place.)
Software Versions:
Emacs 29.4
org-transclusion 1.4.0
This is new behavior, but I do not know from exactly when. Unfortunately, this makes org-transclusion incompatible with my workflow, though I do endorse the project overall.
Thank you in advance for your attention to this matter.
Trace:
@akashpal-21
The text was updated successfully, but these errors were encountered: