diff options
Diffstat (limited to 'lisp/textmodes/text-mode.el')
-rw-r--r-- | lisp/textmodes/text-mode.el | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el index 1432ab6a300..74c6d412a65 100644 --- a/lisp/textmodes/text-mode.el +++ b/lisp/textmodes/text-mode.el @@ -49,7 +49,7 @@ (modify-syntax-entry ?' "w p" st) ;; UAX #29 says HEBREW PUNCTUATION GERESH behaves like a letter ;; for the purposes of finding word boundaries. - (modify-syntax-entry #x5f3 "w ") ; GERESH + (modify-syntax-entry #x5f3 "w " st) ; GERESH ;; UAX #29 says HEBREW PUNCTUATION GERSHAYIM should not be a word ;; boundary when surrounded by letters. Our infrastructure for ;; finding a word boundary doesn't support 3-character @@ -57,45 +57,44 @@ ;; character. This leaves a problem of having GERSHAYIM at the ;; beginning or end of a word, where it should be a boundary; ;; FIXME. - (modify-syntax-entry #x5f4 "w ") ; GERSHAYIM + (modify-syntax-entry #x5f4 "w " st) ; GERSHAYIM ;; These all should not be a word boundary when between letters, ;; according to UAX #29, so they again are prone to the same ;; problem as GERSHAYIM; FIXME. - (modify-syntax-entry #xb7 "w ") ; MIDDLE DOT - (modify-syntax-entry #x2027 "w ") ; HYPHENATION POINT - (modify-syntax-entry #xff1a "w ") ; FULLWIDTH COLON + (modify-syntax-entry #xb7 "w " st) ; MIDDLE DOT + (modify-syntax-entry #x2027 "w " st) ; HYPHENATION POINT + (modify-syntax-entry #xff1a "w " st) ; FULLWIDTH COLON st) "Syntax table used while in `text-mode'.") (defvar text-mode-map (let ((map (make-sparse-keymap))) - (define-key map "\e\t" 'ispell-complete-word) - (define-key map [menu-bar text] - (cons "Text" (make-sparse-keymap "Text"))) - (bindings--define-key map [menu-bar text toggle-text-mode-auto-fill] - '(menu-item "Auto Fill" toggle-text-mode-auto-fill - :button (:toggle . (memq 'turn-on-auto-fill text-mode-hook)) - :help "Automatically fill text while typing in text modes (Auto Fill mode)")) - (bindings--define-key map [menu-bar text paragraph-indent-minor-mode] - '(menu-item "Paragraph Indent" paragraph-indent-minor-mode - :button (:toggle . (bound-and-true-p paragraph-indent-minor-mode)) - :help "Toggle paragraph indent minor mode")) - (bindings--define-key map [menu-bar text sep] menu-bar-separator) - (bindings--define-key map [menu-bar text center-region] - '(menu-item "Center Region" center-region - :help "Center the marked region" - :enable (region-active-p))) - (bindings--define-key map [menu-bar text center-paragraph] - '(menu-item "Center Paragraph" center-paragraph - :help "Center the current paragraph")) - (bindings--define-key map [menu-bar text center-line] - '(menu-item "Center Line" center-line - :help "Center the current line")) + (define-key map "\e\t" #'ispell-complete-word) map) "Keymap for `text-mode'. Many other modes, such as `mail-mode', `outline-mode' and `indented-text-mode', inherit all the commands defined in this map.") +(easy-menu-define text-mode-menu text-mode-map + "Menu for `text-mode'." + '("Text" + ["Center Line" center-line + :help "Center the current line"] + ["Center Paragraph" center-paragraph + :help "Center the current paragraph"] + ["Center Region" center-region + :help "Center the marked region" + :enable (region-active-p)] + "---" + ["Paragraph Indent" paragraph-indent-minor-mode + :help "Toggle paragraph indent minor mode" + :style toggle + :selected (bound-and-true-p paragraph-indent-minor-mode)] + ["Auto Fill" toggle-text-mode-auto-fill + :help "Automatically fill text while typing in text modes (Auto Fill mode)" + :style toggle + :selected (memq 'turn-on-auto-fill text-mode-hook)])) + (define-derived-mode text-mode nil "Text" "Major mode for editing text written for humans to read. @@ -142,7 +141,7 @@ Turning on Paragraph-Indent minor mode runs the normal hook (remove-function (local 'indent-line-function) #'indent-to-left-margin))) -(defalias 'indented-text-mode 'text-mode) +(defalias 'indented-text-mode #'text-mode) ;; This can be made a no-op once all modes that use text-mode-hook ;; are "derived" from text-mode. (As of 2015/04, and probably well before, @@ -169,8 +168,6 @@ both existing buffers and buffers that you subsequently create." (if enable-mode "enabled" "disabled")))) -(define-key facemenu-keymap "\eS" 'center-paragraph) - (defun center-paragraph () "Center each nonblank line in the paragraph at or after point. See `center-line' for more info." @@ -198,8 +195,6 @@ See `center-line' for more info." (center-line)) (forward-line 1))))) -(define-key facemenu-keymap "\es" 'center-line) - (defun center-line (&optional nlines) "Center the line point is on, within the width specified by `fill-column'. This means adjusting the indentation so that it equals |