WEB+DB PRESS Vol.58ã®æªåé²å
容ãã®2ã§ãã第2ç« ã®ã³ã©ã ãããã¯ã«ã¤ãã¦ã㧠after-save-hook ã®ä½¿ãæ¹ã®ä¾ã§å·çãã¾ãããhook ãè¦ãã¦ãshell-command ãè¦ãããã¨ããå人çã«ã¯ä¸ç³äºé³¥ã®ãµã³ãã«ã§ããã
ãã¨ãã°ãMacã«Growlã¨ããéç¥ã½ãããããã¾ãããããã±ã¼ã¸ã«å梱ããã¦ãã growlnotify ã¨ããã³ãã³ãã©ã¤ã³ãã¼ã«ãã¤ã³ã¹ãã¼ã«ããã¨ãã·ã§ã«ãã Growl ãå©ç¨ã§ããããã«ãªãã¾ãã
ãããå©ç¨ãã¦Emacsã§ãããã¡ãä¿åããã¨ãã«Growlã«ããéç¥ãè¡ãããã«ãã¦ã¿ã¾ãããããã®å ´åããããã¡ãä¿åããã¿ã¤ãã³ã°ã§é¢æ°ãå®è¡ãã¦ãããafter-save-hookãå©ç¨ãã¾ãã
;; growlnotifyã³ãã³ããåå¨ããå ´åã®ã¿ããã¯ã追å ;; growl ã«éç¥ããããã®é¢æ°ãå®ç¾© (when (executable-find "growlnotify") (defun growlnotify-after-save-hook () (shell-command (format "growlnotify -a \"Emacs\" -t \"ãããã¡ãä¿å\" -m \"%s\"" (buffer-name (current-buffer))))) ;; é¢æ°ãafter-save-hookã«è¿½å ãã (add-hook 'after-save-hook 'growlnotify-after-save-hook))
ãã®è¨å®ãinit.elã«å ãã¦åèµ·åããã¨ãä»å¾ãããã¡ãä¿åãããã³ã«Growlã«ãã£ã¦éç¥ãããããã«ãªãã¾ãã
ã³ãã³ãã®è§£èª¬ã
growlnotity ã¯ã以ä¸ã®ãããªå¼æ°ã§ã³ãã³ããå®è¡ãããã¨ã§ãä»»æã®éç¥ãè¡ãªããã¨ãã§ãã¾ãããªãã-a ã -t ã -m ãçç¥å¯è½ã§ãã
$ growlnotify -a "ã¢ã¤ã³ã³ãåå¾ãããã¢ããª" -t "ã¿ã¤ãã«ããã¹ã" -m "ã¡ãã»ã¼ã¸ããã¹ã"
Emacs ã§ã¯ shell-command é¢æ°ã使ããã¨ã§ãã·ã§ã«ã«ã³ãã³ãã渡ããã¨ãåºæ¥ã¾ããä¸è¨ã®ãµã³ãã«ã§ã¯ãã¡ãã»ã¼ã¸ã«ãããã¡åã使ãããã®ã§ãformat é¢æ°ãå©ç¨ãã¦ã³ãã³ãã¨ãªãæååãæ´å½¢ãã¦ãããshell ã«ã³ãã³ãã渡ãã¦ãã¾ãã
åã« Emacs ãã Growl ã«ããéç¥ããã¹ããã¦ã¿ãã人ã¯ãä¾ãã°ãEmacs 㧠"C-x C-e" ã使ã£ã¦ä»¥ä¸ã®å¼ãè©ä¾¡ãã¦ã¿ã¾ãããã
(shell-command (format "growlnotify -a \"Emacs\" -t \"ãããã¡ãä¿å\" -m \"%s\"" (buffer-name (current-buffer)))) ; âããã§è©ä¾¡ãã
ãªããããã«ã¯ãªã¼ãå
ã§ããã«ã¯ãªã¼ãã使ãã«ã¯ããã¯ã¹ã©ãã·ã¥ã§ã¨ã¹ã±ã¼ãããå¿
è¦ãããã¾ãã(buffer-name (current-buffer)) ã¯ã«ã¬ã³ããããã¡ã®ååãåå¾ãã¾ãã
ã¨ããããã§ãããã¯ä¸è¨ã®ã³ãã³ãã¨åæã§ãã
$ growlnotify -a "Emacs" -t "ãããã¡ãä¿å" -m "ãããã¡å"
growl.el ã使ã£ã¦ããã£ã¨ç°¡åã« Growl ãå©ç¨ããã
elim ãããå ¬éãã¦ããã¦ãã growl.elãå©ç¨ããã¨ãç°¡åã« Growl ã«ããéç¥ãè¡ãªãã¾ãã
;; (install-elisp "http://github.com/elim/emacs-growl/raw/master/growl.el") (require 'growl nil t)
ã¤ã³ã¹ãã¼ã«ã㦠require ããã¨ã(growl "Hello World.") ã¨ããæãã§ãgrowl é¢æ°ã«æååã渡ãã ãã§ãGrowl ã®éç¥ãå©ç¨ãããã¨ãã§ãã¾ãã