Forums Bugs & issues Failure to open file into emacs with "open"

This topic contains 4 replies, has 2 voices, and was last updated by  Andrew Harris 2 months, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #4077 Reply

    Andrew Harris

    First, thank you very much for AxCrypt, which is quite wonderful.

    On changing to version 2.1.1460.0 I find a new and slightly irritating feature or bug involving my *.txt files, which I have linked to GNU emacs as the default program for txt extensions.  The problem occurs on both my Win7 32-bit and Win10 64-bit machines.

    The right-click “decrypt” works as before, but the right-click “open” launches emacs but does not fill the editor with the text.  This happened occasionally with previous versions, but the text would always fill on the second try — now it does not fill ever, as far as I can tell.

    I can open .docx, .doc, and .xls files from right-click “open”, so it seems to be an interaction with emacs as a third-party text editor.

    The workaround for me is easy (and acceptable): “decrypt” then open, instead of “open,” but I thought the feedback might be useful.  Emacs is probably not recommendable here anyway, since it leaves a backup file that must be manually shredded.   I’m happy to send more detailed information or to make simple tests if you would find that helpful.

    Thanks again!

    #4078 Reply

    Svante
    Keymaster

    Hello Andrew,

    Thanks for the info. We should definitely investigate that. Off the top of my head, I could imagine that this would happen a launch of emacs has a pattern similar to the following:

    emacs.exe blabla.txt launches another process, perhaps xx_emacs.exe blabla.txt . Or, if you have an emacs process running, and launching another causes the new instance to just tell the old instance to open the file.

    The point is that what AxCrypt does is:

    – Decrypt the file to a temp location.
    – Launch the associated application.
    – If AxCrypt sees the started app, it’ll assume it’s done with the file when it exists and thus re-encrypt (if necessary) and then wipe the file in the temp location.

    The secondary emacs would then try to open a file that no longer exists.

    I do not know the behavior of Emacs, but could something like this be the root cause?

    #4079 Reply

    Andrew Harris

    Thanks for the very speedy reply.

    I’m no expert, but your explanation sounds plausible.  In terms of running processes, while I see AxCrypt.exe in the Win Task Manager list whether I am using it or not, the emacs.exe is only present when an emacs window is open, so there does not seem to be an emacs server that starts on first invocation and then hangs around.

    There are variants for different hooks into Win:  https://www.gnu.org/software/emacs/manual/html_node/emacs/Windows-Startup.html

    My .txt files are linked to runemacs.exe (84kB), which in turn seems to launch emacs.exe (8844kB).  From item 1. on the page above, “The desktop shortcut should specify as its “Target” (in the “Properties” of the shortcut) the full absolute file name of runemacs.exe, not of emacs.exe. This is because runemacs.exe hides the console window that would have been created if the target of the shortcut were emacs.exe (which is a console program, as far as Windows is concerned). ”

    So there are indeed multiple steps in opening the file.

    Thanks again,

    Andrew

    #4081 Reply

    Svante
    Keymaster

    Hello Andrew,

    Yes, your ‘.txt’ -> ‘runemacs.exe’ file extension association, where ‘runemacs.exe’ in turn actually starts ’emacs.exe’ will indeed fool AxCrypt.

    It’s an unusual situation, but I’ll add an issue to handle this somehow. We’re trying to keep the logic around this much simpler than with AxCrypt 1, which had a whole number of heuristics – and still did not do it 100% right.

    You can follow https://bitbucket.org/axantum/axcrypt-net/issues/211/file-association-with-launcher-instead-of for progress of this issue.

    #4082 Reply

    Andrew Harris

    Hello Svanete —

    Thanks for looking into this.   It may have slipped through in v. 1 because of timing — as I mentioned, I’d sometimes get an empty editor page with v.1.

    At least from my point of view this is a curiosity rather than a problem that should be high on any list.

    Meanwhile I’ve followed the philosophy you’ve explained in the FAQ and forum pages, and linked the text files I open frequently to the Notepad editor.  This works fine, of course, with the additional advantage that there is little risk of leaving previous versions or temporary files around.  So, thanks for pointing us in that direction as well.

    Best,

    Andrew

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Failure to open file into emacs with "open"
Your information: