From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mark Oteiza Newsgroups: gmane.emacs.devel Subject: [PATCH] change wordstar-mode into a minor mode Date: Sun, 12 Feb 2017 12:32:00 -0500 Message-ID: <20170212173200.GA12419@holos.localdomain> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1486920740 31323 195.159.176.226 (12 Feb 2017 17:32:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 12 Feb 2017 17:32:20 +0000 (UTC) User-Agent: Mutt/1.7.2+46 (7c97a8af8718) (2016-11-26) Cc: Douglas Quagliana To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Feb 12 18:32:10 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ccy0O-0007Qx-MS for ged-emacs-devel@m.gmane.org; Sun, 12 Feb 2017 18:32:08 +0100 Original-Received: from localhost ([::1]:52874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccy0U-0007gJ-FQ for ged-emacs-devel@m.gmane.org; Sun, 12 Feb 2017 12:32:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccy0N-0007fz-02 for emacs-devel@gnu.org; Sun, 12 Feb 2017 12:32:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccy0J-0001CI-SZ for emacs-devel@gnu.org; Sun, 12 Feb 2017 12:32:07 -0500 Original-Received: from mail-qk0-x241.google.com ([2607:f8b0:400d:c09::241]:36361) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ccy0J-0001CA-Lm for emacs-devel@gnu.org; Sun, 12 Feb 2017 12:32:03 -0500 Original-Received: by mail-qk0-x241.google.com with SMTP id p22so3759745qka.3 for ; Sun, 12 Feb 2017 09:32:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=imoxekisOv6cNfWWDzQGd7V+IhynY8csPhUTljoNhUQ=; b=Vn0FSRx9xNypmsCXGlDLXzlrxk5pbvspcuDX0AkzaakzDx1CbiXuHNCPJIQx8fXnQg OA5kntb1RVLD382ooKrdcUAHbk4vvM02wQ8HbeiZD8U6fQ1/3SxPIMeuMg/m/SLfq4pz 2TfJXJ4QJP6WNY7nqQfV2NNhaldf+0Td6yM4qWpt1f+cMfZcry1sJduKebsIZD/0gF9L btZ2AfalQI9mgefUpoLjtMfewz0OCF0W+vh308RhNMUye1lyoCH3bL/OgCm9GWvDn6Ve jfbeam8VeC3gW3t7MUESTgZpJmzibo99OXpJ2/WHzI84QGIJ8LUJphMvGfPYP1c6itFP PbAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=imoxekisOv6cNfWWDzQGd7V+IhynY8csPhUTljoNhUQ=; b=sPEFu9BwMPP5nrBtAuQ6Ef/n1Ve+j0La4N4FZxlyUDs9FKehgwgvnnxDNoHwc9agWu 2GWQqNy3eKNtRysFIPr9jCbDqAzlfDSXc65IyO4wIPrlsFb+p5FYEqhSE7rVBm3/f80y d18rPJCncMUXk6J2DeLkadovItEVjyhthQEtVBb1v5rQScKE/lXYFSBEIRMq9LZ0+hpw SEc6lahhas9Ln7oHnRPyFJSXmLhNzJnrehtS4xB0Q5jAyg/r6AA0ORB2gQc+xH4+iox5 JcvfaOh6gBAfz6BJNlzNhomVy+HEapi30XxDM/oN2+pxk/MjsTWke79DQb7U1S03Sbb6 LNQg== X-Gm-Message-State: AMke39nAZWd3tnKxS42UnCOsLxmZQ85utVLbfyHh/6eWICAX/T72wteGuR7kp6KshhOFCG2Y X-Received: by 10.55.66.68 with SMTP id p65mr16959182qka.187.1486920721517; Sun, 12 Feb 2017 09:32:01 -0800 (PST) Original-Received: from holos.localdomain (pool-173-67-40-97.bltmmd.fios.verizon.net. [173.67.40.97]) by smtp.gmail.com with ESMTPSA id t202sm3916570qke.67.2017.02.12.09.32.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Feb 2017 09:32:00 -0800 (PST) Original-Received: by holos.localdomain (Postfix, from userid 1000) id 2FF51695A3; Sun, 12 Feb 2017 12:32:00 -0500 (EST) Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400d:c09::241 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212296 Archived-At: 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.