emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] org-open-file immediately termininates when calling xdg-open t


From: Ihor Radchenko
Subject: Re: [BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient
Date: Thu, 26 May 2022 22:24:13 +0800

Max Nikulin <manikulin@gmail.com> writes:

>> They both set process-connection-type to nil/'pipe. Somehow, this change
>> breaks org-open-file for me when org-open-file calls xdg-open and xdg is
>> confugured to open the file with emacsclient. I only see a flicker and
>> the file does not open. Sometimes, Emacs even crashes.
>
> I can not reproduce a problem, however I tried to factor-out xdg-open. 
> Emacs-27.1, a minimal LXC container, so "&" to simulate kde-open5 
> starting process in background. On the other hand I consider behavior 
> when emacsclient is called from emacs as confusing due to requirement of 
> C-x # to notify emacs about completion.

Try the following:

(start-process-shell-command "1" nil "emacsclient -c ~/.bashrc")
(let ((process-connection-type nil))
  (start-process-shell-command "1" nil "emacsclient -c ~/.bashrc"))

The second command will cause flickering, though opens the file in the
same frame (not the new as one would expect from -c switch).

To reproduce what I am seeing, you may need to adjust xdg- database
adding the following .desktop file:

~/.local/share/applications/emacsclient-local.desktop
---------------
[Desktop Entry]
Type=Application
Version=1.0
Name=Emacs Client
Exec=emacsclient -c %f
Icon=emacs-icon
Terminal=false
MimeType=text/css;text/english;text/html;text/plain;text/x-c;text/x-chdr;text/x-csrc;text/x-c++;text/x-c++hdr;text/x-c++src;text/x-java;text/x-makefile;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;application/pdf;inode/directory;inode/mount-point;image/png;image/tiff;
---------------

Then, make sure that xdg-open uses the desktop file for
application/x-shellscript (xdg-mime query default
application/x-shellscript)

Finally, run 

(start-process-shell-command "1" nil "xdg-open -c ~/.bashrc")
(let ((process-connection-type nil))
  (start-process-shell-command "1" nil "xdg-open -c ~/.bashrc"))

Observe flickering + Emacs not opening the file.

> Do you see the same problem for a function from mailcap.el in the 
> development emacs version?

Which function are you referring to? 

Best,
Ihor



reply via email to

[Prev in Thread] Current Thread [Next in Thread]