При выполнении описывать-режима M-x в .el файле я заметил, что режим Emacs-Lisp на самом деле кодирует завершение. Однако lisp-complete-symbol
связывается с M-ВКЛАДКОЙ. В Windows эта привязка клавиш взята Windows для переключения активного окна. C-SPC использования большей части IDE, но это взято в Emacs также. Что такое хорошая, довольно общая привязка клавиш для завершения кода?
Если вам нравится завершение всех видов, я рекомендую M - / и связывание, что на Hippie-Explate .
(global-set-key (kbd "M-/") 'hippie-expand)
Это делает различные доработки, которые контролируются переменной Список функций Hippie-Expand-Try-Fute
. В файлах .el вы можете установить, что для выполнения Perrue Complete-Clip-Symbol
сначала, чтобы получить поведение, которое вы просите, наряду со всеми другими расширениями Hippie-Expand.
Это сделало бы это для вас:
(add-hook 'emacs-lisp-mode-hook 'move-lisp-completion-to-front)
(defun move-lisp-completion-to-front ()
"Adjust hippie-expand-try-functions-list to have lisp completion at the front."
(make-local-variable 'hippie-expand-try-functions-list)
(setq hippie-expand-try-functions-list
(cons 'try-complete-lisp-symbol
(delq 'try-complete-lisp-symbol hippie-expand-try-functions-list)))
(setq hippie-expand-try-functions-list
(cons 'try-complete-lisp-symbol-partially
(delq 'try-complete-lisp-symbol-partially hippie-expand-try-functions-list))))
Я использую:
(define-key function-key-map [(control tab)] [?\M-\t])
Я использую M-.
и M - /
для 2 режимов завершения - Hippie-Expand и стандартный Emacs One.
Как упоминал Трей Джексон, хиппи-расширение
- это путь, но вместе с его привязкой к M-/, мне также нравится, что ключ TAB делает всю мою работу по завершению за меня. Так что у меня есть это из Emacs-Wiki в моём файле .emacs:
;;function to implement a smarter TAB (EmacsWiki)
(defun smart-tab ()
"This smart tab is minibuffer compliant: it acts as usual in
the minibuffer. Else, if mark is active, indents region. Else if
point is at the end of a symbol, expands it. Else indents the
current line."
(interactive)
(if (minibufferp)
(unless (minibuffer-complete)
(hippie-expand nil))
(if mark-active
(indent-region (region-beginning)
(region-end))
(if (looking-at "\\_>")
(hippie-expand nil)
(indent-for-tab-command)))))
(global-set-key (kbd "TAB") 'smart-tab)
Настройки расширения хиппи могут быть следующими:
;;settings for hippie-expand
(setq hippie-expand-try-functions-list
'(try-complete-lisp-symbol
try-complete-lisp-symbol-partially
try-expand-dabbrev
try-expand-dabbrev-from-kill
try-expand-dabbrev-all-buffers
try-expand-line
try-complete-file-name-partially
try-complete-file-name))