Skip to content

Instantly share code, notes, and snippets.

@miyamuko
Created July 12, 2010 13:45
Show Gist options
  • Save miyamuko/472474 to your computer and use it in GitHub Desktop.
Save miyamuko/472474 to your computer and use it in GitHub Desktop.
;; -*- mode: lisp-interaction-mode: package: hoge -*- ってファイルの先頭に書いておくと
;; hoge パッケージ内で評価する
(defun eval-print-last-sexp/buffer-package ()
(interactive "*")
(let* ((current-package
(or (save-excursion
(when (scan-buffer "^[ \t]*(in-package[ \t\n]+[:'\"]\\([^\")]+\\)"
:regexp t :reverse t)
(match-string 1)))
*buffer-package*
*package*))
(*package* (lisp::coerce-to-package current-package)))
(minibuffer-message "eval in package: ~A" (package-name *package*))
(message "eval in package: ~A" (package-name *package*))
(eval-print-last-sexp)))
(define-key ed::*lisp-interaction-mode-map* #\LFD 'eval-print-last-sexp/buffer-package)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment