Next: , Previous: Overlay Arrow, Up: Display   [Contents][Index]


38.7 °ì»þŪ¤Êɽ¼¨

°ì»þŪ¤Êɽ¼¨¤Ï¡¢ ½ÐÎϤò¥Ð¥Ã¥Õ¥¡¤ËÃÖ¤­ÊÔ½¸ÌÜŪ¤Ë¤Ç¤Ï¤Ê¤¯ ¥æ¡¼¥¶¡¼¤ËÆÉ¤à¤è¤¦¤ËÄ󼨤¹¤ë¤¿¤á¤Ë Lisp¥×¥í¥°¥é¥à¤¬»È¤¤¤Þ¤¹¡£

Special Form: with-output-to-temp-buffer buffer-name forms…

¤³¤Î´Ø¿ô¤Ï¡¢buffer-name¤È¤¤¤¦Ì¾Á°¤Î¥Ð¥Ã¥Õ¥¡¤Ë forms¤ÎǤ°Õ¤Î½ÐÎϤ¬ÁÞÆþ¤µ¤ì¤ë¤è¤¦¤Ë½àÈ÷¤·¤Æ forms¤ò¼Â¹Ô¤¹¤ë¡£ ¤½¤Î¥Ð¥Ã¥Õ¥¡¤ÏŬÅö¤Ê¥¦¥£¥ó¥É¥¦¤Ëɽ¼¨¤µ¤ì¤ë¤¬¡¢ ¤½¤Î¥Ð¥Ã¥Õ¥¡¤ÏÁªÂò¤µ¤ì¤Ê¤¤¡£

ʸ»úÎóbuffer-name¤Ï¡¢´û¸¤Ç¤¢¤ëɬÍפϤʤ¤°ì»þŪ¤Ê¥Ð¥Ã¥Õ¥¡¤ò»ØÄꤹ¤ë¡£ °ú¿ô¤Ï¡¢¥Ð¥Ã¥Õ¥¡¤Ç¤Ï¤Ê¤¯Ê¸»úÎó¤Ç¤¢¤ë¤³¤È¡£ ¡ÊÌ䤤¹ç¤ï¤»¤º¤Ë¡Ë¤Ï¤¸¤á¤Ë¥Ð¥Ã¥Õ¥¡¤ò¾Ãµî¤·¡¢ with-output-to-temp-buffer¤¬½ªÎ»¤¹¤ë¤È̤Êѹ¹¤È°õ¤òÉÕ¤±¤ë¡£

with-output-to-temp-buffer¤Ï¡¢ standard-output¤Ë°ì»þŪ¤Ê¥Ð¥Ã¥Õ¥¡¤ò«Çû¤·¡¢ forms¤Î¥Õ¥©¡¼¥à·²¤òɾ²Á¤¹¤ë¡£ formsÆâ¤ÇÍѤ¤¤¿Lisp½ÐÎÏ´Ø¿ô¤«¤é¤Î½ÐÎÏ¤Ï ¥Ç¥Õ¥©¥ë¥È¤Ç¤½¤Î¥Ð¥Ã¥Õ¥¡¤ËÆþ¤ë ¡Ê¤·¤«¤·¡¢¥¹¥¯¥ê¡¼¥óɽ¼¨¤ä¥¨¥³¡¼Îΰè¤Î¥á¥Ã¥»¡¼¥¸¤Ï¡¢ ÍѸì¤Î°ìÈÌŪ¤Ê°ÕÌ£¤Ç¡Ø½ÐÎϡ٤Ǥ¢¤ë¤¬¡¢ ±Æ¶Á¤µ¤ì¤Ê¤¤¡£¡Ë see Output Functions¡£

forms¤ÎºÇ¸å¤Î¥Õ¥©¡¼¥à¤ÎÃͤòÊÖ¤¹¡£

---------- Buffer: foo ----------
 This is the contents of foo.
---------- Buffer: foo ----------
(with-output-to-temp-buffer "foo"
    (print 20)
    (print standard-output))
⇒ #<buffer foo>

---------- Buffer: foo ----------
20

#<buffer foo>

---------- Buffer: foo ----------
Variable: temp-buffer-show-function

¤³¤ÎÊÑ¿ô¤¬nil°Ê³°¤Ç¤¢¤ë¤È¡¢ ¥Ø¥ë¥×¥Ð¥Ã¥Õ¥¡¤òɽ¼¨¤¹¤ë¤¿¤á¤Ë with-output-to-temp-buffer¤¬¤³¤ÎÃͤò´Ø¿ô¤È¤·¤Æ¸Æ¤Ó½Ð¤¹¡£ ´Ø¿ô¤Ï1¤Ä¤Î°ú¿ô¡¢¤Ä¤Þ¤ê¡¢É½¼¨¤¹¤Ù¤­¥Ð¥Ã¥Õ¥¡¤ò¼õ¤±¼è¤ë¡£

¤³¤Î´Ø¿ô¤Ç¤Ï¡¢ save-window-excursion¤ò»È¤¤¥¦¥£¥ó¥É¥¦¤È¥Ð¥Ã¥Õ¥¡¤òÁªÂò¤·¤¿Æâ¦¤Ç¡¢ with-output-to-temp-buffer¤¬ÉáÄ̤˹Ԥ¦¤è¤¦¤Ë temp-buffer-show-hook¤ò¸Æ¤Ó½Ð¤¹¤Î¤¬¤è¤¤¡£

Variable: temp-buffer-show-hook

