emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Tobias Getzner <tobias.getzner@gmx.de>,
	Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: [Bug?] Results of code block printed in wrong place
Date: Tue, 23 Sep 2014 14:32:29 -0400	[thread overview]
Message-ID: <87k34unq6a.fsf@gmail.com> (raw)
In-Reply-To: <1411460565.14042.1.camel@gmx.de>

Hi Tobias,

I can reproduce this.

2014ko irailak 23an, Tobias Getzner-ek idatzi zuen:
> 
> Hello Nicolas,
> 
> On Mo, 2014-09-22 at 17:29 +0200, Nicolas Goaziou wrote:
>> FWIW, I cannot reproduce it.
> 
> This was quite painful to isolate, but I’ve now identified a minimal
> configuration which should trigger this bug.
> 
> ──────────────────────────────────────────────────────────────────
> ;; BEGIN minimal.el
> (add-to-list 'load-path (expand-file-name "~/.emacs.d/elpa/org-20140922"))
> 
> ;; Example needs sh; might also trigger with other langs.
> (org-babel-do-load-languages
>   'org-babel-load-languages
>   '((sh .t)))
> 
> (fset 'yes-or-no-p 'y-or-n-p)
> 
> (defun my-org-mode-hook ()
>    (follow-mode))
> (add-hook 'org-mode-hook 'my-org-mode-hook)
> ;; END minimal.el
> ──────────────────────────────────────────────────────────────────
>

The file:

=====
* heading 1
#+BEGIN_SRC sh :eval never
echo baz
#+END_SRC

* heading 2
#+BEGIN_SRC sh :exports results
echo quux
#+END_SRC
=====

I get #+results: quux in the original buffer, not the export buffer (so
that quux is not present in the output of export.)

> This seems rather bizarre. Both follow-mode and the y-or-n-p alias work
> in isolation, but when both are used at the same time, I observe the
> bug initially described. Can you confirm this?

What a fun puzzle!

Babel uses yes-or-no-p to confirm evaluation of the code block on export.
yes-or-no-p is implemented in C whereas y-or-n-p is in elisp, so it must
be the case that the lisp code allows some hook to run, which follow-mode
uses to futz with which buffer/window is current, confusing org-mode.
The C implementation I guess doesn’t run the same hook.

Sounds like the best advice for the moment is “don’t use follow-mode
with org”.  Maybe it’s worth adding to the section on package conflicts
in the manual?

-- 
Aaron Ecay

  parent reply	other threads:[~2014-09-23 18:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-22 13:26 [Bug?] Results of code block printed in wrong place Tobias Getzner
2014-09-22 15:29 ` Nicolas Goaziou
2014-09-23  8:22   ` Tobias Getzner
2014-09-23  9:58     ` Tobias Getzner
2014-09-23 18:32     ` Aaron Ecay [this message]
2014-09-24 11:41       ` Tobias Getzner

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=87k34unq6a.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --cc=tobias.getzner@gmx.de \
    /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).