emacs-devel
[Top][All Lists]
Advanced

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

buttons for the ediff control frame


From: Dan Nicolaescu
Subject: buttons for the ediff control frame
Date: Wed, 01 Mar 2006 10:41:25 -0800

[I sent this a few days ago, but it didn't seem to have made it to the
list...]

Understanding how to use the ediff little control frame is kind of
hard for first time users. 
It might help if it had some graphical buttons... 
A few buttons for the most used functions should be enough.
Something like:
          -next + previous
          -copy A->B, B->A
          -revert A, revert B
          -quit
          -help

Attached is a proof of concept hack that uses button widgets. It works
as a demo, but not all the above buttons are present (I didn't find
any existent icons that would fit).  Plus, there are still quite a few
issues to fix.

Opinions? Would this be useful? 

*** ediff-util.el       18 Feb 2006 21:47:52 -0800      1.68
--- ediff-util.el       23 Feb 2006 14:46:52 -0800      
***************
*** 147,156 ****
--- 147,182 ----
    (setq ediff-mode-map nil)
    (ediff-set-keys))
  
+ (defun ediff-add-buttons ()
+   (widget-create 'push-button
+                :tag "next"
+                :help-echo "Ediff next"
+                :tag-glyph "fwd-arrow"
+                :action (lambda (widget &optional event)
+                          (ediff-next-difference)))
+   (widget-create 'push-button
+                :tag "prev"
+                :help-echo "Ediff previous"
+                 :tag-glyph "back-arrow"
+                :action (lambda (widget &optional event)
+                          (ediff-previous-difference)))
+ 
+   (widget-create 'push-button
+                :tag "quit"
+                :help-echo "Ediff quit"
+                 :tag-glyph "exit"
+                :action (lambda (widget &optional event)
+                          (ediff-quit nil)))
+                          ;(ediff-previous-difference)))
+   
+   (widget-setup)
+   )
  
  (defun ediff-setup-keymap ()
    "Set up the keymap used in the control buffer of Ediff."
+   (require 'wid-edit)
    (setq ediff-mode-map (make-sparse-keymap))
+   (set-keymap-parent ediff-mode-map widget-keymap)
    (suppress-keymap ediff-mode-map)
  
    (define-key ediff-mode-map
***************
*** 254,259 ****
--- 280,287 ----
        ))
  
    (define-key ediff-mode-map "m" 'ediff-toggle-wide-display)
+   
+   (add-hook 'ediff-after-setup-control-frame-hook 'ediff-add-buttons)
  
    ;; Allow ediff-mode-map to be referenced indirectly
    (fset 'ediff-mode-map ediff-mode-map)




reply via email to

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