From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.user Subject: Re: Anniversary hack: Zile editor with Guile support Date: Mon, 13 Feb 2012 15:27:57 +0100 Message-ID: <87ehtylseq.fsf@gnu.org> References: <1329094293.53143.YahooMailNeo@web37901.mail.mud.yahoo.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1329162021 26602 80.91.229.3 (13 Feb 2012 19:40:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Feb 2012 19:40:21 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon Feb 13 20:40:21 2012 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Rx1l6-0007FI-7s for guile-user@m.gmane.org; Mon, 13 Feb 2012 20:40:20 +0100 Original-Received: from localhost ([::1]:55771 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rx1l5-0004jl-Kl for guile-user@m.gmane.org; Mon, 13 Feb 2012 14:40:19 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:54710) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwwtA-0006m4-31 for guile-user@gnu.org; Mon, 13 Feb 2012 09:28:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rwwt2-0001KQ-U7 for guile-user@gnu.org; Mon, 13 Feb 2012 09:28:20 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:44746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rwwt2-0001Jt-I1 for guile-user@gnu.org; Mon, 13 Feb 2012 09:28:12 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rwwsz-0002yx-Uf for guile-user@gnu.org; Mon, 13 Feb 2012 15:28:09 +0100 Original-Received: from reverse-83.fdn.fr ([80.67.176.83]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Feb 2012 15:28:09 +0100 Original-Received: from ludo by reverse-83.fdn.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 13 Feb 2012 15:28:09 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 317 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: reverse-83.fdn.fr X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 =?iso-8859-1?Q?Pluvi=F4se?= an 220 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:0pOTB5KuixZgYIH4GDzyHiViv2E= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-Mailman-Approved-At: Mon, 13 Feb 2012 14:40:04 -0500 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9269 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Mike! Mike Gran 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: --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- /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); } --=-=-= Content-Type: text/plain ... then looked at the difference in the generated assembly: --=-=-= Content-Type: text/x-patch Content-Disposition: inline --- /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) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 is pressed. Works for me, neaaat! :-) Thanks, Ludo’. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Use-NULL-as-the-sentinel-of-scm_c_export.patch Content-Description: the patch >From 027fd77b3caa63137ee01a40cf27ef8911cbdded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= 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 --=-=-=--