Skip to content

Instantly share code, notes, and snippets.

@gongo
Created September 13, 2012 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gongo/3710951 to your computer and use it in GitHub Desktop.
Save gongo/3710951 to your computer and use it in GitHub Desktop.
byte-compile-file 中に山田を踊らせようとしたが、踊ってくれない
(defun yamada-compile-file (filename &optional load)
(interactive
(let ((file buffer-file-name)
(file-name nil)
(file-dir nil))
(and file
(derived-mode-p 'emacs-lisp-mode)
(setq file-name (file-name-nondirectory file)
file-dir (file-name-directory file)))
(list (read-file-name (if current-prefix-arg
"Byte compile and load file: "
"Byte compile file: ")
file-dir file-name nil)
current-prefix-arg)))
(lexical-let
((bytecomp-finish? nil)
(filename filename)
(load load))
(deferred:$
(deferred:parallel
(deferred:lambda ()
(yamada-show) ;; dancing yamada
(when (not bytecomp-finish?)
(deferred:next self))))
(deferred:$
(deferred:next
(lambda (x) (byte-compile-file filename load)))
(deferred:nextc it
(lambda (x) (setq bytecomp-finish? t) nil)))
(deferred:nextc it
(lambda (results) (message "finish"))))))
;; (deferred:next
;; (lambda (x) (byte-compile-file filename load)))
;;
;; で emacs が気合い入る所為か、(yamada-show) が動かない(静止状態)
@gongo
Copy link
Author

gongo commented Sep 13, 2012

(yamada-show) の部分を (message "aaa") にして、js2-mode に対して実行すると

aaa
Compiling /home/gongo/js2-20090723b.el... (js2-get-msg)
aaa
Compiling /home/gongo/js2-20090723b.el... (js2-node-string)
aaa
Compiling /home/gongo/js2-20090723b.el... (js2-treeify)
aaa [2 times]
Compiling /home/gongo/js2-20090723b.el... (js2-parse)
aaa [2 times]
Compiling /home/gongo/js2-20090723b.el... (js2-mode-toggle-warnings-and-errors)
aaa
Compiling /home/gongo/js2-20090723b.el...done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment