unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: guile-user@gnu.org
Subject: Re: Anniversary hack: Zile editor with Guile support
Date: Mon, 13 Feb 2012 15:27:57 +0100	[thread overview]
Message-ID: <87ehtylseq.fsf@gnu.org> (raw)
In-Reply-To: 1329094293.53143.YahooMailNeo@web37901.mail.mud.yahoo.com

[-- Attachment #1: Type: text/plain, Size: 698 bytes --]

Hi Mike!

Mike Gran <spk121@yahoo.com> skribis:

> In response to Ludo's request for a Guile-2.0 anniversary hack, I'll
> start by offering a release of a hack I made.  But this isn't my
> official hack: it is just a building block.

Excellent.  Looking forward to the actual hack.  :-)

> You can find the download at
>
> https://github.com/downloads/spk121/zile/zile-on-guile-0.0.tar.gz
>
> This is a 0.0 release, so if it even builds on anyone else's machine,
> I'd be totally surprised.

It builds!  :-)

There’s a small issue: for me, it would segfault; using NULL instead of
0 as the sentinel in scm_c_export calls solves the problem for me (patch
below.)

(I made the change in basic.c:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 343 bytes --]

--- /home/ludo/src/zile/t/zile-on-guile-0.0/src/basic.c~	2012-02-13 00:26:24.000000000 +0100
+++ /home/ludo/src/zile/t/zile-on-guile-0.0/src/basic.c	2012-02-13 15:15:37.000000000 +0100
@@ -264,5 +264,5 @@ init_guile_basic_procedures (void)
 		"forward-char",
 		"backward-char",
 		"scroll-down",
-		"scroll-up", 0);
+		"scroll-up", NULL);
 }

[-- Attachment #3: Type: text/plain, Size: 63 bytes --]


... then looked at the difference in the generated assembly:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: Type: text/x-patch, Size: 558 bytes --]

--- /home/ludo/src/zile/t/zile-on-guile-0.0/good.S	2012-02-13 15:12:29.000000000 +0100
+++ /home/ludo/src/zile/t/zile-on-guile-0.0/bad.S	2012-02-13 15:12:40.000000000 +0100
@@ -6,8 +6,8 @@
    be 00 00 00 00          mov    $0x0,%esi
    bf 00 00 00 00          mov    $0x0,%edi
    31 c0                   xor    %eax,%eax
-   48 c7 44 24 30 00 00    movq   $0x0,0x30(%rsp)
-   00 00 
+   c7 44 24 30 00 00 00    movl   $0x0,0x30(%rsp)
+   00 
    48 c7 44 24 28 00 00    movq   $0x0,0x28(%rsp)
    00 00 
    48 c7 44 24 20 00 00    movq   $0x0,0x20(%rsp)

[-- Attachment #5: Type: text/plain, Size: 605 bytes --]


It’s subtle, but apparently important.)

> -- Pressing Alt+C brings up a REPL.  You can do all your standard REPL
>    things.
>
> -- In the REPL, one can create and bind new commands.  Define a
>    procedure of zero arguments, export it, and then bind it to a key
>    using 'set-key'.
>
>    For example:
>
>      (define (blammo)
>        (insert "blammo"))
>      (export blammo)
>      (set-key "\\F9" 'blammo)
>
>    This creates a function that inserts the world "blammo" at the mark
>    whenever <F9> is pressed.

Works for me, neaaat!  :-)

Thanks,
Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: the patch --]
[-- Type: text/x-patch, Size: 5104 bytes --]

From 027fd77b3caa63137ee01a40cf27ef8911cbdded Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Mon, 13 Feb 2012 15:27:38 +0100
Subject: [PATCH] Use NULL as the sentinel of `scm_c_export'.

* src/basic.c, src/bind.c, src/buffer.c, src/eval.c, src/file.c,
  src/funcs.c, src/help.c, src/killring.c, src/line.c, src/lisp.c,
  src/macro.c, src/redisplay.c, src/registers.c, src/search.c,
  src/undo.c, src/variables.c: Use NULL as the sentinel of
  `scm_c_export'.
