Forum OpenACS Development: Response to duplicate queries in .tcl, .xql, -oracle.xql, -postgresql.xql

Since, the bboard ate some backslashes, I'm reposting:

(defun dcw-find-tag-default ()
  "return a string near the point"
  (interactive "")
  (save-excursion
    (while (looking-at "\sw\|\s_")
      (forward-char 1))
    (if (or (re-search-backward "\sw\|\s_"
				(save-excursion (beginning-of-line) (point))
				t)
	    (re-search-forward "\(\sw\|\s_\)+"
			       (save-excursion (end-of-line) (point))
			       t))
	(progn (goto-char (match-end 0))
	       (buffer-substring (point)
				 (progn (forward-sexp -1)
					(while (looking-at "\s'")
					  (forward-char 1))
					(point)))) nil)))



(defun dcw-find-query ()
  "run grep on selection 
   Uses x-get-selection to get the grep string"
  (interactive "")
  (let* ((file-name 
          (concat (substring 
                   (buffer-file-name) 0 
                   (string-match ".tcl$" (buffer-file-name))) "*.xql")))
    (grep (concat "grep -n "query  *name=.*" 
                  (dcw-find-tag-default) "" " file-name))))

Hope this works.