From xemacs-m  Wed Jul  9 15:15:56 1997
Received: from ns1.eds.com (ns1.eds.com [192.85.154.78])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id PAA16430
	for <xemacs-beta@xemacs.org>; Wed, 9 Jul 1997 15:15:55 -0500 (CDT)
Received: from nnsa.eds.com (nnsa.eds.com [130.174.31.78])
	by ns1.eds.com (8.8.6/8.8.5) with ESMTP id QAA22584
	for <xemacs-beta@xemacs.org>; Wed, 9 Jul 1997 16:15:54 -0400 (EDT)
Received: from kocrsv04.delcoelect.com (kocrsv04.delcoelect.com [144.250.100.205])
	by nnsa.eds.com (8.8.5/8.8.5) with ESMTP id QAA12898
	for <xemacs-beta@xemacs.org>; Wed, 9 Jul 1997 16:15:24 -0400 (EDT)
Received: from kocrsw12.delcoelect.com (kocrsw12.delcoelect.com [144.250.106.18]) by kocrsv04.delcoelect.com (8.7.5/8.7.3) with SMTP id PAA11356 for <xemacs-beta@xemacs.org>; Wed, 9 Jul 1997 15:15:23 -0500 (EST)
Received: from kocrsw12 by kocrsw12.delcoelect.com (SMI-8.6/SMI-SVR4)
	id PAA25198; Wed, 9 Jul 1997 15:15:21 -0500
X-Mailer: exmh version 2.0gamma 1/27/97
To: xemacs-beta@xemacs.org
Subject: gnuserv.el enhancement - "Done" button 
X-Attribution: mts
X-Face: 4tk3bJx]I+QTZ|=]*1+Z){9+;5u_hK*NBeZK6[+B+iB%bVuOJ%^uK~fIG}O-}%WLX*D^aW>
 Gv8E3Xtz0\N&fQl^:pj<K{xM`:d>pPt:9lF-YXB%O)?@rd?*/jE!s94`?]:jJ#C5RDP:;Mr.3lwo`0
 {vIT+<{%IRwe]vLd]7>\X|*z{TUX_t;?TPcOLBMIv8_V92!Vk(*DJVU~0M[`5D^PAWLniO1?YYWArM
 U*j9o+>?1MWi.lO?F-?aVt:qQ8OaG?R}B:I!7S_+KuzxZ.f9M@$z#n\bG2$Q2{od
Date: Wed, 09 Jul 1997 15:15:20 -0500
Message-ID: <25196.868479320@kocrsw12>
From: Mike Scheidler <c23mts@eng.delcoelect.com>

Here are a couple of patches that add a "Done" button to the menubar of
every gnuclient buffer.  I've wanted something like this for quite awhile,
and finally decided to tackle it myself.  Functionally, it does the same
thing as the C-x # key binding, which I find to be kind of awkward.

The patches are small, but there are a few design/implementation issues
that I'll open up for comment.  I'll try to rework anything that seems
amiss.

  - The :config menu keyword is used to make sure that the button is only
    displayed for gnuclient buffers.  Is this its intended purpose?  (I was
    surprised to see that this feature is used in only one other place in
    all of the the elisp code.)

  - In conjunction with :config, the menubar-configuration variable is made 
    buffer-local, with the value 'gnuserv added to regulate the display of
    the button.  Are there any unwanted side-effects of making this
    buffer-local?

  - 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?

  - The active/inactive state of the button is determined by a call to
    gnuserv-buffer-p.  This may be a belt-and-suspenders approach, but it
    shouldn't hurt anything.  Am I being overly cautious?

  - 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?

  - I had to add `:config' to the list of valid menu items in function
    check-menu-syntax in prim/menubar.el in order to get my changes to
    byte-compile.  Is it okay to be added to the list, or is it not there
    for a reason?  (While I was there, I noticed a `:full' keyword was
    defined, but couldn't find any description of its purpose.  Does anyone
    know?)

The ChangeLog entry and patches follow.

Mike

--------------------------------------------------------------------

1997-07-09  Mike Scheidler  <c23mts@eng.delcoelect.com>

	* packages/gnuserv.el: Added "Done" button to the menubar.


--- packages/gnuserv.el.orig	Tue Jul  8 23:31:28 1997
+++ packages/gnuserv.el	Wed Jul  9 13:56:44 1997
@@ -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:
@@ -194,6 +197,11 @@
   :type 'boolean
   :group 'gnuserv)
 
+(defcustom gnuserv-use-done-button t
+  "*Non-nil means to display a \"Done\" button in the menubar which performs the same action as the key binding \\[gnuserv-edit]."
+  :type 'boolean
+  :group 'gnuserv)
+
 (defcustom gnuserv-temp-file-regexp "^/tmp/Re\\|/draft$"
   "*Regexp which should match filenames of temporary files deleted
 and reused by the programs that invoke the Emacs server."
@@ -438,6 +446,15 @@
 		     gnuserv-find-file-function)
 		   path)
 	  (goto-line line)
+          (if gnuserv-use-done-button
+              (progn
+                (make-local-variable 'menubar-configuration)
+                (add-to-list 'menubar-configuration 'gnuserv)
+                (add-menu-item-1 t nil
+                                 ["Done" gnuserv-edit
+                                  :config gnuserv
+                                  :active (gnuserv-buffer-p (current-buffer))]
+                                 nil)))
 	  (run-hooks 'gnuserv-visit-hook)
 	  ;; Don't memorize the quick and view buffers.
 	  (unless (or quick view)
--- prim/menubar.el.orig	Wed Dec 18 17:42:55 1996
+++ prim/menubar.el	Wed Jul  9 14:43:03 1997
@@ -133,7 +133,7 @@
 		(while (< i L)
 		  (setq item (aref menuitem i))
 		  (cond ((not (memq item '(:active :suffix :keys :style
-						   :full :included :selected)))
+					   :config :full :included :selected)))
 			 (signal 'error
 				 (list (if (keywordp item)
 					   "unknown menu item keyword"


