emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Max Nikulin <manikulin@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient
Date: Thu, 26 May 2022 22:24:13 +0800	[thread overview]
Message-ID: <87bkvke5iq.fsf@localhost> (raw)
In-Reply-To: <t6crbm$ao9$1@ciao.gmane.io>

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	other threads:[~2022-05-26 14:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-22  4:37 [BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient [9.5.3 (release_9.5.3-508-ge268e4 @ /home/yantar92/.emacs.d/straight/build/org/)] Ihor Radchenko
2022-05-22  8:13 ` [BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient Max Nikulin
2022-05-26 14:24   ` Ihor Radchenko [this message]
2022-05-26 16:14     ` Max Nikulin
2022-05-27  6:19       ` Ihor Radchenko
2022-05-27 12:03         ` Max Nikulin
2022-05-27 15:18           ` Ihor Radchenko
2022-06-02 17:04             ` [PATCH] org.el: Use `call-process' to launch external viewers (was: Re: [BUG] org-open-file immediately termininates when calling xdg-open that calls emacsclient) Max Nikulin
2022-07-24  5:51               ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkvke5iq.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=manikulin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).