bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#26765: 25.2; org-babel: Inserting list of cons cells fails


From: Lucas Groenendaal
Subject: bug#26765: 25.2; org-babel: Inserting list of cons cells fails
Date: Wed, 3 May 2017 13:57:50 -0500

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from 'emacs -Q':

First off, I found a fix for this problem.  I wasn't sure how to best
submit that change but a bug report seemed appropriate so I went with
that.  After a short demonstration of the problem comes my diff.
Apologies if anything is missing or confusing, I've never done this
before.

- Start up emacs: emacs -Q
- Put this code into an org mode file:
#+BEGIN_SRC elisp
  (print '((1 . 2)))
#+END_SRC
- Evaluate that code with: C-c C-c
- This will fail when I think it should show the evaluation of the
  code. Here is it's backtrace:
Debugger entered--Lisp error: (wrong-type-argument listp 2)
  mapcar(#[(f) "^HT^P   ^H^X^Z\306\n!\204^Y^@\n:\203^Y^@\307\n^H\"\202^Z^@\n*\211^[\203`^@\310\f^M\"\203`^@^K\311\312^M\"\311\313^M\"D^^^N^Z\306\n!\203B^@\314\n^N^N\"\202\\^@\n\203\
O^@\314\315\n^N^N#\202\\^@^N^N\203Z^@^N^N@\202\\^@^N^N*\202a^@^M^]^N^O^H^X^Z\306\n!\204y^@\n:\203y^@\307\n^H\"\202z^@\n*\206\200^@^N^P^MC^^^N^Z\306\n!\203\223^@\314\n^N^N\"\202\255\
^@\n\203\240^@\314\315\n^N^N#\202\255^@^N^N\203\253^@^N^N@\202\255^@^N^N,\207" [i *orgtbl-efmt* fmt efmt orgtbl-exp-regexp f functionp plist-get string-match match-string 1 2 apply\
 format args *orgtbl-fmt* *orgtbl-default-fmt*] 6] (1 . 2))
  orgtbl-format-line((1 . 2))
  orgtbl-format-section(nil)
  orgtbl-to-generic(((1 . 2)) (:remove-newlines t :tstart nil :tend nil :hline "|---" :sep " | " :lstart "| " :lend " |" :fmt (lambda (cell) (format "%s" cell))))
  orgtbl-to-orgtbl(((1 . 2)) (:fmt (lambda (cell) (format "%s" cell))))
  org-babel-insert-result(((1 . 2)) ("replace") ("elisp" "(print '((1 . 2)))" ((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:e\
xports . "code") (:results . "replace") (:session . "none") (:hlines . "no") (:result-type . value) (:result-params "replace") (:rowname-names) (:colname-names)) "" nil 0 #<marker \
at 1 in test.org>) nil 0 "elisp")
  org-babel-execute-src-block(nil)
  org-babel-execute-src-block-maybe()
  org-babel-execute-maybe()
  org-babel-execute-safely-maybe()
  run-hook-with-args-until-success(org-babel-execute-safely-maybe)
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)

This is my diff for the change:
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index cfbcbe6..19b160d 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -2109,7 +2109,7 @@ code ---- the results are extracted in the syntax of the source
                  (goto-char beg)
                  (insert (concat (orgtbl-to-orgtbl
                                   (if (org-every
-                                       (lambda (el) (or (listp el) (eq el 'hline)))
+                                       (lambda (el) (or (funcall proper-list-p el) (eq el 'hline)))
                                        result)
                                       result (list result))
                                   '(:fmt (lambda (cell) (format "%s" cell)))) "\n"))

Explanation: If a "proper list" (i.e one that ends in "nil") is being
evaluated then emacs will display that "proper list" as a table with one
row for each element if EVERY element in the "proper list" satisfies
"listp".  Later the orgtbl-format-line function is repeatedly called
with successive elements of the "proper list" and does a "mapcar" on the
given element.  This leads to the issue because a cons cell (1 . 2)
satisfies "listp" but will choke "mapcar".

In GNU Emacs 25.2.1 (x86_64-apple-darwin14.5.0)
 of 2017-04-22 built on Yosemite.local
Configured using:
 'configure --disable-dependency-tracking --disable-silent-rules
 --enable-locallisppath=/usr/local/share/emacs/site-lisp
 --infodir=/usr/local/Cellar/emacs/25.2/share/info/emacs
 --prefix=/usr/local/Cellar/emacs/25.2 --without-x --with-xml2
 --without-dbus --without-gnutls --without-imagemagick --without-ns'

Configured features:
NOTIFY ACL LIBXML2 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list...

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
regexp-opt rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode
easymenu cl-loaddefs pcase cl-lib mail-prsvr mail-utils term/xterm xterm
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type tabulated-list newcomment elisp-mode lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select mouse jit-lock font-lock
syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
kqueue multi-tty make-network-process emacs)

Memory information:
((conses 16 86431 6722)
 (symbols 48 18779 0)
 (miscs 40 42 113)
 (strings 32 14391 4240)
 (string-bytes 1 414280)
 (vectors 16 9641)
 (vector-slots 8 378348 17602)
 (floats 8 147 542)
 (intervals 56 232 26)
 (buffers 976 19))


reply via email to

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