2004-04-07 (Wed)
_ [ソフトウェア] tags-searchの検索文字列のデフォルト値
会社で「Emacs上である関数が使われている箇所を探す時どうするか」と いう話になった。 以前は、同じファイル内だけ探す時はisearch、複数のファイルを探す grepだったのだが、最近tags-searchを使うようになった。
後輩は検索のたびに関数名をコピーしてからミニバッファでペーストし て検索しているらしい。曰く、「長い関数名いちいちタイプするの面倒 臭くないですか?」 そういえば、そうだよな。でもコピー&ペーストもけっこう面倒だぞ。
tags-searchの検索文字列のデフォルト値に現在位置の識別子を渡す (find-tagみたいに)のがラクそうだなと思って、defadviceで拡張してみ た。
(defadvice tags-search (before default-value activate compile)
"Provide default values."
(interactive
(list
(let ((default (funcall
(or find-tag-default-function
(get major-mode 'find-tag-default-function)
'find-tag-default))))
(read-string
(format "Tags search (default %s): " default)
nil nil default t)))))
ついでにtags-query-replaceも。
(defun tags-query-replace-read-args (string regexp-flag)
(let ((from nil)
(to nil)
(default (funcall
(or find-tag-default-function
(get major-mode 'find-tag-default-function)
'find-tag-default))))
(if query-replace-interactive
(setq from (car (if regexp-flag regexp-search-ring search-ring)))
(setq from (read-string (format "%s (default %s): " string default)
nil query-replace-from-history-variable
default t)))
(setq to (read-from-minibuffer (format "%s %s with: " string from)
nil nil nil
query-replace-to-history-variable from t))
(if (and transient-mark-mode mark-active)
(list from to current-prefix-arg (region-beginning) (region-end))
(list from to current-prefix-arg nil nil))))
(defadvice tags-query-replace (before default-value activate compile)
"Provide default values."
(interactive (tags-query-replace-read-args "Tags query replace (regexp)" t)))
ちなみに、自分は以下のキーに割り当てている。
(global-set-key "\M-s" 'tags-search) (global-set-key "\M-r" 'tags-query-replace)
最近ラクするのを怠けていたので、もっと頑張ってラクをしようと思う。
_ [その他] グーグル、反ユダヤ論争に巻き込まれる
「Googleは、複数のコンピュータアルゴリズムだけをもとにして、検索結果の順位を決定する。基本的にウェブでの人気度を反映している」とKraneは述べる。「人間はGoogleの検索結果を操作しない。検索結果を手動で変えることはできない」(Krane)
[グーグル、反ユダヤ論争に巻き込まれるより引用]
あれ、そうだったんですか、ふーん。
[TrackBack URL: http://shugo.net/jit/tb.rb/20040407]
本日のリンク元
- http://www.bookshelf.jp/pukiwiki/pukiwiki.php?設定済み... ×9
- http://xrl.us/3pz4 ×5
- http://www.bookshelf.jp/ ×3
- http://search.live.com/results.aspx?q=default ×2
- http://mixi.jp/show_friend.pl?id=1672 ×2
- http://search.live.com/results.aspx?q=default&mrt=... ×2
- http://sbs.mobile.yahoo.co.jp/p/sbs/mobilesite/sea... ×1
- http://sbs.mobile.yahoo.co.jp/union/search?p=デフォルト... ×1
- http://xrl.us/3pz2 ×1
- http://blog.chew.jp/result/php/php M-x ×1
- http://southbeach-diets.blogspot.com/ ×1
- http://azby.search.nifty.com/cgi-bin/search.cgi?se... ×1
- http://looseend.ddo.jp/blog/categorylist_html?cat_... ×1
- http://209.85.175.104/search?q=cache:kWsylRGqFMQJ:... ×1
- http://mobile.goo.ne.jp/search.jsp?MT=グーグル&DC=10&F... ×1
- http://sbs.mobile.yahoo.co.jp/p/sbs/mobilesite/sea... ×1
- http://search.live.com/results.aspx?q=default&form... ×1
- http://209.85.175.104/search?q=cache:kWsylRGqFMQJ:... ×1
- http://search.mobile.yahoo.co.jp/p/search/mobilesi... ×1
- http://xrl.us/3pz6 ×1
- http://sbs.mobile.yahoo.co.jp/union/search?p=デフォルト... ×1
- http://sbs.mobile.yahoo.co.jp/p/sbs/union/search?p... ×1
- http://namazu.org/~satoru/diary/20030421.html ×1
- http://sbs.mobile.yahoo.co.jp/p/sbs/mobilesite/sea... ×1

関数名上にカーソルを置いて C-u M-x grep ってのも便利ですよ。
おお、知りませんでした。これは便利ですね。