[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anniversary hack: Zile editor with Guile support
From: |
Ludovic Courtès |
Subject: |
Re: Anniversary hack: Zile editor with Guile support |
Date: |
Mon, 13 Feb 2012 15:27:57 +0100 |
User-agent: |
Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux) |
Hi Mike!
Mike Gran <address@hidden> 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:
--- /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);
}
... then looked at the difference in the generated assembly:
--- /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)
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’.
>From 027fd77b3caa63137ee01a40cf27ef8911cbdded Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= <address@hidden>
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