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

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

[elpa] 02/04: [gnugo] Replace ‘gnugo -toggle-image-display-command’ w/ ‘


From: Thien-Thi Nguyen
Subject: [elpa] 02/04: [gnugo] Replace ‘gnugo -toggle-image-display-command’ w/ ‘gnugo-image- display-mode’.
Date: Sat, 03 May 2014 05:57:38 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 887421cd6084807b39703db731a52c613eba4e27
Author: Thien-Thi Nguyen <address@hidden>
Date:   Fri May 2 15:50:03 2014 +0200

    [gnugo] Replace ‘gnugo-toggle-image-display-command’ w/ 
‘gnugo-image-display-mode’.
    
    * packages/gnugo/gnugo.el (gnugo-image-display-mode): New command.
    (gnugo-toggle-image-display-command): Delete command.
    (gnugo-board-mode-map): Update binding for ‘i’.
---
 packages/gnugo/NEWS     |    1 +
 packages/gnugo/gnugo.el |   17 +++++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/packages/gnugo/NEWS b/packages/gnugo/NEWS
index b873710..7153073 100644
--- a/packages/gnugo/NEWS
+++ b/packages/gnugo/NEWS
@@ -21,6 +21,7 @@ NB: "RCS: X..Y " means that the particular release includes
   - changes to ‘gnugo-xpms’
     - now a normal var, and not a feature
     - value can be a function to compute XPMs
+  - ‘gnugo-image-display-mode’ replaces ‘gnugo-toggle-image-display-command’
   - PASS for SZ <= 19 normalized to "" on read, written as ""
   - ‘=’ also displays move number of the stone (if any) at that position
   - ‘C-u F’ adds the (abbreviated) blurb as a comment to the last node
diff --git a/packages/gnugo/gnugo.el b/packages/gnugo/gnugo.el
index ffa2ebb..e95c91d 100644
--- a/packages/gnugo/gnugo.el
+++ b/packages/gnugo/gnugo.el
@@ -2331,11 +2331,16 @@ which placed the stone at point."
    (cond ((numberp count) count)
          ((consp count) (car count)))))
 
-(defun gnugo-toggle-image-display-command () ; ugh
-  "Toggle use of images to display the board, then refresh."
-  (interactive)
-  (gnugo-toggle-image-display)
-  (save-excursion (gnugo-refresh)))
+(define-minor-mode gnugo-image-display-mode
+  "If enabled, display the board using images.
+See function `display-images-p' and variable `gnugo-xpms'."
+  :variable
+  ((gnugo-get :display-using-images)
+   .
+   (lambda (bool)
+     (unless (eq bool (gnugo-get :display-using-images))
+       (gnugo-toggle-image-display)
+       (save-excursion (gnugo-refresh))))))
 
 (defsubst gnugo--node-with-played-stone (pos &optional noerror)
   (car (gnugo--mem-with-played-stone pos noerror)))
@@ -2728,7 +2733,7 @@ See `gnugo-board-mode' for a full list of commands."
           ("h"        . gnugo-move-history)
           ("L"        . gnugo-frolic-in-the-leaves)
           ("\C-c\C-l" . gnugo-frolic-in-the-leaves)
-          ("i"        . gnugo-toggle-image-display-command)
+          ("i"        . gnugo-image-display-mode)
           ("w"        . gnugo-worm-stones)
           ("W"        . gnugo-worm-data)
           ("d"        . gnugo-dragon-stones)



reply via email to

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