Debian Codegraph @

lisp/idutils.el

raw
1 ;;; idutils.el --- emacs interface to `lid -R grep', a.k.a. `gid'
2 ;;; Copyright (C) 1995-2020 Free Software Foundation, Inc.
3 ;;; Greg McGary <[email protected]>.
4
5 ;; This file is part of GNU idutils.
6
7 ;; GNU idutils 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 3, or (at your option)
10 ;; any later version.
11
12 ;; GNU idutils 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 this program. If not, see <http://www.gnu.org/licenses/>.
19
20 ;;; This package provides the tools meant to help editing PO files,
21 ;;; as documented in the GNU idutils user's manual. See this manual
22 ;;; for user documentation, which is not repeated here.
23
24 ;;; To install, merely put this file somewhere GNU Emacs will find it,
25 ;;; then add the following lines to your .emacs file:
26 ;;;
27 ;;; (autoload 'gid "idutils" "run idutils' gid command" t)
28 ;;;
29 ;;; You may also adjust some customizations variables, below, by defining
30 ;;; them in your .emacs file.
31
32 (require 'compile)
33 (require 'thingatpt)
34
35 (defvar gid-command "gid" "The command run by the gid function.")
36
37 (defvar gid-mode-font-lock-keywords
38 '(("^\\(Compilation\\|Gid\\) \\(started\\|finished\\).*"
39 (0 '(face nil message nil help-echo nil mouse-face nil) t))))
40
41 (defvar gid-use-search-in-buffer-name t
42 "If non-nil, use the search string in the gid buffer's name.")
43
44 (define-compilation-mode gid-mode "Gid"
45 "Specialization of compilation-mode for use with gid."
46 nil)
47
48 ;;;###autoload
49 (defun gid (args)
50 "Run gid, with user-specified ARGS, and collect output in a buffer.
51 While gid runs asynchronously, you can use the \\[next-error] command to
52 find the text that gid hits refer to. The command actually run is
53 defined by the gid-command variable."
54 (interactive (list (read-shell-command
55 (concat "Run " gid-command " (with args): ") (thing-at-point 'symbol))))
56 (let (compile-command
57 (compilation-error-regexp-alist grep-regexp-alist)
58 (compilation-directory default-directory)
59 (gid-full-buffer-name (concat "*gid-" args "*")))
60 (save-some-buffers (not compilation-ask-about-save) nil)
61 (compilation-start (concat gid-command " " args) 'gid-mode
62 (when gid-use-search-in-buffer-name
63 (function (lambda (ignore)
64 gid-full-buffer-name)))
65 (regexp-quote args))))
66
67 (provide 'idutils)
68
69 ;;; idutils.el ends here