w3mでpsgmlのプレビューを行う
用途は限られるが。
要約
yahtml のプレビューはインターネット・エクスプローラやネットスケープなどで行います. これを, w3m で行うことができます.
設定方法
以下を .emacs に追加します.(autoload 'w3m-goto-url "w3m") (defadvice yahtml-browse-html (around w3m-yahtml-browse-html activate compile) (w3m-goto-url (ad-get-arg 0) t))
この設定を施せばyahtml-modeから M-x yahtml-browse-current-file を実行することでhtmlをw3m上でプレビューでき、"E" (w3m-edit-current-url) でyahtml-modeのソースコードに帰ってこられる。
これをpsgml-modeで利用したい。
つまりpsgml-modeでソースを編集(閲覧)中にw3mでプレビューし、"E"押下でpsgml-modeのソースに戻ってくるようにしたい。
実は上の引用のコードとyahtmlをそのまま流用してこれを実現できる。psgml-mode上でyahtml-browse-current-file を実行すれば、"E"押下でまたpsgml-modeに戻ってこられる (ということをMeadow上で確認した)。
psgml-browse-current-file という名前の関数を用意することにしよう。(といっても、yahtml-browse-current-fileをコールするだけのもの。)
設定例
yahtmlとw3m (あともちろんpsgml-mode) は別途用意・設定してくれっす。
(autoload 'yahtml-browse-current-file "yahtml" "" t nil) ;; (autoload 'w3m-goto-url "w3m") (defadvice yahtml-browse-html (around w3m-yahtml-browse-html activate compile) (w3m-goto-url (ad-get-arg 0) t)) ;; (defun sgml-browse-current-file () (interactive) (call-interactively 'yahtml-browse-current-file))
これにより psgml-modeで編集(閲覧)中にM-x sgml-browse-current-file をやればw3m上でプレビューでき、そこで "E" 押下でpsgml-modeに戻ってくる。
dsvnで特定のファイルを無視(ignore)する
psvnでは特定のファイルをignoreするコマンドが用意されていた(svn-status-property-ignore-file, status-property-ignore-file-extension)が、dsvnではこれに該当するコマンドはなく、propeditバッファにルールをがりがりと書いていく風だ。
以下メモ。
- svn-status のファイルリストから、対象ファイルを格納するディレクトリ名にカーソルを置き 'P' を押下 (もしくはM-x svn-propedit)
- *propedit xxxx*というバッファが現れるので、ここで次のように書く。
svn:ignore: >*.tar.gz >*.o >*.obj >
- 編集が終われば C-c C-c で終了し、あとは通常通りコミットする。
Debianにxoopsをインストールするメモ
ウィンドウ切替とwiden-window.el
というわけで、それなりに必要だと思っていた機能は揃ったので、 ver 0.0.4 から ver 0.1.0 へバージョンアップ。
大変便利です。ありがとうございます。
ところでワタクシは
(windmove-default-keybindings) (setq windmove-wrap-around t)
という設定*1をdot.emacsに書いており、window-systemなemacsを利用する際は [Shift] + カーソル でウィンドウ間の移動をするのが常であります。これによる移動の場合、widen-window.el の最新バージョン(0.1.0)ではウィンドウが広がってくれません。
追記注:以下に書くような「widen-window.el に直接手を加える」方法は賢明ではないと思います。下の追記参照。
これに対処するために widen-window.el に次のように手を加えます。
--- widen-window.el (ver0.1.0) +++ widen-window.el (working copy) @@ -88,6 +88,10 @@ mouse-drag-region delete-window add-change-log-entry-other-window + windmove-up + windmove-down + windmove-right + windmove-left ) "Functions to be advised. Window widening function `widen-current-window' is fired after advised function was called." :type '(list symbol)
これで解決。
;;; C-x ww で widen-window をトグル (define-key ctl-x-map "ww" 'global-widen-window-mode)
とdot.emacsに書き、手動 (C-x w w) でon/offするのが肌に合っています。
追記
widen-window.el に直接手を加えるのでは賢明ではないです。
コメント欄でid: hayamizさんのおっしゃるように M-x customize-variable を利用するか、またはdot.emacsに次のような設定を追記したほうがよいです。
(require 'widen-window) (global-widen-window-mode t) (setq ww-advised-functions (append ww-advised-functions '(windmove-up windmove-down windmove-right windmove-left)))
追記2 (08/12/19)
widen-window を中止するときに、各ウィンドウのサイズを均等割に直せるようにした。意外と重宝する。
(defun my-toggle-global-widen-window-mode () (interactive) (if global-widen-window-mode (if (y-or-n-p "Make windows ratio even? ") (balance-windows))) (call-interactively 'global-widen-window-mode)) ;; (define-key ctl-x-map "ww" 'global-widen-window-mode) (define-key ctl-x-map "ww" 'my-toggle-global-widen-window-mode)
ActivePerl ppmレポジトリ
メモ。
perlのバージョンによってレポジトリのURLが異なる。
- 5.10.x
- 5.8.x
- 5.6.x
参考:レポジトリ登録コマンド
ppm repo add hoge1 http://hogehoge.com
値のみをペースト
EXCELの「形式を選択して貼り付け」→「テキスト」という作業をショートカットで出来ないの?:アルファルファモザイクより。
Sub 値で貼り付け() Selection.PasteSpecial Paste:=xlPasteValues End Sub
イベントハンドラ中のthisの取り扱いに関するメモ
イベントハンドラ中のthisは混乱のもと
(略)
"this"はshiraishiオブジェクトではなく、ボタンのDOMオブジェクトになってしまいます。
混乱のもとなのは分かるけど、それをどう解決すればいいのかについて上記記事はふれていない。
おかげで、はまった。
つまりどんな状況かというと
まちがいのコード
var Monster = function() {}; Monster.prototype = { name: null, func: function() { alert(this.name + " has shown up."); }, init: function(id) { // まちがい document.getElementById(id).addEventListener("click", this.func, false); } }; window.onload = function() { monsterA = new Monster(); monsterA.name = "Slime"; monsterA.init("target"); };
Monster.prototype.initで、引数で渡された要素にonClickイベントを定義したいんだけど、上のような書き方ではダメ。このthisはMonsterオブジェクトではなく、要素のDOMオブジェクトを指すからだ。
結局どうすれば良いかというと———
修正後のコード
var Monster = function() {}; Monster.prototype = { name: null, func: function() { alert(this.name + " has shown up."); }, init2: function(id) { document.getElementById(id).addEventListener("click", (function(obj){return function(){obj.func();};})(this), false); } }; window.onload = function() { monsterA = new Monster(); monsterA.name = "Slime"; monsterA.init("target"); };
何か複雑だが、こんなクロージャを書くと動いた。
もっと良い方法は
prototype.jsを使うべき。