diff options
Diffstat (limited to 'lisp/textmodes/text-mode.el')
-rw-r--r-- | lisp/textmodes/text-mode.el | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 533972fcc95..e8e1f4898ce 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -4,7 +4,7 @@ ;; Inc. ;; Maintainer: emacs-devel@gnu.org -;; Keywords: wp +;; Keywords: text ;; Package: emacs ;; This file is part of GNU Emacs. @@ -41,6 +41,9 @@ "Non-nil if this buffer's major mode is a variant of Text mode.") (make-obsolete-variable 'text-mode-variant 'derived-mode-p "27.1") +;; Actually defined in textconv.c. +(defvar text-conversion-style) + (defvar text-mode-syntax-table (let ((st (make-syntax-table))) (modify-syntax-entry ?\" ". " st) @@ -70,8 +73,28 @@ (defvar-keymap text-mode-map :doc "Keymap for `text-mode'. Many other modes, such as `mail-mode' and `outline-mode', inherit -all the commands defined in this map." - "C-M-i" #'ispell-complete-word) +all the commands defined in this map.") + +(defcustom text-mode-ispell-word-completion 'completion-at-point + "How Text mode provides Ispell word completion. + +By default, this option is set to `completion-at-point', which +means that Text mode adds an Ispell word completion function to +`completion-at-point-functions'. Any other non-nil value says to +bind M-TAB directly to `ispell-complete-word' instead. If this +is nil, Text mode neither binds M-TAB to `ispell-complete-word' +nor does it extend `completion-at-point-functions'. + +This user option only takes effect when you customize it in +Custom or with `setopt', not with `setq'." + :group 'text + :type '(choice (const completion-at-point) boolean) + :version "30.1" + :set (lambda (sym val) + (if (and (set sym val) + (not (eq val 'completion-at-point))) + (keymap-set text-mode-map "C-M-i" #'ispell-complete-word) + (keymap-unset text-mode-map "C-M-i" t)))) (easy-menu-define text-mode-menu text-mode-map "Menu for `text-mode'." @@ -125,7 +148,12 @@ You can thus get the full benefit of adaptive filling Turning on Text mode runs the normal hook `text-mode-hook'." (setq-local text-mode-variant t) (setq-local require-final-newline mode-require-final-newline) - (add-hook 'context-menu-functions 'text-mode-context-menu 10 t)) + + ;; Enable text conversion in this buffer. + (setq-local text-conversion-style t) + (add-hook 'context-menu-functions 'text-mode-context-menu 10 t) + (when (eq text-mode-ispell-word-completion 'completion-at-point) + (add-hook 'completion-at-point-functions #'ispell-completion-at-point 10 t))) (define-derived-mode paragraph-indent-text-mode text-mode "Parindent" "Major mode for editing text, with leading spaces starting a paragraph. |