簡體   English   中英

在Emacs中,有沒有辦法只從一個指定的緩沖區自動完成?

[英]In Emacs, is there a way to auto-complete only from one specified buffer?

使用M- /時 ,當前緩沖區中的文本將自動填充所有活動緩沖區中的建議。

有沒有辦法將建議限制在一個特定的緩沖區?

假設您正在談論dabbrev-expandM- /是通常的綁定),那么根據您的要求,有多種選擇。

要僅搜索特定的白色緩沖區列表,最簡單的方法是設置變量dabbrev-search-these-buffers-only

  "If non-nil, a list of buffers which dabbrev should search.
If this variable is non-nil, dabbrev will only look in these buffers.
It will not even look in the current buffer if it is not a member of
this list."

這是我的自定義模式的一個例子(我將M-/重新綁定到此模式的此函數)

(defun tks-dabbrev-expand (arg)
  "Expand either aliases or descriptions, depending on context."
  (interactive "*P")
  (let* ((candidates
          (if (looking-back "^\\S-+")
              " *tks-aliases*"
            " *tks-descriptions*"))
         (dabbrev-search-these-buffers-only (list (get-buffer candidates))))
    (dabbrev-expand arg)))

請注意,還有其他幾種方法可以過濾dabbrev將在其中搜索的緩沖區列表。 dabbrev自定義組具有以下詳細信息:
Mx customize-group RET dabbrev RET

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM