From: Mark Oteiza <mvoteiza@udel.edu>
To: emacs-devel@gnu.org
Cc: Douglas Quagliana <dquagliana@gmail.com>
Subject: [PATCH] change wordstar-mode into a minor mode
Date: Sun, 12 Feb 2017 12:32:00 -0500 [thread overview]
Message-ID: <20170212173200.GA12419@holos.localdomain> (raw)
I was poking through obsolete/ the other day and happened upon
ws-mode.el and subsequently the thread
https://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00127.html
The following changes `wordstar-mode' into a minor mode, and also
adds a global minor mode `global-wordstar-mode', which will turn on
wordstar-mode in all buffers except the minibuffer.
diff --git a/lisp/obsolete/ws-mode.el b/lisp/obsolete/ws-mode.el
index 62cccf725a..f977bc089e 100644
--- a/lisp/obsolete/ws-mode.el
+++ b/lisp/obsolete/ws-mode.el
@@ -1,4 +1,4 @@
-;;; ws-mode.el --- WordStar emulation mode for GNU Emacs
+;;; ws-mode.el --- WordStar emulation mode for GNU Emacs -*- lexical-binding: t -*-
;; Copyright (C) 1991, 2001-2017 Free Software Foundation, Inc.
@@ -24,9 +24,20 @@
;;; Commentary:
-;; This emulates WordStar, with a major mode.
+;; This provides emulation of WordStar with a minor mode.
;;; Code:
+
+(defgroup wordstar nil
+ "WordStar emulation within Emacs."
+ :prefix "wordstar-"
+ :prefix "ws-"
+ :group 'emulations)
+
+(defcustom wordstar-mode-lighter " WordStar"
+ "Lighter shown in the modeline for `wordstar' mode."
+ :type 'string)
+
(defvar wordstar-C-k-map
(let ((map (make-keymap)))
(define-key map " " ())
@@ -98,8 +109,7 @@ wordstar-C-o-map
(define-key map "wh" 'split-window-right)
(define-key map "wo" 'other-window)
(define-key map "wv" 'split-window-below)
- map)
- "")
+ map))
(defvar wordstar-C-q-map
(let ((map (make-keymap)))
@@ -174,12 +184,9 @@ wordstar-mode-map
;; wordstar-C-j-map not yet implemented
(defvar wordstar-C-j-map nil)
-
-(put 'wordstar-mode 'mode-class 'special)
-
;;;###autoload
-(define-derived-mode wordstar-mode fundamental-mode "WordStar"
- "Major mode with WordStar-like key bindings.
+(define-minor-mode wordstar-mode
+ "Minor mode with WordStar-like key bindings.
BUGS:
- Help menus with WordStar commands (C-j just calls help-for-help)
@@ -189,8 +196,18 @@ wordstar-mode
- Search and replace (C-q a) is only available in forward direction
No key bindings beginning with ESC are installed, they will work
-Emacs-like.")
-
+Emacs-like."
+ :group 'wordstar
+ :lighter wordstar-mode-lighter
+ :keymap wordstar-mode-map)
+
+(defun turn-on-wordstar-mode ()
+ (when (and (not (minibufferp))
+ (not wordstar-mode))
+ (wordstar-mode 1)))
+
+(define-globalized-minor-mode global-wordstar-mode wordstar-mode
+ turn-on-wordstar-mode)
(defun wordstar-center-paragraph ()
"Center each line in the paragraph at or after point.
next reply other threads:[~2017-02-12 17:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-12 17:32 Mark Oteiza [this message]
2017-02-12 18:27 ` [PATCH] change wordstar-mode into a minor mode Eli Zaretskii
2017-02-12 20:38 ` Stefan Monnier
2017-02-13 5:33 ` Eli Zaretskii
2017-02-12 18:29 ` Eli Zaretskii
2017-02-12 19:22 ` Mark Oteiza
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170212173200.GA12419@holos.localdomain \
--to=mvoteiza@udel.edu \
--cc=dquagliana@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).