¤³¤Î¥Î¡¼¥Þ¥ë¥Õ¥Ã¥¯¤Ï¡¢¥Ø¥ë¥×¥Ð¥Ã¥Õ¥¡¤òɽ¼¨¸å¤Ë with-output-to-temp-buffer¤¬¼Â¹Ô¤¹¤ë¡£ ¥Õ¥Ã¥¯¤ò¼Â¹Ô¤¹¤ë¤È¤­¤Ë¤Ï¡¢ ¥Ø¥ë¥×¥Ð¥Ã¥Õ¥¡¤¬¥«¥ì¥ó¥È¥Ð¥Ã¥Õ¥¡¤Ç¤¢¤ê¡¢ ¤½¤ì¤òɽ¼¨¤·¤Æ¤¤¤ë¥¦¥£¥ó¥É¥¦¤¬ÁªÂò¤µ¤ì¤Æ¤¤¤ë¥¦¥£¥ó¥É¥¦¤Ç¤¢¤ë¡£

Function: momentary-string-display string position &optional char message

¤³¤Î´Ø¿ô¤Ï¡¢¥«¥ì¥ó¥È¥Ð¥Ã¥Õ¥¡Æâ¤Î°ÌÃÖposition¤Ë ʸ»úÎóstring¤ò½Ö´ÖŪ¤Ëɽ¼¨¤¹¤ë¡£ ¥¢¥ó¥É¥¥¥ê¥¹¥È¤ä¥Ð¥Ã¥Õ¥¡¤ÎÊѹ¹¾õÂ֤ˤϱƶÁ¤·¤Ê¤¤¡£

½Ö´ÖŪ¤Êɽ¼¨¤Ï¡¢¤Ä¤®¤ÎÆþÎÏ¥¤¥Ù¥ó¥È¤Þ¤Ç»ý³¤¹¤ë¡£ ¤Ä¤®¤ÎÆþÎÏ¥¤¥Ù¥ó¥È¤¬char¤Ç¤¢¤ë¤È¡¢ momentary-string-display¤Ï¤½¤ì¤ò̵»ë¤·¤ÆÌá¤ë¡£ ¤µ¤â¤Ê¤±¤ì¤Ð¡¢¤½¤Î¥¤¥Ù¥ó¥È¤ÏÆþÎϤȤ·¤Æ»È¤ï¤ì¤ë¤è¤¦¤ËÊݸ¤µ¤ì¤ë¡£ ¤·¤¿¤¬¤Ã¤Æ¡¢char¤òÂǤĤÈʸ»úÎó¤Îɽ¼¨¤¬Ã±¤Ë¾Ã¤¨¤ë¤À¤±¤Ç¤¢¤ë¤¬¡¢ ¡Ê¤¿¤È¤¨¤Ð¡ËC-f¤òÂǤĤÈʸ»úÎó¤Îɽ¼¨¤¬¾Ã¤¨¤ë¤À¤±¤Ç¤Ê¤¯ ¡Ê¤¿¤Ö¤ó¡Ë¥Ý¥¤¥ó¥È¤ò¿Ê¤á¤ë¤³¤È¤Ë¤Ê¤ë¡£ °ú¿ôchar¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¶õÇò¤Ç¤¢¤ë¡£

momentary-string-display¤ÎÌá¤êÃͤ˰ÕÌ£¤Ï¤Ê¤¤¡£

ʸ»úÎóstring¤Ë¥³¥ó¥È¥í¡¼¥ëʸ»ú¤¬´Þ¤Þ¤ì¤Ê¤±¤ì¤Ð¡¢ °À­before-string¤Î¥ª¡¼¥Ð¥ì¥¤¤òºîÀ®¡Ê¤Î¤Á¤Ëºï½ü¡Ë¤¹¤ë¤³¤È¤Ç ¤è¤ê°ìÈÌŪ¤ÊÊýË¡¤ÇƱ¤¸¤³¤È¤ò¹Ô¤¨¤ë¡£ see Overlay Properties¡£

message¤¬nil°Ê³°¤Ç¤¢¤ë¤È¡¢ string¤ò¥Ð¥Ã¥Õ¥¡¤Ëɽ¼¨Ãæ¤Ë¤Ï¡¢ message¤ò¥¨¥³¡¼Îΰè¤Ëɽ¼¨¤¹¤ë¡£ nil¤Ç¤¢¤ë¤È¡¢¥Ç¥Õ¥©¥ë¥È¤Ï ¡Ö·Ñ³¤¹¤ë¤Ë¤Ïʸ»úchar¤òÂǤĤ³¤È¡× ¤È¤¤¤Ã¤¿¥á¥Ã¥»¡¼¥¸¤Ç¤¢¤ë¡£

¤Ä¤®¤ÎÎã¤Ç¤Ï¡¢¥Ý¥¤¥ó¥È¤Ï»Ï¤á¤Ï2¹ÔÌܤÎÀèÆ¬¤Ë°ÌÃÖ¤·¤Æ¤¤¤ë¡£

---------- Buffer: foo ----------
This is the contents of foo.
∗Second line.
---------- Buffer: foo ----------
(momentary-string-display
  "**** Important Message! ****"
  (point) ?\r
  "Type RET when done reading")
⇒ t
---------- Buffer: foo ----------
This is the contents of foo.
**** Important Message! ****Second line.
---------- Buffer: foo ----------

---------- Echo Area ----------
Type RET when done reading
---------- Echo Area ----------