如何跳转Emacs中的按钮?

问题描述:

我创造我的主要模式的一些按钮有:如何跳转Emacs中的按钮?

(insert-text-button "Start" :type 'start-btn) 
... 
(insert-text-button "Button2" :type 'b2-btn) 

我要跳转到下一个和prev。光标位置的按钮。

我不知道如何检测按钮的位置。给我一个提示。

(defun jump-to-next-button() 
    "Jump to the next text button from current position." 
    (interactive) 
    ;; magic 
) 

按钮插入insert-text-button和相关功能使用button文本属性,您可以搜索具有next-single-property-change。然后,“魔术”部分将如下所示:

(goto-char (or (next-single-property-change (point) 'button) 
       (point-max)))