aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2004-09-13 20:33:29 +0000
committerKaroly Lorentey2004-09-13 20:33:29 +0000
commit267eea215b322b02bc4bce13cae61813c50f4b5f (patch)
tree2dec815aa97a75c7d1589e72aa814bba68d4ade9
parent5cd432338667788c6739f43e4aa37fb53cc2a125 (diff)
parentef3b7aae581ae555a11aa38f13e0eb55ad93a8c7 (diff)
downloademacs-267eea215b322b02bc4bce13cae61813c50f4b5f.tar.gz
emacs-267eea215b322b02bc4bce13cae61813c50f4b5f.zip
Merged in changes from CVS trunk.
Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-537 Update from CVS * 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 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-543 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-544 Update from CVS * 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/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 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-26 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-244
-rw-r--r--admin/ChangeLog6
-rw-r--r--admin/FOR-RELEASE193
-rw-r--r--etc/NEWS32
-rw-r--r--etc/etags.12
-rw-r--r--lib-src/ChangeLog19
-rw-r--r--lib-src/etags.c1211
-rw-r--r--lisp/ChangeLog91
-rw-r--r--lisp/ChangeLog.104
-rw-r--r--lisp/emacs-lisp/checkdoc.el5
-rw-r--r--lisp/emulation/cua-rect.el3
-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/ido.el25
-rw-r--r--lisp/isearch.el8
-rw-r--r--lisp/kmacro.el3
-rw-r--r--lisp/progmodes/compile.el53
-rw-r--r--lisp/simple.el3
-rw-r--r--lisp/textmodes/bibtex.el748
-rw-r--r--lisp/vc-hooks.el38
-rw-r--r--man/ChangeLog34
-rw-r--r--man/Makefile.in8
-rw-r--r--man/gnus.texi250
-rw-r--r--man/maintaining.texi3
-rw-r--r--man/mini.texi11
-rw-r--r--man/smtpmail.texi7
-rw-r--r--src/ChangeLog54
-rw-r--r--src/Makefile.in72
-rw-r--r--src/editfns.c10
-rw-r--r--src/msdos.c15
-rw-r--r--src/xselect.c10
34 files changed, 1841 insertions, 1168 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/NEWS b/etc/NEWS
index a2012b29093..632d5b4116b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -617,6 +617,8 @@ version 4.7 or newer, compiles to Info pages with embedded images.
617'sql-sqlite'. 617'sql-sqlite'.
618 618
619** BibTeX mode: 619** BibTeX mode:
620*** The new command bibtex-url browses a URL for the BibTeX entry at
621point (bound to C-c C-l and mouse-2 on clickable fields).
620*** The new command bibtex-entry-update (bound to C-c C-u) updates 622*** The new command bibtex-entry-update (bound to C-c C-u) updates
621an existing BibTeX entry. 623an existing BibTeX entry.
622*** New `bibtex-entry-format' option `required-fields', enabled by default. 624*** New `bibtex-entry-format' option `required-fields', enabled by default.
@@ -1172,9 +1174,9 @@ and to type `C-f' at the end of the search string in the minibuffer.
1172search string used as the string to replace. 1174search string used as the string to replace.
1173 1175
1174+++ 1176+++
1175** New user option `isearch-resume-enabled'. 1177** Isearch no longer adds `isearch-resume' commands to the command
1176This option can be disabled, to avoid the normal behavior of isearch 1178history by default. To enable this feature, customize the new
1177which puts calls to `isearch-resume' in the command history. 1179user option `isearch-resume-in-command-history'.
1178 1180
1179+++ 1181+++
1180** New user option `history-delete-duplicates'. 1182** New user option `history-delete-duplicates'.
@@ -1494,29 +1496,31 @@ per line. Lines beginning with space or tab are ignored.
1494**** The `::' qualifier triggers C++ parsing in C file. 1496**** The `::' qualifier triggers C++ parsing in C file.
1495Previously, only the `template' and `class' keywords had this effect. 1497Previously, only the `template' and `class' keywords had this effect.
1496 1498
1499**** New language HTML.
1500Title and h1, h2, h3 are tagged. Also, tags are generated when name= is
1501used inside an anchor and whenever id= is used.
1502
1503**** In Makefiles, constants are tagged.
1504If you want the old behavior instead, thus avoiding to increase the
1505size of the tags file, use the --no-globals option.
1506
1507**** In Lua, all functions are tagged.
1508
1497**** In Perl, packages are tags. 1509**** In Perl, packages are tags.
1498Subroutine tags are named from their package. You can jump to sub tags 1510Subroutine tags are named from their package. You can jump to sub tags
1499as you did before, by the sub name, or additionally by looking for 1511as you did before, by the sub name, or additionally by looking for
1500package::sub. 1512package::sub.
1501 1513
1514**** In Prolog, etags creates tags for rules in addition to predicates.
1515
1502**** New language PHP. 1516**** New language PHP.
1503Tags are functions, classes and defines. 1517Tags are functions, classes and defines.
1504If the --members option is specified to etags, tags are vars also. 1518If the --members option is specified to etags, tags are vars also.
1505 1519
1506**** New language HTML.
1507Title and h1, h2, h3 are tagged. Also, tags are generated when name= is
1508used inside an anchor and whenever id= is used.
1509
1510**** New default keywords for TeX. 1520**** New default keywords for TeX.
1511The new keywords are def, newcommand, renewcommand, newenvironment and 1521The new keywords are def, newcommand, renewcommand, newenvironment and
1512renewenvironment. 1522renewenvironment.
1513 1523
1514**** In Makefiles, constants are tagged.
1515If you want the old behavior instead, thus avoiding to increase the
1516size of the tags file, use the --no-globals option.
1517
1518**** In Prolog, etags creates tags for rules in addition to predicates.
1519
1520*** Honour #line directives. 1524*** Honour #line directives.
1521When Etags parses an input file that contains C preprocessor's #line 1525When Etags parses an input file that contains C preprocessor's #line
1522directives, it creates tags using the file name and line number 1526directives, it creates tags using the file name and line number
@@ -1527,7 +1531,7 @@ writes tags pointing to the source file.
1527*** New option --parse-stdin=FILE. 1531*** New option --parse-stdin=FILE.
1528This option is mostly useful when calling etags from programs. It can 1532This option is mostly useful when calling etags from programs. It can
1529be used (only once) in place of a file name on the command line. Etags 1533be used (only once) in place of a file name on the command line. Etags
1530reads from standard input and mark the produced tags as belonging to 1534reads from standard input and marks the produced tags as belonging to
1531the file FILE. 1535the file FILE.
1532 1536
1533+++ 1537+++
diff --git a/etc/etags.1 b/etc/etags.1
index 8aa2fd51750..5bb43707f6e 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
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 909a5717bcc..b0960f9a98b 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,22 @@
12004-09-13 Francesco Potort,Al(B <pot@gnu.org>
2
3 * etags.c [EXIT_SUCCESS, EXIT_FAILURE]: Define them when no
4 <stdlib.h> is available.
5 (enum sym_type): New st_C_attribute value for parsing
6 gcc's __attribute__. Deleted st_C_typespec value.
7 (gperf, in_word_set): Use gperf 3, options changed. Added the
8 __attribute__ keyword, removed all the st_C_typespec keywords,
9 changed attribute for Java to (C_JAVA & !C_PLPL).
10 (inattribute): New global bool, part of the C state machine.
11 (cblev): Identifier renamed to bracelev throughout.
12 (consider_token, C_entries): Numerous changes for making the
13 parser more robust and adding support for __attribute__.
14
152004-09-13 David A. Capello <dacap@users.sourceforge.net> (tiny change)
16
17 * etags.c: (Lua_suffixes, Lua_help, lang_names, Lua_functions):
18 Support the Lua scripting language <http://www.lua.org>.
19
12004-09-08 Francesco Potort,Al(B <pot@gnu.org> 202004-09-08 Francesco Potort,Al(B <pot@gnu.org>
2 21
3 * etags.c: [LONG_OPTIONS]: make it TRUE (ifdef) or FALSE (ifndef) 22 * 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..f68c2e2bb95 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.4";
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 },
@@ -2373,11 +2392,11 @@ enum sym_type
2373 st_none, 2392 st_none,
2374 st_C_objprot, st_C_objimpl, st_C_objend, 2393 st_C_objprot, st_C_objimpl, st_C_objend,
2375 st_C_gnumacro, 2394 st_C_gnumacro,
2376 st_C_ignore, 2395 st_C_ignore, st_C_attribute,
2377 st_C_javastruct, 2396 st_C_javastruct,
2378 st_C_operator, 2397 st_C_operator,
2379 st_C_class, st_C_template, 2398 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 2399 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef
2381}; 2400};
2382 2401
2383static unsigned int hash __P((const char *, unsigned int)); 2402static unsigned int hash __P((const char *, unsigned int));
@@ -2385,79 +2404,67 @@ static struct C_stab_entry * in_word_set __P((const char *, unsigned int));
2385static enum sym_type C_symtype __P((char *, int, int)); 2404static enum sym_type C_symtype __P((char *, int, int));
2386 2405
2387/* Feed stuff between (but not including) %[ and %] lines to: 2406/* Feed stuff between (but not including) %[ and %] lines to:
2388 gperf -c -k 1,3 -o -p -r -t 2407 gperf -m 5
2389%[ 2408%[
2409%compare-strncmp
2410%enum
2411%struct-type
2390struct C_stab_entry { char *name; int c_ext; enum sym_type type; } 2412struct C_stab_entry { char *name; int c_ext; enum sym_type type; }
2391%% 2413%%
2392if, 0, st_C_ignore 2414if, 0, st_C_ignore
2393for, 0, st_C_ignore 2415for, 0, st_C_ignore
2394while, 0, st_C_ignore 2416while, 0, st_C_ignore
2395switch, 0, st_C_ignore 2417switch, 0, st_C_ignore
2396return, 0, st_C_ignore 2418return, 0, st_C_ignore
2397@interface, 0, st_C_objprot 2419__attribute__, 0, st_C_attribute
2398@protocol, 0, st_C_objprot 2420@interface, 0, st_C_objprot
2399@implementation,0, st_C_objimpl 2421@protocol, 0, st_C_objprot
2400@end, 0, st_C_objend 2422@implementation,0, st_C_objimpl
2401import, C_JAVA, st_C_ignore 2423@end, 0, st_C_objend
2402package, C_JAVA, st_C_ignore 2424import, (C_JAVA & !C_PLPL), st_C_ignore
2403friend, C_PLPL, st_C_ignore 2425package, (C_JAVA & !C_PLPL), st_C_ignore
2404extends, C_JAVA, st_C_javastruct 2426friend, C_PLPL, st_C_ignore
2405implements, C_JAVA, st_C_javastruct 2427extends, (C_JAVA & !C_PLPL), st_C_javastruct
2406interface, C_JAVA, st_C_struct 2428implements, (C_JAVA & !C_PLPL), st_C_javastruct
2407class, 0, st_C_class 2429interface, (C_JAVA & !C_PLPL), st_C_struct
2408namespace, C_PLPL, st_C_struct 2430class, 0, st_C_class
2409domain, C_STAR, st_C_struct 2431namespace, C_PLPL, st_C_struct
2410union, 0, st_C_struct 2432domain, C_STAR, st_C_struct
2411struct, 0, st_C_struct 2433union, 0, st_C_struct
2412extern, 0, st_C_extern 2434struct, 0, st_C_struct
2413enum, 0, st_C_enum 2435extern, 0, st_C_extern
2414typedef, 0, st_C_typedef 2436enum, 0, st_C_enum
2415define, 0, st_C_define 2437typedef, 0, st_C_typedef
2416operator, C_PLPL, st_C_operator 2438define, 0, st_C_define
2417template, 0, st_C_template 2439operator, C_PLPL, st_C_operator
2418bool, C_PLPL, st_C_typespec 2440template, 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). 2441# DEFUN used in emacs, the next three used in glibc (SYSCALL only for mach).
2436DEFUN, 0, st_C_gnumacro 2442DEFUN, 0, st_C_gnumacro
2437SYSCALL, 0, st_C_gnumacro 2443SYSCALL, 0, st_C_gnumacro
2438ENTRY, 0, st_C_gnumacro 2444ENTRY, 0, st_C_gnumacro
2439PSEUDO, 0, st_C_gnumacro 2445PSEUDO, 0, st_C_gnumacro
2440# These are defined inside C functions, so currently they are not met. 2446# These are defined inside C functions, so currently they are not met.
2441# EXFUN used in glibc, DEFVAR_* in emacs. 2447# EXFUN used in glibc, DEFVAR_* in emacs.
2442#EXFUN, 0, st_C_gnumacro 2448#EXFUN, 0, st_C_gnumacro
2443#DEFVAR_, 0, st_C_gnumacro 2449#DEFVAR_, 0, st_C_gnumacro
2444%] 2450%]
2445and replace lines between %< and %> with its output, 2451and replace lines between %< and %> with its output, then:
2446then make in_word_set and C_stab_entry static. */ 2452 - remove the #if characterset check
2453 - make in_word_set static and not inline. */
2447/*%<*/ 2454/*%<*/
2448/* C code produced by gperf version 2.7.1 (19981006 egcs) */ 2455/* C code produced by gperf version 3.0.1 */
2449/* Command-line: gperf -c -k 1,3 -o -p -r -t */ 2456/* Command-line: gperf -m 5 */
2450struct C_stab_entry { char *name; int c_ext; enum sym_type type; }; 2457/* Computed positions: -k'1-2' */
2451 2458
2452#define TOTAL_KEYWORDS 47 2459struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
2453#define MIN_WORD_LENGTH 2 2460/* 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 2461
2459#ifdef __GNUC__ 2462#ifdef __GNUC__
2460__inline 2463__inline
2464#else
2465#ifdef __cplusplus
2466inline
2467#endif
2461#endif 2468#endif
2462static unsigned int 2469static unsigned int
2463hash (str, len) 2470hash (str, len)
@@ -2466,132 +2473,84 @@ hash (str, len)
2466{ 2473{
2467 static unsigned char asso_values[] = 2474 static unsigned char asso_values[] =
2468 { 2475 {
2469 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2476 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2470 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2477 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2471 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2478 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2472 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2479 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2473 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2480 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2474 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2481 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2475 139, 139, 139, 139, 63, 139, 139, 139, 33, 44, 2482 34, 34, 34, 34, 1, 34, 34, 34, 14, 14,
2476 62, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2483 34, 34, 34, 34, 34, 34, 34, 34, 13, 34,
2477 42, 139, 139, 12, 32, 139, 139, 139, 139, 139, 2484 13, 34, 34, 12, 34, 34, 34, 34, 34, 11,
2478 139, 139, 139, 139, 139, 139, 139, 34, 59, 37, 2485 34, 34, 34, 34, 34, 8, 34, 11, 34, 12,
2479 24, 58, 33, 3, 139, 16, 139, 139, 42, 60, 2486 11, 0, 1, 34, 7, 0, 34, 34, 11, 9,
2480 18, 11, 39, 139, 23, 57, 4, 63, 6, 20, 2487 0, 4, 0, 34, 7, 4, 14, 21, 34, 15,
2481 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2488 0, 2, 34, 34, 34, 34, 34, 34, 34, 34,
2482 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2489 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2483 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2490 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2484 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2491 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2485 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2492 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2486 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2493 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2487 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2494 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2488 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2495 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2489 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2496 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2490 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2497 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2491 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2498 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2492 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2499 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2493 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, 2500 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
2494 139, 139, 139, 139, 139, 139 2501 34, 34, 34, 34, 34, 34
2495 }; 2502 };
2496 register int hval = len; 2503 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} 2504}
2510 2505
2511#ifdef __GNUC__
2512__inline
2513#endif
2514static struct C_stab_entry * 2506static struct C_stab_entry *
2515in_word_set (str, len) 2507in_word_set (str, len)
2516 register const char *str; 2508 register const char *str;
2517 register unsigned int len; 2509 register unsigned int len;
2518{ 2510{
2511 enum
2512 {
2513 TOTAL_KEYWORDS = 31,
2514 MIN_WORD_LENGTH = 2,
2515 MAX_WORD_LENGTH = 15,
2516 MIN_HASH_VALUE = 3,
2517 MAX_HASH_VALUE = 33
2518 };
2519
2519 static struct C_stab_entry wordlist[] = 2520 static struct C_stab_entry wordlist[] =
2520 { 2521 {
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 {""}, {""}, {""}, 2522 {""}, {""}, {""},
2542 {"friend", C_PLPL, st_C_ignore}, 2523 {"if", 0, st_C_ignore},
2543 {"volatile", 0, st_C_typespec}, 2524 {"enum", 0, st_C_enum},
2544 {""}, {""}, 2525 {"@end", 0, st_C_objend},
2545 {"for", 0, st_C_ignore}, 2526 {"extern", 0, st_C_extern},
2546 {"const", 0, st_C_typespec}, 2527 {"extends", (C_JAVA & !C_PLPL), st_C_javastruct},
2547 {"import", C_JAVA, st_C_ignore}, 2528 {"for", 0, st_C_ignore},
2548 {""}, 2529 {"interface", (C_JAVA & !C_PLPL), st_C_struct},
2549 {"define", 0, st_C_define}, 2530 {"@protocol", 0, st_C_objprot},
2550 {"long", 0, st_C_typespec}, 2531 {"@interface", 0, st_C_objprot},
2551 {"implements", C_JAVA, st_C_javastruct}, 2532 {"operator", C_PLPL, st_C_operator},
2552 {"signed", 0, st_C_typespec}, 2533 {"return", 0, st_C_ignore},
2553 {""}, 2534 {"friend", C_PLPL, st_C_ignore},
2554 {"extern", 0, st_C_extern}, 2535 {"import", (C_JAVA & !C_PLPL), st_C_ignore},
2555 {"extends", C_JAVA, st_C_javastruct}, 2536 {"@implementation",0, st_C_objimpl},
2556 {""}, 2537 {"define", 0, st_C_define},
2557 {"mutable", C_PLPL, st_C_typespec}, 2538 {"package", (C_JAVA & !C_PLPL), st_C_ignore},
2558 {"template", 0, st_C_template}, 2539 {"implements", (C_JAVA & !C_PLPL), st_C_javastruct},
2559 {"short", 0, st_C_typespec}, 2540 {"namespace", C_PLPL, st_C_struct},
2560 {"bool", C_PLPL, st_C_typespec}, 2541 {"domain", C_STAR, st_C_struct},
2561 {"char", 0, st_C_typespec}, 2542 {"template", 0, st_C_template},
2562 {"class", 0, st_C_class}, 2543 {"typedef", 0, st_C_typedef},
2563 {"operator", C_PLPL, st_C_operator}, 2544 {"struct", 0, st_C_struct},
2564 {""}, 2545 {"switch", 0, st_C_ignore},
2565 {"switch", 0, st_C_ignore}, 2546 {"union", 0, st_C_struct},
2566 {""}, 2547 {"while", 0, st_C_ignore},
2567 {"ENTRY", 0, st_C_gnumacro}, 2548 {"class", 0, st_C_class},
2568 {""}, 2549 {"__attribute__", 0, st_C_attribute},
2569 {"package", C_JAVA, st_C_ignore}, 2550 {"SYSCALL", 0, st_C_gnumacro},
2570 {"union", 0, st_C_struct}, 2551 {"PSEUDO", 0, st_C_gnumacro},
2571 {"@end", 0, st_C_objend}, 2552 {"ENTRY", 0, st_C_gnumacro},
2572 {"struct", 0, st_C_struct}, 2553 {"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 }; 2554 };
2596 2555
2597 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 2556 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -2602,7 +2561,7 @@ in_word_set (str, len)
2602 { 2561 {
2603 register const char *s = wordlist[key].name; 2562 register const char *s = wordlist[key].name;
2604 2563
2605 if (*str == *s && !strncmp (str + 1, s + 1, len - 1)) 2564 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
2606 return &wordlist[key]; 2565 return &wordlist[key];
2607 } 2566 }
2608 } 2567 }
@@ -2625,6 +2584,11 @@ C_symtype (str, len, c_ext)
2625 2584
2626 2585
2627/* 2586/*
2587 * Ignoring __attribute__ ((list))
2588 */
2589static bool inattribute; /* looking at an __attribute__ construct */
2590
2591/*
2628 * C functions and variables are recognized using a simple 2592 * C functions and variables are recognized using a simple
2629 * finite automaton. fvdef is its state variable. 2593 * finite automaton. fvdef is its state variable.
2630 */ 2594 */
@@ -2666,10 +2630,9 @@ static enum
2666static enum 2630static enum
2667{ 2631{
2668 snone, /* nothing seen yet, 2632 snone, /* nothing seen yet,
2669 or in struct body if cblev > 0 */ 2633 or in struct body if bracelev > 0 */
2670 skeyseen, /* struct-like keyword seen */ 2634 skeyseen, /* struct-like keyword seen */
2671 stagseen, /* struct-like tag seen */ 2635 stagseen, /* struct-like tag seen */
2672 sintemplate, /* inside template (ignore) */
2673 scolonseen /* colon seen after struct-like tag */ 2636 scolonseen /* colon seen after struct-like tag */
2674} structdef; 2637} structdef;
2675 2638
@@ -2743,7 +2706,7 @@ static void write_classname __P((linebuffer *, char *qualifier));
2743 2706
2744static struct { 2707static struct {
2745 char **cname; /* nested class names */ 2708 char **cname; /* nested class names */
2746 int *cblev; /* nested class curly brace level */ 2709 int *bracelev; /* nested class brace level */
2747 int nl; /* class nesting level (elements used) */ 2710 int nl; /* class nesting level (elements used) */
2748 int size; /* length of the array */ 2711 int size; /* length of the array */
2749} cstack; /* stack for nested declaration tags */ 2712} cstack; /* stack for nested declaration tags */
@@ -2751,38 +2714,38 @@ static struct {
2751#define nestlev (cstack.nl) 2714#define nestlev (cstack.nl)
2752/* After struct keyword or in struct body, not inside a nested function. */ 2715/* After struct keyword or in struct body, not inside a nested function. */
2753#define instruct (structdef == snone && nestlev > 0 \ 2716#define instruct (structdef == snone && nestlev > 0 \
2754 && cblev == cstack.cblev[nestlev-1] + 1) 2717 && bracelev == cstack.bracelev[nestlev-1] + 1)
2755 2718
2756static void 2719static void
2757pushclass_above (cblev, str, len) 2720pushclass_above (bracelev, str, len)
2758 int cblev; 2721 int bracelev;
2759 char *str; 2722 char *str;
2760 int len; 2723 int len;
2761{ 2724{
2762 int nl; 2725 int nl;
2763 2726
2764 popclass_above (cblev); 2727 popclass_above (bracelev);
2765 nl = cstack.nl; 2728 nl = cstack.nl;
2766 if (nl >= cstack.size) 2729 if (nl >= cstack.size)
2767 { 2730 {
2768 int size = cstack.size *= 2; 2731 int size = cstack.size *= 2;
2769 xrnew (cstack.cname, size, char *); 2732 xrnew (cstack.cname, size, char *);
2770 xrnew (cstack.cblev, size, int); 2733 xrnew (cstack.bracelev, size, int);
2771 } 2734 }
2772 assert (nl == 0 || cstack.cblev[nl-1] < cblev); 2735 assert (nl == 0 || cstack.bracelev[nl-1] < bracelev);
2773 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len); 2736 cstack.cname[nl] = (str == NULL) ? NULL : savenstr (str, len);
2774 cstack.cblev[nl] = cblev; 2737 cstack.bracelev[nl] = bracelev;
2775 cstack.nl = nl + 1; 2738 cstack.nl = nl + 1;
2776} 2739}
2777 2740
2778static void 2741static void
2779popclass_above (cblev) 2742popclass_above (bracelev)
2780 int cblev; 2743 int bracelev;
2781{ 2744{
2782 int nl; 2745 int nl;
2783 2746
2784 for (nl = cstack.nl - 1; 2747 for (nl = cstack.nl - 1;
2785 nl >= 0 && cstack.cblev[nl] >= cblev; 2748 nl >= 0 && cstack.bracelev[nl] >= bracelev;
2786 nl--) 2749 nl--)
2787 { 2750 {
2788 if (cstack.cname[nl] != NULL) 2751 if (cstack.cname[nl] != NULL)
@@ -2849,269 +2812,286 @@ static void make_C_tag __P((bool));
2849 */ 2812 */
2850 2813
2851static bool 2814static bool
2852consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var) 2815consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
2853 register char *str; /* IN: token pointer */ 2816 register char *str; /* IN: token pointer */
2854 register int len; /* IN: token length */ 2817 register int len; /* IN: token length */
2855 register int c; /* IN: first char after the token */ 2818 register int c; /* IN: first char after the token */
2856 int *c_extp; /* IN, OUT: C extensions mask */ 2819 int *c_extp; /* IN, OUT: C extensions mask */
2857 int cblev; /* IN: curly brace level */ 2820 int bracelev; /* IN: brace level */
2858 int parlev; /* IN: parenthesis level */ 2821 int parlev; /* IN: parenthesis level */
2859 bool *is_func_or_var; /* OUT: function or variable found */ 2822 bool *is_func_or_var; /* OUT: function or variable found */
2860{ 2823{
2861 /* When structdef is stagseen, scolonseen, or snone with cblev > 0, 2824 /* When structdef is stagseen, scolonseen, or snone with bracelev > 0,
2862 structtype is the type of the preceding struct-like keyword, and 2825 structtype is the type of the preceding struct-like keyword, and
2863 structcblev is the curly brace level where it has been seen. */ 2826 structbracelev is the brace level where it has been seen. */
2864 static enum sym_type structtype; 2827 static enum sym_type structtype;
2865 static int structcblev; 2828 static int structbracelev;
2866 static enum sym_type toktype; 2829 static enum sym_type toktype;
2867 2830
2868 2831
2869 toktype = C_symtype (str, len, *c_extp); 2832 toktype = C_symtype (str, len, *c_extp);
2870 2833
2871 /* 2834 /*
2872 * Advance the definedef state machine. 2835 * 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 */ 2836 */
2962 switch (toktype) 2837 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 { 2838 {
2994 structdef = stagseen; 2839 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; 2840 return FALSE;
3020 case oprotocol: 2841 }
3021 /* Save the class tag for categories. */ 2842
3022 objtag = savenstr (str, len); 2843 /*
3023 objdef = otagseen; 2844 * Advance the definedef state machine.
3024 *is_func_or_var = TRUE; 2845 */
3025 return TRUE; 2846 switch (definedef)
3026 case oparenseen: 2847 {
3027 objdef = ocatseen; 2848 case dnone:
3028 *is_func_or_var = TRUE; 2849 /* We're not on a preprocessor line. */
3029 return TRUE; 2850 if (toktype == st_C_gnumacro)
3030 case oinbody: 2851 {
3031 break; 2852 fvdef = fdefunkey;
3032 case omethodsign: 2853 return FALSE;
3033 if (parlev == 0) 2854 }
3034 { 2855 break;
3035 objdef = omethodtag; 2856 case dsharpseen:
3036 linebuffer_setlen (&token_name, len); 2857 if (toktype == st_C_define)
3037 strncpy (token_name.buffer, str, len); 2858 {
3038 token_name.buffer[len] = '\0'; 2859 definedef = ddefineseen;
3039 return TRUE; 2860 }
3040 } 2861 else
3041 return FALSE; 2862 {
3042 case omethodcolon: 2863 definedef = dignorerest;
3043 if (parlev == 0) 2864 }
3044 objdef = omethodparm; 2865 return FALSE;
3045 return FALSE; 2866 case ddefineseen:
3046 case omethodparm: 2867 /*
3047 if (parlev == 0) 2868 * Make a tag for any macro, unless it is a constant
3048 { 2869 * and constantypedefs is FALSE.
3049 objdef = omethodtag; 2870 */
3050 linebuffer_setlen (&token_name, token_name.len + len); 2871 definedef = dignorerest;
3051 strncat (token_name.buffer, str, len); 2872 *is_func_or_var = (c == '(');
3052 return TRUE; 2873 if (!*is_func_or_var && !constantypedefs)
3053 } 2874 return FALSE;
3054 return FALSE; 2875 else
3055 case oignore: 2876 return TRUE;
3056 if (toktype == st_C_objend) 2877 case dignorerest:
3057 { 2878 return FALSE;
3058 /* Memory leakage here: the string pointed by objtag is 2879 default:
3059 never released, because many tests would be needed to 2880 error ("internal error: definedef value.", (char *)NULL);
3060 avoid breaking on incorrect input code. The amount of 2881 }
3061 memory leaked here is the sum of the lengths of the 2882
3062 class tags. 2883 /*
3063 free (objtag); */ 2884 * Now typedefs
3064 objdef = onone; 2885 */
3065 } 2886 switch (typdef)
3066 return FALSE; 2887 {
3067 } 2888 case tnone:
3068 2889 if (toktype == st_C_typedef)
3069 /* A function, variable or enum constant? */ 2890 {
3070 switch (toktype) 2891 if (typedefs)
3071 { 2892 typdef = tkeyseen;
3072 case st_C_extern: 2893 fvextern = FALSE;
3073 fvextern = TRUE; 2894 fvdef = fvnone;
3074 /* FALLTHRU */ 2895 return FALSE;
3075 case st_C_typespec: 2896 }
3076 switch (fvdef) 2897 break;
3077 { 2898 case tkeyseen:
3078 case finlist: 2899 switch (toktype)
3079 case flistseen: 2900 {
3080 case fignore: 2901 case st_none:
3081 case vignore: 2902 case st_C_class:
3082 break; 2903 case st_C_struct:
3083 default: 2904 case st_C_enum:
3084 fvdef = fvnone; 2905 typdef = ttypeseen;
3085 } 2906 }
3086 return FALSE; 2907 break;
3087 case st_C_ignore: 2908 case ttypeseen:
3088 fvextern = FALSE; 2909 if (structdef == snone && fvdef == fvnone)
3089 fvdef = vignore; 2910 {
3090 return FALSE; 2911 fvdef = fvnameseen;
3091 case st_C_operator: 2912 return TRUE;
3092 fvdef = foperator; 2913 }
3093 *is_func_or_var = TRUE; 2914 break;
3094 return TRUE; 2915 case tend:
3095 case st_none: 2916 switch (toktype)
3096 if (constantypedefs 2917 {
3097 && structdef == snone 2918 case st_C_class:
3098 && structtype == st_C_enum && cblev > structcblev) 2919 case st_C_struct:
3099 return TRUE; /* enum constant */ 2920 case st_C_enum:
3100 switch (fvdef) 2921 return FALSE;
3101 { 2922 }
3102 case fdefunkey: 2923 return TRUE;
3103 if (cblev > 0) 2924 }
3104 break; 2925
3105 fvdef = fdefunname; /* GNU macro */ 2926 /*
3106 *is_func_or_var = TRUE; 2927 * This structdef business is NOT invoked when we are ctags and the
3107 return TRUE; 2928 * file is plain C. This is because a struct tag may have the same
3108 case fvnone: 2929 * name as another tag, and this loses with ctags.
3109 if ((strneq (str, "asm", 3) && endtoken (str[3])) 2930 */
3110 || (strneq (str, "__asm__", 7) && endtoken (str[7]))) 2931 switch (toktype)
3111 { 2932 {
3112 fvdef = vignore; 2933 case st_C_javastruct:
3113 return FALSE; 2934 if (structdef == stagseen)
3114 } 2935 structdef = scolonseen;
2936 return FALSE;
2937 case st_C_template:
2938 case st_C_class:
2939 if ((*c_extp & C_AUTO) /* automatic detection of C++ language */
2940 && bracelev == 0
2941 && definedef == dnone && structdef == snone
2942 && typdef == tnone && fvdef == fvnone)
2943 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
2944 if (toktype == st_C_template)
2945 break;
2946 /* FALLTHRU */
2947 case st_C_struct:
2948 case st_C_enum:
2949 if (parlev == 0
2950 && fvdef != vignore
2951 && (typdef == tkeyseen
2952 || (typedefs_or_cplusplus && structdef == snone)))
2953 {
2954 structdef = skeyseen;
2955 structtype = toktype;
2956 structbracelev = bracelev;
2957 if (fvdef == fvnameseen)
2958 fvdef = fvnone;
2959 }
2960 return FALSE;
2961 }
2962
2963 if (structdef == skeyseen)
2964 {
2965 structdef = stagseen;
2966 return TRUE;
2967 }
2968
2969 if (typdef != tnone)
2970 definedef = dnone;
2971
2972 /* Detect Objective C constructs. */
2973 switch (objdef)
2974 {
2975 case onone:
2976 switch (toktype)
2977 {
2978 case st_C_objprot:
2979 objdef = oprotocol;
2980 return FALSE;
2981 case st_C_objimpl:
2982 objdef = oimplementation;
2983 return FALSE;
2984 }
2985 break;
2986 case oimplementation:
2987 /* Save the class tag for functions or variables defined inside. */
2988 objtag = savenstr (str, len);
2989 objdef = oinbody;
2990 return FALSE;
2991 case oprotocol:
2992 /* Save the class tag for categories. */
2993 objtag = savenstr (str, len);
2994 objdef = otagseen;
2995 *is_func_or_var = TRUE;
2996 return TRUE;
2997 case oparenseen:
2998 objdef = ocatseen;
2999 *is_func_or_var = TRUE;
3000 return TRUE;
3001 case oinbody:
3002 break;
3003 case omethodsign:
3004 if (parlev == 0)
3005 {
3006 fvdef = fvnone;
3007 objdef = omethodtag;
3008 linebuffer_setlen (&token_name, len);
3009 strncpy (token_name.buffer, str, len);
3010 token_name.buffer[len] = '\0';
3011 return TRUE;
3012 }
3013 return FALSE;
3014 case omethodcolon:
3015 if (parlev == 0)
3016 objdef = omethodparm;
3017 return FALSE;
3018 case omethodparm:
3019 if (parlev == 0)
3020 {
3021 fvdef = fvnone;
3022 objdef = omethodtag;
3023 linebuffer_setlen (&token_name, token_name.len + len);
3024 strncat (token_name.buffer, str, len);
3025 return TRUE;
3026 }
3027 return FALSE;
3028 case oignore:
3029 if (toktype == st_C_objend)
3030 {
3031 /* Memory leakage here: the string pointed by objtag is
3032 never released, because many tests would be needed to
3033 avoid breaking on incorrect input code. The amount of
3034 memory leaked here is the sum of the lengths of the
3035 class tags.
3036 free (objtag); */
3037 objdef = onone;
3038 }
3039 return FALSE;
3040 }
3041
3042 /* A function, variable or enum constant? */
3043 switch (toktype)
3044 {
3045 case st_C_extern:
3046 fvextern = TRUE;
3047 switch (fvdef)
3048 {
3049 case finlist:
3050 case flistseen:
3051 case fignore:
3052 case vignore:
3053 break;
3054 default:
3055 fvdef = fvnone;
3056 }
3057 return FALSE;
3058 case st_C_ignore:
3059 fvextern = FALSE;
3060 fvdef = vignore;
3061 return FALSE;
3062 case st_C_operator:
3063 fvdef = foperator;
3064 *is_func_or_var = TRUE;
3065 return TRUE;
3066 case st_none:
3067 if (constantypedefs
3068 && structdef == snone
3069 && structtype == st_C_enum && bracelev > structbracelev)
3070 return TRUE; /* enum constant */
3071 switch (fvdef)
3072 {
3073 case fdefunkey:
3074 if (bracelev > 0)
3075 break;
3076 fvdef = fdefunname; /* GNU macro */
3077 *is_func_or_var = TRUE;
3078 return TRUE;
3079 case fvnone:
3080 switch (typdef)
3081 {
3082 case ttypeseen:
3083 return FALSE;
3084 case tnone:
3085 if ((strneq (str, "asm", 3) && endtoken (str[3]))
3086 || (strneq (str, "__asm__", 7) && endtoken (str[7])))
3087 {
3088 fvdef = vignore;
3089 return FALSE;
3090 }
3091 break;
3092 }
3093 /* FALLTHRU */
3094 case fvnameseen:
3115 if (len >= 10 && strneq (str+len-10, "::operator", 10)) 3095 if (len >= 10 && strneq (str+len-10, "::operator", 10))
3116 { 3096 {
3117 if (*c_extp & C_AUTO) /* automatic detection of C++ */ 3097 if (*c_extp & C_AUTO) /* automatic detection of C++ */
@@ -3120,7 +3100,7 @@ consider_token (str, len, c, c_extp, cblev, parlev, is_func_or_var)
3120 *is_func_or_var = TRUE; 3100 *is_func_or_var = TRUE;
3121 return TRUE; 3101 return TRUE;
3122 } 3102 }
3123 if (cblev > 0 && !instruct) 3103 if (bracelev > 0 && !instruct)
3124 break; 3104 break;
3125 fvdef = fvnameseen; /* function or variable */ 3105 fvdef = fvnameseen; /* function or variable */
3126 *is_func_or_var = TRUE; 3106 *is_func_or_var = TRUE;
@@ -3216,9 +3196,12 @@ C_entries (c_ext, inf)
3216 register int toklen; /* length of current token */ 3196 register int toklen; /* length of current token */
3217 char *qualifier; /* string used to qualify names */ 3197 char *qualifier; /* string used to qualify names */
3218 int qlen; /* length of qualifier */ 3198 int qlen; /* length of qualifier */
3219 int cblev; /* current curly brace level */ 3199 int bracelev; /* current brace level */
3200 int bracketlev; /* current bracket level */
3220 int parlev; /* current parenthesis level */ 3201 int parlev; /* current parenthesis level */
3221 int typdefcblev; /* cblev where a typedef struct body begun */ 3202 int attrparlev; /* __attribute__ parenthesis level */
3203 int templatelev; /* current template level */
3204 int typdefbracelev; /* bracelev where a typedef struct body begun */
3222 bool incomm, inquote, inchar, quotednl, midtoken; 3205 bool incomm, inquote, inchar, quotednl, midtoken;
3223 bool yacc_rules; /* in the rules part of a yacc file */ 3206 bool yacc_rules; /* in the rules part of a yacc file */
3224 struct tok savetoken; /* token saved during preprocessor handling */ 3207 struct tok savetoken; /* token saved during preprocessor handling */
@@ -3231,10 +3214,10 @@ C_entries (c_ext, inf)
3231 cstack.size = (DEBUG) ? 1 : 4; 3214 cstack.size = (DEBUG) ? 1 : 4;
3232 cstack.nl = 0; 3215 cstack.nl = 0;
3233 cstack.cname = xnew (cstack.size, char *); 3216 cstack.cname = xnew (cstack.size, char *);
3234 cstack.cblev = xnew (cstack.size, int); 3217 cstack.bracelev = xnew (cstack.size, int);
3235 } 3218 }
3236 3219
3237 tokoff = toklen = typdefcblev = 0; /* keep compiler quiet */ 3220 tokoff = toklen = typdefbracelev = 0; /* keep compiler quiet */
3238 curndx = newndx = 0; 3221 curndx = newndx = 0;
3239 lp = curlb.buffer; 3222 lp = curlb.buffer;
3240 *lp = 0; 3223 *lp = 0;
@@ -3244,8 +3227,7 @@ C_entries (c_ext, inf)
3244 yacc_rules = FALSE; 3227 yacc_rules = FALSE;
3245 midtoken = inquote = inchar = incomm = quotednl = FALSE; 3228 midtoken = inquote = inchar = incomm = quotednl = FALSE;
3246 token.valid = savetoken.valid = FALSE; 3229 token.valid = savetoken.valid = FALSE;
3247 cblev = 0; 3230 bracelev = bracketlev = parlev = attrparlev = templatelev = 0;
3248 parlev = 0;
3249 if (cjava) 3231 if (cjava)
3250 { qualifier = "."; qlen = 1; } 3232 { qualifier = "."; qlen = 1; }
3251 else 3233 else
@@ -3257,8 +3239,8 @@ C_entries (c_ext, inf)
3257 c = *lp++; 3239 c = *lp++;
3258 if (c == '\\') 3240 if (c == '\\')
3259 { 3241 {
3260 /* If we're at the end of the line, the next character is a 3242 /* 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 3243 '\0'; do not skip it, because it is what tells us
3262 to read the next line. */ 3244 to read the next line. */
3263 if (*lp == '\0') 3245 if (*lp == '\0')
3264 { 3246 {
@@ -3317,95 +3299,115 @@ C_entries (c_ext, inf)
3317 } 3299 }
3318 continue; 3300 continue;
3319 } 3301 }
3320 else 3302 else if (bracketlev > 0)
3321 switch (c) 3303 {
3322 { 3304 switch (c)
3323 case '"': 3305 {
3324 inquote = TRUE; 3306 case ']':
3325 switch (fvdef) 3307 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; 3308 continue;
3352 }
3353 else if (/* cplpl && */ *lp == '/')
3354 {
3355 c = '\0';
3356 break;
3357 }
3358 else
3359 break; 3309 break;
3360 case '%': 3310 case '\0':
3361 if ((c_ext & YACC) && *lp == '%') 3311 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; 3312 break;
3374 case '#': 3313 }
3375 if (definedef == dnone) 3314 continue;
3376 { 3315 }
3377 char *cp; 3316 else switch (c)
3378 bool cpptoken = TRUE; 3317 {
3379 3318 case '"':
3380 /* Look back on this line. If all blanks, or nonblanks 3319 inquote = TRUE;
3381 followed by an end of comment, this is a preprocessor 3320 if (inattribute)
3382 token. */ 3321 break;
3383 for (cp = newlb.buffer; cp < lp-1; cp++) 3322 switch (fvdef)
3384 if (!iswhite (*cp)) 3323 {
3385 { 3324 case fdefunkey:
3386 if (*cp == '*' && *(cp+1) == '/') 3325 case fstartlist:
3387 { 3326 case finlist:
3388 cp++; 3327 case fignore:
3389 cpptoken = TRUE; 3328 case vignore:
3390 } 3329 break;
3391 else 3330 default:
3392 cpptoken = FALSE; 3331 fvextern = FALSE;
3393 } 3332 fvdef = fvnone;
3394 if (cpptoken) 3333 }
3395 definedef = dsharpseen; 3334 continue;
3396 } /* if (definedef == dnone) */ 3335 case '\'':
3397 3336 inchar = TRUE;
3337 if (inattribute)
3338 break;
3339 if (fvdef != finlist && fvdef != fignore && fvdef !=vignore)
3340 {
3341 fvextern = FALSE;
3342 fvdef = fvnone;
3343 }
3344 continue;
3345 case '/':
3346 if (*lp == '*')
3347 {
3348 lp++;
3349 incomm = TRUE;
3350 continue;
3351 }
3352 else if (/* cplpl && */ *lp == '/')
3353 {
3354 c = '\0';
3355 break;
3356 }
3357 else
3358 break;
3359 case '%':
3360 if ((c_ext & YACC) && *lp == '%')
3361 {
3362 /* Entering or exiting rules section in yacc file. */
3363 lp++;
3364 definedef = dnone; fvdef = fvnone; fvextern = FALSE;
3365 typdef = tnone; structdef = snone;
3366 midtoken = inquote = inchar = incomm = quotednl = FALSE;
3367 bracelev = 0;
3368 yacc_rules = !yacc_rules;
3369 continue;
3370 }
3371 else
3372 break;
3373 case '#':
3374 if (definedef == dnone)
3375 {
3376 char *cp;
3377 bool cpptoken = TRUE;
3378
3379 /* Look back on this line. If all blanks, or nonblanks
3380 followed by an end of comment, this is a preprocessor
3381 token. */
3382 for (cp = newlb.buffer; cp < lp-1; cp++)
3383 if (!iswhite (*cp))
3384 {
3385 if (*cp == '*' && *(cp+1) == '/')
3386 {
3387 cp++;
3388 cpptoken = TRUE;
3389 }
3390 else
3391 cpptoken = FALSE;
3392 }
3393 if (cpptoken)
3394 definedef = dsharpseen;
3395 } /* if (definedef == dnone) */
3396 continue;
3397 case '[':
3398 bracketlev++;
3398 continue; 3399 continue;
3399 } /* switch (c) */ 3400 } /* switch (c) */
3400 3401
3401 3402
3402 /* Consider token only if some involved conditions are satisfied. */ 3403 /* Consider token only if some involved conditions are satisfied. */
3403 if (typdef != tignore 3404 if (typdef != tignore
3404 && definedef != dignorerest 3405 && definedef != dignorerest
3405 && fvdef != finlist 3406 && fvdef != finlist
3406 && structdef != sintemplate 3407 && templatelev == 0
3407 && (definedef != dnone 3408 && (definedef != dnone
3408 || structdef != scolonseen)) 3409 || structdef != scolonseen)
3410 && !inattribute)
3409 { 3411 {
3410 if (midtoken) 3412 if (midtoken)
3411 { 3413 {
@@ -3429,7 +3431,8 @@ C_entries (c_ext, inf)
3429 3431
3430 if (yacc_rules 3432 if (yacc_rules
3431 || consider_token (newlb.buffer + tokoff, toklen, c, 3433 || consider_token (newlb.buffer + tokoff, toklen, c,
3432 &c_ext, cblev, parlev, &funorvar)) 3434 &c_ext, bracelev, parlev,
3435 &funorvar))
3433 { 3436 {
3434 if (fvdef == foperator) 3437 if (fvdef == foperator)
3435 { 3438 {
@@ -3514,7 +3517,7 @@ C_entries (c_ext, inf)
3514 || (funorvar 3517 || (funorvar
3515 && definedef == dnone 3518 && definedef == dnone
3516 && structdef == snone 3519 && structdef == snone
3517 && cblev > 0)); 3520 && bracelev > 0));
3518 } 3521 }
3519 token.lineno = lineno; 3522 token.lineno = lineno;
3520 token.offset = tokoff; 3523 token.offset = tokoff;
@@ -3539,6 +3542,16 @@ C_entries (c_ext, inf)
3539 || instruct) 3542 || instruct)
3540 make_C_tag (funorvar); 3543 make_C_tag (funorvar);
3541 } 3544 }
3545 else /* not yacc and consider_token failed */
3546 {
3547 if (inattribute && fvdef == fignore)
3548 {
3549 /* We have just met __attribute__ after a
3550 function parameter list: do not tag the
3551 function again. */
3552 fvdef = fvnone;
3553 }
3554 }
3542 midtoken = FALSE; 3555 midtoken = FALSE;
3543 } 3556 }
3544 } /* if (endtoken (c)) */ 3557 } /* if (endtoken (c)) */
@@ -3557,6 +3570,9 @@ C_entries (c_ext, inf)
3557 switch (fvdef) 3570 switch (fvdef)
3558 { 3571 {
3559 case fstartlist: 3572 case fstartlist:
3573 /* This prevents tagging fb in
3574 void (__attribute__((noreturn)) *fb) (void);
3575 Fixing this is not easy and not very important. */
3560 fvdef = finlist; 3576 fvdef = finlist;
3561 continue; 3577 continue;
3562 case flistseen: 3578 case flistseen:
@@ -3566,13 +3582,10 @@ C_entries (c_ext, inf)
3566 fvdef = fignore; 3582 fvdef = fignore;
3567 } 3583 }
3568 break; 3584 break;
3569 case fvnameseen:
3570 fvdef = fvnone;
3571 break;
3572 } 3585 }
3573 if (structdef == stagseen && !cjava) 3586 if (structdef == stagseen && !cjava)
3574 { 3587 {
3575 popclass_above (cblev); 3588 popclass_above (bracelev);
3576 structdef = snone; 3589 structdef = snone;
3577 } 3590 }
3578 break; 3591 break;
@@ -3596,6 +3609,8 @@ C_entries (c_ext, inf)
3596 switch (c) 3609 switch (c)
3597 { 3610 {
3598 case ':': 3611 case ':':
3612 if (inattribute)
3613 break;
3599 if (yacc_rules && token.offset == 0 && token.valid) 3614 if (yacc_rules && token.offset == 0 && token.valid)
3600 { 3615 {
3601 make_C_tag (FALSE); /* a yacc function */ 3616 make_C_tag (FALSE); /* a yacc function */
@@ -3630,7 +3645,7 @@ C_entries (c_ext, inf)
3630 } 3645 }
3631 break; 3646 break;
3632 case ';': 3647 case ';':
3633 if (definedef != dnone) 3648 if (definedef != dnone || inattribute)
3634 break; 3649 break;
3635 switch (typdef) 3650 switch (typdef)
3636 { 3651 {
@@ -3650,7 +3665,7 @@ C_entries (c_ext, inf)
3650 fvdef = fvnone; 3665 fvdef = fvnone;
3651 break; 3666 break;
3652 case fvnameseen: 3667 case fvnameseen:
3653 if ((globals && cblev == 0 && (!fvextern || declarations)) 3668 if ((globals && bracelev == 0 && (!fvextern || declarations))
3654 || (members && instruct)) 3669 || (members && instruct))
3655 make_C_tag (FALSE); /* a variable */ 3670 make_C_tag (FALSE); /* a variable */
3656 fvextern = FALSE; 3671 fvextern = FALSE;
@@ -3658,9 +3673,12 @@ C_entries (c_ext, inf)
3658 token.valid = FALSE; 3673 token.valid = FALSE;
3659 break; 3674 break;
3660 case flistseen: 3675 case flistseen:
3661 if (declarations 3676 if ((declarations
3662 && (typdef == tnone || (typdef != tignore && instruct))) 3677 && (cplpl || !instruct)
3663 make_C_tag (TRUE); /* a function declaration */ 3678 && (typdef == tnone || (typdef != tignore && instruct)))
3679 || (members
3680 && plainc && instruct))
3681 make_C_tag (TRUE); /* a function */
3664 /* FALLTHRU */ 3682 /* FALLTHRU */
3665 default: 3683 default:
3666 fvextern = FALSE; 3684 fvextern = FALSE;
@@ -3680,7 +3698,7 @@ C_entries (c_ext, inf)
3680 structdef = snone; 3698 structdef = snone;
3681 break; 3699 break;
3682 case ',': 3700 case ',':
3683 if (definedef != dnone) 3701 if (definedef != dnone || inattribute)
3684 break; 3702 break;
3685 switch (objdef) 3703 switch (objdef)
3686 { 3704 {
@@ -3702,16 +3720,20 @@ C_entries (c_ext, inf)
3702 case fdefunname: 3720 case fdefunname:
3703 fvdef = fignore; 3721 fvdef = fignore;
3704 break; 3722 break;
3705 case fvnameseen: /* a variable */ 3723 case fvnameseen:
3706 if ((globals && cblev == 0 && (!fvextern || declarations)) 3724 if (parlev == 0
3707 || (members && instruct)) 3725 && ((globals
3708 make_C_tag (FALSE); 3726 && bracelev == 0
3727 && templatelev == 0
3728 && (!fvextern || declarations))
3729 || (members && instruct)))
3730 make_C_tag (FALSE); /* a variable */
3709 break; 3731 break;
3710 case flistseen: /* a function */ 3732 case flistseen:
3711 if ((declarations && typdef == tnone && !instruct) 3733 if ((declarations && typdef == tnone && !instruct)
3712 || (members && typdef != tignore && instruct)) 3734 || (members && typdef != tignore && instruct))
3713 { 3735 {
3714 make_C_tag (TRUE); /* a function declaration */ 3736 make_C_tag (TRUE); /* a function */
3715 fvdef = fvnameseen; 3737 fvdef = fvnameseen;
3716 } 3738 }
3717 else if (!declarations) 3739 else if (!declarations)
@@ -3724,8 +3746,8 @@ C_entries (c_ext, inf)
3724 if (structdef == stagseen) 3746 if (structdef == stagseen)
3725 structdef = snone; 3747 structdef = snone;
3726 break; 3748 break;
3727 case '[': 3749 case ']':
3728 if (definedef != dnone) 3750 if (definedef != dnone || inattribute)
3729 break; 3751 break;
3730 if (structdef == stagseen) 3752 if (structdef == stagseen)
3731 structdef = snone; 3753 structdef = snone;
@@ -3746,8 +3768,8 @@ C_entries (c_ext, inf)
3746 case vignore: 3768 case vignore:
3747 break; 3769 break;
3748 case fvnameseen: 3770 case fvnameseen:
3749 if ((members && cblev == 1) 3771 if ((members && bracelev == 1)
3750 || (globals && cblev == 0 3772 || (globals && bracelev == 0
3751 && (!fvextern || declarations))) 3773 && (!fvextern || declarations)))
3752 make_C_tag (FALSE); /* a variable */ 3774 make_C_tag (FALSE); /* a variable */
3753 /* FALLTHRU */ 3775 /* FALLTHRU */
@@ -3758,6 +3780,11 @@ C_entries (c_ext, inf)
3758 } 3780 }
3759 break; 3781 break;
3760 case '(': 3782 case '(':
3783 if (inattribute)
3784 {
3785 attrparlev++;
3786 break;
3787 }
3761 if (definedef != dnone) 3788 if (definedef != dnone)
3762 break; 3789 break;
3763 if (objdef == otagseen && parlev == 0) 3790 if (objdef == otagseen && parlev == 0)
@@ -3787,6 +3814,12 @@ C_entries (c_ext, inf)
3787 parlev++; 3814 parlev++;
3788 break; 3815 break;
3789 case ')': 3816 case ')':
3817 if (inattribute)
3818 {
3819 if (--attrparlev == 0)
3820 inattribute = FALSE;
3821 break;
3822 }
3790 if (definedef != dnone) 3823 if (definedef != dnone)
3791 break; 3824 break;
3792 if (objdef == ocatseen && parlev == 1) 3825 if (objdef == ocatseen && parlev == 1)
@@ -3820,9 +3853,9 @@ C_entries (c_ext, inf)
3820 if (typdef == ttypeseen) 3853 if (typdef == ttypeseen)
3821 { 3854 {
3822 /* Whenever typdef is set to tinbody (currently only 3855 /* Whenever typdef is set to tinbody (currently only
3823 here), typdefcblev should be set to cblev. */ 3856 here), typdefbracelev should be set to bracelev. */
3824 typdef = tinbody; 3857 typdef = tinbody;
3825 typdefcblev = cblev; 3858 typdefbracelev = bracelev;
3826 } 3859 }
3827 switch (fvdef) 3860 switch (fvdef)
3828 { 3861 {
@@ -3846,26 +3879,26 @@ C_entries (c_ext, inf)
3846 break; 3879 break;
3847 default: 3880 default:
3848 /* Neutralize `extern "C" {' grot. */ 3881 /* Neutralize `extern "C" {' grot. */
3849 if (cblev == 0 && structdef == snone && nestlev == 0 3882 if (bracelev == 0 && structdef == snone && nestlev == 0
3850 && typdef == tnone) 3883 && typdef == tnone)
3851 cblev = -1; 3884 bracelev = -1;
3852 } 3885 }
3853 break; 3886 break;
3854 } 3887 }
3855 switch (structdef) 3888 switch (structdef)
3856 { 3889 {
3857 case skeyseen: /* unnamed struct */ 3890 case skeyseen: /* unnamed struct */
3858 pushclass_above (cblev, NULL, 0); 3891 pushclass_above (bracelev, NULL, 0);
3859 structdef = snone; 3892 structdef = snone;
3860 break; 3893 break;
3861 case stagseen: /* named struct or enum */ 3894 case stagseen: /* named struct or enum */
3862 case scolonseen: /* a class */ 3895 case scolonseen: /* a class */
3863 pushclass_above (cblev, token.line+token.offset, token.length); 3896 pushclass_above (bracelev,token.line+token.offset, token.length);
3864 structdef = snone; 3897 structdef = snone;
3865 make_C_tag (FALSE); /* a struct or enum */ 3898 make_C_tag (FALSE); /* a struct or enum */
3866 break; 3899 break;
3867 } 3900 }
3868 cblev++; 3901 bracelev++;
3869 break; 3902 break;
3870 case '*': 3903 case '*':
3871 if (definedef != dnone) 3904 if (definedef != dnone)
@@ -3881,21 +3914,21 @@ C_entries (c_ext, inf)
3881 break; 3914 break;
3882 if (!ignoreindent && lp == newlb.buffer + 1) 3915 if (!ignoreindent && lp == newlb.buffer + 1)
3883 { 3916 {
3884 if (cblev != 0) 3917 if (bracelev != 0)
3885 token.valid = FALSE; 3918 token.valid = FALSE;
3886 cblev = 0; /* reset curly brace level if first column */ 3919 bracelev = 0; /* reset brace level if first column */
3887 parlev = 0; /* also reset paren level, just in case... */ 3920 parlev = 0; /* also reset paren level, just in case... */
3888 } 3921 }
3889 else if (cblev > 0) 3922 else if (bracelev > 0)
3890 cblev--; 3923 bracelev--;
3891 else 3924 else
3892 token.valid = FALSE; /* something gone amiss, token unreliable */ 3925 token.valid = FALSE; /* something gone amiss, token unreliable */
3893 popclass_above (cblev); 3926 popclass_above (bracelev);
3894 structdef = snone; 3927 structdef = snone;
3895 /* Only if typdef == tinbody is typdefcblev significant. */ 3928 /* Only if typdef == tinbody is typdefbracelev significant. */
3896 if (typdef == tinbody && cblev <= typdefcblev) 3929 if (typdef == tinbody && bracelev <= typdefbracelev)
3897 { 3930 {
3898 assert (cblev == typdefcblev); 3931 assert (bracelev == typdefbracelev);
3899 typdef = tend; 3932 typdef = tend;
3900 } 3933 }
3901 break; 3934 break;
@@ -3910,8 +3943,8 @@ C_entries (c_ext, inf)
3910 case vignore: 3943 case vignore:
3911 break; 3944 break;
3912 case fvnameseen: 3945 case fvnameseen:
3913 if ((members && cblev == 1) 3946 if ((members && bracelev == 1)
3914 || (globals && cblev == 0 && (!fvextern || declarations))) 3947 || (globals && bracelev == 0 && (!fvextern || declarations)))
3915 make_C_tag (FALSE); /* a variable */ 3948 make_C_tag (FALSE); /* a variable */
3916 /* FALLTHRU */ 3949 /* FALLTHRU */
3917 default: 3950 default:
@@ -3919,30 +3952,31 @@ C_entries (c_ext, inf)
3919 } 3952 }
3920 break; 3953 break;
3921 case '<': 3954 case '<':
3922 if (cplpl && structdef == stagseen) 3955 if (cplpl
3956 && (structdef == stagseen || fvdef == fvnameseen))
3923 { 3957 {
3924 structdef = sintemplate; 3958 templatelev++;
3925 break; 3959 break;
3926 } 3960 }
3927 goto resetfvdef; 3961 goto resetfvdef;
3928 case '>': 3962 case '>':
3929 if (structdef == sintemplate) 3963 if (templatelev > 0)
3930 { 3964 {
3931 structdef = stagseen; 3965 templatelev--;
3932 break; 3966 break;
3933 } 3967 }
3934 goto resetfvdef; 3968 goto resetfvdef;
3935 case '+': 3969 case '+':
3936 case '-': 3970 case '-':
3937 if (objdef == oinbody && cblev == 0) 3971 if (objdef == oinbody && bracelev == 0)
3938 { 3972 {
3939 objdef = omethodsign; 3973 objdef = omethodsign;
3940 break; 3974 break;
3941 } 3975 }
3942 /* FALLTHRU */ 3976 /* FALLTHRU */
3943 resetfvdef: 3977 resetfvdef:
3944 case '#': case '~': case '&': case '%': case '/': case '|': 3978 case '#': case '~': case '&': case '%': case '/':
3945 case '^': case '!': case '.': case '?': case ']': 3979 case '|': case '^': case '!': case '.': case '?':
3946 if (definedef != dnone) 3980 if (definedef != dnone)
3947 break; 3981 break;
3948 /* These surely cannot follow a function tag in C. */ 3982 /* These surely cannot follow a function tag in C. */
@@ -4894,6 +4928,31 @@ Lisp_functions (inf)
4894 4928
4895 4929
4896/* 4930/*
4931 * Lua script language parsing
4932 * Original code by David A. Capello <dacap@users.sourceforge.net> (2004)
4933 *
4934 * "function" and "local function" are tags if they start at column 1.
4935 */
4936static void
4937Lua_functions (inf)
4938 FILE *inf;
4939{
4940 register char *bp;
4941
4942 LOOP_ON_INPUT_LINES (inf, lb, bp)
4943 {
4944 if (bp[0] != 'f' && bp[0] != 'l')
4945 continue;
4946
4947 LOOKING_AT (bp, "local"); /* skip possible "local" */
4948
4949 if (LOOKING_AT (bp, "function"))
4950 get_tag (bp, NULL);
4951 }
4952}
4953
4954
4955/*
4897 * Postscript tag functions 4956 * Postscript tag functions
4898 * Just look for lines where the first character is '/' 4957 * Just look for lines where the first character is '/'
4899 * Also look at "defineps" for PSWrap 4958 * Also look at "defineps" for PSWrap
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 6d466b5a791..892e2c4790b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,94 @@
12004-09-13 Kim F. Storm <storm@cua.dk>
2
3 * isearch.el (isearch-resume-in-command-history): Rename from
4 isearch-resume-enabled and change default to nil.
5
62004-09-12 Stefan <monnier@iro.umontreal.ca>
7
8 * vc-hooks.el (vc-ignore-dir-regexp): New var.
9 (vc-registered): Use it.
10 (vc-find-root): New fun.
11
12 * emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
13 Don't tell to use \\{...} when it's already done.
14
15 * textmodes/bibtex.el (bibtex-generate-url-list): Change format.
16 Provide a sample complex default.
17 (bibtex-url, bibtex-font-lock-url): Adapt to new format.
18 (bibtex-entry): Use mapc.
19
202004-09-12 Kim F. Storm <storm@cua.dk>
21
22 * kmacro.el (kmacro-step-edit-prompt): Add "%s" format to message.
23
24 * emulation/cua-rect.el (cua--rectangle-operation): Let bind
25 inhibit-field-text-motion to t so rectangles work in comint buffers.
26
27 * simple.el (choose-completion-string): Set buffer before running
28 choose-completion-string-functions hook so it can be buffer-local.
29
302004-09-12 Daniel Pfeiffer <occitan@esperanto.org>
31
32 * progmodes/compile.el (compilation-start): Parse command to see
33 if it starts with a cd, and if so perform it for the *compilation*
34 buffer. Change the header to reflect this.
35
362004-09-11 Kim F. Storm <storm@cua.dk>
37
38 * ido.el (ido-enable-dot-prefix): Doc fix.
39 (ido-enable-dot-prefix): New defcustom.
40 (ido-set-matches1): Use it.
41
422004-09-10 Stefan Monnier <monnier@iro.umontreal.ca>
43
44 * textmodes/bibtex.el (bibtex-mark-active)
45 (bibtex-run-with-idle-timer): Move the `if' inside the defun.
46
472004-09-10 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
48
49 * textmodes/bibtex.el (bibtex-autokey-titleword-ignore): Regexp is
50 used in a case insensitive environment.
51 (bibtex-mode-map): Rearrange order of menus.
52 (bibtex-quoted-string-re): Obsolete.
53 (bibtex-complete-key-cleanup): Variable replaced by new function.
54 (bibtex-font-lock-keywords): Use backquotes.
55 (bibtex-font-lock-url-regexp): New internal variable.
56 (bibtex-name-in-field): New optional arg remove-opt-alt to remove
57 "OPT" and "ALT".
58 (bibtex-insert-current-kill, bibtex-make-field)
59 (bibtex-prepare-new-entry, bibtex-yank-pop, bibtex-String): Use unless.
60 (bibtex-parse-field-text): Simplify.
61 (bibtex-string=): New helper function.
62 (bibtex-member-of-regexp): Merge with bibtex-autokey-get-title.
63 (bibtex-map-entries): Use bibtex-string=.
64 (bibtex-search-entry): Use not.
65 (bibtex-enclosing-field): Fix docstring.
66 (bibtex-assoc-regexp): Obsolete.
67 (bibtex-format-entry): Use assoc-string and bibtex-string=.
68 (bibtex-autokey-get-names): Handle empty name field.
69 (bibtex-parse-strings): Use assoc-string and unless.
70 (bibtex-complete-string-cleanup): Expansion list is passed as an arg.
71 Use assoc-string.
72 (bibtex-pop): Simplify.
73 (bibtex-mode): Set font-lock-extra-managed-props.
74 (bibtex-entry-update): Use assoc-string.
75 (bibtex-parse-entry): Remove "OPT" and "ALT" from FIELD.
76 (bibtex-autofill-entry): Use bibtex-string=.
77 (bibtex-print-help-message): Simplify.
78 (bibtex-find-entry): New optional arg START.
79 (bibtex-validate): Use bibtex-string= and assoc-string.
80 Do not call obsolete function compilation-parse-errors.
81 (bibtex-remove-delimiters): Only remove delimiters if present.
82 (bibtex-copy-entry-as-kill): Add docstring.
83 (bibtex-clean-entry): Use bibtex-string=. Handle empty keys.
84 Detect duplicate keys if bibtex-maintain-sorted-entries is nil.
85 (bibtex-complete): Use bibtex-predefined-month-strings,
86 bibtex-string=, and new function bibtex-complete-key-cleanup.
87 (bibtex-generate-url-list): New variable.
88 (bibtex-url): New command bound to C-c C-l and mouse-2.
89 (bibtex-url-map): New local keymap for bibtex-url-mouse.
90 (bibtex-font-lock-url): New function.
91
12004-09-09 Stefan Monnier <monnier@iro.umontreal.ca> 922004-09-09 Stefan Monnier <monnier@iro.umontreal.ca>
2 93
3 * progmodes/grep.el (grep-mode): Remove unnecessary autoload. 94 * progmodes/grep.el (grep-mode): Remove unnecessary autoload.
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/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/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 77d5037b32d..02757fff4dd 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/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 2398d56ab5f..117d1bfdc13 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
@@ -651,7 +653,7 @@ is treated as a regexp. See \\[isearch-forward] for more info."
651 (setq disable-point-adjustment t)) 653 (setq disable-point-adjustment t))
652 654
653(defun isearch-done (&optional nopush edit) 655(defun isearch-done (&optional nopush edit)
654 (if isearch-resume-enabled 656 (if isearch-resume-in-command-history
655 (let ((command `(isearch-resume ,isearch-string ,isearch-regexp 657 (let ((command `(isearch-resume ,isearch-string ,isearch-regexp
656 ,isearch-word ,isearch-forward 658 ,isearch-word ,isearch-forward
657 ,isearch-message 659 ,isearch-message
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 9e3271d01cc..5aefe46625d 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -928,7 +928,8 @@ following additional answers: `insert', `insert-1', `replace', `replace-1',
928 (curmsg (current-message))) 928 (curmsg (current-message)))
929 929
930 ;; TODO: Scroll macro if max-mini-window-height is too small. 930 ;; TODO: Scroll macro if max-mini-window-height is too small.
931 (message (concat 931 (message "%s"
932 (concat
932 (format "Macro: %s%s%s%s%s\n" 933 (format "Macro: %s%s%s%s%s\n"
933 (format-kbd-macro kmacro-step-edit-new-macro 1) 934 (format-kbd-macro kmacro-step-edit-new-macro 1)
934 (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/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/simple.el b/lisp/simple.el
index 14fa1931e40..588191241c5 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4301,11 +4301,12 @@ to decide what to delete."
4301 (not (equal buffer 4301 (not (equal buffer
4302 (window-buffer (active-minibuffer-window)))))) 4302 (window-buffer (active-minibuffer-window))))))
4303 (error "Minibuffer is not active for completion") 4303 (error "Minibuffer is not active for completion")
4304 ;; Set buffer so buffer-local choose-completion-string-functions works.
4305 (set-buffer buffer)
4304 (unless (run-hook-with-args-until-success 4306 (unless (run-hook-with-args-until-success
4305 'choose-completion-string-functions 4307 'choose-completion-string-functions
4306 choice buffer mini-p base-size) 4308 choice buffer mini-p base-size)
4307 ;; Insert the completion into the buffer where it was requested. 4309 ;; Insert the completion into the buffer where it was requested.
4308 (set-buffer buffer)
4309 (if base-size 4310 (if base-size
4310 (delete-region (+ base-size (if mini-p 4311 (delete-region (+ base-size (if mini-p
4311 (minibuffer-prompt-end) 4312 (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/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/man/ChangeLog b/man/ChangeLog
index 01cc1575517..75e8d3d7c76 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,37 @@
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
12004-09-09 Kim F. Storm <storm@cua.dk> 352004-09-09 Kim F. Storm <storm@cua.dk>
2 36
3 * kmacro.texi (Save Keyboard Macro): Replace `name-last-kbd-macro' 37 * kmacro.texi (Save Keyboard Macro): Replace `name-last-kbd-macro'
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/maintaining.texi b/man/maintaining.texi
index b5f13d5fb9f..1a8edf13188 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
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 bdc2d2d7e20..5fee1e8d97d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,57 @@
12004-09-12 Kim F. Storm <storm@cua.dk>
2
3 * editfns.c (Fformat): Handle format strings with multiple text
4 properties. Reverse text property list from the format string,
5 so the positions are in increasing order.
6
72004-09-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
8
9 * xselect.c (x_reply_selection_request): XSync and UNBLOCK before
10 x_uncatch_errors so that possible protocol errors are delivered.
11
122004-09-10 Eli Zaretskii <eliz@gnu.org>
13
14 * Makefile.in (msdos.o): Depend on buffer.h, commands.h, and
15 blockinput.h.
16 (dosfns.o): Depend on blockinput.h, window.h, dispextern.h,
17 charset.h, and coding.h
18 (w16select.o): Depend on buffer.h, charset.h, coding.h, and
19 composite.h.
20 (term.o): Depend on window.h and keymap.h.
21 (abbrev.o): Depend on syntax.h.
22 (callint.o): Depend on keymap.h.
23 (casefiddle.o): Depend on charset.h and keymap.h.
24 (category.o): Depend on keymap.h.
25 (coding.o): Depend on dispextern.h.
26 (cmds.o): Depend on keyboard.h and keymap.h.
27 (dispnew.o): Depend on indent.h and intervals.h.
28 (doc.o): Depend on keymap.h.
29 (editfns.o): Depend on frame.h.
30 (emacs.o): Depend on dispextern.h.
31 (fileio.o): Don't depend on ccl.h.
32 (filelock.o): Depend on charset.h and coding.h.
33 (frame.o): Depend on w32term.h and macterm.h.
34 (insdel.o): Depend on region-cache.h.
35 (keyboard.o): Depend on keymap.h, w32term.h, and macterm.h.
36 (minibuf.o): Depend on $(INTERVALS_SRC) and keymap.h.
37 (search.o): Depend on $(INTERVALS_SRC).
38 (syntax.o): Depend on keymap.h, regex.h, and $(INTERVALS_SRC).
39 (window.o): Depend on keymap.h, blockinput.h, $(INTERVALS_SRC),
40 xterm.h, w32term.h, and macterm.h.
41 (xdisp.o): Depend on keyboard.h, $(INTERVALS_SRC), xterm.h,
42 w32term.h, and macterm.h.
43 (xfaces.o): Depend on keyboard.h, $(INTERVALS_SRC),
44 region-cache.h, xterm.h, w32term.h, and macterm.h.
45 (bytecode.o): Depend on dispextern.h, frame.h, and xterm.h.
46 (data.o): Depend on frame.h.
47 (fns.o): Depend on keymap.h, xterm.h, and blockinput.h.
48 (print.o): Depend on termchar.h and $(INTERVALS_SRC).
49 (lread.o): Depend on $(INTERVALS_SRC), termhooks.h, and coding.h.
50 (intervals.o): Depend on keymap.h.
51
52 * msdos.c (msdos_set_cursor_shape, IT_display_cursor): Add
53 debugging print-out to termscript.
54
12004-09-09 Richard M. Stallman <rms@gnu.org> 552004-09-09 Richard M. Stallman <rms@gnu.org>
2 56
3 * xdisp.c (decode_mode_spec): Use current buffer for most purposes. 57 * xdisp.c (decode_mode_spec): Use current buffer for most purposes.
diff --git a/src/Makefile.in b/src/Makefile.in
index 13aa119aa8c..ba68a88850a 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1046,25 +1046,27 @@ alloca.o: alloca.c blockinput.h atimer.h
1046 and so rarely changed in ways that do require any. */ 1046 and so rarely changed in ways that do require any. */
1047 1047
1048abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h charset.h \ 1048abbrev.o: abbrev.c buffer.h window.h dispextern.h commands.h charset.h \
1049 $(config_h) 1049 syntax.h $(config_h)
1050buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \ 1050buffer.o: buffer.c buffer.h region-cache.h commands.h window.h \
1051 dispextern.h $(INTERVAL_SRC) blockinput.h atimer.h systime.h charset.h \ 1051 dispextern.h $(INTERVAL_SRC) blockinput.h atimer.h systime.h charset.h \
1052 $(config_h) 1052 $(config_h)
1053callint.o: callint.c window.h commands.h buffer.h \ 1053callint.o: callint.c window.h commands.h buffer.h keymap.h \
1054 keyboard.h dispextern.h $(config_h) 1054 keyboard.h dispextern.h $(config_h)
1055callproc.o: callproc.c epaths.h buffer.h commands.h $(config_h) \ 1055callproc.o: callproc.c epaths.h buffer.h commands.h $(config_h) \
1056 process.h systty.h syssignal.h charset.h coding.h ccl.h msdos.h \ 1056 process.h systty.h syssignal.h charset.h coding.h ccl.h msdos.h \
1057 composite.h 1057 composite.h
1058casefiddle.o: casefiddle.c syntax.h commands.h buffer.h composite.h $(config_h) 1058casefiddle.o: casefiddle.c syntax.h commands.h buffer.h composite.h \
1059 charset.h keymap.h $(config_h)
1059casetab.o: casetab.c buffer.h $(config_h) 1060casetab.o: casetab.c buffer.h $(config_h)
1060category.o: category.c category.h buffer.h charset.h $(config_h) 1061category.o: category.c category.h buffer.h charset.h keymap.h $(config_h)
1061ccl.o: ccl.c ccl.h charset.h coding.h $(config_h) 1062ccl.o: ccl.c ccl.h charset.h coding.h $(config_h)
1062charset.o: charset.c charset.h buffer.h coding.h composite.h disptab.h \ 1063charset.o: charset.c charset.h buffer.h coding.h composite.h disptab.h \
1063 $(config_h) 1064 $(config_h)
1064coding.o: coding.c coding.h ccl.h buffer.h charset.h intervals.h composite.h window.h frame.h termhooks.h $(config_h) 1065coding.o: coding.c coding.h ccl.h buffer.h charset.h intervals.h composite.h \
1066 window.h dispextern.h frame.h termhooks.h $(config_h)
1065cm.o: cm.c frame.h cm.h termhooks.h termchar.h $(config_h) 1067cm.o: cm.c frame.h cm.h termhooks.h termchar.h $(config_h)
1066cmds.o: cmds.c syntax.h buffer.h charset.h commands.h window.h $(config_h) \ 1068cmds.o: cmds.c syntax.h buffer.h charset.h commands.h window.h $(config_h) \
1067 msdos.h dispextern.h 1069 msdos.h dispextern.h keyboard.h keymap.h
1068pre-crt0.o: pre-crt0.c 1070pre-crt0.o: pre-crt0.c
1069ecrt0.o: ecrt0.c $(config_h) 1071ecrt0.o: ecrt0.c $(config_h)
1070 CRT0_COMPILE ${srcdir}/ecrt0.c 1072 CRT0_COMPILE ${srcdir}/ecrt0.c
@@ -1072,24 +1074,25 @@ dired.o: dired.c commands.h buffer.h $(config_h) charset.h coding.h regex.h \
1072 systime.h 1074 systime.h
1073dispnew.o: dispnew.c systime.h commands.h process.h frame.h \ 1075dispnew.o: dispnew.c systime.h commands.h process.h frame.h \
1074 window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \ 1076 window.h buffer.h dispextern.h termchar.h termopts.h termhooks.h cm.h \
1075 disptab.h \ 1077 disptab.h indent.h intervals.h \
1076 xterm.h blockinput.h atimer.h charset.h msdos.h composite.h keyboard.h \ 1078 xterm.h blockinput.h atimer.h charset.h msdos.h composite.h keyboard.h \
1077 $(config_h) 1079 $(config_h)
1078doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h charset.h 1080doc.o: doc.c $(config_h) epaths.h buffer.h keyboard.h keymap.h charset.h
1079doprnt.o: doprnt.c charset.h $(config_h) 1081doprnt.o: doprnt.c charset.h $(config_h)
1080dosfns.o: buffer.h termchar.h termhooks.h frame.h msdos.h dosfns.h $(config_h) 1082dosfns.o: buffer.h termchar.h termhooks.h frame.h blockinput.h window.h \
1083 msdos.h dosfns.h dispextern.h charset.h coding.h $(config_h)
1081editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \ 1084editfns.o: editfns.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \
1082 coding.h dispextern.h $(config_h) 1085 coding.h dispextern.h frame.h $(config_h)
1083emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \ 1086emacs.o: emacs.c commands.h systty.h syssignal.h blockinput.h process.h \
1084 termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \ 1087 termhooks.h buffer.h atimer.h systime.h $(INTERVAL_SRC) $(config_h) \
1085 window.h keyboard.h keymap.h 1088 window.h dispextern.h keyboard.h keymap.h
1086fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \ 1089fileio.o: fileio.c window.h buffer.h systime.h $(INTERVAL_SRC) charset.h \
1087 coding.h ccl.h msdos.h dispextern.h $(config_h) 1090 coding.h ccl.h msdos.h dispextern.h $(config_h)
1088filelock.o: filelock.c buffer.h systime.h epaths.h $(config_h) 1091filelock.o: filelock.c buffer.h charset.h coding.h systime.h epaths.h $(config_h)
1089filemode.o: filemode.c $(config_h) 1092filemode.o: filemode.c $(config_h)
1090frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \ 1093frame.o: frame.c xterm.h window.h frame.h termhooks.h commands.h keyboard.h \
1091 blockinput.h atimer.h systime.h buffer.h charset.h fontset.h \ 1094 blockinput.h atimer.h systime.h buffer.h charset.h fontset.h \
1092 msdos.h dosfns.h dispextern.h termchar.h $(config_h) 1095 msdos.h dosfns.h dispextern.h w32term.h macterm.h termchar.h $(config_h)
1093fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h $(config_h) 1096fringe.o: fringe.c dispextern.h frame.h window.h buffer.h termhooks.h $(config_h)
1094fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h charset.h frame.h \ 1097fontset.o: dispextern.h fontset.h fontset.c ccl.h buffer.h charset.h frame.h \
1095 keyboard.h termhooks.h $(config_h) 1098 keyboard.h termhooks.h $(config_h)
@@ -1100,11 +1103,11 @@ indent.o: indent.c frame.h window.h indent.h buffer.h $(config_h) termchar.h \
1100 termopts.h disptab.h region-cache.h charset.h composite.h dispextern.h \ 1103 termopts.h disptab.h region-cache.h charset.h composite.h dispextern.h \
1101 keyboard.h 1104 keyboard.h
1102insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h charset.h \ 1105insdel.o: insdel.c window.h buffer.h $(INTERVAL_SRC) blockinput.h charset.h \
1103 dispextern.h atimer.h systime.h $(config_h) 1106 dispextern.h atimer.h systime.h region-cache.h $(config_h)
1104keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h charset.h \ 1107keyboard.o: keyboard.c termchar.h termhooks.h termopts.h buffer.h charset.h \
1105 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \ 1108 commands.h frame.h window.h macros.h disptab.h keyboard.h syssignal.h \
1106 systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \ 1109 systime.h dispextern.h syntax.h $(INTERVAL_SRC) blockinput.h \
1107 atimer.h xterm.h puresize.h msdos.h $(config_h) 1110 atimer.h xterm.h puresize.h msdos.h keymap.h w32term.h macterm.h $(config_h)
1108keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \ 1111keymap.o: keymap.c buffer.h commands.h keyboard.h termhooks.h blockinput.h \
1109 atimer.h systime.h puresize.h charset.h intervals.h $(config_h) 1112 atimer.h systime.h puresize.h charset.h intervals.h $(config_h)
1110lastfile.o: lastfile.c $(config_h) 1113lastfile.o: lastfile.c $(config_h)
@@ -1117,11 +1120,12 @@ vm-limit.o: vm-limit.c mem-limits.h $(config_h)
1117marker.o: marker.c buffer.h charset.h $(config_h) 1120marker.o: marker.c buffer.h charset.h $(config_h)
1118md5.o: md5.c md5.h $(config_h) 1121md5.o: md5.c md5.h $(config_h)
1119minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \ 1122minibuf.o: minibuf.c syntax.h dispextern.h frame.h window.h keyboard.h \
1120 buffer.h commands.h charset.h msdos.h termhooks.h $(config_h) 1123 buffer.h commands.h charset.h msdos.h $(INTERVAL_SRC)) keymap.h \
1124 termhooks.h $(config_h)
1121mktime.o: mktime.c $(config_h) 1125mktime.o: mktime.c $(config_h)
1122msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \ 1126msdos.o: msdos.c msdos.h dosfns.h systime.h termhooks.h dispextern.h frame.h \
1123 termopts.h termchar.h charset.h coding.h ccl.h disptab.h window.h \ 1127 termopts.h termchar.h charset.h coding.h ccl.h disptab.h window.h \
1124 keyboard.h intervals.h $(config_h) 1128 keyboard.h intervals.h buffer.h commands.h blockinput.h $(config_h)
1125process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \ 1129process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
1126 commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \ 1130 commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
1127 blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \ 1131 blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
@@ -1131,15 +1135,17 @@ region-cache.o: region-cache.c buffer.h region-cache.h $(config_h)
1131scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \ 1135scroll.o: scroll.c termchar.h dispextern.h frame.h msdos.h keyboard.h \
1132 termhooks.h $(config_h) 1136 termhooks.h $(config_h)
1133search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \ 1137search.o: search.c regex.h commands.h buffer.h region-cache.h syntax.h \
1134 blockinput.h atimer.h systime.h category.h charset.h composite.h $(config_h) 1138 blockinput.h atimer.h systime.h category.h charset.h composite.h \
1139 $(INTERVAL_SRC) $(config_h)
1135strftime.o: strftime.c $(config_h) 1140strftime.o: strftime.c $(config_h)
1136syntax.o: syntax.c syntax.h buffer.h commands.h category.h charset.h \ 1141syntax.o: syntax.c syntax.h buffer.h commands.h category.h charset.h \
1137 composite.h $(config_h) 1142 composite.h keymap.h regex.h $(INTERVAL_SRC) $(config_h)
1138sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ 1143sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \
1139 process.h dispextern.h termhooks.h termchar.h termopts.h \ 1144 process.h dispextern.h termhooks.h termchar.h termopts.h \
1140 frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h $(config_h) 1145 frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h $(config_h)
1141term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \ 1146term.o: term.c termchar.h termhooks.h termopts.h $(config_h) cm.h frame.h \
1142 disptab.h dispextern.h keyboard.h charset.h coding.h ccl.h msdos.h 1147 disptab.h dispextern.h keyboard.h charset.h coding.h ccl.h msdos.h \
1148 window.h keymap.h
1143termcap.o: termcap.c $(config_h) 1149termcap.o: termcap.c $(config_h)
1144terminfo.o: terminfo.c $(config_h) 1150terminfo.o: terminfo.c $(config_h)
1145tparam.o: tparam.c $(config_h) 1151tparam.o: tparam.c $(config_h)
@@ -1149,18 +1155,20 @@ undo.o: undo.c buffer.h commands.h $(config_h)
1149UNEXEC_ALIAS=UNEXEC 1155UNEXEC_ALIAS=UNEXEC
1150$(UNEXEC_ALIAS): UNEXEC_SRC $(config_h) 1156$(UNEXEC_ALIAS): UNEXEC_SRC $(config_h)
1151w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \ 1157w16select.o: w16select.c dispextern.h frame.h blockinput.h atimer.h systime.h \
1152 msdos.h $(config_h) 1158 msdos.h buffer.h charset.h coding.h composite.h $(config_h)
1153widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \ 1159widget.o: widget.c xterm.h frame.h dispextern.h widgetprv.h \
1154 $(srcdir)/../lwlib/lwlib.h $(config_h) 1160 $(srcdir)/../lwlib/lwlib.h $(config_h)
1155window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \ 1161window.o: window.c indent.h commands.h frame.h window.h buffer.h termchar.h \
1156 disptab.h keyboard.h dispextern.h msdos.h composite.h \ 1162 disptab.h keyboard.h dispextern.h msdos.h composite.h \
1157 $(config_h) 1163 keymap.h blockinput.h $(INTERVAL_SRC) xterm.h w32term.h macterm.h $(config_h)
1158xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h coding.h \ 1164xdisp.o: xdisp.c macros.h commands.h process.h indent.h buffer.h dispextern.h coding.h \
1159 termchar.h frame.h window.h disptab.h termhooks.h charset.h $(config_h) \ 1165 termchar.h frame.h window.h disptab.h termhooks.h charset.h $(config_h) \
1166 keyboard.h $(INTERVAL_SRC) region-cache.h xterm.h w32term.h macterm.h \
1160 msdos.h composite.h fontset.h blockinput.h atimer.h systime.h keymap.h 1167 msdos.h composite.h fontset.h blockinput.h atimer.h systime.h keymap.h
1161xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \ 1168xfaces.o: xfaces.c dispextern.h frame.h xterm.h buffer.h blockinput.h \
1162 window.h charset.h msdos.h dosfns.h composite.h atimer.h systime.h \ 1169 window.h charset.h msdos.h dosfns.h composite.h atimer.h systime.h \
1163 termchar.h termhooks.h $(config_h) 1170 keyboard.h fontset.h w32term.h macterm.h $(INTERVAL_SRC) termchar.h \
1171 termhooks.h $(config_h)
1164xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \ 1172xfns.o: xfns.c buffer.h frame.h window.h keyboard.h xterm.h dispextern.h \
1165 $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \ 1173 $(srcdir)/../lwlib/lwlib.h blockinput.h atimer.h systime.h epaths.h \
1166 charset.h gtkutil.h termchar.h termhooks.h $(config_h) 1174 charset.h gtkutil.h termchar.h termhooks.h $(config_h)
@@ -1187,22 +1195,26 @@ atimer.o: atimer.c atimer.h systime.h $(config_h)
1187 1195
1188alloc.o: alloc.c process.h frame.h window.h buffer.h puresize.h syssignal.h keyboard.h \ 1196alloc.o: alloc.c process.h frame.h window.h buffer.h puresize.h syssignal.h keyboard.h \
1189 blockinput.h atimer.h systime.h charset.h dispextern.h $(config_h) $(INTERVAL_SRC) 1197 blockinput.h atimer.h systime.h charset.h dispextern.h $(config_h) $(INTERVAL_SRC)
1190bytecode.o: bytecode.c buffer.h syntax.h charset.h window.h $(config_h) 1198bytecode.o: bytecode.c buffer.h syntax.h charset.h window.h dispextern.h \
1191data.o: data.c buffer.h puresize.h charset.h syssignal.h keyboard.h $(config_h) 1199 frame.h xterm.h $(config_h)
1200data.o: data.c buffer.h puresize.h charset.h syssignal.h keyboard.h frame.h $(config_h)
1192eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \ 1201eval.o: eval.c commands.h keyboard.h blockinput.h atimer.h systime.h \
1193 dispextern.h $(config_h) 1202 dispextern.h $(config_h)
1194floatfns.o: floatfns.c $(config_h) 1203floatfns.o: floatfns.c $(config_h)
1195fns.o: fns.c commands.h $(config_h) frame.h buffer.h charset.h keyboard.h \ 1204fns.o: fns.c commands.h $(config_h) frame.h buffer.h charset.h keyboard.h \
1196 frame.h window.h dispextern.h $(INTERVAL_SRC) coding.h md5.h 1205 keymap.h frame.h window.h dispextern.h $(INTERVAL_SRC) coding.h md5.h \
1206 blockinput.h xterm.h
1197print.o: print.c process.h frame.h window.h buffer.h keyboard.h charset.h \ 1207print.o: print.c process.h frame.h window.h buffer.h keyboard.h charset.h \
1198 $(config_h) dispextern.h msdos.h composite.h termchar.h intervals.h 1208 $(config_h) dispextern.h termchar.h $(INTERVAL_SRC) msdos.h composite.h \
1199lread.o: lread.c commands.h keyboard.h buffer.h epaths.h charset.h $(config_h) \ 1209 termchar.h
1200 termhooks.h coding.h msdos.h 1210lread.o: lread.c commands.h keyboard.h buffer.h epaths.h charset.h \
1211 $(config_h) $(INTERVAL_SRC) termhooks.h coding.h msdos.h
1201 1212
1202/* Text properties support */ 1213/* Text properties support */
1203textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \ 1214textprop.o: textprop.c buffer.h window.h dispextern.h $(INTERVAL_SRC) \
1204 $(config_h) 1215 $(config_h)
1205intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h $(config_h) 1216intervals.o: intervals.c buffer.h $(INTERVAL_SRC) keyboard.h puresize.h \
1217 keymap.h $(config_h)
1206composite.o: composite.c buffer.h charset.h $(INTERVAL_SRC) $(config_h) 1218composite.o: composite.c buffer.h charset.h $(INTERVAL_SRC) $(config_h)
1207 1219
1208/* System-specific programs to be made. 1220/* System-specific programs to be made.
diff --git a/src/editfns.c b/src/editfns.c
index 88a0e63118f..51f8a71d531 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3668,11 +3668,13 @@ usage: (format STRING &rest OBJECTS) */)
3668 3668
3669 /* Adjust the bounds of each text property 3669 /* Adjust the bounds of each text property
3670 to the proper start and end in the output string. */ 3670 to the proper start and end in the output string. */
3671 /* We take advantage of the fact that the positions in PROPS
3672 are in increasing order, so that we can do (effectively)
3673 one scan through the position space of the format string.
3674 3671
3675 BYTEPOS is the byte position in the format string, 3672 /* Put the positions in PROPS in increasing order, so that
3673 we can do (effectively) one scan through the position
3674 space of the format string. */
3675 props = Fnreverse (props);
3676
3677 /* BYTEPOS is the byte position in the format string,
3676 POSITION is the untranslated char position in it, 3678 POSITION is the untranslated char position in it,
3677 TRANSLATED is the translated char position in BUF, 3679 TRANSLATED is the translated char position in BUF,
3678 and ARGN is the number of the next arg we will come to. */ 3680 and ARGN is the number of the next arg we will come to. */
diff --git a/src/msdos.c b/src/msdos.c
index 8b511abebd7..712eb05b959 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/xselect.c b/src/xselect.c
index a10befe2cdb..530bf060af4 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -752,7 +752,15 @@ x_reply_selection_request (event, format, data, size, type)
752 refering to the deleted window, and we'll get a BadWindow error 752 refering to the deleted window, and we'll get a BadWindow error
753 in XTread_socket when processing the events. I don't have 753 in XTread_socket when processing the events. I don't have
754 an idea how to fix that. gerd, 2001-01-98. */ 754 an idea how to fix that. gerd, 2001-01-98. */
755 XFlush (display); 755 /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are
756 delivered before uncatch errors. */
757 XSync (display, False);
758 UNBLOCK_INPUT;
759
760 /* GTK queues events in addition to the queue in Xlib. So we
761 UNBLOCK to enter the event loop and get possible errors delivered,
762 and then BLOCK again because x_uncatch_errors requires it. */
763 BLOCK_INPUT;
756 x_uncatch_errors (display, count); 764 x_uncatch_errors (display, count);
757 UNBLOCK_INPUT; 765 UNBLOCK_INPUT;
758} 766}