---
 src/basic.c     |    2 +-
 src/bind.c      |    2 +-
 src/buffer.c    |    2 +-
 src/eval.c      |    2 +-
 src/file.c      |    2 +-
 src/funcs.c     |    2 +-
 src/help.c      |    2 +-
 src/killring.c  |    2 +-
 src/line.c      |    2 +-
 src/lisp.c      |    2 +-
 src/macro.c     |    2 +-
 src/redisplay.c |    2 +-
 src/registers.c |    2 +-
 src/search.c    |    2 +-
 src/undo.c      |    2 +-
 src/variables.c |    2 +-
 16 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/src/basic.c b/src/basic.c
index 631de68..49d4f6c 100644
--- a/src/basic.c
+++ b/src/basic.c
@@ -264,5 +264,5 @@ init_guile_basic_procedures (void)
 		"forward-char",
 		"backward-char",
 		"scroll-down",
-		"scroll-up", 0);
+		"scroll-up", NULL);
 }
diff --git a/src/bind.c b/src/bind.c
index effd101..820b7c0 100644
--- a/src/bind.c
+++ b/src/bind.c
@@ -728,5 +728,5 @@ init_guile_bind_procedures ()
 		"set-key",
 		"describe-bindings",
 		"key-map",
-		0);
+		NULL);
 }
diff --git a/src/buffer.c b/src/buffer.c
index d25fbbc..1ff127f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -818,5 +818,5 @@ init_guile_buffer_procedures (void)
 {
 
 #include "buffer.x"
-  scm_c_export ("kill-buffer", 0);
+  scm_c_export ("kill-buffer", NULL);
 }
diff --git a/src/eval.c b/src/eval.c
index 8a8ac5a..84521c7 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -202,5 +202,5 @@ void
 init_guile_eval_procedures (void)
 {
 #include "eval.x"
-  scm_c_export ("execute-extended-command", 0);
+  scm_c_export ("execute-extended-command", NULL);
 }
diff --git a/src/file.c b/src/file.c
index 3e9b7a8..903710c 100644
--- a/src/file.c
+++ b/src/file.c
@@ -829,5 +829,5 @@ init_guile_file_procedures (void)
 		"save-some-buffers",
 		"save-buffers-kill-emacs",
 		"cd",
-		0);		
+		NULL);
 }
diff --git a/src/funcs.c b/src/funcs.c
index 0c9407e..dfb6c63 100644
--- a/src/funcs.c
+++ b/src/funcs.c
@@ -1199,5 +1199,5 @@ init_guile_funcs_procedures (void)
 		"shell-command-on-region",
 		"delete-region",
 		"delete-blank-lines",
-		0);
+		NULL);
 }
diff --git a/src/help.c b/src/help.c
index 24e70c4..2daf2f1 100644
--- a/src/help.c
+++ b/src/help.c
@@ -179,5 +179,5 @@ init_guile_help_procedures (void)
   scm_c_export ("describe-function",
 		"describe-variable",
 		"describe-key",
-		0);
+		NULL);
 }
diff --git a/src/killring.c b/src/killring.c
index 23d2f62..07d6796 100644
--- a/src/killring.c
+++ b/src/killring.c
@@ -271,5 +271,5 @@ init_guile_killring_procedures (void)
 		"backward-kill-word",
 		"kill-sexp",
 		"yank",
-		0);
+		NULL);
 }
diff --git a/src/line.c b/src/line.c
index 2500c80..aad5d12 100644
--- a/src/line.c
+++ b/src/line.c
@@ -415,6 +415,6 @@ init_guile_line_procedures (void)
 		"indent-relative",
 		"indent-for-tab-command",
 		"newline-and-indent",
-		0);
+		NULL);
 }
 
