emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Vladimir Nikishkin <lockywolf@gmail.com>
To: Bastien <bzg@gnu.org>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Bug: ob-shell cannot forward empty blocks to stdin [9.3.1 (release_9.3.1-101-gc9ee3d @ /home/lockywolf/OfficialRepos/org-mode/lisp/)]
Date: Thu, 10 Sep 2020 15:10:08 +0800	[thread overview]
Message-ID: <CA+A2iZZU+Ad+5k3mgiE=A__YqPU2zBX8ZoAnPs6uEu6XRvsbGw@mail.gmail.com> (raw)
In-Reply-To: <87blikib0j.fsf@bzg.fr>

It still behaves as described.

Let me describe it in more detail:

suppose you have the following file

```
# -*- mode:org; -*-

#+name: empty
#+begin_quote
#+end_quote

#+begin_src shell :stdin empty
#+end_src
```

the #+end_src line should be the line number 8 in the file.
Place the point at the very beginning of line 8. This way the point is
_inside_ the code block, even though the block itself has length 0.
Type C-c C-c. Observe an error in the echo area.
The stack trace is the following:

```
Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  buffer-substring-no-properties(nil nil)
  (org-remove-indentation (buffer-substring-no-properties
(org-element-property :contents-begin element) (org-element-property
:contents-end element)))
  (cond ((eq val 'fixed-width) (let ((v (org-trim
(org-element-property :value element)))) (or
(org-babel--string-to-number v) v))) ((eq val 'table)
(org-babel-read-table)) ((eq val 'plain-list) (org-babel-read-list))
((eq val 'example-block) (let ((v (org-element-property :value
element))) (if (or org-src-preserve-indentation (org-element-property
:preserve-indent element)) v (org-remove-indentation v)))) ((eq val
'export-block) (org-remove-indentation (org-element-property :value
element))) ((eq val 'paragraph) (skip-chars-forward " \11") (if (and
(looking-at org-link-bracket-re) (save-excursion (goto-char (match-end
0)) (skip-chars-forward " \15\11\n") (<= (org-element-property :end
element) (point)))) (org-babel-read-link)
(buffer-substring-no-properties (org-element-property :contents-begin
element) (org-element-property :contents-end element)))) ((pcase--flip
memq '(special-block verse-block quote-block center-block) val)
(org-remove-indentation (buffer-substring-no-properties
(org-element-property :contents-begin element) (org-element-property
:contents-end element)))) (t nil))
  (let* ((val (org-element-type element))) (cond ((eq val
'fixed-width) (let ((v (org-trim (org-element-property :value
element)))) (or (org-babel--string-to-number v) v))) ((eq val 'table)
(org-babel-read-table)) ((eq val 'plain-list) (org-babel-read-list))
((eq val 'example-block) (let ((v (org-element-property :value
element))) (if (or org-src-preserve-indentation (org-element-property
:preserve-indent element)) v (org-remove-indentation v)))) ((eq val
'export-block) (org-remove-indentation (org-element-property :value
element))) ((eq val 'paragraph) (skip-chars-forward " \11") (if (and
(looking-at org-link-bracket-re) (save-excursion (goto-char (match-end
0)) (skip-chars-forward " \15\11\n") (<= (org-element-property :end
element) (point)))) (org-babel-read-link)
(buffer-substring-no-properties (org-element-property :contents-begin
element) (org-element-property :contents-end element)))) ((pcase--flip
memq '(special-block verse-block quote-block center-block) val)
(org-remove-indentation (buffer-substring-no-properties
(org-element-property :contents-begin element) (org-element-property
:contents-end element)))) (t nil)))
  (pcase (org-element-type element) (`fixed-width (let ((v (org-trim
(org-element-property :value element)))) (or
(org-babel--string-to-number v) v))) (`table (org-babel-read-table))
(`plain-list (org-babel-read-list)) (`example-block (let ((v
(org-element-property :value element))) (if (or
org-src-preserve-indentation (org-element-property :preserve-indent
element)) v (org-remove-indentation v)))) (`export-block
(org-remove-indentation (org-element-property :value element)))
(`paragraph (skip-chars-forward " \11") (if (and (looking-at
org-link-bracket-re) (save-excursion (goto-char (match-end 0))
(skip-chars-forward " \15\11\n") (<= (org-element-property :end
element) (point)))) (org-babel-read-link)
(buffer-substring-no-properties (org-element-property :contents-begin
element) (org-element-property :contents-end element)))) ((or
`center-block `quote-block `verse-block `special-block)
(org-remove-indentation (buffer-substring-no-properties
(org-element-property :contents-begin element) (org-element-property
:contents-end element)))) (_ nil))
  (save-restriction (widen) (goto-char (org-element-property
:post-affiliated element)) (pcase (org-element-type element)
(`fixed-width (let ((v (org-trim (org-element-property :value
element)))) (or (org-babel--string-to-number v) v))) (`table
(org-babel-read-table)) (`plain-list (org-babel-read-list))
(`example-block (let ((v (org-element-property :value element))) (if
(or org-src-preserve-indentation (org-element-property
:preserve-indent element)) v (org-remove-indentation v))))
(`export-block (org-remove-indentation (org-element-property :value
element))) (`paragraph (skip-chars-forward " \11") (if (and
(looking-at org-link-bracket-re) (save-excursion (goto-char (match-end
0)) (skip-chars-forward " \15\11\n") (<= (org-element-property :end
element) (point)))) (org-babel-read-link)
(buffer-substring-no-properties (org-element-property :contents-begin
element) (org-element-property :contents-end element)))) ((or
`center-block `quote-block `verse-block `special-block)
(org-remove-indentation (buffer-substring-no-properties
(org-element-property :contents-begin element) (org-element-property
:contents-end element)))) (_ nil)))
  (save-excursion (save-restriction (widen) (goto-char
(org-element-property :post-affiliated element)) (pcase
(org-element-type element) (`fixed-width (let ((v (org-trim ...))) (or
(org-babel--string-to-number v) v))) (`table (org-babel-read-table))
(`plain-list (org-babel-read-list)) (`example-block (let ((v
(org-element-property :value element))) (if (or
org-src-preserve-indentation (org-element-property :preserve-indent
element)) v (org-remove-indentation v)))) (`export-block
(org-remove-indentation (org-element-property :value element)))
(`paragraph (skip-chars-forward " \11") (if (and (looking-at
org-link-bracket-re) (save-excursion (goto-char ...)
(skip-chars-forward " \15\11\n") (<= ... ...))) (org-babel-read-link)
(buffer-substring-no-properties (org-element-property :contents-begin
element) (org-element-property :contents-end element)))) ((or
`center-block `quote-block `verse-block `special-block)
(org-remove-indentation (buffer-substring-no-properties
(org-element-property :contents-begin element) (org-element-property
:contents-end element)))) (_ nil))))
  (org-with-wide-buffer (goto-char (org-element-property
:post-affiliated element)) (pcase (org-element-type element)
(`fixed-width (let ((v (org-trim (org-element-property :value
element)))) (or (org-babel--string-to-number v) v))) (`table
(org-babel-read-table)) (`plain-list (org-babel-read-list))
(`example-block (let ((v (org-element-property :value element))) (if
(or org-src-preserve-indentation (org-element-property
:preserve-indent element)) v (org-remove-indentation v))))
(`export-block (org-remove-indentation (org-element-property :value
element))) (`paragraph (skip-chars-forward " \11") (if (and
(looking-at org-link-bracket-re) (save-excursion (goto-char (match-end
0)) (skip-chars-forward " \15\11\n") (<= (org-element-property :end
element) (point)))) (org-babel-read-link)
(buffer-substring-no-properties (org-element-property :contents-begin
element) (org-element-property :contents-end element)))) ((or
`center-block `quote-block `verse-block `special-block)
(org-remove-indentation (buffer-substring-no-properties
(org-element-property :contents-begin element) (org-element-property
:contents-end element)))) (_ nil)))
  org-babel-read-element((quote-block (:begin 22 :end 63
:contents-begin nil :contents-end nil :post-blank 1 :post-affiliated
36 :name "empty" :parent nil)))
  org-babel-ref-resolve("empty")
  org-babel-execute:shell("" ((:colname-names) (:rowname-names)
(:result-params "replace") (:result-type . value) (:results .
"replace") (:exports . "code") (:session . "none") (:cache . "no")
(:noweb . "no") (:hlines . "no") (:tangle . "no") (:stdin . "empty")))
  org-babel-execute-src-block(nil ("shell" "" ((:colname-names)
(:rowname-names) (:result-params "replace") (:result-type . value)
(:results . "replace") (:exports . "code") (:stdin . "empty") (:tangle
. "no") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session .
"none")) "" nil 63 "(ref:%s)"))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  #<subr call-interactively>(org-ctrl-c-ctrl-c nil nil)
  apply(#<subr call-interactively> org-ctrl-c-ctrl-c (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr
call-interactively> org-ctrl-c-ctrl-c nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr
call-interactively> (org-ctrl-c-ctrl-c nil nil))
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)
```

On Sat, 5 Sep 2020 at 21:55, Bastien <bzg@gnu.org> wrote:
>
> Hi Vladimir,
>
> Vladimir Nikishkin <lockywolf@gmail.com> writes:
>
> > The MWE would be the following:
> >
> > #+name: empty
> > #+begin_quote
> >
> > #+end_quote
> >
> > #+begin_src shell :stdin empty
> > #+end_src
> >
> > Now if you try to execute the second block, you will get a lisp error.
> > "Wrong argument integer-or-marker-p"
>
> It probably has been fixed a long time ago because I cannot reproduce
> it here.  Sorry if I lost part of the discussion about this bug.  If
> you can confirm the fix, that'd be good.
>
> Thanks,
>
> --
>  Bastien



-- 
Yours sincerely, Vladimir Nikishkin


      reply	other threads:[~2020-09-10  7:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25  1:28 Bug: ob-shell cannot forward empty blocks to stdin [9.3.1 (release_9.3.1-101-gc9ee3d @ /home/lockywolf/OfficialRepos/org-mode/lisp/)] Vladimir Nikishkin
2020-09-05 13:55 ` Bastien
2020-09-10  7:10   ` Vladimir Nikishkin [this message]

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='CA+A2iZZU+Ad+5k3mgiE=A__YqPU2zBX8ZoAnPs6uEu6XRvsbGw@mail.gmail.com' \
    --to=lockywolf@gmail.com \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    /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).