3

Some of my org mode files take a long time to export because they include code for number crunching that is executed during export (via Org Babel) . I usually minimize the Emacs frame while the export process is running and work on something else. Unfortunately, the Emacs frame is automatically raised during export and I think it happens every time pdflatex is run (three times). These frames then get in my way and I have to minimize them again and again. How can I prevent Org mode from raising the frame during export?

Edit: Minimal example:

  • emacs -Q
  • M-x package-initialize
  • M-: (setq org-confirm-babel-evaluate nil)
  • Open a new file test.org and paste content shown below.
  • C-c C-e l p to export to PDF via LaTeX.
  • Immediately minimize Emacs frame using window manager.
  • Wait 5 seconds.

Result: Emacs frame raised after ~5s.

#+BEGIN_SRC emacs-lisp :exports results :results value
(if (sit-for 5)
    "Finished waiting."
  "Interrupted while waiting.")
#+END_SRC

Edit 2: I'm using Emacs 26.0.60 (compiled from source) with Org mode 9.1.6 (from ELPA) but I have been experiencing this problem with many versions of Emacs and Org mode and for at least three years (before that I didn't use Org's exporting facility). My window manager is FVWM2 on Ubuntu 16.04.4 LTS.

  • 1
    I previously experienced a similar issue with another library and tracked it down to select-frame-set-input-focus, which caused the behavior you described. I modified the related functions to use select-frame and raise-frame instead. You might want to grep the org-babel / pdflatex stuff to see if that function is used .... – lawlist Mar 10 '18 at 22:32
  • Thanks for the suggestion. I checked in the complete org source and as far as I can see, select-frame-set-input-focus is only used in two functions that are unrelated to exporting (org-eval-in-calendar and org-read-date). – tmalsburg Mar 11 '18 at 10:09
  • 1
    I cannot reproduce the problem with emacs-version 25.1.50.2 i686-pc-linux-gnu gtk+-version 3.10.8, org-version 9.1.6 Ubuntu 16.04.3 LTS, awesome window manager. That demonstrates how important it is that you add version information to your question. Run M-x emacs-version and M-x org-version and add the output, add also your os and window manager. Your recipe is incomplete. Per default org-confirm-babel-evaluate is set to t. With :exports results you are asked to confirm the source block execution. That should be added to the recipe. – Tobias Mar 11 '18 at 12:55
  • Added version information and the setting of org-confirm-babel-evaluate. – tmalsburg Mar 12 '18 at 14:16
  • 1
    I'm also using fvwm2 together with an older version of emacs. I cannot reproduce your problem. Long time ago I prevented all programs to pop up or raise windows (by configuring fvwm2). I think you should try to setup those Style options in your .fvwm2rc. Experiment with something like Style "emacs" IgnoreRestack,GnomeIgnoreHints,EWMHIgnoreStackingOrderHints. Or try to destroy general popup functionality with: destroyfunc UrgencyFunc or destroyfunc UrgencyDoneFunc or destroyfunc EWMHActivateWindowFunc Or you could ask at the fvwm mailing list. – jue Mar 12 '18 at 20:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.