This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; find-file で環境変数込みのパスを開けるようにする | |
| ;; (find-file "%SystemRoot%/system32/drivers/etc/hosts") | |
| (defun find-file-expand-env-hook (filename) | |
| (when (and filename | |
| (not (file-exist-p filename))) | |
| (let ((replaced nil)) | |
| (while (string-matchp "%\\([a-z]+\\)%" filename) | |
| (setf filename (substitute-string filename (match-string 0) | |
| (map-backslash-to-slash (si:getenv (match-string 1)))) | |
| replaced t)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 全パッケージから apropos | |
| (defun apropos-all (string) | |
| (interactive "sApropos(Regexp): ") | |
| (with-output-to-temp-buffer ("*Help2*") | |
| ;; undo はできるようにする | |
| (setq kept-undo-information (default-value 'kept-undo-information)) | |
| (lisp-interaction-mode) | |
| (save-excursion | |
| (dolist (pkg (reverse (list-all-packages))) | |
| (dolist (line (apropos-filter string pkg)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; package に対応したタグジャンプ | |
| ;; 標準のだと (ed::find-file-internal) などでタグジャンプしても飛べない | |
| (defun lisp-tags-find-target-with-package () | |
| (multiple-value-bind (class name functionp) | |
| (ed::lisp-tags-find-target) | |
| (values class (substitute-string name "^[a-z]+::?" "") functionp))) | |
| (defun install-lisp-tags-find-target-with-package () | |
| (setf tags-find-target #'lisp-tags-find-target-with-package)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; クリップボードの中身を eval | |
| (defun eval-clipboard () | |
| (interactive) | |
| (let ((buf (get-buffer-create "*Clipboard*"))) | |
| (set-buffer buf) | |
| (erase-buffer buf) | |
| (setup-temp-buffer buf) | |
| (insert (get-clipboard-data)) | |
| (handler-case | |
| (progn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; ソースコードで利用している特定のパッケージのシンボルの一覧を表示する。 | |
| ;; | |
| ;; 例) | |
| ;; xl-github が利用している editor パッケージの何かの一覧を表示 | |
| ;; (show-inherited-symbols-dir "site-lisp/github" :editor) | |
| (defun show-inherited-symbols-file (file inherited-from) | |
| (interactive "fFile: \nSPackage: ") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; xyzzy 0.2.2.235 | |
| (require "cmu_loop") | |
| (loop | |
| for i from 0 to 2 | |
| while (progn | |
| (format t "while ~A~%" i) | |
| t) | |
| do (format t "do ~A~%" i)) | |
| do 0 | |
| while 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; 異なるパッケージで関数やマクロを上書きしたら *Trace Output* に警告を出す | |
| ;; #xyzzy | |
| (defmacro with-package-lock (handler &body body) | |
| `(let ((si-fset #'si:*fset)) | |
| (funcall si-fset 'si:*fset | |
| #'(lambda (symbol function) | |
| (when (and (fboundp symbol) | |
| (not (eql (symbol-package symbol) *package*))) | |
| (,handler "~A::~A redefined with ~A::~A." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; xyzzy ではてな ID や Twitter のユーザ名をクリックできるようにする clickable-uri の設定 | |
| ;; | |
| ;; * clickable-uri | |
| ;; http://ohkubo.s53.xrea.com/xyzzy/index.html#clickable-uri | |
| ;; | |
| ;; * clickable-uriを導入しよう | |
| ;; http://xyzzy.s53.xrea.com/wiki/index.php?QuickTour/ext/clickable-uri#t8450eec | |
| (defun clickable-uri-add-special (prefix id uri-format) | |
| (let ((id-regexp (format nil "~A~A" prefix id)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (in-package :winapi) | |
| ;; http://msdn.microsoft.com/en-us/library/ms648381(VS.85).aspx | |
| ;; packing-align を調整しないと size-of CURSORINFO が 24 になる | |
| (let ((c:*c-structure-packing-align* 4)) | |
| (c:*define-c-struct CURSORINFO | |
| (DWORD size) | |
| (DWORD flags) | |
| (HANDLE handle) | |
| (POINT pos))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; クリップボードエンコーディングを自動判別 #xyzzy | |
| ;; get-clipboard-data を上書きしているのでちょっとキケン | |
| (defvar *get-clipboard-data* #'get-clipboard-data) | |
| (defun get-clipboard-data () | |
| (let ((*clipboard-char-encoding* *encoding-sjis*)) | |
| (declare (special *clipboard-char-encoding*)) | |
| (let* ((str (funcall *get-clipboard-data*)) | |
| (enc (detect-char-encoding str))) |