anything.elã®æ°æ©è½ããããã¡ã«ããåè£ä½æãã®äºå
anything.elã¯é常ãæååãªã¹ããstring-matchã§çµãè¾¼ãã§ãããããããåã«ãæ¸ããããã«ãã®ããæ¹ã¯é
ããããã§ãããã¡ã«initã§å
¨åè£ãæ¸ãåºãã¦ããre-search-forwardã§æ¾ã£ã¦ããã®ãéããEmacsãããããæ¹ã ã
ç¾ã«anything-c-moccur.elãanything-c-mx.elã§ã¯ãã®ãã¯ããã¯ã使ããã¦ããã
ãã£ããããããæ¹ãªã®ã ããæ®åãããªãã¦ã¯ãæ®åãããã«ã¯ãæ¸ãããããªãã¨ã ãã ãããã§ãanything-sourcesã«ä½¿ããå±æ§ã«æ°ãããcandidates-in-bufferããå ãããã¨ã«ãããã¶ã£ã¡ããcandidates-in-bufferã¯ã·ã§ã¼ãã«ããã§ã
(candidates-in-buffer)
ã¯
(candidates . anything-candidates-in-buffer) (volatile) (match identity)
ã¨ç価ã§ããã人éãã£ãããã¹ã«ãªããªãæ°ä»ããªããã®ã§æ°å±æ§ãå°å ¥ããã°volatileãå ¥ããã®ãå¿ããå¿é ããªããªããanything-get-sourcesã§åè ããå¾è ã«å±éããã®ã§ãäºææ§ã¯ä¿ãããã
anything-candidates-in-bufferã¯ãåè£ãããã¡ãããre-search-forwardã§åè£ãæ¾ãé¢æ°ã ããã®é¢æ°ãç´æ¥ä½¿ããã¨ã¯ããã¾ããªãã¨æãã(candidates-in-buffer)ã§éæ¥çã«ä½¿ãã®ãã»ã¨ãã©ã ããã
åè£ãããã¡ã¯1è¡ã«1åè£ä¸¦ã¹ã¦ãããããã¡ã ãåè£ãããã¡ã¯ãæ°ããä½æãããã¨ããæ¢åã®ãããã¡ãç»é²ãããã¨ãã§ãããä½æã»ç»é²ã¯initã§ãããåè£ãããã¡ã®ä½æã»ç»é²ã¯anything-candidate-bufferé¢æ°ã使ãããã®é¢æ°ãç¨æããçç±ã¯ãdefvarã§ç¡é§ãªã°ãã¼ãã«å¤æ°ãã°ãæããããªãããã ããã¡ãã¡å®ç¾©ããã®ããã©ãããããã¯é¢æ°ã使ã£ã¦æ½è±¡åãããã
- (anything-candidate-buffer 'local) ã (anything-candidate-buffer t) ã§ãããã¡ãã¼ã«ã«ãªç©ºã®åè£ãããã¡ãä½æããããããã¡åã¯ã *anything candidates:ã½ã¼ã¹å*ãããã¡åãã¨ãªããã¡ã½ããåä¸è¦§ãªã©ããããã¡ã®å 容ãæãåºãã®ã«ä¾¿å©ã
- (anything-candidate-buffer 'global) ã§ã°ãã¼ãã«ãªç©ºã®åè£ãããã¡ãä½æããããããã¡åã¯ã *anything candidates:ã½ã¼ã¹å*ãã¨ãªããEmacsé¢æ°ãªã¹ããªã©ã®ä½æã«ä¾¿å©ã
- (anything-candidate-buffer BUFFER) ã§æ¢åã®BUFFERãåè£ãããã¡ã«ç»é²ããããã¨ãã°ãã¡ã¤ã«ãªã¹ããä¿åãã¦ãããã¡ã¤ã«ãéãããã®ä¸ããåè£ãé¸ã¶å ´åã«ä¾¿å©ã
candidates-in-bufferå±æ§ã使ãã¨ãå®éã«ããã°ã©ãã³ã°ããã®ã¯inité¢æ°ã®ã¿ã«ãªããéåã¯ãããªæãã ã
(defvar anything-c-source-ã»ã«ããã '((name . "ãªã¾ã") (init . (lambda () (when åè£ä½æã®æ¡ä»¶ (with-current-buffer (anything-candidate-buffer 'local) åè£ãæ¸ãåºã)))) (candidates-in-buffer) (action ããããã¼ã)))
åè£ä½æã®æ¡ä»¶ã« (anything-current-buffer-is-modified) ãå
¥ãã¦ããã¨ãanything-current-bufferã®å
容ãå¤æ´ãããªãéããååä½æããåè£ï¼åè£ãããã¡ã®å
容ï¼ãåå©ç¨ãããã
with-current-bufferå
ã§ã¯ã«ã¬ã³ããããã¡ãå¤ãã£ã¦ãã¾ããããbuffer-file-nameã¯anything-buffer-file-nameã使ãå¿
è¦ããããããã¯anything-current-bufferã®buffer-file-nameã ããã¼ããä»ã®ãããã¡ãã¼ã«ã«å¤æ°ã«ã¢ã¯ã»ã¹ã§ãããããªã©ããã¼é¢æ°ãç¨æãã¹ããâ¦
ãã¨ãã°ãRubyのソースコード(C言語)解析支援ツール list-call-seq.rb - http://rubikitch.com/に移転しましたã®ã½ã¼ã¹ãæ¸ãæãã¦ã¿ããããªãªã¸ãã«ã§ã¯shell-command-to-stringãsplit-stringãã¦ãããsplit-stringã¯ä¿¡ããããªããã¨ã«Emacs Lispã§æ¸ããã¦ããã®ã§é ãã
(defvar anything-c-source-list-call-seq '((name . "Ruby Source (call-seq)") (candidates . (lambda () (with-current-buffer anything-current-buffer (when (and buffer-file-name (eq major-mode 'c-mode)) (split-string (shell-command-to-string (format "list-call-seq.rb -n %s" buffer-file-name)) "\n"))))) (invariant) ;; * (action ç¥)))
æ°æ©è½ã使ãã¨ãããªãã
(defvar anything-c-source-list-call-seq '((name . "Ruby Source (call-seq)") (init . (lambda () (when (and buffer-file-name (anything-current-buffer-is-modified) (eq major-mode 'c-mode)) (with-current-buffer (anything-candidate-buffer 'local) (call-process-shell-command (format "list-call-seq.rb -n %s" buffer-file-name) nil (current-buffer)))))) (candidates-in-buffer) (action ç¥)))
ååã¯invariantå±æ§ã使ã£ã¦ããã®ã§è¡æ°ã¯å°ãå¢ãã¦ããããwith-current-bufferã®ä¸ã¯call-process-shell-commandã ããªã®ã§ãè¦éãã¯è¯ããªã£ãã®ã§ã¯ãªãã ããããinvariantã使ããªãã¨ãbuffer-chars-modified-tickã使ã£ã¦ãã«ããã«ãæ¸ãå¿
è¦ãããã
ã(with-current-buffer (anything-candidate-buffer 'local)ãã®é¨åã¯ãããã¡ãã¼ã«ã«ãªåè£ãããã¡ãä½æãã¦ããã®ãããã¡ãã«ã¬ã³ãã«ãããç¡é§ãªã°ãã¼ãã«å¤æ°ããªãåæ¸ãããããªã£ã¦ããã
åè£ãããã¡ã®åç
§ã¯1度ã ããªã®ã§ããã«çãæ¸ããã¨ãã§ããã
(defvar anything-c-source-list-call-seq '((name . "Ruby Source (call-seq)") (init . (lambda () (when (and buffer-file-name (anything-current-buffer-is-modified) (eq major-mode 'c-mode)) (call-process-shell-command (format "list-call-seq.rb -n %s" buffer-file-name) nil (anything-candidate-buffer 'local))))) (candidates-in-buffer) (action ç¥)))
invariantå±æ§ã¯åãè¾¼ãããã©ããè¿·ã£ã¦ããã(anything-current-buffer-is-modified)ã使ãã°ããã®ã§â¦
ã©ãã ãããï¼ ã³ã¡ã³ãããã©ãã¯ããã¯çæ±ãã
追è¨
ãã£ããid:IMAKADOããããã
ã» 2008å¹´08æ08æ¥ IM IMAKADO 5, anything, rubikitch, tmp ãããã¡ã使ã£ãåè£ã®çµãè¾¼ ã¿å¾ã§è©³ããèªã (display . real)ã®å½¢å¼ã¯ã©ãå®è£ ãããã®ãããã¹ãããããã£ã使ã ï¼
candidates-in-bufferã使ãã®ã¯å¤§éã®åè£ãæ±ããã¨ã念é ã«ãã¦ããããã (display . real) å½¢å¼ã¯æ±ããªãããã«ããäºå®ãå®écall-process-shell-commandçã®å¤é¨ã³ãã³ãã®åºåçµæãæ¢åã®ãããã¡ãåè£ã«ãããã¨ãã»ã¨ãã©ã ããããã£ã1ã¤ã®åè£ããé¸æããªãã®ã«ããããã¡å é ãã1è¡1è¡text propertyãä»å ãã¦ããã®ã¯ç¡é§ã ã
ãã®ä»£ãããdisplay-to-realå±æ§ãæ°è¨ãã¦ããé¸æãããåè£âactionã«æ¸¡ãå¼æ°ãã®å¤ææ©æ§ãè¨ãããcandidates-in-bufferã¨ã®ä½µç¨ã¯ãã¡ããã®ãã¨ãå¾æ¥ã®æ¹æ³ã§ãcandidate-transformerã§mapcarã¨ãã§ç¡çã« (display . real) ãä½æããªãã¦ããããªããããã³ã¼ããã³ã³ãã¯ãã«ãªãã ããããã¨ãã°ã
(let ((anything-sources '(((name . "TEST") (candidates "foo") (display-to-real . upcase) (action ("identity" . identity)))))) (anything))
ãå®è¡ããããFOOãè¿ã£ã¦ããããã«ãªãããã¡ãã§ã¯ãä¸å¿ã¦ããããã¹ããå«ãã¦å®è£ æ¸ã
display-to-realã¨ããååã¯ã©ãã ããããã°ããèãã¦ã¿ã¦ããã£ã¨ããååãæãä»ããªãã£ããä»æ§ã¨ãã¦ç¢ºå®ãããªãªã¼ã¹ããã¤ããã ã
ãanything.elã¯éããã¨ãã声ãé»ãããªãã¨ãããªãã