Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#587 emacs compatibility

open
nobody
None
1
2013-11-19
2013-11-10
peter b.
No

Note that parts of this report can also be viewed as a bug.

TS is quite good at noticing when the .tex file has changed and acting accordingly. However, there are some bumps in this road.

I prefer to use emacs to edit my latex source. I know TS is supposed to be an IDE, but after decades of using emacs and decades of emacs development, emacs is more useful than the TS editor. Yes, I could automate most everything TS does using just emacs, but TS is much more convenient in many ways.

Feature Request 1: It would be nice if TS provided more intentional support for using an external text editor.

Bugs/Features:

When I edit externally in emacs while running TS, I get excessive warnings and dialogs about external file changes/deletions.

I believe that many of these occur because by default my emacs writes to disk as follows:
a. rename original file to a backup name
b. write current file state to a new file with real name.

(or it may be that to make things more bulletproof it actually does:
a'. write current state to a temp file
b'. rename original file to a backup name
c'. rename temp file to original file name
)

Because that is not an atomic operation, I believe that one problem occurs because as soon as step (a) occurs, TS notices that the .tex file has been deleted, and starts asking me what to do.

Once step (b) occurs, TS notices the file is indeed there, but now has changed, and again is asking me what to do.

In other words, to TS the .tex file seems to disappear, and then reappear. In the absence of tighter integration with emacs, I think this problem probably could be fixed 99% of the time if TS used a timer before deciding that a file had been deleted. I.e., after noticing a deletion, wait some number of milliseconds to see if the file reappears.

Bug/feature 2:
At least one of the warnings about files changing under TS alludes to the ability to automatically reload the file, and thus avoid the warning. However, I cannot find any options setting that allows this behavior to be controlled.

For TS 2.6.2, win xp sp3.

Discussion

  • Tim Hoffmann
    Tim Hoffmann
    2013-11-12

    Sorry, but as you may imaginge integration of external editors is not a priority in the project. The Option you are looking for is

    Options -> Advanced Editor -> Special Options -> Silently Reload Files on External Changes

    See also this request for details on the problem of reloading files:
    https://sourceforge.net/p/texstudio/feature-requests/296/

    Not sure if it is any help for you: The problem would not occur if it was possible to change the renaming of the original file to a 'save copy' operation and then overwrite the original file. That way it would not disappear in between. Since one can do everything with emacs it might be possible to configure that :).