summaryrefslogtreecommitdiffstats
path: root/gid.el
diff options
context:
space:
mode:
authorGreg McGary <greg@mcgary.org>1997-04-18 06:38:38 +0000
committerGreg McGary <greg@mcgary.org>1997-04-18 06:38:38 +0000
commit8c13e09279f361e18173f9e237c454af0ab33299 (patch)
treef66f1ed48a98145460da6a01926017825cebbdf2 /gid.el
parent509a418a05787df17f1e942593541798facb5acf (diff)
downloadidutils-8c13e09279f361e18173f9e237c454af0ab33299.tar.gz
idutils-8c13e09279f361e18173f9e237c454af0ab33299.tar.bz2
idutils-8c13e09279f361e18173f9e237c454af0ab33299.zip
imported from mkid-3.0.9r3_0_8_2
Diffstat (limited to 'gid.el')
-rw-r--r--gid.el49
1 files changed, 30 insertions, 19 deletions
diff --git a/gid.el b/gid.el
index c5e0e2f..01f855f 100644
--- a/gid.el
+++ b/gid.el
@@ -1,22 +1,33 @@
-;;; put this in your GnuEmacs startup file '~/.emacs' .
-;;; or autoload it from some other file. -wsr
+;;; put this in your GNU emacs startup file '~/.emacs' .
+;;; or byte-compile it and autoload from somewhere else.
-(require 'symfunc)
+(require 'compile)
+(provide 'gid)
-(defun gid (command)
- "Run gid, with user-specified args, and collect output in a buffer.
-While gid runs asynchronously, you can use the \\[next-error] command
-to find the text that gid hits refer to."
- (interactive (list (read-input "Run gid (with args): "
- (symbol-around-point))))
- (require 'compile)
- (setq command (concat "gid " command))
- (compile1 command "No more gid hits" command))
+(defvar gid-command "gid" "The command run by the gid function.")
-(defun aid (command)
- "Run aid, with user-specified args, and collect output in a buffer."
- (interactive (list (read-input "Run aid (with args): "
- (symbol-around-point))))
- (require 'compile)
- (setq command (concat "aid " command))
- (compile1 command "No aid hits" command))
+(defun gid (args)
+ "Run gid, with user-specified ARGS, and collect output in a buffer.
+While gid runs asynchronously, you can use the \\[next-error] command to
+find the text that gid hits refer to. The command actually run is
+defined by the gid-command variable."
+ (interactive (list (read-input
+ (concat "Run " gid-command " (with args): ") (word-around-point))))
+ (let (compile-command
+ (compilation-error-regexp-alist grep-regexp-alist)
+ (compilation-buffer-name-function (lambda (mode)
+ (concat "*" gid-command " " args "*"))))
+ ;; For portability to v19, use compile rather than compile-internal.
+ (compile (concat gid-command " " args))))
+
+(defun word-around-point ()
+ "Return the word around the point as a string."
+ (save-excursion
+ (if (not (eobp))
+ (forward-char 1))
+ (forward-word -1)
+ (forward-word 1)
+ (forward-sexp -1)
+ (buffer-substring (point) (progn
+ (forward-sexp 1)
+ (point)))))