xyzzy 弄った記録メモ。

メモ帳が使えない(UTF-8が無条件にBOM付きになるから)からxyzzyを使っていたが内部コードがunicodeのエディタが見つかった。
真魚[まな]

.siteinit.l を byte-compile するのが面倒。また、.siteinit.l を下手に弄ると動かなくなる。
.xyzzyから.xyzzy.lをロードする。( .xyzzyに大量のLispコードを記述する場合には、.xyzzy.lという別の名前のファイルへ内容をコピーして、それをバイトコンパイルし、.xyzzyではloadでバイトコンパイル済みファイル(.xyzzy.lc)をロードする。)

.xyzzy

(defvar *init-file-name* (merge-pathnames ".xyzzy.l" (user-homedir-pathname)))
;; コンパイル済みファイルがあれば、それを対象とする。
(if (file-exist-p (concat *init-file-name* "c"))
    (setq *init-file-name* (concat *init-file-name* "c")))
;; Lispファイルのロード
(if (file-exist-p *init-file-name*)
    (load *init-file-name*)
  ;; .xyzzy.lファイルが無い場合は、デフォルトの初期化ファイルを利用する。
  ;; 但し、user-homedir-pathname と si:system-root が異なる場合のみ。
  (unless (equalp (user-homedir-pathname) (si:system-root))
    (load (merge-pathnames ".xyzzy" (si:system-root)))))

.xyzzy.l
多量に書いたらbyte-compile

; ----------------------------------------------------------------
; .xyzzy.l for Limited User
; Last-Modified: 
; ----------------------------------------------------------------
(setq-default title-bar-format "%b %#*(%M) [%k:%l] - %p %v%#h")
(setq-default mode-line-format "[%i] --%*- %b (%M) [%k:%l] %P %f")
(setq *status-bar-format* "cupT")
; ----------------------------------------------------------------
; ホームディレクトリにあるsite-lispというサブディレクトリもライブラリをロードする際の検索対象とする。
  (setq *load-path*
        (cons (merge-pathnames "site-lisp" (user-homedir-pathname))
              *load-path*))
; ----------------------------------------------------------
;  xyzzy-0.2.2.235以降はいらない。
(require "calendarex") 
; ----------------------------------------------------------------
; デフォルトパスの指定
(set-default-directory "~/")
; 特定フォルダに全てのバックアップファイルを作成する。
(require "backup")
(setq *backup-directory* "C:/Users/username/Documents/xyzzy/backup/")
(setq *hierarchic-backup-directory* nil)
; ----------------------------------------------------------------
; デフォルトの文字コードと改行コードを指定
(setq *default-fileio-encoding* *encoding-utf8n*) 
(setq *default-eol-code* *eol-lf*)
; Clipboard-EncodingをUTF8nに設定
(setq-default *clipboard-char-encoding* *encoding-utf8n*)
; ----------------------------------------------------------------
; インクリメンタルサーチ
(require "isearch")
; ----------------------------------------------------------------
(require "shell3")
(require "shell-alt")
; ----------------------------------------------------------------
; complete+ 
(require "session-ext")

(require "complete+")    ; ni-autoloadしている人は不要
(use-package "complete+"); ni-autoloadしている人は不要
(dolist (keymap (list minibuffer-local-completion-map
                      minibuffer-local-must-match-map))
  (define-key keymap '#\C-n 'complete+-select-next-item)       ; 次の候補
  (define-key keymap '#\C-p 'complete+-select-prev-item)       ; 前の候補
  (define-key keymap '#\C-< 'complete+-substring-match-rotate) ; 部分一致
  (define-key keymap '#\C-> 'complete+-skip-match-rotate)      ; スキップマッチ
  (define-key keymap '#\C-. 'complete+-toggle-incremental))    ; インクリメンタル
(setf *complete+-and-search* ";") ;AND検索
(setf *complete+-show-drive* t)   ;ドライブを表示
(setf *complete+-current-item-attribute* '(:foreground 1)) ; *Completion*バッファ
(setf *complete+-highlight-color*        '(:foreground 2)) ; ハイライト
(complete+-toggle-incremental t) ;最初からインクリメンタルに補完候補を表示
; ----------------------------------------------------------------
; auto-time-stamp
(require "auto-time-stamp")
; マッチさせる行頭の文字列に変更
(setq ed::*time-stamp-start* " Last-Modified: ")
; マッチさせる行末の文字列に変更(行末に何も無い場合には変更せずで)
(setq ed::*time-stamp-end* "$")
; 上から何行目までをauto-time-stampの挿入範囲にするか
(setq ed::*time-stamp-line-limit* 10)
; 入れる日付のフォーマット(詳しくは$XYZZY/lisp/timestmpに)
(setq ed::*time-stamp-format* "%a, %d %b %Y %H:%M:%S %Z")
; 保存時にタイムスタンプを更新
(require "auto-time-stamp")
(add-hook
 '*before-save-buffer-hook*
 #'(lambda ()
     (interactive)
     (and *time-stamp-active*
         (ed::time-stamp)) nil))
; ----------------------------------------------------------------
(require "grepd")
;;Grepをしたときに特定のディレクトは無視する 
(defvar *ignore-scan-dirs* (list "dic" ".svn" )) 
;;対象外にするフォルダ 
(defvar *org-scan-files-1* (function ed::scan-files-1)) 
;; 元の関数 
(defun ed::scan-files-1 (sFile pattern buffer scanner) (let (bSkip) (dolist (sDir *ignore-scan-dirs*) (setq sDir (append-trail-slash sDir)) (setq iPos (string-match sDir sFile)) (when iPos (setq bSkip t) (return))) (unless bSkip (funcall *org-scan-files-1* sFile pattern buffer scanner))))
; ----------------------------------------------------------------
; Html
(setq ed::*html+-use-html-kwd* t)

;; 一発インデント
      (defun indent-current-buffer ()
      (interactive)
      (indent-region (point-min) (point-max))
      (message "indent buffer"))
      (global-set-key #\C-F8 'indent-current-buffer)

;html+-mode拡張用
(in-package "editor")
(export 'html+-mode)
(autoload 'html+-mode "html+-mode" t)
(pushnew '("\\.s?html?$" . html+-mode) *auto-mode-alist* :test 'equal)
; ----------------------------------------------------------------