2012-10-06 31 views
6

有沒有一種方法可以像在跟隨模式中找到的那樣獲得行爲,但是它在不同的框架中跨越多個窗口?emacs跨框架跟隨模式

我得和一些令人討厭的遺留代碼一起工作,這些代碼有七層八層嵌套循環,帶有lot'a goto,它有助於儘可能多地看到代碼(爲了充分理解並重寫它而不會破壞其他一切)。

我一次可以看到的代碼越多越好。

+2

這個限制的存在有兩個原因:1)沒有自然的「第一幀」,因此跟蹤模式很難找出排列窗口內容的順序。 2)它允許用戶打開多個幀,每個幀顯示緩衝區的不同部分。爲什麼不使用一個大框架 - 我的六個柱子分佈在兩個物理監視器上,總共有888個線路。 – Lindydancer

回答

3

此限制在next-window的調用中由follow-all-followers明確設置。

這是一個基本的解決方法。有一些缺陷會很快發現(例如,您可能需要手動安排幀),但它有利於利用所有幀的基本要求,並且您應該能夠使其工作。

我還建議帶WindMove的FrameMove可能對此安排非常有用。

(defmacro with-temporary-advice (function class name &rest body) 
    "Enable the specified advice, evaluate BODY, then disable the advice." 
    `(progn 
    (ad-enable-advice ,function ,class ,name) 
    (ad-activate ,function) 
    ,@body 
    (ad-disable-advice ,function ,class ,name) 
    (ad-activate ,function))) 

(defadvice next-window (before my-next-window-all-frames disable) 
    "Enforce the ALL-FRAMES argument to `next-window'." 
    (ad-set-arg 2 'visible)) 

(defadvice follow-all-followers (around my-follow-all-frames activate) 
    "Allow `follow-mode' to span frames." 
    (with-temporary-advice 
    'next-window 'before 'my-next-window-all-frames 
    ad-do-it)) 

你可能寧願重新定義follow-all-followers函數來做你想做的事情。

+0

這代表着一個開始的好地方。謝謝。 – Ishpeck