3

When I use toggle-debug-on-error, and look at the backtrace generated in a Backtrace buffer, there are lot's of key-escapes that don't seem like they should be there, example:

Debugger entered--Lisp error: (invalid-read-syntax "#")
  read(#<buffer emacs-config.org>)
  eval-defun-2()
  #[257 "\211\203
\303\304!\210\305?!\207   \204\306 \207\307\310!\311\211\306 \262\n\262)=\204+\207" [edebug-all-defs eval-expression-debug-on-error debug-on-error require edebug eval-defun eval-defun-2 make-symbol "t" nil] 6 2405975 "P"](nil)
  ad-Advice-eval-defun(#[257 "\211\203
\303\304!\210\305?!\207   \204\306 \207\307\310!\311\211\306 \262\n\262)=\204+\207" [edebug-all-defs eval-expression-debug-on-error debug-on-error require edebug eval-defun eval-defun-2 make-symbol "t" nil] 6 2405975 "P"] nil)

What is this, and how can I either remove it or convert it to something useful?

Stian Håklev
  • 1,240
  • 2
  • 14
  • 26

2 Answers2

1

That is byte-compiled code. See the elisp-manual Section "16.2 Byte-Compilation Functions".

The actual problem is that you try to read-eval an org-file (perhaps per load-file). That does not work. What you can do on a buffer in org-mode is org-babel-execute-buffer. The doc for this function is:

org-babel-execute-buffer is an interactive autoloaded compiled Lisp
function in `ob-core.el'.

It is bound to C-c C-v b, C-c C-v C-b.

(org-babel-execute-buffer &optional ARG)

Execute source code blocks in a buffer.
Call `org-babel-execute-src-block' on every source block in
the current buffer.
Tobias
  • 5,038
  • 1
  • 18
  • 39
  • 3
    FWIW -- There have been Emacs bug reports (enhancement requests) asking that the byte-compile code be elided (replaced by `...`) or otherwise escaped, because it interferes with copy+paste, e.g., to send in a bug report. But so far, no dice. – Drew Feb 21 '14 at 23:04
  • @Drew Can you share URLs for any of those reports? – Adam Spiers Apr 14 '15 at 10:46
  • 1
    @AdamSpiers: Here is one such, [bug #6991](http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6991). – Drew Apr 14 '15 at 14:23
  • @Drew Many thanks for the link, and especially for chasing this issue. It astounds me that anyone could be moronic enough to say "No. Closed as wontfix." without even offering any justification! This is clearly a bug which needs to be fixed, and is apparently not too hard to fix based on Stefan's first attempt. – Adam Spiers Apr 14 '15 at 16:41
  • 1
    @AdamSpiers: Welcome to the astounding world of Emacs dev... ;-) – Drew Apr 14 '15 at 22:35
0

Here's an example of some compiled code -

(defun foo (x) "Double a number" (+ x x))

(byte-compile 'foo) =>
#[(x) "\211\\\207" [x] 2 "Double a number"]

ie

#[
  (x)                 ; arguments
  "\211\\\207"        ; byte-code
  [x]                 ; constants
  2                   ; stacksize
  "Double a number"   ; docstring
  ]

And this code can be disassembled -

(disassemble (byte-compile 'foo)) =>

byte code:
  doc:  double a number
  args: (x)
0       varref    x
1       dup       
2       plus      
3       return    

See this page for a brief description of these compiled objects: Byte-Code Objects

It would be nice, as Drew mentioned, to have a more readable form of the compiled functions in the stack traces. Maybe someone has done it with some advice somewhere.

Brian Burns
  • 20,575
  • 8
  • 83
  • 77