Re: [O] AUCTeX conflicting with org-mode
Hi Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: I hope you see the no-win situation now (:-p), hence my apprehension about the fix earlier. That said, I guess you have two choices: 1. Leave the bug unsolved, hoping there will be a cleaner solution later. After all, there is a very simple workaround on the user side, do (load tex.el) before using org-latex. Okay, let's do this. I've marked the patch as Requesting For Comments in the patchwork: http://patchwork.newartisans.com/patch/1232/ Thanks! -- Bastien
Re: [O] AUCTeX conflicting with org-mode
Hi Bastien, On Mon, Mar 26, 2012 at 19:47, Bastien b...@gnu.org wrote: Hi Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: I hope you see the no-win situation now (:-p), hence my apprehension about the fix earlier. That said, I guess you have two choices: 1. Leave the bug unsolved, hoping there will be a cleaner solution later. After all, there is a very simple workaround on the user side, do (load tex.el) before using org-latex. Okay, let's do this. I've marked the patch as Requesting For Comments in the patchwork: http://patchwork.newartisans.com/patch/1232/ Thanks! As I stated earlier, IMO this is the safer choice. Good to see the maintainer agrees. ;) Cheers, -- Suvayu Open source is the future. It sets us free.
Re: [O] AUCTeX conflicting with org-mode
Hi Bastien and Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: [snipped 35 lines] 1. Leave the bug unsolved, hoping there will be a cleaner solution later. After all, there is a very simple workaround on the user side, do (load tex.el) before using org-latex. how about this patch (to hotfix branch). diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 2e11ca4..438e5a4 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -871,6 +871,7 @@ when PUB-DIR is set, use this as the publishing directory. filename))) (auto-insert nil); Avoid any auto-insert stuff for the new file (TeX-master (boundp 'TeX-master)) + (dummy (unless TeX-master (makunbound 'TeX-master))) ; make sure we are not introducing TeX-master (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create -- YYR
Re: [O] AUCTeX conflicting with org-mode
Hi Yagnesh, On Wed, Mar 21, 2012 at 07:01, Yagnesh Raghava Yakkala yagn...@live.com wrote: Hi Bastien and Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: [snipped 35 lines] 1. Leave the bug unsolved, hoping there will be a cleaner solution later. After all, there is a very simple workaround on the user side, do (load tex.el) before using org-latex. how about this patch (to hotfix branch). I tested it, the problem is still there. I don't think you can put arbitrary code within a let* bind and expect to retain the effect in the main body. The only possible solution I can see seems to be ensuring tex.el is loaded properly. More importantly though, if more users cannot replicate this bug this might as well be a detail specific to how the AUCTeX site files behave in my setup (I use AUCTeX from the Fedora repositories). Not sure if that is something org should handle. Cheers, -- Suvayu Open source is the future. It sets us free.
Re: [O] AUCTeX conflicting with org-mode
Hello Suvayu., suvayu ali fatkasuvayu+li...@gmail.com writes: Hi Yagnesh, On Wed, Mar 21, 2012 at 07:01, Yagnesh Raghava Yakkala yagn...@live.com wrote: Hi Bastien and Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: [snipped 35 lines] 1. Leave the bug unsolved, hoping there will be a cleaner solution later. After all, there is a very simple workaround on the user side, do (load tex.el) before using org-latex. how about this patch (to hotfix branch). I tested it, the problem is still there. That's odd. My tests have passed. I don't think you can put arbitrary code within a let* bind and expect to retain the effect in the main body. I don't understand what you mean here. Anyway it seems poking into variables from other packages is not a good idea in elisp. -- YYR
Re: [O] AUCTeX conflicting with org-mode
Hi Yagnesh, Yagnesh Raghava Yakkala yagn...@live.com writes: Thanks for the analysis. I think you are right. With my limited elisp skills I would say its a *bug* and coming from org. If I take that let-binding off and setting the TeX-master by checking with if it ever bound seems fixing this problem. this patch fixing the problem. (can be further improved) Applied, thanks. -- Bastien
Re: [O] AUCTeX conflicting with org-mode
Hi Bastien and Yagnesh, On Tue, Mar 20, 2012 at 12:02, Bastien b...@gnu.org wrote: Hi Yagnesh, Yagnesh Raghava Yakkala yagn...@live.com writes: Thanks for the analysis. I think you are right. With my limited elisp skills I would say its a *bug* and coming from org. If I take that let-binding off and setting the TeX-master by checking with if it ever bound seems fixing this problem. this patch fixing the problem. (can be further improved) Applied, thanks. I wanted to comment earlier but it slipped my mind, sorry about that. I am not sure if this patch is quite corect. It removes the let bind and instead conditionally uses setq to bind it to t. From the docs I see the variable becomes buffer local when set in any fashion, but does that still mean it is okay to use setq? I can imagine in a complicated publishing project, an org file might need to set the value to something. I suppose this will override any such custom config. Is my analysis correct? It might be worth thinking about before applying the patch. Is a conditional let binding possible, it might be the safer choice in that case. Thanks, -- Suvayu Open source is the future. It sets us free.
Re: [O] AUCTeX conflicting with org-mode
Hi Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: I wanted to comment earlier but it slipped my mind, sorry about that. I am not sure if this patch is quite corect. It removes the let bind and instead conditionally uses setq to bind it to t. From the docs I see the variable becomes buffer local when set in any fashion, but does that still mean it is okay to use setq? I can imagine in a complicated publishing project, an org file might need to set the value to something. I suppose this will override any such custom config. Is my analysis correct? It might be worth thinking about before applying the patch. Is a conditional let binding possible, it might be the safer choice in that case. I applied a patch into hotfix-7.8.06 using the let binding -- let me know if this works correctly. Thanks! -- Bastien
Re: [O] AUCTeX conflicting with org-mode
Hi Bastien, On Tue, Mar 20, 2012 at 17:23, Bastien b...@gnu.org wrote: Hi Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: I wanted to comment earlier but it slipped my mind, sorry about that. I am not sure if this patch is quite corect. It removes the let bind and instead conditionally uses setq to bind it to t. From the docs I see the variable becomes buffer local when set in any fashion, but does that still mean it is okay to use setq? I can imagine in a complicated publishing project, an org file might need to set the value to something. I suppose this will override any such custom config. Is my analysis correct? It might be worth thinking about before applying the patch. Is a conditional let binding possible, it might be the safer choice in that case. I applied a patch into hotfix-7.8.06 using the let binding -- let me know if this works correctly. I don't think this works. The problem (thanks to Nick again for the analysis earlier in the thread[1] :-)) is the let bind happens before tex.el is loaded. So when it is loaded eventually, the defvar fails which in turn triggers the backtrace. The setq in the body works but could possibly mess up someone's custom config as I mentioned in my earlier post. I hope you see the no-win situation now (:-p), hence my apprehension about the fix earlier. That said, I guess you have two choices: 1. Leave the bug unsolved, hoping there will be a cleaner solution later. After all, there is a very simple workaround on the user side, do (load tex.el) before using org-latex. 2. The second choice would be to partially fix the bug with the setq, but potentially break a future unsuspecting user with a non-standard config. If it were up to me, I would probably prefer option one. I hope this clears up everything. Footnotes: [1] http://thread.gmane.org/gmane.emacs.orgmode/53128/focus=53152 http://thread.gmane.org/gmane.emacs.orgmode/53128/focus=53156 -- Suvayu Open source is the future. It sets us free.
Re: [O] AUCTeX conflicting with org-mode
On Wed, Mar 7, 2012 at 06:08, Yagnesh Raghava Yakkala yagn...@live.com wrote: I can reproduce this., I think your auctex installation is fine. Its definitely from org. Thanks a lot for taking a look and confirming. :) -- Suvayu Open source is the future. It sets us free.
Re: [O] AUCTeX conflicting with org-mode
Yagnesh Raghava Yakkala yagn...@live.com wrote: Hi Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: Hi, I am having conflicts AUCTeX when I try to open plain latex files after I exporting an org file to latex. These are the exact steps. 1. Start Emacs as: emacs -q (so that the site files load and I have auctex available). 2. Open any org file and export to latex, C-c C-e l. 3. Open another plain latex file. At this point I see this backtrace: Debugger entered--Lisp error: (void-variable TeX-master) #[nil \301\302 !\203 \303=\203 \304\305\211\306#\210\307\306!\207 [TeX-master file-exists-p buffer-file-name shared TeX-master-file nil t TeX-update-style] 4]() run-hooks(find-file-hook) after-find-file(nil t) find-file-noselect-1(#buffer velo-links.tex ~/graphics/velo-links.tex nil nil ~/graphics/velo-links.tex (263573 64770)) find-file-noselect(~/graphics/velo-links.tex nil nil t) find-file(~/graphics/velo-links.tex t) call-interactively(find-file nil nil) Since removing the auctex site files out of the site-lisp directory resolves the conflict I am assuming the problem stems from my auctex installation. Can someone help me trouble shoot this? I can reproduce this., I think your auctex installation is fine. Its definitely from org. In org-latex.el Tex-master is set to t to suppress auctex from asking for that variable while exporting with org-latex..(IIRC there was a discussion and Carsten made that change) Some how org leaving that to void at the end of org-latex export (I coundn't figure out how?). That sounds far-fetched to me: once TeX-master is bound, one has to go to some lengths to unbind it (see makunbound - but I'm pretty sure that's not used anywhere in org code - there are a few instances of the function analog, fmakunbound). It seems much more likely that in these cases, it never got bound in the first place, possibly because of dependency problems in the loading of packages. But I cannot reproduce the problem, so I'm speaking theoretically only and my imagination may be failing me. Nick
Re: [O] AUCTeX conflicting with org-mode
Hi Nick, On Wed, Mar 7, 2012 at 16:39, Nick Dokos nicholas.do...@hp.com wrote: In org-latex.el Tex-master is set to t to suppress auctex from asking for that variable while exporting with org-latex..(IIRC there was a discussion and Carsten made that change) Some how org leaving that to void at the end of org-latex export (I coundn't figure out how?). That sounds far-fetched to me: once TeX-master is bound, one has to go to some lengths to unbind it (see makunbound - but I'm pretty sure that's not used anywhere in org code - there are a few instances of the function analog, fmakunbound). It seems much more likely that in these cases, it never got bound in the first place, possibly because of dependency problems in the loading of packages. But I cannot reproduce the problem, so I'm speaking theoretically only and my imagination may be failing me. I think Yagnesh is talking about this thread: http://thread.gmane.org/gmane.emacs.orgmode/48512/focus=48526 I took a quick look at the commit (ca49e89) and the source (org-latex.el line 888), but everything looks good to me. To add more information, while exporting to latex I get the following warning when auctex site files are present. Export buffer: Exporting to LaTeX... Warning: defvar ignored because TeX-master is let-bound Making TeX-master buffer-local while let-bound! Hope this clearly explains the problem I am facing. PS: BTW, why is AUCTeX not part of Emacs? -- Suvayu Open source is the future. It sets us free.
Re: [O] AUCTeX conflicting with org-mode
suvayu ali fatkasuvayu+li...@gmail.com wrote: Hi Nick, On Wed, Mar 7, 2012 at 16:39, Nick Dokos nicholas.do...@hp.com wrote: In org-latex.el Tex-master is set to t to suppress auctex from asking for that variable while exporting with org-latex..(IIRC there was a discussion and Carsten made that change) Some how org leaving that to void at the end of org-latex export (I coundn't figure out how?). That sounds far-fetched to me: once TeX-master is bound, one has to go to some lengths to unbind it (see makunbound - but I'm pretty sure that's not used anywhere in org code - there are a few instances of the function analog, fmakunbound). It seems much more likely that in these cases, it never got bound in the first place, possibly because of dependency problems in the loading of packages. But I cannot reproduce the problem, so I'm speaking theoretically only and my imagination may be failing me. I think Yagnesh is talking about this thread: http://thread.gmane.org/gmane.emacs.orgmode/48512/focus=48526 I took a quick look at the commit (ca49e89) and the source (org-latex.el line 888), but everything looks good to me. To add more information, while exporting to latex I get the following warning when auctex site files are present. Export buffer: Exporting to LaTeX... Warning: defvar ignored because TeX-master is let-bound Making TeX-master buffer-local while let-bound! Hope this clearly explains the problem I am facing. Yup - that shows that tex.el has not been loaded by the time you try the export, so the let-bind (Carsten's fix) happens first and then the defvar (from tex.el) complains because that's usually not what you want: you want to get to the global binding (which doesn't exist at that point in time). That's what the doc for defvar warns about: , | ... | If SYMBOL has a local binding, then this form affects the local | binding. This is usually not what you want. Thus, if you need to | load a file defining variables, with this form or with `defconst' or | `defcustom', you should always load that file _outside_ any bindings | for these variables. (`defconst' and `defcustom' behave similarly in | this respect.) ` As a workaround-and-proof-of-concept, try (load tex) before loading org. Assuming that that works, you will probably want to arrange things that this is always done. It might also be the case that Carsten's fix needs to be modified to check whether TeX-master is bound already - then it can let-bind it without problems; but I'm not sure what to do if that's not the case. The question I have is what exactly causes tex.el to be loaded at that point in time. If you can figure that out, then that might lead to a more permanent solution. PS: BTW, why is AUCTeX not part of Emacs? I thought it had to do with the glacial release schedule of emacs 21/22/23: at the time, auctex/preview-latex was undergoing changes at a much faster pace, so waiting for emacs releases was just not feasible. Whether it could be integrated now is a good question, but I don't have a good answer for it. There is also a recent thread that implies that the copyrights were not assigned to the FSF, but that seems to have changed. See http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00847.html Nick
Re: [O] AUCTeX conflicting with org-mode
Hi Nick, On Wed, Mar 7, 2012 at 21:00, Nick Dokos nicholas.do...@hp.com wrote: As a workaround-and-proof-of-concept, try (load tex) before loading org. Assuming that that works, you will probably want to arrange things that this is always done. This worked as you hypothesised. :) It might also be the case that Carsten's fix needs to be modified to check whether TeX-master is bound already - then it can let-bind it without problems; but I'm not sure what to do if that's not the case. The question I have is what exactly causes tex.el to be loaded at that point in time. If you can figure that out, then that might lead to a more permanent solution. I am not sure how I can conclusively confirm that, but I think when I export to latex, the exported latex buffer loads it. For example, I don't see this issue when say I go through these steps: 1. Open a tex file. 2. Open and export an org file to latex. 3. Open a new tex file. In this case step (1) must be loading tex.el, circumventing the issue. Cheers, -- Suvayu Open source is the future. It sets us free.
Re: [O] AUCTeX conflicting with org-mode
suvayu ali fatkasuvayu+li...@gmail.com wrote: Hi Nick, On Wed, Mar 7, 2012 at 21:00, Nick Dokos nicholas.do...@hp.com wrote: As a workaround-and-proof-of-concept, try (load tex) before loading org. Assuming that that works, you will probably want to arrange things that this is always done. This worked as you hypothesised. :) It might also be the case that Carsten's fix needs to be modified to check whether TeX-master is bound already - then it can let-bind it without problems; but I'm not sure what to do if that's not the case. The question I have is what exactly causes tex.el to be loaded at that point in time. If you can figure that out, then that might lead to a more permanent solution. I am not sure how I can conclusively confirm that, but I think when I export to latex, the exported latex buffer loads it. For example, I don't see this issue when say I go through these steps: 1. Open a tex file. 2. Open and export an org file to latex. 3. Open a new tex file. In this case step (1) must be loading tex.el, circumventing the issue. Actually, your backtrace in the original post makes things clearer now. org-export-as-latex calls find-file-noselect on the .tex file, which calls after-find-file which runs the find-file-hook. Somehow the find-file-hook is set up[fn:1] as in VirTeX-common-initialization to call TeX-master-file - although your backtrace shows compiled code, it's pretty clear that that's the setting of the find-file-hook that VirTeX-common-initialization has done. So it looks as if tex.el is partially loaded: the initialization is done, the hook is set up but the defvar has failed, probably because of the let-bind. Nick Footnotes: [fn:1] à la Sidney Harris - cf. http://www.sciencecartoonsplus.com/index.php
Re: [O] AUCTeX conflicting with org-mode
Hello Nick., Nick Dokos nicholas.do...@hp.com writes: suvayu ali fatkasuvayu+li...@gmail.com wrote: [snipped] Actually, your backtrace in the original post makes things clearer now. org-export-as-latex calls find-file-noselect on the .tex file, which calls after-find-file which runs the find-file-hook. Somehow the find-file-hook is set up[fn:1] as in VirTeX-common-initialization to call TeX-master-file - although your backtrace shows compiled code, it's pretty clear that that's the setting of the find-file-hook that VirTeX-common-initialization has done. So it looks as if tex.el is partially loaded: the initialization is done, the hook is set up but the defvar has failed, probably because of the let-bind. Thanks for the analysis. I think you are right. With my limited elisp skills I would say its a *bug* and coming from org. If I take that let-binding off and setting the TeX-master by checking with if it ever bound seems fixing this problem. this patch fixing the problem. (can be further improved) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 03664b4..9e53849 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -885,7 +885,6 @@ when PUB-DIR is set, use this as the publishing directory. (concat filename .tex) filename))) (auto-insert nil); Avoid any auto-insert stuff for the new file - (TeX-master t) ; Avoid the Query for TeX master from AUCTeX (buffer (if to-buffer (cond ((eq to-buffer 'string) (get-buffer-create @@ -958,6 +957,8 @@ when PUB-DIR is set, use this as the publishing directory. :exclude-tags (plist-get opt-plist :exclude-tags) :LaTeX-fragments nil))) +(if (boundp 'TeX-master) (setq TeX-master t)) ; Avoid the Query for TeX master from AUCTeX + (set-buffer buffer) (erase-buffer) (org-install-letbind) -- YYR
Re: [O] AUCTeX conflicting with org-mode
Hi Suvayu, suvayu ali fatkasuvayu+li...@gmail.com writes: Hi, I am having conflicts AUCTeX when I try to open plain latex files after I exporting an org file to latex. These are the exact steps. 1. Start Emacs as: emacs -q (so that the site files load and I have auctex available). 2. Open any org file and export to latex, C-c C-e l. 3. Open another plain latex file. At this point I see this backtrace: Debugger entered--Lisp error: (void-variable TeX-master) #[nil \301\302 !\203 \303=\203 \304\305\211\306#\210\307\306!\207 [TeX-master file-exists-p buffer-file-name shared TeX-master-file nil t TeX-update-style] 4]() run-hooks(find-file-hook) after-find-file(nil t) find-file-noselect-1(#buffer velo-links.tex ~/graphics/velo-links.tex nil nil ~/graphics/velo-links.tex (263573 64770)) find-file-noselect(~/graphics/velo-links.tex nil nil t) find-file(~/graphics/velo-links.tex t) call-interactively(find-file nil nil) Since removing the auctex site files out of the site-lisp directory resolves the conflict I am assuming the problem stems from my auctex installation. Can someone help me trouble shoot this? I can reproduce this., I think your auctex installation is fine. Its definitely from org. In org-latex.el Tex-master is set to t to suppress auctex from asking for that variable while exporting with org-latex..(IIRC there was a discussion and Carsten made that change) Some how org leaving that to void at the end of org-latex export (I coundn't figure out how?). -- YYR