[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 1d6b241 214/357: [gnugo] Use ‘define-derived-mod
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 1d6b241 214/357: [gnugo] Use ‘define-derived-mode’ for GNUGO Board mode. |
Date: |
Sun, 29 Nov 2020 14:51:24 -0500 (EST) |
branch: externals/gnugo
commit 1d6b24123337a75b0d11fec21a11534bf7599fdb
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[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’.
---
NEWS | 1 +
gnugo.el | 13 ++++---------
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/NEWS b/NEWS
index 22c447d..c2da1c4 100644
--- a/NEWS
+++ b/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/gnugo.el b/gnugo.el
index 14969c7..28fcec5 100644
--- a/gnugo.el
+++ b/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
- [elpa] externals/gnugo 3f13bbf 168/357: [gnugo] Make ‘=’ also display move number., (continued)
- [elpa] externals/gnugo 3f13bbf 168/357: [gnugo] Make ‘=’ also display move number., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo f3c90cd 187/357: [gnugo] Make ‘C-u F’ add the blurb as a comment to the last node., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo bcc912b 164/357: [gnugo frolic int] Add var selection to awakening parameterization., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 66c29d0 197/357: [gnugo int] Add abstraction: gnugo--gate-game-over, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5bbec0e 179/357: [gnugo int] Incorporate ‘gnugo-note’ into unique caller., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 82b6000 198/357: [gnugo] Mention ‘gnugo-frolic-mode-hook’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 32e8547 199/357: [gnugo int] Add abstraction: gnugo--user-play, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 001228c 205/357: [gnugo] Drop support for ‘(gnugo-move-history 'count)’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 106a279 211/357: [gnugo int] Consolidate paren overlays access., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 17d907d 210/357: [gnugo int] Shave one ‘gnugo-other’ call., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1d6b241 214/357: [gnugo] Use ‘define-derived-mode’ for GNUGO Board mode.,
Stefan Monnier <=
- [elpa] externals/gnugo 167ba89 213/357: [gnugo int] Decruft: Streamline game-over handling on SGF load., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo b3d3da0 220/357: [gnugo int] Use functional style more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo e96b88b 218/357: [gnugo] Decruft: Use ‘gnugo-program’ directly as executable., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 3670b0b 228/357: [gnugo] On SGF load, leave cursor at last user board position., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1020a7f 237/357: [gnugo int] Simplify towards-root loop termination check., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 7114ed6 234/357: [gnugo int] Add abstraction: gnugo--mem-with-played-stone, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 9ae1363 236/357: [gnugo] Internalize ‘gnugo-magic-undo’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a92e184 255/357: fixup! [gnugo int] Decorate w/ plist instead of alist., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 71e1500 245/357: [gnugo] Fix bug: Use ‘gnugo-gate’ for abdication enable., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 46f49e3 246/357: [gnugo int] Use ‘gnugo-current-player’ more., Stefan Monnier, 2020/11/29