annotate lisp/cedet/ede/autoconf-edit.el @ 110632:081b4ec99498

* lisp/calendar/appt.el (appt-check): Minor simplification.
author Glenn Morris <rgm@gnu.org>
date Mon, 27 Sep 2010 20:00:09 -0700
parents b150a06c6999
children 56b71cddc9c5 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; ede/autoconf-edit.el --- Keymap for autoconf
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105377
diff changeset
3 ;; Copyright (C) 1998, 1999, 2000, 2009, 2010 Free Software Foundation, Inc.
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Keywords: project
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; (at your option) any later version.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; GNU General Public License for more details.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;;; Commentary:
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;; Autoconf editing and modification support, and compatibility layer
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; for Emacses w/out autoconf mode built in.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;;; Code:
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 (require 'autoconf)
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
30 (declare-function ede-srecode-setup "ede/srecode")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
31 (declare-function ede-srecode-insert "ede/srecode")
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 (defun autoconf-new-program (rootdir program testfile)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 "Initialize a new configure.in in ROOTDIR for PROGRAM using TESTFILE.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ROOTDIR is the root directory of a given autoconf controlled project.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 PROGRAM is the program to be configured.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 TESTFILE is the file used with AC_INIT.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 configure the initial configure script using `autoconf-new-automake-string'"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (interactive "DRoot Dir: \nsProgram: \nsTest File: ")
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
40 (require 'ede/srecode)
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (if (bufferp rootdir)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 (set-buffer rootdir)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 (let ((cf1 (expand-file-name "configure.in" rootdir))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (cf2 (expand-file-name "configure.ac" rootdir)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 (if (and (or (file-exists-p cf1) (file-exists-p cf2))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 (not (y-or-n-p (format "File %s exists. Start Over? "
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 (if (file-exists-p cf1)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 cf1 cf2)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 ))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 (error "Quit"))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 (find-file cf2)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 ;; Note, we only ask about overwrite if a string/path is specified.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 (erase-buffer)
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
54 (ede-srecode-setup)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
55 (ede-srecode-insert
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
56 "file:ede-empty"
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
57 "TEST_FILE" testfile
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
58 "PROGRAM" program)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
59 )
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 (defvar autoconf-preferred-macro-order
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 '("AC_INIT"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 "AM_INIT_AUTOMAKE"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 "AM_CONFIG_HEADER"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 ;; Arg parsing
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 "AC_ARG_ENABLE"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 "AC_ARG_WITH"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 ;; Programs
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 "AC_PROG_MAKE_SET"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 "AC_PROG_AWK"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 "AC_PROG_CC"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 "AC_PROG_CC_C_O"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 "AC_PROG_CPP"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 "AC_PROG_CXX"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 "AC_PROG_CXXCPP"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 "AC_ISC_POSIX"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 "AC_PROG_F77"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 "AC_PROG_GCC_TRADITIONAL"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 "AC_PROG_INSTALL"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 "AC_PROG_LEX"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 "AC_PROG_LN_S"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 "AC_PROG_RANLIB"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 "AC_PROG_YACC"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 "AC_CHECK_PROG"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 "AC_CHECK_PROGS"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 "AC_PROG_LIBTOOL"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 ;; Libraries
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 "AC_CHECK_LIB"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 "AC_PATH_XTRA"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 ;; Headers
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 "AC_HEADER_STDC"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 "AC_HEADER_SYS_WAIT"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 "AC_HEADER_TIME"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 "AC_HEADERS"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 ;; Typedefs, structures
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 "AC_TYPE_PID_T"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 "AC_TYPE_SIGNAL"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 "AC_TYPE_UID_T"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 "AC_STRUCT_TM"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 ;; Compiler characteristics
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 "AC_CHECK_SIZEOF"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 "AC_C_CONST"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 ;; Library functions
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 "AC_CHECK_FUNCS"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 "AC_TRY_LINK"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 ;; System Services
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 ;; Other
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 "AM_PATH_LISPDIR"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 "AM_INIT_GUILE_MODULE"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 ;; AC_OUTPUT is always last
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 "AC_OUTPUT"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 )
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 "List of macros in the order that they prefer to occur in.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 This helps when inserting a macro which doesn't yet exist
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 by positioning it near other macros which may exist.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 From the autoconf manual:
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 `AC_INIT(FILE)'
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 checks for programs
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 checks for libraries
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 checks for header files
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 checks for typedefs
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 checks for structures
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 checks for compiler characteristics
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 checks for library functions
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 checks for system services
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 `AC_OUTPUT([FILE...])'")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (defvar autoconf-multiple-macros
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 '("AC_ARG_ENABLE"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 "AC_ARG_WITH"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 "AC_CHECK_PROGS"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 "AC_CHECK_LIB"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 "AC_CHECK_SIZEOF"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 "AC_TRY_LINK"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 )
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 "Macros which appear multiple times.")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 (defvar autoconf-multiple-multiple-macros
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 '("AC_HEADERS" "AC_CHECK_FUNCS")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 "Macros which appear multiple times, and perform multiple queries.")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (defun autoconf-in-macro (macro)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 "Non-nil if point is in a macro of type MACRO."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 (save-excursion
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 (beginning-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 (looking-at (concat "\\(A[CM]_" macro "\\|" macro "\\)"))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
148 (defun autoconf-find-last-macro (macro &optional ignore-bol)
105333
51ba3b848c03 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104496
diff changeset
149 "Move to the last occurrence of MACRO in FILE, and return that point.
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 The last macro is usually the one in which we would like to insert more
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 items such as CHECK_HEADERS."
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
152 (let ((op (point)) (atbol (if ignore-bol "" "^")))
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (goto-char (point-max))
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
154 (if (re-search-backward (concat atbol (regexp-quote macro) "\\s-*\\((\\|$\\)") nil t)
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (progn
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
156 (unless ignore-bol (beginning-of-line))
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 (point))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 (goto-char op)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 nil)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (defun autoconf-parameter-strip (param)
105333
51ba3b848c03 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104496
diff changeset
162 "Strip the parameter PARAM of whitespace and miscellaneous characters."
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
163 ;; force greedy match for \n.
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
164 (when (string-match "\\`\n*\\s-*\\[?\\s-*" param)
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (setq param (substring param (match-end 0))))
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
166 (when (string-match "\\s-*\\]?\\s-*\\'" param)
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 (setq param (substring param 0 (match-beginning 0))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 param)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
170 (defun autoconf-parameters-for-macro (macro &optional ignore-bol ignore-case)
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 "Retrieve the parameters to MACRO.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 Returns a list of the arguments passed into MACRO as strings."
110526
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
173 (let ((case-fold-search ignore-case))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
174 (save-excursion
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
175 (when (autoconf-find-last-macro macro ignore-bol)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
176 (forward-sexp 1)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
177 (mapcar
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
178 #'autoconf-parameter-strip
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
179 (when (looking-at "(")
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
180 (let* ((start (+ (point) 1))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
181 (end (save-excursion
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
182 (forward-sexp 1)
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
183 (- (point) 1)))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
184 (ans (buffer-substring-no-properties start end)))
b150a06c6999 Synch EDE to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
185 (split-string ans "," t))))))))
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (defun autoconf-position-for-macro (macro)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 "Position the cursor where a new MACRO could be inserted.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 This will appear at the BEGINNING of the macro MACRO should appear AFTER.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 This is to make it compatible with `autoconf-find-last-macro'.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 Assume that MACRO doesn't appear in the buffer yet, so search
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 the ordering list `autoconf-preferred-macro-order'."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 ;; Search this list backwards.. heh heh heh
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 ;; This lets us do a reverse search easilly.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (let ((ml (member macro (reverse autoconf-preferred-macro-order))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (if (not ml) (error "Don't know how to position for %s yet" macro))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (setq ml (cdr ml))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (goto-char (point-max))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 (while (and ml (not (autoconf-find-last-macro (car ml))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 (setq ml (cdr ml)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 (if (not ml) (error "Could not find context for positioning %s" macro))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 (defun autoconf-insert-macro-at-point (macro &optional param)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 "Add MACRO at the current point with PARAM."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 (insert macro)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 (if param
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (progn
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (insert "(" param ")")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (if (< (current-column) 3) (insert " dnl")))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 (defun autoconf-insert-new-macro (macro &optional param)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 "Add a call to MACRO in the current autoconf file.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 Deals with macro order. See `autoconf-preferred-macro-order' and
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 `autoconf-multi-macros'.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 Optional argument PARAM is the parameter to pass to the macro as one string."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 (cond ((member macro autoconf-multiple-macros)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 ;; This occurs multiple times
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 (or (autoconf-find-last-macro macro)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 (autoconf-position-for-macro macro))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 (forward-sexp 2)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 (end-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 (insert "\n")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 (autoconf-insert-macro-at-point macro param))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 ((member macro autoconf-multiple-multiple-macros)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (if (not param)
105333
51ba3b848c03 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 104496
diff changeset
226 (error "You must have a parameter for %s" macro))
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (if (not (autoconf-find-last-macro macro))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 (progn
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 ;; Doesn't exist yet....
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (autoconf-position-for-macro macro)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (forward-sexp 2)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 (end-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (insert "\n")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (autoconf-insert-macro-at-point macro param))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 ;; Does exist, can we fit onto the current line?
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 (forward-sexp 2)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (down-list -1)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 (if (> (+ (current-column) (length param)) fill-column)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 (insert " " param)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 (up-list 1)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 (end-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 (insert "\n")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 (autoconf-insert-macro-at-point macro param))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 ((autoconf-find-last-macro macro)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 ;; If it isn't one of the multi's, it's a singleton.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 ;; If it exists, ignore it.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 nil)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 (t
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 (autoconf-position-for-macro macro)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 (forward-sexp 1)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 (if (looking-at "\\s-*(")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 (forward-sexp 1))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 (end-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 (insert "\n")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 (autoconf-insert-macro-at-point macro param))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 (defun autoconf-find-query-for-header (header)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 "Position the cursor where HEADER is queried."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 (interactive "sHeader: ")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 (let ((op (point))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 (found t))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 (goto-char (point-min))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 (condition-case nil
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 (while (not
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 (progn
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 (re-search-forward
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 (concat "\\b" (regexp-quote header) "\\b"))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 (save-excursion
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 (beginning-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 (looking-at "AC_CHECK_HEADERS")))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 ;; We depend on the search failing to exit our loop on failure.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 (error (setq found nil)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 (if (not found) (goto-char op))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 found))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 (defun autoconf-add-query-for-header (header)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 "Add in HEADER to be queried for in our autoconf file."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 (interactive "sHeader: ")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 (or (autoconf-find-query-for-header header)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 (autoconf-insert-new-macro "AC_CHECK_HEADERS" header)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 (defun autoconf-find-query-for-func (func)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 "Position the cursor where FUNC is queried."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 (interactive "sFunction: ")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 (let ((op (point))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (found t))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (goto-char (point-min))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 (condition-case nil
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 (while (not
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 (progn
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 (re-search-forward
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 (concat "\\b" (regexp-quote func) "\\b"))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 (save-excursion
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 (beginning-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 (looking-at "AC_CHECK_FUNCS")))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 ;; We depend on the search failing to exit our loop on failure.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 (error (setq found nil)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 (if (not found) (goto-char op))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 found))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302 (defun autoconf-add-query-for-func (func)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 "Add in FUNC to be queried for in our autoconf file."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 (interactive "sFunction: ")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 (or (autoconf-find-query-for-func func)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 (autoconf-insert-new-macro "AC_CHECK_FUNCS" func)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 (defvar autoconf-program-builtin
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 '(("AWK" . "AC_PROG_AWK")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 ("CC" . "AC_PROG_CC")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 ("CPP" . "AC_PROG_CPP")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 ("CXX" . "AC_PROG_CXX")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 ("CXXCPP" . "AC_PROG_CXXCPP")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 ("F77" . "AC_PROG_F77")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 ("GCC_TRADITIONAL" . "AC_PROG_GCC_TRADITIONAL")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 ("INSTALL" . "AC_PROG_INSTALL")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 ("LEX" . "AC_PROG_LEX")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 ("LN_S" . "AC_PROG_LN_S")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 ("RANLIB" . "AC_PROG_RANLIB")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 ("YACC" . "AC_PROG_YACC")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 )
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 "Association list of PROGRAM variables and their built-in MACRO.")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 (defun autoconf-find-query-for-program (prog)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 "Position the cursor where PROG is queried.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 PROG is the VARIABLE to use in autoconf to identify the program.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 PROG excludes the _PROG suffix. Thus if PROG were EMACS, then the
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 variable in configure.in would be EMACS_PROG."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (let ((op (point))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 (found t)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 (builtin (assoc prog autoconf-program-builtin)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 (goto-char (point-min))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 (condition-case nil
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 (re-search-forward
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 (concat "^"
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 (or (cdr-safe builtin)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 (concat "AC_CHECK_PROG\\s-*(\\s-*" prog "_PROG"))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 "\\>"))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (error (setq found nil)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 (if (not found) (goto-char op))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 found))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 (defun autoconf-add-query-for-program (prog &optional names)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 "Add in PROG to be queried for in our autoconf file.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 Optional NAMES is for non-built-in programs, and is the list
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 of possible names."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 (interactive "sProgram: ")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 (if (autoconf-find-query-for-program prog)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 nil
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (let ((builtin (assoc prog autoconf-program-builtin)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 (if builtin
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 (autoconf-insert-new-macro (cdr builtin))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 ;; Not built in, try the params item
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 (autoconf-insert-new-macro "AC_CHECK_PROGS" (concat prog "," names))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 ))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 ;;; Scrappy little changes
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 ;;
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 (defvar autoconf-deleted-text nil
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 "Set to the last bit of text deleted during an edit.")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 (defvar autoconf-inserted-text nil
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 "Set to the last bit of text inserted during an edit.")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (defmacro autoconf-edit-cycle (&rest body)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 "Start an edit cycle, unsetting the modified flag if there is no change.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 Optional argument BODY is the code to execute which edits the autoconf file."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 `(let ((autoconf-deleted-text nil)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 (autoconf-inserted-text nil)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 (mod (buffer-modified-p)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 ,@body
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 (if (and (not mod)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 (string= autoconf-deleted-text autoconf-inserted-text))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 (set-buffer-modified-p nil))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 (defun autoconf-delete-parameter (index)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 "Delete the INDEXth parameter from the macro starting on the current line.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 Leaves the cursor where a new parameter can be inserted.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 INDEX starts at 1."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 (beginning-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 (down-list 1)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 (re-search-forward ", ?" nil nil (1- index))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 (let ((end (save-excursion
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 (re-search-forward ",\\|)" (save-excursion
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 (end-of-line)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 (point)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 (forward-char -1)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 (point))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 (setq autoconf-deleted-text (buffer-substring (point) end))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 (delete-region (point) end)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 (defun autoconf-insert (text)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 "Insert TEXT."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 (setq autoconf-inserted-text text)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 (insert text))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 (defun autoconf-set-version (version)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 "Set the version used with automake to VERSION."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 (if (not (stringp version))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 (signal 'wrong-type-argument '(stringp version)))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 (if (not (autoconf-find-last-macro "AM_INIT_AUTOMAKE"))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (error "Cannot update version")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 ;; Move to correct position.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (autoconf-edit-cycle
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 (autoconf-delete-parameter 2)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406 (autoconf-insert version))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 (defun autoconf-set-output (outputlist)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 "Set the files created in AC_OUTPUT to OUTPUTLIST.
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 OUTPUTLIST is a list of strings representing relative paths
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 to Makefiles, or other files using Autoconf substitution."
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 (if (not (autoconf-find-last-macro "AC_OUTPUT"))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 (error "Cannot update version")
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 (autoconf-edit-cycle
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 (autoconf-delete-parameter 1)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 (autoconf-insert (mapconcat (lambda (a) a) outputlist " ")))))
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 (provide 'ede/autoconf-edit)
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105333
diff changeset
420 ;; arch-tag: 5932c433-4fd4-4d5e-ab35-8effd95a405f
104496
8c4870c15962 * cedet/ede.el, cedet/ede/*.el: New files.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 ;;; ede/autoconf-edit.el ends here