diff --git a/src/lisp.c b/src/lisp.c
index b20d693..3ca6e7b 100644
--- a/src/lisp.c
+++ b/src/lisp.c
@@ -190,5 +190,5 @@ init_guile_lisp_procedures (void)
 {
 #include "lisp.x"
   scm_c_export ("console",
-		0);
+		NULL);
 }
diff --git a/src/macro.c b/src/macro.c
index b0e42b3..5627f0e 100644
--- a/src/macro.c
+++ b/src/macro.c
@@ -198,5 +198,5 @@ init_guile_macro_procedures (void)
 		"call-last-kbd-macro",
 		"end-kbd-macro",
 		"execute-kbd-macro",
-		0);
+		NULL);
 }
diff --git a/src/redisplay.c b/src/redisplay.c
index df02642..1b43a9f 100644
--- a/src/redisplay.c
+++ b/src/redisplay.c
@@ -130,5 +130,5 @@ init_guile_redisplay_procedures (void)
 {
 #include "redisplay.x"
   scm_c_export ("recenter", 
-		0);
+		NULL);
 }
diff --git a/src/registers.c b/src/registers.c
index 990e2aa..70d3056 100644
--- a/src/registers.c
+++ b/src/registers.c
@@ -152,5 +152,5 @@ init_guile_registers_procedures (void)
   scm_c_export ("copy-to-register",
 		"insert-register",
 		"list-registers",
-		0);
+		NULL);
 }
diff --git a/src/search.c b/src/search.c
index 3c37242..410d7ba 100644
--- a/src/search.c
+++ b/src/search.c
@@ -462,5 +462,5 @@ init_guile_search_procedures (void)
 		"isearch-forward-regexp",
 		"isearch-backward-regexp",
 		"query-replace",
-		0);
+		NULL);
 }
diff --git a/src/undo.c b/src/undo.c
index 82a9d65..91bd77c 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -159,5 +159,5 @@ init_guile_undo_procedures (void)
 {
 #include "undo.x"
   scm_c_export ("undo",
-		0);
+		NULL);
 }
diff --git a/src/variables.c b/src/variables.c
index 799697e..add0c4c 100644
--- a/src/variables.c
+++ b/src/variables.c
@@ -324,6 +324,6 @@ init_guile_variables_procedures (void)
 {
 #include "variables.x"
   scm_c_export ("set-variable",
-		0);
+		NULL);
   scm_c_define ("setq", scm_c_lookup ("define"));
 }
-- 
1.7.6


  parent reply	other threads:[~2012-02-13 14:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-13  0:51 Anniversary hack: Zile editor with Guile support Mike Gran
2012-02-13 14:25 ` Bernardo Ezequiel Contreras
2012-02-13 15:37   ` Mike Gran
2012-02-13 22:40     ` Ludovic Courtès
2012-02-13 14:27 ` Ludovic Courtès [this message]
2012-02-14  5:46   ` Mike Gran
     [not found] <CAOnWdoggx6YWV_VUuYcdosvsXFwYXzua57NaUTa7ZT3RiUtvOA@mail.gmail.com>
     [not found] ` <4CB5C160-9728-4784-ABA1-E8BDFC825990@vaughan.pe>
2013-03-22  1:13   ` Gary V. Vaughan
2013-03-22  2:43     ` Mike Gran
2013-03-22  3:10       ` Gary V. Vaughan
2013-03-25  2:13         ` Ian Price
2013-03-25  2:21           ` Gary V. Vaughan
2013-03-25  4:10             ` Ian Price
2013-03-25  4:22               ` Gary V. Vaughan
2013-03-25  6:24                 ` Ian Price
2013-03-25  7:06                   ` Gary V. Vaughan
2013-03-25  2:52           ` Nala Ginrut
2013-03-22 11:05     ` Ludovic Courtès
2013-03-23  1:32       ` Nala Ginrut

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.gnu.org/software/guile/

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

  git send-email \
    --in-reply-to=87ehtylseq.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guile-user@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.
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).