all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: arthur miller <arthur.miller@live.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "archambv@iro.umontreal.ca" <archambv@iro.umontreal.ca>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Sv: Sv: Christmas wish: Literate Elisp
Date: Mon, 16 Dec 2019 12:01:45 +0000	[thread overview]
Message-ID: <VI1P194MB04296085AAD37D19755D0D2E96510@VI1P194MB0429.EURP194.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <jwv5zijq9y5.fsf-monnier+emacs@gnu.org>


[-- Attachment #1.1: Type: text/plain, Size: 2782 bytes --]

Hello again,

I was able to make readevalloop do what I want. It was rather trivial to
implement this (once I realized how it works 🙂). Emacs built fine and I was
able to test wtih eval-buffer and eval-regionwhich worked as intended.

It was just 4 code lines, I just copied codeto parse comment and change the
condition in if-statement:

(message "Hello, World!")

(message "Hello Again!")

In code blocs the ';' is still a comment delimiter:

(message
 ;; Here is a line comment
 "I am a bit chatty today!")

That's it for today folks!

(message "Bye bye cruel world!")

This email was composed in scratch buffer and executed during writing with
eval-buffer for testing.

However, byte compiler is not happy about this. It emits warnings
for every word out of code blocks as references to free variables. I am not sure
where to look to patch it, maybe another day.
________________________________
Från: Stefan Monnier <monnier@iro.umontreal.ca>
Skickat: den 14 december 2019 15:08
Till: arthur miller <arthur.miller@live.com>
Kopia: emacs-devel <emacs-devel@gnu.org>; archambv@iro.umontreal.ca <archambv@iro.umontreal.ca>
Ämne: Re: Sv: Christmas wish: Literate Elisp

arthur miller [2019-12-14 04:40:30] wrote:

> To be honest my contact with Haskell broke once the university course, some
> 20 yrs ago was over, so I am a little bit illiterate about Haskells sexy
> packages.  I just recalled that it was possible to invert text and code in
> Haskell.  But cool.

The fact that it's written is Haskell is just incidental.

> Didn't know there is a package to let load org files directly either.

Hmm... The closest I can find is https://github.com/jingtaozf/literate-elisp/
but it doesn't quite match what I think I was referring to.


        Stefan


> Thanks for the answers.
> ________________________________
> Från: Stefan Monnier <monnier@iro.umontreal.ca>
> Skickat: den 12 december 2019 18:29
> Till: arthur miller <arthur.miller@live.com>
> Kopia: emacs-devel <emacs-devel@gnu.org>; archambv@iro.umontreal.ca <archambv@iro.umontreal.ca>
> Ämne: Re: Christmas wish: Literate Elisp
>
>> My proposal is to slightly change Elisp parser to treat lines that start
>> with any other printable character but '(' as a start of comment and to
>> simply ignore the line, just as it treats ';' as a comment.
>
> The `sexpresso` Haskell package follows the same idea ;-)
>
> As for using it in Elisp: I don't think there's anything stopping anyone
> from making such a `literate-elisp-mode` and even arrange for `load` to
> handle such a file (just like there is already a package that lets
> `load` work directly on .org files).
>
> I'd welcome such a package in GNU ELPA.
>
>
>         Stefan


[-- Attachment #1.2: Type: text/html, Size: 4373 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: lread.patch --]
[-- Type: text/x-patch; name="lread.patch", Size: 389 bytes --]

--- lread.c	2019-12-16 12:52:05.739490741 +0100
+++ mylread.c	2019-12-16 12:50:46.572077138 +0100
@@ -2053,6 +2053,12 @@
 	  || c == NO_BREAK_SPACE)
 	goto read_next;
 
+      if (c != '(' && c != '#')
+	{
+	  while ((c = READCHAR) != '\n' && c != -1);
+	  goto read_next;
+	}
+
       if (! HASH_TABLE_P (read_objects_map)
 	  || XHASH_TABLE (read_objects_map)->count)
 	read_objects_map

  parent reply	other threads:[~2019-12-16 12:01 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12 15:45 Christmas wish: Literate Elisp arthur miller
2019-12-12 17:29 ` Stefan Monnier
2019-12-14  4:40   ` Sv: " arthur miller
2019-12-14 14:08     ` Stefan Monnier
2019-12-15  8:37       ` arthur miller
2019-12-16 12:01       ` arthur miller [this message]
2019-12-16 13:41         ` Sv: " Stefan Monnier
2019-12-16 14:02           ` Sv: " arthur miller
2019-12-16 16:07             ` Jonathan Leech-Pepin
2019-12-17  2:09               ` arthur miller
2019-12-17 11:06                 ` Adam Porter
2019-12-18 16:29                   ` Sv: " arthur miller
2019-12-18 18:49                     ` Adam Porter
2019-12-18 20:04                       ` Sv: " arthur miller
2019-12-18 23:18                         ` Adam Porter
2019-12-18 23:53                           ` Sv: " arthur miller
2019-12-20 15:58                             ` Unknown
2019-12-18 21:18                       ` Sv: Sv: Sv: " Stefan Monnier
2019-12-18 22:43                         ` Christmas wish: Literate Elisp (Intro) VanL
2019-12-19  0:05                           ` Sv: " arthur miller
2019-12-18 22:59                         ` Sv: Sv: Sv: Christmas wish: Literate Elisp Adam Porter
2019-12-18 23:18                           ` Sv: " arthur miller
2019-12-18 23:52                             ` Adam Porter
2019-12-19  0:02                               ` Sv: " arthur miller
2019-12-19  0:42                                 ` chad
2019-12-19  1:50                                   ` Jean-Christophe Helary
2019-12-20  0:55                                     ` Sv: " arthur miller
2019-12-20 15:00                                       ` Stefan Monnier
2019-12-20 15:50                                         ` Stefan Monnier
2019-12-20 15:50                                         ` Sv: " arthur miller
2019-12-20 16:17                                           ` Stefan Monnier
2019-12-20 16:34                                             ` Eduardo Ochs
2019-12-21  1:18                                               ` Sv: " arthur miller
2019-12-21  5:24                                                 ` Eduardo Ochs
2019-12-21  5:52                                                   ` Sv: " arthur miller
     [not found]                                                   ` <VI1P194MB042965777086C4466B7FF5EC962C0@VI1P194MB0429.EURP194.PROD.OUTLOOK.COM>
2019-12-21 15:29                                                     ` arthur miller
     [not found]                                             ` <VI1P194MB0429A123183C15AF8EC3956B962C0@VI1P194MB0429.EURP194.PROD.OUTLOOK.COM>
     [not found]                                               ` <jwv7e2pln3s.fsf-monnier+emacs@gnu.org>
     [not found]                                                 ` <VI1P194MB0429F37A29A2720037CAD9F9962C0@VI1P194MB0429.EURP194.PROD.OUTLOOK.COM>
2019-12-22  7:01                                                   ` Sv: " arthur miller
2019-12-20 16:51   ` Phillip Lord
2019-12-21  1:16     ` Tim Cross
2019-12-21  4:24       ` Sv: " arthur miller
2019-12-21  6:41         ` Tim Cross
2019-12-21  9:39           ` VanL
2019-12-21 14:17             ` Sv: " arthur miller
2019-12-14  4:16 ` Richard Stallman
2019-12-14  5:05   ` Sv: " arthur miller

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=VI1P194MB04296085AAD37D19755D0D2E96510@VI1P194MB0429.EURP194.PROD.OUTLOOK.COM \
    --to=arthur.miller@live.com \
    --cc=archambv@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.