home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / id-utils-3.2-src.tgz / tar.out / fsf / id-utils / lisp / id-utils.el < prev    next >
Lisp/Scheme  |  1996-09-28  |  2KB  |  64 lines

  1. ;;; id-utils.el -- emacs interface to `lid -R grep', a.k.a. `gid'
  2. ;;; Copyright (C) 1995, 1996 Free Software Foundation, Inc.
  3. ;;; Greg McGary <gkm@gnu.ai.mit.edu>.
  4.  
  5. ;; This file is part of GNU id-utils.
  6.  
  7. ;; GNU id-utils is free software; you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation; either version 2, or (at your option)
  10. ;; any later version.
  11.  
  12. ;; GNU id-utils is distributed in the hope that it will be useful,
  13. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. ;; GNU General Public License for more details.
  16.  
  17. ;; You should have received a copy of the GNU General Public License
  18. ;; along with GNU Emacs; see the file COPYING.  If not, write to the
  19. ;; Free Software Foundation, 59 Temple Place - Suite 330, Boston,
  20. ;; MA 02111-1307, USA.
  21.  
  22. ;;; This package provides the tools meant to help editing PO files,
  23. ;;; as documented in the GNU id-utils user's manual.  See this manual
  24. ;;; for user documentation, which is not repeated here.
  25.  
  26. ;;; To install, merely put this file somewhere GNU Emacs will find it,
  27. ;;; then add the following lines to your .emacs file:
  28. ;;;
  29. ;;;   (autoload 'gid "id-utils")
  30. ;;;
  31. ;;; You may also adjust some customizations variables, below, by defining
  32. ;;; them in your .emacs file.
  33.  
  34. (require 'compile)
  35. (provide 'id-utils)
  36.  
  37. (defvar gid-command "gid" "The command run by the gid function.")
  38.  
  39. (defun gid (args)
  40.   "Run gid, with user-specified ARGS, and collect output in a buffer.
  41. While gid runs asynchronously, you can use the \\[next-error] command to
  42. find the text that gid hits refer to. The command actually run is
  43. defined by the gid-command variable."
  44.   (interactive (list (read-input
  45.      (concat "Run " gid-command " (with args): ") (word-around-point))))
  46.   (let (compile-command
  47.     (compilation-error-regexp-alist grep-regexp-alist)
  48.     (compilation-buffer-name-function '(lambda (mode)
  49.                          (concat "*" gid-command " " args "*"))))
  50.     ;; For portability to v19, use compile rather than compile-internal.
  51.     (compile (concat gid-command " " args))))
  52.  
  53. (defun word-around-point ()
  54.   "Return the word around the point as a string."
  55.   (save-excursion
  56.     (if (not (eobp))
  57.     (forward-char 1))
  58.     (forward-word -1)
  59.     (forward-word 1)
  60.     (forward-sexp -1)
  61.     (buffer-substring (point) (progn
  62.                 (forward-sexp 1)
  63.                 (point)))))
  64.