2
我使用GNU emacs-24。 我讓按鈕這樣的:如何使鏈接emacs按鈕在另一個緩衝區中點擊鼠標?
(defun go-click (button)
(print (button-get button 'point))
(let ((win (get-buffer-window (button-get button 'buffer))))
(if win
(progn
(select-window win)
(goto-char (button-get button 'point)))
(message "open a window with the location"))))
(let ((p (point)) (buf (current-buffer)))
(with-current-buffer (get-buffer "yyy")
(insert-button "go" 'action #'go-click
'follow-link t
'point p
'buffer buf)))
我有這樣的代碼在*刮*緩衝區ONW窗口,並與bufffer YYY另一個窗口。我是eval-current-buffer,重點是,比如說在'go-click'位置。並且按鈕去在yyy出現。
如果現在按一下按鈕,它打印的數量,符合市場預期,使得*刮*活躍,像預想的那樣,但不會繼續前進#點'去點擊的位置。
但是,如果在我的位置點去按鈕由光標鍵和回車鍵,它按預期工作(point移到#'去點擊positoin,不管了,在這裏我把它放在*劃痕*先前的)。
如何使它適用於鍵盤輸入和鼠標點擊的情況?
工程。不太明白,爲什麼,但還是謝謝! – Necto
我想在鼠標點擊的場景'點'是在** \ * scratch \ ***緩衝區,並且在所有操作之後emacs只是恢復點。我使用函數'goto-char'的'debug-on-entry'來闡明行爲。 – artscan