diff options
| author | Mark Oteiza | 2019-04-24 19:38:20 -0400 |
|---|---|---|
| committer | Mark Oteiza | 2019-04-24 19:38:20 -0400 |
| commit | cb17e9c42e92efa526d79b717d7d4bc872153b8f (patch) | |
| tree | 39feb98bd29f0666eeeca811bcc807724b2c4bad | |
| parent | f0e026a8495e49379b94e04826b6b8d0dd4b1990 (diff) | |
| download | emacs-cb17e9c42e92efa526d79b717d7d4bc872153b8f.tar.gz emacs-cb17e9c42e92efa526d79b717d7d4bc872153b8f.zip | |
Change WordStar emulation into a minor mode (Bug#35148)
* lisp/obsolete/ws-mode.el: Turn on lexical-binding. Update commentary.
(wordstar): New custom group.
(wordstar-mode-lighter): New custom variable.
(wordstar-mode): Declare with define-minor-mode.
(turn-on-wordstar-mode): New function.
(global-wordstar-mode): New function. Use previous new function.
| -rw-r--r-- | lisp/obsolete/ws-mode.el | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/lisp/obsolete/ws-mode.el b/lisp/obsolete/ws-mode.el index 05dca959dad..17c35176b41 100644 --- a/lisp/obsolete/ws-mode.el +++ b/lisp/obsolete/ws-mode.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;;; ws-mode.el --- WordStar emulation mode for GNU Emacs | 1 | ;;; ws-mode.el --- WordStar emulation mode for GNU Emacs -*- lexical-binding: t -*- |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1991, 2001-2019 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1991, 2001-2019 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -24,9 +24,20 @@ | |||
| 24 | 24 | ||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; This emulates WordStar, with a major mode. | 27 | ;; This provides emulation of WordStar with a minor mode. |
| 28 | 28 | ||
| 29 | ;;; Code: | 29 | ;;; Code: |
| 30 | |||
| 31 | (defgroup wordstar nil | ||
| 32 | "WordStar emulation within Emacs." | ||
| 33 | :prefix "wordstar-" | ||
| 34 | :prefix "ws-" | ||
| 35 | :group 'emulations) | ||
| 36 | |||
| 37 | (defcustom wordstar-mode-lighter " WordStar" | ||
| 38 | "Lighter shown in the modeline for `wordstar' mode." | ||
| 39 | :type 'string) | ||
| 40 | |||
| 30 | (defvar wordstar-C-k-map | 41 | (defvar wordstar-C-k-map |
| 31 | (let ((map (make-keymap))) | 42 | (let ((map (make-keymap))) |
| 32 | (define-key map " " ()) | 43 | (define-key map " " ()) |
| @@ -98,8 +109,7 @@ | |||
| 98 | (define-key map "wh" 'split-window-right) | 109 | (define-key map "wh" 'split-window-right) |
| 99 | (define-key map "wo" 'other-window) | 110 | (define-key map "wo" 'other-window) |
| 100 | (define-key map "wv" 'split-window-below) | 111 | (define-key map "wv" 'split-window-below) |
| 101 | map) | 112 | map)) |
| 102 | "") | ||
| 103 | 113 | ||
| 104 | (defvar wordstar-C-q-map | 114 | (defvar wordstar-C-q-map |
| 105 | (let ((map (make-keymap))) | 115 | (let ((map (make-keymap))) |
| @@ -174,12 +184,9 @@ | |||
| 174 | ;; wordstar-C-j-map not yet implemented | 184 | ;; wordstar-C-j-map not yet implemented |
| 175 | (defvar wordstar-C-j-map nil) | 185 | (defvar wordstar-C-j-map nil) |
| 176 | 186 | ||
| 177 | |||
| 178 | (put 'wordstar-mode 'mode-class 'special) | ||
| 179 | |||
| 180 | ;;;###autoload | 187 | ;;;###autoload |
| 181 | (define-derived-mode wordstar-mode fundamental-mode "WordStar" | 188 | (define-minor-mode wordstar-mode |
| 182 | "Major mode with WordStar-like key bindings. | 189 | "Minor mode with WordStar-like key bindings. |
| 183 | 190 | ||
| 184 | BUGS: | 191 | BUGS: |
| 185 | - Help menus with WordStar commands (C-j just calls help-for-help) | 192 | - Help menus with WordStar commands (C-j just calls help-for-help) |
| @@ -189,8 +196,18 @@ BUGS: | |||
| 189 | - Search and replace (C-q a) is only available in forward direction | 196 | - Search and replace (C-q a) is only available in forward direction |
| 190 | 197 | ||
| 191 | No key bindings beginning with ESC are installed, they will work | 198 | No key bindings beginning with ESC are installed, they will work |
| 192 | Emacs-like.") | 199 | Emacs-like." |
| 193 | 200 | :group 'wordstar | |
| 201 | :lighter wordstar-mode-lighter | ||
| 202 | :keymap wordstar-mode-map) | ||
| 203 | |||
| 204 | (defun turn-on-wordstar-mode () | ||
| 205 | (when (and (not (minibufferp)) | ||
| 206 | (not wordstar-mode)) | ||
| 207 | (wordstar-mode 1))) | ||
| 208 | |||
| 209 | (define-globalized-minor-mode global-wordstar-mode wordstar-mode | ||
| 210 | turn-on-wordstar-mode) | ||
| 194 | 211 | ||
| 195 | (defun wordstar-center-paragraph () | 212 | (defun wordstar-center-paragraph () |
| 196 | "Center each line in the paragraph at or after point. | 213 | "Center each line in the paragraph at or after point. |