aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2004-09-15 09:00:10 +0000
committerMiles Bader2004-09-15 09:00:10 +0000
commita63aa6924c6a4bb92dfdb524627c13c791615e2b (patch)
tree771f503928d8f4486f462405107334910302e3ad
parenta88eb4ae4abf8cf3f83ecd4ad08e86db7345ae22 (diff)
parent5c2137b83cb6cf1ffc32e26ff091cf1785a9bf1a (diff)
downloademacs-a63aa6924c6a4bb92dfdb524627c13c791615e2b.tar.gz
emacs-a63aa6924c6a4bb92dfdb524627c13c791615e2b.zip
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-40
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-535 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-536 sync-tree with gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-537 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-538 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-539 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-540 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-541 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-542 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-545 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-546 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-547 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-548 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-549 Use symbol-matching for generic-mode keywords * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-550 Update from CVS * miles@gnu.org--gnu-2004/gnus--devo--0--patch-2 Add {arch}/=cvs-sync-make-log * miles@gnu.org--gnu-2004/gnus--rel--5.8--base-0 Import from Gnus CVS branch V5-8 * miles@gnu.org--gnu-2004/gnus--rel--5.8--patch-1 {arch}/=tagging-method: Add CVS and autoconf grot to junk regexp * miles@gnu.org--gnu-2004/gnus--rel--5.8--patch-2 Use explicit tags for autoconf input files * miles@gnu.org--gnu-2004/gnus--rel--5.8--patch-3 Remove RCS keywords * miles@gnu.org--gnu-2004/gnus--rel--5.8--patch-4 Fix copied explicit id-tags * miles@gnu.org--gnu-2004/gnus--rel--5.8--patch-5 Add {arch}/=cvs-sync-make-log * miles@gnu.org--gnu-2004/gnus--rel--5.8--patch-6 configure.in: Use ifelse instead of m4_if for arch-tag: comment * miles@gnu.org--gnu-2004/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2004/gnus--rel--5.8--base-0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-1 Gnus 5.10, from CVS branch v5-10 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-2 Merge from gnus--rel--5.8 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-3 Use explicit tags for autoconf input files * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-4 sync-tree with gnus--rel--5.8 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-5 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-6 Merge from gnus--rel--5.8 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-7 Remove RCS keywords * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-8 Merge from gnus--rel--5.8 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-9 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-10 Add {arch}/=cvs-sync-make-log * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-11 Merge from gnus--rel--5.8 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-12 Update from CVS: make.bat: Fix line endings around arch-tag. * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-13 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-17 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-21 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-22 Update from CVS: lisp/nndb.el (require): Remove tcp and duplicate cl. * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-23 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-24 lisp/nnimap.el (nnimap-open-connection): Remove extraneous end-paren * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-25 - miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-26 Update from CVS
-rw-r--r--admin/ChangeLog6
-rw-r--r--admin/FOR-RELEASE193
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/ETAGS.EBNF4
-rw-r--r--etc/MORE.STUFF4
-rw-r--r--etc/NEWS36
-rw-r--r--etc/etags.16
-rw-r--r--lib-src/ChangeLog25
-rw-r--r--lib-src/etags.c1215
-rw-r--r--lisp/ChangeLog184
-rw-r--r--lisp/ChangeLog.104
-rw-r--r--lisp/desktop.el168
-rw-r--r--lisp/emacs-lisp/checkdoc.el5
-rw-r--r--lisp/emulation/cua-rect.el3
-rw-r--r--lisp/faces.el4
-rw-r--r--lisp/files.el1
-rw-r--r--lisp/generic.el4
-rw-r--r--lisp/gnus/ChangeLog30
-rw-r--r--lisp/gnus/ChangeLog.216
-rw-r--r--lisp/gnus/gnus-registry.el26
-rw-r--r--lisp/gnus/gnus-sum.el4
-rw-r--r--lisp/gnus/nndb.el8
-rw-r--r--lisp/gnus/nnimap.el7
-rw-r--r--lisp/ibuf-ext.el5
-rw-r--r--lisp/ido.el25
-rw-r--r--lisp/isearch.el8
-rw-r--r--lisp/kmacro.el50
-rw-r--r--lisp/novice.el6
-rw-r--r--lisp/progmodes/compile.el53
-rw-r--r--lisp/progmodes/grep.el13
-rw-r--r--lisp/simple.el3
-rw-r--r--lisp/textmodes/bibtex.el748
-rw-r--r--lisp/textmodes/dns-mode.el198
-rw-r--r--lisp/vc-arch.el32
-rw-r--r--lisp/vc-hooks.el38
-rw-r--r--lisp/vc-mcvs.el32
-rw-r--r--lisp/windmove.el70
-rw-r--r--man/ChangeLog43
-rw-r--r--man/Makefile.in8
-rw-r--r--man/gnus.texi250
-rw-r--r--man/kmacro.texi6
-rw-r--r--man/maintaining.texi6
-rw-r--r--man/makefile.w32-in8
-rw-r--r--man/mini.texi11
-rw-r--r--man/smtpmail.texi7
-rw-r--r--src/ChangeLog84
-rw-r--r--src/Makefile.in78
-rw-r--r--src/alloc.c31
-rw-r--r--src/bytecode.c35
-rw-r--r--src/editfns.c10
-rw-r--r--src/fileio.c6
-rw-r--r--src/msdos.c15
-rw-r--r--src/puresize.h2
-rw-r--r--src/xdisp.c9
-rw-r--r--src/xfaces.c59
-rw-r--r--src/xselect.c10
56 files changed, 2455 insertions, 1461 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog
index dafae3c1158..4876e35b6b2 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,9 @@
12004-09-11 Kim F. Storm <storm@cua.dk>
2
3 * FOR-RELEASE (New features): Remove Gnus 5.10 entry (Done!).
4 (Documentation): Add NEWS entry.
5 Add section lists for proof-reading Emacs and Lisp manuals.
6
12004-08-29 Kim F. Storm <storm@cua.dk> 72004-08-29 Kim F. Storm <storm@cua.dk>
2 8
3 * FOR-RELEASE (Documentation): Add man/ack.texi and AUTHORS. 9 * FOR-RELEASE (Documentation): Add man/ack.texi and AUTHORS.
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE
index fbbacaf6456..05bbd0b7c5c 100644
--- a/admin/FOR-RELEASE
+++ b/admin/FOR-RELEASE
@@ -1,32 +1,11 @@
1Tasks needed before the next release. 1Tasks needed before the next release.
2 2
3* DOCUMENTATION
4
5** Finish updating the Emacs Lisp manual.
6
7** Finish checking the Emacs Lisp manual.
8
9** Update the Emacs manual.
10
11** Check the Emacs Manual.
12
13** Add missing years in copyright notices of all files.
14
15** Update man/info.texi.
16
17** Update man/ack.texi.
18
19** Update AUTHORS.
20
21
22* NEW FEATURES 3* NEW FEATURES
23 4
24** Test the mbox branch of Rmail. 5** Test the mbox branch of Rmail.
25 6
26** Install the mbox branch of Rmail. 7** Install the mbox branch of Rmail.
27 8
28** Update Gnus.
29
30** Face remapping. 9** Face remapping.
31 10
32 11
@@ -44,6 +23,178 @@ isearch faces.
44 23
45** Make GTK scrollbars behave like others w.r.t. overscrolling. 24** Make GTK scrollbars behave like others w.r.t. overscrolling.
46 25
26
27* DOCUMENTATION
28
29** Finish updating the Emacs Lisp manual.
30
31*** New display properties (KFS to provide input).
32
33** Update the Emacs manual.
34
35*** Update man/info.texi.
36
37*** Update man/ack.texi.
38
39** Add missing years in copyright notices of all files.
40
41** Update AUTHORS.
42
43** Reorder NEWS entries.
44
45** Check the Emacs manual.
46
47Write you name/initials in the DONE column when you have
48proof-read the corresponding manual section.
49
50DONE SECTION
51---------------------------------------------
52 man/abbrevs.texi
53 man/ack.texi
54 man/ada-mode.texi
55 man/anti.texi
56 man/autotype.texi
57 man/back.texi
58 man/basic.texi
59 man/buffers.texi
60 man/building.texi
61 man/calc.texi
62 man/calendar.texi
63 man/cc-mode.texi
64 man/cl.texi
65 man/cmdargs.texi
66 man/commands.texi
67 man/custom.texi
68 man/dired.texi
69 man/dired-x.texi
70 man/display.texi
71 man/doclicense.texi
72 man/ebrowse.texi
73 man/ediff.texi
74 man/emacs-mime.texi
75 man/emacs.texi
76 man/emacs-xtra.texi
77 man/entering.texi
78 man/eshell.texi
79 man/eudc.texi
80 man/faq.texi
81 man/files.texi
82 man/fixit.texi
83 man/flymake.texi
84 man/forms.texi
85 man/frames.texi
86 man/glossary.texi
87 man/gnus-faq.texi
88 man/gnus.texi
89 man/gnu.texi
90 man/help.texi
91 man/idlwave.texi
92 man/indent.texi
93 man/info.texi
94 man/killing.texi
95 man/kmacro.texi
96 man/macos.texi
97 man/maintaining.texi
98 man/major.texi
99 man/mark.texi
100 man/message.texi
101 man/mh-e.texi
102 man/mini.texi
103 man/misc.texi
104 man/msdog.texi
105 man/mule.texi
106 man/m-x.texi
107 man/pcl-cvs.texi
108 man/pgg.texi
109 man/picture.texi
110 man/programs.texi
111 man/reftex.texi
112 man/regs.texi
113 man/rmail.texi
114 man/screen.texi
115 man/sc.texi
116 man/search.texi
117 man/sending.texi
118 man/ses.texi
119 man/sieve.texi
120 man/smtpmail.texi
121 man/speedbar.texi
122 man/texinfo.tex
123 man/text.texi
124 man/tramp.texi
125 man/trampver.texi
126 man/trouble.texi
127 man/viper.texi
128 man/vip.texi
129 man/widget.texi
130 man/windows.texi
131 man/woman.texi
132 man/xresources.texi
133
134** Check the Emacs Lisp manual.
135
136Write you name/initials in the DONE column when you have
137proof-read the corresponding manual section.
138
139DONE SECTION
140---------------------------------------------
141 lispref/abbrevs.texi
142 lispref/advice.texi
143 lispref/anti.texi
144 lispref/back.texi
145 lispref/backups.texi
146 lispref/buffers.texi
147 lispref/calendar.texi
148 lispref/commands.texi
149 lispref/compile.texi
150 lispref/control.texi
151 lispref/customize.texi
152 lispref/debugging.texi
153 lispref/display.texi
154 lispref/doclicense.texi
155 lispref/edebug.texi
156 lispref/elisp-covers.texi
157 lispref/elisp.texi
158 lispref/errors.texi
159 lispref/eval.texi
160 lispref/files.texi
161 lispref/frames.texi
162 lispref/front-cover-1.texi
163 lispref/functions.texi
164 lispref/gpl.texi
165 lispref/hash.texi
166 lispref/help.texi
167 lispref/hooks.texi
168 lispref/index.texi
169 lispref/internals.texi
170 lispref/intro.texi
171 lispref/keymaps.texi
172 lispref/lay-flat.texi
173 lispref/lists.texi
174 lispref/loading.texi
175 lispref/locals.texi
176 lispref/macros.texi
177 lispref/maps.texi
178 lispref/markers.texi
179 lispref/minibuf.texi
180 lispref/modes.texi
181 lispref/nonascii.texi
182 lispref/numbers.texi
183 lispref/objects.texi
184 lispref/os.texi
185 lispref/positions.texi
186 lispref/processes.texi
187 lispref/searching.texi
188 lispref/sequences.texi
189 lispref/streams.texi
190 lispref/strings.texi
191 lispref/symbols.texi
192 lispref/syntax.texi
193 lispref/text.texi
194 lispref/tips.texi
195 lispref/variables.texi
196 lispref/windows.texi
197
47 198
48Local variables: 199Local variables:
49mode: outline 200mode: outline
diff --git a/etc/ChangeLog b/etc/ChangeLog
index e2d9457db14..5bc0ae4cfb9 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
12004-09-09 Thien-Thi Nguyen <ttn@gnu.org>
2
3 * MORE.STUFF (EDB): Update entry.
4
12004-09-07 Dan Nicolaescu <dann@ics.uci.edu> 52004-09-07 Dan Nicolaescu <dann@ics.uci.edu>
2 6
3 * e/eterm.ti: Add `op' entry to enable colors in term. 7 * e/eterm.ti: Add `op' entry to enable colors in term.
diff --git a/etc/ETAGS.EBNF b/etc/ETAGS.EBNF
index 55c90dc4701..4d09eaa581d 100644
--- a/etc/ETAGS.EBNF
+++ b/etc/ETAGS.EBNF
@@ -2,7 +2,7 @@
2 2
3This file contains two sections: 3This file contains two sections:
4 4
51) An EBNF (Extended Backus Normal Form) description of the format of 51) An EBNF (Extended Backus-Naur Form) description of the format of
6 the tags file created by etags.c and interpreted by etags.el; 6 the tags file created by etags.c and interpreted by etags.el;
72) A discussion of tag names and implicit tag names. 72) A discussion of tag names and implicit tag names.
8 8
@@ -81,7 +81,7 @@ substring of the tag pattern. We define a set of rules to decide
81whether it is possible to deduce the tag name from the pattern, and make 81whether it is possible to deduce the tag name from the pattern, and make
82an unnamed tag in those cases. The name deduced from the pattern of an 82an unnamed tag in those cases. The name deduced from the pattern of an
83unnamed tag is the implicit name of that tag. 83unnamed tag is the implicit name of that tag.
84 When the user looks for a tag, and Emacs founds no explicit tag names 84 When the user looks for a tag, and Emacs finds no explicit tag names
85that match it, Emacs then looks for an tag whose implicit tag name 85that match it, Emacs then looks for an tag whose implicit tag name
86matches the request. etags.c uses implicit tag names when possible, in 86matches the request. etags.c uses implicit tag names when possible, in
87order to reduce the size of the tags file. 87order to reduce the size of the tags file.
diff --git a/etc/MORE.STUFF b/etc/MORE.STUFF
index 8a6ddd5d55a..ad3f607c26a 100644
--- a/etc/MORE.STUFF
+++ b/etc/MORE.STUFF
@@ -140,9 +140,7 @@ Several are for Debian GNU/Linux in particular.
140 * Dismal: spreadsheet: 140 * Dismal: spreadsheet:
141 <URL:http://acs.ist.psu.edu/dismal/dismal.html> 141 <URL:http://acs.ist.psu.edu/dismal/dismal.html>
142 142
143 * EDB: database: 143 * EDB: database: <URL:http://www.glug.org/people/ttn/software/edb/>
144 <URL:http://sdg.lcs.mit.edu/%7Emernst/software/edb-mrp.tar.gz>
145 Not maintained?
146 144
147 * Ee: categorizing information manager: 145 * Ee: categorizing information manager:
148 <URL:http://www.jurta.org/emacs/ee/> 146 <URL:http://www.jurta.org/emacs/ee/>
diff --git a/etc/NEWS b/etc/NEWS
index 667e0f5d9be..0c62333b250 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -692,6 +692,8 @@ version 4.7 or newer, compiles to Info pages with embedded images.
692'sql-sqlite'. 692'sql-sqlite'.
693 693
694** BibTeX mode: 694** BibTeX mode:
695*** The new command bibtex-url browses a URL for the BibTeX entry at
696point (bound to C-c C-l and mouse-2 on clickable fields).
695*** The new command bibtex-entry-update (bound to C-c C-u) updates 697*** The new command bibtex-entry-update (bound to C-c C-u) updates
696an existing BibTeX entry. 698an existing BibTeX entry.
697*** New `bibtex-entry-format' option `required-fields', enabled by default. 699*** New `bibtex-entry-format' option `required-fields', enabled by default.
@@ -1247,9 +1249,9 @@ and to type `C-f' at the end of the search string in the minibuffer.
1247search string used as the string to replace. 1249search string used as the string to replace.
1248 1250
1249+++ 1251+++
1250** New user option `isearch-resume-enabled'. 1252** Isearch no longer adds `isearch-resume' commands to the command
1251This option can be disabled, to avoid the normal behavior of isearch 1253history by default. To enable this feature, customize the new
1252which puts calls to `isearch-resume' in the command history. 1254user option `isearch-resume-in-command-history'.
1253 1255
1254+++ 1256+++
1255** New user option `history-delete-duplicates'. 1257** New user option `history-delete-duplicates'.
@@ -1569,29 +1571,31 @@ per line. Lines beginning with space or tab are ignored.
1569**** The `::' qualifier triggers C++ parsing in C file. 1571**** The `::' qualifier triggers C++ parsing in C file.
1570Previously, only the `template' and `class' keywords had this effect. 1572Previously, only the `template' and `class' keywords had this effect.
1571 1573
1574**** New language HTML.
1575Title and h1, h2, h3 are tagged. Also, tags are generated when name= is
1576used inside an anchor and whenever id= is used.
1577
1578**** In Makefiles, constants are tagged.
1579If you want the old behavior instead, thus avoiding to increase the
1580size of the tags file, use the --no-globals option.
1581
1582**** In Lua, all functions are tagged.
1583
1572**** In Perl, packages are tags. 1584**** In Perl, packages are tags.
1573Subroutine tags are named from their package. You can jump to sub tags 1585Subroutine tags are named from their package. You can jump to sub tags
1574as you did before, by the sub name, or additionally by looking for 1586as you did before, by the sub name, or additionally by looking for
1575package::sub. 1587package::sub.
1576 1588
1589**** In Prolog, etags creates tags for rules in addition to predicates.
1590
1577**** New language PHP. 1591**** New language PHP.
1578Tags are functions, classes and defines. 1592Tags are functions, classes and defines.
1579If the --members option is specified to etags, tags are vars also. 1593If the --members option is specified to etags, tags are vars also.
1580 1594
1581**** New language HTML.
1582Title and h1, h2, h3 are tagged. Also, tags are generated when name= is
1583used inside an anchor and whenever id= is used.
1584
1585**** New default keywords for TeX. 1595**** New default keywords for TeX.
1586The new keywords are def, newcommand, renewcommand, newenvironment and 1596The new keywords are def, newcommand, renewcommand, newenvironment and
1587renewenvironment. 1597renewenvironment.
1588 1598
1589**** In Makefiles, constants are tagged.
1590If you want the old behavior instead, thus avoiding to increase the
1591size of the tags file, use the --no-globals option.
1592
1593**** In Prolog, etags creates tags for rules in addition to predicates.
1594
1595*** Honour #line directives. 1599*** Honour #line directives.
1596When Etags parses an input file that contains C preprocessor's #line 1600When Etags parses an input file that contains C preprocessor's #line
1597directives, it creates tags using the file name and line number 1601directives, it creates tags using the file name and line number
@@ -1602,7 +1606,7 @@ writes tags pointing to the source file.
1602*** New option --parse-stdin=FILE. 1606*** New option --parse-stdin=FILE.
1603This option is mostly useful when calling etags from programs. It can 1607This option is mostly useful when calling etags from programs. It can
1604be used (only once) in place of a file name on the command line. Etags 1608be used (only once) in place of a file name on the command line. Etags
1605reads from standard input and mark the produced tags as belonging to 1609reads from standard input and marks the produced tags as belonging to
1606the file FILE. 1610the file FILE.
1607 1611
1608+++ 1612+++
@@ -2075,6 +2079,10 @@ anyone has committed to the repository since you last executed
2075 2079
2076* New modes and packages in Emacs 21.4 2080* New modes and packages in Emacs 21.4
2077 2081
2082** The new package dns-mode.el add syntax highlight of DNS master files.
2083The key binding C-c C-s (`dns-mode-soa-increment-serial') can be used
2084to increment the SOA serial.
2085
2078** The new package flymake.el does on-the-fly syntax checking of program 2086** The new package flymake.el does on-the-fly syntax checking of program
2079source files. See the Flymake's Info manual for more details. 2087source files. See the Flymake's Info manual for more details.
2080 2088
diff --git a/etc/etags.1 b/etc/etags.1
index 8aa2fd51750..2a84c622e0e 100644
--- a/etc/etags.1
+++ b/etc/etags.1
@@ -50,7 +50,7 @@ format understood by
50.BR vi ( 1 )\c 50.BR vi ( 1 )\c
51\&. Both forms of the program understand 51\&. Both forms of the program understand
52the syntax of C, Objective C, C++, Java, Fortran, Ada, Cobol, Erlang, HTML, 52the syntax of C, Objective C, C++, Java, Fortran, Ada, Cobol, Erlang, HTML,
53LaTeX, Emacs Lisp/Common Lisp, makefiles, Pascal, Perl, PHP, Postscript, 53LaTeX, Emacs Lisp/Common Lisp, Lua, makefile, Pascal, Perl, PHP, Postscript,
54Python, Prolog, Scheme and 54Python, Prolog, Scheme and
55most assembler\-like syntaxes. 55most assembler\-like syntaxes.
56Both forms read the files specified on the command line, and write a tag 56Both forms read the files specified on the command line, and write a tag
@@ -58,7 +58,9 @@ table (defaults: \fBTAGS\fP for \fBetags\fP, \fBtags\fP for
58\fBctags\fP) in the current working directory. 58\fBctags\fP) in the current working directory.
59Files specified with relative file names will be recorded in the tag 59Files specified with relative file names will be recorded in the tag
60table with file names relative to the directory where the tag table 60table with file names relative to the directory where the tag table
61resides. Files specified with absolute file names will be recorded 61resides. If the tag table is in /dev, however, the file names are made
62relative to the working directory. Files specified with absolute file
63names will be recorded
62with absolute file names. Files generated from a source file\-\-like 64with absolute file names. Files generated from a source file\-\-like
63a C file generated from a source Cweb file\-\-will be recorded with 65a C file generated from a source Cweb file\-\-will be recorded with
64the name of the source file. 66the name of the source file.
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 909a5717bcc..c04bdf2f094 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,28 @@
12004-09-13 Francesco Potort,Al(B <pot@gnu.org>
2
3 * etags.c (main): When relative file names are given as argument,
4 make them relative to the current working dir, rather than
5 relative to the output tags file, if the latter is in /dev.
6
72004-09-13 Francesco Potort,Al(B <pot@gnu.org>
8
9 * etags.c [EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
10 <stdlib.h> is available.
11 (enum sym_type): New st_C_attribute value for parsing
12 gcc's __attribute__. Deleted st_C_typespec value.
13 (gperf, in_word_set): Use gperf 3, options changed. Added the
14 __attribute__ keyword, removed all the st_C_typespec keywords,
15 changed attribute for Java to (C_JAVA & !C_PLPL).
16 (inattribute): New global bool, part of the C state machine.
17 (cblev): Identifier renamed to bracelev throughout.
18 (consider_token, C_entries): Numerous changes for making the
19 parser more robust and adding support for __attribute__.
20
212004-09-13 David A. Capello <dacap@users.sourceforge.net> (tiny change)
22
23 * etags.c: (Lua_suffixes, Lua_help, lang_names, Lua_functions):
24 Support the Lua scripting language <http://www.lua.org>.
25
12004-09-08 Francesco Potort,Al(B <pot@gnu.org> 262004-09-08 Francesco Potort,Al(B <pot@gnu.org>
2 27
3 * etags.c: [LONG_OPTIONS]: make it TRUE (ifdef) or FALSE (ifndef) 28 * etags.c: [LONG_OPTIONS]: make it TRUE (ifdef) or FALSE (ifndef)
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 094c81e91a0..a6004a048a9 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -32,10 +32,15 @@
32 * 2002 #line directives by Francesco Potortì. 32 * 2002 #line directives by Francesco Potortì.
33 * 33 *
34 * Francesco Potortì <pot@gnu.org> has maintained and improved it since 1993. 34 * Francesco Potortì <pot@gnu.org> has maintained and improved it since 1993.
35 *
36 */ 35 */
37 36
38char pot_etags_version[] = "@(#) pot revision number is 16.58"; 37/*
38 * If you want to add support for a new language, start by looking at the LUA
39 * language, which is the simplest. Alternatively, consider shipping a
40 * configuration file containing regexp definitions for etags.
41 */
42
43char pot_etags_version[] = "@(#) pot revision number is 17.5";
39 44
40#define TRUE 1 45#define TRUE 1
41#define FALSE 0 46#define FALSE 0
@@ -61,11 +66,11 @@ char pot_etags_version[] = "@(#) pot revision number is 16.58";
61# ifndef __P /* for Xemacs */ 66# ifndef __P /* for Xemacs */
62# define __P(args) args 67# define __P(args) args
63# endif 68# endif
64#else 69#else /* no config.h */
65# if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C)) 70# if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C))
66# define __P(args) args /* use prototypes */ 71# define __P(args) args /* use prototypes */
67# define PTR void * /* for generic pointers */ 72# define PTR void * /* for generic pointers */
68# else 73# else /* not standard C */
69# define __P(args) () /* no prototypes */ 74# define __P(args) () /* no prototypes */
70# define const /* remove const for old compilers' sake */ 75# define const /* remove const for old compilers' sake */
71# define PTR long * /* don't use void* */ 76# define PTR long * /* don't use void* */
@@ -118,12 +123,19 @@ char pot_etags_version[] = "@(#) pot revision number is 16.58";
118# ifndef HAVE_GETCWD 123# ifndef HAVE_GETCWD
119# define HAVE_GETCWD 124# define HAVE_GETCWD
120# endif /* undef HAVE_GETCWD */ 125# endif /* undef HAVE_GETCWD */
121#else /* !WINDOWSNT */ 126#else /* not WINDOWSNT */
122# ifdef STDC_HEADERS 127# ifdef STDC_HEADERS
123# include <stdlib.h> 128# include <stdlib.h>
124# include <string.h> 129# include <string.h>
125# else 130# else /* no standard C headers */
126 extern char *getenv (); 131 extern char *getenv ();
132# ifdef VMS
133# define EXIT_SUCCESS 1
134# define EXIT_FAILURE 0
135# else /* no VMS */
136# define EXIT_SUCCESS 0
137# define EXIT_FAILURE 1
138# endif
127# endif 139# endif
128#endif /* !WINDOWSNT */ 140#endif /* !WINDOWSNT */
129 141
@@ -333,6 +345,7 @@ static void Erlang_functions __P((FILE *));
333static void Fortran_functions __P((FILE *)); 345static void Fortran_functions __P((FILE *));
334static void HTML_labels __P((FILE *)); 346static void HTML_labels __P((FILE *));
335static void Lisp_functions __P((FILE *)); 347static void Lisp_functions __P((FILE *));
348static void Lua_functions __P((FILE *));
336static void Makefile_targets __P((FILE *)); 349static void Makefile_targets __P((FILE *));
337static void Pascal_functions __P((FILE *)); 350static void Pascal_functions __P((FILE *));
338static void Perl_functions __P((FILE *)); 351static void Perl_functions __P((FILE *));
@@ -637,6 +650,11 @@ defined with `defvar' or `defconst', and in general the first\n\
637argument of any expression that starts with `(def' in column zero\n\ 650argument of any expression that starts with `(def' in column zero\n\
638is a tag."; 651is a tag.";
639 652
653static char *Lua_suffixes [] =
654 { "lua", "LUA", NULL };
655static char Lua_help [] =
656"In Lua scripts, all functions are tags.";
657
640static char *Makefile_filenames [] = 658static char *Makefile_filenames [] =
641 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; 659 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
642static char Makefile_help [] = 660static char Makefile_help [] =
@@ -763,6 +781,7 @@ static language lang_names [] =
763 { "html", HTML_help, HTML_labels, HTML_suffixes }, 781 { "html", HTML_help, HTML_labels, HTML_suffixes },
764 { "java", Cjava_help, Cjava_entries, Cjava_suffixes }, 782 { "java", Cjava_help, Cjava_entries, Cjava_suffixes },
765 { "lisp", Lisp_help, Lisp_functions, Lisp_suffixes }, 783 { "lisp", Lisp_help, Lisp_functions, Lisp_suffixes },
784 { "lua", Lua_help, Lua_functions, Lua_suffixes },
766 { "makefile", Makefile_help,Makefile_targets,NULL,Makefile_filenames}, 785 { "makefile", Makefile_help,Makefile_targets,NULL,Makefile_filenames},
767 { "objc", Objc_help, plain_C_entries, Objc_suffixes }, 786 { "objc", Objc_help, plain_C_entries, Objc_suffixes },
768 { "pascal", Pascal_help, Pascal_functions, Pascal_suffixes }, 787 { "pascal", Pascal_help, Pascal_functions, Pascal_suffixes },
@@ -1295,7 +1314,9 @@ main (argc, argv)
1295 cwd = concat (oldcwd, "/", ""); 1314 cwd = concat (oldcwd, "/", "");
1296 free (oldcwd); 1315 free (oldcwd);
1297 } 1316 }
1298 if (streq (tagfile, "-")) 1317 /* Relative file names are made relative to the current directory. */
1318 if (streq (tagfile, "-")
1319 || strneq (tagfile, "/dev/", 5))
1299 tagfiledir = cwd; 1320 tagfiledir = cwd;
1300 else 1321 else
1301 tagfiledir = absolute_dirname (tagfile, cwd); 1322 tagfiledir = absolute_dirname (tagfile, cwd);
@@ -2373,11 +2394,11 @@ enum sym_type
2373 st_none, 2394 st_none,
2374 st_C_objprot, st_C_objimpl, st_C_objend, 2395 st_C_objprot, st_C_objimpl, st_C_objend,
2375 st_C_gnumacro, 2396 st_C_gnumacro,
2376 st_C_ignore, 2397 st_C_ignore, st_C_attribute,
2377 st_C_javastruct, 2398 st_C_javastruct,
2378 st_C_operator, 2399 st_C_operator,
2379 st_C_class, st_C_template, 2400 st_C_class, st_C_template,
2380 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef, st_C_typespec 2401 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef
2381}; 2402};
2382 2403
2383static unsigned int hash __P((const char *, unsigned int)); 2404static unsigned int hash __P((const char *, unsigned int));
@@ -2385,79 +2406,67 @@ static struct C_stab_entry * in_word_set __P((const char *, unsigned int));
2385static enum sym_type C_symtype __P((char *, int, int)); 2406static enum sym_type C_symtype __P((char *, int, int));
2386 2407
2387/* Feed stuff between (but not including) %[ and %] lines to: 2408/* Feed stuff between (but not including) %[ and %] lines to:
2388 gperf -c -k 1,3 -o -p -r -t 2409 gperf -m 5
2389%[ 2410%[
2411%compare-strncmp
2412%enum
2413%struct-type
2390struct C_stab_entry { char *name; int c_ext; enum sym_type type; } 2414struct C_stab_entry { char *name; int c_ext; enum sym_type type; }
2391%% 2415%%
2392if, 0, st_C_ignore 2416if, 0, st_C_ignore
2393for, 0, st_C_ignore 2417for, 0, st_C_ignore
2394while, 0, st_C_ignore 2418while, 0, st_C_ignore
2395switch, 0, st_C_ignore 2419switch, 0, st_C_ignore
2396return, 0, st_C_ignore 2420return, 0, st_C_ignore
2397@interface, 0, st_C_objprot 2421__attribute__, 0, st_C_attribute
2398@protocol, 0, st_C_objprot 2422@interface, 0, st_C_objprot
2399@implementation,0, st_C_objimpl 2423@protocol, 0, st_C_objprot
2400@end, 0, st_C_objend 2424@implementation,0, st_C_objimpl
2401import, C_JAVA, st_C_ignore 2425@end, 0, st_C_objend
2402package, C_JAVA, st_C_ignore 2426import, (C_JAVA & !C_PLPL), st_C_ignore
2403friend, C_PLPL, st_C_ignore 2427package, (C_JAVA & !C_PLPL), st_C_ignore
2404extends, C_JAVA, st_C_javastruct 2428friend, C_PLPL, st_C_ignore
2405implements, C_JAVA, st_C_javastruct 2429extends, (C_JAVA & !C_PLPL), st_C_javastruct
2406interface, C_JAVA, st_C_struct 2430implements, (C_JAVA & !C_PLPL), st_C_javastruct
2407class, 0, st_C_class 2431interface, (C_JAVA & !C_PLPL), st_C_struct
2408namespace, C_PLPL, st_C_struct 2432class, 0, st_C_class
2409domain, C_STAR, st_C_struct 2433namespace, C_PLPL, st_C_struct
2410union, 0, st_C_struct 2434domain, C_STAR, st_C_struct
2411struct, 0, st_C_struct 2435union, 0, st_C_struct
2412extern, 0, st_C_extern 2436struct, 0, st_C_struct
2413enum, 0, st_C_enum 2437extern, 0, st_C_extern
2414typedef, 0, st_C_typedef 2438enum, 0, st_C_enum
2415define, 0, st_C_define 2439typedef, 0, st_C_typedef
2416operator, C_PLPL, st_C_operator 2440define, 0, st_C_define
2417template, 0, st_C_template 2441operator, C_PLPL, st_C_operator
2418bool, C_PLPL, st_C_typespec 2442template, 0, st_C_template
2419long, 0, st_C_typespec
2420short, 0, st_C_typespec
2421int, 0, st_C_typespec
2422char, 0, st_C_typespec
2423float, 0, st_C_typespec
2424double, 0, st_C_typespec
2425signed, 0, st_C_typespec
2426unsigned, 0, st_C_typespec
2427auto, 0, st_C_typespec
2428void, 0, st_C_typespec
2429static, 0, st_C_typespec
2430const, 0, st_C_typespec
2431volatile, 0, st_C_typespec
2432explicit, C_PLPL, st_C_typespec
2433mutable, C_PLPL, st_C_typespec
2434typename, C_PLPL, st_C_typespec
2435# DEFUN used in emacs, the next three used in glibc (SYSCALL only for mach). 2443# DEFUN used in emacs, the next three used in glibc (SYSCALL only for mach).
2436DEFUN, 0, st_C_gnumacro 2444DEFUN, 0, st_C_gnumacro
2437SYSCALL, 0, st_C_gnumacro 2445SYSCALL, 0, st_C_gnumacro
2438ENTRY, 0, st_C_gnumacro 2446ENTRY, 0, st_C_gnumacro
2439PSEUDO, 0, st_C_gnumacro 2447PSEUDO, 0, st_C_gnumacro
2440# These are defined inside C functions, so currently they are not met. 2448# These are defined inside C functions, so currently they are not met.
2441# EXFUN used in glibc, DEFVAR_* in emacs. 2449# EXFUN used in glibc, DEFVAR_* in emacs.
2442#EXFUN, 0, st_C_gnumacro 2450#EXFUN, 0, st_C_gnumacro
2443#DEFVAR_, 0, st_C_gnumacro 2451#DEFVAR_, 0, st_C_gnumacro
2444%] 2452%]
2445and replace lines between %< and %> with its output, 2453and replace lines between %< and %> with its output, then:
2446then make in_word_set and C_stab_entry static. */ 2454 - remove the #if characterset check
2455 - make in_word_set static and not inline. */
2447/*%<*/ 2456/*%<*/
2448/* C code produced by gperf version 2.7.1 (19981006 egcs) */ 2457/* C code produced by gperf version 3.0.1 */
2449/* Command-line: gperf -c -k 1,3 -o -p -r -t */ 2458/* Command-line: gperf -m 5 */
2450struct C_stab_entry { char *name; int c_ext; enum sym_type type; }; 2459/* Computed positions: -k'1-2' */
2451 2460
2452#define TOTAL_KEYWORDS 47 2461struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
2453#define MIN_WORD_LENGTH 2 2462/* maximum key range = 31, duplicates = 0 */
2454#define MAX_WORD_LENGTH 15
2455#define MIN_HASH_VALUE 18
2456#define MAX_HASH_VALUE 138
2457/* maximum key range = 121, duplicates = 0 */
2458 2463
2459#ifdef __GNUC__ 2464#ifdef __GNUC__
2460__inline 2465__inline
2466#else
2467#ifdef __cplusplus
2468inline
2469#endif
2461#endif 2470#endif
2462static unsigned int 2471static unsigned int
2463hash (str, len) 2472hash (str, len)
@@ -2466,132 +2475,84 @@ hash (str, len)
2466{ 2475{
2467 static unsigned char asso_values[] = 2476 static unsigned char asso_values[] =
2468 { 2477 {
2469 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2478 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2470 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2479 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2471 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2480 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2472 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2481 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2473 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2482 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2474 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2483 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2475 139, 139, 139, 139, 63, 139, 139, 139, 33, 44, 2484 34, 34, 34, 34, 1, 34, 34, 34, 14, 14,
2476 62, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2485 34, 34, 34, 34, 34, 34, 34, 34, 13, 34,
2477 42, 139, 139, 12, 32, 139, 139, 139, 139, 139, 2486 13, 34, 34, 12, 34, 34, 34, 34, 34, 11,
2478 139, 139, 139, 139, 139, 139, 139, 34, 59, 37, 2487 34, 34, 34, 34, 34, 8, 34, 11, 34, 12,
2479 24, 58, 33, 3, 139, 16, 139, 139, 42, 60, 2488 11, 0, 1, 34, 7, 0, 34, 34, 11, 9,
2480 18, 11, 39, 139, 23, 57, 4, 63, 6, 20, 2489 0, 4, 0, 34, 7, 4, 14, 21, 34, 15,
2481 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2490 0, 2, 34, 34, 34, 34, 34, 34, 34, 34,
2482 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2491 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2483 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2492 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2484 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2493 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2485 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2494 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2486 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2495 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2487 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2496 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2488 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2497 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2489 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2498 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2490 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2499 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2491 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2500 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2492 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2501 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2493 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2502 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2494 139, 139, 139, 139, 139, 139 2503 34, 34, 34, 34, 34, 34
2495 }; 2504 };
2496 register int hval = len; 2505 return len + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[0]];
2497
2498 switch (hval)
2499 {
2500 default:
2501 case 3:
2502 hval += asso_values[(unsigned char)str[2]];
2503 case 2:
2504 case 1:
2505 hval += asso_values[(unsigned char)str[0]];
2506 break;
2507 }
2508 return hval;
2509} 2506}
2510 2507
2511#ifdef __GNUC__
2512__inline
2513#endif
2514static struct C_stab_entry * 2508static struct C_stab_entry *
2515in_word_set (str, len) 2509in_word_set (str, len)
2516 register const char *str; 2510 register const char *str;
2517 register unsigned int len; 2511 register unsigned int len;
2518{ 2512{
2513 enum
2514 {
2515 TOTAL_KEYWORDS = 31,
2516 MIN_WORD_LENGTH = 2,
2517 MAX_WORD_LENGTH = 15,
2518 MIN_HASH_VALUE = 3,
2519 MAX_HASH_VALUE = 33
2520 };
2521
2519 static struct C_stab_entry wordlist[] = 2522 static struct C_stab_entry wordlist[] =
2520 { 2523 {
2521 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2522 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2523 {"if", 0, st_C_ignore},
2524 {""}, {""}, {""}, {""},
2525 {"int", 0, st_C_typespec},
2526 {""}, {""},
2527 {"void", 0, st_C_typespec},
2528 {""}, {""},
2529 {"interface", C_JAVA, st_C_struct},
2530 {""},
2531 {"SYSCALL", 0, st_C_gnumacro},
2532 {""},
2533 {"return", 0, st_C_ignore},
2534 {""}, {""}, {""}, {""}, {""}, {""}, {""},
2535 {"while", 0, st_C_ignore},
2536 {"auto", 0, st_C_typespec},
2537 {""}, {""}, {""}, {""}, {""}, {""},
2538 {"float", 0, st_C_typespec},
2539 {"typedef", 0, st_C_typedef},
2540 {"typename", C_PLPL, st_C_typespec},
2541 {""}, {""}, {""}, 2524 {""}, {""}, {""},
2542 {"friend", C_PLPL, st_C_ignore}, 2525 {"if", 0, st_C_ignore},
2543 {"volatile", 0, st_C_typespec}, 2526 {"enum", 0, st_C_enum},
2544 {""}, {""}, 2527 {"@end", 0, st_C_objend},
2545 {"for", 0, st_C_ignore}, 2528 {"extern", 0, st_C_extern},
2546 {"const", 0, st_C_typespec}, 2529 {"extends", (C_JAVA & !C_PLPL), st_C_javastruct},
2547 {"import", C_JAVA, st_C_ignore}, 2530 {"for", 0, st_C_ignore},
2548 {""}, 2531 {"interface", (C_JAVA & !C_PLPL), st_C_struct},
2549 {"define", 0, st_C_define}, 2532 {"@protocol", 0, st_C_objprot},
2550 {"long", 0, st_C_typespec}, 2533 {"@interface", 0, st_C_objprot},
2551 {"implements", C_JAVA, st_C_javastruct}, 2534 {"operator", C_PLPL, st_C_operator},
2552 {"signed", 0, st_C_typespec}, 2535 {"return", 0, st_C_ignore},
2553 {""}, 2536 {"friend", C_PLPL, st_C_ignore},
2554 {"extern", 0, st_C_extern}, 2537 {"import", (C_JAVA & !C_PLPL), st_C_ignore},
2555 {"extends", C_JAVA, st_C_javastruct}, 2538 {"@implementation",0, st_C_objimpl},
2556 {""}, 2539 {"define", 0, st_C_define},
2557 {"mutable", C_PLPL, st_C_typespec}, 2540 {"package", (C_JAVA & !C_PLPL), st_C_ignore},
2558 {"template", 0, st_C_template}, 2541 {"implements", (C_JAVA & !C_PLPL), st_C_javastruct},
2559 {"short", 0, st_C_typespec}, 2542 {"namespace", C_PLPL, st_C_struct},
2560 {"bool", C_PLPL, st_C_typespec}, 2543 {"domain", C_STAR, st_C_struct},
2561 {"char", 0, st_C_typespec}, 2544 {"template", 0, st_C_template},
2562 {"class", 0, st_C_class}, 2545 {"typedef", 0, st_C_typedef},
2563 {"operator", C_PLPL, st_C_operator}, 2546 {"struct", 0, st_C_struct},
2564 {""}, 2547 {"switch", 0, st_C_ignore},
2565 {"switch", 0, st_C_ignore}, 2548 {"union", 0, st_C_struct},
2566 {""}, 2549 {"while", 0, st_C_ignore},
2567 {"ENTRY", 0, st_C_gnumacro}, 2550 {"class", 0, st_C_class},
2568 {""}, 2551 {"__attribute__", 0, st_C_attribute},
2569 {"package", C_JAVA, st_C_ignore}, 2552 {"SYSCALL", 0, st_C_gnumacro},
2570 {"union", 0, st_C_struct}, 2553 {"PSEUDO", 0, st_C_gnumacro},
2571 {"@end", 0, st_C_objend}, 2554 {"ENTRY", 0, st_C_gnumacro},
2572 {"struct", 0, st_C_struct}, 2555 {"DEFUN", 0, st_C_gnumacro}
2573 {"namespace", C_PLPL, st_C_struct},
2574 {""}, {""},
2575 {"domain", C_STAR, st_C_struct},
2576 {"@interface", 0, st_C_objprot},
2577 {"PSEUDO", 0, st_C_gnumacro},
2578 {"double", 0, st_C_typespec},
2579 {""},
2580 {"@protocol", 0, st_C_objprot},
2581 {""},
2582 {"static", 0, st_C_typespec},
2583 {""}, {""},
2584 {"DEFUN", 0, st_C_gnumacro},
2585 {""}, {""}, {""}, {""},
2586 {"explicit", C_PLPL, st_C_typespec},
2587 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2588 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2589 {""},
2590 {"enum", 0, st_C_enum},
2591 {""}, {""},
2592 {"unsigned", 0, st_C_typespec},
2593 {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""},
2594 {"@implementation",0, st_C_objimpl}
2595 }; 2556 };
2596 2557
2597 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 2558 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -2602,7 +2563,7 @@ in_word_set (str, len)
2602 { 2563 {
2603 register const char *s = wordlist[key].name; 2564 register const char *s = wordlist[key].name;
2604 2565
2605 if (*str == *s && !strncmp (str + 1, s + 1, len - 1)) 2566 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
2606 return &wordlist[key]; 2567 return &wordlist[key];
2607 } 2568 }
2608 } 2569 }
@@ -2625,6 +2586,11 @@ C_symtype (str, len, c_ext)
2625 2586
2626 2587
2627/* 2588/*
2589 * Ignoring __attribute__ ((list))
2590 */
2591static bool inattribute; /* looking at an __attribute__ construct */
2592
2593/*
2628 * C functions and variables are recognized using a simple 2594 * C functions and variables are recognized using a simple
2629 * finite automaton. fvdef is its state variable. 2595 * finite automaton. fvdef is its state variable.
2630 */ 2596 */
@@ -2666,10 +2632,9 @@ static enum
2666static enum 2632static enum
2667{ 2633{
2668 snone, /* nothing seen yet, 2634 snone, /* nothing seen yet,
2669 or in struct body if cblev > 0 */ 2635 or in struct body if bracelev > 0 */
2670 skeyseen, /* struct-like keyword seen */ 2636 skeyseen, /* struct-like keyword seen */
2671 stagseen, /* struct-like tag seen */ 2637 stagseen, /* struct-like tag seen */
2672 sintemplate, /* inside template (ignore) */
2673 scolonseen /* colon seen after struct-like tag */ 2638 scolonseen /* colon seen after struct-like tag */
2674} structdef; 2639} structdef;
2675 2640
@@ -2743,7 +2708,7 @@ static void write_classname __P((linebuffer *, char *qualifier));
2743 2708
2744static struct { 2709static struct {
2745 char **cname; /* nested class names */ 2710 char **cname; /* nested class names */
2746 int *cblev; /* nested class curly brace level */ 2711 int *bracelev; /* nested class brace level */
2747 int nl; /* class nesting level (elements used) */ 2712 int nl; /* class nesting level (elements used) */
2748 int size; /* length of the array */ 2713 int size; /* length of the array */
2749} cstack; /* stack for nested declaration tags */ 2714} cstack; /* stack for nested declaration tags */
@@ -2751,38 +2716,38 @@ static struct {
2751#define nestlev (cstack.nl) 2716#define nestlev (cstack.nl)
2752/* After struct keyword or in struct body, not inside a nested function. */ 2717/* After struct keyword or in struct body, not inside a nested function. */
2753#define instruct (structdef == snone && nestlev > 0 \ 2718#define instruct (structdef == snone && nestlev > 0 \
2754 && cblev == cstack.cblev[nestlev-1] + 1) 2719 && bracelev == cstack.bracelev[nestlev-1] + 1)
2755 2720
2756static void 2721static void
2757pushclass_above (cblev, str, len) 2722pushclass_above (bracelev, str, len)
2758 int cblev; 2723 int bracelev;
2759 char *str; 2724 char *str;
2760 int len; 2725 int len;
2761{ 2726{
2762 int nl; 2727 int nl;
2763 2728
2764 popclass_above (cblev); 2729 popclass_above (bracelev);
2765 nl = cstack.nl; 2730 nl = cstack.nl;
2766 if (nl >= cstack.size) 2731 if (nl >= cstack.size)
2767 { 2732 {
2768 int size = cstack.size *= 2; 2733 int size = cstack.size *= 2;
2769 xrnew (cstack.cname, size, char *); 2734 xrnew (cstack.cname, size, char *);
2770 xrnew (cstack.cblev, size, int); 2735 xrnew (cstack.bracelev, size, int);
2771 } 2736 }
2772 assert (nl == 0 || cstack.cblev[nl-1] < cblev); 2737 assert (nl == 0 || cstack.bracelev[nl-1] < bracelev);
2773 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len); 2738 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len);
2774 cstack.cblev[nl] = cblev; 2739 cstack.bracelev[nl] = bracelev;
2775 cstack.nl = nl + 1; 2740 cstack.nl = nl + 1;
2776} 2741}
2777 2742
2778static void 2743static void
2779popclass_above (cblev) 2744popclass_above (bracelev)
2780 int cblev; 2745 int bracelev;
2781{ 2746{
2782 int nl; 2747 int nl;
2783 2748
2784 for (nl = cstack.nl - 1; 2749 for (nl = cstack.nl - 1;
2785 nl >= 0 && cstack.cblev[nl] >= cblev; 2750 nl >= 0 && cstack.bracelev[nl] >= bracelev;
2786 nl--) 2751 nl--)
2787 { 2752 {
2788 if (cstack.cname[nl] != NULL) 2753 if (cstack.cname[nl] != NULL)
@@ -2849,269 +2814,286 @@ static void make_C_tag __P((bool));
2849 */ 2814 */
2850 2815
2851static bool 2816static bool
2852consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var) 2817consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
2853 register char *str; /* IN: token pointer */ 2818 register char *str; /* IN: token pointer */
2854 register int len; /* IN: token length */ 2819 register int len; /* IN: token length */
2855 register int c; /* IN: first char after the token */ 2820 register int c; /* IN: first char after the token */
2856 int *c_extp; /* IN, OUT: C extensions mask */ 2821 int *c_extp; /* IN, OUT: C extensions mask */
2857 int cblev; /* IN: curly brace level */ 2822 int bracelev; /* IN: brace level */
2858 int parlev; /* IN: parenthesis level */ 2823 int parlev; /* IN: parenthesis level */
2859 bool *is_func_or_var; /* OUT: function or variable found */ 2824 bool *is_func_or_var; /* OUT: function or variable found */
2860{ 2825{
2861 /* When structdef is stagseen, scolonseen, or snone with cblev > 0, 2826 /* When structdef is stagseen, scolonseen, or snone with bracelev > 0,
2862 structtype is the type of the preceding struct-like keyword, and 2827 structtype is the type of the preceding struct-like keyword, and
2863 structcblev is the curly brace level where it has been seen. */ 2828 structbracelev is the brace level where it has been seen. */
2864 static enum sym_type structtype; 2829 static enum sym_type structtype;
2865 static int structcblev; 2830 static int structbracelev;
2866 static enum sym_type toktype; 2831 static enum sym_type toktype;
2867 2832
2868 2833
2869 toktype = C_symtype (str, len, *c_extp); 2834 toktype = C_symtype (str, len, *c_extp);
2870 2835
2871 /* 2836 /*
2872 * Advance the definedef state machine. 2837 * Skip __attribute__
2873 */
2874 switch (definedef)
2875 {
2876 case dnone:
2877 /* We're not on a preprocessor line. */
2878 if (toktype == st_C_gnumacro)
2879 {
2880 fvdef = fdefunkey;
2881 return FALSE;
2882 }
2883 break;
2884 case dsharpseen:
2885 if (toktype == st_C_define)
2886 {
2887 definedef = ddefineseen;
2888 }
2889 else
2890 {
2891 definedef = dignorerest;
2892 }
2893 return FALSE;
2894 case ddefineseen:
2895 /*
2896 * Make a tag for any macro, unless it is a constant
2897 * and constantypedefs is FALSE.
2898 */
2899 definedef = dignorerest;
2900 *is_func_or_var = (c == '(');
2901 if (!*is_func_or_var && !constantypedefs)
2902 return FALSE;
2903 else
2904 return TRUE;
2905 case dignorerest:
2906 return FALSE;
2907 default:
2908 error ("internal error: definedef value.", (char *)NULL);
2909 }
2910
2911 /*
2912 * Now typedefs
2913 */
2914 switch (typdef)
2915 {
2916 case tnone:
2917 if (toktype == st_C_typedef)
2918 {
2919 if (typedefs)
2920 typdef = tkeyseen;
2921 fvextern = FALSE;
2922 fvdef = fvnone;
2923 return FALSE;
2924 }
2925 break;
2926 case tkeyseen:
2927 switch (toktype)
2928 {
2929 case st_none:
2930 case st_C_typespec:
2931 case st_C_class:
2932 case st_C_struct:
2933 case st_C_enum:
2934 typdef = ttypeseen;
2935 break;
2936 }
2937 break;
2938 case ttypeseen:
2939 if (structdef == snone && fvdef == fvnone)
2940 {
2941 fvdef = fvnameseen;
2942 return TRUE;
2943 }
2944 break;
2945 case tend:
2946 switch (toktype)
2947 {
2948 case st_C_typespec:
2949 case st_C_class:
2950 case st_C_struct:
2951 case st_C_enum:
2952 return FALSE;
2953 }
2954 return TRUE;
2955 }
2956
2957 /*
2958 * This structdef business is NOT invoked when we are ctags and the
2959 * file is plain C. This is because a struct tag may have the same
2960 * name as another tag, and this loses with ctags.
2961 */ 2838 */
2962 switch (toktype) 2839 if (toktype == st_C_attribute)
2963 {
2964 case st_C_javastruct:
2965 if (structdef == stagseen)
2966 structdef = scolonseen;
2967 return FALSE;
2968 case st_C_template:
2969 case st_C_class:
2970 if ((*c_extp & C_AUTO) /* automatic detection of C++ language */
2971 && cblev == 0
2972 && definedef == dnone && structdef == snone
2973 && typdef == tnone && fvdef == fvnone)
2974 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
2975 if (toktype == st_C_template)
2976 break;
2977 /* FALLTHRU */
2978 case st_C_struct:
2979 case st_C_enum:
2980 if (parlev == 0
2981 && fvdef != vignore
2982 && (typdef == tkeyseen
2983 || (typedefs_or_cplusplus && structdef == snone)))
2984 {
2985 structdef = skeyseen;
2986 structtype = toktype;
2987 structcblev = cblev;
2988 }
2989 return FALSE;
2990 }
2991
2992 if (structdef == skeyseen)
2993 { 2840 {
2994 structdef = stagseen; 2841 inattribute = TRUE;
2995 return TRUE;
2996 }
2997
2998 if (typdef != tnone)
2999 definedef = dnone;
3000
3001 /* Detect Objective C constructs. */
3002 switch (objdef)
3003 {
3004 case onone:
3005 switch (toktype)
3006 {
3007 case st_C_objprot:
3008 objdef = oprotocol;
3009 return FALSE;
3010 case st_C_objimpl:
3011 objdef = oimplementation;
3012 return FALSE;
3013 }
3014 break;
3015 case oimplementation:
3016 /* Save the class tag for functions or variables defined inside. */
3017 objtag = savenstr (str, len);
3018 objdef = oinbody;
3019 return FALSE; 2842 return FALSE;
3020 case oprotocol: 2843 }
3021 /* Save the class tag for categories. */ 2844
3022 objtag = savenstr (str, len); 2845 /*
3023 objdef = otagseen; 2846 * Advance the definedef state machine.
3024 *is_func_or_var = TRUE; 2847 */
3025 return TRUE; 2848 switch (definedef)
3026 case oparenseen: 2849 {
3027 objdef = ocatseen; 2850 case dnone:
3028 *is_func_or_var = TRUE; 2851 /* We're not on a preprocessor line. */
3029 return TRUE; 2852 if (toktype == st_C_gnumacro)
3030 case oinbody: 2853 {
3031 break; 2854 fvdef = fdefunkey;
3032 case omethodsign: 2855 return FALSE;
3033 if (parlev == 0) 2856 }
3034 { 2857 break;
3035 objdef = omethodtag; 2858 case dsharpseen:
3036 linebuffer_setlen (&token_name, len); 2859 if (toktype == st_C_define)
3037 strncpy (token_name.buffer, str, len); 2860 {
3038 token_name.buffer[len] = '\0'; 2861 definedef = ddefineseen;
3039 return TRUE; 2862 }
3040 } 2863 else
3041 return FALSE; 2864 {
3042 case omethodcolon: 2865 definedef = dignorerest;
3043 if (parlev == 0) 2866 }
3044 objdef = omethodparm; 2867 return FALSE;
3045 return FALSE; 2868 case ddefineseen:
3046 case omethodparm: 2869 /*
3047 if (parlev == 0) 2870 * Make a tag for any macro, unless it is a constant
3048 { 2871 * and constantypedefs is FALSE.
3049 objdef = omethodtag; 2872 */
3050 linebuffer_setlen (&token_name, token_name.len + len); 2873 definedef = dignorerest;
3051 strncat (token_name.buffer, str, len); 2874 *is_func_or_var = (c == '(');
3052 return TRUE; 2875 if (!*is_func_or_var && !constantypedefs)
3053 } 2876 return FALSE;
3054 return FALSE; 2877 else
3055 case oignore: 2878 return TRUE;
3056 if (toktype == st_C_objend) 2879 case dignorerest:
3057 { 2880 return FALSE;
3058 /* Memory leakage here: the string pointed by objtag is 2881 default:
3059 never released, because many tests would be needed to 2882 error ("internal error: definedef value.", (char *)NULL);
3060 avoid breaking on incorrect input code. The amount of 2883 }
3061 memory leaked here is the sum of the lengths of the 2884
3062 class tags. 2885 /*
3063 free (objtag); */ 2886 * Now typedefs
3064 objdef = onone; 2887 */
3065 } 2888 switch (typdef)
3066 return FALSE; 2889 {
3067 } 2890 case tnone:
3068 2891 if (toktype == st_C_typedef)
3069 /* A function, variable or enum constant? */ 2892 {
3070 switch (toktype) 2893 if (typedefs)
3071 { 2894 typdef = tkeyseen;
3072 case st_C_extern: 2895 fvextern = FALSE;
3073 fvextern = TRUE; 2896 fvdef = fvnone;
3074 /* FALLTHRU */ 2897 return FALSE;
3075 case st_C_typespec: 2898 }
3076 switch (fvdef) 2899 break;
3077 { 2900 case tkeyseen:
3078 case finlist: 2901 switch (toktype)
3079 case flistseen: 2902 {
3080 case fignore: 2903 case st_none:
3081 case vignore: 2904 case st_C_class:
3082 break; 2905 case st_C_struct:
3083 default: 2906 case st_C_enum:
3084 fvdef = fvnone; 2907 typdef = ttypeseen;
3085 } 2908 }
3086 return FALSE; 2909 break;
3087 case st_C_ignore: 2910 case ttypeseen:
3088 fvextern = FALSE; 2911 if (structdef == snone && fvdef == fvnone)
3089 fvdef = vignore; 2912 {
3090 return FALSE; 2913 fvdef = fvnameseen;
3091 case st_C_operator: 2914 return TRUE;
3092 fvdef = foperator; 2915 }
3093 *is_func_or_var = TRUE; 2916 break;
3094 return TRUE; 2917 case tend:
3095 case st_none: 2918 switch (toktype)
3096 if (constantypedefs 2919 {
3097 && structdef == snone 2920 case st_C_class:
3098 && structtype == st_C_enum && cblev > structcblev) 2921 case st_C_struct:
3099 return TRUE; /* enum constant */ 2922 case st_C_enum:
3100 switch (fvdef) 2923 return FALSE;
3101 { 2924 }
3102 case fdefunkey: 2925 return TRUE;
3103 if (cblev > 0) 2926 }
3104 break; 2927
3105 fvdef = fdefunname; /* GNU macro */ 2928 /*
3106 *is_func_or_var = TRUE; 2929 * This structdef business is NOT invoked when we are ctags and the
3107 return TRUE; 2930 * file is plain C. This is because a struct tag may have the same
3108 case fvnone: 2931 * name as another tag, and this loses with ctags.
3109 if ((strneq (str, "asm", 3) && endtoken (str[3])) 2932 */
3110 || (strneq (str, "__asm__", 7) && endtoken (str[7]))) 2933 switch (toktype)
3111 { 2934 {
3112 fvdef = vignore; 2935 case st_C_javastruct:
3113 return FALSE; 2936 if (structdef == stagseen)
3114 } 2937 structdef = scolonseen;
2938 return FALSE;
2939 case st_C_template:
2940 case st_C_class:
2941 if ((*c_extp & C_AUTO) /* automatic detection of C++ language */
2942 && bracelev == 0
2943 && definedef == dnone && structdef == snone
2944 && typdef == tnone && fvdef == fvnone)
2945 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
2946 if (toktype == st_C_template)
2947 break;
2948 /* FALLTHRU */
2949 case st_C_struct:
2950 case st_C_enum:
2951 if (parlev == 0
2952 && fvdef != vignore
2953 && (typdef == tkeyseen
2954 || (typedefs_or_cplusplus && structdef == snone)))
2955 {
2956 structdef = skeyseen;
2957 structtype = toktype;
2958 structbracelev = bracelev;
2959 if (fvdef == fvnameseen)
2960 fvdef = fvnone;
2961 }
2962 return FALSE;
2963 }
2964
2965 if (structdef == skeyseen)
2966 {
2967 structdef = stagseen;
2968 return TRUE;
2969 }
2970
2971 if (typdef != tnone)
2972 definedef = dnone;
2973
2974 /* Detect Objective C constructs. */
2975 switch (objdef)
2976 {
2977 case onone:
2978 switch (toktype)
2979 {
2980 case st_C_objprot:
2981 objdef = oprotocol;
2982 return FALSE;
2983 case st_C_objimpl:
2984 objdef = oimplementation;
2985 return FALSE;
2986 }
2987 break;
2988 case oimplementation:
2989 /* Save the class tag for functions or variables defined inside. */
2990 objtag = savenstr (str, len);
2991 objdef = oinbody;
2992 return FALSE;
2993 case oprotocol:
2994 /* Save the class tag for categories. */
2995 objtag = savenstr (str, len);
2996 objdef = otagseen;
2997 *is_func_or_var = TRUE;
2998 return TRUE;
2999 case oparenseen:
3000 objdef = ocatseen;
3001 *is_func_or_var = TRUE;
3002 return TRUE;
3003 case oinbody:
3004 break;
3005 case omethodsign:
3006 if (parlev == 0)
3007 {
3008 fvdef = fvnone;
3009 objdef = omethodtag;
3010 linebuffer_setlen (&token_name, len);
3011 strncpy (token_name.buffer, str, len);
3012 token_name.buffer[len] = '\0';
3013 return TRUE;
3014 }
3015 return FALSE;
3016 case omethodcolon:
3017 if (parlev == 0)
3018 objdef = omethodparm;
3019 return FALSE;
3020 case omethodparm:
3021 if (parlev == 0)
3022 {
3023 fvdef = fvnone;
3024 objdef = omethodtag;
3025 linebuffer_setlen (&token_name, token_name.len + len);
3026 strncat (token_name.buffer, str, len);
3027 return TRUE;
3028 }
3029 return FALSE;
3030 case oignore:
3031 if (toktype == st_C_objend)
3032 {
3033 /* Memory leakage here: the string pointed by objtag is
3034 never released, because many tests would be needed to
3035 avoid breaking on incorrect input code. The amount of
3036 memory leaked here is the sum of the lengths of the
3037 class tags.
3038 free (objtag); */
3039 objdef = onone;
3040 }
3041 return FALSE;
3042 }
3043
3044 /* A function, variable or enum constant? */
3045 switch (toktype)
3046 {
3047 case st_C_extern:
3048 fvextern = TRUE;
3049 switch (fvdef)
3050 {
3051 case finlist:
3052 case flistseen:
3053 case fignore:
3054 case vignore:
3055 break;
3056 default:
3057 fvdef = fvnone;
3058 }
3059 return FALSE;
3060 case st_C_ignore:
3061 fvextern = FALSE;
3062 fvdef = vignore;
3063 return FALSE;
3064 case st_C_operator:
3065 fvdef = foperator;
3066 *is_func_or_var = TRUE;
3067 return TRUE;
3068 case st_none:
3069 if (constantypedefs
3070 && structdef == snone
3071 && structtype == st_C_enum && bracelev > structbracelev)
3072 return TRUE; /* enum constant */
3073 switch (fvdef)
3074 {
3075 case fdefunkey:
3076 if (bracelev > 0)
3077 break;
3078 fvdef = fdefunname; /* GNU macro */
3079 *is_func_or_var = TRUE;
3080 return TRUE;
3081 case fvnone:
3082 switch (typdef)
3083 {
3084 case ttypeseen:
3085 return FALSE;
3086 case tnone:
3087 if ((strneq (str, "asm", 3) && endtoken (str[3]))
3088 || (strneq (str, "__asm__", 7) && endtoken (str[7])))
3089 {
3090 fvdef = vignore;
3091 return FALSE;
3092 }
3093 break;
3094 }
3095 /* FALLTHRU */
3096 case fvnameseen:
3115 if (len >= 10 && strneq (str+len-10, "::operator", 10)) 3097 if (len >= 10 && strneq (str+len-10, "::operator", 10))
3116 { 3098 {
3117 if (*c_extp & C_AUTO) /* automatic detection of C++ */ 3099 if (*c_extp & C_AUTO) /* automatic detection of C++ */
@@ -3120,7 +3102,7 @@ consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var)
3120 *is_func_or_var = TRUE; 3102 *is_func_or_var = TRUE;
3121 return TRUE; 3103 return TRUE;
3122 } 3104 }
3123 if (cblev > 0 && !instruct) 3105 if (bracelev > 0 && !instruct)
3124 break; 3106 break;
3125 fvdef = fvnameseen; /* function or variable */ 3107 fvdef = fvnameseen; /* function or variable */
3126 *is_func_or_var = TRUE; 3108 *is_func_or_var = TRUE;
@@ -3216,9 +3198,12 @@ C_entries (c_ext, inf)
3216 register int toklen; /* length of current token */ 3198 register int toklen; /* length of current token */
3217 char *qualifier; /* string used to qualify names */ 3199 char *qualifier; /* string used to qualify names */
3218 int qlen; /* length of qualifier */ 3200 int qlen; /* length of qualifier */
3219 int cblev; /* current curly brace level */ 3201 int bracelev; /* current brace level */
3202 int bracketlev; /* current bracket level */
3220 int parlev; /* current parenthesis level */ 3203 int parlev; /* current parenthesis level */
3221 int typdefcblev; /* cblev where a typedef struct body begun */ 3204 int attrparlev; /* __attribute__ parenthesis level */
3205 int templatelev; /* current template level */
3206 int typdefbracelev; /* bracelev where a typedef struct body begun */
3222 bool incomm, inquote, inchar, quotednl, midtoken; 3207 bool incomm, inquote, inchar, quotednl, midtoken;
3223 bool yacc_rules; /* in the rules part of a yacc file */ 3208 bool yacc_rules; /* in the rules part of a yacc file */
3224 struct tok savetoken; /* token saved during preprocessor handling */ 3209 struct tok savetoken; /* token saved during preprocessor handling */
@@ -3231,10 +3216,10 @@ C_entries (c_ext, inf)
3231 cstack.size = (DEBUG) ? 1 : 4; 3216 cstack.size = (DEBUG) ? 1 : 4;
3232 cstack.nl = 0; 3217 cstack.nl = 0;
3233 cstack.cname = xnew (cstack.size, char *); 3218 cstack.cname = xnew (cstack.size, char *);
3234 cstack.cblev = xnew (cstack.size, int); 3219 cstack.bracelev = xnew (cstack.size, int);
3235 } 3220 }
3236 3221
3237 tokoff = toklen = typdefcblev = 0; /* keep compiler quiet */ 3222 tokoff = toklen = typdefbracelev = 0; /* keep compiler quiet */
3238 curndx = newndx = 0; 3223 curndx = newndx = 0;
3239 lp = curlb.buffer; 3224 lp = curlb.buffer;
3240 *lp = 0; 3225 *lp = 0;
@@ -3244,8 +3229,7 @@ C_entries (c_ext, inf)
3244 yacc_rules = FALSE; 3229 yacc_rules = FALSE;
3245 midtoken = inquote = inchar = incomm = quotednl = FALSE; 3230 midtoken = inquote = inchar = incomm = quotednl = FALSE;
3246 token.valid = savetoken.valid = FALSE; 3231 token.valid = savetoken.valid = FALSE;
3247 cblev = 0; 3232 bracelev = bracketlev = parlev = attrparlev = templatelev = 0;
3248 parlev = 0;
3249 if (cjava) 3233 if (cjava)
3250 { qualifier = "."; qlen = 1; } 3234 { qualifier = "."; qlen = 1; }
3251 else 3235 else
@@ -3257,8 +3241,8 @@ C_entries (c_ext, inf)
3257 c = *lp++; 3241 c = *lp++;
3258 if (c == '\\') 3242 if (c == '\\')
3259 { 3243 {
3260 /* If we're at the end of the line, the next character is a 3244 /* If we are at the end of the line, the next character is a
3261 '\0'; don't skip it, because it's the thing that tells us 3245 '\0'; do not skip it, because it is what tells us
3262 to read the next line. */ 3246 to read the next line. */
3263 if (*lp == '\0') 3247 if (*lp == '\0')
3264 { 3248 {
@@ -3317,95 +3301,115 @@ C_entries (c_ext, inf)
3317 } 3301 }
3318 continue; 3302 continue;
3319 } 3303 }
3320 else 3304 else if (bracketlev > 0)
3321 switch (c) 3305 {
3322 { 3306 switch (c)
3323 case '"': 3307 {
3324 inquote = TRUE; 3308 case ']':
3325 switch (fvdef) 3309 if (--bracketlev > 0)
3326 {
3327 case fdefunkey:
3328 case fstartlist:
3329 case finlist:
3330 case fignore:
3331 case vignore:
3332 break;
3333 default:
3334 fvextern = FALSE;
3335 fvdef = fvnone;
3336 }
3337 continue;
3338 case '\'':
3339 inchar = TRUE;
3340 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
3341 {
3342 fvextern = FALSE;
3343 fvdef = fvnone;
3344 }
3345 continue;
3346 case '/':
3347 if (*lp == '*')
3348 {
3349 lp++;
3350 incomm = TRUE;
3351 continue; 3310 continue;
3352 }
3353 else if (/* cplpl && */ *lp == '/')
3354 {
3355 c = '\0';
3356 break;
3357 }
3358 else
3359 break; 3311 break;
3360 case '%': 3312 case '\0':
3361 if ((c_ext & YACC) && *lp == '%') 3313 CNL_SAVE_DEFINEDEF ();
3362 {
3363 /* Entering or exiting rules section in yacc file. */
3364 lp++;
3365 definedef = dnone; fvdef = fvnone; fvextern = FALSE;
3366 typdef = tnone; structdef = snone;
3367 midtoken = inquote = inchar = incomm = quotednl = FALSE;
3368 cblev = 0;
3369 yacc_rules = !yacc_rules;
3370 continue;
3371 }
3372 else
3373 break; 3314 break;
3374 case '#': 3315 }
3375 if (definedef == dnone) 3316 continue;
3376 { 3317 }
3377 char *cp; 3318 else switch (c)
3378 bool cpptoken = TRUE; 3319 {
3379 3320 case '"':
3380 /* Look back on this line. If all blanks, or nonblanks 3321 inquote = TRUE;
3381 followed by an end of comment, this is a preprocessor 3322 if (inattribute)
3382 token. */ 3323 break;
3383 for (cp = newlb.buffer; cp < lp-1; cp++) 3324 switch (fvdef)
3384 if (!iswhite (*cp)) 3325 {
3385 { 3326 case fdefunkey:
3386 if (*cp == '*' && *(cp+1) == '/') 3327 case fstartlist:
3387 { 3328 case finlist:
3388 cp++; 3329 case fignore:
3389 cpptoken = TRUE; 3330 case vignore:
3390 } 3331 break;
3391 else 3332 default:
3392 cpptoken = FALSE; 3333 fvextern = FALSE;
3393 } 3334 fvdef = fvnone;
3394 if (cpptoken) 3335 }
3395 definedef = dsharpseen; 3336 continue;
3396 } /* if (definedef == dnone) */ 3337 case '\'':
3397 3338 inchar = TRUE;
3339 if (inattribute)
3340 break;
3341 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
3342 {
3343 fvextern = FALSE;
3344 fvdef = fvnone;
3345 }
3346 continue;
3347 case '/':
3348 if (*lp == '*')
3349 {
3350 lp++;
3351 incomm = TRUE;
3352 continue;
3353 }
3354 else if (/* cplpl && */ *lp == '/')
3355 {
3356 c = '\0';
3357 break;
3358 }
3359 else
3360 break;
3361 case '%':
3362 if ((c_ext & YACC) && *lp == '%')
3363 {
3364 /* Entering or exiting rules section in yacc file. */
3365 lp++;
3366 definedef = dnone; fvdef = fvnone; fvextern = FALSE;
3367 typdef = tnone; structdef = snone;
3368 midtoken = inquote = inchar = incomm = quotednl = FALSE;
3369 bracelev = 0;
3370 yacc_rules = !yacc_rules;
3371 continue;
3372 }
3373 else
3374 break;
3375 case '#':
3376 if (definedef == dnone)
3377 {
3378 char *cp;
3379 bool cpptoken = TRUE;
3380
3381 /* Look back on this line. If all blanks, or nonblanks
3382 followed by an end of comment, this is a preprocessor
3383 token. */
3384 for (cp = newlb.buffer; cp < lp-1; cp++)
3385 if (!iswhite (*cp))
3386 {
3387 if (*cp == '*' && *(cp+1) == '/')
3388 {
3389 cp++;
3390 cpptoken = TRUE;
3391 }
3392 else
3393 cpptoken = FALSE;
3394 }
3395 if (cpptoken)
3396 definedef = dsharpseen;
3397 } /* if (definedef == dnone) */
3398 continue;
3399 case '[':
3400 bracketlev++;
3398 continue; 3401 continue;
3399 } /* switch (c) */ 3402 } /* switch (c) */
3400 3403
3401 3404
3402 /* Consider token only if some involved conditions are satisfied. */ 3405 /* Consider token only if some involved conditions are satisfied. */
3403 if (typdef != tignore 3406 if (typdef != tignore
3404 && definedef != dignorerest 3407 && definedef != dignorerest
3405 && fvdef != finlist 3408 && fvdef != finlist
3406 && structdef != sintemplate 3409 && templatelev == 0
3407 && (definedef != dnone 3410 && (definedef != dnone
3408 || structdef != scolonseen)) 3411 || structdef != scolonseen)
3412 && !inattribute)
3409 { 3413 {
3410 if (midtoken) 3414 if (midtoken)
3411 { 3415 {
@@ -3429,7 +3433,8 @@ C_entries (c_ext, inf)
3429 3433
3430 if (yacc_rules 3434 if (yacc_rules
3431 || consider_token (newlb.buffer + tokoff, toklen, c, 3435 || consider_token (newlb.buffer + tokoff, toklen, c,
3432 &c_ext, cblev, parlev, &funorvar)) 3436 &c_ext, bracelev, parlev,
3437 &funorvar))
3433 { 3438 {
3434 if (fvdef == foperator) 3439 if (fvdef == foperator)
3435 { 3440 {
@@ -3514,7 +3519,7 @@ C_entries (c_ext, inf)
3514 || (funorvar 3519 || (funorvar
3515 && definedef == dnone 3520 && definedef == dnone
3516 && structdef == snone 3521 && structdef == snone
3517 && cblev > 0)); 3522 && bracelev > 0));
3518 } 3523 }
3519 token.lineno = lineno; 3524 token.lineno = lineno;
3520 token.offset = tokoff; 3525 token.offset = tokoff;
@@ -3539,6 +3544,16 @@ C_entries (c_ext, inf)
3539 || instruct) 3544 || instruct)
3540 make_C_tag (funorvar); 3545 make_C_tag (funorvar);
3541 } 3546 }
3547 else /* not yacc and consider_token failed */
3548 {
3549 if (inattribute && fvdef == fignore)
3550 {
3551 /* We have just met __attribute__ after a
3552 function parameter list: do not tag the
3553 function again. */
3554 fvdef = fvnone;
3555 }
3556 }
3542 midtoken = FALSE; 3557 midtoken = FALSE;
3543 } 3558 }
3544 } /* if (endtoken (c)) */ 3559 } /* if (endtoken (c)) */
@@ -3557,6 +3572,9 @@ C_entries (c_ext, inf)
3557 switch (fvdef) 3572 switch (fvdef)
3558 { 3573 {
3559 case fstartlist: 3574 case fstartlist:
3575 /* This prevents tagging fb in
3576 void (__attribute__((noreturn)) *fb) (void);
3577 Fixing this is not easy and not very important. */
3560 fvdef = finlist; 3578 fvdef = finlist;
3561 continue; 3579 continue;
3562 case flistseen: 3580 case flistseen:
@@ -3566,13 +3584,10 @@ C_entries (c_ext, inf)
3566 fvdef = fignore; 3584 fvdef = fignore;
3567 } 3585 }
3568 break; 3586 break;
3569 case fvnameseen:
3570 fvdef = fvnone;
3571 break;
3572 } 3587 }
3573 if (structdef == stagseen && !cjava) 3588 if (structdef == stagseen && !cjava)
3574 { 3589 {
3575 popclass_above (cblev); 3590 popclass_above (bracelev);
3576 structdef = snone; 3591 structdef = snone;
3577 } 3592 }
3578 break; 3593 break;
@@ -3596,6 +3611,8 @@ C_entries (c_ext, inf)
3596 switch (c) 3611 switch (c)
3597 { 3612 {
3598 case ':': 3613 case ':':
3614 if (inattribute)
3615 break;
3599 if (yacc_rules && token.offset == 0 && token.valid) 3616 if (yacc_rules && token.offset == 0 && token.valid)
3600 { 3617 {
3601 make_C_tag (FALSE); /* a yacc function */ 3618 make_C_tag (FALSE); /* a yacc function */
@@ -3630,7 +3647,7 @@ C_entries (c_ext, inf)
3630 } 3647 }
3631 break; 3648 break;
3632 case ';': 3649 case ';':
3633 if (definedef != dnone) 3650 if (definedef != dnone || inattribute)
3634 break; 3651 break;
3635 switch (typdef) 3652 switch (typdef)
3636 { 3653 {
@@ -3650,7 +3667,7 @@ C_entries (c_ext, inf)
3650 fvdef = fvnone; 3667 fvdef = fvnone;
3651 break; 3668 break;
3652 case fvnameseen: 3669 case fvnameseen:
3653 if ((globals && cblev == 0 && (!fvextern || declarations)) 3670 if ((globals && bracelev == 0 && (!fvextern || declarations))
3654 || (members && instruct)) 3671 || (members && instruct))
3655 make_C_tag (FALSE); /* a variable */ 3672 make_C_tag (FALSE); /* a variable */
3656 fvextern = FALSE; 3673 fvextern = FALSE;
@@ -3658,9 +3675,12 @@ C_entries (c_ext, inf)
3658 token.valid = FALSE; 3675 token.valid = FALSE;
3659 break; 3676 break;
3660 case flistseen: 3677 case flistseen:
3661 if (declarations 3678 if ((declarations
3662 && (typdef == tnone || (typdef != tignore && instruct))) 3679 && (cplpl || !instruct)
3663 make_C_tag (TRUE); /* a function declaration */ 3680 && (typdef == tnone || (typdef != tignore && instruct)))
3681 || (members
3682 && plainc && instruct))
3683 make_C_tag (TRUE); /* a function */
3664 /* FALLTHRU */ 3684 /* FALLTHRU */
3665 default: 3685 default:
3666 fvextern = FALSE; 3686 fvextern = FALSE;
@@ -3680,7 +3700,7 @@ C_entries (c_ext, inf)
3680 structdef = snone; 3700 structdef = snone;
3681 break; 3701 break;
3682 case ',': 3702 case ',':
3683 if (definedef != dnone) 3703 if (definedef != dnone || inattribute)
3684 break; 3704 break;
3685 switch (objdef) 3705 switch (objdef)
3686 { 3706 {
@@ -3702,16 +3722,20 @@ C_entries (c_ext, inf)
3702 case fdefunname: 3722 case fdefunname:
3703 fvdef = fignore; 3723 fvdef = fignore;
3704 break; 3724 break;
3705 case fvnameseen: /* a variable */ 3725 case fvnameseen:
3706 if ((globals && cblev == 0 && (!fvextern || declarations)) 3726 if (parlev == 0
3707 || (members && instruct)) 3727 && ((globals
3708 make_C_tag (FALSE); 3728 && bracelev == 0
3729 && templatelev == 0
3730 && (!fvextern || declarations))
3731 || (members && instruct)))
3732 make_C_tag (FALSE); /* a variable */
3709 break; 3733 break;
3710 case flistseen: /* a function */ 3734 case flistseen:
3711 if ((declarations && typdef == tnone && !instruct) 3735 if ((declarations && typdef == tnone && !instruct)
3712 || (members && typdef != tignore && instruct)) 3736 || (members && typdef != tignore && instruct))
3713 { 3737 {
3714 make_C_tag (TRUE); /* a function declaration */ 3738 make_C_tag (TRUE); /* a function */
3715 fvdef = fvnameseen; 3739 fvdef = fvnameseen;
3716 } 3740 }
3717 else if (!declarations) 3741 else if (!declarations)
@@ -3724,8 +3748,8 @@ C_entries (c_ext, inf)
3724 if (structdef == stagseen) 3748 if (structdef == stagseen)
3725 structdef = snone; 3749 structdef = snone;
3726 break; 3750 break;
3727 case '[': 3751 case ']':
3728 if (definedef != dnone) 3752 if (definedef != dnone || inattribute)
3729 break; 3753 break;
3730 if (structdef == stagseen) 3754 if (structdef == stagseen)
3731 structdef = snone; 3755 structdef = snone;
@@ -3746,8 +3770,8 @@ C_entries (c_ext, inf)
3746 case vignore: 3770 case vignore:
3747 break; 3771 break;
3748 case fvnameseen: 3772 case fvnameseen:
3749 if ((members && cblev == 1) 3773 if ((members && bracelev == 1)
3750 || (globals && cblev == 0 3774 || (globals && bracelev == 0
3751 && (!fvextern || declarations))) 3775 && (!fvextern || declarations)))
3752 make_C_tag (FALSE); /* a variable */ 3776 make_C_tag (FALSE); /* a variable */
3753 /* FALLTHRU */ 3777 /* FALLTHRU */
@@ -3758,6 +3782,11 @@ C_entries (c_ext, inf)
3758 } 3782 }
3759 break; 3783 break;
3760 case '(': 3784 case '(':
3785 if (inattribute)
3786 {
3787 attrparlev++;
3788 break;
3789 }
3761 if (definedef != dnone) 3790 if (definedef != dnone)
3762 break; 3791 break;
3763 if (objdef == otagseen && parlev == 0) 3792 if (objdef == otagseen && parlev == 0)
@@ -3787,6 +3816,12 @@ C_entries (c_ext, inf)
3787 parlev++; 3816 parlev++;
3788 break; 3817 break;
3789 case ')': 3818 case ')':
3819 if (inattribute)
3820 {
3821 if (--attrparlev == 0)
3822 inattribute = FALSE;
3823 break;
3824 }
3790 if (definedef != dnone) 3825 if (definedef != dnone)
3791 break; 3826 break;
3792 if (objdef == ocatseen && parlev == 1) 3827 if (objdef == ocatseen && parlev == 1)
@@ -3820,9 +3855,9 @@ C_entries (c_ext, inf)
3820 if (typdef == ttypeseen) 3855 if (typdef == ttypeseen)
3821 { 3856 {
3822 /* Whenever typdef is set to tinbody (currently only 3857 /* Whenever typdef is set to tinbody (currently only
3823 here), typdefcblev should be set to cblev. */ 3858 here), typdefbracelev should be set to bracelev. */
3824 typdef = tinbody; 3859 typdef = tinbody;
3825 typdefcblev = cblev; 3860 typdefbracelev = bracelev;
3826 } 3861 }
3827 switch (fvdef) 3862 switch (fvdef)
3828 { 3863 {
@@ -3846,26 +3881,26 @@ C_entries (c_ext, inf)
3846 break; 3881 break;
3847 default: 3882 default:
3848 /* Neutralize `extern "C" {' grot. */ 3883 /* Neutralize `extern "C" {' grot. */
3849 if (cblev == 0 && structdef == snone && nestlev == 0 3884 if (bracelev == 0 && structdef == snone && nestlev == 0
3850 && typdef == tnone) 3885 && typdef == tnone)
3851 cblev = -1; 3886 bracelev = -1;
3852 } 3887 }
3853 break; 3888 break;
3854 } 3889 }
3855 switch (structdef) 3890 switch (structdef)
3856 { 3891 {
3857 case skeyseen: /* unnamed struct */ 3892 case skeyseen: /* unnamed struct */
3858 pushclass_above (cblev, NULL, 0); 3893 pushclass_above (bracelev, NULL, 0);
3859 structdef = snone; 3894 structdef = snone;
3860 break; 3895 break;
3861 case stagseen: /* named struct or enum */ 3896 case stagseen: /* named struct or enum */
3862 case scolonseen: /* a class */ 3897 case scolonseen: /* a class */
3863 pushclass_above (cblev, token.line+token.offset, token.length); 3898 pushclass_above (bracelev,token.line+token.offset, token.length);
3864 structdef = snone; 3899 structdef = snone;
3865 make_C_tag (FALSE); /* a struct or enum */ 3900 make_C_tag (FALSE); /* a struct or enum */
3866 break; 3901 break;
3867 } 3902 }
3868 cblev++; 3903 bracelev++;
3869 break; 3904 break;
3870 case '*': 3905 case '*':
3871 if (definedef != dnone) 3906 if (definedef != dnone)
@@ -3881,21 +3916,21 @@ C_entries (c_ext, inf)
3881 break; 3916 break;
3882 if (!ignoreindent && lp == newlb.buffer + 1) 3917 if (!ignoreindent && lp == newlb.buffer + 1)
3883 { 3918 {
3884 if (cblev != 0) 3919 if (bracelev != 0)
3885 token.valid = FALSE; 3920 token.valid = FALSE;
3886 cblev = 0; /* reset curly brace level if first column */ 3921 bracelev = 0; /* reset brace level if first column */
3887 parlev = 0; /* also reset paren level, just in case... */ 3922 parlev = 0; /* also reset paren level, just in case... */
3888 } 3923 }
3889 else if (cblev > 0) 3924 else if (bracelev > 0)
3890 cblev--; 3925 bracelev--;
3891 else 3926 else
3892 token.valid = FALSE; /* something gone amiss, token unreliable */ 3927 token.valid = FALSE; /* something gone amiss, token unreliable */
3893 popclass_above (cblev); 3928 popclass_above (bracelev);
3894 structdef = snone; 3929 structdef = snone;
3895 /* Only if typdef == tinbody is typdefcblev significant. */ 3930 /* Only if typdef == tinbody is typdefbracelev significant. */
3896 if (typdef == tinbody && cblev <= typdefcblev) 3931 if (typdef == tinbody && bracelev <= typdefbracelev)
3897 { 3932 {
3898 assert (cblev == typdefcblev); 3933 assert (bracelev == typdefbracelev);
3899 typdef = tend; 3934 typdef = tend;
3900 } 3935 }
3901 break; 3936 break;
@@ -3910,8 +3945,8 @@ C_entries (c_ext, inf)
3910 case vignore: 3945 case vignore:
3911 break; 3946 break;
3912 case fvnameseen: 3947 case fvnameseen:
3913 if ((members && cblev == 1) 3948 if ((members && bracelev == 1)
3914 || (globals && cblev == 0 && (!fvextern || declarations))) 3949 || (globals && bracelev == 0 && (!fvextern || declarations)))
3915 make_C_tag (FALSE); /* a variable */ 3950 make_C_tag (FALSE); /* a variable */
3916 /* FALLTHRU */ 3951 /* FALLTHRU */
3917 default: 3952 default:
@@ -3919,30 +3954,31 @@ C_entries (c_ext, inf)
3919 } 3954 }
3920 break; 3955 break;
3921 case '<': 3956 case '<':
3922 if (cplpl && structdef == stagseen) 3957 if (cplpl
3958 && (structdef == stagseen || fvdef == fvnameseen))
3923 { 3959 {
3924 structdef = sintemplate; 3960 templatelev++;
3925 break; 3961 break;
3926 } 3962 }
3927 goto resetfvdef; 3963 goto resetfvdef;
3928 case '>': 3964 case '>':
3929 if (structdef == sintemplate) 3965 if (templatelev > 0)
3930 { 3966 {
3931 structdef = stagseen; 3967 templatelev--;
3932 break; 3968 break;
3933 } 3969 }
3934 goto resetfvdef; 3970 goto resetfvdef;
3935 case '+': 3971 case '+':
3936 case '-': 3972 case '-':
3937 if (objdef == oinbody && cblev == 0) 3973 if (objdef == oinbody && bracelev == 0)
3938 { 3974 {
3939 objdef = omethodsign; 3975 objdef = omethodsign;
3940 break; 3976 break;
3941 } 3977 }
3942 /* FALLTHRU */ 3978 /* FALLTHRU */
3943 resetfvdef: 3979 resetfvdef:
3944 case '#': case '~': case '&': case '%': case '/': case '|': 3980 case '#': case '~': case '&': case '%': case '/':
3945 case '^': case '!': case '.': case '?': case ']': 3981 case '|': case '^': case '!': case '.': case '?':
3946 if (definedef != dnone) 3982 if (definedef != dnone)
3947 break; 3983 break;
3948 /* These surely cannot follow a function tag in C. */ 3984 /* These surely cannot follow a function tag in C. */
@@ -4894,6 +4930,31 @@ Lisp_functions (inf)
4894 4930
4895 4931
4896/* 4932/*
4933 * Lua script language parsing
4934 * Original code by David A. Capello <dacap@users.sourceforge.net> (2004)
4935 *
4936 * "function" and "local function" are tags if they start at column 1.
4937 */
4938static void
4939Lua_functions (inf)
4940 FILE *inf;
4941{
4942 register char *bp;
4943
4944 LOOP_ON_INPUT_LINES (inf, lb, bp)
4945 {
4946 if (bp[0] != 'f' && bp[0] != 'l')
4947 continue;
4948
4949 LOOKING_AT (bp, "local"); /* skip possible "local" */
4950
4951 if (LOOKING_AT (bp, "function"))
4952 get_tag (bp, NULL);
4953 }
4954}
4955
4956
4957/*
4897 * Postscript tag functions 4958 * Postscript tag functions
4898 * Just look for lines where the first character is '/' 4959 * Just look for lines where the first character is '/'
4899 * Also look at "defineps" for PSWrap 4960 * Also look at "defineps" for PSWrap
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0d9e7b45e24..6edfb468241 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,4 +1,154 @@
12004-09-08 Stefan <monnier@iro.umontreal.ca> 12004-09-15 Miles Bader <miles@gnu.org>
2
3 * generic.el (generic-make-keywords-list): Use symbol rather than
4 word anchors in regexp.
5
62004-09-14 Sean O'Rourke <sorourke@cs.ucsd.edu>
7
8 * ibuf-ext.el (define-ibuffer-filter filename): If buffer has
9 no file name consider `dired-directory'.
10
112004-09-14 Kim F. Storm <storm@cua.dk>
12
13 * faces.el (cursor): Add face-no-inherit property. Doc fix.
14
152004-09-14 Simon Josefsson <jas@extundo.com>
16
17 * files.el (auto-mode-alist): Map .soa and .zone to dns-mode.
18
19 * textmodes/dns-mode.el: Add.
20
212004-09-13 Stefan Monnier <monnier@iro.umontreal.ca>
22
23 * novice.el (disabled-command-hook): Use shorthand for obsolescence.
24 (disabled-command-function): Make the ?\ char more obvious.
25
26 * vc-arch.el (vc-arch-root, vc-arch-registered):
27 * vc-mcvs.el (vc-mcvs-root, vc-mcvs-registered): Use vc-find-root.
28
292004-09-13 Hovav Shacham <hovav@sha1.stanford.edu>
30
31 * windmove.el (windmove-frame-edges): Report coordinates of
32 outside edges of frame, not inside edges.
33 (windmove-coordinates-of-position): Convert into wrapper to new
34 function `windmove-coordinates-of-window-position';
35 `compute-motion' always applies to selected window.
36 (windmove-coordinates-of-position): Update documentation to refer
37 to Emacs 21 Lisp Reference Manual.
38 (windmove-find-other-window): Fix off-by-one errors for max x,y.
39
402004-09-13 Kim F. Storm <storm@cua.dk>
41
42 * isearch.el (isearch-resume-in-command-history): Rename from
43 isearch-resume-enabled and change default to nil.
44
452004-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
46
47 * vc-hooks.el (vc-ignore-dir-regexp): New var.
48 (vc-registered): Use it.
49 (vc-find-root): New fun.
50
51 * emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
52 Don't tell to use \\{...} when it's already done.
53
54 * textmodes/bibtex.el (bibtex-generate-url-list): Change format.
55 Provide a sample complex default.
56 (bibtex-url, bibtex-font-lock-url): Adapt to new format.
57 (bibtex-entry): Use mapc.
58
592004-09-12 Kim F. Storm <storm@cua.dk>
60
61 * kmacro.el (kmacro-step-edit-prompt): Add "%s" format to message.
62
63 * emulation/cua-rect.el (cua--rectangle-operation): Let bind
64 inhibit-field-text-motion to t so rectangles work in comint buffers.
65
66 * simple.el (choose-completion-string): Set buffer before running
67 choose-completion-string-functions hook so it can be buffer-local.
68
692004-09-12 Daniel Pfeiffer <occitan@esperanto.org>
70
71 * progmodes/compile.el (compilation-start): Parse command to see
72 if it starts with a cd, and if so perform it for the *compilation*
73 buffer. Change the header to reflect this.
74
752004-09-11 Kim F. Storm <storm@cua.dk>
76
77 * ido.el (ido-enable-dot-prefix): Doc fix.
78 (ido-enable-dot-prefix): New defcustom.
79 (ido-set-matches1): Use it.
80
812004-09-10 Stefan Monnier <monnier@iro.umontreal.ca>
82
83 * textmodes/bibtex.el (bibtex-mark-active)
84 (bibtex-run-with-idle-timer): Move the `if' inside the defun.
85
862004-09-10 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
87
88 * textmodes/bibtex.el (bibtex-autokey-titleword-ignore): Regexp is
89 used in a case insensitive environment.
90 (bibtex-mode-map): Rearrange order of menus.
91 (bibtex-quoted-string-re): Obsolete.
92 (bibtex-complete-key-cleanup): Variable replaced by new function.
93 (bibtex-font-lock-keywords): Use backquotes.
94 (bibtex-font-lock-url-regexp): New internal variable.
95 (bibtex-name-in-field): New optional arg remove-opt-alt to remove
96 "OPT" and "ALT".
97 (bibtex-insert-current-kill, bibtex-make-field)
98 (bibtex-prepare-new-entry, bibtex-yank-pop, bibtex-String): Use unless.
99 (bibtex-parse-field-text): Simplify.
100 (bibtex-string=): New helper function.
101 (bibtex-member-of-regexp): Merge with bibtex-autokey-get-title.
102 (bibtex-map-entries): Use bibtex-string=.
103 (bibtex-search-entry): Use not.
104 (bibtex-enclosing-field): Fix docstring.
105 (bibtex-assoc-regexp): Obsolete.
106 (bibtex-format-entry): Use assoc-string and bibtex-string=.
107 (bibtex-autokey-get-names): Handle empty name field.
108 (bibtex-parse-strings): Use assoc-string and unless.
109 (bibtex-complete-string-cleanup): Expansion list is passed as an arg.
110 Use assoc-string.
111 (bibtex-pop): Simplify.
112 (bibtex-mode): Set font-lock-extra-managed-props.
113 (bibtex-entry-update): Use assoc-string.
114 (bibtex-parse-entry): Remove "OPT" and "ALT" from FIELD.
115 (bibtex-autofill-entry): Use bibtex-string=.
116 (bibtex-print-help-message): Simplify.
117 (bibtex-find-entry): New optional arg START.
118 (bibtex-validate): Use bibtex-string= and assoc-string.
119 Do not call obsolete function compilation-parse-errors.
120 (bibtex-remove-delimiters): Only remove delimiters if present.
121 (bibtex-copy-entry-as-kill): Add docstring.
122 (bibtex-clean-entry): Use bibtex-string=. Handle empty keys.
123 Detect duplicate keys if bibtex-maintain-sorted-entries is nil.
124 (bibtex-complete): Use bibtex-predefined-month-strings,
125 bibtex-string=, and new function bibtex-complete-key-cleanup.
126 (bibtex-generate-url-list): New variable.
127 (bibtex-url): New command bound to C-c C-l and mouse-2.
128 (bibtex-url-map): New local keymap for bibtex-url-mouse.
129 (bibtex-font-lock-url): New function.
130
1312004-09-09 Stefan Monnier <monnier@iro.umontreal.ca>
132
133 * progmodes/grep.el (grep-mode): Remove unnecessary autoload.
134
1352004-09-09 Kim F. Storm <storm@cua.dk>
136
137 * kmacro.el (kmacro-bind-to-key): Associate dedicated macro
138 counter and format with binding.
139 (kmacro-name-last-macro): New defun. Like name-last-kbd-macro, but
140 the declared macro uses own macro counter and format. Give symbol
141 kmacro property.
142 (kmacro-keymap): Bind kmacro-name-last-macro to n.
143 (kmacro-start-macro, kmacro-end-macro, kmacro-call-macro)
144 (kmacro-end-and-call-macro): Doc fix.
145
1462004-09-09 Lars Hansen <larsh@math.ku.dk>
147
148 * desktop.el (desktop-clear-preserve-buffers):
149 Remove make-obsolete-variable.
150
1512004-09-08 Stefan Monnier <monnier@iro.umontreal.ca>
2 152
3 * vc-arch.el (vc-arch-state): Fix parsing for `names' method. 153 * vc-arch.el (vc-arch-state): Fix parsing for `names' method.
4 154
@@ -85,7 +235,7 @@
85 window system if overflow-newline-into-fringe is enabled. 235 window system if overflow-newline-into-fringe is enabled.
86 (term-mode): Don't disable overflow-newline-into-fringe. 236 (term-mode): Don't disable overflow-newline-into-fringe.
87 237
882004-09-07 Stefan <monnier@iro.umontreal.ca> 2382004-09-07 Stefan Monnier <monnier@iro.umontreal.ca>
89 239
90 * term/xterm.el (function-key-map): Add bindings for C- and S- cursor 240 * term/xterm.el (function-key-map): Add bindings for C- and S- cursor
91 motion as seen on my Mac OS X xterms. 241 motion as seen on my Mac OS X xterms.
@@ -342,8 +492,8 @@
342 492
3432004-08-29 Kim F. Storm <storm@cua.dk> 4932004-08-29 Kim F. Storm <storm@cua.dk>
344 494
345 * emulation/cua-base.el (cua-auto-expand-rectangles): Remove 495 * emulation/cua-base.el (cua-auto-expand-rectangles):
346 automatic rectangle padding feature; replace by non-destructive 496 Remove automatic rectangle padding feature; replace by non-destructive
347 virtual rectangle edges feature. 497 virtual rectangle edges feature.
348 (cua-virtual-rectangle-edges): New defcustom. 498 (cua-virtual-rectangle-edges): New defcustom.
349 (cua-auto-tabify-rectangles): New defcustom. 499 (cua-auto-tabify-rectangles): New defcustom.
@@ -826,8 +976,8 @@
826 key-translation-map. 976 key-translation-map.
827 (encoded-kbd-setup-keymap): Setup key-translation-map. 977 (encoded-kbd-setup-keymap): Setup key-translation-map.
828 (saved-key-translation-map): New variable. 978 (saved-key-translation-map): New variable.
829 (encoded-kbd-mode): Save/restore key-translation-map. Adjusted 979 (encoded-kbd-mode): Save/restore key-translation-map.
830 for the change of encoded-kbd-setup-keymap. 980 Adjust for the change of encoded-kbd-setup-keymap.
831 981
8322004-08-02 Kim F. Storm <storm@cua.dk> 9822004-08-02 Kim F. Storm <storm@cua.dk>
833 983
@@ -990,12 +1140,11 @@
990 1140
991 Sync with Tramp 2.0.43. 1141 Sync with Tramp 2.0.43.
992 1142
993 * net/tramp.el (tramp-handle-verify-visited-file-modtime): Remove 1143 * net/tramp.el (tramp-handle-verify-visited-file-modtime):
994 outdated comment. 1144 Remove outdated comment.
995 (tramp-locked, tramp-locker): New variables for implementing a 1145 (tramp-locked, tramp-locker): New variables for implementing a
996 global lock. 1146 global lock.
997 (tramp-sh-file-name-handler): Use them to implement the global 1147 (tramp-sh-file-name-handler): Use them to implement the global lock.
998 lock.
999 1148
10002004-07-13 Michael Albinus <michael.albinus@gmx.de> 11492004-07-13 Michael Albinus <michael.albinus@gmx.de>
1001 1150
@@ -1030,14 +1179,15 @@
1030 * emacs-lisp/testcover.el: New category "potentially-1valued" for 1179 * emacs-lisp/testcover.el: New category "potentially-1valued" for
1031 functions that are not erroneous if either 1-valued or 1180 functions that are not erroneous if either 1-valued or
1032 multi-valued. Detect functions in this class. 1181 multi-valued. Detect functions in this class.
1033 (testcover-1value-functions, testcover-compose-functions, 1182 (testcover-1value-functions, testcover-compose-functions)
1034 testcover-progn-functions) Added some additional functions to lists. 1183 (testcover-progn-functions) Added some additional functions to lists.
1035 (testcover-mark): Bugfix when marking up the definition for an 1184 (testcover-mark): Bugfix when marking up the definition for an
1036 empty function. 1185 empty function.
1037 1186
10382004-07-17 Richard M. Stallman <rms@gnu.org> 11872004-07-17 Richard M. Stallman <rms@gnu.org>
1039 1188
1040 * replace.el (occur-read-primary-args): Pass default to read-from-minibuffer. 1189 * replace.el (occur-read-primary-args): Pass default to
1190 read-from-minibuffer.
1041 1191
1042 * mail/footnote.el (footnote-section-tag): Use defcustom. 1192 * mail/footnote.el (footnote-section-tag): Use defcustom.
1043 1193
@@ -1146,8 +1296,8 @@
1146 1296
11472004-07-09 John Paul Wallington <jpw@gnu.org> 12972004-07-09 John Paul Wallington <jpw@gnu.org>
1148 1298
1149 * emacs-lisp/re-builder.el (reb-update-overlays): Distinguish 1299 * emacs-lisp/re-builder.el (reb-update-overlays):
1150 between one and several matches in message. 1300 Distinguish between one and several matches in message.
1151 1301
11522004-07-09 Richard M. Stallman <rms@gnu.org> 13022004-07-09 Richard M. Stallman <rms@gnu.org>
1153 1303
@@ -1185,11 +1335,11 @@
1185 Do not treat double clicks and triple clicks specially in the 1335 Do not treat double clicks and triple clicks specially in the
1186 scroll bar (preventing strange repositioning problems) 1336 scroll bar (preventing strange repositioning problems)
1187 1337
11882004-07-06 Stefan <monnier@iro.umontreal.ca> 13382004-07-06 Stefan Monnier <monnier@iro.umontreal.ca>
1189 1339
1190 * replace.el (query-replace-regexp-eval): Fix last change. 1340 * replace.el (query-replace-regexp-eval): Fix last change.
1191 1341
11922004-07-05 Stefan <monnier@iro.umontreal.ca> 13422004-07-05 Stefan Monnier <monnier@iro.umontreal.ca>
1193 1343
1194 * replace.el (query-replace-descr): New fun. 1344 * replace.el (query-replace-descr): New fun.
1195 (query-replace-read-from, query-replace-read-args): Default to the 1345 (query-replace-read-from, query-replace-read-args): Default to the
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index cf1743c3490..486f0f38964 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -14327,7 +14327,7 @@
143272002-06-01 Kim F. Storm <storm@cua.dk> 143272002-06-01 Kim F. Storm <storm@cua.dk>
14328 14328
14329 * simple.el: Reworked previous change. 14329 * simple.el: Reworked previous change.
14330 (choose-completion-string1): Merged back into choose-completion-string. 14330 (choose-completion-string1): Merge back into choose-completion-string.
14331 (choose-completion-string): Run choose-completion-string-functions 14331 (choose-completion-string): Run choose-completion-string-functions
14332 after checking for proper minibuffer window. Added mini-p arg to 14332 after checking for proper minibuffer window. Added mini-p arg to
14333 the hook functions. Insert choice if all hook functions return nil. 14333 the hook functions. Insert choice if all hook functions return nil.
@@ -14348,7 +14348,7 @@
143482002-06-01 Kim F. Storm <storm@cua.dk> 143482002-06-01 Kim F. Storm <storm@cua.dk>
14349 14349
14350 * simple.el (choose-completion-string-functions): New special hook. 14350 * simple.el (choose-completion-string-functions): New special hook.
14351 (choose-completion-string1): Renamed from choose-completion-string. 14351 (choose-completion-string1): Rename from choose-completion-string.
14352 (choose-completion-string): Run choose-completion-string-functions 14352 (choose-completion-string): Run choose-completion-string-functions
14353 until success, and only call choose-completion-string1 if it fails. 14353 until success, and only call choose-completion-string1 if it fails.
14354 14354
diff --git a/lisp/desktop.el b/lisp/desktop.el
index a71fc6c79fe..28521a0d7c4 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -171,13 +171,13 @@ This is useful for truncating history lists, for example."
171 :type 'hook 171 :type 'hook
172 :group 'desktop) 172 :group 'desktop)
173 173
174(defcustom desktop-globals-to-save '( 174(defcustom desktop-globals-to-save
175 desktop-missing-file-warning 175 '(desktop-missing-file-warning
176 tags-file-name 176 tags-file-name
177 tags-table-list 177 tags-table-list
178 search-ring 178 search-ring
179 regexp-search-ring 179 regexp-search-ring
180 register-alist) 180 register-alist)
181 "List of global variables saved by `desktop-save'. 181 "List of global variables saved by `desktop-save'.
182An element may be variable name (a symbol) or a cons cell of the form 182An element may be variable name (a symbol) or a cons cell of the form
183\(VAR . MAX-SIZE), which means to truncate VAR's value to at most 183\(VAR . MAX-SIZE), which means to truncate VAR's value to at most
@@ -186,13 +186,13 @@ Feature: Saving `kill-ring' implies saving `kill-ring-yank-pointer'."
186 :type '(repeat (restricted-sexp :match-alternatives (symbolp consp))) 186 :type '(repeat (restricted-sexp :match-alternatives (symbolp consp)))
187 :group 'desktop) 187 :group 'desktop)
188 188
189(defcustom desktop-globals-to-clear '( 189(defcustom desktop-globals-to-clear
190 kill-ring 190 '(kill-ring
191 kill-ring-yank-pointer 191 kill-ring-yank-pointer
192 search-ring 192 search-ring
193 search-ring-yank-pointer 193 search-ring-yank-pointer
194 regexp-search-ring 194 regexp-search-ring
195 regexp-search-ring-yank-pointer) 195 regexp-search-ring-yank-pointer)
196 "List of global variables to clear by `desktop-clear'. 196 "List of global variables to clear by `desktop-clear'.
197An element may be variable name (a symbol) or a cons cell of the form 197An element may be variable name (a symbol) or a cons cell of the form
198\(VAR . FORM). Symbols are set to nil and for cons cells VAR is set 198\(VAR . FORM). Symbols are set to nil and for cons cells VAR is set
@@ -202,29 +202,27 @@ to the value obtained by evaluateing FORM."
202 202
203(defcustom desktop-clear-preserve-buffers-regexp 203(defcustom desktop-clear-preserve-buffers-regexp
204 "^\\(\\*scratch\\*\\|\\*Messages\\*\\|\\*tramp/.+\\*\\)$" 204 "^\\(\\*scratch\\*\\|\\*Messages\\*\\|\\*tramp/.+\\*\\)$"
205 "Regexp identifying buffers that `desktop-clear' should not delete." 205 "Regexp identifying buffers that `desktop-clear' should not delete.
206See also `desktop-clear-preserve-buffers'."
206 :type 'regexp 207 :type 'regexp
207 :group 'desktop) 208 :group 'desktop)
208 209
209;; Maintained for backward compatibility
210(defcustom desktop-clear-preserve-buffers nil 210(defcustom desktop-clear-preserve-buffers nil
211 "*List of buffer names that `desktop-clear' should not delete. 211 "*List of buffer names that `desktop-clear' should not delete.
212This variable is maintained for backward compatibility only." 212See also `desktop-clear-preserve-buffers-regexp'."
213 :type '(repeat string) 213 :type '(repeat string)
214 :group 'desktop) 214 :group 'desktop)
215(make-obsolete-variable 'desktop-clear-preserve-buffers 215
216 'desktop-clear-preserve-buffers-regexp) 216(defcustom desktop-locals-to-save
217 217 '(desktop-locals-to-save ; Itself! Think it over.
218(defcustom desktop-locals-to-save '( 218 truncate-lines
219 desktop-locals-to-save ; Itself! Think it over. 219 case-fold-search
220 truncate-lines 220 case-replace
221 case-fold-search 221 fill-column
222 case-replace 222 overwrite-mode
223 fill-column 223 change-log-default-name
224 overwrite-mode 224 line-number-mode
225 change-log-default-name 225 buffer-file-coding-system)
226 line-number-mode
227 buffer-file-coding-system)
228 "List of local variables to save for each buffer. 226 "List of local variables to save for each buffer.
229The variables are saved only when they really are local." 227The variables are saved only when they really are local."
230 :type '(repeat symbol) 228 :type '(repeat symbol)
@@ -282,11 +280,11 @@ DESKTOP-BUFFER-MISC.")
282(make-obsolete-variable 'desktop-buffer-misc-functions 280(make-obsolete-variable 'desktop-buffer-misc-functions
283 'desktop-save-buffer) 281 'desktop-save-buffer)
284 282
285(defcustom desktop-buffer-mode-handlers '( 283(defcustom desktop-buffer-mode-handlers
286 (dired-mode . dired-restore-desktop-buffer) 284 '((dired-mode . dired-restore-desktop-buffer)
287 (rmail-mode . rmail-restore-desktop-buffer) 285 (rmail-mode . rmail-restore-desktop-buffer)
288 (mh-folder-mode . mh-restore-desktop-buffer) 286 (mh-folder-mode . mh-restore-desktop-buffer)
289 (Info-mode . Info-restore-desktop-buffer)) 287 (Info-mode . Info-restore-desktop-buffer))
290 "Alist of major mode specific functions to restore a desktop buffer. 288 "Alist of major mode specific functions to restore a desktop buffer.
291Functions are called by `desktop-read'. List elements must have the form 289Functions are called by `desktop-read'. List elements must have the form
292\(MAJOR-MODE . RESTORE-BUFFER-FUNCTION). 290\(MAJOR-MODE . RESTORE-BUFFER-FUNCTION).
@@ -580,8 +578,7 @@ See also `desktop-base-file-name'."
580 (let ((filename (expand-file-name desktop-base-file-name dirname)) 578 (let ((filename (expand-file-name desktop-base-file-name dirname))
581 (info 579 (info
582 (mapcar 580 (mapcar
583 (function 581 #'(lambda (b)
584 (lambda (b)
585 (set-buffer b) 582 (set-buffer b)
586 (list 583 (list
587 (desktop-file-name (buffer-file-name) dirname) 584 (desktop-file-name (buffer-file-name) dirname)
@@ -618,7 +615,7 @@ See also `desktop-base-file-name'."
618 (when (member (car locals) loclist) 615 (when (member (car locals) loclist)
619 (setq ll (cons (car locals) ll))))) 616 (setq ll (cons (car locals) ll)))))
620 (setq locals (cdr locals))) 617 (setq locals (cdr locals)))
621 ll)))) 618 ll)))
622 (buffer-list))) 619 (buffer-list)))
623 (buf (get-buffer-create "*desktop*"))) 620 (buf (get-buffer-create "*desktop*")))
624 (set-buffer buf) 621 (set-buffer buf)
@@ -639,19 +636,15 @@ See also `desktop-base-file-name'."
639 " kill-ring))\n")) 636 " kill-ring))\n"))
640 637
641 (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n") 638 (insert "\n;; Buffer section -- buffers listed in same order as in buffer list:\n")
642 (mapcar 639 (mapcar #'(lambda (l)
643 (function 640 (if (apply 'desktop-save-buffer-p l)
644 (lambda (l) 641 (progn
645 (if (apply 'desktop-save-buffer-p l) 642 (insert "(desktop-create-buffer " desktop-file-version)
646 (progn 643 (mapcar #'(lambda (e)
647 (insert "(desktop-create-buffer " desktop-file-version) 644 (insert "\n " (desktop-value-to-string e)))
648 (mapcar 645 l)
649 (function 646 (insert ")\n\n"))))
650 (lambda (e) 647 info)
651 (insert "\n " (desktop-value-to-string e))))
652 l)
653 (insert ")\n\n")))))
654 info)
655 (setq default-directory dirname) 648 (setq default-directory dirname)
656 (when (file-exists-p filename) (delete-file filename)) 649 (when (file-exists-p filename) (delete-file filename))
657 (let ((coding-system-for-write 'utf-8-emacs)) 650 (let ((coding-system-for-write 'utf-8-emacs))
@@ -816,18 +809,18 @@ directory DIRNAME."
816 (defvar desktop-first-buffer) ;; Dynamically bound in `desktop-read' 809 (defvar desktop-first-buffer) ;; Dynamically bound in `desktop-read'
817) 810)
818 811
819(defun desktop-create-buffer ( 812(defun desktop-create-buffer
820 desktop-file-version 813 (desktop-file-version
821 desktop-buffer-file-name 814 desktop-buffer-file-name
822 desktop-buffer-name 815 desktop-buffer-name
823 desktop-buffer-major-mode 816 desktop-buffer-major-mode
824 desktop-buffer-minor-modes 817 desktop-buffer-minor-modes
825 desktop-buffer-point 818 desktop-buffer-point
826 desktop-buffer-mark 819 desktop-buffer-mark
827 desktop-buffer-read-only 820 desktop-buffer-read-only
828 desktop-buffer-misc 821 desktop-buffer-misc
829 &optional 822 &optional
830 desktop-buffer-locals) 823 desktop-buffer-locals)
831 ;; Just to silence the byte compiler. Bound locally in `desktop-read'. 824 ;; Just to silence the byte compiler. Bound locally in `desktop-read'.
832 (eval-when-compile 825 (eval-when-compile
833 (defvar desktop-buffer-ok-count) 826 (defvar desktop-buffer-ok-count)
@@ -835,21 +828,21 @@ directory DIRNAME."
835 ;; To make desktop files with relative file names possible, we cannot 828 ;; To make desktop files with relative file names possible, we cannot
836 ;; allow `default-directory' to change. Therefore we save current buffer. 829 ;; allow `default-directory' to change. Therefore we save current buffer.
837 (save-current-buffer 830 (save-current-buffer
838 (let ( 831 (let ((buffer-list (buffer-list))
839 (buffer-list (buffer-list)) 832 (result
840 (result 833 (condition-case err
841 (condition-case err 834 (funcall (or (cdr (assq desktop-buffer-major-mode
842 (funcall (or (cdr (assq desktop-buffer-major-mode desktop-buffer-mode-handlers)) 835 desktop-buffer-mode-handlers))
843 'desktop-restore-file-buffer) 836 'desktop-restore-file-buffer)
844 desktop-buffer-file-name 837 desktop-buffer-file-name
845 desktop-buffer-name 838 desktop-buffer-name
846 desktop-buffer-misc) 839 desktop-buffer-misc)
847 (error 840 (error
848 (message "Desktop: Can't load buffer %s: %s" 841 (message "Desktop: Can't load buffer %s: %s"
849 desktop-buffer-name (error-message-string err)) 842 desktop-buffer-name
850 (when desktop-missing-file-warning (sit-for 1)) 843 (error-message-string err))
851 nil))) 844 (when desktop-missing-file-warning (sit-for 1))
852 ) 845 nil))))
853 (if (bufferp result) 846 (if (bufferp result)
854 (setq desktop-buffer-ok-count (1+ desktop-buffer-ok-count)) 847 (setq desktop-buffer-ok-count (1+ desktop-buffer-ok-count))
855 (setq desktop-buffer-fail-count (1+ desktop-buffer-fail-count)) 848 (setq desktop-buffer-fail-count (1+ desktop-buffer-fail-count))
@@ -867,17 +860,14 @@ directory DIRNAME."
867 (unless (equal (buffer-name) desktop-buffer-name) 860 (unless (equal (buffer-name) desktop-buffer-name)
868 (rename-buffer desktop-buffer-name)) 861 (rename-buffer desktop-buffer-name))
869 ;; minor modes 862 ;; minor modes
870 (cond ( 863 (cond ((equal '(t) desktop-buffer-minor-modes) ; backwards compatible
871 ;; backwards compatible 864 (auto-fill-mode 1))
872 (equal '(t) desktop-buffer-minor-modes) 865 ((equal '(nil) desktop-buffer-minor-modes) ; backwards compatible
873 (auto-fill-mode 1))( 866 (auto-fill-mode 0))
874 (equal '(nil) desktop-buffer-minor-modes) 867 (t
875 (auto-fill-mode 0))( 868 (mapcar #'(lambda (minor-mode)
876 t 869 (when (functionp minor-mode) (funcall minor-mode 1)))
877 (mapcar 870 desktop-buffer-minor-modes)))
878 #'(lambda (minor-mode)
879 (when (functionp minor-mode) (funcall minor-mode 1)))
880 desktop-buffer-minor-modes)))
881 ;; Even though point and mark are non-nil when written by `desktop-save' 871 ;; Even though point and mark are non-nil when written by `desktop-save'
882 ;; they may be modified by handlers wanting to set point or mark themselves. 872 ;; they may be modified by handlers wanting to set point or mark themselves.
883 (when desktop-buffer-point 873 (when desktop-buffer-point
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 2aba3ea254c..cc2be890657 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1561,8 +1561,9 @@ mouse-[0-3]\\)\\)\\>"))
1561 ;; to describe the most important commands in your major mode, and 1561 ;; to describe the most important commands in your major mode, and
1562 ;; then use `\\{...}' to display the rest of the mode's keymap. 1562 ;; then use `\\{...}' to display the rest of the mode's keymap.
1563 (save-excursion 1563 (save-excursion
1564 (if (re-search-forward "\\\\\\\\\\[\\w+" e t 1564 (if (and (re-search-forward "\\\\\\\\\\[\\w+" e t
1565 (1+ checkdoc-max-keyref-before-warn)) 1565 (1+ checkdoc-max-keyref-before-warn))
1566 (not (re-search-forward "\\\\\\\\{\\w+}" e t)))
1566 (checkdoc-create-error 1567 (checkdoc-create-error
1567 "Too many occurrences of \\[function]. Use \\{keymap} instead" 1568 "Too many occurrences of \\[function]. Use \\{keymap} instead"
1568 s (marker-position e)))) 1569 s (marker-position e))))
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 10d369fa042..742ae2033be 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -559,7 +559,8 @@ If command is repeated at same position, delete the rectangle."
559 ;; Rectangle is padded if PAD = t or numeric and (cua--rectangle-virtual-edges) 559 ;; Rectangle is padded if PAD = t or numeric and (cua--rectangle-virtual-edges)
560 ;; Perform auto-tabify after operation if TABIFY is non-nil. 560 ;; Perform auto-tabify after operation if TABIFY is non-nil.
561 ;; Mark is kept if keep-clear is 'keep and cleared if keep-clear is 'clear. 561 ;; Mark is kept if keep-clear is 'keep and cleared if keep-clear is 'clear.
562 (let* ((start (cua--rectangle-top)) 562 (let* ((inhibit-field-text-motion t)
563 (start (cua--rectangle-top))
563 (end (cua--rectangle-bot)) 564 (end (cua--rectangle-bot))
564 (l (cua--rectangle-left)) 565 (l (cua--rectangle-left))
565 (r (1+ (cua--rectangle-right))) 566 (r (1+ (cua--rectangle-right)))
diff --git a/lisp/faces.el b/lisp/faces.el
index 5ab91b5f1ba..8926bb2a65e 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1925,11 +1925,13 @@ created."
1925 1925
1926 1926
1927(defface cursor '() 1927(defface cursor '()
1928 "Basic face for the cursor color under X." 1928 "Basic face for the cursor color under X.
1929Note: Other faces cannot inherit from the cursor face."
1929 :version "21.1" 1930 :version "21.1"
1930 :group 'cursor 1931 :group 'cursor
1931 :group 'basic-faces) 1932 :group 'basic-faces)
1932 1933
1934(put 'cursor 'face-no-inherit t)
1933 1935
1934(defface mouse '() 1936(defface mouse '()
1935 "Basic face for the mouse color under X." 1937 "Basic face for the mouse color under X."
diff --git a/lisp/files.el b/lisp/files.el
index 30f318fbf69..5571ede9d3e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1771,6 +1771,7 @@ in that case, this function acts as if `enable-local-variables' were t."
1771 ("\\.g\\'" . antlr-mode) 1771 ("\\.g\\'" . antlr-mode)
1772 ("\\.ses\\'" . ses-mode) 1772 ("\\.ses\\'" . ses-mode)
1773 ("\\.orig\\'" nil t) ; from patch 1773 ("\\.orig\\'" nil t) ; from patch
1774 ("\\.\\(soa\\|zone\\)\\'" . dns-mode)
1774 ("\\.in\\'" nil t))) 1775 ("\\.in\\'" nil t)))
1775 "Alist of filename patterns vs corresponding major mode functions. 1776 "Alist of filename patterns vs corresponding major mode functions.
1776Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL). 1777Each element looks like (REGEXP . FUNCTION) or (REGEXP FUNCTION NON-NIL).
diff --git a/lisp/generic.el b/lisp/generic.el
index a951a0d53d8..84cd4d0730f 100644
--- a/lisp/generic.el
+++ b/lisp/generic.el
@@ -405,10 +405,10 @@ INI file. This hook is NOT installed by default."
405The regexp is highlighted with FACE." 405The regexp is highlighted with FACE."
406 (unless (listp keywords-list) 406 (unless (listp keywords-list)
407 (error "Keywords argument must be a list of strings")) 407 (error "Keywords argument must be a list of strings"))
408 (list (concat prefix "\\<" 408 (list (concat prefix "\\_<"
409 ;; Use an optimized regexp. 409 ;; Use an optimized regexp.
410 (regexp-opt keywords-list t) 410 (regexp-opt keywords-list t)
411 "\\>" suffix) 411 "\\_>" suffix)
412 1 412 1
413 face)) 413 face))
414 414
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 0f0f4697c47..668607af94d 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,23 @@
12004-09-13 Reiner Steib <Reiner.Steib@gmx.de>
2
3 * gnus-sum.el (gnus-summary-copy-article): Fixed doc string.
4
52004-09-10 Miles Bader <miles@gnu.ai.mit.edu>
6
7 * nnimap.el (nnimap-open-connection): Remove extraneous end-paren.
8
92004-09-10 Teodor Zlatanov <tzz@lifelogs.com>
10
11 * nnimap.el (nnimap-open-connection): allow 'imaps' as a synonym
12 for the 'imap' port in netrc files
13
14 * gnus-registry.el (gnus-registry-trim): watch out for negatives
15 in gnus-registry-trim
16
172004-09-10 Simon Josefsson <jas@extundo.com>
18
19 * nndb.el (require): Remove tcp and duplicate cl.
20
12004-09-08 Reiner Steib <Reiner.Steib@gmx.de> 212004-09-08 Reiner Steib <Reiner.Steib@gmx.de>
2 22
3 * nntp.el (nntp): New customization group. 23 * nntp.el (nntp): New customization group.
@@ -388,12 +408,14 @@
388 * gnus-cus.el: Merged revisions 7.2 through 7.5 into branch to support 408 * gnus-cus.el: Merged revisions 7.2 through 7.5 into branch to support
389 gnus-agent.el update and incorporate bug fixes. 409 gnus-agent.el update and incorporate bug fixes.
390 410
391;; Local Variables: 411See ChangeLog.2 for earlier changes.
392;; coding: iso-2022-7bit
393;; End:
394 412
395 Copyright (C) 2002 2004 Free Software Foundation, Inc. 413 Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
396 Copying and distribution of this file, with or without modification, 414 Copying and distribution of this file, with or without modification,
397 are permitted provided the copyright notice and this notice are preserved. 415 are permitted provided the copyright notice and this notice are preserved.
398 416
417;; Local Variables:
418;; coding: iso-2022-7bit
419;; End:
420
399;;; arch-tag: 3f33a3e7-090d-492b-bedd-02a1417d32b4 421;;; arch-tag: 3f33a3e7-090d-492b-bedd-02a1417d32b4
diff --git a/lisp/gnus/ChangeLog.2 b/lisp/gnus/ChangeLog.2
index c36aad0a6e9..2dbd6d306dd 100644
--- a/lisp/gnus/ChangeLog.2
+++ b/lisp/gnus/ChangeLog.2
@@ -18913,12 +18913,18 @@
18913 * smime.el: New file. 18913 * smime.el: New file.
18914 * mml-smime.el: New file. 18914 * mml-smime.el: New file.
18915 18915
18916;; Local Variables: 189162000-10-27 19:42:12 ShengHuo ZHU <zsh@cs.rochester.edu>
18917;; coding: iso-2022-7bit 18917
18918;; End: 18918 * ChangeLog: Moved to ChangeLog.1.
18919
18920See ChangeLog.1 for earlier changes.
18919 18921
18920 Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. 18922 Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
18921 Copying and distribution of this file, with or without modification, 18923 Copying and distribution of this file, with or without modification,
18922 are permitted provided the copyright notice and this notice are preserved. 18924 are permitted provided the copyright notice and this notice are preserved.
18923 18925
18924;; arch-tag: 13460c90-d3bc-4be2-9e15-c7c271d0c1eb 18926;; Local Variables:
18927;; coding: iso-2022-7bit
18928;; End:
18929
18930;; arch-tag: 956fd310-042f-4fca-8dca-a01dbe06acff
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index 9a8d77d3b24..33238ef4552 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -266,25 +266,27 @@ way."
266(defun gnus-registry-trim (alist) 266(defun gnus-registry-trim (alist)
267 "Trim alist to size, using gnus-registry-max-entries." 267 "Trim alist to size, using gnus-registry-max-entries."
268 (if (null gnus-registry-max-entries) 268 (if (null gnus-registry-max-entries)
269 alist ; just return the alist 269 alist ; just return the alist
270 ;; else, when given max-entries, trim the alist 270 ;; else, when given max-entries, trim the alist
271 (let ((timehash (make-hash-table 271 (let* ((timehash (make-hash-table
272 :size 4096 272 :size 4096
273 :test 'equal))) 273 :test 'equal))
274 (trim-length (- (length alist) gnus-registry-max-entries))
275 (trim-length (if (natnump trim-length) trim-length 0)))
274 (maphash 276 (maphash
275 (lambda (key value) 277 (lambda (key value)
276 (puthash key (gnus-registry-fetch-extra key 'mtime) timehash)) 278 (puthash key (gnus-registry-fetch-extra key 'mtime) timehash))
277 gnus-registry-hashtb) 279 gnus-registry-hashtb)
278 280
279 ;; we use the return value of this setq, which is the trimmed alist 281 ;; we use the return value of this setq, which is the trimmed alist
280 (setq alist 282 (setq alist
281 (nthcdr 283 (nthcdr
282 (- (length alist) gnus-registry-max-entries) 284 trim-length
283 (sort alist 285 (sort alist
284 (lambda (a b) 286 (lambda (a b)
285 (time-less-p 287 (time-less-p
286 (cdr (gethash (car a) timehash)) 288 (cdr (gethash (car a) timehash))
287 (cdr (gethash (car b) timehash)))))))))) 289 (cdr (gethash (car b) timehash))))))))))
288 290
289(defun alist-to-hashtable (alist) 291(defun alist-to-hashtable (alist)
290 "Build a hashtable from the values in ALIST." 292 "Build a hashtable from the values in ALIST."
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 4a7bb5ac9e7..1d1e30935cb 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -9056,8 +9056,8 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
9056 (gnus-set-mode-line 'summary))) 9056 (gnus-set-mode-line 'summary)))
9057 9057
9058(defun gnus-summary-copy-article (&optional n to-newsgroup select-method) 9058(defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
9059 "Move the current article to a different newsgroup. 9059 "Copy the current article to some other group.
9060If TO-NEWSGROUP is string, do not prompt for a newsgroup to move to. 9060If TO-NEWSGROUP is string, do not prompt for a newsgroup to copy to.
9061When called interactively, if TO-NEWSGROUP is nil, use the value of 9061When called interactively, if TO-NEWSGROUP is nil, use the value of
9062the variable `gnus-move-split-methods' for finding a default target 9062the variable `gnus-move-split-methods' for finding a default target
9063newsgroup. 9063newsgroup.
diff --git a/lisp/gnus/nndb.el b/lisp/gnus/nndb.el
index d29d16fa690..bd8523f11b2 100644
--- a/lisp/gnus/nndb.el
+++ b/lisp/gnus/nndb.el
@@ -1,6 +1,6 @@
1;;; nndb.el --- nndb access for Gnus 1;;; nndb.el --- nndb access for Gnus
2 2
3;; Copyright (C) 1997, 1998, 2000, 2003 Free Software Foundation, Inc. 3;; Copyright (C) 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
4 4
5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet> 5;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
6;; Kai Grossjohann <grossjohann@ls6.informatik.uni-dortmund.de> 6;; Kai Grossjohann <grossjohann@ls6.informatik.uni-dortmund.de>
@@ -60,12 +60,6 @@
60(eval-when-compile (require 'cl)) 60(eval-when-compile (require 'cl))
61 61
62(eval-and-compile 62(eval-and-compile
63 (unless (fboundp 'open-network-stream)
64 (require 'tcp)))
65
66(eval-when-compile (require 'cl))
67
68(eval-and-compile
69 (autoload 'news-setup "rnewspost") 63 (autoload 'news-setup "rnewspost")
70 (autoload 'news-reply-mode "rnewspost") 64 (autoload 'news-reply-mode "rnewspost")
71 (autoload 'cancel-timer "timer") 65 (autoload 'cancel-timer "timer")
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index fc33b9a48eb..08aa48a5948 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -723,10 +723,15 @@ If EXAMINE is non-nil the group is selected read-only."
723 (int-to-string nnimap-server-port) 723 (int-to-string nnimap-server-port)
724 "imap")) 724 "imap"))
725 (alist (or (gnus-netrc-machine list server port "imap") 725 (alist (or (gnus-netrc-machine list server port "imap")
726 (gnus-netrc-machine list server port "imaps")
726 (gnus-netrc-machine list 727 (gnus-netrc-machine list
727 (or nnimap-server-address 728 (or nnimap-server-address
728 nnimap-address) 729 nnimap-address)
729 port "imap"))) 730 port "imap")
731 (gnus-netrc-machine list
732 (or nnimap-server-address
733 nnimap-address)
734 port "imaps")))
730 (user (gnus-netrc-get alist "login")) 735 (user (gnus-netrc-get alist "login"))
731 (passwd (gnus-netrc-get alist "password"))) 736 (passwd (gnus-netrc-get alist "password")))
732 (if (imap-authenticate user passwd nnimap-server-buffer) 737 (if (imap-authenticate user passwd nnimap-server-buffer)
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 96678d2bc9a..b7e6741e9d4 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1015,7 +1015,10 @@ currently used by buffers."
1015 "Toggle current view to buffers with filename matching QUALIFIER." 1015 "Toggle current view to buffers with filename matching QUALIFIER."
1016 (:description "filename" 1016 (:description "filename"
1017 :reader (read-from-minibuffer "Filter by filename (regexp): ")) 1017 :reader (read-from-minibuffer "Filter by filename (regexp): "))
1018 (ibuffer-awhen (buffer-file-name buf) 1018 (ibuffer-awhen (with-current-buffer buf
1019 (or buffer-file-name
1020 (and (boundp 'dired-directory)
1021 dired-directory)))
1019 (string-match qualifier it))) 1022 (string-match qualifier it)))
1020 1023
1021;;;###autoload (autoload 'ibuffer-filter-by-size-gt "ibuf-ext.el") 1024;;;###autoload (autoload 'ibuffer-filter-by-size-gt "ibuf-ext.el")
diff --git a/lisp/ido.el b/lisp/ido.el
index ae376741f1b..b82338ef85d 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -482,14 +482,20 @@ Value can be toggled within `ido' using `ido-toggle-regexp'."
482 :group 'ido) 482 :group 'ido)
483 483
484(defcustom ido-enable-prefix nil 484(defcustom ido-enable-prefix nil
485 "*Nil means that `ido' will match if the inserted text is an 485 "*Non-nil means only match if the entered text is a prefix of file name.
486arbitrary substring (default). If non-nil `ido' will only match if the inserted 486This behavior is like the standard emacs-completion.
487text is a prefix \(this behavior is like the standard unix- or 487Nil means to match if the entered text is an arbitrary substring.
488emacs-completion works).
489Value can be toggled within `ido' using `ido-toggle-prefix'." 488Value can be toggled within `ido' using `ido-toggle-prefix'."
490 :type 'boolean 489 :type 'boolean
491 :group 'ido) 490 :group 'ido)
492 491
492(defcustom ido-enable-dot-prefix nil
493 "*Non-nil means to match leading dot as prefix.
494I.e. hidden files and buffers will match only if you type a dot
495as first char even if `ido-enable-prefix' is nil."
496 :type 'boolean
497 :group 'ido)
498
493(defcustom ido-confirm-unique-completion nil 499(defcustom ido-confirm-unique-completion nil
494 "*Non-nil means that even a unique completion must be confirmed. 500 "*Non-nil means that even a unique completion must be confirmed.
495This means that \\[ido-complete] must always be followed by \\[ido-exit-minibuffer] 501This means that \\[ido-complete] must always be followed by \\[ido-exit-minibuffer]
@@ -2928,13 +2934,22 @@ for first matching file."
2928 (concat "\\`" re "\\'"))) 2934 (concat "\\`" re "\\'")))
2929 (prefix-re (and full-re (not ido-enable-prefix) 2935 (prefix-re (and full-re (not ido-enable-prefix)
2930 (concat "\\`" rexq))) 2936 (concat "\\`" rexq)))
2937 (non-prefix-dot (or (not ido-enable-dot-prefix)
2938 (not ido-process-ignore-lists)
2939 ido-enable-prefix
2940 (= (length ido-text) 0)))
2941
2931 full-matches 2942 full-matches
2932 prefix-matches 2943 prefix-matches
2933 matches) 2944 matches)
2934 (mapcar 2945 (mapcar
2935 (lambda (item) 2946 (lambda (item)
2936 (let ((name (ido-name item))) 2947 (let ((name (ido-name item)))
2937 (if (string-match re name) 2948 (if (and (or non-prefix-dot
2949 (if (= (aref ido-text 0) ?.)
2950 (= (aref name 0) ?.)
2951 (/= (aref name 0) ?.)))
2952 (string-match re name))
2938 (cond 2953 (cond
2939 ((and full-re (string-match full-re name)) 2954 ((and full-re (string-match full-re name))
2940 (setq full-matches (cons item full-matches))) 2955 (setq full-matches (cons item full-matches)))
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 12ac2ea1165..1e8e0f6586e 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -146,8 +146,10 @@ Ordinarily the text becomes invisible again at the end of the search."
146 :type 'boolean 146 :type 'boolean
147 :group 'isearch) 147 :group 'isearch)
148 148
149(defcustom isearch-resume-enabled t 149(defcustom isearch-resume-in-command-history nil
150 "*If non-nil, `isearch-resume' commands are added to the command history." 150 "*If non-nil, `isearch-resume' commands are added to the command history.
151This allows you to resume earlier isearch sessions through the
152command history."
151 :type 'boolean 153 :type 'boolean
152 :group 'isearch) 154 :group 'isearch)
153 155
@@ -647,7 +649,7 @@ is treated as a regexp. See \\[isearch-forward] for more info."
647 (setq disable-point-adjustment t)) 649 (setq disable-point-adjustment t))
648 650
649(defun isearch-done (&optional nopush edit) 651(defun isearch-done (&optional nopush edit)
650 (if isearch-resume-enabled 652 (if isearch-resume-in-command-history
651 (let ((command `(isearch-resume ,isearch-string ,isearch-regexp 653 (let ((command `(isearch-resume ,isearch-string ,isearch-regexp
652 ,isearch-word ,isearch-forward 654 ,isearch-word ,isearch-forward
653 ,isearch-message 655 ,isearch-message
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index a129ab53cef..5aefe46625d 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -204,7 +204,7 @@ macro to be executed before appending to it."
204 204
205 ;; naming and binding 205 ;; naming and binding
206 (define-key map "b" 'kmacro-bind-to-key) 206 (define-key map "b" 'kmacro-bind-to-key)
207 (define-key map "n" 'name-last-kbd-macro) 207 (define-key map "n" 'kmacro-name-last-macro)
208 map) 208 map)
209 "Keymap for keyboard macro commands.") 209 "Keymap for keyboard macro commands.")
210(defalias 'kmacro-keymap kmacro-keymap) 210(defalias 'kmacro-keymap kmacro-keymap)
@@ -539,8 +539,8 @@ Displays the selected macro in the echo area."
539The commands are recorded even as they are executed. 539The commands are recorded even as they are executed.
540Use \\[kmacro-end-macro] to finish recording and make the macro available. 540Use \\[kmacro-end-macro] to finish recording and make the macro available.
541Use \\[kmacro-end-and-call-macro] to execute the macro. 541Use \\[kmacro-end-and-call-macro] to execute the macro.
542Use \\[name-last-kbd-macro] to give it a permanent name. 542
543Non-nil arg (prefix arg) means append to last macro defined; 543Non-nil arg (prefix arg) means append to last macro defined.
544 544
545With \\[universal-argument] prefix, append to last keyboard macro 545With \\[universal-argument] prefix, append to last keyboard macro
546defined. Depending on `kmacro-execute-before-append', this may begin 546defined. Depending on `kmacro-execute-before-append', this may begin
@@ -551,7 +551,10 @@ defining the macro.
551 551
552Use \\[kmacro-insert-counter] to insert (and increment) the macro counter. 552Use \\[kmacro-insert-counter] to insert (and increment) the macro counter.
553The counter value can be set or modified via \\[kmacro-set-counter] and \\[kmacro-add-counter]. 553The counter value can be set or modified via \\[kmacro-set-counter] and \\[kmacro-add-counter].
554The format of the counter can be modified via \\[kmacro-set-format]." 554The format of the counter can be modified via \\[kmacro-set-format].
555
556Use \\[kmacro-name-last-macro] to give it a permanent name.
557Use \\[kmacro-bind-to-key] to bind it to a key sequence."
555 (interactive "P") 558 (interactive "P")
556 (if (or defining-kbd-macro executing-kbd-macro) 559 (if (or defining-kbd-macro executing-kbd-macro)
557 (message "Already defining keyboard macro.") 560 (message "Already defining keyboard macro.")
@@ -585,7 +588,7 @@ The format of the counter can be modified via \\[kmacro-set-format]."
585 "Finish defining a keyboard macro. 588 "Finish defining a keyboard macro.
586The definition was started by \\[kmacro-start-macro]. 589The definition was started by \\[kmacro-start-macro].
587The macro is now available for use via \\[kmacro-call-macro], 590The macro is now available for use via \\[kmacro-call-macro],
588or it can be given a name with \\[name-last-kbd-macro] and then invoked 591or it can be given a name with \\[kmacro-name-last-macro] and then invoked
589under that name. 592under that name.
590 593
591With numeric arg, repeat macro now that many times, 594With numeric arg, repeat macro now that many times,
@@ -609,7 +612,7 @@ command. See `kmacro-call-repeat-key' and `kmacro-call-repeat-with-arg'
609for details on how to adjust or disable this behaviour. 612for details on how to adjust or disable this behaviour.
610 613
611To make a macro permanent so you can call it even after defining 614To make a macro permanent so you can call it even after defining
612others, use \\[name-last-kbd-macro]." 615others, use \\[kmacro-name-last-macro]."
613 (interactive "p") 616 (interactive "p")
614 (let ((repeat-key (and (null no-repeat) 617 (let ((repeat-key (and (null no-repeat)
615 (> (length (this-single-command-keys)) 1) 618 (> (length (this-single-command-keys)) 1)
@@ -707,7 +710,7 @@ With numeric prefix ARG, repeat macro that many times.
707Zero argument means repeat until there is an error. 710Zero argument means repeat until there is an error.
708 711
709To give a macro a permanent name, so you can call it 712To give a macro a permanent name, so you can call it
710even after defining other macros, use \\[name-last-kbd-macro]." 713even after defining other macros, use \\[kmacro-name-last-macro]."
711 (interactive "P") 714 (interactive "P")
712 (if defining-kbd-macro 715 (if defining-kbd-macro
713 (kmacro-end-macro nil)) 716 (kmacro-end-macro nil))
@@ -771,10 +774,38 @@ may be shaded by a local key binding."
771 (yes-or-no-p (format "%s runs command %S. Bind anyway? " 774 (yes-or-no-p (format "%s runs command %S. Bind anyway? "
772 (format-kbd-macro key-seq) 775 (format-kbd-macro key-seq)
773 cmd)))) 776 cmd))))
774 (define-key global-map key-seq last-kbd-macro) 777 (define-key global-map key-seq
778 `(lambda (&optional arg)
779 "Keyboard macro."
780 (interactive "p")
781 (kmacro-exec-ring-item ',(kmacro-ring-head) arg)))
775 (message "Keyboard macro bound to %s" (format-kbd-macro key-seq)))))) 782 (message "Keyboard macro bound to %s" (format-kbd-macro key-seq))))))
776 783
777 784
785(defun kmacro-name-last-macro (symbol)
786 "Assign a name to the last keyboard macro defined.
787Argument SYMBOL is the name to define.
788The symbol's function definition becomes the keyboard macro string.
789Such a \"function\" cannot be called from Lisp, but it is a valid editor command."
790 (interactive "SName for last kbd macro: ")
791 (or last-kbd-macro
792 (error "No keyboard macro defined"))
793 (and (fboundp symbol)
794 (not (get symbol 'kmacro))
795 (not (stringp (symbol-function symbol)))
796 (not (vectorp (symbol-function symbol)))
797 (error "Function %s is already defined and not a keyboard macro"
798 symbol))
799 (if (string-equal symbol "")
800 (error "No command name given"))
801 (fset symbol
802 `(lambda (&optional arg)
803 "Keyboard macro."
804 (interactive "p")
805 (kmacro-exec-ring-item ',(kmacro-ring-head) arg)))
806 (put symbol 'kmacro t))
807
808
778(defun kmacro-view-macro (&optional arg) 809(defun kmacro-view-macro (&optional arg)
779 "Display the last keyboard macro. 810 "Display the last keyboard macro.
780If repeated, it shows previous elements in the macro ring." 811If repeated, it shows previous elements in the macro ring."
@@ -897,7 +928,8 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
897 (curmsg (current-message))) 928 (curmsg (current-message)))
898 929
899 ;; TODO: Scroll macro if max-mini-window-height is too small. 930 ;; TODO: Scroll macro if max-mini-window-height is too small.
900 (message (concat 931 (message "%s"
932 (concat
901 (format "Macro: %s%s%s%s%s\n" 933 (format "Macro: %s%s%s%s%s\n"
902 (format-kbd-macro kmacro-step-edit-new-macro 1) 934 (format-kbd-macro kmacro-step-edit-new-macro 1)
903 (if (and kmacro-step-edit-new-macro (> (length kmacro-step-edit-new-macro) 0)) " " "") 935 (if (and kmacro-step-edit-new-macro (> (length kmacro-step-edit-new-macro) 0)) " " "")
diff --git a/lisp/novice.el b/lisp/novice.el
index ca9a06769d5..b2a0bec0204 100644
--- a/lisp/novice.el
+++ b/lisp/novice.el
@@ -44,7 +44,7 @@ If nil, the feature is disabled, i.e., all commands work normally.")
44(defvaralias 'disabled-command-hook 'disabled-command-function) 44(defvaralias 'disabled-command-hook 'disabled-command-function)
45(make-obsolete-variable 45(make-obsolete-variable
46 'disabled-command-hook 46 'disabled-command-hook
47 "use the variable `disabled-command-function' instead." "21.4") 47 'disabled-command-function "21.4")
48 48
49;;;###autoload 49;;;###autoload
50(defun disabled-command-function (&rest ignore) 50(defun disabled-command-function (&rest ignore)
@@ -93,7 +93,7 @@ SPC to try the command just this once, but leave it disabled.
93 (message "Type y, n, ! or SPC (the space bar): ") 93 (message "Type y, n, ! or SPC (the space bar): ")
94 (let ((cursor-in-echo-area t)) 94 (let ((cursor-in-echo-area t))
95 (while (not (memq (setq char (downcase (read-char))) 95 (while (not (memq (setq char (downcase (read-char)))
96 '(?! ? ?y ?n))) 96 '(?! ?y ?n ?\ )))
97 (ding) 97 (ding)
98 (message "Please type y, n, ! or SPC (the space bar): ")))) 98 (message "Please type y, n, ! or SPC (the space bar): "))))
99 (if (= char ?!) 99 (if (= char ?!)
@@ -185,5 +185,5 @@ to future sessions."
185 185
186(provide 'novice) 186(provide 'novice)
187 187
188;;; arch-tag: f83c0f96-497e-4db6-a430-8703716c6dd9 188;; arch-tag: f83c0f96-497e-4db6-a430-8703716c6dd9
189;;; novice.el ends here 189;;; novice.el ends here
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 8ae2a7abe76..2f910608d5c 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -849,6 +849,7 @@ Otherwise, construct a buffer name from MODE-NAME."
849 849
850(defun compilation-start (command &optional mode name-function highlight-regexp) 850(defun compilation-start (command &optional mode name-function highlight-regexp)
851 "Run compilation command COMMAND (low level interface). 851 "Run compilation command COMMAND (low level interface).
852If COMMAND starts with a cd command, that becomes the `default-directory'.
852The rest of the arguments are optional; for them, nil means use the default. 853The rest of the arguments are optional; for them, nil means use the default.
853 854
854MODE is the major mode to set in the compilation buffer. Mode 855MODE is the major mode to set in the compilation buffer. Mode
@@ -861,26 +862,29 @@ global value of `compilation-highlight-regexp'.
861 862
862Returns the compilation buffer created." 863Returns the compilation buffer created."
863 (or mode (setq mode 'compilation-mode)) 864 (or mode (setq mode 'compilation-mode))
864 (let ((name-of-mode 865 (let* ((name-of-mode
865 (if (eq mode t) 866 (if (eq mode t)
866 (prog1 "compilation" (require 'comint)) 867 (prog1 "compilation" (require 'comint))
867 (replace-regexp-in-string "-mode$" "" (symbol-name mode)))) 868 (replace-regexp-in-string "-mode$" "" (symbol-name mode))))
868 (process-environment 869 (process-environment
869 (append 870 (append
870 compilation-environment 871 compilation-environment
871 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning 872 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
872 system-uses-terminfo) 873 system-uses-terminfo)
873 (list "TERM=dumb" "TERMCAP=" 874 (list "TERM=dumb" "TERMCAP="
874 (format "COLUMNS=%d" (window-width))) 875 (format "COLUMNS=%d" (window-width)))
875 (list "TERM=emacs" 876 (list "TERM=emacs"
876 (format "TERMCAP=emacs:co#%d:tc=unknown:" 877 (format "TERMCAP=emacs:co#%d:tc=unknown:"
877 (window-width)))) 878 (window-width))))
878 ;; Set the EMACS variable, but 879 ;; Set the EMACS variable, but
879 ;; don't override users' setting of $EMACS. 880 ;; don't override users' setting of $EMACS.
880 (unless (getenv "EMACS") '("EMACS=t")) 881 (unless (getenv "EMACS") '("EMACS=t"))
881 (copy-sequence process-environment))) 882 (copy-sequence process-environment)))
882 (thisdir default-directory) 883 cd-path ; in case process-environment contains CDPATH
883 outwin outbuf) 884 (thisdir (if (string-match "^\\s *cd\\s +\\(.+?\\)\\s *[;&\n]" command)
885 (substitute-in-file-name (match-string 1 command))
886 default-directory))
887 outwin outbuf)
884 (with-current-buffer 888 (with-current-buffer
885 (setq outbuf 889 (setq outbuf
886 (get-buffer-create 890 (get-buffer-create
@@ -901,15 +905,16 @@ Returns the compilation buffer created."
901 (buffer-name))))) 905 (buffer-name)))))
902 ;; Clear out the compilation buffer and make it writable. 906 ;; Clear out the compilation buffer and make it writable.
903 ;; Change its default-directory to the directory where the compilation 907 ;; Change its default-directory to the directory where the compilation
904 ;; will happen, and insert a `cd' command to indicate this. 908 ;; will happen, and insert a `default-directory' to indicate this.
905 (setq buffer-read-only nil) 909 (setq buffer-read-only nil)
906 (buffer-disable-undo (current-buffer)) 910 (buffer-disable-undo (current-buffer))
907 (erase-buffer) 911 (erase-buffer)
908 (buffer-enable-undo (current-buffer)) 912 (buffer-enable-undo (current-buffer))
909 (setq default-directory thisdir) 913 (cd thisdir)
910 ;; output a mode setter, for saving and later reloading this buffer 914 ;; output a mode setter, for saving and later reloading this buffer
911 (insert "cd " thisdir " # -*-" name-of-mode 915 (insert "-*- mode: " name-of-mode
912 "-*-\nEntering directory `" thisdir "'\n" command "\n") 916 "; default-directory: " (prin1-to-string default-directory)
917 " -*-\n" command "\n")
913 (set-buffer-modified-p nil)) 918 (set-buffer-modified-p nil))
914 ;; If we're already in the compilation buffer, go to the end 919 ;; If we're already in the compilation buffer, go to the end
915 ;; of the buffer, so point will track the compilation output. 920 ;; of the buffer, so point will track the compilation output.
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 083540c7820..4d9e05109a8 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -500,17 +500,6 @@ temporarily highlight in visited source lines."
500 command-args) 500 command-args)
501 'grep-mode nil highlight-regexp))) 501 'grep-mode nil highlight-regexp)))
502 502
503;;; This doesn't work:
504;;; ###autoload (autoload 'grep-mode "grep" nil t)
505;;; The ostensibly correct result is nonetheless opaque to the accounting
506;;; done in `generate-file-autoloads'; in loaddefs.el, the generated elisp is
507;;; correct but the generated header comment for grep.el lacks `grep-mode'.
508;;; This approach also doesn't help other users of `define-compilation-mode'
509;;; who wish to autoload.
510;;;
511;;; Better to extend autoload.el to grok `define-compilation-mode'.
512
513;;;###autoload
514(define-compilation-mode grep-mode "Grep" 503(define-compilation-mode grep-mode "Grep"
515 "Sets `grep-last-buffer' and `compilation-window-height'." 504 "Sets `grep-last-buffer' and `compilation-window-height'."
516 (setq grep-last-buffer (current-buffer)) 505 (setq grep-last-buffer (current-buffer))
@@ -626,5 +615,5 @@ those sub directories of DIR."
626 615
627(provide 'grep) 616(provide 'grep)
628 617
629;;; arch-tag: 5a5b9169-a79d-4f38-9c38-f69615f39c4d 618;; arch-tag: 5a5b9169-a79d-4f38-9c38-f69615f39c4d
630;;; grep.el ends here 619;;; grep.el ends here
diff --git a/lisp/simple.el b/lisp/simple.el
index 9bc81759715..899534a899a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4297,11 +4297,12 @@ to decide what to delete."
4297 (not (equal buffer 4297 (not (equal buffer
4298 (window-buffer (active-minibuffer-window)))))) 4298 (window-buffer (active-minibuffer-window))))))
4299 (error "Minibuffer is not active for completion") 4299 (error "Minibuffer is not active for completion")
4300 ;; Set buffer so buffer-local choose-completion-string-functions works.
4301 (set-buffer buffer)
4300 (unless (run-hook-with-args-until-success 4302 (unless (run-hook-with-args-until-success
4301 'choose-completion-string-functions 4303 'choose-completion-string-functions
4302 choice buffer mini-p base-size) 4304 choice buffer mini-p base-size)
4303 ;; Insert the completion into the buffer where it was requested. 4305 ;; Insert the completion into the buffer where it was requested.
4304 (set-buffer buffer)
4305 (if base-size 4306 (if base-size
4306 (delete-region (+ base-size (if mini-p 4307 (delete-region (+ base-size (if mini-p
4307 (minibuffer-prompt-end) 4308 (minibuffer-prompt-end)
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 15348205c51..ddc1d4ecb62 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1,6 +1,6 @@
1;;; bibtex.el --- BibTeX mode for GNU Emacs 1;;; bibtex.el --- BibTeX mode for GNU Emacs
2 2
3;; Copyright (C) 1992,94,95,96,97,98,1999,2003,2004 3;; Copyright (C) 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2003, 2004
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de> 6;; Author: Stefan Schoef <schoef@offis.uni-oldenburg.de>
@@ -61,13 +61,13 @@
61 :type 'hook) 61 :type 'hook)
62 62
63(defcustom bibtex-field-delimiters 'braces 63(defcustom bibtex-field-delimiters 'braces
64 "*Type of field delimiters. Allowed values are `braces' or `double-quotes'." 64 "*Type of field delimiters. Allowed values are `braces' or `double-quotes'."
65 :group 'bibtex 65 :group 'bibtex
66 :type '(choice (const braces) 66 :type '(choice (const braces)
67 (const double-quotes))) 67 (const double-quotes)))
68 68
69(defcustom bibtex-entry-delimiters 'braces 69(defcustom bibtex-entry-delimiters 'braces
70 "*Type of entry delimiters. Allowed values are `braces' or `parentheses'." 70 "*Type of entry delimiters. Allowed values are `braces' or `parentheses'."
71 :group 'bibtex 71 :group 'bibtex
72 :type '(choice (const braces) 72 :type '(choice (const braces)
73 (const parentheses))) 73 (const parentheses)))
@@ -154,10 +154,10 @@ narrowed to just the entry."
154Allowed non-nil values are: 154Allowed non-nil values are:
155plain All entries are sorted alphabetically. 155plain All entries are sorted alphabetically.
156crossref All entries are sorted alphabetically unless an entry has a 156crossref All entries are sorted alphabetically unless an entry has a
157 crossref field. These crossrefed entries are placed in 157 crossref field. These crossrefed entries are placed in
158 alphabetical order immediately preceding the main entry. 158 alphabetical order immediately preceding the main entry.
159entry-class The entries are divided into classes according to their 159entry-class The entries are divided into classes according to their
160 entry name, see `bibtex-sort-entry-class'. Within each class 160 entry name, see `bibtex-sort-entry-class'. Within each class
161 the entries are sorted alphabetically. 161 the entries are sorted alphabetically.
162See also `bibtex-sort-ignore-string-entries'." 162See also `bibtex-sort-ignore-string-entries'."
163 :group 'bibtex 163 :group 'bibtex
@@ -172,8 +172,8 @@ See also `bibtex-sort-ignore-string-entries'."
172 ("Book" "Proceedings")) 172 ("Book" "Proceedings"))
173 "*List of classes of BibTeX entry names, used for sorting entries. 173 "*List of classes of BibTeX entry names, used for sorting entries.
174If value of `bibtex-maintain-sorted-entries' is `entry-class' 174If value of `bibtex-maintain-sorted-entries' is `entry-class'
175entries are ordered according to the classes they belong to. Each 175entries are ordered according to the classes they belong to. Each
176class contains a list of entry names. An entry `catch-all' applies 176class contains a list of entry names. An entry `catch-all' applies
177to all entries not explicitely mentioned.") 177to all entries not explicitely mentioned.")
178 178
179(defcustom bibtex-sort-ignore-string-entries t 179(defcustom bibtex-sort-ignore-string-entries t
@@ -640,7 +640,7 @@ See `bibtex-generate-autokey' for details."
640 640
641(defcustom bibtex-autokey-titleword-ignore 641(defcustom bibtex-autokey-titleword-ignore
642 '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das" 642 '("A" "An" "On" "The" "Eine?" "Der" "Die" "Das"
643 "[^A-Z].*" ".*[^a-zA-Z0-9].*") 643 "[^A-Z].*" ".*[^A-Z0-9].*")
644 "*Determines words from the title that are not to be used in the key. 644 "*Determines words from the title that are not to be used in the key.
645Each item of the list is a regexp. If a word of the title matchs a 645Each item of the list is a regexp. If a word of the title matchs a
646regexp from that list, it is not included in the title part of the key. 646regexp from that list, it is not included in the title part of the key.
@@ -762,11 +762,47 @@ If non-nil, the column for the equal sign is the value of
762 "Automatically fill fields if possible for those BibTeX entry types." 762 "Automatically fill fields if possible for those BibTeX entry types."
763 :type '(repeat string)) 763 :type '(repeat string))
764 764
765(defcustom bibtex-complete-key-cleanup nil 765(defcustom bibtex-generate-url-list
766 "*Function called by `bibtex-complete' after insertion of a key fragment." 766 '((("url" . ".*:.*"))
767 :group 'bibtex-autokey 767 ;; Example of a complex setup.
768 :type '(choice (const :tag "None" nil) 768 (("journal" . "\\<\\(PR[ABCDEL]?\\|RMP\\)\\>")
769 (function :tag "Cleanup function"))) 769 "http://publish.aps.org/abstract/"
770 ("journal" ".*" downcase)
771 "/v"
772 ("volume" ".*" 0)
773 "/p"
774 ("pages" "\\`\\([0-9]+\\)" 1)))
775 "List of schemes for generating the URL of a BibTeX entry.
776These schemes are used by `bibtex-url'.
777
778Each scheme is of the form ((FIELD . REGEXP) STEP...).
779
780FIELD is a field name as returned by `bibtex-parse-entry'.
781REGEXP is matched against the text of FIELD. If the match succeed, then
782this scheme will be used. If no STEPS are specified the matched text is used
783as the URL, otherwise the URL is built by concatenating the STEPS.
784
785A STEP can be a string or a list (FIELD REGEXP REPLACE) in which case
786the text of FIELD is matched against REGEXP, and is replaced with REPLACE.
787REPLACE can be a string, or a number (which selects the corresponding submatch)
788or a function called with the field's text as argument and with the
789`match-data' properly set.
790
791Case is always ignored. Always remove the field delimiters."
792 :group 'bibtex
793 :type '(repeat
794 (list :tag "Scheme"
795 (cons :tag "Matcher" :extra-offset 4
796 (string :tag "BibTeX field")
797 (regexp :tag "Regexp"))
798 (repeat :tag "Steps to generate URL" :inline t
799 (choice
800 (string :tag "Literal text")
801 (list (string :tag "BibTeX field")
802 (regexp :tag "Regexp")
803 (choice (string :tag "Replacement")
804 (integer :tag "Sub-match")
805 (function :tag "Filter"))))))))
770 806
771;; bibtex-font-lock-keywords is a user option as well, but since the 807;; bibtex-font-lock-keywords is a user option as well, but since the
772;; patterns used to define this variable are defined in a later 808;; patterns used to define this variable are defined in a later
@@ -801,6 +837,7 @@ If non-nil, the column for the equal sign is the value of
801 (define-key km "\C-c}" 'bibtex-remove-delimiters) 837 (define-key km "\C-c}" 'bibtex-remove-delimiters)
802 (define-key km "\C-c\C-c" 'bibtex-clean-entry) 838 (define-key km "\C-c\C-c" 'bibtex-clean-entry)
803 (define-key km "\C-c\C-q" 'bibtex-fill-entry) 839 (define-key km "\C-c\C-q" 'bibtex-fill-entry)
840 (define-key km "\C-c\C-s" 'bibtex-find-entry)
804 (define-key km "\C-c?" 'bibtex-print-help-message) 841 (define-key km "\C-c?" 'bibtex-print-help-message)
805 (define-key km "\C-c\C-p" 'bibtex-pop-previous) 842 (define-key km "\C-c\C-p" 'bibtex-pop-previous)
806 (define-key km "\C-c\C-n" 'bibtex-pop-next) 843 (define-key km "\C-c\C-n" 'bibtex-pop-next)
@@ -821,6 +858,7 @@ If non-nil, the column for the equal sign is the value of
821 (define-key km "\C-c\C-b" 'bibtex-entry) 858 (define-key km "\C-c\C-b" 'bibtex-entry)
822 (define-key km "\C-c\C-rn" 'bibtex-narrow-to-entry) 859 (define-key km "\C-c\C-rn" 'bibtex-narrow-to-entry)
823 (define-key km "\C-c\C-rw" 'widen) 860 (define-key km "\C-c\C-rw" 'widen)
861 (define-key km "\C-c\C-l" 'bibtex-url)
824 (define-key km "\C-c\C-o" 'bibtex-remove-OPT-or-ALT) 862 (define-key km "\C-c\C-o" 'bibtex-remove-OPT-or-ALT)
825 (define-key km "\C-c\C-e\C-i" 'bibtex-InProceedings) 863 (define-key km "\C-c\C-e\C-i" 'bibtex-InProceedings)
826 (define-key km "\C-c\C-ei" 'bibtex-InCollection) 864 (define-key km "\C-c\C-ei" 'bibtex-InCollection)
@@ -854,21 +892,7 @@ If non-nil, the column for the equal sign is the value of
854 ("Moving in BibTeX Buffer" 892 ("Moving in BibTeX Buffer"
855 ["Find Entry" bibtex-find-entry t] 893 ["Find Entry" bibtex-find-entry t]
856 ["Find Crossref Entry" bibtex-find-crossref t]) 894 ["Find Crossref Entry" bibtex-find-crossref t])
857 ("Operating on Current Entry"
858 ["Fill Entry" bibtex-fill-entry t]
859 ["Clean Entry" bibtex-clean-entry t]
860 "--" 895 "--"
861 ["Kill Entry" bibtex-kill-entry t]
862 ["Copy Entry to Kill Ring" bibtex-copy-entry-as-kill t]
863 ["Paste Most Recently Killed Entry" bibtex-yank t]
864 ["Paste Previously Killed Entry" bibtex-yank-pop t]
865 "--"
866 ["Ispell Entry" bibtex-ispell-entry t]
867 ["Ispell Entry Abstract" bibtex-ispell-abstract t]
868 ["Narrow to Entry" bibtex-narrow-to-entry t]
869 "--"
870 ["View Cite Locations (RefTeX)" reftex-view-crossref-from-bibtex
871 (fboundp 'reftex-view-crossref-from-bibtex)])
872 ("Operating on Current Field" 896 ("Operating on Current Field"
873 ["Fill Field" fill-paragraph t] 897 ["Fill Field" fill-paragraph t]
874 ["Remove Delimiters" bibtex-remove-delimiters t] 898 ["Remove Delimiters" bibtex-remove-delimiters t]
@@ -888,12 +912,28 @@ If non-nil, the column for the equal sign is the value of
888 ["String or Key Complete" bibtex-complete t] 912 ["String or Key Complete" bibtex-complete t]
889 "--" 913 "--"
890 ["Help about Current Field" bibtex-print-help-message t]) 914 ["Help about Current Field" bibtex-print-help-message t])
915 ("Operating on Current Entry"
916 ["Fill Entry" bibtex-fill-entry t]
917 ["Clean Entry" bibtex-clean-entry t]
918 ["Update Entry" bibtex-entry-update t]
919 "--"
920 ["Kill Entry" bibtex-kill-entry t]
921 ["Copy Entry to Kill Ring" bibtex-copy-entry-as-kill t]
922 ["Paste Most Recently Killed Entry" bibtex-yank t]
923 ["Paste Previously Killed Entry" bibtex-yank-pop t]
924 "--"
925 ["Ispell Entry" bibtex-ispell-entry t]
926 ["Ispell Entry Abstract" bibtex-ispell-abstract t]
927 ["Narrow to Entry" bibtex-narrow-to-entry t]
928 "--"
929 ["View Cite Locations (RefTeX)" reftex-view-crossref-from-bibtex
930 (fboundp 'reftex-view-crossref-from-bibtex)])
891 ("Operating on Buffer or Region" 931 ("Operating on Buffer or Region"
892 ["Validate Entries" bibtex-validate t] 932 ["Validate Entries" bibtex-validate t]
893 ["Sort Entries" bibtex-sort-buffer t] 933 ["Sort Entries" bibtex-sort-buffer t]
894 ["Reformat Entries" bibtex-reformat t] 934 ["Reformat Entries" bibtex-reformat t]
895 ["Count Entries" bibtex-count-entries t]) 935 ["Count Entries" bibtex-count-entries t]
896 ("Miscellaneous" 936 "--"
897 ["Convert Alien Buffer" bibtex-convert-alien t]))) 937 ["Convert Alien Buffer" bibtex-convert-alien t])))
898 938
899(easy-menu-define 939(easy-menu-define
@@ -915,6 +955,13 @@ If non-nil, the column for the equal sign is the value of
915 ["String" bibtex-String t] 955 ["String" bibtex-String t]
916 ["Preamble" bibtex-Preamble t])) 956 ["Preamble" bibtex-Preamble t]))
917 957
958(defvar bibtex-url-map
959 (let ((km (make-sparse-keymap)))
960 (define-key km [(mouse-2)] 'bibtex-url)
961 km)
962 "Local keymap for clickable URLs.")
963(fset 'bibtex-url-map bibtex-url-map)
964
918 965
919;; Internal Variables 966;; Internal Variables
920 967
@@ -954,8 +1001,7 @@ Initialized from `bibtex-predefined-strings' and `bibtex-string-files'.")
954(make-variable-buffer-local 'bibtex-reference-keys) 1001(make-variable-buffer-local 'bibtex-reference-keys)
955 1002
956(defvar bibtex-buffer-last-parsed-tick nil 1003(defvar bibtex-buffer-last-parsed-tick nil
957 "Last value returned by `buffer-modified-tick' when buffer 1004 "Value of `buffer-modified-tick' last time buffer was parsed for keys.")
958was parsed for keys the last time.")
959 1005
960(defvar bibtex-parse-idle-timer nil 1006(defvar bibtex-parse-idle-timer nil
961 "Stores if timer is already installed.") 1007 "Stores if timer is already installed.")
@@ -1040,41 +1086,35 @@ was parsed for keys the last time.")
1040(defconst bibtex-empty-field-re "\"\"\\|{}" 1086(defconst bibtex-empty-field-re "\"\"\\|{}"
1041 "Regexp matching an empty field.") 1087 "Regexp matching an empty field.")
1042 1088
1043(defconst bibtex-quoted-string-re
1044 (concat "\""
1045 "\\("
1046 "[^\"\\]" ; anything but quote or backslash
1047 "\\|"
1048 "\\("
1049 "\\\\\\(.\\|\n\\)" ; any backslash quoted character
1050 "\\)"
1051 "\\)*"
1052 "\"")
1053 "Regexp matching a field string enclosed by quotes.")
1054
1055(defconst bibtex-font-lock-syntactic-keywords 1089(defconst bibtex-font-lock-syntactic-keywords
1056 `((,(concat "^[ \t]*\\(" (substring bibtex-comment-start 0 1) "\\)" 1090 `((,(concat "^[ \t]*\\(" (substring bibtex-comment-start 0 1) "\\)"
1057 (substring bibtex-comment-start 1) "\\>") 1091 (substring bibtex-comment-start 1) "\\>")
1058 1 '(11)))) 1092 1 '(11))))
1059 1093
1060(defvar bibtex-font-lock-keywords 1094(defvar bibtex-font-lock-keywords
1061 (list 1095 ;; entry type and reference key
1062 ;; entry type and reference key 1096 `((,bibtex-entry-maybe-empty-head
1063 (list bibtex-entry-maybe-empty-head 1097 (,bibtex-type-in-head font-lock-function-name-face)
1064 (list bibtex-type-in-head 'font-lock-function-name-face) 1098 (,bibtex-key-in-head font-lock-constant-face nil t))
1065 (list bibtex-key-in-head 'font-lock-constant-face nil t)) 1099 ;; optional field names (treated as comments)
1066 ;; optional field names (treated as comments) 1100 (,(concat "^[ \t]*\\(OPT" bibtex-field-name "\\)[ \t]*=")
1067 (list 1101 1 font-lock-comment-face)
1068 (concat "^[ \t]*\\(OPT" bibtex-field-name "\\)[ \t]*=") 1102 ;; field names
1069 1 'font-lock-comment-face) 1103 (,(concat "^[ \t]*\\(" bibtex-field-name "\\)[ \t]*=")
1070 ;; field names 1104 1 font-lock-variable-name-face)
1071 (list (concat "^[ \t]*\\(" bibtex-field-name "\\)[ \t]*=") 1105 ;; url
1072 1 'font-lock-variable-name-face)) 1106 (bibtex-font-lock-url 0 '(face nil mouse-face highlight
1107 keymap bibtex-url-map)))
1073 "*Default expressions to highlight in BibTeX mode.") 1108 "*Default expressions to highlight in BibTeX mode.")
1074 1109
1110(defvar bibtex-font-lock-url-regexp
1111 (concat "\\<" (regexp-opt (mapcar 'caar bibtex-generate-url-list) t)
1112 "\\>[ \t]*=[ \t]*")
1113 "Regexp for `bibtex-font-lock-url'.")
1114
1075(defvar bibtex-field-name-for-parsing nil 1115(defvar bibtex-field-name-for-parsing nil
1076 "Temporary variable storing the name string to be parsed by the callback 1116 "Regexp of field name to be parsed by function `bibtex-parse-field-name'.
1077function `bibtex-parse-field-name'.") 1117Passed by dynamic scoping.")
1078 1118
1079(defvar bibtex-sort-entry-class-alist 1119(defvar bibtex-sort-entry-class-alist
1080 (let ((i -1) alist) 1120 (let ((i -1) alist)
@@ -1083,41 +1123,38 @@ function `bibtex-parse-field-name'.")
1083 (dolist (entry class) 1123 (dolist (entry class)
1084 ;; all entry names should be downcase (for ease of comparison) 1124 ;; all entry names should be downcase (for ease of comparison)
1085 (push (cons (if (stringp entry) (downcase entry) entry) i) alist)))) 1125 (push (cons (if (stringp entry) (downcase entry) entry) i) alist))))
1086 "Alist for the classes of the entry types if the value of 1126 "Alist mapping entry types to their sorting index.
1087`bibtex-maintain-sorted-entries' is `entry-class'.") 1127Auto-generated from `bibtex-sort-entry-class'.
1128Used when `bibtex-maintain-sorted-entries' is `entry-class'.")
1088 1129
1089 1130
1090;; Special support taking care of variants 1131;; Special support taking care of variants
1091(defvar zmacs-regions) 1132(defvar zmacs-regions)
1092(if (boundp 'mark-active) 1133(defalias 'bibtex-mark-active
1093 (defun bibtex-mark-active () 1134 (if (boundp 'mark-active)
1094 ;; In Emacs mark-active indicates if mark is active. 1135 ;; In Emacs mark-active indicates if mark is active.
1095 mark-active) 1136 (lambda () mark-active)
1096 (defun bibtex-mark-active ()
1097 ;; In XEmacs (mark) returns nil when not active. 1137 ;; In XEmacs (mark) returns nil when not active.
1098 (if zmacs-regions (mark) (mark t)))) 1138 (lambda () (if zmacs-regions (mark) (mark t)))))
1099 1139
1100(if (fboundp 'run-with-idle-timer) 1140(defalias 'bibtex-run-with-idle-timer
1101 ;; timer.el is distributed with Emacs 1141 (if (fboundp 'run-with-idle-timer)
1102 (fset 'bibtex-run-with-idle-timer 'run-with-idle-timer) 1142 ;; timer.el is distributed with Emacs
1103 ;; timer.el is not distributed with XEmacs 1143 'run-with-idle-timer
1104 ;; Notice that this does not (yet) pass the arguments, but they 1144 ;; timer.el is not distributed with XEmacs
1105 ;; are not used (yet) in bibtex.el. Fix if needed. 1145 ;; Notice that this does not (yet) pass the arguments, but they
1106 (defun bibtex-run-with-idle-timer (secs repeat function &rest args) 1146 ;; are not used (yet) in bibtex.el. Fix if needed.
1107 (start-itimer "bibtex" function secs (if repeat secs nil) t))) 1147 (lambda (secs repeat function &rest args)
1148 (start-itimer "bibtex" function secs (if repeat secs nil) t))))
1108 1149
1109 1150
1110;; Support for hideshow minor mode 1151;; Support for hideshow minor mode
1111(defun bibtex-hs-forward-sexp (arg) 1152(defun bibtex-hs-forward-sexp (arg)
1112 "Replacement for `forward-sexp' to be used by `hs-minor-mode'." 1153 "Replacement for `forward-sexp' to be used by `hs-minor-mode'.
1113 (if (< arg 0) 1154ARG is ignored."
1114 (backward-sexp 1) 1155 (if (looking-at "@\\S(*\\s(")
1115 (if (looking-at "@\\S(*\\s(") 1156 (goto-char (1- (match-end 0))))
1116 (progn 1157 (forward-sexp 1))
1117 (goto-char (match-end 0))
1118 (forward-char -1)
1119 (forward-sexp 1))
1120 (forward-sexp 1))))
1121 1158
1122(add-to-list 1159(add-to-list
1123 'hs-special-modes-alist 1160 'hs-special-modes-alist
@@ -1144,7 +1181,7 @@ values of the functions PARSE-LHS and PARSE-RHS is returned."
1144 "Parse the field name stored in `bibtex-field-name-for-parsing'. 1181 "Parse the field name stored in `bibtex-field-name-for-parsing'.
1145If the field name is found, return a triple consisting of the position of the 1182If the field name is found, return a triple consisting of the position of the
1146very first character of the match, the actual starting position of the name 1183very first character of the match, the actual starting position of the name
1147part and end position of the match. Move point to end of field name. 1184part and end position of the match. Move point to end of field name.
1148If `bibtex-autoadd-commas' is non-nil add missing comma at end of preceeding 1185If `bibtex-autoadd-commas' is non-nil add missing comma at end of preceeding
1149BibTeX field as necessary." 1186BibTeX field as necessary."
1150 (cond ((looking-at ",[ \t\n]*") 1187 (cond ((looking-at ",[ \t\n]*")
@@ -1206,7 +1243,7 @@ end position of the field string is returned, nil otherwise."
1206The text part is either a string, or an empty string, or a constant followed 1243The text part is either a string, or an empty string, or a constant followed
1207by one or more <# (string|constant)> pairs. If a syntactically correct text 1244by one or more <# (string|constant)> pairs. If a syntactically correct text
1208is found, a pair containing the start and end position of the text is 1245is found, a pair containing the start and end position of the text is
1209returned, nil otherwise. Move point to end of field text." 1246returned, nil otherwise. Move point to end of field text."
1210 (let ((starting-point (point)) 1247 (let ((starting-point (point))
1211 end-point failure boundaries) 1248 end-point failure boundaries)
1212 (while (not (or end-point failure)) 1249 (while (not (or end-point failure))
@@ -1215,9 +1252,9 @@ returned, nil otherwise. Move point to end of field text."
1215 ((setq boundaries (bibtex-parse-field-string)) 1252 ((setq boundaries (bibtex-parse-field-string))
1216 (goto-char (cdr boundaries))) 1253 (goto-char (cdr boundaries)))
1217 ((setq failure t))) 1254 ((setq failure t)))
1218 (if (not (looking-at "[ \t\n]*#[ \t\n]*")) 1255 (if (looking-at "[ \t\n]*#[ \t\n]*")
1219 (setq end-point (point)) 1256 (goto-char (match-end 0))
1220 (goto-char (match-end 0)))) 1257 (setq end-point (point))))
1221 (if (and (not failure) 1258 (if (and (not failure)
1222 end-point) 1259 end-point)
1223 (cons starting-point end-point)))) 1260 (cons starting-point end-point))))
@@ -1234,8 +1271,8 @@ the name and text parts of the field is returned."
1234 "Search forward to find a field of name NAME. 1271 "Search forward to find a field of name NAME.
1235If a syntactically correct field is found, a pair containing the boundaries of 1272If a syntactically correct field is found, a pair containing the boundaries of
1236the name and text parts of the field is returned. The search is limited by 1273the name and text parts of the field is returned. The search is limited by
1237optional arg BOUND. If BOUND is t the search is limited by the end of the current 1274optional arg BOUND. If BOUND is t the search is limited by the end of the
1238entry. Do not move point." 1275current entry. Do not move point."
1239 (save-match-data 1276 (save-match-data
1240 (save-excursion 1277 (save-excursion
1241 (unless (integer-or-marker-p bound) 1278 (unless (integer-or-marker-p bound)
@@ -1261,8 +1298,8 @@ entry. Do not move point."
1261 "Search backward to find a field of name NAME. 1298 "Search backward to find a field of name NAME.
1262If a syntactically correct field is found, a pair containing the boundaries of 1299If a syntactically correct field is found, a pair containing the boundaries of
1263the name and text parts of the field is returned. The search is limited by 1300the name and text parts of the field is returned. The search is limited by
1264optional arg BOUND. If BOUND is t the search is limited by the beginning of the 1301optional arg BOUND. If BOUND is t the search is limited by the beginning of the
1265current entry. Do not move point." 1302current entry. Do not move point."
1266 (save-match-data 1303 (save-match-data
1267 (save-excursion 1304 (save-excursion
1268 (unless (integer-or-marker-p bound) 1305 (unless (integer-or-marker-p bound)
@@ -1294,10 +1331,15 @@ current entry. Do not move point."
1294(defsubst bibtex-end-of-text-in-field (bounds) 1331(defsubst bibtex-end-of-text-in-field (bounds)
1295 (cddr bounds)) 1332 (cddr bounds))
1296 1333
1297(defun bibtex-name-in-field (bounds) 1334(defun bibtex-name-in-field (bounds &optional remove-opt-alt)
1298 "Get content of name in BibTeX field defined via BOUNDS." 1335 "Get content of name in BibTeX field defined via BOUNDS.
1299 (buffer-substring-no-properties (nth 1 (car bounds)) 1336If optional arg REMOVE-OPT-ALT is non-nil remove \"OPT\" and \"ALT\"."
1300 (nth 2 (car bounds)))) 1337 (let ((name (buffer-substring-no-properties (nth 1 (car bounds))
1338 (nth 2 (car bounds)))))
1339 (if (and remove-opt-alt
1340 (string-match "\\`\\(OPT\\|ALT\\)" name))
1341 (substring name 3)
1342 name)))
1301 1343
1302(defun bibtex-text-in-field-bounds (bounds &optional remove-delim) 1344(defun bibtex-text-in-field-bounds (bounds &optional remove-delim)
1303 "Get content of text in BibTeX field defined via BOUNDS. 1345 "Get content of text in BibTeX field defined via BOUNDS.
@@ -1311,7 +1353,7 @@ if present."
1311 content))) 1353 content)))
1312 1354
1313(defun bibtex-text-in-field (field &optional follow-crossref) 1355(defun bibtex-text-in-field (field &optional follow-crossref)
1314 "Get content of field FIELD of current BibTeX entry. Return nil if not found. 1356 "Get content of field FIELD of current BibTeX entry. Return nil if not found.
1315If optional arg FOLLOW-CROSSREF is non-nil, follow crossref." 1357If optional arg FOLLOW-CROSSREF is non-nil, follow crossref."
1316 (save-excursion 1358 (save-excursion
1317 (save-restriction 1359 (save-restriction
@@ -1351,7 +1393,7 @@ reference key and the end position of the match."
1351 "Parse the postfix part of a BibTeX string entry, including the text. 1393 "Parse the postfix part of a BibTeX string entry, including the text.
1352If the string postfix is found, return a triple consisting of the position of 1394If the string postfix is found, return a triple consisting of the position of
1353the actual starting and ending position of the text and the very last 1395the actual starting and ending position of the text and the very last
1354character of the string entry. Move point past BibTeX string entry." 1396character of the string entry. Move point past BibTeX string entry."
1355 (let* ((case-fold-search t) 1397 (let* ((case-fold-search t)
1356 (bounds (bibtex-parse-field-text))) 1398 (bounds (bibtex-parse-field-text)))
1357 (when bounds 1399 (when bounds
@@ -1373,7 +1415,7 @@ Move point past BibTeX string entry."
1373(defun bibtex-search-forward-string () 1415(defun bibtex-search-forward-string ()
1374 "Search forward to find a BibTeX string entry. 1416 "Search forward to find a BibTeX string entry.
1375If a syntactically correct entry is found, a pair containing the boundaries of 1417If a syntactically correct entry is found, a pair containing the boundaries of
1376the reference key and text parts of the string is returned. Do not move point." 1418the reference key and text parts of the string is returned. Do not move point."
1377 (save-excursion 1419 (save-excursion
1378 (save-match-data 1420 (save-match-data
1379 (let ((case-fold-search t) 1421 (let ((case-fold-search t)
@@ -1389,7 +1431,7 @@ the reference key and text parts of the string is returned. Do not move point."
1389(defun bibtex-search-backward-string () 1431(defun bibtex-search-backward-string ()
1390 "Search backward to find a BibTeX string entry. 1432 "Search backward to find a BibTeX string entry.
1391If a syntactically correct entry is found, a pair containing the boundaries of 1433If a syntactically correct entry is found, a pair containing the boundaries of
1392the reference key and text parts of the field is returned. Do not move point." 1434the reference key and text parts of the field is returned. Do not move point."
1393 (save-excursion 1435 (save-excursion
1394 (save-match-data 1436 (save-match-data
1395 (let ((case-fold-search t) 1437 (let ((case-fold-search t)
@@ -1430,7 +1472,7 @@ delimiters if present."
1430 (match-end bibtex-type-in-head))) 1472 (match-end bibtex-type-in-head)))
1431 1473
1432(defun bibtex-key-in-head (&optional empty) 1474(defun bibtex-key-in-head (&optional empty)
1433 "Extract BibTeX key in head. Return optional arg EMPTY if key is empty." 1475 "Extract BibTeX key in head. Return optional arg EMPTY if key is empty."
1434 (if (match-beginning bibtex-key-in-head) 1476 (if (match-beginning bibtex-key-in-head)
1435 (buffer-substring-no-properties (match-beginning bibtex-key-in-head) 1477 (buffer-substring-no-properties (match-beginning bibtex-key-in-head)
1436 (match-end bibtex-key-in-head)) 1478 (match-end bibtex-key-in-head))
@@ -1438,6 +1480,10 @@ delimiters if present."
1438 1480
1439;; Helper Functions 1481;; Helper Functions
1440 1482
1483(defsubst bibtex-string= (str1 str2)
1484 "Return t if STR1 and STR2 are equal, ignoring case."
1485 (eq t (compare-strings str1 0 nil str2 0 nil t)))
1486
1441(defun bibtex-delete-whitespace () 1487(defun bibtex-delete-whitespace ()
1442 "Delete all whitespace starting at point." 1488 "Delete all whitespace starting at point."
1443 (if (looking-at "[ \t\n]+") 1489 (if (looking-at "[ \t\n]+")
@@ -1448,22 +1494,14 @@ delimiters if present."
1448 (+ (count-lines 1 (point)) 1494 (+ (count-lines 1 (point))
1449 (if (equal (current-column) 0) 1 0))) 1495 (if (equal (current-column) 0) 1 0)))
1450 1496
1451(defun bibtex-member-of-regexp (string list)
1452 "Return non-nil if STRING is exactly matched by an element of LIST.
1453The value is actually the tail of LIST whose car matches STRING."
1454 (let (case-fold-search)
1455 (while (and list
1456 (not (string-match (concat "\\`\\(?:" (car list) "\\)\\'") string)))
1457 (setq list (cdr list)))
1458 list))
1459
1460(defun bibtex-skip-to-valid-entry (&optional backward) 1497(defun bibtex-skip-to-valid-entry (&optional backward)
1461 "Unless at beginning of a valid BibTeX entry, move point to beginning of the 1498 "Move point to beginning of the next valid BibTeX entry.
1462next valid one. With optional argument BACKWARD non-nil, move backward to 1499Do not move if we are already at beginning of a valid BibTeX entry.
1463beginning of previous valid one. A valid entry is a syntactical correct one 1500With optional argument BACKWARD non-nil, move backward to
1501beginning of previous valid one. A valid entry is a syntactical correct one
1464with type contained in `bibtex-entry-field-alist' or, if 1502with type contained in `bibtex-entry-field-alist' or, if
1465`bibtex-sort-ignore-string-entries' is nil, a syntactical correct string 1503`bibtex-sort-ignore-string-entries' is nil, a syntactical correct string
1466entry. Return buffer position of beginning and ending of entry if a valid 1504entry. Return buffer position of beginning and ending of entry if a valid
1467entry is found, nil otherwise." 1505entry is found, nil otherwise."
1468 (interactive "P") 1506 (interactive "P")
1469 (let ((case-fold-search t) 1507 (let ((case-fold-search t)
@@ -1488,9 +1526,9 @@ entry is found, nil otherwise."
1488 1526
1489(defun bibtex-map-entries (fun) 1527(defun bibtex-map-entries (fun)
1490 "Call FUN for each BibTeX entry starting with the current. 1528 "Call FUN for each BibTeX entry starting with the current.
1491Do this to the end of the file. FUN is called with three arguments, the key of 1529Do this to the end of the file. FUN is called with three arguments, the key of
1492the entry and the buffer positions (marker) of beginning and end of entry. 1530the entry and the buffer positions (marker) of beginning and end of entry.
1493Point is inside the entry. If `bibtex-sort-ignore-string-entries' is non-nil, 1531Point is inside the entry. If `bibtex-sort-ignore-string-entries' is non-nil,
1494FUN will not be called for @String entries." 1532FUN will not be called for @String entries."
1495 (let ((case-fold-search t)) 1533 (let ((case-fold-search t))
1496 (bibtex-beginning-of-entry) 1534 (bibtex-beginning-of-entry)
@@ -1501,7 +1539,7 @@ FUN will not be called for @String entries."
1501 (end (copy-marker (save-excursion (bibtex-end-of-entry))))) 1539 (end (copy-marker (save-excursion (bibtex-end-of-entry)))))
1502 (save-excursion 1540 (save-excursion
1503 (if (or (and (not bibtex-sort-ignore-string-entries) 1541 (if (or (and (not bibtex-sort-ignore-string-entries)
1504 (string-equal "string" (downcase entry-type))) 1542 (bibtex-string= entry-type "string"))
1505 (assoc-string entry-type bibtex-entry-field-alist t)) 1543 (assoc-string entry-type bibtex-entry-field-alist t))
1506 (funcall fun key beg end))) 1544 (funcall fun key beg end)))
1507 (goto-char end))))) 1545 (goto-char end)))))
@@ -1556,8 +1594,8 @@ If FLAG is nil, a message is echoed if point was incremented at least
1556 1594
1557(defun bibtex-search-entry (empty-head &optional bound noerror backward) 1595(defun bibtex-search-entry (empty-head &optional bound noerror backward)
1558 "Search for a BibTeX entry (maybe without reference key if EMPTY-HEAD is t). 1596 "Search for a BibTeX entry (maybe without reference key if EMPTY-HEAD is t).
1559BOUND and NOERROR are exactly as in `re-search-forward'. If BACKWARD 1597BOUND and NOERROR are exactly as in `re-search-forward'. If BACKWARD
1560is non-nil, search is done in reverse direction. Point is moved past the 1598is non-nil, search is done in reverse direction. Point is moved past the
1561closing delimiter (at the beginning of entry if BACKWARD is non-nil). 1599closing delimiter (at the beginning of entry if BACKWARD is non-nil).
1562Return a cons pair with buffer positions of beginning and end of entry. 1600Return a cons pair with buffer positions of beginning and end of entry.
1563After call to this function MATCH-BEGINNING and MATCH-END functions 1601After call to this function MATCH-BEGINNING and MATCH-END functions
@@ -1575,7 +1613,7 @@ are defined, but only for the head part of the entry
1575 (if found 1613 (if found
1576 (progn (goto-char (match-beginning 0)) 1614 (progn (goto-char (match-beginning 0))
1577 found) 1615 found)
1578 (cond ((equal noerror nil) 1616 (cond ((not noerror)
1579 ;; yell 1617 ;; yell
1580 (error "Backward search of BibTeX entry failed")) 1618 (error "Backward search of BibTeX entry failed"))
1581 ((equal noerror t) 1619 ((equal noerror t)
@@ -1660,7 +1698,7 @@ are defined, but only for the head part of the entry
1660 (skip-chars-forward " \t\n"))) 1698 (skip-chars-forward " \t\n")))
1661 1699
1662(defun bibtex-beginning-of-first-entry () 1700(defun bibtex-beginning-of-first-entry ()
1663 "Go to the beginning of the first BibTeX entry in buffer. Return point." 1701 "Go to the beginning of the first BibTeX entry in buffer. Return point."
1664 (goto-char (point-min)) 1702 (goto-char (point-min))
1665 (if (re-search-forward "^[ \t]*@" nil 'move) 1703 (if (re-search-forward "^[ \t]*@" nil 'move)
1666 (beginning-of-line)) 1704 (beginning-of-line))
@@ -1684,10 +1722,10 @@ are defined, but only for the head part of the entry
1684 (forward-char -1))) 1722 (forward-char -1)))
1685 1723
1686(defun bibtex-enclosing-field (&optional noerr) 1724(defun bibtex-enclosing-field (&optional noerr)
1687 "Search for BibTeX field enclosing point. Point moves to end of field. 1725 "Search for BibTeX field enclosing point.
1688Use `match-beginning' and `match-end' to parse the field. If NOERR is non-nil, 1726Use `match-beginning' and `match-end' to parse the field. If NOERR is non-nil,
1689no error is signalled. In this case, bounds are returned on success, 1727no error is signalled. In this case, bounds are returned on success,
1690nil otherwise." 1728nil otherwise. Does not move point."
1691 (let ((bounds (bibtex-search-backward-field bibtex-field-name t))) 1729 (let ((bounds (bibtex-search-backward-field bibtex-field-name t)))
1692 (if (and bounds 1730 (if (and bounds
1693 (<= (bibtex-start-of-field bounds) (point)) 1731 (<= (bibtex-start-of-field bounds) (point))
@@ -1697,7 +1735,7 @@ nil otherwise."
1697 (error "Can't find enclosing BibTeX field"))))) 1735 (error "Can't find enclosing BibTeX field")))))
1698 1736
1699(defun bibtex-enclosing-entry-maybe-empty-head () 1737(defun bibtex-enclosing-entry-maybe-empty-head ()
1700 "Search for BibTeX entry enclosing point. Move point to end of entry. 1738 "Search for BibTeX entry enclosing point. Move point to end of entry.
1701Beginning (but not end) of entry is given by (`match-beginning' 0)." 1739Beginning (but not end) of entry is given by (`match-beginning' 0)."
1702 (let ((case-fold-search t) 1740 (let ((case-fold-search t)
1703 (old-point (point))) 1741 (old-point (point)))
@@ -1732,8 +1770,7 @@ Beginning (but not end) of entry is given by (`match-beginning' 0)."
1732 (message "Mark set") 1770 (message "Mark set")
1733 (bibtex-make-field (list (elt current 1) nil (elt current 2)) t)) 1771 (bibtex-make-field (list (elt current 1) nil (elt current 2)) t))
1734 ((equal bibtex-last-kill-command 'entry) 1772 ((equal bibtex-last-kill-command 'entry)
1735 (if (not (eobp)) 1773 (unless (eobp) (bibtex-beginning-of-entry))
1736 (bibtex-beginning-of-entry))
1737 (set-mark (point)) 1774 (set-mark (point))
1738 (message "Mark set") 1775 (message "Mark set")
1739 (insert (elt current 1))) 1776 (insert (elt current 1)))
@@ -1741,15 +1778,6 @@ Beginning (but not end) of entry is given by (`match-beginning' 0)."
1741 (error "Unknown tag field: %s. Please submit a bug report" 1778 (error "Unknown tag field: %s. Please submit a bug report"
1742 bibtex-last-kill-command)))))) 1779 bibtex-last-kill-command))))))
1743 1780
1744(defun bibtex-assoc-regexp (regexp alist)
1745 "Return non-nil if REGEXP matches the car of an element of ALIST.
1746The value is actually the element of ALIST matched by REGEXP.
1747Case is ignored if `case-fold-search' is non-nil in the current buffer."
1748 (while (and alist
1749 (not (string-match regexp (caar alist))))
1750 (setq alist (cdr alist)))
1751 (car alist))
1752
1753(defun bibtex-format-entry () 1781(defun bibtex-format-entry ()
1754 "Helper function for `bibtex-clean-entry'. 1782 "Helper function for `bibtex-clean-entry'.
1755Formats current entry according to variable `bibtex-entry-format'." 1783Formats current entry according to variable `bibtex-entry-format'."
@@ -1764,7 +1792,7 @@ Formats current entry according to variable `bibtex-entry-format'."
1764 unify-case inherit-booktitle) 1792 unify-case inherit-booktitle)
1765 bibtex-entry-format)) 1793 bibtex-entry-format))
1766 crossref-key bounds alternatives-there non-empty-alternative 1794 crossref-key bounds alternatives-there non-empty-alternative
1767 entry-list req-field-list field-done field-list) 1795 entry-list req-field-list field-list)
1768 1796
1769 ;; identify entry type 1797 ;; identify entry type
1770 (goto-char (point-min)) 1798 (goto-char (point-min))
@@ -1792,9 +1820,7 @@ Formats current entry according to variable `bibtex-entry-format'."
1792 ;; one alternative is non-empty 1820 ;; one alternative is non-empty
1793 (goto-char (point-min)) 1821 (goto-char (point-min))
1794 (let* ((fields-alist (bibtex-parse-entry)) 1822 (let* ((fields-alist (bibtex-parse-entry))
1795 (case-fold-search t) 1823 (field (assoc-string "crossref" fields-alist t)))
1796 (field (bibtex-assoc-regexp "\\`\\(OPT\\)?crossref\\'"
1797 fields-alist)))
1798 (setq crossref-key (and field 1824 (setq crossref-key (and field
1799 (not (string-match bibtex-empty-field-re 1825 (not (string-match bibtex-empty-field-re
1800 (cdr field))) 1826 (cdr field)))
@@ -1806,9 +1832,7 @@ Formats current entry according to variable `bibtex-entry-format'."
1806 (dolist (rfield req-field-list) 1832 (dolist (rfield req-field-list)
1807 (when (nth 3 rfield) ; we should have an alternative 1833 (when (nth 3 rfield) ; we should have an alternative
1808 (setq alternatives-there t 1834 (setq alternatives-there t
1809 field (bibtex-assoc-regexp 1835 field (assoc-string (car rfield) fields-alist t))
1810 (concat "\\`\\(ALT\\)?" (car rfield) "\\'")
1811 fields-alist))
1812 (if (and field 1836 (if (and field
1813 (not (string-match bibtex-empty-field-re 1837 (not (string-match bibtex-empty-field-re
1814 (cdr field)))) 1838 (cdr field))))
@@ -1887,7 +1911,7 @@ Formats current entry according to variable `bibtex-entry-format'."
1887 1911
1888 ;; update page dashes 1912 ;; update page dashes
1889 (if (and (memq 'page-dashes format) 1913 (if (and (memq 'page-dashes format)
1890 (string-match "\\`\\(OPT\\)?pages\\'" field-name) 1914 (bibtex-string= field-name "pages")
1891 (progn (goto-char beg-text) 1915 (progn (goto-char beg-text)
1892 (looking-at 1916 (looking-at
1893 "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)"))) 1917 "\\([\"{][0-9]+\\)[ \t\n]*--?[ \t\n]*\\([0-9]+[\"}]\\)")))
@@ -1896,7 +1920,7 @@ Formats current entry according to variable `bibtex-entry-format'."
1896 ;; use book title of crossref'd entry 1920 ;; use book title of crossref'd entry
1897 (if (and (memq 'inherit-booktitle format) 1921 (if (and (memq 'inherit-booktitle format)
1898 empty-field 1922 empty-field
1899 (equal (downcase field-name) "booktitle") 1923 (bibtex-string= field-name "booktitle")
1900 crossref-key) 1924 crossref-key)
1901 (let ((title (save-restriction 1925 (let ((title (save-restriction
1902 (widen) 1926 (widen)
@@ -1909,7 +1933,7 @@ Formats current entry according to variable `bibtex-entry-format'."
1909 1933
1910 ;; Use booktitle to set a missing title. 1934 ;; Use booktitle to set a missing title.
1911 (if (and empty-field 1935 (if (and empty-field
1912 (equal (downcase field-name) "title")) 1936 (bibtex-string= field-name "title"))
1913 (let ((booktitle (bibtex-text-in-field "booktitle"))) 1937 (let ((booktitle (bibtex-text-in-field "booktitle")))
1914 (when booktitle 1938 (when booktitle
1915 (setq empty-field nil) 1939 (setq empty-field nil)
@@ -1990,8 +2014,8 @@ Formats current entry according to variable `bibtex-entry-format'."
1990(defun bibtex-autokey-abbrev (string len) 2014(defun bibtex-autokey-abbrev (string len)
1991 "Return an abbreviation of STRING with at least LEN characters. 2015 "Return an abbreviation of STRING with at least LEN characters.
1992If LEN is positive the abbreviation is terminated only after a consonant 2016If LEN is positive the abbreviation is terminated only after a consonant
1993or at the word end. If LEN is negative the abbreviation is strictly 2017or at the word end. If LEN is negative the abbreviation is strictly
1994enforced using abs (LEN) characters. If LEN is not a number, STRING 2018enforced using abs (LEN) characters. If LEN is not a number, STRING
1995is returned unchanged." 2019is returned unchanged."
1996 (cond ((or (not (numberp len)) 2020 (cond ((or (not (numberp len))
1997 (<= (length string) (abs len))) 2021 (<= (length string) (abs len)))
@@ -2007,9 +2031,9 @@ is returned unchanged."
2007 string))))) 2031 string)))))
2008 2032
2009(defun bibtex-autokey-get-field (field &optional change-list) 2033(defun bibtex-autokey-get-field (field &optional change-list)
2010 "Get content of BibTeX field FIELD. Return empty string if not found. 2034 "Get content of BibTeX field FIELD. Return empty string if not found.
2011Optional arg CHANGE-LIST is a list of substitution patterns that is 2035Optional arg CHANGE-LIST is a list of substitution patterns that is
2012applied to the content of FIELD. It is an alist with pairs 2036applied to the content of FIELD. It is an alist with pairs
2013\(OLD-REGEXP . NEW-STRING\)." 2037\(OLD-REGEXP . NEW-STRING\)."
2014 (let ((content (bibtex-text-in-field field bibtex-autokey-use-crossref)) 2038 (let ((content (bibtex-text-in-field field bibtex-autokey-use-crossref))
2015 case-fold-search) 2039 case-fold-search)
@@ -2023,15 +2047,16 @@ applied to the content of FIELD. It is an alist with pairs
2023 "Get contents of the name field of the current entry. 2047 "Get contents of the name field of the current entry.
2024Do some modifications based on `bibtex-autokey-name-change-strings' 2048Do some modifications based on `bibtex-autokey-name-change-strings'
2025and return results as a list." 2049and return results as a list."
2026 (let ((case-fold-search t)) 2050 (let ((case-fold-search t)
2027 (mapcar 'bibtex-autokey-demangle-name 2051 (names (bibtex-autokey-get-field "author\\|editor"
2028 (split-string (bibtex-autokey-get-field 2052 bibtex-autokey-name-change-strings)))
2029 "author\\|editor" 2053 ;; Some entries do not have a name field.
2030 bibtex-autokey-name-change-strings) 2054 (unless (string= "" names)
2031 "[ \t\n]+and[ \t\n]+")))) 2055 (mapcar 'bibtex-autokey-demangle-name
2056 (split-string names "[ \t\n]+and[ \t\n]+")))))
2032 2057
2033(defun bibtex-autokey-demangle-name (fullname) 2058(defun bibtex-autokey-demangle-name (fullname)
2034 "Get the last part from a well-formed name and perform abbreviations." 2059 "Get the last part from a well-formed FULLNAME and perform abbreviations."
2035 (let* (case-fold-search 2060 (let* (case-fold-search
2036 (name (cond ((string-match "\\([A-Z][^, ]*\\)[^,]*," fullname) 2061 (name (cond ((string-match "\\([A-Z][^, ]*\\)[^,]*," fullname)
2037 ;; Name is of the form "von Last, First" or 2062 ;; Name is of the form "von Last, First" or
@@ -2059,18 +2084,18 @@ and return results as a list."
2059 2084
2060(defun bibtex-autokey-get-title () 2085(defun bibtex-autokey-get-title ()
2061 "Get title field contents up to a terminator." 2086 "Get title field contents up to a terminator."
2062 (let ((titlestring 2087 (let ((case-fold-search t)
2088 (titlestring
2063 (bibtex-autokey-get-field "title" 2089 (bibtex-autokey-get-field "title"
2064 bibtex-autokey-titleword-change-strings))) 2090 bibtex-autokey-titleword-change-strings)))
2065 ;; ignore everything past a terminator 2091 ;; ignore everything past a terminator
2066 (let ((case-fold-search t)) 2092 (dolist (terminator bibtex-autokey-title-terminators)
2067 (dolist (terminator bibtex-autokey-title-terminators) 2093 (if (string-match terminator titlestring)
2068 (if (string-match terminator titlestring) 2094 (setq titlestring (substring titlestring 0 (match-beginning 0)))))
2069 (setq titlestring (substring titlestring 0 (match-beginning 0))))))
2070 ;; gather words from titlestring into a list. Ignore 2095 ;; gather words from titlestring into a list. Ignore
2071 ;; specific words and use only a specific amount of words. 2096 ;; specific words and use only a specific amount of words.
2072 (let ((counter 0) 2097 (let ((counter 0)
2073 case-fold-search titlewords titlewords-extra titleword end-match) 2098 titlewords titlewords-extra titleword end-match)
2074 (while (and (or (not (numberp bibtex-autokey-titlewords)) 2099 (while (and (or (not (numberp bibtex-autokey-titlewords))
2075 (< counter (+ bibtex-autokey-titlewords 2100 (< counter (+ bibtex-autokey-titlewords
2076 bibtex-autokey-titlewords-stretch))) 2101 bibtex-autokey-titlewords-stretch)))
@@ -2078,8 +2103,12 @@ and return results as a list."
2078 (setq end-match (match-end 0) 2103 (setq end-match (match-end 0)
2079 titleword (substring titlestring 2104 titleword (substring titlestring
2080 (match-beginning 0) end-match)) 2105 (match-beginning 0) end-match))
2081 (unless (bibtex-member-of-regexp titleword 2106 (unless (let ((lst bibtex-autokey-titleword-ignore))
2082 bibtex-autokey-titleword-ignore) 2107 (while (and lst
2108 (not (string-match (concat "\\`\\(?:" (car lst)
2109 "\\)\\'") titleword)))
2110 (setq lst (cdr lst)))
2111 lst)
2083 (setq titleword 2112 (setq titleword
2084 (funcall bibtex-autokey-titleword-case-convert titleword)) 2113 (funcall bibtex-autokey-titleword-case-convert titleword))
2085 (if (or (not (numberp bibtex-autokey-titlewords)) 2114 (if (or (not (numberp bibtex-autokey-titlewords))
@@ -2097,7 +2126,7 @@ and return results as a list."
2097 "Do some abbreviations on TITLEWORD. 2126 "Do some abbreviations on TITLEWORD.
2098The rules are defined in `bibtex-autokey-titleword-abbrevs' 2127The rules are defined in `bibtex-autokey-titleword-abbrevs'
2099and `bibtex-autokey-titleword-length'." 2128and `bibtex-autokey-titleword-length'."
2100 (let ((case-folde-search t) 2129 (let ((case-fold-search t)
2101 (alist bibtex-autokey-titleword-abbrevs)) 2130 (alist bibtex-autokey-titleword-abbrevs))
2102 (while (and alist 2131 (while (and alist
2103 (not (string-match (concat "\\`\\(?:" (caar alist) "\\)\\'") 2132 (not (string-match (concat "\\`\\(?:" (caar alist) "\\)\\'")
@@ -2119,7 +2148,7 @@ The generation algorithm works as follows:
2119 `bibtex-autokey-name-change-strings' to the corresponding new 2148 `bibtex-autokey-name-change-strings' to the corresponding new
2120 one (see documentation of this variable for further detail). 2149 one (see documentation of this variable for further detail).
2121 4. For every of at least first `bibtex-autokey-names' names in 2150 4. For every of at least first `bibtex-autokey-names' names in
2122 the name field, determine the last name. If there are maximal 2151 the name field, determine the last name. If there are maximal
2123 `bibtex-autokey-names' + `bibtex-autokey-names-stretch' 2152 `bibtex-autokey-names' + `bibtex-autokey-names-stretch'
2124 names, all names are used. 2153 names, all names are used.
2125 5. From every last name, take at least `bibtex-autokey-name-length' 2154 5. From every last name, take at least `bibtex-autokey-name-length'
@@ -2128,12 +2157,12 @@ The generation algorithm works as follows:
2128 `bibtex-autokey-name-case-convert'. 2157 `bibtex-autokey-name-case-convert'.
2129 7. Build the name part of the key by concatenating all 2158 7. Build the name part of the key by concatenating all
2130 abbreviated last names with the string 2159 abbreviated last names with the string
2131 `bibtex-autokey-name-separator' between any two. If there are 2160 `bibtex-autokey-name-separator' between any two. If there are
2132 more names than are used in the name part, prepend the string 2161 more names than are used in the name part, prepend the string
2133 contained in `bibtex-autokey-additional-names'. 2162 contained in `bibtex-autokey-additional-names'.
2134 8. Build the year part of the key by truncating the contents of 2163 8. Build the year part of the key by truncating the contents of
2135 the year field to the rightmost `bibtex-autokey-year-length' 2164 the year field to the rightmost `bibtex-autokey-year-length'
2136 digits (useful values are 2 and 4). If the year field (or any 2165 digits (useful values are 2 and 4). If the year field (or any
2137 other field required to generate the key) is absent, but the entry 2166 other field required to generate the key) is absent, but the entry
2138 has a valid crossref field and the variable 2167 has a valid crossref field and the variable
2139 `bibtex-autokey-use-crossref' is non-nil, use the field of the 2168 `bibtex-autokey-use-crossref' is non-nil, use the field of the
@@ -2149,7 +2178,7 @@ The generation algorithm works as follows:
2149 appear in `bibtex-autokey-titleword-ignore'. 2178 appear in `bibtex-autokey-titleword-ignore'.
2150 Build the title part of the key by using at least the first 2179 Build the title part of the key by using at least the first
2151 `bibtex-autokey-titlewords' words from this 2180 `bibtex-autokey-titlewords' words from this
2152 abbreviated title. If the abbreviated title ends after 2181 abbreviated title. If the abbreviated title ends after
2153 maximal `bibtex-autokey-titlewords' + 2182 maximal `bibtex-autokey-titlewords' +
2154 `bibtex-autokey-titlewords-stretch' words, all 2183 `bibtex-autokey-titlewords-stretch' words, all
2155 words from the abbreviated title are used. 2184 words from the abbreviated title are used.
@@ -2170,13 +2199,13 @@ The generation algorithm works as follows:
2170 and the title part with `bibtex-autokey-name-year-separator' 2199 and the title part with `bibtex-autokey-name-year-separator'
2171 between the name part and the year part if both are non-empty 2200 between the name part and the year part if both are non-empty
2172 and `bibtex-autokey-year-title-separator' between the year 2201 and `bibtex-autokey-year-title-separator' between the year
2173 part and the title part if both are non-empty. If the year 2202 part and the title part if both are non-empty. If the year
2174 part is empty, but not the other two parts, 2203 part is empty, but not the other two parts,
2175 `bibtex-autokey-year-title-separator' is used as well. 2204 `bibtex-autokey-year-title-separator' is used as well.
217616. If the value of `bibtex-autokey-before-presentation-function' 220516. If the value of `bibtex-autokey-before-presentation-function'
2177 is non-nil, it must be a function taking one argument. This 2206 is non-nil, it must be a function taking one argument. This
2178 function is then called with the generated key as the 2207 function is then called with the generated key as the
2179 argument. The return value of this function (a string) is 2208 argument. The return value of this function (a string) is
2180 used as the key. 2209 used as the key.
218117. If the value of `bibtex-autokey-edit-before-use' is non-nil, 221017. If the value of `bibtex-autokey-edit-before-use' is non-nil,
2182 the key is then presented in the minibuffer to the user, 2211 the key is then presented in the minibuffer to the user,
@@ -2230,9 +2259,9 @@ The generation algorithm works as follows:
2230The buffer might possibly be restricted. 2259The buffer might possibly be restricted.
2231Find both entry keys and crossref entries. 2260Find both entry keys and crossref entries.
2232If ADD is non-nil add the new keys to `bibtex-reference-keys' instead of 2261If ADD is non-nil add the new keys to `bibtex-reference-keys' instead of
2233simply resetting it. If ADD is an alist of keys, also add ADD to 2262simply resetting it. If ADD is an alist of keys, also add ADD to
2234`bibtex-reference-keys'. If ABORTABLE is non-nil abort on user 2263`bibtex-reference-keys'. If ABORTABLE is non-nil abort on user
2235input. If VERBOSE is non-nil gives messages about progress. 2264input. If VERBOSE is non-nil gives messages about progress.
2236Return alist of keys if parsing was completed, `aborted' otherwise." 2265Return alist of keys if parsing was completed, `aborted' otherwise."
2237 (let ((reference-keys (if (and add 2266 (let ((reference-keys (if (and add
2238 (listp bibtex-reference-keys)) 2267 (listp bibtex-reference-keys))
@@ -2296,8 +2325,8 @@ Return alist of keys if parsing was completed, `aborted' otherwise."
2296 "Set `bibtex-strings' to the string definitions in the whole buffer. 2325 "Set `bibtex-strings' to the string definitions in the whole buffer.
2297The buffer might possibly be restricted. 2326The buffer might possibly be restricted.
2298If ADD is non-nil add the new strings to `bibtex-strings' instead of 2327If ADD is non-nil add the new strings to `bibtex-strings' instead of
2299simply resetting it. If ADD is an alist of strings, also add ADD to 2328simply resetting it. If ADD is an alist of strings, also add ADD to
2300`bibtex-strings'. If ABORTABLE is non-nil abort on user input. 2329`bibtex-strings'. If ABORTABLE is non-nil abort on user input.
2301Return alist of strings if parsing was completed, `aborted' otherwise." 2330Return alist of strings if parsing was completed, `aborted' otherwise."
2302 (save-excursion 2331 (save-excursion
2303 (save-match-data 2332 (save-match-data
@@ -2308,7 +2337,7 @@ Return alist of strings if parsing was completed, `aborted' otherwise."
2308 bounds key) 2337 bounds key)
2309 (if (listp add) 2338 (if (listp add)
2310 (dolist (string add) 2339 (dolist (string add)
2311 (unless (assoc (car string) strings) 2340 (unless (assoc-string (car string) strings t)
2312 (push string strings)))) 2341 (push string strings))))
2313 (catch 'userkey 2342 (catch 'userkey
2314 (while (setq bounds (bibtex-search-forward-string)) 2343 (while (setq bounds (bibtex-search-forward-string))
@@ -2317,9 +2346,9 @@ Return alist of strings if parsing was completed, `aborted' otherwise."
2317 ;; user has aborted by typing a key --> return `aborted' 2346 ;; user has aborted by typing a key --> return `aborted'
2318 (throw 'userkey 'aborted)) 2347 (throw 'userkey 'aborted))
2319 (setq key (bibtex-reference-key-in-string bounds)) 2348 (setq key (bibtex-reference-key-in-string bounds))
2320 (if (not (assoc key strings)) 2349 (unless (assoc-string key strings t)
2321 (push (cons key (bibtex-text-in-string bounds t)) 2350 (push (cons key (bibtex-text-in-string bounds t))
2322 strings)) 2351 strings))
2323 (goto-char (bibtex-end-of-text-in-string bounds))) 2352 (goto-char (bibtex-end-of-text-in-string bounds)))
2324 ;; successful operation --> return `bibtex-strings' 2353 ;; successful operation --> return `bibtex-strings'
2325 (setq bibtex-strings strings)))))) 2354 (setq bibtex-strings strings))))))
@@ -2357,7 +2386,8 @@ Use `bibtex-predefined-strings' and bib files `bibtex-string-files'."
2357 (append bibtex-predefined-strings (nreverse compl))))) 2386 (append bibtex-predefined-strings (nreverse compl)))))
2358 2387
2359(defun bibtex-parse-buffers-stealthily () 2388(defun bibtex-parse-buffers-stealthily ()
2360 "Called by `bibtex-run-with-idle-timer'. Whenever emacs has been idle 2389 "Parse buffer in the background during idle time.
2390Called by `bibtex-run-with-idle-timer'. Whenever Emacs has been idle
2361for `bibtex-parse-keys-timeout' seconds, all BibTeX buffers (starting 2391for `bibtex-parse-keys-timeout' seconds, all BibTeX buffers (starting
2362with the current) are parsed." 2392with the current) are parsed."
2363 (save-excursion 2393 (save-excursion
@@ -2381,9 +2411,9 @@ with the current) are parsed."
2381 (setq buffers (cdr buffers)))))) 2411 (setq buffers (cdr buffers))))))
2382 2412
2383(defun bibtex-complete-internal (completions) 2413(defun bibtex-complete-internal (completions)
2384 "Complete word fragment before point to longest prefix of one 2414 "Complete word fragment before point to longest prefix of COMPLETIONS.
2385string defined in list COMPLETIONS. If point is not after the part 2415COMPLETIONS should be a list of strings. If point is not after the part
2386of a word, all strings are listed. Return completion." 2416of a word, all strings are listed. Return completion."
2387 (let* ((case-fold-search t) 2417 (let* ((case-fold-search t)
2388 (beg (save-excursion 2418 (beg (save-excursion
2389 (re-search-backward "[ \t{\"]") 2419 (re-search-backward "[ \t{\"]")
@@ -2409,11 +2439,12 @@ of a word, all strings are listed. Return completion."
2409 ;; return value is handled by choose-completion-string-functions 2439 ;; return value is handled by choose-completion-string-functions
2410 nil)))) 2440 nil))))
2411 2441
2412(defun bibtex-complete-string-cleanup (str) 2442(defun bibtex-complete-string-cleanup (str strings-alist)
2413 "Cleanup after inserting string STR. 2443 "Cleanup after inserting string STR.
2414Remove enclosing field delimiters for string STR. Display message with 2444Remove enclosing field delimiters for string STR. Display message with
2415expansion of STR." 2445expansion of STR using expansion list STRINGS-ALIST."
2416 (let ((pair (assoc str bibtex-strings))) 2446 (let ((pair (if (stringp str)
2447 (assoc-string str strings-alist t))))
2417 (when pair 2448 (when pair
2418 (if (cdr pair) 2449 (if (cdr pair)
2419 (message "Abbreviation for `%s'" (cdr pair))) 2450 (message "Abbreviation for `%s'" (cdr pair)))
@@ -2427,6 +2458,38 @@ expansion of STR."
2427 (bibtex-end-of-text-in-field bounds))) 2458 (bibtex-end-of-text-in-field bounds)))
2428 (bibtex-remove-delimiters)))))))) 2459 (bibtex-remove-delimiters))))))))
2429 2460
2461(defun bibtex-complete-key-cleanup (key)
2462 "Display message on entry KEY after completion of a crossref key."
2463 (save-excursion
2464 ;; Don't do anything if we completed the key of an entry.
2465 (let ((pnt (bibtex-beginning-of-entry)))
2466 (if (and (stringp key)
2467 (bibtex-find-entry key)
2468 (/= pnt (point)))
2469 (let* ((bibtex-autokey-name-case-convert 'identity)
2470 (bibtex-autokey-name-length 'infty)
2471 (nl (bibtex-autokey-get-names))
2472 (name (concat (nth 0 nl) (if (nth 1 nl) " etal")))
2473 (year (bibtex-autokey-get-field "year"))
2474 (bibtex-autokey-titlewords 5)
2475 (bibtex-autokey-titlewords-stretch 2)
2476 (bibtex-autokey-titleword-case-convert 'identity)
2477 (bibtex-autokey-titleword-length 5)
2478 (title (mapconcat 'identity
2479 (bibtex-autokey-get-title) " "))
2480 (journal (bibtex-autokey-get-field
2481 "journal" bibtex-autokey-transcriptions))
2482 (volume (bibtex-autokey-get-field "volume"))
2483 (pages (bibtex-autokey-get-field "pages" '(("-.*\\'" . "")))))
2484 (message "Ref:%s"
2485 (mapconcat (lambda (arg)
2486 (if (not (string= "" (cdr arg)))
2487 (concat (car arg) (cdr arg))))
2488 `((" " . ,name) (" " . ,year)
2489 (": " . ,title) (", " . ,journal)
2490 (" " . ,volume) (":" . ,pages))
2491 "")))))))
2492
2430(defun bibtex-choose-completion-string (choice buffer mini-p base-size) 2493(defun bibtex-choose-completion-string (choice buffer mini-p base-size)
2431 ;; Code borrowed from choose-completion-string: 2494 ;; Code borrowed from choose-completion-string:
2432 ;; We must duplicate the code from choose-completion-string 2495 ;; We must duplicate the code from choose-completion-string
@@ -2450,7 +2513,8 @@ expansion of STR."
2450 (set-window-point window (point)))) 2513 (set-window-point window (point))))
2451 2514
2452(defun bibtex-pop (arg direction) 2515(defun bibtex-pop (arg direction)
2453 "Generic function used by `bibtex-pop-previous' and `bibtex-pop-next'." 2516 "Fill current field from the ARG'th same field's text in DIRECTION.
2517Generic function used by `bibtex-pop-previous' and `bibtex-pop-next'."
2454 (let (bibtex-help-message) 2518 (let (bibtex-help-message)
2455 (bibtex-find-text nil)) 2519 (bibtex-find-text nil))
2456 (save-excursion 2520 (save-excursion
@@ -2460,17 +2524,7 @@ expansion of STR."
2460 (bounds (bibtex-enclosing-field)) 2524 (bounds (bibtex-enclosing-field))
2461 (start-old-text (bibtex-start-of-text-in-field bounds)) 2525 (start-old-text (bibtex-start-of-text-in-field bounds))
2462 (stop-old-text (bibtex-end-of-text-in-field bounds)) 2526 (stop-old-text (bibtex-end-of-text-in-field bounds))
2463 (start-name (bibtex-start-of-name-in-field bounds)) 2527 (field-name (bibtex-name-in-field bounds t)))
2464 (stop-name (bibtex-end-of-name-in-field bounds))
2465 ;; construct regexp for field with same name as this one,
2466 ;; ignoring possible OPT's or ALT's
2467 (field-name (progn
2468 (goto-char start-name)
2469 (buffer-substring-no-properties
2470 (if (looking-at "\\(OPT\\)\\|\\(ALT\\)")
2471 (match-end 0)
2472 (point))
2473 stop-name))))
2474 ;; if executed several times in a row, start each search where 2528 ;; if executed several times in a row, start each search where
2475 ;; the last one was finished 2529 ;; the last one was finished
2476 (unless (eq last-command 'bibtex-pop) 2530 (unless (eq last-command 'bibtex-pop)
@@ -2523,15 +2577,15 @@ expansion of STR."
2523General information on working with BibTeX mode: 2577General information on working with BibTeX mode:
2524 2578
2525You should use commands such as \\[bibtex-Book] to get a template for a 2579You should use commands such as \\[bibtex-Book] to get a template for a
2526specific entry. You should then fill in all desired fields using 2580specific entry. You should then fill in all desired fields using
2527\\[bibtex-next-field] to jump from field to field. After having filled 2581\\[bibtex-next-field] to jump from field to field. After having filled
2528in all desired fields in the entry, you should clean the new entry 2582in all desired fields in the entry, you should clean the new entry
2529with the command \\[bibtex-clean-entry]. 2583with the command \\[bibtex-clean-entry].
2530 2584
2531Some features of BibTeX mode are available only by setting the variable 2585Some features of BibTeX mode are available only by setting the variable
2532`bibtex-maintain-sorted-entries' to non-nil. However, then BibTeX mode will 2586`bibtex-maintain-sorted-entries' to non-nil. However, then BibTeX mode will
2533work only with buffers containing valid (syntactical correct) entries 2587work only with buffers containing valid (syntactical correct) entries
2534and with entries being sorted. This is usually the case, if you have 2588and with entries being sorted. This is usually the case, if you have
2535created a buffer completely with BibTeX mode and finished every new 2589created a buffer completely with BibTeX mode and finished every new
2536entry with \\[bibtex-clean-entry]. 2590entry with \\[bibtex-clean-entry].
2537 2591
@@ -2639,9 +2693,10 @@ non-nil.
2639 ) 2693 )
2640 nil 2694 nil
2641 (font-lock-syntactic-keywords . bibtex-font-lock-syntactic-keywords) 2695 (font-lock-syntactic-keywords . bibtex-font-lock-syntactic-keywords)
2696 (font-lock-extra-managed-props . (mouse-face keymap))
2642 (font-lock-mark-block-function 2697 (font-lock-mark-block-function
2643 . (lambda () 2698 . (lambda ()
2644 (set-mark (bibtex-end-of-entry)) 2699 (set-mark (bibtex-end-of-entry))
2645 (bibtex-beginning-of-entry))))) 2700 (bibtex-beginning-of-entry)))))
2646 (setq imenu-generic-expression 2701 (setq imenu-generic-expression
2647 (list (list nil bibtex-entry-head bibtex-key-in-head))) 2702 (list (list nil bibtex-entry-head bibtex-key-in-head)))
@@ -2681,7 +2736,7 @@ names for ENTRY-TYPE according to `bibtex-entry-field-alist'."
2681 (cons required optional))) 2736 (cons required optional)))
2682 2737
2683(defun bibtex-entry (entry-type) 2738(defun bibtex-entry (entry-type)
2684 "Insert a new BibTeX entry. 2739 "Insert a new BibTeX entry of type ENTRY-TYPE.
2685After insertion it calls the functions in `bibtex-add-entry-hook'." 2740After insertion it calls the functions in `bibtex-add-entry-hook'."
2686 (interactive (let* ((completion-ignore-case t) 2741 (interactive (let* ((completion-ignore-case t)
2687 (e-t (completing-read 2742 (e-t (completing-read
@@ -2698,8 +2753,8 @@ After insertion it calls the functions in `bibtex-add-entry-hook'."
2698 (insert "@" entry-type (bibtex-entry-left-delimiter)) 2753 (insert "@" entry-type (bibtex-entry-left-delimiter))
2699 (if key (insert key)) 2754 (if key (insert key))
2700 (save-excursion 2755 (save-excursion
2701 (mapcar 'bibtex-make-field (car field-list)) 2756 (mapc 'bibtex-make-field (car field-list))
2702 (mapcar 'bibtex-make-optional-field (cdr field-list)) 2757 (mapc 'bibtex-make-optional-field (cdr field-list))
2703 (if bibtex-comma-after-last-field 2758 (if bibtex-comma-after-last-field
2704 (insert ",")) 2759 (insert ","))
2705 (insert "\n") 2760 (insert "\n")
@@ -2722,29 +2777,27 @@ according to `bibtex-entry-field-alist', but are not yet present."
2722 (let* ((fields-alist (bibtex-parse-entry)) 2777 (let* ((fields-alist (bibtex-parse-entry))
2723 (field-list (bibtex-field-list 2778 (field-list (bibtex-field-list
2724 (substring (cdr (assoc "=type=" fields-alist)) 2779 (substring (cdr (assoc "=type=" fields-alist))
2725 1))) ; don't want @ 2780 1)))) ; don't want @
2726 (case-fold-search t))
2727 (dolist (field (car field-list)) 2781 (dolist (field (car field-list))
2728 (unless (bibtex-assoc-regexp (concat "\\`\\(ALT\\)?" (car field) "\\'") 2782 (unless (assoc-string (car field) fields-alist t)
2729 fields-alist)
2730 (bibtex-make-field field))) 2783 (bibtex-make-field field)))
2731 (dolist (field (cdr field-list)) 2784 (dolist (field (cdr field-list))
2732 (unless (bibtex-assoc-regexp (concat "\\`\\(OPT\\)?" (car field) "\\'") 2785 (unless (assoc-string (car field) fields-alist t)
2733 fields-alist)
2734 (bibtex-make-optional-field field)))))) 2786 (bibtex-make-optional-field field))))))
2735 2787
2736(defun bibtex-parse-entry () 2788(defun bibtex-parse-entry ()
2737 "Parse entry at point, return an alist. 2789 "Parse entry at point, return an alist.
2738The alist elements have the form (FIELD . TEXT), where FIELD can also be 2790The alist elements have the form (FIELD . TEXT), where FIELD can also be
2739the special strings \"=type=\" and \"=key=\". For the FIELD \"=key=\" 2791the special strings \"=type=\" and \"=key=\". For the FIELD \"=key=\"
2740TEXT may be nil. Move point to the end of the last field." 2792TEXT may be nil. Remove \"OPT\" and \"ALT\" from FIELD.
2793Move point to the end of the last field."
2741 (let (alist bounds) 2794 (let (alist bounds)
2742 (when (looking-at bibtex-entry-maybe-empty-head) 2795 (when (looking-at bibtex-entry-maybe-empty-head)
2743 (push (cons "=type=" (match-string bibtex-type-in-head)) alist) 2796 (push (cons "=type=" (match-string bibtex-type-in-head)) alist)
2744 (push (cons "=key=" (match-string bibtex-key-in-head)) alist) 2797 (push (cons "=key=" (match-string bibtex-key-in-head)) alist)
2745 (goto-char (match-end 0)) 2798 (goto-char (match-end 0))
2746 (while (setq bounds (bibtex-parse-field bibtex-field-name)) 2799 (while (setq bounds (bibtex-parse-field bibtex-field-name))
2747 (push (cons (bibtex-name-in-field bounds) 2800 (push (cons (bibtex-name-in-field bounds t)
2748 (bibtex-text-in-field-bounds bounds)) 2801 (bibtex-text-in-field-bounds bounds))
2749 alist) 2802 alist)
2750 (goto-char (bibtex-end-of-field bounds)))) 2803 (goto-char (bibtex-end-of-field bounds))))
@@ -2770,7 +2823,7 @@ TEXT may be nil. Move point to the end of the last field."
2770 (bibtex-beginning-of-entry) 2823 (bibtex-beginning-of-entry)
2771 (when (and 2824 (when (and
2772 (looking-at bibtex-entry-head) 2825 (looking-at bibtex-entry-head)
2773 (equal type (match-string bibtex-type-in-head)) 2826 (bibtex-string= type (match-string bibtex-type-in-head))
2774 ;; In case we found ourselves :-( 2827 ;; In case we found ourselves :-(
2775 (not (equal key (setq tmp (match-string bibtex-key-in-head))))) 2828 (not (equal key (setq tmp (match-string bibtex-key-in-head)))))
2776 (setq other-key tmp) 2829 (setq other-key tmp)
@@ -2780,7 +2833,7 @@ TEXT may be nil. Move point to the end of the last field."
2780 (bibtex-skip-to-valid-entry) 2833 (bibtex-skip-to-valid-entry)
2781 (when (and 2834 (when (and
2782 (looking-at bibtex-entry-head) 2835 (looking-at bibtex-entry-head)
2783 (equal type (match-string bibtex-type-in-head)) 2836 (bibtex-string= type (match-string bibtex-type-in-head))
2784 ;; In case we found ourselves :-( 2837 ;; In case we found ourselves :-(
2785 (not (equal key (setq tmp (match-string bibtex-key-in-head)))) 2838 (not (equal key (setq tmp (match-string bibtex-key-in-head))))
2786 (or (not other-key) 2839 (or (not other-key)
@@ -2794,11 +2847,8 @@ TEXT may be nil. Move point to the end of the last field."
2794 (setq other (save-excursion (goto-char other) (bibtex-parse-entry))) 2847 (setq other (save-excursion (goto-char other) (bibtex-parse-entry)))
2795 (setq key-end (point)) ;In case parse-entry changed the buffer. 2848 (setq key-end (point)) ;In case parse-entry changed the buffer.
2796 (while (setq bounds (bibtex-parse-field bibtex-field-name)) 2849 (while (setq bounds (bibtex-parse-field bibtex-field-name))
2797 (goto-char (bibtex-start-of-name-in-field bounds)) 2850 (let ((text (assoc-string (bibtex-name-in-field bounds t)
2798 (let* ((name (buffer-substring 2851 other t)))
2799 (if (looking-at "ALT\\|OPT") (match-end 0) (point))
2800 (bibtex-end-of-name-in-field bounds)))
2801 (text (assoc-string name other t)))
2802 (goto-char (bibtex-start-of-text-in-field bounds)) 2852 (goto-char (bibtex-start-of-text-in-field bounds))
2803 (if (not (and (looking-at bibtex-empty-field-re) text)) 2853 (if (not (and (looking-at bibtex-empty-field-re) text))
2804 (goto-char (bibtex-end-of-field bounds)) 2854 (goto-char (bibtex-end-of-field bounds))
@@ -2821,13 +2871,7 @@ TEXT may be nil. Move point to the end of the last field."
2821 (interactive) 2871 (interactive)
2822 (save-excursion 2872 (save-excursion
2823 (let* ((case-fold-search t) 2873 (let* ((case-fold-search t)
2824 (bounds (bibtex-enclosing-field)) 2874 (field-name (bibtex-name-in-field (bibtex-enclosing-field) t))
2825 (mb (bibtex-start-of-name-in-field bounds))
2826 (field-name (buffer-substring-no-properties
2827 (if (progn (goto-char mb)
2828 (looking-at "OPT\\|ALT"))
2829 (match-end 0) mb)
2830 (bibtex-end-of-name-in-field bounds)))
2831 (field-list (bibtex-field-list (progn (re-search-backward 2875 (field-list (bibtex-field-list (progn (re-search-backward
2832 bibtex-entry-maybe-empty-head nil t) 2876 bibtex-entry-maybe-empty-head nil t)
2833 (bibtex-type-in-head)))) 2877 (bibtex-type-in-head))))
@@ -2843,7 +2887,8 @@ TEXT may be nil. Move point to the end of the last field."
2843 "Make a field named FIELD in current BibTeX entry. 2887 "Make a field named FIELD in current BibTeX entry.
2844FIELD is either a string or a list of the form 2888FIELD is either a string or a list of the form
2845\(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in 2889\(FIELD-NAME COMMENT-STRING INIT ALTERNATIVE-FLAG) as in
2846`bibtex-entry-field-alist'." 2890`bibtex-entry-field-alist'.
2891If CALLED-BY-YANK is non-nil, don't insert delimiters."
2847 (interactive 2892 (interactive
2848 (list (let ((completion-ignore-case t) 2893 (list (let ((completion-ignore-case t)
2849 (field-list (bibtex-field-list 2894 (field-list (bibtex-field-list
@@ -2868,16 +2913,16 @@ FIELD is either a string or a list of the form
2868 (indent-to-column (+ bibtex-entry-offset 2913 (indent-to-column (+ bibtex-entry-offset
2869 (- bibtex-text-indentation 2)))) 2914 (- bibtex-text-indentation 2))))
2870 (insert "= ") 2915 (insert "= ")
2871 (if (not bibtex-align-at-equal-sign) 2916 (unless bibtex-align-at-equal-sign
2872 (indent-to-column (+ bibtex-entry-offset 2917 (indent-to-column (+ bibtex-entry-offset
2873 bibtex-text-indentation))) 2918 bibtex-text-indentation)))
2874 (if (not called-by-yank) (insert (bibtex-field-left-delimiter))) 2919 (unless called-by-yank (insert (bibtex-field-left-delimiter)))
2875 (let ((init (nth 2 field))) 2920 (let ((init (nth 2 field)))
2876 (cond ((stringp init) 2921 (cond ((stringp init)
2877 (insert init)) 2922 (insert init))
2878 ((fboundp init) 2923 ((fboundp init)
2879 (insert (funcall init))))) 2924 (insert (funcall init)))))
2880 (if (not called-by-yank) (insert (bibtex-field-right-delimiter))) 2925 (unless called-by-yank (insert (bibtex-field-right-delimiter)))
2881 (when (interactive-p) 2926 (when (interactive-p)
2882 (forward-char -1) 2927 (forward-char -1)
2883 (bibtex-print-help-message))) 2928 (bibtex-print-help-message)))
@@ -2885,8 +2930,8 @@ FIELD is either a string or a list of the form
2885(defun bibtex-beginning-of-entry () 2930(defun bibtex-beginning-of-entry ()
2886 "Move to beginning of BibTeX entry (beginning of line). 2931 "Move to beginning of BibTeX entry (beginning of line).
2887If inside an entry, move to the beginning of it, otherwise move to the 2932If inside an entry, move to the beginning of it, otherwise move to the
2888beginning of the previous entry. If point is ahead of all BibTeX entries 2933beginning of the previous entry. If point is ahead of all BibTeX entries
2889move point to the beginning of buffer. Return the new location of point." 2934move point to the beginning of buffer. Return the new location of point."
2890 (interactive) 2935 (interactive)
2891 (skip-chars-forward " \t") 2936 (skip-chars-forward " \t")
2892 (if (looking-at "@") 2937 (if (looking-at "@")
@@ -2897,7 +2942,7 @@ move point to the beginning of buffer. Return the new location of point."
2897(defun bibtex-end-of-entry () 2942(defun bibtex-end-of-entry ()
2898 "Move to end of BibTeX entry (past the closing brace). 2943 "Move to end of BibTeX entry (past the closing brace).
2899If inside an entry, move to the end of it, otherwise move to the end 2944If inside an entry, move to the end of it, otherwise move to the end
2900of the previous entry. Do not move if ahead of first entry. 2945of the previous entry. Do not move if ahead of first entry.
2901Return the new location of point." 2946Return the new location of point."
2902 (interactive) 2947 (interactive)
2903 (let ((case-fold-search t) 2948 (let ((case-fold-search t)
@@ -2997,9 +3042,9 @@ If mark is active it counts entries in region, if not in whole buffer."
2997 (bibtex-end-of-entry)))) 3042 (bibtex-end-of-entry))))
2998 3043
2999(defun bibtex-entry-index () 3044(defun bibtex-entry-index ()
3000 "Return the index of the BibTeX entry at point. Move point. 3045 "Return the index of the BibTeX entry at point. Move point.
3001The index is a list (KEY CROSSREF-KEY ENTRY-NAME) that is used for sorting 3046The index is a list (KEY CROSSREF-KEY ENTRY-NAME) that is used for sorting
3002the entries of the BibTeX buffer. Return nil if no entry found." 3047the entries of the BibTeX buffer. Return nil if no entry found."
3003 (let ((case-fold-search t)) 3048 (let ((case-fold-search t))
3004 (if (re-search-forward bibtex-entry-maybe-empty-head nil t) 3049 (if (re-search-forward bibtex-entry-maybe-empty-head nil t)
3005 (let ((key (bibtex-key-in-head)) 3050 (let ((key (bibtex-key-in-head))
@@ -3049,8 +3094,8 @@ If its value is nil use plain sorting."
3049(defun bibtex-sort-buffer () 3094(defun bibtex-sort-buffer ()
3050 "Sort BibTeX buffer alphabetically by key. 3095 "Sort BibTeX buffer alphabetically by key.
3051The predicate for sorting is defined via `bibtex-maintain-sorted-entries'. 3096The predicate for sorting is defined via `bibtex-maintain-sorted-entries'.
3052If its value is nil use plain sorting. Text outside of BibTeX entries is not 3097If its value is nil use plain sorting. Text outside of BibTeX entries is not
3053affected. If `bibtex-sort-ignore-string-entries' is non-nil, @String entries 3098affected. If `bibtex-sort-ignore-string-entries' is non-nil, @String entries
3054will be ignored." 3099will be ignored."
3055 (interactive) 3100 (interactive)
3056 (save-restriction 3101 (save-restriction
@@ -3084,13 +3129,17 @@ entry."
3084 (error "This entry must not follow the crossrefed entry!")) 3129 (error "This entry must not follow the crossrefed entry!"))
3085 (goto-char pos))) 3130 (goto-char pos)))
3086 3131
3087(defun bibtex-find-entry (key) 3132(defun bibtex-find-entry (key &optional start)
3088 "Move point to the beginning of BibTeX entry named KEY. 3133 "Move point to the beginning of BibTeX entry named KEY.
3089Return position of entry if KEY is found or nil if not found." 3134Return position of entry if KEY is found or nil if not found.
3090 (interactive (list (bibtex-read-key "Find key: "))) 3135Optional arg START is buffer position where the search starts.
3136If it is nil, start search at beginning of buffer.
3137With prefix arg, the value of START is position of point."
3138 (interactive (list (bibtex-read-key "Find key: ")
3139 (if current-prefix-arg (point))))
3091 (let* (case-fold-search 3140 (let* (case-fold-search
3092 (pnt (save-excursion 3141 (pnt (save-excursion
3093 (goto-char (point-min)) 3142 (goto-char (or start (point-min)))
3094 (if (re-search-forward (concat "^[ \t]*\\(" 3143 (if (re-search-forward (concat "^[ \t]*\\("
3095 bibtex-entry-type 3144 bibtex-entry-type
3096 "\\)[ \t]*[({][ \t\n]*\\(" 3145 "\\)[ \t]*[({][ \t\n]*\\("
@@ -3108,7 +3157,7 @@ Return position of entry if KEY is found or nil if not found."
3108INDEX is a list (KEY CROSSREF-KEY ENTRY-NAME). 3157INDEX is a list (KEY CROSSREF-KEY ENTRY-NAME).
3109Move point where the entry KEY should be placed. 3158Move point where the entry KEY should be placed.
3110If `bibtex-maintain-sorted-entries' is non-nil, perform a binary 3159If `bibtex-maintain-sorted-entries' is non-nil, perform a binary
3111search to look for place for KEY. This will fail if buffer is not in 3160search to look for place for KEY. This will fail if buffer is not in
3112sorted order, see \\[bibtex-validate].) 3161sorted order, see \\[bibtex-validate].)
3113Return t if preparation was successful or nil if entry KEY already exists." 3162Return t if preparation was successful or nil if entry KEY already exists."
3114 (let ((key (nth 0 index)) 3163 (let ((key (nth 0 index))
@@ -3157,8 +3206,7 @@ Return t if preparation was successful or nil if entry KEY already exists."
3157 ;; buffer contains no valid entries or 3206 ;; buffer contains no valid entries or
3158 ;; greater than last entry --> append 3207 ;; greater than last entry --> append
3159 (bibtex-end-of-entry) 3208 (bibtex-end-of-entry)
3160 (if (not (bobp)) 3209 (unless (bobp) (newline (forward-line 2)))
3161 (newline (forward-line 2)))
3162 (beginning-of-line))))) 3210 (beginning-of-line)))))
3163 (unless key-exist t))) 3211 (unless key-exist t)))
3164 3212
@@ -3233,9 +3281,7 @@ Returns t if test was successful, nil otherwise."
3233 (goto-char (point-min)) 3281 (goto-char (point-min))
3234 (bibtex-progress-message 3282 (bibtex-progress-message
3235 "Checking required fields and month fields") 3283 "Checking required fields and month fields")
3236 (let ((bibtex-sort-ignore-string-entries t) 3284 (let ((bibtex-sort-ignore-string-entries t))
3237 (questionable-month
3238 (regexp-opt (mapcar 'car bibtex-predefined-month-strings))))
3239 (bibtex-map-entries 3285 (bibtex-map-entries
3240 (lambda (key beg end) 3286 (lambda (key beg end)
3241 (bibtex-progress-message) 3287 (bibtex-progress-message)
@@ -3251,17 +3297,16 @@ Returns t if test was successful, nil otherwise."
3251 (while (setq bounds (bibtex-search-forward-field 3297 (while (setq bounds (bibtex-search-forward-field
3252 bibtex-field-name end)) 3298 bibtex-field-name end))
3253 (goto-char (bibtex-start-of-text-in-field bounds)) 3299 (goto-char (bibtex-start-of-text-in-field bounds))
3254 (let ((field-name (downcase (bibtex-name-in-field bounds))) 3300 (let ((field-name (bibtex-name-in-field bounds)))
3255 case-fold-search) 3301 (if (and (bibtex-string= field-name "month")
3256 (if (and (equal field-name "month") 3302 (not (assoc-string (bibtex-text-in-field-bounds bounds)
3257 (not (string-match questionable-month 3303 bibtex-predefined-month-strings t)))
3258 (bibtex-text-in-field-bounds bounds))))
3259 (push (list (bibtex-current-line) 3304 (push (list (bibtex-current-line)
3260 "Questionable month field") 3305 "Questionable month field")
3261 error-list)) 3306 error-list))
3262 (setq req (delete (assoc-string field-name req t) req) 3307 (setq req (delete (assoc-string field-name req t) req)
3263 creq (delete (assoc-string field-name creq t) creq)) 3308 creq (delete (assoc-string field-name creq t) creq))
3264 (if (equal field-name "crossref") 3309 (if (bibtex-string= field-name "crossref")
3265 (setq crossref-there t)))) 3310 (setq crossref-there t))))
3266 (if crossref-there 3311 (if crossref-there
3267 (setq req creq)) 3312 (setq req creq))
@@ -3305,10 +3350,6 @@ Returns t if test was successful, nil otherwise."
3305 (dolist (err error-list) 3350 (dolist (err error-list)
3306 (insert bufnam ":" (number-to-string (elt err 0)) 3351 (insert bufnam ":" (number-to-string (elt err 0))
3307 ": " (elt err 1) "\n")) 3352 ": " (elt err 1) "\n"))
3308 (compilation-parse-errors nil nil)
3309 (setq compilation-old-error-list compilation-error-list)
3310 ;; this is necessary to avoid reparsing of buffer if you
3311 ;; switch to compilation buffer and enter `compile-goto-error'
3312 (set-buffer-modified-p nil) 3353 (set-buffer-modified-p nil)
3313 (toggle-read-only 1) 3354 (toggle-read-only 1)
3314 (goto-char (point-min)) 3355 (goto-char (point-min))
@@ -3395,11 +3436,13 @@ Align text and go thereafter to end of text."
3395 (interactive) 3436 (interactive)
3396 (save-excursion 3437 (save-excursion
3397 (bibtex-inside-field) 3438 (bibtex-inside-field)
3398 (let ((bounds (bibtex-enclosing-field))) 3439 (let* ((bounds (bibtex-enclosing-field))
3399 (goto-char (bibtex-start-of-text-in-field bounds)) 3440 (end (bibtex-end-of-text-in-field bounds))
3400 (delete-char 1) 3441 (start (bibtex-start-of-text-in-field bounds)))
3401 (goto-char (1- (bibtex-end-of-text-in-field bounds))) 3442 (if (memq (char-before end) '(?\} ?\"))
3402 (delete-backward-char 1)))) 3443 (delete-region (1- end) end))
3444 (if (memq (char-after start) '(?\{ ?\"))
3445 (delete-region start (1+ start))))))
3403 3446
3404(defun bibtex-kill-field (&optional copy-only) 3447(defun bibtex-kill-field (&optional copy-only)
3405 "Kill the entire enclosing BibTeX field. 3448 "Kill the entire enclosing BibTeX field.
@@ -3455,6 +3498,7 @@ With prefix arg COPY-ONLY the current entry to
3455 (setq bibtex-last-kill-command 'entry)) 3498 (setq bibtex-last-kill-command 'entry))
3456 3499
3457(defun bibtex-copy-entry-as-kill () 3500(defun bibtex-copy-entry-as-kill ()
3501 "Copy the entire enclosing BibTeX entry to `bibtex-entry-kill-ring'."
3458 (interactive) 3502 (interactive)
3459 (bibtex-kill-entry t)) 3503 (bibtex-kill-entry t))
3460 3504
@@ -3482,8 +3526,8 @@ If N is negative, this is a more recent kill.
3482The sequence of kills wraps around, so that after the oldest one 3526The sequence of kills wraps around, so that after the oldest one
3483comes the newest one." 3527comes the newest one."
3484 (interactive "*p") 3528 (interactive "*p")
3485 (if (not (eq last-command 'bibtex-yank)) 3529 (unless (eq last-command 'bibtex-yank)
3486 (error "Previous command was not a BibTeX yank")) 3530 (error "Previous command was not a BibTeX yank"))
3487 (setq this-command 'bibtex-yank) 3531 (setq this-command 'bibtex-yank)
3488 (let ((inhibit-read-only t)) 3532 (let ((inhibit-read-only t))
3489 (delete-region (point) (mark t)) 3533 (delete-region (point) (mark t))
@@ -3519,7 +3563,7 @@ intermixed with \\[bibtex-pop-previous] (bibtex-pop-previous)."
3519Check that no required fields are empty and formats entry dependent 3563Check that no required fields are empty and formats entry dependent
3520on the value of `bibtex-entry-format'. 3564on the value of `bibtex-entry-format'.
3521If the reference key of the entry is empty or a prefix argument is given, 3565If the reference key of the entry is empty or a prefix argument is given,
3522calculate a new reference key. (Note: this will only work if fields in entry 3566calculate a new reference key. (Note: this will only work if fields in entry
3523begin on separate lines prior to calling `bibtex-clean-entry' or if 3567begin on separate lines prior to calling `bibtex-clean-entry' or if
3524'realign is contained in `bibtex-entry-format'.) 3568'realign is contained in `bibtex-entry-format'.)
3525Don't call `bibtex-clean-entry' on @Preamble entries. 3569Don't call `bibtex-clean-entry' on @Preamble entries.
@@ -3533,19 +3577,20 @@ At end of the cleaning process, the functions in
3533 (bibtex-beginning-of-entry) 3577 (bibtex-beginning-of-entry)
3534 (save-excursion 3578 (save-excursion
3535 (when (re-search-forward bibtex-entry-maybe-empty-head nil t) 3579 (when (re-search-forward bibtex-entry-maybe-empty-head nil t)
3536 (setq entry-type (downcase (bibtex-type-in-head))) 3580 (setq entry-type (bibtex-type-in-head))
3537 (setq key (bibtex-key-in-head)))) 3581 (setq key (bibtex-key-in-head))))
3538 ;; formatting 3582 ;; formatting
3539 (cond ((equal entry-type "preamble") 3583 (cond ((bibtex-string= entry-type "preamble")
3540 ;; (bibtex-format-preamble) 3584 ;; (bibtex-format-preamble)
3541 (error "No clean up of @Preamble entries")) 3585 (error "No clean up of @Preamble entries"))
3542 ((equal entry-type "string")) 3586 ((bibtex-string= entry-type "string"))
3543 ;; (bibtex-format-string) 3587 ;; (bibtex-format-string)
3544 (t (bibtex-format-entry))) 3588 (t (bibtex-format-entry)))
3545 ;; set key 3589 ;; set key
3546 (when (or new-key (not key)) 3590 (when (or new-key (not key))
3547 (setq key (bibtex-generate-autokey)) 3591 (setq key (bibtex-generate-autokey))
3548 (if bibtex-autokey-edit-before-use 3592 ;; Sometimes bibtex-generate-autokey returns an empty string
3593 (if (or bibtex-autokey-edit-before-use (string= "" key))
3549 (setq key (bibtex-read-key "Key to use: " key))) 3594 (setq key (bibtex-read-key "Key to use: " key)))
3550 (re-search-forward bibtex-entry-maybe-empty-head) 3595 (re-search-forward bibtex-entry-maybe-empty-head)
3551 (if (match-beginning bibtex-key-in-head) 3596 (if (match-beginning bibtex-key-in-head)
@@ -3563,19 +3608,21 @@ At end of the cleaning process, the functions in
3563 (entry (buffer-substring start end)) 3608 (entry (buffer-substring start end))
3564 (index (progn (goto-char start) 3609 (index (progn (goto-char start)
3565 (bibtex-entry-index))) 3610 (bibtex-entry-index)))
3566 no-error) 3611 error)
3567 (if (and bibtex-maintain-sorted-entries 3612 (if (and bibtex-maintain-sorted-entries
3568 (not (and bibtex-sort-ignore-string-entries 3613 (not (and bibtex-sort-ignore-string-entries
3569 (equal entry-type "string")))) 3614 (bibtex-string= entry-type "string"))))
3570 (progn 3615 (progn
3571 (delete-region start end) 3616 (delete-region start end)
3572 (setq no-error (bibtex-prepare-new-entry index)) 3617 (setq error (not (bibtex-prepare-new-entry index)))
3573 (insert entry) 3618 (insert entry)
3574 (forward-char -1) 3619 (forward-char -1)
3575 (bibtex-beginning-of-entry) ; moves backward 3620 (bibtex-beginning-of-entry) ; moves backward
3576 (re-search-forward bibtex-entry-head)) 3621 (re-search-forward bibtex-entry-head))
3577 (setq no-error (bibtex-find-entry (car index)))) 3622 (bibtex-find-entry key)
3578 (unless no-error 3623 (setq error (or (/= (point) start)
3624 (bibtex-find-entry key end))))
3625 (if error
3579 (error "New inserted entry yields duplicate key")))) 3626 (error "New inserted entry yields duplicate key"))))
3580 ;; final clean up 3627 ;; final clean up
3581 (unless called-by-reformat 3628 (unless called-by-reformat
@@ -3583,7 +3630,7 @@ At end of the cleaning process, the functions in
3583 (save-restriction 3630 (save-restriction
3584 (bibtex-narrow-to-entry) 3631 (bibtex-narrow-to-entry)
3585 ;; Only update the list of keys if it has been built already. 3632 ;; Only update the list of keys if it has been built already.
3586 (cond ((equal entry-type "string") 3633 (cond ((bibtex-string= entry-type "string")
3587 (if (listp bibtex-strings) (bibtex-parse-strings t))) 3634 (if (listp bibtex-strings) (bibtex-parse-strings t)))
3588 ((listp bibtex-reference-keys) (bibtex-parse-keys t))) 3635 ((listp bibtex-reference-keys) (bibtex-parse-keys t)))
3589 (run-hooks 'bibtex-clean-entry-hook)))))) 3636 (run-hooks 'bibtex-clean-entry-hook))))))
@@ -3752,28 +3799,29 @@ entries from minibuffer."
3752(defun bibtex-complete () 3799(defun bibtex-complete ()
3753 "Complete word fragment before point according to context. 3800 "Complete word fragment before point according to context.
3754If point is inside key or crossref field perform key completion based on 3801If point is inside key or crossref field perform key completion based on
3755`bibtex-reference-keys'. Inside any other field perform string 3802`bibtex-reference-keys'. Inside a month field perform key completion
3756completion based on `bibtex-strings'. An error is signaled if point 3803based on `bibtex-predefined-month-strings'. Inside any other field
3757is outside key or BibTeX field." 3804perform string completion based on `bibtex-strings'. An error is
3805signaled if point is outside key or BibTeX field."
3758 (interactive) 3806 (interactive)
3759 (let* ((pnt (point)) 3807 (let ((pnt (point))
3760 (case-fold-search t) 3808 (case-fold-search t)
3761 bounds compl) 3809 bounds name compl)
3762 (save-excursion 3810 (save-excursion
3763 (if (and (setq bounds (bibtex-enclosing-field t)) 3811 (if (and (setq bounds (bibtex-enclosing-field t))
3764 (>= pnt (bibtex-start-of-text-in-field bounds)) 3812 (>= pnt (bibtex-start-of-text-in-field bounds))
3765 (<= pnt (bibtex-end-of-text-in-field bounds))) 3813 (<= pnt (bibtex-end-of-text-in-field bounds)))
3766 (progn 3814 (setq name (bibtex-name-in-field bounds t)
3767 (goto-char (bibtex-start-of-name-in-field bounds)) 3815 compl (cond ((bibtex-string= name "crossref")
3768 (setq compl (if (string= "crossref" 3816 'key)
3769 (downcase 3817 ((bibtex-string= name "month")
3770 (buffer-substring-no-properties 3818 bibtex-predefined-month-strings)
3771 (if (looking-at "\\(OPT\\)\\|\\(ALT\\)") 3819 (t (if (listp bibtex-strings)
3772 (match-end 0) 3820 bibtex-strings
3773 (point)) 3821 ;; so that bibtex-complete-string-cleanup
3774 (bibtex-end-of-name-in-field bounds)))) 3822 ;; can do its job
3775 'key 3823 (bibtex-parse-strings
3776 'str))) 3824 (bibtex-string-files-init))))))
3777 (bibtex-beginning-of-entry) 3825 (bibtex-beginning-of-entry)
3778 (if (and (re-search-forward bibtex-entry-maybe-empty-head nil t) 3826 (if (and (re-search-forward bibtex-entry-maybe-empty-head nil t)
3779 ;; point is inside a key 3827 ;; point is inside a key
@@ -3789,24 +3837,23 @@ is outside key or BibTeX field."
3789 ;; key completion 3837 ;; key completion
3790 (setq choose-completion-string-functions 3838 (setq choose-completion-string-functions
3791 (lambda (choice buffer mini-p base-size) 3839 (lambda (choice buffer mini-p base-size)
3792 (bibtex-choose-completion-string choice buffer mini-p base-size) 3840 (bibtex-choose-completion-string choice buffer mini-p base-size)
3793 (if bibtex-complete-key-cleanup 3841 (bibtex-complete-key-cleanup choice)
3794 (funcall bibtex-complete-key-cleanup choice))
3795 ;; return t (required by choose-completion-string-functions) 3842 ;; return t (required by choose-completion-string-functions)
3796 t)) 3843 t))
3797 (let ((choice (bibtex-complete-internal bibtex-reference-keys))) 3844 (bibtex-complete-key-cleanup (bibtex-complete-internal
3798 (if bibtex-complete-key-cleanup 3845 bibtex-reference-keys)))
3799 (funcall bibtex-complete-key-cleanup choice))))
3800 3846
3801 ((equal compl 'str) 3847 (compl
3802 ;; string completion 3848 ;; string completion
3803 (setq choose-completion-string-functions 3849 (setq choose-completion-string-functions
3804 (lambda (choice buffer mini-p base-size) 3850 `(lambda (choice buffer mini-p base-size)
3805 (bibtex-choose-completion-string choice buffer mini-p base-size) 3851 (bibtex-choose-completion-string choice buffer mini-p base-size)
3806 (bibtex-complete-string-cleanup choice) 3852 (bibtex-complete-string-cleanup choice ',compl)
3807 ;; return t (required by choose-completion-string-functions) 3853 ;; return t (required by choose-completion-string-functions)
3808 t)) 3854 t))
3809 (bibtex-complete-string-cleanup (bibtex-complete-internal bibtex-strings))) 3855 (bibtex-complete-string-cleanup (bibtex-complete-internal compl)
3856 compl))
3810 3857
3811 (t (error "Point outside key or BibTeX field"))))) 3858 (t (error "Point outside key or BibTeX field")))))
3812 3859
@@ -3880,8 +3927,8 @@ is outside key or BibTeX field."
3880 (interactive (list (completing-read "String key: " bibtex-strings 3927 (interactive (list (completing-read "String key: " bibtex-strings
3881 nil nil nil 'bibtex-key-history))) 3928 nil nil nil 'bibtex-key-history)))
3882 (let ((bibtex-maintain-sorted-entries 3929 (let ((bibtex-maintain-sorted-entries
3883 (if (not bibtex-sort-ignore-string-entries) 3930 (unless bibtex-sort-ignore-string-entries
3884 bibtex-maintain-sorted-entries)) 3931 bibtex-maintain-sorted-entries))
3885 endpos) 3932 endpos)
3886 (unless (bibtex-prepare-new-entry (list key nil "String")) 3933 (unless (bibtex-prepare-new-entry (list key nil "String"))
3887 (error "Entry with key `%s' already exists" key)) 3934 (error "Entry with key `%s' already exists" key))
@@ -3913,6 +3960,81 @@ is outside key or BibTeX field."
3913 "\n") 3960 "\n")
3914 (goto-char endpos))) 3961 (goto-char endpos)))
3915 3962
3963(defun bibtex-url (&optional event)
3964 "Browse a URL for the BibTeX entry at position PNT.
3965The URL is generated using the schemes defined in `bibtex-generate-url-list'
3966\(see there\). Then the URL is passed to `browse-url'."
3967 (interactive (list last-input-event))
3968 (save-excursion
3969 (if event (posn-set-point (event-end event)))
3970 (bibtex-beginning-of-entry)
3971 (let ((fields-alist (bibtex-parse-entry))
3972 (case-fold-search t)
3973 (lst bibtex-generate-url-list)
3974 field url scheme)
3975 (while (setq scheme (car lst))
3976 (when (and (setq field (cdr (assoc-string (caar scheme)
3977 fields-alist t)))
3978 (progn
3979 (if (string-match "\\`[{\"]\\(.*\\)[}\"]\\'" field)
3980 (setq field (match-string 1 field)))
3981 (string-match (cdar scheme) field)))
3982 (setq lst nil)
3983 (if (null (cdr scheme))
3984 (setq url (match-string 0 field)))
3985 (dolist (step (cdr scheme))
3986 (cond ((stringp step)
3987 (setq url (concat url step)))
3988 ((setq field (assoc-string (car step) fields-alist t))
3989 ;; always remove field delimiters
3990 (let* ((text (if (string-match "\\`[{\"]\\(.*\\)[}\"]\\'"
3991 (cdr field))
3992 (match-string 1 (cdr field))
3993 (cdr field)))
3994 (str (if (string-match (nth 1 step) text)
3995 (cond
3996 ((functionp (nth 2 step))
3997 (funcall (nth 2 step) text))
3998 ((numberp (nth 2 step))
3999 (match-string (nth 2 step) text))
4000 (t
4001 (replace-match (nth 2 step) nil nil text)))
4002 ;; If the scheme is set up correctly,
4003 ;; we should never reach this point
4004 (error "Match failed: %s" text))))
4005 (setq url (concat url str))))
4006 ;; If the scheme is set up correctly,
4007 ;; we should never reach this point
4008 (t (error "Step failed: %s" step))))
4009 (message "%s" url)
4010 (browse-url url))
4011 (setq lst (cdr lst)))
4012 (unless url (message "No URL known.")))))
4013
4014(defun bibtex-font-lock-url (bound)
4015 "Font-lock for URLs."
4016 (let ((case-fold-search t)
4017 (bounds (bibtex-enclosing-field t))
4018 (pnt (point))
4019 found field)
4020 ;; We use start-of-field as syntax-begin
4021 (goto-char (if bounds (bibtex-start-of-field bounds) pnt))
4022 (while (and (not found)
4023 (prog1 (re-search-forward bibtex-font-lock-url-regexp bound t)
4024 (setq field (match-string-no-properties 1)))
4025 (setq bounds (bibtex-parse-field-text))
4026 (>= bound (car bounds))
4027 (>= (car bounds) pnt))
4028 (let ((lst bibtex-generate-url-list) url)
4029 (goto-char (car bounds))
4030 (while (and (not found)
4031 (setq url (caar lst)))
4032 (when (bibtex-string= field (car url))
4033 (setq found (re-search-forward (cdr url) (cdr bounds) t)))
4034 (setq lst (cdr lst))))
4035 (goto-char (cdr bounds)))
4036 found))
4037
3916 4038
3917;; Make BibTeX a Feature 4039;; Make BibTeX a Feature
3918 4040
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el
new file mode 100644
index 00000000000..400f87205c4
--- /dev/null
+++ b/lisp/textmodes/dns-mode.el
@@ -0,0 +1,198 @@
1;;; dns-mode.el --- a mode for viewing/editing Domain Name System master files
2;; Copyright (c) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
3
4;; Author: Simon Josefsson <simon@josefsson.org>
5;; Keywords: DNS master zone file SOA
6
7;; This file is part of GNU Emacs.
8
9;; GNU Emacs is free software; you can redistribute it and/or modify
10;; it under the terms of the GNU General Public License as published by
11;; the Free Software Foundation; either version 2, or (at your option)
12;; any later version.
13
14;; GNU Emacs is distributed in the hope that it will be useful,
15;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;; GNU General Public License for more details.
18
19;; You should have received a copy of the GNU General Public License
20;; along with GNU Emacs; see the file COPYING. If not, write to the
21;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22;; Boston, MA 02111-1307, USA.
23
24;;; Commentary:
25
26;; Use M-x dns-mode RET to invoke in master files.
27;;
28;; C-c C-s Increment SOA serial.
29;; Understands YYYYMMDDNN, Unix time, and serial number formats,
30;; and complains if it fail to find SOA serial.
31;;
32;; Put something similar to the following in your ~/.emacs to use this file:
33;;
34;; (load "~/path/to/dns-mode.el")
35;; (setq auto-mode-alist (cons '("\\.soa\\'" . dns-mode) auto-mode-alist))
36
37;;; References:
38
39;; RFC 1034, "DOMAIN NAMES - CONCEPTS AND FACILITIES", P. Mockapetris.
40;; RFC 1035, "DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION", P. Mockapetris.
41
42;;; Release history:
43
44;; 2004-09-11 Posted on gnu.emacs.sources.
45;; 2004-09-13 Ported to XEmacs.
46;; 2004-09-14 Installed in Emacs CVS.
47
48;;; Code:
49
50(defgroup dns-mode nil
51 "DNS master file mode configuration.")
52
53(defconst dns-mode-classes '("IN" "CS" "CH" "HS")
54 "List of strings with known DNS classes.")
55
56(defconst dns-mode-types '("A" "NS" "MD" "MF" "CNAME" "SOA" "MB" "MG" "MR"
57 "NULL" "WKS" "PTR" "HINFO" "MINFO" "MX" "TXT"
58 "RP" "AFSDB" "X25" "ISDN" "RT" "NSAP" "NSAP"
59 "SIG" "KEY" "PX" "GPOS" "AAAA" "LOC" "NXT"
60 "EID" "NIMLOC" "SRV" "ATMA" "NAPTR" "KX" "CERT"
61 "A6" "DNAME" "SINK" "OPT" "APL" "DS" "SSHFP"
62 "RRSIG" "NSEC" "DNSKEY" "UINFO" "UID" "GID"
63 "UNSPEC" "TKEY" "TSIG" "IXFR" "AXFR" "MAILB"
64 "MAILA")
65 "List of strings with known DNS types.")
66
67;; Font lock.
68
69(defvar dns-mode-control-entity-face 'font-lock-keyword-face
70 "Name of face used for control entities, e.g. $ORIGIN.")
71
72(defvar dns-mode-bad-control-entity-face 'font-lock-warning-face
73 "Name of face used for non-standard control entities, e.g. $FOO.")
74
75(defvar dns-mode-type-face 'font-lock-type-face
76 "Name of face used for DNS types, e.g., SOA.")
77
78(defvar dns-mode-class-face 'font-lock-constant-face
79 "Name of face used for DNS classes, e.g., IN.")
80
81(defcustom dns-mode-font-lock-keywords
82 `(("^$ORIGIN" 0 ,dns-mode-control-entity-face)
83 ("^$INCLUDE" 0 ,dns-mode-control-entity-face)
84 ("^$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face)
85 (,(regexp-opt dns-mode-classes) 0 ,dns-mode-class-face)
86 (,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face))
87 "Font lock keywords used to highlight text in DNS master file mode."
88 :type 'sexp
89 :group 'dns-mode)
90
91;; Syntax table.
92
93(defvar dns-mode-syntax-table
94 (let ((table (make-syntax-table)))
95 (modify-syntax-entry ?\; "< " table)
96 (modify-syntax-entry ?\n "> " table)
97 table)
98 "Syntax table in use in DNS master file buffers.")
99
100;; Keymap.
101
102(defvar dns-mode-map
103 (let ((map (make-sparse-keymap)))
104 (define-key map "\C-c\C-s" 'dns-mode-soa-increment-serial)
105 map)
106 "Keymap for DNS master file mode.")
107
108;; Menu.
109
110(defvar dns-mode-menu nil
111 "Menubar used in DNS master file mode.")
112
113(easy-menu-define dns-mode-menu dns-mode-map
114 "DNS Menu."
115 '("DNS"
116 ["Increment SOA serial" dns-mode-soa-increment-serial t]))
117
118;; Mode.
119
120;;;###autoload
121(define-derived-mode dns-mode text-mode "DNS"
122 "Major mode for viewing and editing DNS master files.
123This mode is inherited from text mode. It add syntax
124highlighting, and some commands for handling DNS master files.
125Its keymap inherits from `text-mode' and it has the same
126variables for customizing indentation. It has its own abbrev
127table and its own syntax table.
128
129Turning on DNS mode runs `dns-mode-hook'."
130 (set (make-local-variable 'comment-start) ";")
131 (set (make-local-variable 'comment-end) "")
132 (set (make-local-variable 'comment-start-skip) ";+ *")
133 (unless (featurep 'xemacs)
134 (set (make-local-variable 'font-lock-defaults)
135 '(dns-mode-font-lock-keywords nil nil ((?_ . "w")))))
136 (easy-menu-add dns-mode-menu dns-mode-map))
137
138;; Tools.
139
140;;;###autoload
141(defun dns-mode-soa-increment-serial ()
142 "Locate SOA record and increment the serial field."
143 (interactive)
144 (save-excursion
145 (goto-char (point-min))
146 (unless (re-search-forward
147 (concat "^\\(\\(\\([^ \t]+[ \t]+\\)?[^ \t]+"
148 "[ \t]+\\)?[^ \t]+[ \t]+\\)?SOA") nil t)
149 (error "Cannot locate SOA record"))
150 (if (re-search-forward (concat "\\<\\("
151 ;; year
152 "\\(198\\|199\\|20[0-9]\\)[0-9]"
153 ;; month
154 "\\(0[0-9]\\|10\\|11\\|12\\)"
155 ;; day
156 "\\([012][0-9]\\|30\\|31\\)"
157 ;; counter
158 "\\([0-9]\\{1,3\\}\\)"
159 "\\)\\>")
160 nil t)
161 ;; YYYYMMDDIII format, one to three I's.
162 (let* ((serial (match-string 1))
163 (counterstr (match-string 5))
164 (counter (string-to-number counterstr))
165 (now (format-time-string "%Y%m%d"))
166 (nowandoldserial (concat now counterstr)))
167 (if (string< serial nowandoldserial)
168 (let ((new (format "%s00" now)))
169 (replace-match new nil nil nil 1)
170 (message "Replaced old serial %s with %s" serial new))
171 (if (string= serial nowandoldserial)
172 (let ((new (format (format "%%s%%0%dd" (length counterstr))
173 now (1+ counter))))
174 (replace-match new nil nil nil 1)
175 (message "Replaced old serial %s with %s" serial new))
176 (error "Current SOA serial is in the future"))))
177 (if (re-search-forward "\\<\\([0-9]\\{9,10\\}\\)\\>" nil t)
178 ;; Unix time
179 (let* ((serial (match-string 1))
180 (new (format-time-string "%s")))
181 (if (not (string< serial new))
182 (error "Current SOA serial is in the future")
183 (replace-match new nil nil nil 1)
184 (message "Replaced old serial %s with %s" serial new)))
185 (if (re-search-forward "\\<\\([0-9]+\\)\\>" nil t)
186 ;; Just any serial number.
187 (let* ((serial (match-string 1))
188 (new (format "%d" (1+ (string-to-number serial)))))
189 (replace-match new nil nil nil 1)
190 (message "Replaced old serial %s with %s" serial new))
191 (error "Cannot locate serial number in SOA record"))))))
192
193;;;###autoload(add-to-list 'auto-mode-alist '("\\.soa\\'" . dns-mode))
194
195(provide 'dns-mode)
196
197;; arch-tag: 6a179f0a-072f-49db-8b01-37b8f23998c0
198;;; dns-mode.el ends here
diff --git a/lisp/vc-arch.el b/lisp/vc-arch.el
index c4c484a9347..e32fc474d94 100644
--- a/lisp/vc-arch.el
+++ b/lisp/vc-arch.el
@@ -73,18 +73,10 @@
73(put 'Arch 'vc-functions nil) 73(put 'Arch 'vc-functions nil)
74 74
75;;;###autoload (defun vc-arch-registered (file) 75;;;###autoload (defun vc-arch-registered (file)
76;;;###autoload (let ((dir file)) 76;;;###autoload (if (vc-find-root file "{arch}/=tagging-method")
77;;;###autoload (while (and (stringp dir) 77;;;###autoload (progn
78;;;###autoload (not (equal 78;;;###autoload (load "vc-arch")
79;;;###autoload dir (setq dir (file-name-directory dir)))) 79;;;###autoload (vc-arch-registered file))))
80;;;###autoload dir)
81;;;###autoload (setq dir (if (file-directory-p
82;;;###autoload (expand-file-name "{arch}" dir))
83;;;###autoload t (directory-file-name dir))))
84;;;###autoload (if (eq dir t)
85;;;###autoload (progn
86;;;###autoload (load "vc-arch")
87;;;###autoload (vc-arch-registered file)))))
88 80
89(defun vc-arch-add-tagline () 81(defun vc-arch-add-tagline ()
90 "Add an `arch-tag' to the end of the current file." 82 "Add an `arch-tag' to the end of the current file."
@@ -186,18 +178,10 @@ Only the value `maybe' can be trusted :-(."
186(defun vc-arch-root (file) 178(defun vc-arch-root (file)
187 "Return the root directory of a Arch project, if any." 179 "Return the root directory of a Arch project, if any."
188 (or (vc-file-getprop file 'arch-root) 180 (or (vc-file-getprop file 'arch-root)
189 (vc-file-setprop 181 (vc-file-setprop
190 file 'arch-root 182 ;; Check the =tagging-method, in case someone naively manually
191 (let ((root nil)) 183 ;; creates a {arch} directory somewhere.
192 (while (not (or root 184 file 'arch-root (vc-find-root file "{arch}/=tagging-method"))))
193 (equal file (setq file (file-name-directory file)))
194 (null file)))
195 ;; Check the =tagging-method, in case someone naively manually
196 ;; creates a {arch} directory somewhere.
197 (if (file-exists-p (expand-file-name "{arch}/=tagging-method" file))
198 (setq root file)
199 (setq file (directory-file-name file))))
200 root))))
201 185
202(defun vc-arch-register (file &optional rev comment) 186(defun vc-arch-register (file &optional rev comment)
203 (if rev (error "Explicit initial revision not supported for Arch")) 187 (if rev (error "Explicit initial revision not supported for Arch"))
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 3f5a46c5bea..fef1431fe7d 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -1,6 +1,6 @@
1;;; vc-hooks.el --- resident support for version-control 1;;; vc-hooks.el --- resident support for version-control
2 2
3;; Copyright (C) 1992,93,94,95,96,98,99,2000,03,2004 3;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2003, 2004
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: FSF (see vc.el for full credits) 6;; Author: FSF (see vc.el for full credits)
@@ -52,6 +52,12 @@ BACKEND, use `vc-handled-backends'.")
52(defvar vc-header-alist ()) 52(defvar vc-header-alist ())
53(make-obsolete-variable 'vc-header-alist 'vc-BACKEND-header) 53(make-obsolete-variable 'vc-header-alist 'vc-BACKEND-header)
54 54
55(defvar vc-ignore-dir-regexp "\\`\\([\\/][\\/]\\|/net/\\|/afs/\\)\\'"
56 "Regexp matching directory names that are not under VC's control.
57The default regexp prevents fruitless and time-consuming attempts
58to determine the VC status in directories in which filenames are
59interpreted as hostnames.")
60
55(defcustom vc-handled-backends '(RCS CVS SVN SCCS Arch MCVS) 61(defcustom vc-handled-backends '(RCS CVS SVN SCCS Arch MCVS)
56 ;; Arch and MCVS come last because they are per-tree rather than per-dir. 62 ;; Arch and MCVS come last because they are per-tree rather than per-dir.
57 "*List of version control backends for which VC will be used. 63 "*List of version control backends for which VC will be used.
@@ -298,6 +304,20 @@ non-nil if FILE exists and its contents were successfully inserted."
298 (set-buffer-modified-p nil) 304 (set-buffer-modified-p nil)
299 t)) 305 t))
300 306
307(defun vc-find-root (file witness)
308 "Find the root of a checked out project.
309The function walks up the directory tree from FILE looking for WITNESS.
310If WITNESS if not found, return nil, otherwise return the root."
311 (let ((root nil))
312 (while (not (or root
313 (equal file (setq file (file-name-directory file)))
314 (null file)
315 (string-match vc-ignore-dir-regexp file)))
316 (if (file-exists-p (expand-file-name witness file))
317 (setq root file)
318 (setq file (directory-file-name file))))
319 root))
320
301;; Access functions to file properties 321;; Access functions to file properties
302;; (Properties should be _set_ using vc-file-setprop, but 322;; (Properties should be _set_ using vc-file-setprop, but
303;; _retrieved_ only through these functions, which decide 323;; _retrieved_ only through these functions, which decide
@@ -315,11 +335,13 @@ on the result of a previous call, use `vc-backend' instead. If the
315file was previously registered under a certain backend, then that 335file was previously registered under a certain backend, then that
316backend is tried first." 336backend is tried first."
317 (let (handler) 337 (let (handler)
318 (if (boundp 'file-name-handler-alist) 338 (cond
319 (setq handler (find-file-name-handler file 'vc-registered))) 339 ((string-match vc-ignore-dir-regexp (file-name-directory file)) nil)
320 (if handler 340 ((and (boundp 'file-name-handler-alist)
321 ;; handler should set vc-backend and return t if registered 341 (setq handler (find-file-name-handler file 'vc-registered)))
322 (funcall handler 'vc-registered file) 342 ;; handler should set vc-backend and return t if registered
343 (funcall handler 'vc-registered file))
344 (t
323 ;; There is no file name handler. 345 ;; There is no file name handler.
324 ;; Try vc-BACKEND-registered for each handled BACKEND. 346 ;; Try vc-BACKEND-registered for each handled BACKEND.
325 (catch 'found 347 (catch 'found
@@ -334,7 +356,7 @@ backend is tried first."
334 (cons backend vc-handled-backends)))) 356 (cons backend vc-handled-backends))))
335 ;; File is not registered. 357 ;; File is not registered.
336 (vc-file-setprop file 'vc-backend 'none) 358 (vc-file-setprop file 'vc-backend 'none)
337 nil)))) 359 nil)))))
338 360
339(defun vc-backend (file) 361(defun vc-backend (file)
340 "Return the version control type of FILE, nil if it is not registered." 362 "Return the version control type of FILE, nil if it is not registered."
@@ -869,5 +891,5 @@ Used in `find-file-not-found-functions'."
869 891
870(provide 'vc-hooks) 892(provide 'vc-hooks)
871 893
872;;; arch-tag: 2e5a6fa7-1d30-48e2-8bd0-e3d335f04f32 894;; arch-tag: 2e5a6fa7-1d30-48e2-8bd0-e3d335f04f32
873;;; vc-hooks.el ends here 895;;; vc-hooks.el ends here
diff --git a/lisp/vc-mcvs.el b/lisp/vc-mcvs.el
index 5c0bac48b3a..d2ac776170f 100644
--- a/lisp/vc-mcvs.el
+++ b/lisp/vc-mcvs.el
@@ -1,6 +1,7 @@
1;;; vc-mcvs.el --- VC backend for the Meta-CVS version-control system 1;;; vc-mcvs.el --- VC backend for the Meta-CVS version-control system
2 2
3;; Copyright (C) 1995,98,99,2000,01,02,03,2004 Free Software Foundation, Inc. 3;; Copyright (C) 1995, 1998, 1999, 2000, 2001, 2002, 2003, 2004
4;; Free Software Foundation, Inc.
4 5
5;; Author: FSF (see vc.el for full credits) 6;; Author: FSF (see vc.el for full credits)
6;; Maintainer: Stefan Monnier <monnier@gnu.org> 7;; Maintainer: Stefan Monnier <monnier@gnu.org>
@@ -114,32 +115,15 @@ This is only meaningful if you don't use the implicit checkout model
114;;; 115;;;
115 116
116;;;###autoload (defun vc-mcvs-registered (file) 117;;;###autoload (defun vc-mcvs-registered (file)
117;;;###autoload (let ((dir file)) 118;;;###autoload (if (vc-find-root file "MCVS/CVS")
118;;;###autoload (while (and (stringp dir) 119;;;###autoload (progn
119;;;###autoload (not (equal 120;;;###autoload (load "vc-mcvs")
120;;;###autoload dir (setq dir (file-name-directory dir)))) 121;;;###autoload (vc-mcvs-registered file))))
121;;;###autoload dir)
122;;;###autoload (setq dir (if (file-directory-p
123;;;###autoload (expand-file-name "MCVS/CVS" dir))
124;;;###autoload t (directory-file-name dir))))
125;;;###autoload (if (eq dir t)
126;;;###autoload (progn
127;;;###autoload (load "vc-mcvs")
128;;;###autoload (vc-mcvs-registered file)))))
129 122
130(defun vc-mcvs-root (file) 123(defun vc-mcvs-root (file)
131 "Return the root directory of a Meta-CVS project, if any." 124 "Return the root directory of a Meta-CVS project, if any."
132 (or (vc-file-getprop file 'mcvs-root) 125 (or (vc-file-getprop file 'mcvs-root)
133 (vc-file-setprop 126 (vc-file-setprop file 'mcvs-root (vc-find-root file "MCVS/CVS"))))
134 file 'mcvs-root
135 (let ((root nil))
136 (while (not (or root
137 (equal file (setq file (file-name-directory file)))
138 (null file)))
139 (if (file-directory-p (expand-file-name "MCVS/CVS" file))
140 (setq root file)
141 (setq file (directory-file-name file))))
142 root))))
143 127
144(defun vc-mcvs-read (file) 128(defun vc-mcvs-read (file)
145 (if (file-readable-p file) 129 (if (file-readable-p file)
@@ -608,5 +592,5 @@ and that it passes `vc-mcvs-global-switches' to it before FLAGS."
608 592
609(provide 'vc-mcvs) 593(provide 'vc-mcvs)
610 594
611;;; arch-tag: a39c7c1c-5247-429d-88df-dd7187d2e704 595;; arch-tag: a39c7c1c-5247-429d-88df-dd7187d2e704
612;;; vc-mcvs.el ends here 596;;; vc-mcvs.el ends here
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 642f04a1d8d..986280c0bb1 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -324,11 +324,11 @@ from `windmove-frame-edges' will be the list (0 0 180 75)."
324 (let* ((frame (if window 324 (let* ((frame (if window
325 (window-frame window) 325 (window-frame window)
326 (selected-frame))) 326 (selected-frame)))
327 (top-left (window-inside-edges (frame-first-window frame))) 327 (top-left (window-edges (frame-first-window frame)))
328 (x-min (nth 0 top-left)) 328 (x-min (nth 0 top-left))
329 (y-min (nth 1 top-left)) 329 (y-min (nth 1 top-left))
330 (x-max (+ x-min (frame-width frame) -1)) ; 1- for last row & col 330 (x-max (1- (frame-width frame))) ; 1- for last row & col
331 (y-max (+ x-max (frame-height frame) -1))) 331 (y-max (1- (frame-height frame))))
332 (list x-min y-min x-max y-max))) 332 (list x-min y-min x-max y-max)))
333 333
334;; it turns out that constraining is always a good thing, even when 334;; it turns out that constraining is always a good thing, even when
@@ -406,7 +406,7 @@ Returns the wrapped coordinate."
406 406
407 407
408;; `windmove-coordinates-of-position' is stolen and modified from the 408;; `windmove-coordinates-of-position' is stolen and modified from the
409;; Emacs Lisp Reference Manual, section 27.2.5. It seems to work 409;; Emacs 20 Lisp Reference Manual, section 27.2.5. It seems to work
410;; okay, although I am bothered by the fact that tab-offset (the cdr 410;; okay, although I am bothered by the fact that tab-offset (the cdr
411;; of the next-to- last argument) is set to 0. On the other hand, I 411;; of the next-to- last argument) is set to 0. On the other hand, I
412;; can't find a single usage of `compute-motion' anywhere that doesn't 412;; can't find a single usage of `compute-motion' anywhere that doesn't
@@ -418,28 +418,43 @@ Returns the wrapped coordinate."
418;; the number that `window-width' gives, or continuation lines aren't 418;; the number that `window-width' gives, or continuation lines aren't
419;; counted correctly. I haven't seen anyone doing this before, 419;; counted correctly. I haven't seen anyone doing this before,
420;; though. 420;; though.
421(defun windmove-coordinates-of-position (pos &optional window) 421;;
422 "Return the coordinates of position POS in window WINDOW. 422;; Now updated for Emacs 21, based on the Emacs 21 Lisp Reference
423;; Manual, section 30.2.5. It is no longer necessary to subtract
424;; 1 for the usable width of the window.
425;; TODO: also handle minibuffer case, w/ `minibuffer-prompt-width'.
426(defun windmove-coordinates-of-position (pos)
427 "Return the coordinates of position POS in the current window.
423Return the window-based coodinates in a cons pair: (HPOS . VPOS), 428Return the window-based coodinates in a cons pair: (HPOS . VPOS),
424where HPOS and VPOS are the zero-based x and y components of the 429where HPOS and VPOS are the zero-based x and y components of the
425screen location of POS. If WINDOW is nil, return the coordinates in 430screen location of POS.
426the currently selected window.
427As an example, if point is in the top left corner of a window, then 431As an example, if point is in the top left corner of a window, then
428the return value from `windmove-coordinates-of-position' is (0 . 0) 432the return value from `windmove-coordinates-of-position' is (0 . 0)
429regardless of the where point is in the buffer and where the window 433regardless of the where point is in the buffer and where the window
430is placed in the frame." 434is placed in the frame."
431 (let* ((wind (if (null window) (selected-window) window)) 435 (let ((big-hairy-result (compute-motion
432 (big-hairy-result (compute-motion 436 (window-start)
433 (window-start) 437 '(0 . 0)
434 '(0 . 0) 438 pos
435 pos 439 nil ; (window-width window-height)
436 nil ; (window-width window-height) 440 nil ; window-width
437 nil ; window-width 441 (cons (window-hscroll)
438 (cons (window-hscroll) 442 0) ; why zero?
439 0) ; why zero? 443 (selected-window))))
440 wind))) 444 (cons (nth 1 big-hairy-result) ; hpos, not vpos as documented
441 (cons (nth 1 big-hairy-result) ; hpos, not vpos as documented 445 (nth 2 big-hairy-result)))) ; vpos, not hpos as documented
442 (nth 2 big-hairy-result)))) ; vpos, not hpos as documented 446
447(defun windmove-coordinates-of-window-position (pos &optional window)
448 "Return the coordinates of position POS in WINDOW.
449Return the window-based coodinates in a cons pair: (HPOS . VPOS),
450where HPOS and VPOS are the zero-based x and y components of the
451screen location of POS. If WINDOW is nil, return the coordinates in
452the currently selected window."
453 (if (null window)
454 (windmove-coordinates-of-position pos)
455 (save-selected-window
456 (select-window window)
457 (windmove-coordinates-of-position pos))))
443 458
444;; This calculates the reference location in the current window: the 459;; This calculates the reference location in the current window: the
445;; frame-based (x . y) of either point, the top-left, or the 460;; frame-based (x . y) of either point, the top-left, or the
@@ -467,8 +482,9 @@ supplied, if ARG is greater or smaller than zero, respectively."
467 ((= effective-arg 0) 482 ((= effective-arg 0)
468 (windmove-coord-add 483 (windmove-coord-add
469 top-left 484 top-left
470 (windmove-coordinates-of-position (window-point window) 485 (windmove-coordinates-of-window-position
471 window))))))) 486 (window-point window)
487 window)))))))
472 488
473;; This uses the reference location in the current window (calculated 489;; This uses the reference location in the current window (calculated
474;; by `windmove-reference-loc' above) to find a reference location 490;; by `windmove-reference-loc' above) to find a reference location
@@ -491,13 +507,13 @@ movement is relative to."
491 (- (nth 1 edges) 507 (- (nth 1 edges)
492 windmove-window-distance-delta))) ; (x, y0-d) 508 windmove-window-distance-delta))) ; (x, y0-d)
493 ((eq dir 'right) 509 ((eq dir 'right)
494 (cons (+ (nth 2 edges) 510 (cons (+ (1- (nth 2 edges)) ; -1 to get actual max x
495 windmove-window-distance-delta) 511 windmove-window-distance-delta)
496 (cdr refpoint))) ; (x1+d, y) 512 (cdr refpoint))) ; (x1+d-1, y)
497 ((eq dir 'down) 513 ((eq dir 'down) ; -1 to get actual max y
498 (cons (car refpoint) 514 (cons (car refpoint)
499 (+ (nth 3 edges) 515 (+ (1- (nth 3 edges))
500 windmove-window-distance-delta))) ; (x, y1+d) 516 windmove-window-distance-delta))) ; (x, y1+d-1)
501 (t (error "Invalid direction of movement: %s" dir))))) 517 (t (error "Invalid direction of movement: %s" dir)))))
502 518
503(defun windmove-find-other-window (dir &optional arg window) 519(defun windmove-find-other-window (dir &optional arg window)
diff --git a/man/ChangeLog b/man/ChangeLog
index 09d273e1d33..75e8d3d7c76 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,46 @@
12004-09-13 Kim F. Storm <storm@cua.dk>
2
3 * mini.texi (Repetition): Rename isearch-resume-enabled to
4 isearch-resume-in-command-history and change default to disabled.
5
62004-09-10 Simon Josefsson <jas@extundo.com>
7
8 * gnus.texi (IMAP): Add example. Suggested and partially written
9 by Steinar Bang <sb@dod.no>.
10
112004-09-10 Teodor Zlatanov <tzz@lifelogs.com>
12
13 * gnus.texi (IMAP): add comments about imaps synonym to imap in
14 netrc syntax
15
162004-09-10 Teodor Zlatanov <tzz@lifelogs.com>
17
18 * gnus.texi (Spam ELisp Package Sequence of Events): some clarifications
19 (Spam ELisp Package Global Variables)
20 (Spam ELisp Package Global Variables): more clarifications
21
222004-09-10 Teodor Zlatanov <tzz@lifelogs.com>
23
24 * gnus.texi (Spam ELisp Package Filtering of Incoming Mail):
25 mention spam-split does not modify incoming mail
26
272004-09-10 Teodor Zlatanov <tzz@lifelogs.com>
28
29 * gnus.texi (Spam ELisp Package Sequence of Events): fix typo
30
312004-09-10 Eli Zaretskii <eliz@gnu.org>
32
33 * Makefile.in (../info/gnus, gnus.dvi): Depend on gnus-faq.texi
34
352004-09-09 Kim F. Storm <storm@cua.dk>
36
37 * kmacro.texi (Save Keyboard Macro): Replace `name-last-kbd-macro'
38 with new `kmacro-name-last-macro'.
39
402004-09-09 Reiner Steib <Reiner.Steib@gmx.de>
41
42 * makefile.w32-in (sieve, pgg): Use $(infodir).
43
12004-09-08 Juri Linkov <juri@jurta.org> 442004-09-08 Juri Linkov <juri@jurta.org>
2 45
3 * mini.texi (Minibuffer History): Add `history-delete-duplicates'. 46 * mini.texi (Minibuffer History): Add `history-delete-duplicates'.
diff --git a/man/Makefile.in b/man/Makefile.in
index 47530d467e3..20cbf76a484 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -188,25 +188,29 @@ forms.dvi: forms.texi
188 $(ENVADD) $(TEXI2DVI) ${srcdir}/forms.texi 188 $(ENVADD) $(TEXI2DVI) ${srcdir}/forms.texi
189 189
190# gnus/message/emacs-mime/sieve/pgg are part of Gnus: 190# gnus/message/emacs-mime/sieve/pgg are part of Gnus:
191../info/gnus: gnus.texi 191../info/gnus: gnus.texi gnus-faq.texi
192 cd $(srcdir); $(MAKEINFO) gnus.texi 192 cd $(srcdir); $(MAKEINFO) gnus.texi
193gnus.dvi: gnus.texi 193gnus.dvi: gnus.texi gnus-faq.texi
194 sed -e '/@iflatex/,/@end iflatex/d' ${srcdir}/gnus.texi > gnustmp.texi 194 sed -e '/@iflatex/,/@end iflatex/d' ${srcdir}/gnus.texi > gnustmp.texi
195 $(ENVADD) $(TEXI2DVI) gnustmp.texi 195 $(ENVADD) $(TEXI2DVI) gnustmp.texi
196 cp gnustmp.dvi $*.dvi 196 cp gnustmp.dvi $*.dvi
197 rm gnustmp.* 197 rm gnustmp.*
198
198../info/message: message.texi 199../info/message: message.texi
199 cd $(srcdir); $(MAKEINFO) message.texi 200 cd $(srcdir); $(MAKEINFO) message.texi
200message.dvi: message.texi 201message.dvi: message.texi
201 $(ENVADD) $(TEXI2DVI) ${srcdir}/message.texi 202 $(ENVADD) $(TEXI2DVI) ${srcdir}/message.texi
203
202../info/sieve: sieve.texi 204../info/sieve: sieve.texi
203 cd $(srcdir); $(MAKEINFO) sieve.texi 205 cd $(srcdir); $(MAKEINFO) sieve.texi
204sieve.dvi: sieve.texi 206sieve.dvi: sieve.texi
205 $(ENVADD) $(TEXI2DVI) ${srcdir}/sieve.texi 207 $(ENVADD) $(TEXI2DVI) ${srcdir}/sieve.texi
208
206../info/emacs-mime: emacs-mime.texi 209../info/emacs-mime: emacs-mime.texi
207 cd $(srcdir); $(MAKEINFO) emacs-mime.texi 210 cd $(srcdir); $(MAKEINFO) emacs-mime.texi
208emacs-mime.dvi: emacs-mime.texi 211emacs-mime.dvi: emacs-mime.texi
209 $(ENVADD) $(TEXI2DVI) ${srcdir}/emacs-mime.texi 212 $(ENVADD) $(TEXI2DVI) ${srcdir}/emacs-mime.texi
213
210../info/pgg: pgg.texi 214../info/pgg: pgg.texi
211 cd $(srcdir); $(MAKEINFO) pgg.texi 215 cd $(srcdir); $(MAKEINFO) pgg.texi
212pgg.dvi: pgg.texi 216pgg.dvi: pgg.texi
diff --git a/man/gnus.texi b/man/gnus.texi
index 763fe0c98a9..b435a34b462 100644
--- a/man/gnus.texi
+++ b/man/gnus.texi
@@ -14011,8 +14011,8 @@ is run. That's why @code{(widen)} needs to be called after
14011@code{save-excursion} and @code{save-restriction} in the example 14011@code{save-excursion} and @code{save-restriction} in the example
14012above. Also note that with the nnimap backend, message bodies will 14012above. Also note that with the nnimap backend, message bodies will
14013not be downloaded by default. You need to set 14013not be downloaded by default. You need to set
14014@code{nnimap-split-download-body} to t to do that (@pxref{Splitting in 14014@code{nnimap-split-download-body} to @code{t} to do that
14015IMAP}). 14015(@pxref{Splitting in IMAP}).
14016 14016
14017@item (! @var{func} @var{split}) 14017@item (! @var{func} @var{split})
14018If the split is a list, and the first element is @code{!}, then 14018If the split is a list, and the first element is @code{!}, then
@@ -16209,7 +16209,17 @@ RFC 2060 for more information on valid strings.
16209A file containing credentials used to log in on servers. The format is 16209A file containing credentials used to log in on servers. The format is
16210(almost) the same as the @code{ftp} @file{~/.netrc} file. See the 16210(almost) the same as the @code{ftp} @file{~/.netrc} file. See the
16211variable @code{nntp-authinfo-file} for exact syntax; also see 16211variable @code{nntp-authinfo-file} for exact syntax; also see
16212@ref{NNTP}. 16212@ref{NNTP}. An example of an .authinfo line for an IMAP server, is:
16213
16214@example
16215machine students.uio.no login larsi password geheimnis port imap
16216@end example
16217
16218Note that it should be @code{port imap}, or @code{port 143}, if you
16219use a @code{nnimap-stream} of @code{tls} or @code{ssl}, even if the
16220actual port number used is port 993 for secured IMAP. For
16221convenience, Gnus will accept @code{port imaps} as a synonym of
16222@code{port imap}.
16213 16223
16214@item nnimap-need-unselect-to-notice-new-mail 16224@item nnimap-need-unselect-to-notice-new-mail
16215@vindex nnimap-need-unselect-to-notice-new-mail 16225@vindex nnimap-need-unselect-to-notice-new-mail
@@ -22249,16 +22259,18 @@ server or when you sort through incoming mail. If you get 200 spam
22249messages per day from @samp{random-address@@vmadmin.com}, you block 22259messages per day from @samp{random-address@@vmadmin.com}, you block
22250@samp{vmadmin.com}. If you get 200 messages about @samp{VIAGRA}, you 22260@samp{vmadmin.com}. If you get 200 messages about @samp{VIAGRA}, you
22251discard all messages with @samp{VIAGRA} in the message. If you get 22261discard all messages with @samp{VIAGRA} in the message. If you get
22252lots of spam from China, for example, you try to filter all mail from 22262lots of spam from Bulgaria, for example, you try to filter all mail
22253Chinese IPs. 22263from Bulgarian IPs.
22264
22265This, unfortunately, is a great way to discard legitimate e-mail. The
22266risks of blocking a whole country (Bulgaria, Norway, Nigeria, China,
22267etc.) or even a continent (Asia, Africa, Europe, etc.) from contacting
22268you should be obvious, so don't do it if you have the choice.
22254 22269
22255This, unfortunately, is a great way to discard legitimate e-mail. For 22270In another instance, the very informative and useful RISKS digest has
22256instance, the very informative and useful RISKS digest has been 22271been blocked by overzealous mail filters because it @strong{contained}
22257blocked by overzealous mail filters because it @strong{contained} 22272words that were common in spam messages. Nevertheless, in isolated
22258words that were common in spam messages. The risks of blocking a 22273cases, with great care, direct filtering of mail can be useful.
22259whole country from contacting you should also be obvious, so don't do
22260it if you have the choice. Nevertheless, in isolated cases, with
22261great care, direct filtering of mail can be useful.
22262 22274
22263Another approach to filtering e-mail is the distributed spam 22275Another approach to filtering e-mail is the distributed spam
22264processing, for instance DCC implements such a system. In essence, 22276processing, for instance DCC implements such a system. In essence,
@@ -22435,8 +22447,8 @@ call the external tools during splitting. Example fancy split method:
22435 22447
22436Note that with the nnimap backend, message bodies will not be 22448Note that with the nnimap backend, message bodies will not be
22437downloaded by default. You need to set 22449downloaded by default. You need to set
22438@code{nnimap-split-download-body} to t to do that (@pxref{Splitting in 22450@code{nnimap-split-download-body} to @code{t} to do that
22439IMAP}). 22451(@pxref{Splitting in IMAP}).
22440 22452
22441That is about it. As some spam is likely to get through anyway, you 22453That is about it. As some spam is likely to get through anyway, you
22442might want to have a nifty function to call when you happen to read 22454might want to have a nifty function to call when you happen to read
@@ -22672,8 +22684,8 @@ any are set, and the processed mail is moved to the
22672@code{ham-process-destination} or the @code{spam-process-destination} 22684@code{ham-process-destination} or the @code{spam-process-destination}
22673depending on the article's classification. If the 22685depending on the article's classification. If the
22674@code{ham-process-destination} or the @code{spam-process-destination}, 22686@code{ham-process-destination} or the @code{spam-process-destination},
22675whichever is appropriate, are nil, the article is left in the current 22687whichever is appropriate, are @code{nil}, the article is left in the
22676group. 22688current group.
22677 22689
22678If a spam is found in any group (this can be changed to only non-spam 22690If a spam is found in any group (this can be changed to only non-spam
22679groups with @code{spam-move-spam-nonspam-groups-only}), it is 22691groups with @code{spam-move-spam-nonspam-groups-only}), it is
@@ -22685,11 +22697,11 @@ You have to load the @code{gnus-registry.el} package and enable the
22685@code{spam-log-to-registry} variable if you want spam to be processed 22697@code{spam-log-to-registry} variable if you want spam to be processed
22686no more than once. Thus, spam is detected and processed everywhere, 22698no more than once. Thus, spam is detected and processed everywhere,
22687which is what most people want. If the 22699which is what most people want. If the
22688@code{spam-process-destination} is nil, the spam is marked as 22700@code{spam-process-destination} is @code{nil}, the spam is marked as
22689expired, which is usually the right thing to do. 22701expired, which is usually the right thing to do.
22690 22702
22691If spam can not be moved - because of a read-only backend such as NNTP, 22703If spam can not be moved---because of a read-only backend such as
22692for example, it will be copied. 22704@acronym{NNTP}, for example, it will be copied.
22693 22705
22694If a ham mail is found in a ham group, as determined by the 22706If a ham mail is found in a ham group, as determined by the
22695@code{ham-marks} parameter, it is processed as ham by the active ham 22707@code{ham-marks} parameter, it is processed as ham by the active ham
@@ -22703,11 +22715,11 @@ no more than once. Thus, ham is detected and processed only when
22703necessary, which is what most people want. More on this in 22715necessary, which is what most people want. More on this in
22704@xref{Spam ELisp Package Configuration Examples}. 22716@xref{Spam ELisp Package Configuration Examples}.
22705 22717
22706If ham can not be moved - because of a read-only backend such as NNTP, 22718If ham can not be moved---because of a read-only backend such as
22707for example, it will be copied. 22719@acronym{NNTP}, for example, it will be copied.
22708 22720
22709If all this seems confusing, don't worry. Soon it will be as natural 22721If all this seems confusing, don't worry. Soon it will be as natural
22710as typing Lisp one-liners on a neural interface... err, sorry, that's 22722as typing Lisp one-liners on a neural interface@dots{} err, sorry, that's
2271150 years in the future yet. Just trust us, it's not so bad. 2272350 years in the future yet. Just trust us, it's not so bad.
22712 22724
22713@node Spam ELisp Package Filtering of Incoming Mail 22725@node Spam ELisp Package Filtering of Incoming Mail
@@ -22728,6 +22740,8 @@ Note that the fancy split may be called @code{nnmail-split-fancy} or
22728@code{nnimap-split-fancy}, depending on whether you use the nnmail or 22740@code{nnimap-split-fancy}, depending on whether you use the nnmail or
22729nnimap back ends to retrieve your mail. 22741nnimap back ends to retrieve your mail.
22730 22742
22743Also, @code{spam-split} will not modify incoming mail in any way.
22744
22731The @code{spam-split} function will process incoming mail and send the 22745The @code{spam-split} function will process incoming mail and send the
22732mail considered to be spam into the group name given by the variable 22746mail considered to be spam into the group name given by the variable
22733@code{spam-split-group}. By default that group name is @samp{spam}, 22747@code{spam-split-group}. By default that group name is @samp{spam},
@@ -22741,7 +22755,7 @@ actually give you the group
22741work depending on your server's tolerance for strange group names. 22755work depending on your server's tolerance for strange group names.
22742 22756
22743You can also give @code{spam-split} a parameter, 22757You can also give @code{spam-split} a parameter,
22744e.g. @samp{'spam-use-regex-headers} or @samp{"maybe-spam"}. Why is 22758e.g. @code{spam-use-regex-headers} or @code{"maybe-spam"}. Why is
22745this useful? 22759this useful?
22746 22760
22747Take these split rules (with @code{spam-use-regex-headers} and 22761Take these split rules (with @code{spam-use-regex-headers} and
@@ -22751,7 +22765,7 @@ Take these split rules (with @code{spam-use-regex-headers} and
22751 nnimap-split-fancy '(| 22765 nnimap-split-fancy '(|
22752 (any "ding" "ding") 22766 (any "ding" "ding")
22753 (: spam-split) 22767 (: spam-split)
22754 ;; default mailbox 22768 ;; @r{default mailbox}
22755 "mail") 22769 "mail")
22756@end example 22770@end example
22757 22771
@@ -22767,14 +22781,15 @@ You can let SpamAssassin headers supersede ding rules, but all other
22767regex-headers check) will be after the ding rule: 22781regex-headers check) will be after the ding rule:
22768 22782
22769@example 22783@example
22770 nnimap-split-fancy '(| 22784nnimap-split-fancy
22771;;; all spam detected by spam-use-regex-headers goes to "regex-spam" 22785 '(|
22772 (: spam-split "regex-spam" 'spam-use-regex-headers) 22786 ;; @r{all spam detected by @code{spam-use-regex-headers} goes to @samp{regex-spam}}
22773 (any "ding" "ding") 22787 (: spam-split "regex-spam" 'spam-use-regex-headers)
22774;;; all other spam detected by spam-split goes to spam-split-group 22788 (any "ding" "ding")
22775 (: spam-split) 22789 ;; @r{all other spam detected by spam-split goes to @code{spam-split-group}}
22776 ;; default mailbox 22790 (: spam-split)
22777 "mail") 22791 ;; @r{default mailbox}
22792 "mail")
22778@end example 22793@end example
22779 22794
22780This lets you invoke specific @code{spam-split} checks depending on 22795This lets you invoke specific @code{spam-split} checks depending on
@@ -22827,7 +22842,7 @@ processors take mail known to be spam and process it so similar spam
22827will be detected later. 22842will be detected later.
22828 22843
22829The format of the spam or ham processor entry used to be a symbol, 22844The format of the spam or ham processor entry used to be a symbol,
22830but now it is a cons cell. See the individual spam processor entries 22845but now it is a @sc{cons} cell. See the individual spam processor entries
22831for more information. 22846for more information.
22832 22847
22833@vindex gnus-spam-newsgroup-contents 22848@vindex gnus-spam-newsgroup-contents
@@ -22905,18 +22920,16 @@ not done for @emph{unclassified} or @emph{ham} groups. Also, any
22905determined by either the @code{ham-process-destination} group 22920determined by either the @code{ham-process-destination} group
22906parameter or a match in the @code{gnus-ham-process-destinations} 22921parameter or a match in the @code{gnus-ham-process-destinations}
22907variable, which is a list of regular expressions matched with group 22922variable, which is a list of regular expressions matched with group
22908names (it's easiest to customize this variable with 22923names (it's easiest to customize this variable with @kbd{M-x
22909@code{customize-variable gnus-ham-process-destinations}). Each 22924customize-variable @key{RET} gnus-ham-process-destinations}). Each
22910newsgroup specification has the format (REGEXP PROCESSOR) in a 22925group name list is a standard Lisp list, if you prefer to customize
22911standard Lisp list, if you prefer to customize the variable manually. 22926the variable manually. If the @code{ham-process-destination}
22912The ultimate location is a group name or names. If the 22927parameter is not set, ham articles are left in place. If the
22913@code{ham-process-destination} parameter is not set, ham articles are
22914left in place. If the
22915@code{spam-mark-ham-unread-before-move-from-spam-group} parameter is 22928@code{spam-mark-ham-unread-before-move-from-spam-group} parameter is
22916set, the ham articles are marked as unread before being moved. 22929set, the ham articles are marked as unread before being moved.
22917 22930
22918If ham can not be moved - because of a read-only backend such as NNTP, 22931If ham can not be moved---because of a read-only backend such as
22919for example, it will be copied. 22932@acronym{NNTP}, for example, it will be copied.
22920 22933
22921Note that you can use multiples destinations per group or regular 22934Note that you can use multiples destinations per group or regular
22922expression! This enables you to send your ham to a regular mail 22935expression! This enables you to send your ham to a regular mail
@@ -22944,18 +22957,16 @@ When you leave a @emph{ham} or @emph{unclassified} group, all
22944the @code{spam-process-destination} group parameter or a match in the 22957the @code{spam-process-destination} group parameter or a match in the
22945@code{gnus-spam-process-destinations} variable, which is a list of 22958@code{gnus-spam-process-destinations} variable, which is a list of
22946regular expressions matched with group names (it's easiest to 22959regular expressions matched with group names (it's easiest to
22947customize this variable with @code{customize-variable 22960customize this variable with @kbd{M-x customize-variable @key{RET}
22948gnus-spam-process-destinations}). Each newsgroup specification has 22961gnus-spam-process-destinations}). Each group name list is a standard
22949the repeated format (REGEXP GROUP) and they are all in a standard Lisp 22962Lisp list, if you prefer to customize the variable manually. If the
22950list, if you prefer to customize the variable manually. The ultimate
22951location is a group name or names. If the
22952@code{spam-process-destination} parameter is not set, the spam 22963@code{spam-process-destination} parameter is not set, the spam
22953articles are only expired. The group name is fully qualified, meaning 22964articles are only expired. The group name is fully qualified, meaning
22954that if you see @samp{nntp:servername} before the group name in the 22965that if you see @samp{nntp:servername} before the group name in the
22955group buffer then you need it here as well. 22966group buffer then you need it here as well.
22956 22967
22957If spam can not be moved - because of a read-only backend such as NNTP, 22968If spam can not be moved---because of a read-only backend such as
22958for example, it will be copied. 22969@acronym{NNTP}, for example, it will be copied.
22959 22970
22960Note that you can use multiples destinations per group or regular 22971Note that you can use multiples destinations per group or regular
22961expression! This enables you to send your spam to multiple @emph{spam 22972expression! This enables you to send your spam to multiple @emph{spam
@@ -22971,15 +22982,15 @@ entries, this won't work as well as it does without a limit.
22971 22982
22972@vindex spam-mark-only-unseen-as-spam 22983@vindex spam-mark-only-unseen-as-spam
22973Set this variable if you want only unseen articles in spam groups to 22984Set this variable if you want only unseen articles in spam groups to
22974be marked as spam. By default, it is set. If you set it to nil, 22985be marked as spam. By default, it is set. If you set it to
22975unread articles will also be marked as spam. 22986@code{nil}, unread articles will also be marked as spam.
22976 22987
22977@vindex spam-mark-ham-unread-before-move-from-spam-group 22988@vindex spam-mark-ham-unread-before-move-from-spam-group
22978Set this variable if you want ham to be unmarked before it is moved 22989Set this variable if you want ham to be unmarked before it is moved
22979out of the spam group. This is very useful when you use something 22990out of the spam group. This is very useful when you use something
22980like the tick mark @samp{!} to mark ham - the article will be placed 22991like the tick mark @samp{!} to mark ham---the article will be placed
22981in your ham-process-destination, unmarked as if it came fresh from 22992in your @code{ham-process-destination}, unmarked as if it came fresh
22982the mail server. 22993from the mail server.
22983 22994
22984@vindex spam-autodetect-recheck-messages 22995@vindex spam-autodetect-recheck-messages
22985When autodetecting spam, this variable tells @code{spam.el} whether 22996When autodetecting spam, this variable tells @code{spam.el} whether
@@ -22997,87 +23008,86 @@ spam. It is recommended that you leave it off.
22997 23008
22998From Ted Zlatanov <tzz@@lifelogs.com>. 23009From Ted Zlatanov <tzz@@lifelogs.com>.
22999@example 23010@example
23000 23011;; @r{for @code{gnus-registry-split-fancy-with-parent} and spam autodetection}
23001;; for gnus-registry-split-fancy-with-parent and spam autodetection 23012;; @r{see @file{gnus-registry.el} for more information}
23002;; see gnus-registry.el for more information
23003(gnus-registry-initialize) 23013(gnus-registry-initialize)
23004(spam-initialize) 23014(spam-initialize)
23005 23015
23006;; I like control-S for marking spam 23016;; @r{I like @kbd{C-s} for marking spam}
23007(define-key gnus-summary-mode-map "\C-s" 'gnus-summary-mark-as-spam) 23017(define-key gnus-summary-mode-map "\C-s" 'gnus-summary-mark-as-spam)
23008 23018
23009(setq 23019(setq
23010 spam-log-to-registry t ;; for spam autodetection 23020 spam-log-to-registry t ; @r{for spam autodetection}
23011 spam-use-BBDB t 23021 spam-use-BBDB t
23012 spam-use-regex-headers t ; catch X-Spam-Flag (SpamAssassin) 23022 spam-use-regex-headers t ; @r{catch X-Spam-Flag (SpamAssassin)}
23013 ;; all groups with "spam" in the name contain spam 23023 ;; @r{all groups with @samp{spam} in the name contain spam}
23014 gnus-spam-newsgroup-contents '(("spam" gnus-group-spam-classification-spam)) 23024 gnus-spam-newsgroup-contents
23015 ;; see documentation for these 23025 '(("spam" gnus-group-spam-classification-spam))
23026 ;; @r{see documentation for these}
23016 spam-move-spam-nonspam-groups-only nil 23027 spam-move-spam-nonspam-groups-only nil
23017 spam-mark-only-unseen-as-spam t 23028 spam-mark-only-unseen-as-spam t
23018 spam-mark-ham-unread-before-move-from-spam-group t 23029 spam-mark-ham-unread-before-move-from-spam-group t
23019 nnimap-split-rule 'nnimap-split-fancy 23030 nnimap-split-rule 'nnimap-split-fancy
23020 ;; understand what this does before you copy it to your own setup! 23031 ;; @r{understand what this does before you copy it to your own setup!}
23021 nnimap-split-fancy '(| 23032 nnimap-split-fancy '(|
23022 ;; trace references to parents and put in their group 23033 ;; @r{trace references to parents and put in their group}
23023 (: gnus-registry-split-fancy-with-parent) 23034 (: gnus-registry-split-fancy-with-parent)
23024 ;; this will catch server-side SpamAssassin tags 23035 ;; @r{this will catch server-side SpamAssassin tags}
23025 (: spam-split 'spam-use-regex-headers) 23036 (: spam-split 'spam-use-regex-headers)
23026 (any "ding" "ding") 23037 (any "ding" "ding")
23027 ;; note that spam by default will go to "spam" 23038 ;; @r{note that spam by default will go to @samp{spam}}
23028 (: spam-split) 23039 (: spam-split)
23029 ;; default mailbox 23040 ;; @r{default mailbox}
23030 "mail")) 23041 "mail"))
23031 23042
23032;; my parameters, set with `G p' 23043;; @r{my parameters, set with @kbd{G p}}
23033 23044
23034;; all nnml groups, and all nnimap groups except 23045;; @r{all nnml groups, and all nnimap groups except}
23035;; "nnimap+mail.lifelogs.com:train" and 23046;; @r{@samp{nnimap+mail.lifelogs.com:train} and}
23036;; "nnimap+mail.lifelogs.com:spam": any spam goes to nnimap training, 23047;; @r{@samp{nnimap+mail.lifelogs.com:spam}: any spam goes to nnimap training,}
23037;; because it must have been detected manually 23048;; @r{because it must have been detected manually}
23038 23049
23039((spam-process-destination . "nnimap+mail.lifelogs.com:train")) 23050((spam-process-destination . "nnimap+mail.lifelogs.com:train"))
23040 23051
23041;; all NNTP groups 23052;; @r{all @acronym{NNTP} groups}
23042;; autodetect spam with the blacklist and ham with the BBDB 23053;; @r{autodetect spam with the blacklist and ham with the BBDB}
23043((spam-autodetect-methods spam-use-blacklist spam-use-BBDB) 23054((spam-autodetect-methods spam-use-blacklist spam-use-BBDB)
23044;; send all spam to the training group 23055;; @r{send all spam to the training group}
23045 (spam-process-destination . "nnimap+mail.lifelogs.com:train")) 23056 (spam-process-destination . "nnimap+mail.lifelogs.com:train"))
23046 23057
23047;; only some NNTP groups, where I want to autodetect spam 23058;; @r{only some @acronym{NNTP} groups, where I want to autodetect spam}
23048((spam-autodetect . t)) 23059((spam-autodetect . t))
23049 23060
23050;; my nnimap "nnimap+mail.lifelogs.com:spam" group 23061;; @r{my nnimap @samp{nnimap+mail.lifelogs.com:spam} group}
23051 23062
23052;; this is a spam group 23063;; @r{this is a spam group}
23053((spam-contents gnus-group-spam-classification-spam) 23064((spam-contents gnus-group-spam-classification-spam)
23054 23065
23055 ;; any spam (which happens when I enter for all unseen messages, 23066 ;; @r{any spam (which happens when I enter for all unseen messages,}
23056 ;; because of the gnus-spam-newsgroup-contents setting above), goes to 23067 ;; @r{because of the @code{gnus-spam-newsgroup-contents} setting above), goes to}
23057 ;; "nnimap+mail.lifelogs.com:train" unless I mark it as ham 23068 ;; @r{@samp{nnimap+mail.lifelogs.com:train} unless I mark it as ham}
23058 23069
23059 (spam-process-destination "nnimap+mail.lifelogs.com:train") 23070 (spam-process-destination "nnimap+mail.lifelogs.com:train")
23060 23071
23061 ;; any ham goes to my "nnimap+mail.lifelogs.com:mail" folder, but 23072 ;; @r{any ham goes to my @samp{nnimap+mail.lifelogs.com:mail} folder, but}
23062 ;; also to my "nnimap+mail.lifelogs.com:trainham" folder for training 23073 ;; @r{also to my @samp{nnimap+mail.lifelogs.com:trainham} folder for training}
23063 23074
23064 (ham-process-destination "nnimap+mail.lifelogs.com:mail" 23075 (ham-process-destination "nnimap+mail.lifelogs.com:mail"
23065 "nnimap+mail.lifelogs.com:trainham") 23076 "nnimap+mail.lifelogs.com:trainham")
23066 ;; in this group, only '!' marks are ham 23077 ;; @r{in this group, only @samp{!} marks are ham}
23067 (ham-marks 23078 (ham-marks
23068 (gnus-ticked-mark)) 23079 (gnus-ticked-mark))
23069 ;; remembers senders in the blacklist on the way out - this is 23080 ;; @r{remembers senders in the blacklist on the way out---this is}
23070 ;; definitely not needed, it just makes me feel better 23081 ;; @r{definitely not needed, it just makes me feel better}
23071 (spam-process (gnus-group-spam-exit-processor-blacklist))) 23082 (spam-process (gnus-group-spam-exit-processor-blacklist)))
23072 23083
23073;; Later, on the IMAP server I use the "train" group for training 23084;; @r{Later, on the @acronym{IMAP} server I use the @samp{train} group for training}
23074;; SpamAssassin to recognize spam, and the "trainham" group for 23085;; @r{SpamAssassin to recognize spam, and the @samp{trainham} group fora}
23075;; recognizing ham - but Gnus has nothing to do with it. 23086;; @r{recognizing ham---but Gnus has nothing to do with it.}
23076 23087
23077@end example 23088@end example
23078 23089
23079@subsubheading Using @file{spam.el} on an IMAP server with a statistical filter on the server 23090@subsubheading Using @file{spam.el} on an IMAP server with a statistical filter on the server
23080
23081From Reiner Steib <reiner.steib@@gmx.de>. 23091From Reiner Steib <reiner.steib@@gmx.de>.
23082 23092
23083My provider has set up bogofilter (in combination with @acronym{DCC}) on 23093My provider has set up bogofilter (in combination with @acronym{DCC}) on
@@ -23115,7 +23125,7 @@ Because of the @code{gnus-group-spam-classification-spam} entry, all
23115messages are marked as spam (with @code{$}). When I find a false 23125messages are marked as spam (with @code{$}). When I find a false
23116positive, I mark the message with some other ham mark (@code{ham-marks}, 23126positive, I mark the message with some other ham mark (@code{ham-marks},
23117@ref{Spam ELisp Package Global Variables}). On group exit, those 23127@ref{Spam ELisp Package Global Variables}). On group exit, those
23118messages are copied to both groups, @samp{INBOX} (were I want to have 23128messages are copied to both groups, @samp{INBOX} (where I want to have
23119the article) and @samp{training.ham} (for training bogofilter) and 23129the article) and @samp{training.ham} (for training bogofilter) and
23120deleted from the @samp{spam.detected} folder. 23130deleted from the @samp{spam.detected} folder.
23121 23131
@@ -23147,7 +23157,7 @@ groups as spam and reports the to Gmane at group exit:
23147 (spam-process (gnus-group-spam-exit-processor-report-gmane))) 23157 (spam-process (gnus-group-spam-exit-processor-report-gmane)))
23148@end lisp 23158@end lisp
23149 23159
23150Additionally, I use `(setq spam-report-gmane-use-article-number nil)' 23160Additionally, I use @code{(setq spam-report-gmane-use-article-number nil)}
23151because I don't read the groups directly from news.gmane.org, but 23161because I don't read the groups directly from news.gmane.org, but
23152through my local news server (leafnode). I.e. the article numbers are 23162through my local news server (leafnode). I.e. the article numbers are
23153not the same as on news.gmane.org, thus @code{spam-report.el} has to check 23163not the same as on news.gmane.org, thus @code{spam-report.el} has to check
@@ -23702,7 +23712,7 @@ the same way, we promise.
23702Add this symbol to a group's @code{spam-process} parameter by 23712Add this symbol to a group's @code{spam-process} parameter by
23703customizing the group parameter or the 23713customizing the group parameter or the
23704@code{gnus-spam-process-newsgroups} variable. When this symbol is added 23714@code{gnus-spam-process-newsgroups} variable. When this symbol is added
23705to a grup's @code{spam-process} parameter, the ham-marked articles in 23715to a group's @code{spam-process} parameter, the ham-marked articles in
23706@emph{ham} groups will be sent to the SpamOracle as samples of ham 23716@emph{ham} groups will be sent to the SpamOracle as samples of ham
23707messages. Note that this ham processor has no effect in @emph{spam} or 23717messages. Note that this ham processor has no effect in @emph{spam} or
23708@emph{unclassified} groups. 23718@emph{unclassified} groups.
@@ -23742,7 +23752,7 @@ incoming mail, provide the following:
23742@enumerate 23752@enumerate
23743 23753
23744@item 23754@item
23745code 23755Code
23746 23756
23747@lisp 23757@lisp
23748(defvar spam-use-blackbox nil 23758(defvar spam-use-blackbox nil
@@ -23750,32 +23760,34 @@ code
23750@end lisp 23760@end lisp
23751 23761
23752Add 23762Add
23753@example 23763@lisp
23754 (spam-use-blackbox . spam-check-blackbox) 23764(spam-use-blackbox . spam-check-blackbox)
23755@end example 23765@end lisp
23756to @code{spam-list-of-checks}. 23766to @code{spam-list-of-checks}.
23757 23767
23758Add 23768Add
23759@example 23769@lisp
23760 (gnus-group-ham-exit-processor-blackbox ham spam-use-blackbox) 23770(gnus-group-ham-exit-processor-blackbox ham spam-use-blackbox)
23761 (gnus-group-spam-exit-processor-blackbox spam spam-use-blackbox) 23771(gnus-group-spam-exit-processor-blackbox spam spam-use-blackbox)
23762@end example 23772@end lisp
23773
23763to @code{spam-list-of-processors}. 23774to @code{spam-list-of-processors}.
23764 23775
23765Add 23776Add
23766@example 23777@lisp
23767 (spam-use-blackbox spam-blackbox-register-routine 23778(spam-use-blackbox spam-blackbox-register-routine
23768 nil 23779 nil
23769 spam-blackbox-unregister-routine 23780 spam-blackbox-unregister-routine
23770 nil) 23781 nil)
23771@end example 23782@end lisp
23783
23772to @code{spam-registration-functions}. Write the register/unregister 23784to @code{spam-registration-functions}. Write the register/unregister
23773routines using the bogofilter register/unregister routines as a 23785routines using the bogofilter register/unregister routines as a
23774start, or other restister/unregister routines more appropriate to 23786start, or other restister/unregister routines more appropriate to
23775Blackbox. 23787Blackbox.
23776 23788
23777@item 23789@item
23778functionality 23790Functionality
23779 23791
23780Write the @code{spam-check-blackbox} function. It should return 23792Write the @code{spam-check-blackbox} function. It should return
23781@samp{nil} or @code{spam-split-group}, observing the other 23793@samp{nil} or @code{spam-split-group}, observing the other
@@ -23794,7 +23806,7 @@ For processing spam and ham messages, provide the following:
23794@enumerate 23806@enumerate
23795 23807
23796@item 23808@item
23797code 23809Code
23798 23810
23799Note you don't have to provide a spam or a ham processor. Only 23811Note you don't have to provide a spam or a ham processor. Only
23800provide them if Blackbox supports spam or ham processing. 23812provide them if Blackbox supports spam or ham processing.
@@ -23819,18 +23831,18 @@ Only applicable to non-spam (unclassified and ham) groups.")
23819Gnus parameters 23831Gnus parameters
23820 23832
23821Add 23833Add
23822@example 23834@lisp
23823 (const :tag "Spam: Blackbox" (spam spam-use-blackbox)) 23835(const :tag "Spam: Blackbox" (spam spam-use-blackbox))
23824 (const :tag "Ham: Blackbox" (ham spam-use-blackbox)) 23836(const :tag "Ham: Blackbox" (ham spam-use-blackbox))
23825@end example 23837@end lisp
23826to the @code{spam-process} group parameter in @code{gnus.el}. Make 23838to the @code{spam-process} group parameter in @code{gnus.el}. Make
23827sure you do it twice, once for the parameter and once for the 23839sure you do it twice, once for the parameter and once for the
23828variable customization. 23840variable customization.
23829 23841
23830Add 23842Add
23831@example 23843@lisp
23832 (variable-item spam-use-blackbox) 23844(variable-item spam-use-blackbox)
23833@end example 23845@end lisp
23834to the @code{spam-autodetect-methods} group parameter in 23846to the @code{spam-autodetect-methods} group parameter in
23835@code{gnus.el}. 23847@code{gnus.el}.
23836 23848
diff --git a/man/kmacro.texi b/man/kmacro.texi
index bad186f88b2..c07602bc77f 100644
--- a/man/kmacro.texi
+++ b/man/kmacro.texi
@@ -62,7 +62,7 @@ When this point is reached during macro execution, ask for confirmation
62(@code{kbd-macro-query}). 62(@code{kbd-macro-query}).
63@item C-x C-k n 63@item C-x C-k n
64Give a command name (for the duration of the session) to the most 64Give a command name (for the duration of the session) to the most
65recently defined keyboard macro (@code{name-last-kbd-macro}). 65recently defined keyboard macro (@code{kmacro-name-last-macro}).
66@item C-x C-k b 66@item C-x C-k b
67Bind the most recently defined keyboard macro to a key sequence (for 67Bind the most recently defined keyboard macro to a key sequence (for
68the duration of the session) (@code{kmacro-bind-to-key}). 68the duration of the session) (@code{kmacro-bind-to-key}).
@@ -361,10 +361,10 @@ register as a counter, incrementing it on each repetition of the macro.
361@section Naming and Saving Keyboard Macros 361@section Naming and Saving Keyboard Macros
362 362
363@cindex saving keyboard macros 363@cindex saving keyboard macros
364@findex name-last-kbd-macro 364@findex kmacro-name-last-macro
365@kindex C-x C-k n 365@kindex C-x C-k n
366 If you wish to save a keyboard macro for later use, you can give it 366 If you wish to save a keyboard macro for later use, you can give it
367a name using @kbd{C-x C-k n} (@code{name-last-kbd-macro}). 367a name using @kbd{C-x C-k n} (@code{kmacro-name-last-macro}).
368This reads a name as an argument using the minibuffer and defines that 368This reads a name as an argument using the minibuffer and defines that
369name to execute the last keyboard macro, in its current form. (If you 369name to execute the last keyboard macro, in its current form. (If you
370later add to the definition of this macro, that does not alter the 370later add to the definition of this macro, that does not alter the
diff --git a/man/maintaining.texi b/man/maintaining.texi
index b5f13d5fb9f..e7d98e67591 100644
--- a/man/maintaining.texi
+++ b/man/maintaining.texi
@@ -343,6 +343,9 @@ In HTML input files, the tags are the @code{title} and the @code{h1},
343and all occurrences of @code{id=}. 343and all occurrences of @code{id=}.
344 344
345@item 345@item
346In Lua input files, all functions are tags.
347
348@item
346In makefiles, targets are tags; additionally, variables are tags 349In makefiles, targets are tags; additionally, variables are tags
347unless you specify @samp{--no-globals}. 350unless you specify @samp{--no-globals}.
348 351
@@ -442,7 +445,8 @@ well as the files it directly contains.
442directory where the tags file was initially written. This way, you can 445directory where the tags file was initially written. This way, you can
443move an entire directory tree containing both the tags file and the 446move an entire directory tree containing both the tags file and the
444source files, and the tags file will still refer correctly to the source 447source files, and the tags file will still refer correctly to the source
445files. 448files. If the tags file is in @file{/dev}, however, the file names are
449made relative to the current working directory.
446 450
447 If you specify absolute file names as arguments to @code{etags}, then 451 If you specify absolute file names as arguments to @code{etags}, then
448the tags file will contain absolute file names. This way, the tags file 452the tags file will contain absolute file names. This way, the tags file
diff --git a/man/makefile.w32-in b/man/makefile.w32-in
index 1041164b2b2..09f314dbf47 100644
--- a/man/makefile.w32-in
+++ b/man/makefile.w32-in
@@ -198,19 +198,23 @@ gnus.dvi: gnus.texi
198 $(ENVADD) $(TEXI2DVI) gnustmp.texi 198 $(ENVADD) $(TEXI2DVI) gnustmp.texi
199 cp gnustmp.dvi $*.dvi 199 cp gnustmp.dvi $*.dvi
200 rm gnustmp.* 200 rm gnustmp.*
201#
201$(infodir)/message: message.texi 202$(infodir)/message: message.texi
202 $(MAKEINFO) message.texi 203 $(MAKEINFO) message.texi
203message.dvi: message.texi 204message.dvi: message.texi
204 $(ENVADD) $(TEXI2DVI) $(srcdir)/message.texi 205 $(ENVADD) $(TEXI2DVI) $(srcdir)/message.texi
206#
205$(infodir)/emacs-mime: emacs-mime.texi 207$(infodir)/emacs-mime: emacs-mime.texi
206 $(MAKEINFO) emacs-mime.texi 208 $(MAKEINFO) emacs-mime.texi
207emacs-mime.dvi: emacs-mime.texi 209emacs-mime.dvi: emacs-mime.texi
208 $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-mime.texi 210 $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-mime.texi
209../info/sieve: sieve.texi 211#
212$(infodir)/sieve: sieve.texi
210 $(MAKEINFO) sieve.texi 213 $(MAKEINFO) sieve.texi
211sieve.dvi: sieve.texi 214sieve.dvi: sieve.texi
212 $(ENVADD) $(TEXI2DVI) $(srcdir)/sieve.texi 215 $(ENVADD) $(TEXI2DVI) $(srcdir)/sieve.texi
213../info/pgg: pgg.texi 216#
217$(infodir)/pgg: pgg.texi
214 $(MAKEINFO) pgg.texi 218 $(MAKEINFO) pgg.texi
215pgg.dvi: pgg.texi 219pgg.dvi: pgg.texi
216 $(ENVADD) $(TEXI2DVI) $(srcdir)/pgg.texi 220 $(ENVADD) $(TEXI2DVI) $(srcdir)/pgg.texi
diff --git a/man/mini.texi b/man/mini.texi
index ec82c6d4f88..9d0a7d54be1 100644
--- a/man/mini.texi
+++ b/man/mini.texi
@@ -564,12 +564,13 @@ of saved entire commands. After finding the desired previous command,
564you can edit its expression as usual and then resubmit it by typing 564you can edit its expression as usual and then resubmit it by typing
565@key{RET} as usual. 565@key{RET} as usual.
566 566
567@vindex isearch-resume-enabled 567@vindex isearch-resume-in-command-history
568 Incremental search does not, strictly speaking, use the minibuffer, 568 Incremental search does not, strictly speaking, use the minibuffer,
569but it does something similar, so normally it is treated as a complex 569but it does something similar. Although it behaves like a complex command,
570command and it appears in the history list for @kbd{C-x @key{ESC} 570it normally does not appear in the history list for @kbd{C-x
571@key{ESC}}. You can disable that by setting 571@key{ESC} @key{ESC}}. You can make it appear in the history by
572@code{isearch-resume-enabled} to @code{nil}. 572setting @code{isearch-resume-in-command-history} to a non-@code{nil}
573value.
573 574
574@vindex command-history 575@vindex command-history
575 The list of previous minibuffer-using commands is stored as a Lisp 576 The list of previous minibuffer-using commands is stored as a Lisp
diff --git a/man/smtpmail.texi b/man/smtpmail.texi
index 6efe6f71630..26fd77eafb3 100644
--- a/man/smtpmail.texi
+++ b/man/smtpmail.texi
@@ -279,6 +279,13 @@ respectively.
279;; Authenticate using this username and password against my server. 279;; Authenticate using this username and password against my server.
280(setq smtpmail-auth-credentials 280(setq smtpmail-auth-credentials
281 '(("@var{hostname}" "@var{port}" "@var{username}" "@var{password}"))) 281 '(("@var{hostname}" "@var{port}" "@var{username}" "@var{password}")))
282
283;; Note that if @var{port} is an integer, you must not quote it as a
284;; string. Normally @var{port} should be the integer 25, and the example
285;; become:
286(setq smtpmail-auth-credentials
287 '(("@var{hostname}" 25 "@var{username}" "@var{password}")))
288
282;; Use STARTTLS without authentication against the server. 289;; Use STARTTLS without authentication against the server.
283(setq smtpmail-starttls-credentials 290(setq smtpmail-starttls-credentials
284 '(("@var{hostname}" "@var{port}" nil nil))) 291 '(("@var{hostname}" "@var{port}" nil nil)))
diff --git a/src/ChangeLog b/src/ChangeLog
index 52426939562..955c8929f92 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,85 @@
12004-09-14 Stefan <monnier@iro.umontreal.ca>
2
3 * fileio.c (Finsert_file_contents): Fix case of replacement in a
4 narrowed buffer.
5
62004-09-14 Kim F. Storm <storm@cua.dk>
7
8 * puresize.h (PURESIZE_RATIO): Define based on BITS_PER_EMACS_INT.
9
10 * xfaces.c (Qface_no_inherit): New var.
11 (syms_of_xfaces): Intern and staticpro it.
12 (Finternal_make_lisp_face, Finternal_set_lisp_face_attribute)
13 (Finternal_copy_lisp_face, update_face_from_frame_parameter):
14 Don't increment face_change_count when face has non-nil
15 face-no-inherit property.
16
172004-09-13 Stefan Monnier <monnier@iro.umontreal.ca>
18
19 * bytecode.c (BYTE_CODE_QUIT): Add missing AFTER_POTENTIAL_GC.
20 (Fbyte_code): Remove dead code after `wrong_type_argument'.
21
22 * alloc.c (Fgarbage_collect): Mark keyboards, gtk data, and specpdl
23 before doing the mark_stack_check_gcpros since they are not on the stack.
24
252004-09-12 Kim F. Storm <storm@cua.dk>
26
27 * editfns.c (Fformat): Handle format strings with multiple text
28 properties. Reverse text property list from the format string,
29 so the positions are in increasing order.
30
312004-09-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
32
33 * xselect.c (x_reply_selection_request): XSync and UNBLOCK before
34 x_uncatch_errors so that possible protocol errors are delivered.
35
362004-09-10 Eli Zaretskii <eliz@gnu.org>
37
38 * Makefile.in (msdos.o): Depend on buffer.h, commands.h, and
39 blockinput.h.
40 (dosfns.o): Depend on blockinput.h, window.h, dispextern.h,
41 charset.h, and coding.h
42 (w16select.o): Depend on buffer.h, charset.h, coding.h, and
43 composite.h.
44 (term.o): Depend on window.h and keymap.h.
45 (abbrev.o): Depend on syntax.h.
46 (callint.o): Depend on keymap.h.
47 (casefiddle.o): Depend on charset.h and keymap.h.
48 (category.o): Depend on keymap.h.
49 (coding.o): Depend on dispextern.h.
50 (cmds.o): Depend on keyboard.h and keymap.h.
51 (dispnew.o): Depend on indent.h and intervals.h.
52 (doc.o): Depend on keymap.h.
53 (editfns.o): Depend on frame.h.
54 (emacs.o): Depend on dispextern.h.
55 (fileio.o): Don't depend on ccl.h.
56 (filelock.o): Depend on charset.h and coding.h.
57 (frame.o): Depend on w32term.h and macterm.h.
58 (insdel.o): Depend on region-cache.h.
59 (keyboard.o): Depend on keymap.h, w32term.h, and macterm.h.
60 (minibuf.o): Depend on $(INTERVALS_SRC) and keymap.h.
61 (search.o): Depend on $(INTERVALS_SRC).
62 (syntax.o): Depend on keymap.h, regex.h, and $(INTERVALS_SRC).
63 (window.o): Depend on keymap.h, blockinput.h, $(INTERVALS_SRC),
64 xterm.h, w32term.h, and macterm.h.
65 (xdisp.o): Depend on keyboard.h, $(INTERVALS_SRC), xterm.h,
66 w32term.h, and macterm.h.
67 (xfaces.o): Depend on keyboard.h, $(INTERVALS_SRC),
68 region-cache.h, xterm.h, w32term.h, and macterm.h.
69 (bytecode.o): Depend on dispextern.h, frame.h, and xterm.h.
70 (data.o): Depend on frame.h.
71 (fns.o): Depend on keymap.h, xterm.h, and blockinput.h.
72 (print.o): Depend on termchar.h and $(INTERVALS_SRC).
73 (lread.o): Depend on $(INTERVALS_SRC), termhooks.h, and coding.h.
74 (intervals.o): Depend on keymap.h.
75
76 * msdos.c (msdos_set_cursor_shape, IT_display_cursor): Add
77 debugging print-out to termscript.
78
792004-09-09 Richard M. Stallman <rms@gnu.org>
80
81 * xdisp.c (decode_mode_spec): Use current buffer for most purposes.
82
12004-09-08 Richard M. Stallman <rms@gnu.org> 832004-09-08 Richard M. Stallman <rms@gnu.org>
2 84
3 * window.c (Fset_window_buffer): Doc fix. 85 * window.c (Fset_window_buffer): Doc fix.
@@ -12446,7 +12528,7 @@
12446 12528
124472002-02-15 Andreas Schwab <schwab@suse.de> 125292002-02-15 Andreas Schwab <schwab@suse.de>
12448 12530
12449 * puresize.h (BASE_PURESIZE): Increase to 9/5. 12531 * puresize.h (PURESIZE_RATIO): Increase to 9/5.
12450 12532
12451 * alloc.c (NSTATICS): Increase to 1280. 12533 * alloc.c (NSTATICS): Increase to 1280.
12452 12534
diff --git a/src/Makefile.in b/src/Makefile.in
index 14a4a64f1cc..007c0584c5a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1024,29 +1024,32 @@ alloca.o: alloca.c blockinput.h atimer.h
1024 and so rarely changed in ways that do require any. */ 1024 and so rarely changed in ways that do require any. */
1025 1025
1026abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h character.h \ 1026abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h character.h \
1027 $(config_h) 1027 syntax.h $(config_h)
1028buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \ 1028buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
1029 dispextern.h $(INTERVAL_SRC) blockinput.h atimer.h systime.h character.h \ 1029 dispextern.h $(INTERVAL_SRC) blockinput.h atimer.h systime.h character.h \
1030 $(config_h) 1030 $(config_h)
1031callint.o: callint.c window.h commands.h buffer.h \ 1031callint.o: callint.c window.h commands.h buffer.h keymap.h \
1032 keyboard.h dispextern.h $(config_h) 1032 keyboard.h dispextern.h $(config_h)
1033callproc.o: callproc.c epaths.h buffer.h commands.h $(config_h) \ 1033callproc.o: callproc.c epaths.h buffer.h commands.h $(config_h) \
1034 process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \ 1034 process.h systty.h syssignal.h character.h coding.h ccl.h msdos.h \
1035 composite.h 1035 composite.h w32.h
1036casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \ 1036casefiddle.o: casefiddle.c syntax.h commands.h buffer.h character.h \
1037 composite.h $(config_h) 1037 composite.h \
1038 charset.h keymap.h $(config_h)
1038casetab.o: casetab.c buffer.h $(config_h) 1039casetab.o: casetab.c buffer.h $(config_h)
1039category.o: category.c category.h buffer.h charset.h character.h $(config_h) 1040category.o: category.c category.h buffer.h charset.h keymap.h \
1041 character.h $(config_h)
1040ccl.o: ccl.c ccl.h charset.h character.h coding.h $(config_h) 1042ccl.o: ccl.c ccl.h charset.h character.h coding.h $(config_h)
1041character.o: character.c character.h buffer.h charset.h composite.h disptab.h \ 1043character.o: character.c character.h buffer.h charset.h composite.h disptab.h \
1042 $(config.h) 1044 $(config.h)
1043charset.o: charset.c charset.h character.h buffer.h coding.h composite.h \ 1045charset.o: charset.c charset.h character.h buffer.h coding.h composite.h \
1044 disptab.h $(config_h) 1046 disptab.h $(config_h)
1045chartab.o: charset.h character.h $(config.h) 1047chartab.o: charset.h character.h $(config.h)
1046coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h intervals.h composite.h window.h $(config_h) 1048coding.o: coding.c coding.h ccl.h buffer.h character.h charset.h intervals.h composite.h \
1049 window.h dispextern.h $(config_h)
1047cm.o: cm.c cm.h termhooks.h $(config_h) 1050cm.o: cm.c cm.h termhooks.h $(config_h)
1048cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h $(config_h) \ 1051cmds.o: cmds.c syntax.h buffer.h character.h commands.h window.h $(config_h) \
1049 msdos.h dispextern.h 1052 msdos.h dispextern.h keyboard.h keymap.h
1050pre-crt0.o: pre-crt0.c 1053pre-crt0.o: pre-crt0.c
1051ecrt0.o: ecrt0.c $(config_h) 1054ecrt0.o: ecrt0.c $(config_h)
1052 CRT0_COMPILE ${srcdir}/ecrt0.c 1055 CRT0_COMPILE ${srcdir}/ecrt0.c
@@ -1054,25 +1057,26 @@ dired.o: dired.c commands.h buffer.h $(config_h) character.h charset.h \
1054 coding.h regex.h systime.h 1057 coding.h regex.h systime.h
1055dispnew.o: dispnew.c systty.h systime.h commands.h process.h frame.h \ 1058dispnew.o: dispnew.c systty.h systime.h commands.h process.h frame.h \
1056 window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \ 1059 window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \
1057 disptab.h \ 1060 disptab.h indent.h intervals.h \
1058 xterm.h blockinput.h atimer.h character.h msdos.h composite.h keyboard.h \ 1061 xterm.h blockinput.h atimer.h character.h msdos.h composite.h keyboard.h \
1059 $(config_h) 1062 $(config_h)
1060doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h character.h 1063doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h keymap.h character.h
1061doprnt.o: doprnt.c character.h $(config_h) 1064doprnt.o: doprnt.c character.h $(config_h)
1062dosfns.o: buffer.h termchar.h termhooks.h frame.h msdos.h dosfns.h $(config_h) 1065dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
1066 msdos.h dosfns.h dispextern.h charset.h coding.h $(config_h)
1063editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \ 1067editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \
1064 coding.h dispextern.h $(config_h) 1068 coding.h dispextern.h frame.h $(config_h)
1065emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ 1069emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
1066 termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \ 1070 termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \
1067 window.h keyboard.h keymap.h 1071 window.h dispextern.h keyboard.h keymap.h
1068fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \ 1072fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) character.h \
1069 coding.h ccl.h msdos.h dispextern.h $(config_h) 1073 coding.h msdos.h dispextern.h $(config_h)
1070filelock.o: filelock.c buffer.h character.h charset.h coding.h systime.h \ 1074filelock.o: filelock.c buffer.h character.h charset.h coding.h systime.h \
1071 epaths.h $(config_h) 1075 epaths.h $(config_h)
1072filemode.o: filemode.c $(config_h) 1076filemode.o: filemode.c $(config_h)
1073frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ 1077frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
1074 blockinput.h atimer.h systime.h buffer.h character.h fontset.h \ 1078 blockinput.h atimer.h systime.h buffer.h character.h fontset.h \
1075 msdos.h dosfns.h dispextern.h $(config_h) 1079 msdos.h dosfns.h dispextern.h w32term.h macterm.h $(config_h)
1076fringe.o: fringe.c dispextern.h frame.h window.h buffer.h $(config_h) 1080fringe.o: fringe.c dispextern.h frame.h window.h buffer.h $(config_h)
1077fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h character.h \ 1081fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h character.h \
1078 charset.h frame.h keyboard.h $(config_h) 1082 charset.h frame.h keyboard.h $(config_h)
@@ -1083,11 +1087,11 @@ indent.o: indent.c frame.h window.h indent.h buffer.h $(config_h) termchar.h \
1083 termopts.h disptab.h region-cache.h character.h category.h composite.h \ 1087 termopts.h disptab.h region-cache.h character.h category.h composite.h \
1084 dispextern.h keyboard.h 1088 dispextern.h keyboard.h
1085insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h character.h \ 1089insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h character.h \
1086 dispextern.h atimer.h systime.h $(config_h) 1090 dispextern.h atimer.h systime.h region-cache.h $(config_h)
1087keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \ 1091keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h character.h \
1088 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \ 1092 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
1089 systty.h systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \ 1093 systty.h systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
1090 atimer.h xterm.h puresize.h msdos.h $(config_h) 1094 atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h)
1091keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ 1095keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
1092 atimer.h systime.h puresize.h character.h intervals.h $(config_h) 1096 atimer.h systime.h puresize.h character.h intervals.h $(config_h)
1093lastfile.o: lastfile.c $(config_h) 1097lastfile.o: lastfile.c $(config_h)
@@ -1100,11 +1104,11 @@ vm-limit.o: vm-limit.c mem-limits.h $(config_h)
1100marker.o: marker.c buffer.h character.h $(config_h) 1104marker.o: marker.c buffer.h character.h $(config_h)
1101md5.o: md5.c md5.h $(config_h) 1105md5.o: md5.c md5.h $(config_h)
1102minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \ 1106minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \
1103 buffer.h commands.h character.h msdos.h $(config_h) 1107 buffer.h commands.h character.h msdos.h $(INTERVAL_SRC) keymap.h $(config_h)
1104mktime.o: mktime.c $(config_h) 1108mktime.o: mktime.c $(config_h)
1105msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \ 1109msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
1106 termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \ 1110 termopts.h termchar.h character.h coding.h ccl.h disptab.h window.h \
1107 keyboard.h intervals.h $(config_h) 1111 keyboard.h intervals.h buffer.h commands.h blockinput.h $(config_h)
1108process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \ 1112process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
1109 commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \ 1113 commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
1110 blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \ 1114 blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
@@ -1116,16 +1120,17 @@ scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
1116 $(config_h) 1120 $(config_h)
1117search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \ 1121search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
1118 blockinput.h atimer.h systime.h category.h character.h composite.h \ 1122 blockinput.h atimer.h systime.h category.h character.h composite.h \
1123 $(INTERVAL_SRC) \
1119 $(config_h) 1124 $(config_h)
1120strftime.o: strftime.c $(config_h) 1125strftime.o: strftime.c $(config_h)
1121syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \ 1126syntax.o: syntax.c syntax.h buffer.h commands.h category.h character.h \
1122 composite.h $(config_h) 1127 composite.h keymap.h regex.h $(INTERVAL_SRC) $(config_h)
1123sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ 1128sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
1124 process.h dispextern.h termhooks.h termchar.h termopts.h \ 1129 process.h dispextern.h termhooks.h termchar.h termopts.h \
1125 frame.h atimer.h window.h msdos.h dosfns.h keyboard.h $(config_h) 1130 frame.h atimer.h window.h msdos.h dosfns.h keyboard.h $(config_h)
1126term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \ 1131term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \
1127 disptab.h dispextern.h keyboard.h character.h charset.h coding.h ccl.h \ 1132 disptab.h dispextern.h keyboard.h character.h charset.h coding.h ccl.h \
1128 msdos.h keymap.h 1133 msdos.h window.h keymap.h
1129termcap.o: termcap.c $(config_h) 1134termcap.o: termcap.c $(config_h)
1130terminfo.o: terminfo.c $(config_h) 1135terminfo.o: terminfo.c $(config_h)
1131tparam.o: tparam.c $(config_h) 1136tparam.o: tparam.c $(config_h)
@@ -1135,19 +1140,21 @@ undo.o: undo.c buffer.h commands.h $(config_h)
1135UNEXEC_ALIAS=UNEXEC 1140UNEXEC_ALIAS=UNEXEC
1136$(UNEXEC_ALIAS): UNEXEC_SRC $(config_h) 1141$(UNEXEC_ALIAS): UNEXEC_SRC $(config_h)
1137w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \ 1142w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
1138 msdos.h $(config_h) 1143 msdos.h buffer.h charset.h coding.h composite.h $(config_h)
1139widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \ 1144widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
1140 $(srcdir)/../lwlib/lwlib.h $(config_h) 1145 $(srcdir)/../lwlib/lwlib.h $(config_h)
1141window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \ 1146window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
1142 termhooks.h disptab.h keyboard.h dispextern.h msdos.h composite.h \ 1147 termhooks.h disptab.h keyboard.h dispextern.h msdos.h composite.h \
1148 keymap.h blockinput.h $(INTERVAL_SRC) xterm.h w32term.h macterm.h $(config_h)
1149xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h \
1150 coding.h termchar.h frame.h window.h disptab.h termhooks.h character.h \
1151 charset.h keyboard.h $(INTERVAL_SRC) region-cache.h xterm.h w32term.h \
1152 macterm.h $(config_h) msdos.h composite.h fontset.h blockinput.h atimer.h \
1153 systime.h keymap.h
1154xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
1155 window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h \
1156 systime.h keyboard.h fontset.h w32term.h macterm.h $(INTERVAL_SRC) \
1143 $(config_h) 1157 $(config_h)
1144xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h coding.h \
1145 termchar.h frame.h window.h disptab.h termhooks.h character.h charset.h \
1146 $(config_h) msdos.h composite.h fontset.h blockinput.h atimer.h systime.h \
1147 keymap.h region-cache.h
1148xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
1149 window.h character.h charset.h msdos.h dosfns.h composite.h atimer.h \
1150 systime.h fontset.h $(config_h) $(INTERVAL_SRC)
1151xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \ 1158xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
1152 $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \ 1159 $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
1153 character.h charset.h coding.h gtkutil.h $(config_h) termhooks.h 1160 character.h charset.h coding.h gtkutil.h $(config_h) termhooks.h
@@ -1175,23 +1182,26 @@ atimer.o: atimer.c atimer.h systime.h $(config_h)
1175alloc.o: alloc.c process.h frame.h window.h buffer.h puresize.h syssignal.h keyboard.h \ 1182alloc.o: alloc.c process.h frame.h window.h buffer.h puresize.h syssignal.h keyboard.h \
1176 blockinput.h atimer.h systime.h character.h dispextern.h $(config_h) \ 1183 blockinput.h atimer.h systime.h character.h dispextern.h $(config_h) \
1177 $(INTERVAL_SRC) 1184 $(INTERVAL_SRC)
1178bytecode.o: bytecode.c buffer.h syntax.h character.h window.h $(config_h) 1185bytecode.o: bytecode.c buffer.h syntax.h character.h window.h dispextern.h \
1179data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h \ 1186 frame.h xterm.h $(config_h)
1187data.o: data.c buffer.h puresize.h character.h syssignal.h keyboard.h frame.h \
1180 $(config_h) 1188 $(config_h)
1181eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \ 1189eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \
1182 dispextern.h $(config_h) 1190 dispextern.h $(config_h)
1183floatfns.o: floatfns.c $(config_h) 1191floatfns.o: floatfns.c $(config_h)
1184fns.o: fns.c commands.h $(config_h) frame.h buffer.h character.h keyboard.h \ 1192fns.o: fns.c commands.h $(config_h) frame.h buffer.h character.h keyboard.h \
1185 frame.h window.h dispextern.h $(INTERVAL_SRC) coding.h md5.h 1193 keymap.h frame.h window.h dispextern.h $(INTERVAL_SRC) coding.h md5.h \
1194 blockinput.h xterm.h
1186print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \ 1195print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \
1187 $(config_h) dispextern.h msdos.h composite.h 1196 $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h
1188lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \ 1197lread.o: lread.c commands.h keyboard.h buffer.h epaths.h character.h \
1189 charset.h $(config_h) termhooks.h coding.h msdos.h 1198 charset.h $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h
1190 1199
1191/* Text properties support */ 1200/* Text properties support */
1192textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \ 1201textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \
1193 $(config_h) 1202 $(config_h)
1194intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h $(config_h) 1203intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h \
1204 keymap.h $(config_h)
1195composite.o: composite.c buffer.h character.h $(INTERVAL_SRC) $(config_h) 1205composite.o: composite.c buffer.h character.h $(INTERVAL_SRC) $(config_h)
1196 1206
1197/* System-specific programs to be made. 1207/* System-specific programs to be made.
diff --git a/src/alloc.c b/src/alloc.c
index 567b8c7a925..4b31ec7897e 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1,6 +1,6 @@
1/* Storage allocation and gc for GNU Emacs Lisp interpreter. 1/* Storage allocation and gc for GNU Emacs Lisp interpreter.
2 Copyright (C) 1985,86,88,93,94,95,97,98,1999,2000,01,02,03,2004 2 Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999,
3 Free Software Foundation, Inc. 3 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -4411,6 +4411,20 @@ returns nil, because real GC can't be done. */)
4411 for (i = 0; i < staticidx; i++) 4411 for (i = 0; i < staticidx; i++)
4412 mark_object (*staticvec[i]); 4412 mark_object (*staticvec[i]);
4413 4413
4414 for (bind = specpdl; bind != specpdl_ptr; bind++)
4415 {
4416 mark_object (bind->symbol);
4417 mark_object (bind->old_value);
4418 }
4419 mark_kboards ();
4420
4421#ifdef USE_GTK
4422 {
4423 extern void xg_mark_data ();
4424 xg_mark_data ();
4425 }
4426#endif
4427
4414#if (GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \ 4428#if (GC_MARK_STACK == GC_MAKE_GCPROS_NOOPS \
4415 || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS) 4429 || GC_MARK_STACK == GC_MARK_STACK_CHECK_GCPROS)
4416 mark_stack (); 4430 mark_stack ();
@@ -4424,11 +4438,6 @@ returns nil, because real GC can't be done. */)
4424#endif 4438#endif
4425 4439
4426 mark_byte_stack (); 4440 mark_byte_stack ();
4427 for (bind = specpdl; bind != specpdl_ptr; bind++)
4428 {
4429 mark_object (bind->symbol);
4430 mark_object (bind->old_value);
4431 }
4432 for (catch = catchlist; catch; catch = catch->next) 4441 for (catch = catchlist; catch; catch = catch->next)
4433 { 4442 {
4434 mark_object (catch->tag); 4443 mark_object (catch->tag);
@@ -4440,19 +4449,11 @@ returns nil, because real GC can't be done. */)
4440 mark_object (handler->var); 4449 mark_object (handler->var);
4441 } 4450 }
4442 mark_backtrace (); 4451 mark_backtrace ();
4443 mark_kboards ();
4444 4452
4445#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES 4453#if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
4446 mark_stack (); 4454 mark_stack ();
4447#endif 4455#endif
4448 4456
4449#ifdef USE_GTK
4450 {
4451 extern void xg_mark_data ();
4452 xg_mark_data ();
4453 }
4454#endif
4455
4456 /* Everything is now marked, except for the things that require special 4457 /* Everything is now marked, except for the things that require special
4457 finalization, i.e. the undo_list. 4458 finalization, i.e. the undo_list.
4458 Look thru every buffer's undo list 4459 Look thru every buffer's undo list
diff --git a/src/bytecode.c b/src/bytecode.c
index b30a410f80e..d130b3b3d42 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1,5 +1,5 @@
1/* Execution of byte code produced by bytecomp.el. 1/* Execution of byte code produced by bytecomp.el.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 2000, 2001, 2002, 2003 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 2000, 2001, 2002, 2003, 2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -387,6 +387,7 @@ unmark_byte_stack ()
387 Vquit_flag = Qnil; \ 387 Vquit_flag = Qnil; \
388 BEFORE_POTENTIAL_GC (); \ 388 BEFORE_POTENTIAL_GC (); \
389 Fsignal (Qquit, Qnil); \ 389 Fsignal (Qquit, Qnil); \
390 AFTER_POTENTIAL_GC (); \
390 } \ 391 } \
391 } while (0) 392 } while (0)
392 393
@@ -539,9 +540,7 @@ If the third argument is incorrect, Emacs may crash. */)
539 TOP = Qnil; 540 TOP = Qnil;
540 else 541 else
541 { 542 {
542 BEFORE_POTENTIAL_GC (); 543 wrong_type_argument (Qlistp, v1);
543 Fcar (wrong_type_argument (Qlistp, v1));
544 AFTER_POTENTIAL_GC ();
545 } 544 }
546 break; 545 break;
547 } 546 }
@@ -574,9 +573,7 @@ If the third argument is incorrect, Emacs may crash. */)
574 TOP = Qnil; 573 TOP = Qnil;
575 else 574 else
576 { 575 {
577 BEFORE_POTENTIAL_GC (); 576 wrong_type_argument (Qlistp, v1);
578 Fcdr (wrong_type_argument (Qlistp, v1));
579 AFTER_POTENTIAL_GC ();
580 } 577 }
581 break; 578 break;
582 } 579 }
@@ -907,11 +904,7 @@ If the third argument is incorrect, Emacs may crash. */)
907 else if (!NILP (v1)) 904 else if (!NILP (v1))
908 { 905 {
909 immediate_quit = 0; 906 immediate_quit = 0;
910 BEFORE_POTENTIAL_GC (); 907 wrong_type_argument (Qlistp, v1);
911 v1 = wrong_type_argument (Qlistp, v1);
912 AFTER_POTENTIAL_GC ();
913 immediate_quit = 1;
914 op++;
915 } 908 }
916 } 909 }
917 immediate_quit = 0; 910 immediate_quit = 0;
@@ -920,11 +913,7 @@ If the third argument is incorrect, Emacs may crash. */)
920 else if (NILP (v1)) 913 else if (NILP (v1))
921 TOP = Qnil; 914 TOP = Qnil;
922 else 915 else
923 { 916 wrong_type_argument (Qlistp, v1);
924 BEFORE_POTENTIAL_GC ();
925 Fcar (wrong_type_argument (Qlistp, v1));
926 AFTER_POTENTIAL_GC ();
927 }
928 break; 917 break;
929 } 918 }
930 919
@@ -1561,11 +1550,7 @@ If the third argument is incorrect, Emacs may crash. */)
1561 else if (!NILP (v1)) 1550 else if (!NILP (v1))
1562 { 1551 {
1563 immediate_quit = 0; 1552 immediate_quit = 0;
1564 BEFORE_POTENTIAL_GC (); 1553 wrong_type_argument (Qlistp, v1);
1565 v1 = wrong_type_argument (Qlistp, v1);
1566 AFTER_POTENTIAL_GC ();
1567 immediate_quit = 1;
1568 op++;
1569 } 1554 }
1570 } 1555 }
1571 immediate_quit = 0; 1556 immediate_quit = 0;
@@ -1574,11 +1559,7 @@ If the third argument is incorrect, Emacs may crash. */)
1574 else if (NILP (v1)) 1559 else if (NILP (v1))
1575 TOP = Qnil; 1560 TOP = Qnil;
1576 else 1561 else
1577 { 1562 wrong_type_argument (Qlistp, v1);
1578 BEFORE_POTENTIAL_GC ();
1579 Fcar (wrong_type_argument (Qlistp, v1));
1580 AFTER_POTENTIAL_GC ();
1581 }
1582 } 1563 }
1583 else 1564 else
1584 { 1565 {
diff --git a/src/editfns.c b/src/editfns.c
index 7fdd5598bf8..49617f7ebc9 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3824,11 +3824,13 @@ usage: (format STRING &rest OBJECTS) */)
3824 3824
3825 /* Adjust the bounds of each text property 3825 /* Adjust the bounds of each text property
3826 to the proper start and end in the output string. */ 3826 to the proper start and end in the output string. */
3827 /* We take advantage of the fact that the positions in PROPS
3828 are in increasing order, so that we can do (effectively)
3829 one scan through the position space of the format string.
3830 3827
3831 BYTEPOS is the byte position in the format string, 3828 /* Put the positions in PROPS in increasing order, so that
3829 we can do (effectively) one scan through the position
3830 space of the format string. */
3831 props = Fnreverse (props);
3832
3833 /* BYTEPOS is the byte position in the format string,
3832 POSITION is the untranslated char position in it, 3834 POSITION is the untranslated char position in it,
3833 TRANSLATED is the translated char position in BUF, 3835 TRANSLATED is the translated char position in BUF,
3834 and ARGN is the number of the next arg we will come to. */ 3836 and ARGN is the number of the next arg we will come to. */
diff --git a/src/fileio.c b/src/fileio.c
index f3678cac0e5..7c0490e6978 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,6 +1,6 @@
1/* File IO for GNU Emacs. 1/* File IO for GNU Emacs.
2 Copyright (C) 1985,86,87,88,93,94,95,96,97,98,99,2000,01,03,2004 2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998,
3 Free Software Foundation, Inc. 3 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -4304,7 +4304,7 @@ actually used. */)
4304 /* Replace the chars that we need to replace, 4304 /* Replace the chars that we need to replace,
4305 and update INSERTED to equal the number of bytes 4305 and update INSERTED to equal the number of bytes
4306 we are taking from the decoded string. */ 4306 we are taking from the decoded string. */
4307 inserted -= (Z_BYTE - same_at_end) + (same_at_start - BEG_BYTE); 4307 inserted -= (ZV_BYTE - same_at_end) + (same_at_start - BEGV_BYTE);
4308 4308
4309 if (same_at_end != same_at_start) 4309 if (same_at_end != same_at_start)
4310 { 4310 {
diff --git a/src/msdos.c b/src/msdos.c
index daa4199d6a7..0020be310a6 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -752,6 +752,9 @@ msdos_set_cursor_shape (struct frame *f, int start_line, int width)
752 if (f && f != SELECTED_FRAME()) 752 if (f && f != SELECTED_FRAME())
753 return; 753 return;
754 754
755 if (termscript)
756 fprintf (termscript, "\nCURSOR SHAPE=(%d,%d)", start_line, width);
757
755 /* The character cell size in scan lines is stored at 40:85 in the 758 /* The character cell size in scan lines is stored at 40:85 in the
756 BIOS data area. */ 759 BIOS data area. */
757 max_line = _farpeekw (_dos_ds, 0x485) - 1; 760 max_line = _farpeekw (_dos_ds, 0x485) - 1;
@@ -851,10 +854,12 @@ IT_set_cursor_type (struct frame *f, Lisp_Object cursor_type)
851 } 854 }
852 } 855 }
853 else 856 else
854 /* Treat anything unknown as "box cursor". This includes nil, so 857 {
855 that a frame which doesn't specify a cursor type gets a box, 858 /* Treat anything unknown as "box cursor". This includes nil, so
856 which is the default in Emacs. */ 859 that a frame which doesn't specify a cursor type gets a box,
857 msdos_set_cursor_shape (f, 0, BOX_CURSOR_WIDTH); 860 which is the default in Emacs. */
861 msdos_set_cursor_shape (f, 0, BOX_CURSOR_WIDTH);
862 }
858} 863}
859 864
860static void 865static void
@@ -1826,6 +1831,8 @@ static int cursor_cleared;
1826static void 1831static void
1827IT_display_cursor (int on) 1832IT_display_cursor (int on)
1828{ 1833{
1834 if (termscript)
1835 fprintf (termscript, "\nCURSOR %s", on ? "ON" : "OFF");
1829 if (on && cursor_cleared) 1836 if (on && cursor_cleared)
1830 { 1837 {
1831 ScreenSetCursor (current_pos_Y, current_pos_X); 1838 ScreenSetCursor (current_pos_Y, current_pos_X);
diff --git a/src/puresize.h b/src/puresize.h
index 8088a374765..054b2bc4c89 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -47,7 +47,7 @@ Boston, MA 02111-1307, USA. */
47 47
48/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ 48/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */
49#ifndef PURESIZE_RATIO 49#ifndef PURESIZE_RATIO
50#if VALBITS + GCTYPEBITS + 1 > 32 50#if BITS_PER_EMACS_INT > 32
51#define PURESIZE_RATIO 9/5 /* Don't surround with `()'. */ 51#define PURESIZE_RATIO 9/5 /* Don't surround with `()'. */
52#else 52#else
53#define PURESIZE_RATIO 1 53#define PURESIZE_RATIO 1
diff --git a/src/xdisp.c b/src/xdisp.c
index 6f88827bf73..a756b99577c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -16228,7 +16228,10 @@ decode_mode_spec_coding (coding_system, buf, eol_flag)
16228 generated by character C. PRECISION >= 0 means don't return a 16228 generated by character C. PRECISION >= 0 means don't return a
16229 string longer than that value. FIELD_WIDTH > 0 means pad the 16229 string longer than that value. FIELD_WIDTH > 0 means pad the
16230 string returned with spaces to that value. Return 1 in *MULTIBYTE 16230 string returned with spaces to that value. Return 1 in *MULTIBYTE
16231 if the result is multibyte text. */ 16231 if the result is multibyte text.
16232
16233 Note we operate on the current buffer for most purposes,
16234 the exception being w->base_line_pos. */
16232 16235
16233static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------"; 16236static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
16234 16237
@@ -16242,7 +16245,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
16242 Lisp_Object obj; 16245 Lisp_Object obj;
16243 struct frame *f = XFRAME (WINDOW_FRAME (w)); 16246 struct frame *f = XFRAME (WINDOW_FRAME (w));
16244 char *decode_mode_spec_buf = f->decode_mode_spec_buffer; 16247 char *decode_mode_spec_buf = f->decode_mode_spec_buffer;
16245 struct buffer *b = XBUFFER (w->buffer); 16248 struct buffer *b = current_buffer;
16246 16249
16247 obj = Qnil; 16250 obj = Qnil;
16248 *multibyte = 0; 16251 *multibyte = 0;
@@ -16544,7 +16547,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
16544 16547
16545 case 's': 16548 case 's':
16546 /* status of process */ 16549 /* status of process */
16547 obj = Fget_buffer_process (w->buffer); 16550 obj = Fget_buffer_process (Fcurrent_buffer ());
16548 if (NILP (obj)) 16551 if (NILP (obj))
16549 return "no process"; 16552 return "no process";
16550#ifdef subprocesses 16553#ifdef subprocesses
diff --git a/src/xfaces.c b/src/xfaces.c
index 6e8a64e3c41..19369353f5e 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -389,6 +389,10 @@ Lisp_Object Qforeground_color, Qbackground_color;
389Lisp_Object Qface; 389Lisp_Object Qface;
390extern Lisp_Object Qmouse_face; 390extern Lisp_Object Qmouse_face;
391 391
392/* Property for basic faces which other faces cannot inherit. */
393
394Lisp_Object Qface_no_inherit;
395
392/* Error symbol for wrong_type_argument in load_pixmap. */ 396/* Error symbol for wrong_type_argument in load_pixmap. */
393 397
394Lisp_Object Qbitmap_spec_p; 398Lisp_Object Qbitmap_spec_p;
@@ -3944,8 +3948,11 @@ Value is a vector of face attributes. */)
3944 depend on the face, make sure they are all removed. This is done 3948 depend on the face, make sure they are all removed. This is done
3945 by incrementing face_change_count. The next call to 3949 by incrementing face_change_count. The next call to
3946 init_iterator will then free realized faces. */ 3950 init_iterator will then free realized faces. */
3947 ++face_change_count; 3951 if (NILP (Fget (face, Qface_no_inherit)))
3948 ++windows_or_buffers_changed; 3952 {
3953 ++face_change_count;
3954 ++windows_or_buffers_changed;
3955 }
3949 3956
3950 xassert (LFACEP (lface)); 3957 xassert (LFACEP (lface));
3951 check_lface (lface); 3958 check_lface (lface);
@@ -4020,8 +4027,11 @@ The value is TO. */)
4020 depend on the face, make sure they are all removed. This is done 4027 depend on the face, make sure they are all removed. This is done
4021 by incrementing face_change_count. The next call to 4028 by incrementing face_change_count. The next call to
4022 init_iterator will then free realized faces. */ 4029 init_iterator will then free realized faces. */
4023 ++face_change_count; 4030 if (NILP (Fget (to, Qface_no_inherit)))
4024 ++windows_or_buffers_changed; 4031 {
4032 ++face_change_count;
4033 ++windows_or_buffers_changed;
4034 }
4025 4035
4026 return to; 4036 return to;
4027} 4037}
@@ -4385,6 +4395,7 @@ FRAME 0 means change the face on all frames, and change the default
4385 by incrementing face_change_count. The next call to 4395 by incrementing face_change_count. The next call to
4386 init_iterator will then free realized faces. */ 4396 init_iterator will then free realized faces. */
4387 if (!EQ (frame, Qt) 4397 if (!EQ (frame, Qt)
4398 && NILP (Fget (face, Qface_no_inherit))
4388 && (EQ (attr, QCfont) 4399 && (EQ (attr, QCfont)
4389 || EQ (attr, QCfontset) 4400 || EQ (attr, QCfontset)
4390 || NILP (Fequal (old_value, value)))) 4401 || NILP (Fequal (old_value, value))))
@@ -4538,6 +4549,7 @@ update_face_from_frame_parameter (f, param, new_value)
4538 struct frame *f; 4549 struct frame *f;
4539 Lisp_Object param, new_value; 4550 Lisp_Object param, new_value;
4540{ 4551{
4552 Lisp_Object face = Qnil;
4541 Lisp_Object lface; 4553 Lisp_Object lface;
4542 4554
4543 /* If there are no faces yet, give up. This is the case when called 4555 /* If there are no faces yet, give up. This is the case when called
@@ -4546,17 +4558,10 @@ update_face_from_frame_parameter (f, param, new_value)
4546 if (NILP (f->face_alist)) 4558 if (NILP (f->face_alist))
4547 return; 4559 return;
4548 4560
4549 /* Changing a named face means that all realized faces depending on
4550 that face are invalid. Since we cannot tell which realized faces
4551 depend on the face, make sure they are all removed. This is done
4552 by incrementing face_change_count. The next call to
4553 init_iterator will then free realized faces. */
4554 ++face_change_count;
4555 ++windows_or_buffers_changed;
4556
4557 if (EQ (param, Qforeground_color)) 4561 if (EQ (param, Qforeground_color))
4558 { 4562 {
4559 lface = lface_from_face_name (f, Qdefault, 1); 4563 face = Qdefault;
4564 lface = lface_from_face_name (f, face, 1);
4560 LFACE_FOREGROUND (lface) = (STRINGP (new_value) 4565 LFACE_FOREGROUND (lface) = (STRINGP (new_value)
4561 ? new_value : Qunspecified); 4566 ? new_value : Qunspecified);
4562 realize_basic_faces (f); 4567 realize_basic_faces (f);
@@ -4571,29 +4576,45 @@ update_face_from_frame_parameter (f, param, new_value)
4571 XSETFRAME (frame, f); 4576 XSETFRAME (frame, f);
4572 call1 (Qframe_update_face_colors, frame); 4577 call1 (Qframe_update_face_colors, frame);
4573 4578
4574 lface = lface_from_face_name (f, Qdefault, 1); 4579 face = Qdefault;
4580 lface = lface_from_face_name (f, face, 1);
4575 LFACE_BACKGROUND (lface) = (STRINGP (new_value) 4581 LFACE_BACKGROUND (lface) = (STRINGP (new_value)
4576 ? new_value : Qunspecified); 4582 ? new_value : Qunspecified);
4577 realize_basic_faces (f); 4583 realize_basic_faces (f);
4578 } 4584 }
4579 if (EQ (param, Qborder_color)) 4585 else if (EQ (param, Qborder_color))
4580 { 4586 {
4581 lface = lface_from_face_name (f, Qborder, 1); 4587 face = Qborder;
4588 lface = lface_from_face_name (f, face, 1);
4582 LFACE_BACKGROUND (lface) = (STRINGP (new_value) 4589 LFACE_BACKGROUND (lface) = (STRINGP (new_value)
4583 ? new_value : Qunspecified); 4590 ? new_value : Qunspecified);
4584 } 4591 }
4585 else if (EQ (param, Qcursor_color)) 4592 else if (EQ (param, Qcursor_color))
4586 { 4593 {
4587 lface = lface_from_face_name (f, Qcursor, 1); 4594 face = Qcursor;
4595 lface = lface_from_face_name (f, face, 1);
4588 LFACE_BACKGROUND (lface) = (STRINGP (new_value) 4596 LFACE_BACKGROUND (lface) = (STRINGP (new_value)
4589 ? new_value : Qunspecified); 4597 ? new_value : Qunspecified);
4590 } 4598 }
4591 else if (EQ (param, Qmouse_color)) 4599 else if (EQ (param, Qmouse_color))
4592 { 4600 {
4593 lface = lface_from_face_name (f, Qmouse, 1); 4601 face = Qmouse;
4602 lface = lface_from_face_name (f, face, 1);
4594 LFACE_BACKGROUND (lface) = (STRINGP (new_value) 4603 LFACE_BACKGROUND (lface) = (STRINGP (new_value)
4595 ? new_value : Qunspecified); 4604 ? new_value : Qunspecified);
4596 } 4605 }
4606
4607 /* Changing a named face means that all realized faces depending on
4608 that face are invalid. Since we cannot tell which realized faces
4609 depend on the face, make sure they are all removed. This is done
4610 by incrementing face_change_count. The next call to
4611 init_iterator will then free realized faces. */
4612 if (!NILP (face)
4613 && NILP (Fget (face, Qface_no_inherit)))
4614 {
4615 ++face_change_count;
4616 ++windows_or_buffers_changed;
4617 }
4597} 4618}
4598 4619
4599 4620
@@ -7951,6 +7972,8 @@ syms_of_xfaces ()
7951{ 7972{
7952 Qface = intern ("face"); 7973 Qface = intern ("face");
7953 staticpro (&Qface); 7974 staticpro (&Qface);
7975 Qface_no_inherit = intern ("face-no-inherit");
7976 staticpro (&Qface_no_inherit);
7954 Qbitmap_spec_p = intern ("bitmap-spec-p"); 7977 Qbitmap_spec_p = intern ("bitmap-spec-p");
7955 staticpro (&Qbitmap_spec_p); 7978 staticpro (&Qbitmap_spec_p);
7956 Qframe_update_face_colors = intern ("frame-update-face-colors"); 7979 Qframe_update_face_colors = intern ("frame-update-face-colors");
diff --git a/src/xselect.c b/src/xselect.c
index 5de1beb9ac4..1e3efd2bf54 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -744,7 +744,15 @@ x_reply_selection_request (event, format, data, size, type)
744 refering to the deleted window, and we'll get a BadWindow error 744 refering to the deleted window, and we'll get a BadWindow error
745 in XTread_socket when processing the events. I don't have 745 in XTread_socket when processing the events. I don't have
746 an idea how to fix that. gerd, 2001-01-98. */ 746 an idea how to fix that. gerd, 2001-01-98. */
747 XFlush (display); 747 /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are
748 delivered before uncatch errors. */
749 XSync (display, False);
750 UNBLOCK_INPUT;
751
752 /* GTK queues events in addition to the queue in Xlib. So we
753 UNBLOCK to enter the event loop and get possible errors delivered,
754 and then BLOCK again because x_uncatch_errors requires it. */
755 BLOCK_INPUT;
748 x_uncatch_errors (display, count); 756 x_uncatch_errors (display, count);
749 UNBLOCK_INPUT; 757 UNBLOCK_INPUT;
750} 758}