Skip to content

Instantly share code, notes, and snippets.

;;; .xyzzy の最後にでも書いておけば ~/*.l を全部読み込む
(dolist (file (directory "~/" :wild "*.l"))
(load-file (merge-pathnames file "~/")))
;;; 文字コード指定を -*- coding: hoge -*- でもできるように
;;; .xyzzy にでも; 組み込み関数上書き注意報
(defun ed::find-file-auto-encoding (filename)
(unwind-protect
(let ((encoding
(progn
(ignore-errors (insert-file-contents filename t nil 4096))
(goto-char (point-min))
(dolist (x *auto-encoding-alist* nil)
--- info-modoki-mode.l 2010-05-22 04:11:28.921875000 +0900
+++ info-modoki-mode.l~ 2010-05-22 03:44:55.406250000 +0900
@@ -227,6 +227,7 @@
(defvar *imm-history-pointer* nil)
(defvar *imm-menu* nil)
+(defparameter *imm-window* nil)
;;; ──────────────────────────────────── ;;;
;;; ■ リファレンス参照
;;; -*- mode: lisp; package: editor -*-
;;;
;;; turnaround.l
(in-package :editor)
(export '(turnaround
turnaround-or-select-word
turnaround-or-self-insert))
;;; restart-case の再起動部分を handler-case 風にする calc-lisp-indent
(in-package :editor)
(setf (get 'handler-case 'lisp-indent-handler-macro)
(lambda (sym)
(or (subtypep sym 'condition) (consp sym)))
(get 'restart-case 'lisp-indent-handler-macro)
(lambda (sym) t))
(defun ed::calc-lisp-indent (opoint)
(require "condition-restart")
(in-package :lisp)
;;;
;;; * Condition Definitions
(define-condition library-condition (condition)
(name source-pathname compiled-pathname)
;;; setf'able な PLACE を一時的に変更して BODY を評価する
(defmacro letf (bindings &body body)
(let ((originals (mapcar (lambda (x) (gensym)) bindings)))
`(let (,@(mapcar (lambda (sym x) `(,sym ,(car x)))
originals
bindings))
(unwind-protect
(progn
(setf ,@(mapcan #'identity bindings))
,@body)
;;; struct の slot に obj.slot でアクセスする。
(require "struct")
(require "symbol-macrolet")
(defun keyword (name)
(intern (string name) :keyword))
(defun %slot-value (object slot-name)
(si:*slot-value object slot-name))
@bowbow99
bowbow99 / gist:512148
Created August 6, 2010 22:44
symbol が被ってたら、再起動で unintern とか shadow できる use-package
;;; symbol が被ってたら、再起動で unintern とか shadow できる use-package
(defun %use-package-w/restart (used &optional (using *package*))
(tagbody
#1=#:begin
(handler-bind
((simple-package-error
(lambda (e)
(let ((symbol (simple-package-error-datum2 e)))
(restart-case
@bowbow99
bowbow99 / gist:602564
Created September 29, 2010 11:12
一番左下の window を探す #xyzzy
(in-package :editor)
(defun find-most-left/bottom-window (&optional (start (selected-window)))
(if (= (count-windows) 1)
(selected-window)
(do* ((win (next-window start) (next-window win))
(coord (window-coordinate win) (window-coordinate win))
(most (cons start (window-coordinate start))))
((eql win start)
(car most))