history のタイムスタンプが出てしまう・・・
.zshrc で
# 履歴ファイルに時刻を記録
setopt extended_history
としていると、Emacs の shell-mode で M-p (履歴呼び出し) をしたときに
% : 1347254684:0;ls
と UNIX TIME でタイムスタンプが表示されてしまいます。
multi-term だったら C-p してもタイムスタンプは出ませんが、
shell-mode が好きなので・・・。
なんとか非表示にしたいのですが、正しい方法が分かりません。
しかたないので、対処療法・・・。
comit.el:
(defun comint-previous-matching-input (regexp n) : ;; (insert (ring-ref comint-input-ring pos)) (insert (replace-regexp-in-string "^[0-9:; ]+" "" (ring-ref comint-input-ring pos))) :
MozRepl の日本語文字化け解消
■後日追記: 続き → 今見ているページの url と title をメモる - armbrust の日記
なんとかしたいと調べていましたが、ズバリこれという情報に当たりません。
で・・・、
・Javascriptのalertで日本語が文字化けするんだけれども - 牌語備忘録 -pygo
・Text Escaping and Unescaping in JavaScript
を見つけて中身を読んでいるうちに、
これと同じことを Firefox に js でやらせちゃえばいいんじゃね? と思いました。
ゴチャゴチャと試した結果が ↓ です。
Welcome to MozRepl. : repl> document.title "ofj - Mozilla Firefox" // 化けてる (ほんとは "はてな"って出るはず) repl> alert("あああ") // 化ける : repl> repl.load("http://0xcc.net/jsescape/strutil.js") !!! Trying to load a non-local URI. repl> function r_conv(str){ return convertUnicodeCodePointsToString( convertUnicodeCodePointsToUtf8Bytes( convertStringToUnicodeCodePoints(str))) // 理解できてないけど・・・ } repl> function s_conv(str){ return convertUnicodeCodePointsToString( convertUtf8BytesToUnicodeCodePoints( convertStringToUnicodeCodePoints(str))) // 理解できてないけど・・・ } repl> r_conv(document.title) "はてな - Mozilla Firefox" // どうやら上手くいったらしい repl> alert(s_conv("あああ")) // どうやら上手く出るみたい
もしくは、こういうほうがいいかな・・・。
Welcome to MozRepl. : repl> repl.load("file:///c:/temp/js/strutil.js") // DLしてローカルに置いた repl> String.prototype.CodeToU8 = function(){ return convertUnicodeCodePointsToString( convertUnicodeCodePointsToUtf8Bytes( convertStringToUnicodeCodePoints(this))) } repl> String.prototype.U8ToCode = function(){ return convertUnicodeCodePointsToString( convertUtf8BytesToUnicodeCodePoints( convertStringToUnicodeCodePoints(this))) } repl> document.title.CodeToU8() "はてな - Mozilla Firefox" repl> alert("あああ".U8ToCode())
もっと清く正しい方法がありそうなんだけどなぁ。
あ、js 部分が妙な書き方でスミマセン。