From xemacs-m  Wed Jul  9 16:10:40 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id QAA17867
	for <xemacs-beta@xemacs.org>; Wed, 9 Jul 1997 16:10:39 -0500 (CDT)
Received: (from hniksic@localhost)
	by jagor.srce.hr (8.8.6/8.8.6) id XAA08657;
	Wed, 9 Jul 1997 23:10:36 +0200 (MET DST)
To: XEmacs Developers <xemacs-beta@xemacs.org>
Subject: Re: gnuserv.el enhancement - "Done" button
References: <25196.868479320@kocrsw12>
X-Attribution: Hrv
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 09 Jul 1997 23:10:36 +0200
In-Reply-To: Mike Scheidler's message of "Wed, 09 Jul 1997 15:15:20 -0500"
Message-ID: <kigsoxoj5ir.fsf@jagor.srce.hr>
Lines: 113
X-Mailer: Gnus v5.4.59/XEmacs 20.3(beta11) - "Stockholm"

Mike Scheidler <c23mts@eng.delcoelect.com> writes:

>   - The :config menu keyword is used to make sure that the button is only
>     displayed for gnuclient buffers.

It is nonnecessary.  Use `add-menu-button' to add the button in the
gnuclient buffers, in the first place.

>   - A customize option exists to control whether the button is
>     displayed or not.  The default is to display it.  Should it
>     default to off instead?

There is no point in having such an option.  I mean, options are a
nice thing, but this is going too far.  If we consider the
functionality valuable, why not add it?

>   - The active/inactive state of the button is determined by a call
>     to gnuserv-buffer-p.

I'm not sure I like this.  `gnuserv-buffer-p' is not a very fast
function.

>   - Being a button, this should probably be on the toolbar instead
>     of the menubar.  Given the current granularity of the toolbar
>     functions, though, this was a lot easier to implement.  Is
>     anybody planning to make manipulation of toolbars easier?

That person would become our hero.

Here is a simpler patch that does the same thing, but doesn't use
undocumented and obsolete functions (like `add-menu-item-1').  Please
let me know whether it works for you.

--- lisp/packages/gnuserv.el.orig	Wed Jul  9 22:54:39 1997
+++ lisp/packages/gnuserv.el	Wed Jul  9 23:09:33 1997
@@ -1,7 +1,7 @@
 ;;; gnuserv.el --- Lisp interface code between Emacs and gnuserv
 ;; Copyright (C) 1989-1997 Free Software Foundation, Inc.
 
-;; Version: 3.7
+;; Version: 3.8
 ;; Author: Andy Norman (ange@hplb.hpl.hp.com), originally based on server.el
 ;;         Hrvoje Niksic <hniksic@srce.hr>
 ;; Maintainer: Jan Vroonhof <vroonhof@math.ethz.ch>,
@@ -75,6 +75,9 @@
 ;; Hrvoje Niksic <hniksic@srce.hr> May/1997
 ;;     Completely rewritten.  Now uses `defstruct' and other CL stuff
 ;;     to define clients cleanly.  Many thanks to Dave Gillespie!
+;;
+;; Mike Scheidler <c23mts@eng.delcoelect.com> July, 1997
+;;     Added 'Done' button to the menubar.
 
 
 ;;; Code:
@@ -132,8 +135,8 @@
 
 (defcustom gnuserv-done-function 'kill-buffer 
   "*Function used to remove a buffer after editing.
-It is called with one BUFFER argument.  Functions such as 'kill-buffer' and
-'bury-buffer' are good values. See also `gnuserv-done-temp-file-function'."
+It is called with one BUFFER argument.  Functions such as `kill-buffer' and
+`bury-buffer' are good values. See also `gnuserv-done-temp-file-function'."
   :type '(radio (function-item kill-buffer)
 		(function-item bury-buffer)
 		(function :tag "Other"))
@@ -141,8 +144,8 @@
 
 (defcustom gnuserv-done-temp-file-function 'kill-buffer
   "*Function used to remove a temporary buffer after editing.
-It is called with one BUFFER argument.  Functions such as 'kill-buffer' and
- 'bury-buffer' are good values. See also `gnuserv-done-temp-file-function'."
+It is called with one BUFFER argument.  Functions such as `kill-buffer' and
+`bury-buffer' are good values. See also `gnuserv-done-temp-file-function'."
   :type '(radio (function-item kill-buffer)
 		(function-item bury-buffer)
 		(function :tag "Other"))
@@ -438,11 +441,13 @@
 		     gnuserv-find-file-function)
 		   path)
 	  (goto-line line)
-	  (run-hooks 'gnuserv-visit-hook)
 	  ;; Don't memorize the quick and view buffers.
 	  (unless (or quick view)
 	    (pushnew (current-buffer) (gnuclient-buffers client))
-	    (setq gnuserv-minor-mode t))
+	    (setq gnuserv-minor-mode t)
+	    ;; Add the "Done" button to the menubar.
+	    (add-menu-button nil ["Done" gnuserv-edit t]))
+	  (run-hooks 'gnuserv-visit-hook)
 	  (pop list)))
       (cond
        ((and (or quick view)
@@ -592,11 +597,13 @@
     (callf2 delq buffer (gnuclient-buffers client))
     (when (null (gnuclient-buffers client))
       (gnuserv-kill-client client)))
-  ;; Get rid of the buffer
+  ;; Get rid of the buffer.
   (save-excursion
     (set-buffer buffer)
     (run-hooks 'gnuserv-done-hook)
     (setq gnuserv-minor-mode nil)
+    ;; Delete the menu button.
+    (delete-menu-item '("Done"))
     (funcall (if (gnuserv-temp-file-p buffer)
 		 gnuserv-done-temp-file-function
 	       gnuserv-done-function)


-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Idle RAM is the Devil's playground.

