Emacsã®widgetã«ã¤ãã¦æã£ããã¨
id-manager.el ã«ã¦ Emacs ã® widget ã使ã£ã¦ã¿ã¾ããããã®ææ³ãªã©ã§ãã
widgetã¨ã¯
widgetã¯Emacsä¸ã§ãã¤ã¢ãã°ã®ãããªUIãä½ãã©ã¤ãã©ãªã§ããCustomizeãªã©ã®UIãããã§åºæ¥ã¦ãã¾ãã
æè¿ã®Emacsï¼å°ãªãã¨ãEmacs23ï¼ã«ã¯æ¨æºã§å
¥ã£ã¦ãã¾ãã
ã©ããè¯ãã
è¤æ°ã®å ¥åé ç®ãã¦ã¼ã¶ã¼ã«è¦æ±ãããããªå ´åãwidgetã使ããã¨ã§é常ã«åãããããUIã«ãªããã¨ãå¤ãã§ãã
grepã®UIã§å ·ä½çã«æ¯ã¹ã¦ã¿ã¾ããlgrepã¨ezgrepã¨ãããEmacsããgrepããããã°ã©ã ãããã¾ãã
- åè
lgrepã¯ããæ¤ç´¢ãããæåããã©ããªãã¡ã¤ã«ãæ¤ç´¢ãããããã©ãã®ãã£ã¬ã¯ããªãåºæºã«æ¢ãããã¨ããæ å ±ããããããã¡ããé çªã«å ¥åãã¾ããåãã¦ä½¿ãã¨ãã¯ä½ãå ¥åããªããã°ãªããªãã®ãåãããªãã¦ä¸å®ã§ããã¾ããå ¥åããé çªã決ã¾ã£ã¦ããã®ã§èããªããå ¥åããªããã°ãªãã¾ããããæ £ãã¦ã¦ãé çªãééããããã¦æåããããç´ããã¨ãããã¾ãã
ä¸æ¹ã®ezgrepã¯ã以ä¸ã®ãããªç»é¢ã§ããï¼widgetã使ã£ã¦ããããã§ã¯ãªãã®ã§ãããä¼¼ããããªå ¥åãã£ã¼ã«ãã®æ©è½ãç¬èªã§å®è£ ããã¦ãã¾ããï¼
ezgrepã®ç»é¢ï¼ezgrepã®ãµã¤ãããå¼ç¨ï¼
çµæã¨ãã¦ããããããã¡ã®é£ç¶å ¥åã®ä»£ããã«widgetã使ããã¨ã«ãã£ã¦ãã¦ã¼ã¶ã«ã¨ã£ã¦åããããããã¾ãã¹ãã¬ã¹ãå°ãªãUIãæä¾ãããã¨ãåºæ¥ã¾ãããã¡ãããwidgetã使ã£ã¦ãåããã«ããUIãåºæ¥ãå¯è½æ§ã¯ããã¾ãããããããããã®ãããªããã°ã©ã ã¯ãããããã¡ã使ã£ã¦ãããã«åããã«ããã¤ã³ã¿ãã§ã¼ã¹ã«ãªãã®ã§ã¯ãªããã¨æãã¾ãã
UIã¨ããã°ã©ã ã®ãããã
UIã¯widgetã使ããã¨ã§ä½¿ãããããªãã®ã§ããããã®ä»£åã¨ãã¦ããã°ã©ã ãéãã«ç ©éã«ãªãã¾ãã
ãããããã¡ã§å ¥åãããã¤ã³ã¿ãã§ã¼ã¹ã¯ãå ¥åçµæããã®ã¾ã¾å¤æ°ã«ä»£å ¥ãã¦ãããã¨ãåºæ¥ã¾ããã¾ããé çªãã½ã¼ã¹ã³ã¼ãã®é çªã§æ±ºã¾ã£ã¦ãã¦ãå¾æ»ãããã¾ãããå ¥åã«åé¡ããã£ãå ´åãååº¦å ¥åãæ±ããããã¨ã©ã¼ã§ä¸æããããã¨ãåºæ¥ã¾ããã·ã³ãã«ãªå ´åã«ã¯ä¸ã¤ã®é¢æ°ã®ä¸ã§å®çµããããã¨ãåºæ¥ã¾ãã
ä¸æ¹ã§ãwidgetã¯ãããã¡ããä½ãå¿ è¦ãããã¾ããããã«ãwidgetã«å ¥åå®äºãªã©ã®ã¢ã¯ã·ã§ã³ãä»æãã¦ããä»çµã¿ã«ãªããããããã¤ãé¢æ°ãæ¸ãå¿ è¦ãããã¾ããã¨ãããã¨ã§æ¸ãéã¯å¤ããªãã¾ãã
ã¨ãã£ã¦ããããé£ããããã§ã¯ãªããWebã®ã¢ããªãªã©ã§æ®æ®µãã£ã¦ãããããªãã¨ã§ãã®ã§ãä»ã®GUIã¢ããªãªã©ã®éçºã®çµé¨ãããã°ããã«åºæ¥ãã¨æãã¾ãã
æ å ±
使ã£ã¦ãã人ã極端ã«å°ãªãããããæ å ±ããã¾ãããã¾ãããããããæ¢ãã¦ã¿ãã®ã§ãããä»ã®ã¨ããEmacsã«å«ã¾ãã¦ããInfoï¼è±èªï¼ãã詳ããè³æããªãããã§ãããã è¯ãæ¸ããã¦ãã¾ãã®ã§ãã¨ã£ãããã¨ãã¦ã¯ååã ã¨æãã¾ããinfoã®ãµã³ãã«ã³ã¼ãããEmacsWikiä¸ã®サンプルコードãè¦ãã°ã大ä½åããããªãã®ãåºæ¥ã¾ãã
ãã ãã¨ãã£ã¿ã®ä»çµã¿ã®ä¸ã§ç¡çç¢çå®ç¾ãã¦ããå®è£ ãªã®ã§ãåããå¾®å¦ã ã£ãããä»ã®GUIããã°ã©ãã³ã°ã¨ã¯éãé¨åãå¤ã ããã¾ãããªã®ã§widgetã®ã³ã¼ãï¼wid-edit.elï¼ãåç §ããªããã°ãªããªãå ´é¢ãå¤ã ããã¾ãããå ¨ä½ã®ã³ã¼ãã®éã¯å¤ãã§ããã大åãwidgetã³ã³ãã¼ãã³ãã®å®ç¾©ãªã®ã§ãã³ã¢ãªé¨åã¯ãããå°ããã§ããå¤åèªã¿ãããæ¹ã ã¨æãã¾ãã
id-managerã§ã®ä¾
以ä¸ã®å³ã®ãããªæãã§ä½ãã¾ããã
å ¥åæ¬ã4ã¤ä¸¦ãã§ããã ãã ã£ããããçµããå 容ã ã£ãã®ã§ããããã¹ã¯ã¼ãã®è¡¨ç¤ºãåãæ¿ããã¨ããã§ã¯ã¾ãã¾ãããwid-edit.elã®ã³ã¼ããèªã¿ãªãã試è¡é¯èª¤ãç¹°ãè¿ãã¦ãããããä»ã®æ £ããGUIãã¼ã«ã ã£ããä¸ç¬ã§çµãããã¨ããwidgetã使ã£ããã¤ã¢ãã°ãä½ãã®ã¯ä¸¸1æ¥ããã£ã¦ãã¾ãã¾ãããå¤åã次ããã¯ãã£ã¨ãã¾ããããã¨ã¯æãã¾ãã
ã¯ã¾ã£ãã¨ãã
æ§ç¯ä¸ã«ã¨ã©ã¼ãçºçããå ´åãåãããããã¨ã©ã¼ãåºããã¾ãä¸è¦widgetãæ§ç¯ã§ãã¦ããããã«è¦ãããã¨ãããã¾ããwidgetã®ãããã°ä¸ã¯ toggle-debug-on-error ã§ã¨ã©ã¼ã表示ãããªã©æ³¨æããæ¹ãè¯ãã§ãã
widget-create ããã¨ãã®æç¹ãããã¡ã«insertããã¦ãã¾ãã¾ããã§ãã®ã§ãã¬ã¤ã¢ã¦ããèããªããããã°ã©ã ã®é çªãèããå¿ è¦ãããã¾ããæ°è»½ã«ã¬ã¤ã¢ã¦ããå¤æ´ã§ãã¾ããããã³ã¼ããé·ããªããã¡ã§ãã
ãã¿ã³ãªã©ã®ã¢ã¯ã·ã§ã³ï¼ã¤ãã³ããã³ãã©ï¼ã®ä¸ããwidgetã®å 容ãæ´æ°ããå ´åã¯ãæå¾ã« widget-setup ãå¼ã¶å¿ è¦ãããã¾ãã
widget-setup ã§åæ ã§ããªãå±æ§ãããã¾ããä»åã®ä¾ã§ã¯ããã§ãã¯ããã¯ã¹ã®ON/OFFã§ãã¹ã¯ã¼ããã£ã¼ã«ãã®å 容ã®è¡¨ç¤ºã»é ãã®åããè¦å´ãã¾ãããwidgetã®æ©è½ãæ§ç¯æã«æ±ºã¾ã£ã¦ãã¾ãããã ã£ãã®ã§ããããã¡ãã¨ä½ãç´ããã¨ã«ãã¾ããã
ãããã¡ãä½ãç´ãéã«ãåããããã¡ãåå©ç¨ããã¨ããããã¡ãã¼ã«ã«å¤æ°ãªã©ãæ®ã£ã¦ãã¦ãã¾ãåããªãã¨ããããã¾ããèªåã§ããããåæåãã¦ãã¾ãã°ããã®ã§ãããå é¨ã®å®è£ ã«ä¾åããã®ã¯è¯ããªãã¨æãã¾ãã®ã§ãç´ ç´ã«killãã¦ããä½ãç´ãæ¹ãè¯ãã¨æãã¾ãã
widgetã®å 容ã®æ¤è¨¼ã¯ :validation å±æ§ã«é¢æ°ãå ¥ããã®ã§ãããå ¨ä½ã®è¨è¨ã¨ãã¦ãããã©ã使ãã°ããã®ãçµå±ããåããã¾ããã§ãããåå°ã®ã³ã¼ããèªãã¨ã widget-apply ã§ããã«å ¥ããé¢æ°ãèªåã§å¼ãã§ãããããªã®ã§ãããããããã¨å®è£ ãããããããªãã ãã§ãã¾ããããããªããããªæ°ããã¾ãããä»åã¯æ®éã«èªåã§å 容ãã§ãã¯ããã¦ãã¾ãã
以ä¸ã®ãããªãã¨ããã¦ãããã¡ã«ãwidgetã§ã®ããã°ã©ãã³ã°ã¯ããã¼ã«ã«ã¢ããªã®GUIã®è¨è¨ãèãæ¹ã§ã¯ãªãã¦ãWebã¢ããªã®èãæ¹ãè¿ãã®ããªã¨æãã¾ããããããã¡ãæ¯åçæããã¨ããããã¨ã©ã¼ã¡ãã»ã¼ã¸ã®å ´æã確ä¿ããããã»ãã·ã§ã³å¤æ°ã®ãããªãããã¡ãã¾ãããå¤æ°ã欲ããã£ãããªã©ã次åããã¯ãã¾ããããããªæ°ããã¾ãã
ãããã
ä»ã¾ã§ãããããªGUIã¢ããªãæ¸ãã¦ããçµé¨ãããwidgetã¯é常ã«ä½¿ãã«ããã¨æãã¾ããã
ã¾ããæç¶ãçæ§ç¯ã¨å®£è¨çæ§ç¯ãæ··ãã£ã¦ãããã¨ãåé¡ã§ããé常ã¯ãJavaã®Swingãªã©ã®ããã«ããã°ã©ã ã§æç¶ãçã«æ§ç¯ãã¦ããæ¹æ³ï¼ãªãã¸ã§ã¯ãçæã¨ã¬ã¤ã¢ã¦ããç¹°ãè¿ãï¼ãä½ã¬ãã«ã®å±¤ã«ç¨æãã¦ãããæ°ã®å©ããGUIãã¼ã«ãããã ã¨ãHTMLã»Flexãããã¯VBãªã©ã®ããã«GUIã宣è¨çã«ç»é¢ãå®ç¾©ããæ¹æ³ããã®ä¸ã«ç¨æããã¦ããã¨ããæ§æã«ãªã£ã¦ãããã¨ãã»ã¨ãã©ã§ããwidgetã§ã¯æ§ç¯ããç¬éã«ãã£ã¼ã«ããé ç½®ããã¦ãã¾ããããã©ã¡ãã§ãããã¾ããï¼ããããã¦Tcl/Tkã«è¿ãï¼ï¼ãããã¦åæã«insertããªãã§ãã¦ãããã°æç¶ãçã«æ§ç¯ãã¦ãããã®ã§ãããç¾ç¶ããããããã«ã¯ããã«é¢æ°ããã¯ãã§ã©ããããå¿ è¦ãããã¾ãã
ãããã¡ãwidgetå°ç¨ã«ãªã£ã¦ãã¾ããã¨ãå°ãã¾ããå®è£ ãè¦ãã¨ãinsertããwidgetããããã¡ãã¼ã«ã«å¤æ°ã«å ¥ãã¦ããã¦ã post-command-hook ã change hook ã¾ããã§é å¼µã£ã¦ãã¾ãã®ã§ä»æ¹ããªãã®ã§ãããããå°ããã®ãã¨ãããã¥ã¡ã³ãã§å¼·èª¿ãã¦ãè¯ãã£ãã®ã§ã¯ãªãããªã¨æãã¾ãããæå㯠scratch ãããã¡ã«è²¼ãä»ãããã対話çã«æ§ç¯ãã¦å®é¨ãã¦ããã®ã§ãwidgetæ§ç¯ã«ããå¯ä½ç¨ã§ã¯ã¾ã£ã¦ãã¾ãã¾ããã
ãã¨ã¯ãwidgetã®è²¬ä»»ç¯å²ãã©ãã¾ã§ããåãããªãã¨æãã¾ãããwidgetã®å±æ§ãçºãã¦ããã¨ãããããã¨ä¾¿å©ãããªæ çµã¿ãç¨æãã¦ããããã«æããã®ã§ãããå®éã«ã¯æ ã ãç¨æãã¦ãã£ã¦ãå®éã«ã¯èªåã§å¼ãã§ãã®çµæãèªåã§ã¾ãå¤æããªããã°ãªããªãã£ããã¨ãã©ã使ãã°ããã®ããInfoãã³ã¼ããèªãã ãã§ã¯åãããªããã¨ãå¤ãã£ãã§ãããã®ãããã«ã¤ãã¦ãããå°ãwidgetã®èãæ¹ã¨ããããã¬ã¼ã ã¯ã¼ã¯ã¨ãã¦ã®å²å¦ã¿ãããªãã®ã欲ããã£ãããªã¨æãã¾ãã
widgetã®ã³ã¼ãã¯ãä¼¼ãå¦çãããä¼¼ãã¿ã¤ãã³ã°ã®å¦çãããããéãã¦ãã¦å ±éåãããã®ã®ãããªå½¢ã«ãªã£ã¦ããããã«è¦ãã¾ããã³ã¼ãã¯ç¶ºéºã§ãããããã ã¢ããã¨ãã¦ããããã¾ãå ±éåã¯åºæ¥ã¦ããã®ã§ãããããããã¦ã³çãªè¨è¨ï¼APIå©ç¨è ã¸ã©ã使ã£ã¦ããããã¨ããæ¹éï¼ãç¡ããããªæ°ããã¦ãã¾ãã
15年以ä¸åããã®å®è£ ã§ããããããããªæ´å²ççµç·¯ï¼w3ã¨ãcustomizeã¨ã®é¢ä¿ãªã©ï¼ããç¾ç¶ã®å®è£ ã«è½ã¡çããã®ããªã¨ãããã¨ãã³ã¼ãããåããã¾ããä½ãç¥ããªãæ°åè ã®æè¦ã§ããããã¾ããã
çµå±
ã¨ã¯ããããããããã¡ã§ã®é£ç¶å ¥åããã¯widgetã®æ¹ãããUIãæä¾ã§ãããã¨ã¯ç¢ºãã§ãããç¾ç¶ã§ã¯ãã¤ã¢ãã°ãæ§ç¯ããæ段ãwidgetãããªããã¨ã確ãã§ãã
çµå±ãå¥ã®GUIãã¼ã«ããããä½ãã»ã©ã®ä½è£ããªãã§ãã®ã§ãå¿ è¦ãªå ´é¢ã§ã¯ä»å¾ãé å¼µã£ã¦ widget ã使ã£ã¦ãããããªã¨æãã¾ããã