Skip to content

Instantly share code, notes, and snippets.

;; -*- xyzzy -*-
#|
グローバルキーマップで[C-x RET]をプレフィックスキーに、その後
ローカルキーマップで[C-x RET]にコマンドを定義するとdescribe-keyなどの
キーシーケンス読み込み時に最長一致のグローバルマップを(この例では)選んでしまう。
※実際のコマンドでは最短一致のキーコマンドを呼び出すらしい
そのため、最短一致のキーを返すように修正する。
【例】
@southly
southly / gist:559318
Created August 31, 2010 16:41
#xyzzy のバイトコード
1 constant 引数をひとつとって、該当する定数リストをスタックにプッシュ
2 global_set スタックのトップをグローバル変数に設定
3 global_ref グローバル変数を参照し、スタックにプッシュ
4 lexical_set スタックのトップをレキシカル変数に設定
5 lexical_ref レキシカル変数を参照し、スタックにプッシュ
8 local_set スタックのトップをローカル変数に設定
9 local_ref ローカル変数を参照し、スタックにプッシュ
10 make_closure 引数をひとつとってクロージャを作成し、スタックにプッシュ
11 discard スタックからポップし、値を破棄
12 goto 引数をひとつとって、goto
@miyamuko
miyamuko / gist:566528
Created September 6, 2010 01:53
save-window-excursion は多値を返さない。
;; save-window-excursion は多値を返さない。 #xyzzy
(save-window-excursion
(values 1 2 3))
;=> 1
(save-excursion
(values 1 2 3))
;=> 1
; 2
@miyamuko
miyamuko / gist:589523
Created September 21, 2010 10:45
コマンドを実行することで変更される環境変数を取得する #xyzzy
;; detect-environment-changes
;; 指定したコマンド実行後に変更された環境変数を取得する
;;
;; environment
;; 現在のプロセスの環境変数を取得する
;;
;; system
;; 指定したコマンドを実行し、実行結果と実行後の環境変数を取得する
(defconstant +boundary+ "--- pik --- pik --- pik --- pik ---")
@youz
youz / debug-print.lisp
Created October 3, 2010 14:20
Gauche's debug-print macro for CL
;;; ref. http://practical-scheme.net/gauche/man/gauche-refj_16.html#SEC18
(defmacro debug-print (form)
`(progn
(format t "#?=~S~%" ',form)
(let ((#1=#:values (multiple-value-list ,form)))
(format t "#?- ~{~S~%~^#?+ ~}" #1#)
(values-list #1#))))
(set-dispatch-macro-character #\# #\?
@southly
southly / gist:716591
Created November 26, 2010 11:34
fix flet, labels, macrolet. #xyzzy
diff --git a/src/cons.h b/src/cons.h
index 82961bd..aeb9c86 100644
--- a/src/cons.h
+++ b/src/cons.h
@@ -10,6 +10,7 @@ public:
};
# define consp(X) typep ((X), Tcons)
+# define listp(X) ((X) == Qnil || consp (X))
@faerie
faerie / encoding.l
Created May 12, 2011 02:34
xyzzy lisp/encoding.l: rename utf8 to utf8-bom and utf8n to utf8.
;;; -*- Mode: Lisp; Package: EDITOR -*-
;;;
;;; This file is part of xyzzy.
;;;
(provide "abbrev")
(in-package "editor")
(export '(*encoding-iso-8bit-jp* *encoding-iso-8bit-jp-open*
@hidsh
hidsh / py-mode.l
Created February 28, 2012 00:52
xyzzy py-mode mod
;;; -*- Mode: Lisp; Last updated: "2007/04/07" -*-
;;;
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.