emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 01/03: [gnugo] Use ‘define-de rived-mode’ for GNUGO Board mode.


From: Thien-Thi Nguyen
Subject: [elpa] 01/03: [gnugo] Use ‘define-de rived-mode’ for GNUGO Board mode.
Date: Thu, 17 Apr 2014 15:58:23 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 3e940cb3e680646fc310b7f18256c5dcc5ed461c
Author: Thien-Thi Nguyen <address@hidden>
Date:   Thu Apr 17 15:15:02 2014 +0200

    [gnugo] Use ‘define-derived-mode’ for GNUGO Board mode.
    
    This exposes ‘gnugo-board-mode-hook’ to the vagaries
    of Special mode (in particular ‘special-mode-hook’).
    
    * packages/gnugo/gnugo.el (gnugo-board-mode):
    ...here, removing now-redundant stuff accordingly,
    as well as ‘(put 'gnugo-board-mode 'mode-class 'special)’;
    also, clear ‘buffer-read-only’.
---
 packages/gnugo/NEWS     |    1 +
 packages/gnugo/gnugo.el |   13 ++++---------
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS
index 22c447d..c2da1c4 100644
--- a/packages/gnugo/NEWS
+++ b/packages/gnugo/NEWS
@@ -29,6 +29,7 @@ NB: "RCS: X..Y " means that the particular release includes
   - new command: ‘C-c C-a’ (gnugo-toggle-abdication)
   - new major mode: GNUGO Frolic (gnugo-frolic-mode)
   - ‘gnugo-move-history’ returns last two moves w/ RSEL ‘two’
+  - GNUGO Board mode now derived from Special mode
   - performance improvements
   - of interest to hackers (see source, BI => backward incompatible)
     - dropped var: ‘gnugo-inhibit-refresh’ (BI)
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index 14969c7..28fcec5 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -2378,26 +2378,21 @@ NOTE: At this time, GTP command handling specification 
is still
 ;;;---------------------------------------------------------------------------
 ;;; Major mode for interacting with a GNUGO subprocess
 
-(put 'gnugo-board-mode 'mode-class 'special)
-(defun gnugo-board-mode ()
+(define-derived-mode gnugo-board-mode special-mode "GNUGO Board"
   "Major mode for playing GNU Go.
 Entering this mode runs the normal hook `gnugo-board-mode-hook'.
 In this mode, keys do not self insert.
 
 \\{gnugo-board-mode-map}"
   (buffer-disable-undo)                 ; todo: undo undo undoing
-  (kill-all-local-variables)
-  (use-local-map gnugo-board-mode-map)
+  (setq buffer-read-only nil)           ; todo: make everything else DTRT
   (set (make-local-variable 'font-lock-defaults)
        '(gnugo-font-lock-keywords t))
-  (setq major-mode 'gnugo-board-mode
-        mode-name "GNUGO Board"
-        truncate-lines t)
+  (setq truncate-lines t)
   (add-hook 'kill-buffer-hook 'gnugo-cleanup nil t)
   (set (make-local-variable 'gnugo-state)
        (gnugo--mkht :size (1- 42)))
-  (add-to-invisibility-spec :nogrid)
-  (run-hooks 'gnugo-board-mode-hook))
+  (add-to-invisibility-spec :nogrid))
 
 ;;;---------------------------------------------------------------------------
 ;;; Entry point



reply via email to

[Prev in Thread] Current Thread [Next in Thread]