CVS: elisp refdb-mode.el,1.3,1.4

Michael Smith <[email protected]>
Newsgroups gmane.text.refdb.devel
Message-ID <[email protected]>
Update of /cvsroot/refdb/elisp
In directory sc8-pr-cvs1:/tmp/cvs-serv22094

Modified Files:
	refdb-mode.el 
Log Message:
Change for RFE #861367, "consolidate variables containing refdbc"

  http://sourceforge.net/tracker/index.php?func=detail&aid=861367&group_id=26091&atid=385994

Problem:
  The customization buffer of refdb-menu contains a variety of entries
  containing the name/path of the refdbc executable. Changing the
  refdb-refdbc-program variable will change the others only after a
  restart or after reloading .emacs. This is inconvenient if you want
  to switch e.g. to a debug version of the executable.  I'd suggest to
  modify the code so that in all places refdb-refdbc-program is used,
  and use the other variables which so far depend on this to carry
  only additional arguments.

Cause:
  Bad design; custom variables referencing other custom variables
  don't get updated when the values of the referenced custom variables
  change.

Fix:
  All user commands now include a direct call refdb-refdbc-program
  (instead of a call to a custom variable that references
  refdb-refdbc-program.

Affects:
  All commands that call the refdbc program. If you change the value
  of refdb-refdbc-program during a session, the new value will be used
  in all commands that call refdbc (i.e., you don't have to restart
  your Emacs for the changes to take effect). As a consequence of
  this, the following custom variables have been removed:

    refdb-refdbc-program-and-options
    refdb-addref-command
    refdb-getref-command
    refdb-listdb-command

Other:
  Made some minor formatting changes to make code look better in
  outline view.


Index: refdb-mode.el
===================================================================
RCS file: /cvsroot/refdb/elisp/refdb-mode.el,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -U2 -r1.3 -r1.4
--- refdb-mode.el	17 Dec 2003 10:36:31 -0000	1.3
+++ refdb-mode.el	17 Dec 2003 11:32:56 -0000	1.4
@@ -117,7 +117,7 @@
 ;; -------------------------------------------------------------------
 ;;
-;; --------------------
-;;  :: Menu contents ::
-;; --------------------
+;; ------------------------------
+;;;      :: Menu contents ::
+;; ------------------------------
 ;; By default, the RefDB menu provides the following submenus:
 ;;
@@ -305,39 +305,4 @@
   :group 'refdb)
 
-(defcustom refdb-refdbc-program-and-options
-  (format "%s %s"
-	  refdb-refdbc-program
-	  refdb-refdbc-options
-	  )
-  "RefDB command along with global options."
-  :type 'string
-  :group 'refdb)
-
-(defcustom refdb-addref-command
-  (format "%s -C addref"
-	  refdb-refdbc-program-and-options
-	  )
-  "Command for adding references to RefDB."
-  :type 'string
-  :group 'refdb)
-
-(defcustom refdb-getref-command
-  (format "%s -C getref"
-	  refdb-refdbc-program-and-options
-	  )
-  "Command for getting references from RefDB."
-  :type 'string
-  :group 'refdb)
-
-(defcustom refdb-listdb-command
-  (format "%s -C listdb"
-	  refdb-refdbc-program-and-options
-	  )
-  "Command for getting database list from RefDB."
-  :type 'string
-  :group 'refdb)
-
-;; need to have this here to ensure that menu item will be in Tools
-;; menu even if RefDB hasn't been loaded yet.
 (defcustom refdb-menu-suppress-toggle-flag nil
   "*Non-nil means suppress 'RefDB Mode' menu item.
@@ -365,5 +330,5 @@
 
 ;; *******************************************************************
-;; end of user-customizable options, part 1
+;;; end of user-customizable options, part 1
 ;; *******************************************************************
 
@@ -372,6 +337,7 @@
   (setq refdb-selectdb-submenu-contents nil)
   (message
-   "Building list of databases using '%s %s' ..."
-   refdb-listdb-command
+   "Building list of databases using '%s %s -C listdb %s' ..."
+   refdb-refdbc-program
+   refdb-refdbc-options
    refdb-listdb-sql-regexp
    )
@@ -380,10 +346,12 @@
      (with-current-buffer
 	 standard-output
-       (call-process shell-file-name nil '(t nil) nil shell-command-switch
-		     (format "%s %s"
-			     refdb-listdb-command
-			     refdb-listdb-sql-regexp
-			     )
-		     )
+       (call-process
+	shell-file-name nil '(t nil) nil shell-command-switch
+	(format "%s %s -C listdb %s"
+		refdb-refdbc-program
+		refdb-refdbc-options
+		refdb-listdb-sql-regexp
+		)
+	)
        )
      )
@@ -559,6 +527,7 @@
 	     (point) (mark)
 	     (format
-	      "%s %s -d %s -t %s"
-	      refdb-addref-command
+	      "%s %s -C addref %s -d %s -t %s"
+	      refdb-refdbc-program
+	      refdb-refdbc-options
 	      refdb-addref-options
 	      refdb-database
@@ -567,6 +536,7 @@
 	     "*refdb-output*" nil "*refdb-messages*")
 	     (message
-	      "Displaying output for '%s %s -d %s -t %s'"
-	      refdb-addref-command
+	      "Displaying output for '%s %s -C addref %s -d %s -t %s'"
+	      refdb-refdbc-program
+	      refdb-refdbc-options
 	      refdb-addref-options
 	      refdb-database
@@ -604,10 +574,13 @@
 	(shell-command
 	 (format
-	  "%s -d %s -t %s :%s:=%s"
-	  refdb-getref-command
+	  "%s %s -C getref %s -d %s -t %s :%s:=%s"
+	  refdb-refdbc-program
+	  refdb-refdbc-options
+	  refdb-getref-options
 	  refdb-database
 	  refdb-output-type
 	  field
-	  value)
+	  value
+	  )
 	 "*refdb-output*" "*refdb-messages*")
 	
@@ -621,6 +594,8 @@
     )
   (message
-   "Displaying output for %s -d %s -t %s :%s:=%s"
-   refdb-getref-command
+   "Displaying output for '%s %s -C getref %s -d %s -t %s :%s:=%s'"
+   refdb-refdbc-program
+   refdb-refdbc-options
+   refdb-getref-options
    refdb-database
    refdb-output-type
@@ -714,9 +689,12 @@
 	(shell-command
 	 (format
-	  "%s -d %s -t %s %s"
-	  refdb-getref-command
+	  "%s %s -C getref %s -d %s -t %s %s"
+	  refdb-refdbc-program
+	  refdb-refdbc-options
+	  refdb-getref-options
 	  refdb-database
 	  refdb-output-type
-	  searchstring)
+	  searchstring
+	  )
 	 "*refdb-output*" nil)
 	
@@ -730,6 +708,8 @@
     )
   (message
-   "Displaying output for %s -d %s -t %s %s"
-   refdb-getref-command
+   "Displaying output for '%s %s -C getref %s -d %s -t %s %s"
+   refdb-refdbc-program
+   refdb-refdbc-options
+   refdb-getref-options
    refdb-database
    refdb-output-type
@@ -941,5 +921,5 @@
   )
 ;; *******************************************************************
-;; end of user-customizable options, part 2
+;;; end of user-customizable options, part 2
 ;; *******************************************************************
 



-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.