* Some whitespace stripped from emacs-lisp value in src blocks making it unreadable in certain cases
@ 2019-09-10 0:55 akater
2019-09-10 15:43 ` Colin Baxter
2019-09-10 17:29 ` Berry, Charles
0 siblings, 2 replies; 3+ messages in thread
From: akater @ 2019-09-10 0:55 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]
Consider a lisp form that, when evaluated, produces another form. I'm
used to org printing the resulting form nicely, in lisp blocks. However,
this is not the case for emacs-lisp src blocks. An example:
1. The way it should be (and is now the case) with lisp, namely sbcl:
#+begin_src lisp :results value verbatim :wrap example lisp
(macroexpand '(defun test (a b &optional c) "doc" nil))
#+end_src
#+RESULTS:
#+begin_example lisp
(PROGN
(EVAL-WHEN (:COMPILE-TOPLEVEL) (SB-C:%COMPILER-DEFUN 'TEST T NIL NIL))
(SB-IMPL::%DEFUN 'TEST
(SB-INT:NAMED-LAMBDA TEST
(A B &OPTIONAL C)
"doc"
(BLOCK TEST NIL))))
T
#+end_example
2. The way it is now with emacs-lisp and a src block header that is
otherwise identical:
#+begin_src emacs-lisp :results value verbatim :wrap example emacs-lisp
(macroexpand
'(use-package outline
:ensure nil
:bind
(:map outline-mode-map
("<kp-home>" . (lambda nil (interactive) (outline-up-heading 1))))))
#+end_src
#+RESULTS:
#+begin_example emacs-lisp
(progn (use-package-ensure-elpa 'outline '(nil) 'nil) (defvar use-package--warning157 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" 'outline keyword (error-message-string err)))) (display-warning 'use-package msg :error)))) (condition-case-unless-debug err (progn (if (not (require 'outline nil t)) (display-warning 'use-package (format "Cannot load %s" 'outline) :error)) (bind-keys :package outline :map outline-mode-map ("<kp-home>" lambda nil (interactive) (outline-up-heading 1)))) (error (funcall use-package--warning157 :catch err))))
#+end_example
Is there a remedy? This probably better be fixed but it could be due to
me using bleeding-edge Emacs 27 master (2019-09-10) & Org from melpa
(2019-09-09). If you don't have proper output formatting with other
versions in use, please report.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Some whitespace stripped from emacs-lisp value in src blocks making it unreadable in certain cases
2019-09-10 0:55 Some whitespace stripped from emacs-lisp value in src blocks making it unreadable in certain cases akater
@ 2019-09-10 15:43 ` Colin Baxter
2019-09-10 17:29 ` Berry, Charles
1 sibling, 0 replies; 3+ messages in thread
From: Colin Baxter @ 2019-09-10 15:43 UTC (permalink / raw)
To: akater; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]
>>>>> akater <nuclearspace@gmail.com> writes:
> Consider a lisp form that, when evaluated, produces another
> form. I'm used to org printing the resulting form nicely, in lisp
> blocks. However, this is not the case for emacs-lisp src
> blocks. An example:
> 1. The way it should be (and is now the case) with lisp, namely
> sbcl:
> #+begin_src lisp :results value verbatim :wrap example lisp
> (macroexpand '(defun test (a b &optional c) "doc" nil)) #+end_src
> #+RESULTS:
> #+begin_example lisp (PROGN (EVAL-WHEN (:COMPILE-TOPLEVEL)
> (SB-C:%COMPILER-DEFUN 'TEST T NIL NIL)) (SB-IMPL::%DEFUN 'TEST
> (SB-INT:NAMED-LAMBDA TEST (A B &OPTIONAL C) "doc" (BLOCK TEST
> NIL)))) T #+end_example
> 2. The way it is now with emacs-lisp and a src block header that
> is otherwise identical:
> #+begin_src emacs-lisp :results value verbatim :wrap example
> emacs-lisp (macroexpand '(use-package outline :ensure nil :bind
> (:map outline-mode-map ("<kp-home>" . (lambda nil (interactive)
> (outline-up-heading 1)))))) #+end_src
> #+RESULTS:
> #+begin_example emacs-lisp (progn (use-package-ensure-elpa
> 'outline '(nil) 'nil) (defvar use-package--warning157 #'(lambda
> (keyword err) (let ((msg (format "%s/%s: %s" 'outline keyword
> (error-message-string err)))) (display-warning 'use-package msg
> :error)))) (condition-case-unless-debug err (progn (if (not
> (require 'outline nil t)) (display-warning 'use-package (format
> "Cannot load %s" 'outline) :error)) (bind-keys :package outline
> :map outline-mode-map ("<kp-home>" lambda nil (interactive)
> (outline-up-heading 1)))) (error (funcall use-package--warning157
> :catch err)))) #+end_example
> Is there a remedy? This probably better be fixed but it could be
> due to me using bleeding-edge Emacs 27 master (2019-09-10) & Org
> from melpa (2019-09-09). If you don't have proper output
> formatting with other versions in use, please report.
I get the same formatting error as you and I am using emacs-26.3 with
org-mode version 9.2.6.
Best wishes,
--
Colin Baxter
www.Colin-Baxter.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Some whitespace stripped from emacs-lisp value in src blocks making it unreadable in certain cases
2019-09-10 0:55 Some whitespace stripped from emacs-lisp value in src blocks making it unreadable in certain cases akater
2019-09-10 15:43 ` Colin Baxter
@ 2019-09-10 17:29 ` Berry, Charles
1 sibling, 0 replies; 3+ messages in thread
From: Berry, Charles @ 2019-09-10 17:29 UTC (permalink / raw)
To: akater; +Cc: emacs-orgmode@gnu.org
> On Sep 9, 2019, at 5:55 PM, akater <nuclearspace@gmail.com> wrote:
>
> Consider a lisp form that, when evaluated, produces another form. I'm
> used to org printing the resulting form nicely, in lisp blocks. However,
> this is not the case for emacs-lisp src blocks. An example:
>
> 1. The way it should be (and is now the case) with lisp, namely sbcl:
>
> #+begin_src lisp :results value verbatim :wrap example lisp
> (macroexpand '(defun test (a b &optional c) "doc" nil))
> #+end_src
>
> #+RESULTS:
> #+begin_example lisp
> (PROGN
> (EVAL-WHEN (:COMPILE-TOPLEVEL) (SB-C:%COMPILER-DEFUN 'TEST T NIL NIL))
> (SB-IMPL::%DEFUN 'TEST
> (SB-INT:NAMED-LAMBDA TEST
> (A B &OPTIONAL C)
> "doc"
> (BLOCK TEST NIL))))
> T
> #+end_example
>
> 2. The way it is now with emacs-lisp and a src block header that is
> otherwise identical:
>
> #+begin_src emacs-lisp :results value verbatim :wrap example emacs-lisp
> (macroexpand
> '(use-package outline
> :ensure nil
> :bind
> (:map outline-mode-map
> ("<kp-home>" . (lambda nil (interactive) (outline-up-heading 1))))))
> #+end_src
>
Using emacs 26.1 and org 9.2.5, I get
#+RESULTS:
#+begin_example emacs-lisp
(use-package outline :ensure nil :bind (:map outline-mode-map ("<kp-home>" lambda nil (interactive) (outline-up-heading 1))))
#+end_example
I am unclear what the effect of `:wrap example emacs-lisp' is here. AFAICS, the `emacs-lisp' has no effect. Can you point to a place in the code where this has effect?
Using `:results value code :wrap src emacs-lisp' as the header args, I get this:
#+RESULTS:
#+begin_src emacs-lisp
(use-package outline :ensure nil :bind
(:map outline-mode-map
("<kp-home>" lambda nil
(interactive)
(outline-up-heading 1))))
#+end_src
HTH,
Chuck
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-10 21:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-10 0:55 Some whitespace stripped from emacs-lisp value in src blocks making it unreadable in certain cases akater
2019-09-10 15:43 ` Colin Baxter
2019-09-10 17:29 ` Berry, Charles
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).