aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2005-07-29 01:54:54 +0000
committerMiles Bader2005-07-29 01:54:54 +0000
commit58b646fafc27ea5fb93fa95d5ff84187d689d315 (patch)
tree361704f8149dccf6d1578bea3b89da11ced846f7
parentffc3bd5c6c5ce65d4390c3523e4527c701a0ed95 (diff)
parentd44e3b453c528446579182d82284abbfd80f8b7d (diff)
downloademacs-58b646fafc27ea5fb93fa95d5ff84187d689d315.tar.gz
emacs-58b646fafc27ea5fb93fa95d5ff84187d689d315.zip
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-74
Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 493-503) - Update from CVS - Update from CVS: lisp/startup.el (command-line): Fix typo. - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 95-98) - Update from CVS
-rw-r--r--ChangeLog16
-rw-r--r--Makefile.in8
-rw-r--r--admin/FOR-RELEASE26
-rwxr-xr-xconfigure488
-rw-r--r--configure.in11
-rw-r--r--etc/.gitignore1
-rw-r--r--etc/ChangeLog6
-rw-r--r--etc/NEWS6
-rw-r--r--lib-src/.gitignore5
-rw-r--r--lib-src/ChangeLog24
-rw-r--r--lib-src/Makefile.in21
-rw-r--r--lib-src/getopt.c632
-rw-r--r--lib-src/getopt1.c79
-rw-r--r--lib-src/getopt_.h (renamed from lib-src/getopt.h)121
-rw-r--r--lib-src/getopt_int.h134
-rw-r--r--[-rwxr-xr-x]lib-src/gettext.h (renamed from nt/inc/gettext.h)31
-rw-r--r--lib-src/makefile.w32-in3
-rw-r--r--lisp/ChangeLog208
-rw-r--r--lisp/bookmark.el43
-rw-r--r--lisp/dired.el4
-rw-r--r--lisp/emacs-lisp/re-builder.el63
-rw-r--r--lisp/gnus/ChangeLog33
-rw-r--r--lisp/gnus/gnus-art.el50
-rw-r--r--lisp/gnus/gnus-util.el24
-rw-r--r--lisp/gnus/pgg.el1
-rw-r--r--lisp/gnus/rfc2231.el18
-rw-r--r--lisp/image-file.el19
-rw-r--r--lisp/isearch.el52
-rw-r--r--lisp/man.el53
-rw-r--r--lisp/net/ange-ftp.el46
-rw-r--r--lisp/progmodes/compile.el6
-rw-r--r--lisp/progmodes/gdb-ui.el33
-rw-r--r--lisp/progmodes/grep.el11
-rw-r--r--lisp/ps-bdf.el26
-rw-r--r--lisp/recentf.el24
-rw-r--r--lisp/simple.el4
-rw-r--r--lisp/smerge-mode.el2
-rw-r--r--lisp/startup.el12
-rw-r--r--lisp/tempo.el2
-rw-r--r--lisp/term/README7
-rw-r--r--lisp/term/apollo.el5
-rw-r--r--lisp/term/bobcat.el9
-rw-r--r--lisp/term/cygwin.el10
-rw-r--r--lisp/term/iris-ansi.el594
-rw-r--r--lisp/term/linux.el22
-rw-r--r--lisp/term/news.el80
-rw-r--r--lisp/term/rxvt.el212
-rw-r--r--lisp/term/sun.el216
-rw-r--r--lisp/term/tvi970.el149
-rw-r--r--lisp/term/vt100.el6
-rw-r--r--lisp/term/vt102.el4
-rw-r--r--lisp/term/vt125.el4
-rw-r--r--lisp/term/vt200.el8
-rw-r--r--lisp/term/vt201.el9
-rw-r--r--lisp/term/vt220.el9
-rw-r--r--lisp/term/vt240.el9
-rw-r--r--lisp/term/vt300.el9
-rw-r--r--lisp/term/vt320.el9
-rw-r--r--lisp/term/vt400.el9
-rw-r--r--lisp/term/vt420.el9
-rw-r--r--lisp/term/wyse50.el173
-rw-r--r--lisp/term/xterm.el481
-rw-r--r--lisp/tooltip.el2
-rw-r--r--lispref/ChangeLog15
-rw-r--r--lispref/internals.texi13
-rw-r--r--lispref/loading.texi13
-rw-r--r--lispref/modes.texi2
-rw-r--r--m4/getopt.m482
-rwxr-xr-xmake-dist9
-rw-r--r--man/ChangeLog10
-rw-r--r--man/files.texi1
-rw-r--r--man/gnus.texi8
-rw-r--r--nt/.gitignore2
-rw-r--r--nt/ChangeLog15
-rwxr-xr-xnt/configure.bat3
-rw-r--r--src/ChangeLog82
-rw-r--r--src/alloc.c23
-rw-r--r--src/bytecode.c15
-rw-r--r--src/config.in16
-rw-r--r--src/eval.c30
-rw-r--r--src/insdel.c1
-rw-r--r--src/keyboard.c3
-rw-r--r--src/lisp.h6
-rw-r--r--src/mac.c58
-rw-r--r--src/macfns.c318
-rw-r--r--src/macmenu.c57
-rw-r--r--src/macselect.c12
-rw-r--r--src/s/cygwin.h4
-rw-r--r--src/w32fns.c8
-rw-r--r--src/w32menu.c7
-rw-r--r--src/w32term.c16
91 files changed, 3181 insertions, 2039 deletions
diff --git a/ChangeLog b/ChangeLog
index c44bcfbbf38..2f054186bfe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
12005-07-28 Juanma Barranquero <lekktu@gmail.com>
2
3 * .cvsignore: Add `data' and `site-lisp' (for in-place installs).
4
52005-07-26 Paul Eggert <eggert@cs.ucla.edu>
6
7 Merge gnulib getopt implementation into Emacs.
8
9 * Makefile.in (AUTOCONF_INPUTS): New macro.
10 ($(srcdir)/configure, $(srcdir)/src/stamp-h.in): Depend on it,
11 so that these files also depend on m4/getopt.m4.
12 * configure.in: Configure getopt by including m4/getopt.m4,
13 and configuring a getopt replacement if necessary.
14 * make-dist: Add m4 subdirectory. Unlink lib-src/getopt.h.
15 * m4/getopt.m4: New file.
16
12005-07-06 Lute Kamstra <lute@gnu.org> 172005-07-06 Lute Kamstra <lute@gnu.org>
2 18
3 * configure.in: Fix capitalization. 19 * configure.in: Fix capitalization.
diff --git a/Makefile.in b/Makefile.in
index 811a8205c45..c8fa29b3439 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -2,7 +2,7 @@
2# DIST: make most of the changes to this file you might want, so try 2# DIST: make most of the changes to this file you might want, so try
3# DIST: that first. 3# DIST: that first.
4 4
5# Copyright (C) 1992,93,94,95,96,97,98,1999,2000,01,02,03,2004 5# Copyright (C) 1992,93,94,95,96,97,98,1999,2000,01,02,03,04,2005
6# Free Software Foundation, Inc. 6# Free Software Foundation, Inc.
7 7
8# This file is part of GNU Emacs. 8# This file is part of GNU Emacs.
@@ -302,12 +302,14 @@ Makefile: $(srcdir)/Makefile.in config.status
302config.status: ${srcdir}/configure 302config.status: ${srcdir}/configure
303 ./config.status --recheck 303 ./config.status --recheck
304 304
305${srcdir}/configure: @MAINT@ ${srcdir}/configure.in 305AUTOCONF_INPUTS = @MAINT@ $(srcdir)/configure.in $(srcdir)/m4/getopt.m4
306
307$(srcdir)/configure: $(AUTOCONF_INPUTS)
306 cd ${srcdir} && autoconf 308 cd ${srcdir} && autoconf
307 309
308$(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in 310$(srcdir)/src/config.in: $(srcdir)/src/stamp-h.in
309 @true 311 @true
310$(srcdir)/src/stamp-h.in: @MAINT@ ${srcdir}/configure.in 312$(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
311 cd ${srcdir} && autoheader 313 cd ${srcdir} && autoheader
312 rm -f $(srcdir)/src/stamp-h.in 314 rm -f $(srcdir)/src/stamp-h.in
313 echo timestamp > $(srcdir)/src/stamp-h.in 315 echo timestamp > $(srcdir)/src/stamp-h.in
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE
index 7ef6c4349b7..b701f2509e7 100644
--- a/admin/FOR-RELEASE
+++ b/admin/FOR-RELEASE
@@ -79,32 +79,6 @@ The *Tree* is then displayed as
79 79
80The class A seems to be missing. 80The class A seems to be missing.
81 81
82** Ange-ftp should ignore irrelevant IPv6 errors:
83
84Message-Id: <4121-Tue23Mar2004165249+0100-piet@cs.uu.nl>
85From: "Piet van Oostrum" <piet@cs.uu.nl>
86To: emacs-pretest-bug@gnu.org
87Subject: Ange-ftp can't deal with IPV6/IPV4 fallback
88
89Symptoms:
90
91C-x C-f /ftp.nluug.nl:/
92
93The problem is that the DNS first gives an IPV6 address. However our
94router doesn't do IPV6. Ftp then falls back to IPV4:
95
96ftp> open ftp.nluug.nl
97Trying 2001:610:1:80aa:192:87:102:36...
98ftp: connect to address 2001:610:1:80aa:192:87:102:36: No route to host
99Trying 192.87.102.36...
100Connected to ftp.nluug.nl.
101
102Ange-ftp chokes on the `No route to host' message and doesn't look any
103further.
104
105I think in the near future we will see more of this problem, so it might be
106time to make anfe-ftp more intelligent.
107
108* DOCUMENTATION 82* DOCUMENTATION
109 83
110** Document Custom Themes. 84** Document Custom Themes.
diff --git a/configure b/configure
index ac6c9d9fa96..aa788f6d5cb 100755
--- a/configure
+++ b/configure
@@ -310,7 +310,7 @@ ac_includes_default="\
310# include <unistd.h> 310# include <unistd.h>
311#endif" 311#endif"
312 312
313ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LN_S CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO EGREP LIBSOUND SET_MAKE PKG_CONFIG GTK_CFLAGS GTK_LIBS ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS' 313ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT LN_S CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA RANLIB ac_ct_RANLIB INSTALL_INFO EGREP LIBSOUND SET_MAKE PKG_CONFIG GTK_CFLAGS GTK_LIBS ALLOCA liblockfile LIBOBJS NEED_SETGID KMEM_GROUP GETLOADAVG_LIBS GETOPT_H GETOPTOBJS version configuration canonical srcdir lispdir locallisppath lisppath x_default_search_path etcdir archlibdir docdir bitmapdir gamedir gameuser c_switch_system c_switch_machine LD_SWITCH_X_SITE LD_SWITCH_X_SITE_AUX C_SWITCH_X_SITE X_TOOLKIT_TYPE machfile opsysfile carbon_appdir LTLIBOBJS'
314ac_subst_files='' 314ac_subst_files=''
315 315
316# Initialize some variables set by options. 316# Initialize some variables set by options.
@@ -16828,6 +16828,490 @@ _ACEOF
16828fi 16828fi
16829 16829
16830 16830
16831# Configure getopt.
16832# getopt.m4 serial 10
16833
16834# The getopt module assume you want GNU getopt, with getopt_long etc,
16835# rather than vanilla POSIX getopt. This means your your code should
16836# always include <getopt.h> for the getopt prototypes.
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848# Prerequisites of lib/getopt*.
16849
16850
16851
16852 GETOPT_H=
16853
16854for ac_header in getopt.h
16855do
16856as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
16857if eval "test \"\${$as_ac_Header+set}\" = set"; then
16858 echo "$as_me:$LINENO: checking for $ac_header" >&5
16859echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
16860if eval "test \"\${$as_ac_Header+set}\" = set"; then
16861 echo $ECHO_N "(cached) $ECHO_C" >&6
16862fi
16863echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
16864echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
16865else
16866 # Is the header compilable?
16867echo "$as_me:$LINENO: checking $ac_header usability" >&5
16868echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
16869cat >conftest.$ac_ext <<_ACEOF
16870/* confdefs.h. */
16871_ACEOF
16872cat confdefs.h >>conftest.$ac_ext
16873cat >>conftest.$ac_ext <<_ACEOF
16874/* end confdefs.h. */
16875$ac_includes_default
16876#include <$ac_header>
16877_ACEOF
16878rm -f conftest.$ac_objext
16879if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
16880 (eval $ac_compile) 2>conftest.er1
16881 ac_status=$?
16882 grep -v '^ *+' conftest.er1 >conftest.err
16883 rm -f conftest.er1
16884 cat conftest.err >&5
16885 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16886 (exit $ac_status); } &&
16887 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
16888 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
16889 (eval $ac_try) 2>&5
16890 ac_status=$?
16891 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16892 (exit $ac_status); }; } &&
16893 { ac_try='test -s conftest.$ac_objext'
16894 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
16895 (eval $ac_try) 2>&5
16896 ac_status=$?
16897 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16898 (exit $ac_status); }; }; then
16899 ac_header_compiler=yes
16900else
16901 echo "$as_me: failed program was:" >&5
16902sed 's/^/| /' conftest.$ac_ext >&5
16903
16904ac_header_compiler=no
16905fi
16906rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
16907echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
16908echo "${ECHO_T}$ac_header_compiler" >&6
16909
16910# Is the header present?
16911echo "$as_me:$LINENO: checking $ac_header presence" >&5
16912echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
16913cat >conftest.$ac_ext <<_ACEOF
16914/* confdefs.h. */
16915_ACEOF
16916cat confdefs.h >>conftest.$ac_ext
16917cat >>conftest.$ac_ext <<_ACEOF
16918/* end confdefs.h. */
16919#include <$ac_header>
16920_ACEOF
16921if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
16922 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
16923 ac_status=$?
16924 grep -v '^ *+' conftest.er1 >conftest.err
16925 rm -f conftest.er1
16926 cat conftest.err >&5
16927 echo "$as_me:$LINENO: \$? = $ac_status" >&5
16928 (exit $ac_status); } >/dev/null; then
16929 if test -s conftest.err; then
16930 ac_cpp_err=$ac_c_preproc_warn_flag
16931 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
16932 else
16933 ac_cpp_err=
16934 fi
16935else
16936 ac_cpp_err=yes
16937fi
16938if test -z "$ac_cpp_err"; then
16939 ac_header_preproc=yes
16940else
16941 echo "$as_me: failed program was:" >&5
16942sed 's/^/| /' conftest.$ac_ext >&5
16943
16944 ac_header_preproc=no
16945fi
16946rm -f conftest.err conftest.$ac_ext
16947echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
16948echo "${ECHO_T}$ac_header_preproc" >&6
16949
16950# So? What about this header?
16951case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
16952 yes:no: )
16953 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
16954echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
16955 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
16956echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
16957 ac_header_preproc=yes
16958 ;;
16959 no:yes:* )
16960 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
16961echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
16962 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
16963echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
16964 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
16965echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
16966 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
16967echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
16968 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
16969echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
16970 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
16971echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
16972 (
16973 cat <<\_ASBOX
16974## ------------------------------------------ ##
16975## Report this to the AC_PACKAGE_NAME lists. ##
16976## ------------------------------------------ ##
16977_ASBOX
16978 ) |
16979 sed "s/^/$as_me: WARNING: /" >&2
16980 ;;
16981esac
16982echo "$as_me:$LINENO: checking for $ac_header" >&5
16983echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
16984if eval "test \"\${$as_ac_Header+set}\" = set"; then
16985 echo $ECHO_N "(cached) $ECHO_C" >&6
16986else
16987 eval "$as_ac_Header=\$ac_header_preproc"
16988fi
16989echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
16990echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
16991
16992fi
16993if test `eval echo '${'$as_ac_Header'}'` = yes; then
16994 cat >>confdefs.h <<_ACEOF
16995#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
16996_ACEOF
16997
16998else
16999 GETOPT_H=getopt.h
17000fi
17001
17002done
17003
17004 if test -z "$GETOPT_H"; then
17005
17006for ac_func in getopt_long_only
17007do
17008as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
17009echo "$as_me:$LINENO: checking for $ac_func" >&5
17010echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
17011if eval "test \"\${$as_ac_var+set}\" = set"; then
17012 echo $ECHO_N "(cached) $ECHO_C" >&6
17013else
17014 cat >conftest.$ac_ext <<_ACEOF
17015/* confdefs.h. */
17016_ACEOF
17017cat confdefs.h >>conftest.$ac_ext
17018cat >>conftest.$ac_ext <<_ACEOF
17019/* end confdefs.h. */
17020/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
17021 For example, HP-UX 11i <limits.h> declares gettimeofday. */
17022#define $ac_func innocuous_$ac_func
17023
17024/* System header to define __stub macros and hopefully few prototypes,
17025 which can conflict with char $ac_func (); below.
17026 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
17027 <limits.h> exists even on freestanding compilers. */
17028
17029#ifdef __STDC__
17030# include <limits.h>
17031#else
17032# include <assert.h>
17033#endif
17034
17035#undef $ac_func
17036
17037/* Override any gcc2 internal prototype to avoid an error. */
17038#ifdef __cplusplus
17039extern "C"
17040{
17041#endif
17042/* We use char because int might match the return type of a gcc2
17043 builtin and then its argument prototype would still apply. */
17044char $ac_func ();
17045/* The GNU C library defines this for functions which it implements
17046 to always fail with ENOSYS. Some functions are actually named
17047 something starting with __ and the normal name is an alias. */
17048#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
17049choke me
17050#else
17051char (*f) () = $ac_func;
17052#endif
17053#ifdef __cplusplus
17054}
17055#endif
17056
17057int
17058main ()
17059{
17060return f != $ac_func;
17061 ;
17062 return 0;
17063}
17064_ACEOF
17065rm -f conftest.$ac_objext conftest$ac_exeext
17066if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
17067 (eval $ac_link) 2>conftest.er1
17068 ac_status=$?
17069 grep -v '^ *+' conftest.er1 >conftest.err
17070 rm -f conftest.er1
17071 cat conftest.err >&5
17072 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17073 (exit $ac_status); } &&
17074 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
17075 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
17076 (eval $ac_try) 2>&5
17077 ac_status=$?
17078 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17079 (exit $ac_status); }; } &&
17080 { ac_try='test -s conftest$ac_exeext'
17081 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
17082 (eval $ac_try) 2>&5
17083 ac_status=$?
17084 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17085 (exit $ac_status); }; }; then
17086 eval "$as_ac_var=yes"
17087else
17088 echo "$as_me: failed program was:" >&5
17089sed 's/^/| /' conftest.$ac_ext >&5
17090
17091eval "$as_ac_var=no"
17092fi
17093rm -f conftest.err conftest.$ac_objext \
17094 conftest$ac_exeext conftest.$ac_ext
17095fi
17096echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
17097echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
17098if test `eval echo '${'$as_ac_var'}'` = yes; then
17099 cat >>confdefs.h <<_ACEOF
17100#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
17101_ACEOF
17102
17103else
17104 GETOPT_H=getopt.h
17105fi
17106done
17107
17108 fi
17109
17110 if test -z "$GETOPT_H"; then
17111 echo "$as_me:$LINENO: checking whether optreset is declared" >&5
17112echo $ECHO_N "checking whether optreset is declared... $ECHO_C" >&6
17113if test "${ac_cv_have_decl_optreset+set}" = set; then
17114 echo $ECHO_N "(cached) $ECHO_C" >&6
17115else
17116 cat >conftest.$ac_ext <<_ACEOF
17117/* confdefs.h. */
17118_ACEOF
17119cat confdefs.h >>conftest.$ac_ext
17120cat >>conftest.$ac_ext <<_ACEOF
17121/* end confdefs.h. */
17122#include <getopt.h>
17123
17124int
17125main ()
17126{
17127#ifndef optreset
17128 char *p = (char *) optreset;
17129#endif
17130
17131 ;
17132 return 0;
17133}
17134_ACEOF
17135rm -f conftest.$ac_objext
17136if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
17137 (eval $ac_compile) 2>conftest.er1
17138 ac_status=$?
17139 grep -v '^ *+' conftest.er1 >conftest.err
17140 rm -f conftest.er1
17141 cat conftest.err >&5
17142 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17143 (exit $ac_status); } &&
17144 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
17145 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
17146 (eval $ac_try) 2>&5
17147 ac_status=$?
17148 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17149 (exit $ac_status); }; } &&
17150 { ac_try='test -s conftest.$ac_objext'
17151 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
17152 (eval $ac_try) 2>&5
17153 ac_status=$?
17154 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17155 (exit $ac_status); }; }; then
17156 ac_cv_have_decl_optreset=yes
17157else
17158 echo "$as_me: failed program was:" >&5
17159sed 's/^/| /' conftest.$ac_ext >&5
17160
17161ac_cv_have_decl_optreset=no
17162fi
17163rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
17164fi
17165echo "$as_me:$LINENO: result: $ac_cv_have_decl_optreset" >&5
17166echo "${ECHO_T}$ac_cv_have_decl_optreset" >&6
17167if test $ac_cv_have_decl_optreset = yes; then
17168 GETOPT_H=getopt.h
17169fi
17170
17171 fi
17172
17173 if test -z "$GETOPT_H"; then
17174 echo "$as_me:$LINENO: checking for working GNU getopt function" >&5
17175echo $ECHO_N "checking for working GNU getopt function... $ECHO_C" >&6
17176if test "${gl_cv_func_gnu_getopt+set}" = set; then
17177 echo $ECHO_N "(cached) $ECHO_C" >&6
17178else
17179 if test "$cross_compiling" = yes; then
17180 echo "$as_me:$LINENO: checking whether getopt_clip is declared" >&5
17181echo $ECHO_N "checking whether getopt_clip is declared... $ECHO_C" >&6
17182if test "${ac_cv_have_decl_getopt_clip+set}" = set; then
17183 echo $ECHO_N "(cached) $ECHO_C" >&6
17184else
17185 cat >conftest.$ac_ext <<_ACEOF
17186/* confdefs.h. */
17187_ACEOF
17188cat confdefs.h >>conftest.$ac_ext
17189cat >>conftest.$ac_ext <<_ACEOF
17190/* end confdefs.h. */
17191#include <getopt.h>
17192
17193int
17194main ()
17195{
17196#ifndef getopt_clip
17197 char *p = (char *) getopt_clip;
17198#endif
17199
17200 ;
17201 return 0;
17202}
17203_ACEOF
17204rm -f conftest.$ac_objext
17205if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
17206 (eval $ac_compile) 2>conftest.er1
17207 ac_status=$?
17208 grep -v '^ *+' conftest.er1 >conftest.err
17209 rm -f conftest.er1
17210 cat conftest.err >&5
17211 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17212 (exit $ac_status); } &&
17213 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
17214 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
17215 (eval $ac_try) 2>&5
17216 ac_status=$?
17217 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17218 (exit $ac_status); }; } &&
17219 { ac_try='test -s conftest.$ac_objext'
17220 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
17221 (eval $ac_try) 2>&5
17222 ac_status=$?
17223 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17224 (exit $ac_status); }; }; then
17225 ac_cv_have_decl_getopt_clip=yes
17226else
17227 echo "$as_me: failed program was:" >&5
17228sed 's/^/| /' conftest.$ac_ext >&5
17229
17230ac_cv_have_decl_getopt_clip=no
17231fi
17232rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
17233fi
17234echo "$as_me:$LINENO: result: $ac_cv_have_decl_getopt_clip" >&5
17235echo "${ECHO_T}$ac_cv_have_decl_getopt_clip" >&6
17236if test $ac_cv_have_decl_getopt_clip = yes; then
17237 gl_cv_func_gnu_getopt=no
17238else
17239 gl_cv_func_gnu_getopt=yes
17240fi
17241
17242else
17243 cat >conftest.$ac_ext <<_ACEOF
17244/* confdefs.h. */
17245_ACEOF
17246cat confdefs.h >>conftest.$ac_ext
17247cat >>conftest.$ac_ext <<_ACEOF
17248/* end confdefs.h. */
17249#include <getopt.h>
17250int
17251main ()
17252{
17253
17254 char *myargv[3];
17255 myargv[0] = "conftest";
17256 myargv[1] = "-+";
17257 myargv[2] = 0;
17258 return getopt (2, myargv, "+a") != '?';
17259
17260 ;
17261 return 0;
17262}
17263_ACEOF
17264rm -f conftest$ac_exeext
17265if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
17266 (eval $ac_link) 2>&5
17267 ac_status=$?
17268 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17269 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
17270 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
17271 (eval $ac_try) 2>&5
17272 ac_status=$?
17273 echo "$as_me:$LINENO: \$? = $ac_status" >&5
17274 (exit $ac_status); }; }; then
17275 gl_cv_func_gnu_getopt=yes
17276else
17277 echo "$as_me: program exited with status $ac_status" >&5
17278echo "$as_me: failed program was:" >&5
17279sed 's/^/| /' conftest.$ac_ext >&5
17280
17281( exit $ac_status )
17282gl_cv_func_gnu_getopt=no
17283fi
17284rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
17285fi
17286fi
17287echo "$as_me:$LINENO: result: $gl_cv_func_gnu_getopt" >&5
17288echo "${ECHO_T}$gl_cv_func_gnu_getopt" >&6
17289 if test "$gl_cv_func_gnu_getopt" = "no"; then
17290 GETOPT_H=getopt.h
17291 fi
17292 fi
17293
17294
17295
17296 if test -n "$GETOPT_H"; then
17297
17298
17299 GETOPT_H=getopt.h
17300
17301cat >>confdefs.h <<\_ACEOF
17302#define __GETOPT_PREFIX rpl_
17303_ACEOF
17304
17305
17306
17307 :
17308 GETOPTOBJS='getopt.o getopt1.o'
17309
17310fi
17311
17312
17313
17314
16831echo "$as_me:$LINENO: checking whether getpgrp requires zero arguments" >&5 17315echo "$as_me:$LINENO: checking whether getpgrp requires zero arguments" >&5
16832echo $ECHO_N "checking whether getpgrp requires zero arguments... $ECHO_C" >&6 17316echo $ECHO_N "checking whether getpgrp requires zero arguments... $ECHO_C" >&6
16833if test "${ac_cv_func_getpgrp_void+set}" = set; then 17317if test "${ac_cv_func_getpgrp_void+set}" = set; then
@@ -22646,6 +23130,8 @@ s,@LIBOBJS@,$LIBOBJS,;t t
22646s,@NEED_SETGID@,$NEED_SETGID,;t t 23130s,@NEED_SETGID@,$NEED_SETGID,;t t
22647s,@KMEM_GROUP@,$KMEM_GROUP,;t t 23131s,@KMEM_GROUP@,$KMEM_GROUP,;t t
22648s,@GETLOADAVG_LIBS@,$GETLOADAVG_LIBS,;t t 23132s,@GETLOADAVG_LIBS@,$GETLOADAVG_LIBS,;t t
23133s,@GETOPT_H@,$GETOPT_H,;t t
23134s,@GETOPTOBJS@,$GETOPTOBJS,;t t
22649s,@version@,$version,;t t 23135s,@version@,$version,;t t
22650s,@configuration@,$configuration,;t t 23136s,@configuration@,$configuration,;t t
22651s,@canonical@,$canonical,;t t 23137s,@canonical@,$canonical,;t t
diff --git a/configure.in b/configure.in
index d288fc1b87e..5cb3f808688 100644
--- a/configure.in
+++ b/configure.in
@@ -2353,7 +2353,7 @@ if test "${HAVE_CARBON}" = "yes"; then
2353 CFLAGS="$CFLAGS -framework Carbon" 2353 CFLAGS="$CFLAGS -framework Carbon"
2354 AC_CHECK_FUNC(CancelMenuTracking, have_cmt=yes, have_cmt=no) 2354 AC_CHECK_FUNC(CancelMenuTracking, have_cmt=yes, have_cmt=no)
2355 if test "$have_cmt" = yes; then 2355 if test "$have_cmt" = yes; then
2356 AC_DEFINE(HAVE_CANCELMENUTRACKING, 1, 2356 AC_DEFINE(HAVE_CANCELMENUTRACKING, 1,
2357 [Define to 1 if CancelMenuTracking is available (Mac OSX).]) 2357 [Define to 1 if CancelMenuTracking is available (Mac OSX).])
2358 fi 2358 fi
2359 CFLAGS="$tmp_CFLAGS" 2359 CFLAGS="$tmp_CFLAGS"
@@ -2434,6 +2434,15 @@ AC_FUNC_GETLOADAVG
2434 2434
2435AC_FUNC_FSEEKO 2435AC_FUNC_FSEEKO
2436 2436
2437# Configure getopt.
2438m4_include([m4/getopt.m4])
2439gl_GETOPT_IFELSE([
2440 gl_GETOPT_SUBSTITUTE_HEADER
2441 gl_PREREQ_GETOPT
2442 GETOPTOBJS='getopt.o getopt1.o'
2443])
2444AC_SUBST(GETOPTOBJS)
2445
2437AC_FUNC_GETPGRP 2446AC_FUNC_GETPGRP
2438 2447
2439AC_FUNC_STRFTIME 2448AC_FUNC_STRFTIME
diff --git a/etc/.gitignore b/etc/.gitignore
index 38c525889bb..15e45da4361 100644
--- a/etc/.gitignore
+++ b/etc/.gitignore
@@ -1,4 +1,5 @@
1fns-* 1fns-*
2icons
2*.ps 3*.ps
3*.log 4*.log
4*.dvi 5*.dvi
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 8fdb699c50e..80e01003faa 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,10 +1,14 @@
12005-07-28 Juanma Barranquero <lekktu@gmail.com>
2
3 * .cvsignore: Add `icons' (for in-place installs).
4
12005-07-19 Juri Linkov <juri@jurta.org> 52005-07-19 Juri Linkov <juri@jurta.org>
2 6
3 * grep.txt: New file. 7 * grep.txt: New file.
4 8
52005-07-19 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 92005-07-19 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
6 10
7 * PROBLEMS (Fedora Core 4 GNU/Linux: Segfault during dumping): 11 * PROBLEMS (Fedora Core 4 GNU/Linux: Segfault during dumping):
8 -R comes after i386 in setarch command. 12 -R comes after i386 in setarch command.
9 13
102005-07-12 Juri Linkov <juri@jurta.org> 142005-07-12 Juri Linkov <juri@jurta.org>
diff --git a/etc/NEWS b/etc/NEWS
index e1cf10de70d..f98e24a8e5e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2258,7 +2258,7 @@ syntactic indentation.
2258 2258
2259** In sh-script, a continuation line is only indented if the backslash was 2259** In sh-script, a continuation line is only indented if the backslash was
2260preceded by a SPC or a TAB. 2260preceded by a SPC or a TAB.
2261 2261
2262--- 2262---
2263** Perl mode has a new variable `perl-indent-continued-arguments'. 2263** Perl mode has a new variable `perl-indent-continued-arguments'.
2264 2264
@@ -5105,8 +5105,8 @@ running under X.
5105 5105
5106+++ 5106+++
5107*** New variable `gc-cons-percentage' automatically grows the GC cons threshold 5107*** New variable `gc-cons-percentage' automatically grows the GC cons threshold
5108as the heap sizxe increases. 5108as the heap size increases.
5109 5109
5110+++ 5110+++
5111*** New variables `gc-elapsed' and `gcs-done' provide extra information 5111*** New variables `gc-elapsed' and `gcs-done' provide extra information
5112on garbage collection. 5112on garbage collection.
diff --git a/lib-src/.gitignore b/lib-src/.gitignore
index 167540307ae..66933a62c36 100644
--- a/lib-src/.gitignore
+++ b/lib-src/.gitignore
@@ -1,7 +1,7 @@
1DOC 1DOC
2Makefile.c 2Makefile.c
3b2m 3b2m
4ctags 4ctags*
5cvtmail 5cvtmail
6digest-doc 6digest-doc
7ebrowse 7ebrowse
@@ -9,8 +9,7 @@ emacsclient
9emacsserver 9emacsserver
10etags 10etags
11fakemail 11fakemail
12fns-* 12getopt.h
13fns.el
14hexl 13hexl
15make-docfile 14make-docfile
16movemail 15movemail
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index dd4dc62a562..5767b49aaed 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,27 @@
12005-07-27 Juanma Barranquero <lekktu@gmail.com>
2
3 * .cvsignore: Don't ignore fns-* and fns.el, which are no longer
4 generated. Ignore also ctags.c and getopt.h.
5
6 * makefile.w32-in (clean): Delete getopt.h.
7 (getopt.h): New rule.
8
92005-07-26 Paul Eggert <eggert@cs.ucla.edu>
10
11 Merge gnulib getopt implementation into Emacs.
12
13 * Makefile.in (mostlyclean): Remove getopt.h, getopt.h-t.
14 (GETOPT_H): New macro, from gnulib.
15 (getopt.h): New rule, from gnulib.
16 (GETOPTOBJS): Now autoconfigured.
17 (GETOPTDEPS): getopt.h is now autoconfigured.
18 (getopt.o, getopt1.o): Depend on $(GETOPT_H), not ${srcdir}/getopt.h.
19 (getopt.o): Depend on ${srcdir}/gettext.h.
20 (movemail.o): Depend on $(GETOPT_H).
21 * getopt.c, getopt1.c: Sync from gnulib.
22 * getopt_.h, getopt_int.h, gettext.h: New files, from gnulib.
23 * getopt.h: Removed (now is getopt_.h).
24
12005-07-13 Ken Raeburn <raeburn@gnu.org> 252005-07-13 Ken Raeburn <raeburn@gnu.org>
2 26
3 * pop.c: Don't include des.h (or variants thereof); krb.h will do 27 * pop.c: Don't include des.h (or variants thereof); krb.h will do
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index 372983221a3..6fa89e728c6 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -1,5 +1,5 @@
1# Makefile for lib-src subdirectory in GNU Emacs. 1# Makefile for lib-src subdirectory in GNU Emacs.
2# Copyright (C) 1985, 1987, 1988, 1993, 1994, 2002, 2003, 2004 2# Copyright (C) 1985, 1987, 1988, 1993, 1994, 2002, 2003, 2004, 2005
3# Free Software Foundation, Inc. 3# Free Software Foundation, Inc.
4 4
5# This file is part of GNU Emacs. 5# This file is part of GNU Emacs.
@@ -344,7 +344,7 @@ uninstall:
344 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) 344 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS})
345 345
346mostlyclean: 346mostlyclean:
347 -rm -f core *.o 347 -rm -f core *.o getopt.h getopt.h-t
348 348
349clean: mostlyclean 349clean: mostlyclean
350 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL} 350 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
@@ -382,11 +382,18 @@ test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
382 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c 382 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c
383 ./test-distrib ${srcdir}/testfile 383 ./test-distrib ${srcdir}/testfile
384 384
385GETOPTOBJS = getopt.o getopt1.o 385/* We need the following in order to create a <getopt.h> when the system
386GETOPTDEPS = $(GETOPTOBJS) ${srcdir}/getopt.h 386 doesn't have one that works with the given compiler. */
387getopt.o: ${srcdir}/getopt.c ${srcdir}/getopt.h 387GETOPT_H = @GETOPT_H@
388getopt.h: getopt_.h
389 cp $(srcdir)/getopt_.h $@-t
390 mv $@-t $@
391
392GETOPTOBJS = @GETOPTOBJS@
393GETOPTDEPS = $(GETOPTOBJS) $(GETOPT_H)
394getopt.o: ${srcdir}/getopt.c $(GETOPT_H) ${srcdir}/gettext.h
388 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c 395 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt.c
389getopt1.o: ${srcdir}/getopt1.c ${srcdir}/getopt.h 396getopt1.o: ${srcdir}/getopt1.c $(GETOPT_H)
390 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c 397 ${CC} -c ${CPP_CFLAGS} ${srcdir}/getopt1.c
391 398
392#ifdef REGEXP_IN_LIBC 399#ifdef REGEXP_IN_LIBC
@@ -430,7 +437,7 @@ b2m${EXEEXT}: ${srcdir}/b2m.c ../src/config.h $(GETOPTDEPS)
430movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS) 437movemail${EXEEXT}: movemail.o pop.o $(GETOPTDEPS)
431 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MAIL) $(LIBS_MOVE) -o movemail 438 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o $(GETOPTOBJS) $(LOADLIBES) $(LIBS_MAIL) $(LIBS_MOVE) -o movemail
432 439
433movemail.o: ${srcdir}/movemail.c ../src/config.h 440movemail.o: ${srcdir}/movemail.c ../src/config.h $(GETOPT_H)
434 $(CC) -c ${CPP_CFLAGS} -Demacs ${MOVE_FLAGS} ${srcdir}/movemail.c 441 $(CC) -c ${CPP_CFLAGS} -Demacs ${MOVE_FLAGS} ${srcdir}/movemail.c
435 442
436pop.o: ${srcdir}/pop.c ../src/config.h 443pop.o: ${srcdir}/pop.c ../src/config.h
diff --git a/lib-src/getopt.c b/lib-src/getopt.c
index 6799045bde8..8cbe6e1a1da 100644
--- a/lib-src/getopt.c
+++ b/lib-src/getopt.c
@@ -2,8 +2,8 @@
2 NOTE: getopt is now part of the C library, so if you don't know what 2 NOTE: getopt is now part of the C library, so if you don't know what
3 "Keep this file name-space clean" means, talk to drepper@gnu.org 3 "Keep this file name-space clean" means, talk to drepper@gnu.org
4 before changing it! 4 before changing it!
5 Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002 5 Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002,2003,2004
6 Free Software Foundation, Inc. 6 Free Software Foundation, Inc.
7 This file is part of the GNU C Library. 7 This file is part of the GNU C Library.
8 8
9 This program is free software; you can redistribute it and/or modify 9 This program is free software; you can redistribute it and/or modify
@@ -30,35 +30,8 @@
30# include <config.h> 30# include <config.h>
31#endif 31#endif
32 32
33#if !defined __STDC__ || !__STDC__
34/* This is a separate conditional since some stdc systems
35 reject `defined (const)'. */
36# ifndef const
37# define const
38# endif
39#endif
40
41#include <stdio.h> 33#include <stdio.h>
42 34
43/* Comment out all this code if we are using the GNU C Library, and are not
44 actually compiling the library itself. This code is part of the GNU C
45 Library, but also included in many other GNU distributions. Compiling
46 and linking in this code is a waste when using the GNU C library
47 (especially if it is a shared library). Rather than having every GNU
48 program understand `configure --with-gnu-libc' and omit the object files,
49 it is simpler to just do this in the source for each such file. */
50
51#define GETOPT_INTERFACE_VERSION 2
52#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
53# include <gnu-versions.h>
54# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
55# define ELIDE_CODE
56# endif
57#endif
58
59#ifndef ELIDE_CODE
60
61
62/* This needs to come after some library #include 35/* This needs to come after some library #include
63 to get __GNU_LIBRARY__ defined. */ 36 to get __GNU_LIBRARY__ defined. */
64#ifdef __GNU_LIBRARY__ 37#ifdef __GNU_LIBRARY__
@@ -68,32 +41,18 @@
68# include <unistd.h> 41# include <unistd.h>
69#endif /* GNU C library. */ 42#endif /* GNU C library. */
70 43
44#include <string.h>
45
71#ifdef VMS 46#ifdef VMS
72# include <unixlib.h> 47# include <unixlib.h>
73# if HAVE_STRING_H - 0
74# include <string.h>
75# endif
76#endif 48#endif
77 49
78#if HAVE_LIBINTL_H 50#ifdef _LIBC
79# include <libintl.h> 51# include <libintl.h>
80#endif /* HAVE_LIBINTL_H */ 52#else
81 53# include "gettext.h"
82#if 0 54# define _(msgid) gettext (msgid)
83# ifdef _LIBC 55#endif
84# include <libintl.h>
85# else /* not #ifdef _LIBC */
86/* This is for other GNU distributions with internationalized messages. */
87# include "gettext.h"
88# endif /* end #ifdef _LIBC */
89#endif /* end #if 0 */
90
91#if HAVE_LIBINTL_H
92 /* Should I include libintl.h here as in regex.c ? */
93# define _(msgid) gettext (msgid)
94#else /* not #if HAVE_LIBINTL_H */
95# define _(msgid) (msgid)
96#endif /* end #if HAVE_LIBINTL_H */
97 56
98#if defined _LIBC && defined USE_IN_LIBIO 57#if defined _LIBC && defined USE_IN_LIBIO
99# include <wchar.h> 58# include <wchar.h>
@@ -103,21 +62,22 @@
103# define attribute_hidden 62# define attribute_hidden
104#endif 63#endif
105 64
106/* This version of `getopt' appears to the caller like standard Unix `getopt' 65/* Unlike standard Unix `getopt', functions like `getopt_long'
107 but it behaves differently for the user, since it allows the user 66 let the user intersperse the options with the other arguments.
108 to intersperse the options with the other arguments.
109 67
110 As `getopt' works, it permutes the elements of ARGV so that, 68 As `getopt_long' works, it permutes the elements of ARGV so that,
111 when it is done, all the options precede everything else. Thus 69 when it is done, all the options precede everything else. Thus
112 all application programs are extended to handle flexible argument order. 70 all application programs are extended to handle flexible argument order.
113 71
114 Setting the environment variable POSIXLY_CORRECT disables permutation. 72 Using `getopt' or setting the environment variable POSIXLY_CORRECT
115 Then the behavior is completely standard. 73 disables permutation.
74 Then the application's behavior is completely standard.
116 75
117 GNU application programs can use a third alternative mode in which 76 GNU application programs can use a third alternative mode in which
118 they can distinguish the relative order of options and other arguments. */ 77 they can distinguish the relative order of options and other arguments. */
119 78
120#include "getopt.h" 79#include "getopt.h"
80#include "getopt_int.h"
121 81
122/* For communication from `getopt' to the caller. 82/* For communication from `getopt' to the caller.
123 When `getopt' finds an option that takes an argument, 83 When `getopt' finds an option that takes an argument,
@@ -142,21 +102,6 @@ char *optarg;
142/* 1003.2 says this must be 1 before any call. */ 102/* 1003.2 says this must be 1 before any call. */
143int optind = 1; 103int optind = 1;
144 104
145/* Formerly, initialization of getopt depended on optind==0, which
146 causes problems with re-calling getopt as programs generally don't
147 know that. */
148
149int __getopt_initialized attribute_hidden;
150
151/* The next char to be scanned in the option-element
152 in which the last option character we returned was found.
153 This allows us to pick up the scan where we left off.
154
155 If this is zero, or a null string, it means resume the scan
156 by advancing to the next ARGV-element. */
157
158static char *nextchar;
159
160/* Callers store zero here to inhibit the error message 105/* Callers store zero here to inhibit the error message
161 for unrecognized options. */ 106 for unrecognized options. */
162 107
@@ -168,57 +113,12 @@ int opterr = 1;
168 113
169int optopt = '?'; 114int optopt = '?';
170 115
171/* Describe how to deal with options that follow non-option ARGV-elements. 116/* Keep a global copy of all internal members of getopt_data. */
172
173 If the caller did not specify anything,
174 the default is REQUIRE_ORDER if the environment variable
175 POSIXLY_CORRECT is defined, PERMUTE otherwise.
176
177 REQUIRE_ORDER means don't recognize them as options;
178 stop option processing when the first non-option is seen.
179 This is what Unix does.
180 This mode of operation is selected by either setting the environment
181 variable POSIXLY_CORRECT, or using `+' as the first character
182 of the list of option characters.
183
184 PERMUTE is the default. We permute the contents of ARGV as we scan,
185 so that eventually all the non-options are at the end. This allows options
186 to be given in any order, even with programs that were not written to
187 expect this.
188 117
189 RETURN_IN_ORDER is an option available to programs that were written 118static struct _getopt_data getopt_data;
190 to expect options and other ARGV-elements in any order and that care about
191 the ordering of the two. We describe each non-option ARGV-element
192 as if it were the argument of an option with character code 1.
193 Using `-' as the first character of the list of option characters
194 selects this mode of operation.
195 119
196 The special argument `--' forces an end of option-scanning regardless
197 of the value of `ordering'. In the case of RETURN_IN_ORDER, only
198 `--' can cause `getopt' to return -1 with `optind' != ARGC. */
199
200static enum
201{
202 REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
203} ordering;
204
205/* Value of POSIXLY_CORRECT environment variable. */
206static char *posixly_correct;
207 120
208#ifdef __GNU_LIBRARY__ 121#ifndef __GNU_LIBRARY__
209/* We want to avoid inclusion of string.h with non-GNU libraries
210 because there are many ways it can cause trouble.
211 On some systems, it contains special magic macros that don't work
212 in GCC. */
213# include <string.h>
214# define my_index strchr
215#else
216
217# if HAVE_STRING_H
218# include <string.h>
219# else
220# include <strings.h>
221# endif
222 122
223/* Avoid depending on library functions or files 123/* Avoid depending on library functions or files
224 whose names are inconsistent. */ 124 whose names are inconsistent. */
@@ -227,43 +127,8 @@ static char *posixly_correct;
227extern char *getenv (); 127extern char *getenv ();
228#endif 128#endif
229 129
230static char *
231my_index (str, chr)
232 const char *str;
233 int chr;
234{
235 while (*str)
236 {
237 if (*str == chr)
238 return (char *) str;
239 str++;
240 }
241 return 0;
242}
243
244/* If using GCC, we can safely declare strlen this way.
245 If not using GCC, it is ok not to declare it. */
246#ifdef __GNUC__
247/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
248 That was relevant to code that was here before. */
249# if (!defined __STDC__ || !__STDC__) && !defined strlen
250/* gcc with -traditional declares the built-in strlen to return int,
251 and has done so at least since version 2.4.5. -- rms. */
252extern int strlen (const char *);
253# endif /* not __STDC__ */
254#endif /* __GNUC__ */
255
256#endif /* not __GNU_LIBRARY__ */ 130#endif /* not __GNU_LIBRARY__ */
257 131
258/* Handle permutation of arguments. */
259
260/* Describe the part of ARGV that contains non-options that have
261 been skipped. `first_nonopt' is the index in ARGV of the first of them;
262 `last_nonopt' is the index after the last of them. */
263
264static int first_nonopt;
265static int last_nonopt;
266
267#ifdef _LIBC 132#ifdef _LIBC
268/* Stored original parameters. 133/* Stored original parameters.
269 XXX This is no good solution. We should rather copy the args so 134 XXX This is no good solution. We should rather copy the args so
@@ -277,14 +142,11 @@ extern char **__libc_argv;
277# ifdef USE_NONOPTION_FLAGS 142# ifdef USE_NONOPTION_FLAGS
278/* Defined in getopt_init.c */ 143/* Defined in getopt_init.c */
279extern char *__getopt_nonoption_flags; 144extern char *__getopt_nonoption_flags;
280
281static int nonoption_flags_max_len;
282static int nonoption_flags_len;
283# endif 145# endif
284 146
285# ifdef USE_NONOPTION_FLAGS 147# ifdef USE_NONOPTION_FLAGS
286# define SWAP_FLAGS(ch1, ch2) \ 148# define SWAP_FLAGS(ch1, ch2) \
287 if (nonoption_flags_len > 0) \ 149 if (d->__nonoption_flags_len > 0) \
288 { \ 150 { \
289 char __tmp = __getopt_nonoption_flags[ch1]; \ 151 char __tmp = __getopt_nonoption_flags[ch1]; \
290 __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \ 152 __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2]; \
@@ -306,17 +168,12 @@ static int nonoption_flags_len;
306 `first_nonopt' and `last_nonopt' are relocated so that they describe 168 `first_nonopt' and `last_nonopt' are relocated so that they describe
307 the new indices of the non-options in ARGV after they are moved. */ 169 the new indices of the non-options in ARGV after they are moved. */
308 170
309#if defined __STDC__ && __STDC__
310static void exchange (char **);
311#endif
312
313static void 171static void
314exchange (argv) 172exchange (char **argv, struct _getopt_data *d)
315 char **argv;
316{ 173{
317 int bottom = first_nonopt; 174 int bottom = d->__first_nonopt;
318 int middle = last_nonopt; 175 int middle = d->__last_nonopt;
319 int top = optind; 176 int top = d->optind;
320 char *tem; 177 char *tem;
321 178
322 /* Exchange the shorter segment with the far end of the longer segment. 179 /* Exchange the shorter segment with the far end of the longer segment.
@@ -328,19 +185,19 @@ exchange (argv)
328 /* First make sure the handling of the `__getopt_nonoption_flags' 185 /* First make sure the handling of the `__getopt_nonoption_flags'
329 string can work normally. Our top argument must be in the range 186 string can work normally. Our top argument must be in the range
330 of the string. */ 187 of the string. */
331 if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len) 188 if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
332 { 189 {
333 /* We must extend the array. The user plays games with us and 190 /* We must extend the array. The user plays games with us and
334 presents new arguments. */ 191 presents new arguments. */
335 char *new_str = malloc (top + 1); 192 char *new_str = malloc (top + 1);
336 if (new_str == NULL) 193 if (new_str == NULL)
337 nonoption_flags_len = nonoption_flags_max_len = 0; 194 d->__nonoption_flags_len = d->__nonoption_flags_max_len = 0;
338 else 195 else
339 { 196 {
340 memset (__mempcpy (new_str, __getopt_nonoption_flags, 197 memset (__mempcpy (new_str, __getopt_nonoption_flags,
341 nonoption_flags_max_len), 198 d->__nonoption_flags_max_len),
342 '\0', top + 1 - nonoption_flags_max_len); 199 '\0', top + 1 - d->__nonoption_flags_max_len);
343 nonoption_flags_max_len = top + 1; 200 d->__nonoption_flags_max_len = top + 1;
344 __getopt_nonoption_flags = new_str; 201 __getopt_nonoption_flags = new_str;
345 } 202 }
346 } 203 }
@@ -386,76 +243,71 @@ exchange (argv)
386 243
387 /* Update records for the slots the non-options now occupy. */ 244 /* Update records for the slots the non-options now occupy. */
388 245
389 first_nonopt += (optind - last_nonopt); 246 d->__first_nonopt += (d->optind - d->__last_nonopt);
390 last_nonopt = optind; 247 d->__last_nonopt = d->optind;
391} 248}
392 249
393/* Initialize the internal data when the first call is made. */ 250/* Initialize the internal data when the first call is made. */
394 251
395#if defined __STDC__ && __STDC__
396static const char *_getopt_initialize (int, char *const *, const char *);
397#endif
398static const char * 252static const char *
399_getopt_initialize (argc, argv, optstring) 253_getopt_initialize (int argc, char **argv, const char *optstring,
400 int argc; 254 int posixly_correct, struct _getopt_data *d)
401 char *const *argv;
402 const char *optstring;
403{ 255{
404 /* Start processing options with ARGV-element 1 (since ARGV-element 0 256 /* Start processing options with ARGV-element 1 (since ARGV-element 0
405 is the program name); the sequence of previously skipped 257 is the program name); the sequence of previously skipped
406 non-option ARGV-elements is empty. */ 258 non-option ARGV-elements is empty. */
407 259
408 first_nonopt = last_nonopt = optind; 260 d->__first_nonopt = d->__last_nonopt = d->optind;
409 261
410 nextchar = NULL; 262 d->__nextchar = NULL;
411 263
412 posixly_correct = getenv ("POSIXLY_CORRECT"); 264 d->__posixly_correct = posixly_correct || !!getenv ("POSIXLY_CORRECT");
413 265
414 /* Determine how to handle the ordering of options and nonoptions. */ 266 /* Determine how to handle the ordering of options and nonoptions. */
415 267
416 if (optstring[0] == '-') 268 if (optstring[0] == '-')
417 { 269 {
418 ordering = RETURN_IN_ORDER; 270 d->__ordering = RETURN_IN_ORDER;
419 ++optstring; 271 ++optstring;
420 } 272 }
421 else if (optstring[0] == '+') 273 else if (optstring[0] == '+')
422 { 274 {
423 ordering = REQUIRE_ORDER; 275 d->__ordering = REQUIRE_ORDER;
424 ++optstring; 276 ++optstring;
425 } 277 }
426 else if (posixly_correct != NULL) 278 else if (d->__posixly_correct)
427 ordering = REQUIRE_ORDER; 279 d->__ordering = REQUIRE_ORDER;
428 else 280 else
429 ordering = PERMUTE; 281 d->__ordering = PERMUTE;
430 282
431#if defined _LIBC && defined USE_NONOPTION_FLAGS 283#if defined _LIBC && defined USE_NONOPTION_FLAGS
432 if (posixly_correct == NULL 284 if (!d->__posixly_correct
433 && argc == __libc_argc && argv == __libc_argv) 285 && argc == __libc_argc && argv == __libc_argv)
434 { 286 {
435 if (nonoption_flags_max_len == 0) 287 if (d->__nonoption_flags_max_len == 0)
436 { 288 {
437 if (__getopt_nonoption_flags == NULL 289 if (__getopt_nonoption_flags == NULL
438 || __getopt_nonoption_flags[0] == '\0') 290 || __getopt_nonoption_flags[0] == '\0')
439 nonoption_flags_max_len = -1; 291 d->__nonoption_flags_max_len = -1;
440 else 292 else
441 { 293 {
442 const char *orig_str = __getopt_nonoption_flags; 294 const char *orig_str = __getopt_nonoption_flags;
443 int len = nonoption_flags_max_len = strlen (orig_str); 295 int len = d->__nonoption_flags_max_len = strlen (orig_str);
444 if (nonoption_flags_max_len < argc) 296 if (d->__nonoption_flags_max_len < argc)
445 nonoption_flags_max_len = argc; 297 d->__nonoption_flags_max_len = argc;
446 __getopt_nonoption_flags = 298 __getopt_nonoption_flags =
447 (char *) malloc (nonoption_flags_max_len); 299 (char *) malloc (d->__nonoption_flags_max_len);
448 if (__getopt_nonoption_flags == NULL) 300 if (__getopt_nonoption_flags == NULL)
449 nonoption_flags_max_len = -1; 301 d->__nonoption_flags_max_len = -1;
450 else 302 else
451 memset (__mempcpy (__getopt_nonoption_flags, orig_str, len), 303 memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
452 '\0', nonoption_flags_max_len - len); 304 '\0', d->__nonoption_flags_max_len - len);
453 } 305 }
454 } 306 }
455 nonoption_flags_len = nonoption_flags_max_len; 307 d->__nonoption_flags_len = d->__nonoption_flags_max_len;
456 } 308 }
457 else 309 else
458 nonoption_flags_len = 0; 310 d->__nonoption_flags_len = 0;
459#endif 311#endif
460 312
461 return optstring; 313 return optstring;
@@ -503,10 +355,6 @@ _getopt_initialize (argc, argv, optstring)
503 `flag' field is nonzero, the value of the option's `val' field 355 `flag' field is nonzero, the value of the option's `val' field
504 if the `flag' field is zero. 356 if the `flag' field is zero.
505 357
506 The elements of ARGV aren't really const, because we permute them.
507 But we pretend they're const in the prototype to be compatible
508 with other systems.
509
510 LONGOPTS is a vector of `struct option' terminated by an 358 LONGOPTS is a vector of `struct option' terminated by an
511 element containing a name which is zero. 359 element containing a name which is zero.
512 360
@@ -515,32 +363,32 @@ _getopt_initialize (argc, argv, optstring)
515 recent call. 363 recent call.
516 364
517 If LONG_ONLY is nonzero, '-' as well as '--' can introduce 365 If LONG_ONLY is nonzero, '-' as well as '--' can introduce
518 long-named options. */ 366 long-named options.
367
368 If POSIXLY_CORRECT is nonzero, behave as if the POSIXLY_CORRECT
369 environment variable were set. */
519 370
520int 371int
521_getopt_internal (argc, argv, optstring, longopts, longind, long_only) 372_getopt_internal_r (int argc, char **argv, const char *optstring,
522 int argc; 373 const struct option *longopts, int *longind,
523 char *const *argv; 374 int long_only, int posixly_correct, struct _getopt_data *d)
524 const char *optstring;
525 const struct option *longopts;
526 int *longind;
527 int long_only;
528{ 375{
529 int print_errors = opterr; 376 int print_errors = d->opterr;
530 if (optstring[0] == ':') 377 if (optstring[0] == ':')
531 print_errors = 0; 378 print_errors = 0;
532 379
533 if (argc < 1) 380 if (argc < 1)
534 return -1; 381 return -1;
535 382
536 optarg = NULL; 383 d->optarg = NULL;
537 384
538 if (optind == 0 || !__getopt_initialized) 385 if (d->optind == 0 || !d->__initialized)
539 { 386 {
540 if (optind == 0) 387 if (d->optind == 0)
541 optind = 1; /* Don't scan ARGV[0], the program name. */ 388 d->optind = 1; /* Don't scan ARGV[0], the program name. */
542 optstring = _getopt_initialize (argc, argv, optstring); 389 optstring = _getopt_initialize (argc, argv, optstring,
543 __getopt_initialized = 1; 390 posixly_correct, d);
391 d->__initialized = 1;
544 } 392 }
545 393
546 /* Test whether ARGV[optind] points to a non-option argument. 394 /* Test whether ARGV[optind] points to a non-option argument.
@@ -548,40 +396,41 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
548 from the shell indicating it is not an option. The later information 396 from the shell indicating it is not an option. The later information
549 is only used when the used in the GNU libc. */ 397 is only used when the used in the GNU libc. */
550#if defined _LIBC && defined USE_NONOPTION_FLAGS 398#if defined _LIBC && defined USE_NONOPTION_FLAGS
551# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0' \ 399# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0' \
552 || (optind < nonoption_flags_len \ 400 || (d->optind < d->__nonoption_flags_len \
553 && __getopt_nonoption_flags[optind] == '1')) 401 && __getopt_nonoption_flags[d->optind] == '1'))
554#else 402#else
555# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0') 403# define NONOPTION_P (argv[d->optind][0] != '-' || argv[d->optind][1] == '\0')
556#endif 404#endif
557 405
558 if (nextchar == NULL || *nextchar == '\0') 406 if (d->__nextchar == NULL || *d->__nextchar == '\0')
559 { 407 {
560 /* Advance to the next ARGV-element. */ 408 /* Advance to the next ARGV-element. */
561 409
562 /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been 410 /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
563 moved back by the user (who may also have changed the arguments). */ 411 moved back by the user (who may also have changed the arguments). */
564 if (last_nonopt > optind) 412 if (d->__last_nonopt > d->optind)
565 last_nonopt = optind; 413 d->__last_nonopt = d->optind;
566 if (first_nonopt > optind) 414 if (d->__first_nonopt > d->optind)
567 first_nonopt = optind; 415 d->__first_nonopt = d->optind;
568 416
569 if (ordering == PERMUTE) 417 if (d->__ordering == PERMUTE)
570 { 418 {
571 /* If we have just processed some options following some non-options, 419 /* If we have just processed some options following some non-options,
572 exchange them so that the options come first. */ 420 exchange them so that the options come first. */
573 421
574 if (first_nonopt != last_nonopt && last_nonopt != optind) 422 if (d->__first_nonopt != d->__last_nonopt
575 exchange ((char **) argv); 423 && d->__last_nonopt != d->optind)
576 else if (last_nonopt != optind) 424 exchange ((char **) argv, d);
577 first_nonopt = optind; 425 else if (d->__last_nonopt != d->optind)
426 d->__first_nonopt = d->optind;
578 427
579 /* Skip any additional non-options 428 /* Skip any additional non-options
580 and extend the range of non-options previously skipped. */ 429 and extend the range of non-options previously skipped. */
581 430
582 while (optind < argc && NONOPTION_P) 431 while (d->optind < argc && NONOPTION_P)
583 optind++; 432 d->optind++;
584 last_nonopt = optind; 433 d->__last_nonopt = d->optind;
585 } 434 }
586 435
587 /* The special ARGV-element `--' means premature end of options. 436 /* The special ARGV-element `--' means premature end of options.
@@ -589,28 +438,29 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
589 then exchange with previous non-options as if it were an option, 438 then exchange with previous non-options as if it were an option,
590 then skip everything else like a non-option. */ 439 then skip everything else like a non-option. */
591 440
592 if (optind != argc && !strcmp (argv[optind], "--")) 441 if (d->optind != argc && !strcmp (argv[d->optind], "--"))
593 { 442 {
594 optind++; 443 d->optind++;
595 444
596 if (first_nonopt != last_nonopt && last_nonopt != optind) 445 if (d->__first_nonopt != d->__last_nonopt
597 exchange ((char **) argv); 446 && d->__last_nonopt != d->optind)
598 else if (first_nonopt == last_nonopt) 447 exchange ((char **) argv, d);
599 first_nonopt = optind; 448 else if (d->__first_nonopt == d->__last_nonopt)
600 last_nonopt = argc; 449 d->__first_nonopt = d->optind;
450 d->__last_nonopt = argc;
601 451
602 optind = argc; 452 d->optind = argc;
603 } 453 }
604 454
605 /* If we have done all the ARGV-elements, stop the scan 455 /* If we have done all the ARGV-elements, stop the scan
606 and back over any non-options that we skipped and permuted. */ 456 and back over any non-options that we skipped and permuted. */
607 457
608 if (optind == argc) 458 if (d->optind == argc)
609 { 459 {
610 /* Set the next-arg-index to point at the non-options 460 /* Set the next-arg-index to point at the non-options
611 that we previously skipped, so the caller will digest them. */ 461 that we previously skipped, so the caller will digest them. */
612 if (first_nonopt != last_nonopt) 462 if (d->__first_nonopt != d->__last_nonopt)
613 optind = first_nonopt; 463 d->optind = d->__first_nonopt;
614 return -1; 464 return -1;
615 } 465 }
616 466
@@ -619,17 +469,17 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
619 469
620 if (NONOPTION_P) 470 if (NONOPTION_P)
621 { 471 {
622 if (ordering == REQUIRE_ORDER) 472 if (d->__ordering == REQUIRE_ORDER)
623 return -1; 473 return -1;
624 optarg = argv[optind++]; 474 d->optarg = argv[d->optind++];
625 return 1; 475 return 1;
626 } 476 }
627 477
628 /* We have found another option-ARGV-element. 478 /* We have found another option-ARGV-element.
629 Skip the initial punctuation. */ 479 Skip the initial punctuation. */
630 480
631 nextchar = (argv[optind] + 1 481 d->__nextchar = (argv[d->optind] + 1
632 + (longopts != NULL && argv[optind][1] == '-')); 482 + (longopts != NULL && argv[d->optind][1] == '-'));
633 } 483 }
634 484
635 /* Decode the current option-ARGV-element. */ 485 /* Decode the current option-ARGV-element. */
@@ -648,8 +498,9 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
648 This distinction seems to be the most useful approach. */ 498 This distinction seems to be the most useful approach. */
649 499
650 if (longopts != NULL 500 if (longopts != NULL
651 && (argv[optind][1] == '-' 501 && (argv[d->optind][1] == '-'
652 || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) 502 || (long_only && (argv[d->optind][2]
503 || !strchr (optstring, argv[d->optind][1])))))
653 { 504 {
654 char *nameend; 505 char *nameend;
655 const struct option *p; 506 const struct option *p;
@@ -659,15 +510,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
659 int indfound = -1; 510 int indfound = -1;
660 int option_index; 511 int option_index;
661 512
662 for (nameend = nextchar; *nameend && *nameend != '='; nameend++) 513 for (nameend = d->__nextchar; *nameend && *nameend != '='; nameend++)
663 /* Do nothing. */ ; 514 /* Do nothing. */ ;
664 515
665 /* Test all long options for either exact match 516 /* Test all long options for either exact match
666 or abbreviated matches. */ 517 or abbreviated matches. */
667 for (p = longopts, option_index = 0; p->name; p++, option_index++) 518 for (p = longopts, option_index = 0; p->name; p++, option_index++)
668 if (!strncmp (p->name, nextchar, nameend - nextchar)) 519 if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
669 { 520 {
670 if ((unsigned int) (nameend - nextchar) 521 if ((unsigned int) (nameend - d->__nextchar)
671 == (unsigned int) strlen (p->name)) 522 == (unsigned int) strlen (p->name))
672 { 523 {
673 /* Exact match found. */ 524 /* Exact match found. */
@@ -698,37 +549,44 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
698 char *buf; 549 char *buf;
699 550
700 if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"), 551 if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
701 argv[0], argv[optind]) >= 0) 552 argv[0], argv[d->optind]) >= 0)
702 { 553 {
554 _IO_flockfile (stderr);
555
556 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
557 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
703 558
704 if (_IO_fwide (stderr, 0) > 0) 559 if (_IO_fwide (stderr, 0) > 0)
705 __fwprintf (stderr, L"%s", buf); 560 __fwprintf (stderr, L"%s", buf);
706 else 561 else
707 fputs (buf, stderr); 562 fputs (buf, stderr);
708 563
564 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
565 _IO_funlockfile (stderr);
566
709 free (buf); 567 free (buf);
710 } 568 }
711#else 569#else
712 fprintf (stderr, _("%s: option `%s' is ambiguous\n"), 570 fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
713 argv[0], argv[optind]); 571 argv[0], argv[d->optind]);
714#endif 572#endif
715 } 573 }
716 nextchar += strlen (nextchar); 574 d->__nextchar += strlen (d->__nextchar);
717 optind++; 575 d->optind++;
718 optopt = 0; 576 d->optopt = 0;
719 return '?'; 577 return '?';
720 } 578 }
721 579
722 if (pfound != NULL) 580 if (pfound != NULL)
723 { 581 {
724 option_index = indfound; 582 option_index = indfound;
725 optind++; 583 d->optind++;
726 if (*nameend) 584 if (*nameend)
727 { 585 {
728 /* Don't test has_arg with >, because some C compilers don't 586 /* Don't test has_arg with >, because some C compilers don't
729 allow it to be used on enums. */ 587 allow it to be used on enums. */
730 if (pfound->has_arg) 588 if (pfound->has_arg)
731 optarg = nameend + 1; 589 d->optarg = nameend + 1;
732 else 590 else
733 { 591 {
734 if (print_errors) 592 if (print_errors)
@@ -738,7 +596,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
738 int n; 596 int n;
739#endif 597#endif
740 598
741 if (argv[optind - 1][1] == '-') 599 if (argv[d->optind - 1][1] == '-')
742 { 600 {
743 /* --option */ 601 /* --option */
744#if defined _LIBC && defined USE_IN_LIBIO 602#if defined _LIBC && defined USE_IN_LIBIO
@@ -757,38 +615,48 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
757#if defined _LIBC && defined USE_IN_LIBIO 615#if defined _LIBC && defined USE_IN_LIBIO
758 n = __asprintf (&buf, _("\ 616 n = __asprintf (&buf, _("\
759%s: option `%c%s' doesn't allow an argument\n"), 617%s: option `%c%s' doesn't allow an argument\n"),
760 argv[0], argv[optind - 1][0], 618 argv[0], argv[d->optind - 1][0],
761 pfound->name); 619 pfound->name);
762#else 620#else
763 fprintf (stderr, _("\ 621 fprintf (stderr, _("\
764%s: option `%c%s' doesn't allow an argument\n"), 622%s: option `%c%s' doesn't allow an argument\n"),
765 argv[0], argv[optind - 1][0], pfound->name); 623 argv[0], argv[d->optind - 1][0],
624 pfound->name);
766#endif 625#endif
767 } 626 }
768 627
769#if defined _LIBC && defined USE_IN_LIBIO 628#if defined _LIBC && defined USE_IN_LIBIO
770 if (n >= 0) 629 if (n >= 0)
771 { 630 {
631 _IO_flockfile (stderr);
632
633 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
634 ((_IO_FILE *) stderr)->_flags2
635 |= _IO_FLAGS2_NOTCANCEL;
636
772 if (_IO_fwide (stderr, 0) > 0) 637 if (_IO_fwide (stderr, 0) > 0)
773 __fwprintf (stderr, L"%s", buf); 638 __fwprintf (stderr, L"%s", buf);
774 else 639 else
775 fputs (buf, stderr); 640 fputs (buf, stderr);
776 641
642 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
643 _IO_funlockfile (stderr);
644
777 free (buf); 645 free (buf);
778 } 646 }
779#endif 647#endif
780 } 648 }
781 649
782 nextchar += strlen (nextchar); 650 d->__nextchar += strlen (d->__nextchar);
783 651
784 optopt = pfound->val; 652 d->optopt = pfound->val;
785 return '?'; 653 return '?';
786 } 654 }
787 } 655 }
788 else if (pfound->has_arg == 1) 656 else if (pfound->has_arg == 1)
789 { 657 {
790 if (optind < argc) 658 if (d->optind < argc)
791 optarg = argv[optind++]; 659 d->optarg = argv[d->optind++];
792 else 660 else
793 { 661 {
794 if (print_errors) 662 if (print_errors)
@@ -798,27 +666,36 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
798 666
799 if (__asprintf (&buf, _("\ 667 if (__asprintf (&buf, _("\
800%s: option `%s' requires an argument\n"), 668%s: option `%s' requires an argument\n"),
801 argv[0], argv[optind - 1]) >= 0) 669 argv[0], argv[d->optind - 1]) >= 0)
802 { 670 {
671 _IO_flockfile (stderr);
672
673 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
674 ((_IO_FILE *) stderr)->_flags2
675 |= _IO_FLAGS2_NOTCANCEL;
676
803 if (_IO_fwide (stderr, 0) > 0) 677 if (_IO_fwide (stderr, 0) > 0)
804 __fwprintf (stderr, L"%s", buf); 678 __fwprintf (stderr, L"%s", buf);
805 else 679 else
806 fputs (buf, stderr); 680 fputs (buf, stderr);
807 681
682 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
683 _IO_funlockfile (stderr);
684
808 free (buf); 685 free (buf);
809 } 686 }
810#else 687#else
811 fprintf (stderr, 688 fprintf (stderr,
812 _("%s: option `%s' requires an argument\n"), 689 _("%s: option `%s' requires an argument\n"),
813 argv[0], argv[optind - 1]); 690 argv[0], argv[d->optind - 1]);
814#endif 691#endif
815 } 692 }
816 nextchar += strlen (nextchar); 693 d->__nextchar += strlen (d->__nextchar);
817 optopt = pfound->val; 694 d->optopt = pfound->val;
818 return optstring[0] == ':' ? ':' : '?'; 695 return optstring[0] == ':' ? ':' : '?';
819 } 696 }
820 } 697 }
821 nextchar += strlen (nextchar); 698 d->__nextchar += strlen (d->__nextchar);
822 if (longind != NULL) 699 if (longind != NULL)
823 *longind = option_index; 700 *longind = option_index;
824 if (pfound->flag) 701 if (pfound->flag)
@@ -833,8 +710,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
833 or the option starts with '--' or is not a valid short 710 or the option starts with '--' or is not a valid short
834 option, then it's an error. 711 option, then it's an error.
835 Otherwise interpret it as a short option. */ 712 Otherwise interpret it as a short option. */
836 if (!long_only || argv[optind][1] == '-' 713 if (!long_only || argv[d->optind][1] == '-'
837 || my_index (optstring, *nextchar) == NULL) 714 || strchr (optstring, *d->__nextchar) == NULL)
838 { 715 {
839 if (print_errors) 716 if (print_errors)
840 { 717 {
@@ -843,15 +720,15 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
843 int n; 720 int n;
844#endif 721#endif
845 722
846 if (argv[optind][1] == '-') 723 if (argv[d->optind][1] == '-')
847 { 724 {
848 /* --option */ 725 /* --option */
849#if defined _LIBC && defined USE_IN_LIBIO 726#if defined _LIBC && defined USE_IN_LIBIO
850 n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"), 727 n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
851 argv[0], nextchar); 728 argv[0], d->__nextchar);
852#else 729#else
853 fprintf (stderr, _("%s: unrecognized option `--%s'\n"), 730 fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
854 argv[0], nextchar); 731 argv[0], d->__nextchar);
855#endif 732#endif
856 } 733 }
857 else 734 else
@@ -859,28 +736,36 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
859 /* +option or -option */ 736 /* +option or -option */
860#if defined _LIBC && defined USE_IN_LIBIO 737#if defined _LIBC && defined USE_IN_LIBIO
861 n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"), 738 n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
862 argv[0], argv[optind][0], nextchar); 739 argv[0], argv[d->optind][0], d->__nextchar);
863#else 740#else
864 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"), 741 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
865 argv[0], argv[optind][0], nextchar); 742 argv[0], argv[d->optind][0], d->__nextchar);
866#endif 743#endif
867 } 744 }
868 745
869#if defined _LIBC && defined USE_IN_LIBIO 746#if defined _LIBC && defined USE_IN_LIBIO
870 if (n >= 0) 747 if (n >= 0)
871 { 748 {
749 _IO_flockfile (stderr);
750
751 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
752 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
753
872 if (_IO_fwide (stderr, 0) > 0) 754 if (_IO_fwide (stderr, 0) > 0)
873 __fwprintf (stderr, L"%s", buf); 755 __fwprintf (stderr, L"%s", buf);
874 else 756 else
875 fputs (buf, stderr); 757 fputs (buf, stderr);
876 758
759 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
760 _IO_funlockfile (stderr);
761
877 free (buf); 762 free (buf);
878 } 763 }
879#endif 764#endif
880 } 765 }
881 nextchar = (char *) ""; 766 d->__nextchar = (char *) "";
882 optind++; 767 d->optind++;
883 optopt = 0; 768 d->optopt = 0;
884 return '?'; 769 return '?';
885 } 770 }
886 } 771 }
@@ -888,12 +773,12 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
888 /* Look at and handle the next short option-character. */ 773 /* Look at and handle the next short option-character. */
889 774
890 { 775 {
891 char c = *nextchar++; 776 char c = *d->__nextchar++;
892 char *temp = my_index (optstring, c); 777 char *temp = strchr (optstring, c);
893 778
894 /* Increment `optind' when we start to process its last character. */ 779 /* Increment `optind' when we start to process its last character. */
895 if (*nextchar == '\0') 780 if (*d->__nextchar == '\0')
896 ++optind; 781 ++d->optind;
897 782
898 if (temp == NULL || c == ':') 783 if (temp == NULL || c == ':')
899 { 784 {
@@ -904,7 +789,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
904 int n; 789 int n;
905#endif 790#endif
906 791
907 if (posixly_correct) 792 if (d->__posixly_correct)
908 { 793 {
909 /* 1003.2 specifies the format of this message. */ 794 /* 1003.2 specifies the format of this message. */
910#if defined _LIBC && defined USE_IN_LIBIO 795#if defined _LIBC && defined USE_IN_LIBIO
@@ -927,16 +812,24 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
927#if defined _LIBC && defined USE_IN_LIBIO 812#if defined _LIBC && defined USE_IN_LIBIO
928 if (n >= 0) 813 if (n >= 0)
929 { 814 {
815 _IO_flockfile (stderr);
816
817 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
818 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
819
930 if (_IO_fwide (stderr, 0) > 0) 820 if (_IO_fwide (stderr, 0) > 0)
931 __fwprintf (stderr, L"%s", buf); 821 __fwprintf (stderr, L"%s", buf);
932 else 822 else
933 fputs (buf, stderr); 823 fputs (buf, stderr);
934 824
825 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
826 _IO_funlockfile (stderr);
827
935 free (buf); 828 free (buf);
936 } 829 }
937#endif 830#endif
938 } 831 }
939 optopt = c; 832 d->optopt = c;
940 return '?'; 833 return '?';
941 } 834 }
942 /* Convenience. Treat POSIX -W foo same as long option --foo */ 835 /* Convenience. Treat POSIX -W foo same as long option --foo */
@@ -951,14 +844,14 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
951 int option_index; 844 int option_index;
952 845
953 /* This is an option that requires an argument. */ 846 /* This is an option that requires an argument. */
954 if (*nextchar != '\0') 847 if (*d->__nextchar != '\0')
955 { 848 {
956 optarg = nextchar; 849 d->optarg = d->__nextchar;
957 /* If we end this ARGV-element by taking the rest as an arg, 850 /* If we end this ARGV-element by taking the rest as an arg,
958 we must advance to the next element now. */ 851 we must advance to the next element now. */
959 optind++; 852 d->optind++;
960 } 853 }
961 else if (optind == argc) 854 else if (d->optind == argc)
962 { 855 {
963 if (print_errors) 856 if (print_errors)
964 { 857 {
@@ -970,11 +863,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
970 _("%s: option requires an argument -- %c\n"), 863 _("%s: option requires an argument -- %c\n"),
971 argv[0], c) >= 0) 864 argv[0], c) >= 0)
972 { 865 {
866 _IO_flockfile (stderr);
867
868 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
869 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
870
973 if (_IO_fwide (stderr, 0) > 0) 871 if (_IO_fwide (stderr, 0) > 0)
974 __fwprintf (stderr, L"%s", buf); 872 __fwprintf (stderr, L"%s", buf);
975 else 873 else
976 fputs (buf, stderr); 874 fputs (buf, stderr);
977 875
876 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
877 _IO_funlockfile (stderr);
878
978 free (buf); 879 free (buf);
979 } 880 }
980#else 881#else
@@ -982,7 +883,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
982 argv[0], c); 883 argv[0], c);
983#endif 884#endif
984 } 885 }
985 optopt = c; 886 d->optopt = c;
986 if (optstring[0] == ':') 887 if (optstring[0] == ':')
987 c = ':'; 888 c = ':';
988 else 889 else
@@ -990,22 +891,23 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
990 return c; 891 return c;
991 } 892 }
992 else 893 else
993 /* We already incremented `optind' once; 894 /* We already incremented `d->optind' once;
994 increment it again when taking next ARGV-elt as argument. */ 895 increment it again when taking next ARGV-elt as argument. */
995 optarg = argv[optind++]; 896 d->optarg = argv[d->optind++];
996 897
997 /* optarg is now the argument, see if it's in the 898 /* optarg is now the argument, see if it's in the
998 table of longopts. */ 899 table of longopts. */
999 900
1000 for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++) 901 for (d->__nextchar = nameend = d->optarg; *nameend && *nameend != '=';
902 nameend++)
1001 /* Do nothing. */ ; 903 /* Do nothing. */ ;
1002 904
1003 /* Test all long options for either exact match 905 /* Test all long options for either exact match
1004 or abbreviated matches. */ 906 or abbreviated matches. */
1005 for (p = longopts, option_index = 0; p->name; p++, option_index++) 907 for (p = longopts, option_index = 0; p->name; p++, option_index++)
1006 if (!strncmp (p->name, nextchar, nameend - nextchar)) 908 if (!strncmp (p->name, d->__nextchar, nameend - d->__nextchar))
1007 { 909 {
1008 if ((unsigned int) (nameend - nextchar) == strlen (p->name)) 910 if ((unsigned int) (nameend - d->__nextchar) == strlen (p->name))
1009 { 911 {
1010 /* Exact match found. */ 912 /* Exact match found. */
1011 pfound = p; 913 pfound = p;
@@ -1031,22 +933,30 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1031 char *buf; 933 char *buf;
1032 934
1033 if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"), 935 if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
1034 argv[0], argv[optind]) >= 0) 936 argv[0], argv[d->optind]) >= 0)
1035 { 937 {
938 _IO_flockfile (stderr);
939
940 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
941 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
942
1036 if (_IO_fwide (stderr, 0) > 0) 943 if (_IO_fwide (stderr, 0) > 0)
1037 __fwprintf (stderr, L"%s", buf); 944 __fwprintf (stderr, L"%s", buf);
1038 else 945 else
1039 fputs (buf, stderr); 946 fputs (buf, stderr);
1040 947
948 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
949 _IO_funlockfile (stderr);
950
1041 free (buf); 951 free (buf);
1042 } 952 }
1043#else 953#else
1044 fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), 954 fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
1045 argv[0], argv[optind]); 955 argv[0], argv[d->optind]);
1046#endif 956#endif
1047 } 957 }
1048 nextchar += strlen (nextchar); 958 d->__nextchar += strlen (d->__nextchar);
1049 optind++; 959 d->optind++;
1050 return '?'; 960 return '?';
1051 } 961 }
1052 if (pfound != NULL) 962 if (pfound != NULL)
@@ -1057,7 +967,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1057 /* Don't test has_arg with >, because some C compilers don't 967 /* Don't test has_arg with >, because some C compilers don't
1058 allow it to be used on enums. */ 968 allow it to be used on enums. */
1059 if (pfound->has_arg) 969 if (pfound->has_arg)
1060 optarg = nameend + 1; 970 d->optarg = nameend + 1;
1061 else 971 else
1062 { 972 {
1063 if (print_errors) 973 if (print_errors)
@@ -1069,11 +979,20 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1069%s: option `-W %s' doesn't allow an argument\n"), 979%s: option `-W %s' doesn't allow an argument\n"),
1070 argv[0], pfound->name) >= 0) 980 argv[0], pfound->name) >= 0)
1071 { 981 {
982 _IO_flockfile (stderr);
983
984 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
985 ((_IO_FILE *) stderr)->_flags2
986 |= _IO_FLAGS2_NOTCANCEL;
987
1072 if (_IO_fwide (stderr, 0) > 0) 988 if (_IO_fwide (stderr, 0) > 0)
1073 __fwprintf (stderr, L"%s", buf); 989 __fwprintf (stderr, L"%s", buf);
1074 else 990 else
1075 fputs (buf, stderr); 991 fputs (buf, stderr);
1076 992
993 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
994 _IO_funlockfile (stderr);
995
1077 free (buf); 996 free (buf);
1078 } 997 }
1079#else 998#else
@@ -1083,14 +1002,14 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1083#endif 1002#endif
1084 } 1003 }
1085 1004
1086 nextchar += strlen (nextchar); 1005 d->__nextchar += strlen (d->__nextchar);
1087 return '?'; 1006 return '?';
1088 } 1007 }
1089 } 1008 }
1090 else if (pfound->has_arg == 1) 1009 else if (pfound->has_arg == 1)
1091 { 1010 {
1092 if (optind < argc) 1011 if (d->optind < argc)
1093 optarg = argv[optind++]; 1012 d->optarg = argv[d->optind++];
1094 else 1013 else
1095 { 1014 {
1096 if (print_errors) 1015 if (print_errors)
@@ -1100,26 +1019,35 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1100 1019
1101 if (__asprintf (&buf, _("\ 1020 if (__asprintf (&buf, _("\
1102%s: option `%s' requires an argument\n"), 1021%s: option `%s' requires an argument\n"),
1103 argv[0], argv[optind - 1]) >= 0) 1022 argv[0], argv[d->optind - 1]) >= 0)
1104 { 1023 {
1024 _IO_flockfile (stderr);
1025
1026 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1027 ((_IO_FILE *) stderr)->_flags2
1028 |= _IO_FLAGS2_NOTCANCEL;
1029
1105 if (_IO_fwide (stderr, 0) > 0) 1030 if (_IO_fwide (stderr, 0) > 0)
1106 __fwprintf (stderr, L"%s", buf); 1031 __fwprintf (stderr, L"%s", buf);
1107 else 1032 else
1108 fputs (buf, stderr); 1033 fputs (buf, stderr);
1109 1034
1035 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1036 _IO_funlockfile (stderr);
1037
1110 free (buf); 1038 free (buf);
1111 } 1039 }
1112#else 1040#else
1113 fprintf (stderr, 1041 fprintf (stderr,
1114 _("%s: option `%s' requires an argument\n"), 1042 _("%s: option `%s' requires an argument\n"),
1115 argv[0], argv[optind - 1]); 1043 argv[0], argv[d->optind - 1]);
1116#endif 1044#endif
1117 } 1045 }
1118 nextchar += strlen (nextchar); 1046 d->__nextchar += strlen (d->__nextchar);
1119 return optstring[0] == ':' ? ':' : '?'; 1047 return optstring[0] == ':' ? ':' : '?';
1120 } 1048 }
1121 } 1049 }
1122 nextchar += strlen (nextchar); 1050 d->__nextchar += strlen (d->__nextchar);
1123 if (longind != NULL) 1051 if (longind != NULL)
1124 *longind = option_index; 1052 *longind = option_index;
1125 if (pfound->flag) 1053 if (pfound->flag)
@@ -1129,7 +1057,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1129 } 1057 }
1130 return pfound->val; 1058 return pfound->val;
1131 } 1059 }
1132 nextchar = NULL; 1060 d->__nextchar = NULL;
1133 return 'W'; /* Let the application handle it. */ 1061 return 'W'; /* Let the application handle it. */
1134 } 1062 }
1135 if (temp[1] == ':') 1063 if (temp[1] == ':')
@@ -1137,26 +1065,26 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1137 if (temp[2] == ':') 1065 if (temp[2] == ':')
1138 { 1066 {
1139 /* This is an option that accepts an argument optionally. */ 1067 /* This is an option that accepts an argument optionally. */
1140 if (*nextchar != '\0') 1068 if (*d->__nextchar != '\0')
1141 { 1069 {
1142 optarg = nextchar; 1070 d->optarg = d->__nextchar;
1143 optind++; 1071 d->optind++;
1144 } 1072 }
1145 else 1073 else
1146 optarg = NULL; 1074 d->optarg = NULL;
1147 nextchar = NULL; 1075 d->__nextchar = NULL;
1148 } 1076 }
1149 else 1077 else
1150 { 1078 {
1151 /* This is an option that requires an argument. */ 1079 /* This is an option that requires an argument. */
1152 if (*nextchar != '\0') 1080 if (*d->__nextchar != '\0')
1153 { 1081 {
1154 optarg = nextchar; 1082 d->optarg = d->__nextchar;
1155 /* If we end this ARGV-element by taking the rest as an arg, 1083 /* If we end this ARGV-element by taking the rest as an arg,
1156 we must advance to the next element now. */ 1084 we must advance to the next element now. */
1157 optind++; 1085 d->optind++;
1158 } 1086 }
1159 else if (optind == argc) 1087 else if (d->optind == argc)
1160 { 1088 {
1161 if (print_errors) 1089 if (print_errors)
1162 { 1090 {
@@ -1168,11 +1096,19 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1168%s: option requires an argument -- %c\n"), 1096%s: option requires an argument -- %c\n"),
1169 argv[0], c) >= 0) 1097 argv[0], c) >= 0)
1170 { 1098 {
1099 _IO_flockfile (stderr);
1100
1101 int old_flags2 = ((_IO_FILE *) stderr)->_flags2;
1102 ((_IO_FILE *) stderr)->_flags2 |= _IO_FLAGS2_NOTCANCEL;
1103
1171 if (_IO_fwide (stderr, 0) > 0) 1104 if (_IO_fwide (stderr, 0) > 0)
1172 __fwprintf (stderr, L"%s", buf); 1105 __fwprintf (stderr, L"%s", buf);
1173 else 1106 else
1174 fputs (buf, stderr); 1107 fputs (buf, stderr);
1175 1108
1109 ((_IO_FILE *) stderr)->_flags2 = old_flags2;
1110 _IO_funlockfile (stderr);
1111
1176 free (buf); 1112 free (buf);
1177 } 1113 }
1178#else 1114#else
@@ -1181,7 +1117,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1181 argv[0], c); 1117 argv[0], c);
1182#endif 1118#endif
1183 } 1119 }
1184 optopt = c; 1120 d->optopt = c;
1185 if (optstring[0] == ':') 1121 if (optstring[0] == ':')
1186 c = ':'; 1122 c = ':';
1187 else 1123 else
@@ -1190,8 +1126,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1190 else 1126 else
1191 /* We already incremented `optind' once; 1127 /* We already incremented `optind' once;
1192 increment it again when taking next ARGV-elt as argument. */ 1128 increment it again when taking next ARGV-elt as argument. */
1193 optarg = argv[optind++]; 1129 d->optarg = argv[d->optind++];
1194 nextchar = NULL; 1130 d->__nextchar = NULL;
1195 } 1131 }
1196 } 1132 }
1197 return c; 1133 return c;
@@ -1199,18 +1135,40 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
1199} 1135}
1200 1136
1201int 1137int
1202getopt (argc, argv, optstring) 1138_getopt_internal (int argc, char **argv, const char *optstring,
1203 int argc; 1139 const struct option *longopts, int *longind,
1204 char *const *argv; 1140 int long_only, int posixly_correct)
1205 const char *optstring; 1141{
1142 int result;
1143
1144 getopt_data.optind = optind;
1145 getopt_data.opterr = opterr;
1146
1147 result = _getopt_internal_r (argc, argv, optstring, longopts, longind,
1148 long_only, posixly_correct, &getopt_data);
1149
1150 optind = getopt_data.optind;
1151 optarg = getopt_data.optarg;
1152 optopt = getopt_data.optopt;
1153
1154 return result;
1155}
1156
1157/* glibc gets a LSB-compliant getopt.
1158 Standalone applications get a POSIX-compliant getopt. */
1159#if _LIBC
1160enum { POSIXLY_CORRECT = 0 };
1161#else
1162enum { POSIXLY_CORRECT = 1 };
1163#endif
1164
1165int
1166getopt (int argc, char *const *argv, const char *optstring)
1206{ 1167{
1207 return _getopt_internal (argc, argv, optstring, 1168 return _getopt_internal (argc, (char **) argv, optstring, NULL, NULL, 0,
1208 (const struct option *) 0, 1169 POSIXLY_CORRECT);
1209 (int *) 0,
1210 0);
1211} 1170}
1212 1171
1213#endif /* Not ELIDE_CODE. */
1214 1172
1215#ifdef TEST 1173#ifdef TEST
1216 1174
@@ -1218,9 +1176,7 @@ getopt (argc, argv, optstring)
1218 the above definition of `getopt'. */ 1176 the above definition of `getopt'. */
1219 1177
1220int 1178int
1221main (argc, argv) 1179main (int argc, char **argv)
1222 int argc;
1223 char **argv;
1224{ 1180{
1225 int c; 1181 int c;
1226 int digit_optind = 0; 1182 int digit_optind = 0;
diff --git a/lib-src/getopt1.c b/lib-src/getopt1.c
index 4ec1e50b830..40c1d1695d3 100644
--- a/lib-src/getopt1.c
+++ b/lib-src/getopt1.c
@@ -1,5 +1,5 @@
1/* getopt_long and getopt_long_only entry points for GNU getopt. 1/* getopt_long and getopt_long_only entry points for GNU getopt.
2 Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98 2 Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98,2004
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
5 5
@@ -26,36 +26,10 @@
26#else 26#else
27# include "getopt.h" 27# include "getopt.h"
28#endif 28#endif
29 29#include "getopt_int.h"
30#if !defined __STDC__ || !__STDC__
31/* This is a separate conditional since some stdc systems
32 reject `defined (const)'. */
33#ifndef const
34#define const
35#endif
36#endif
37 30
38#include <stdio.h> 31#include <stdio.h>
39 32
40/* Comment out all this code if we are using the GNU C Library, and are not
41 actually compiling the library itself. This code is part of the GNU C
42 Library, but also included in many other GNU distributions. Compiling
43 and linking in this code is a waste when using the GNU C library
44 (especially if it is a shared library). Rather than having every GNU
45 program understand `configure --with-gnu-libc' and omit the object files,
46 it is simpler to just do this in the source for each such file. */
47
48#define GETOPT_INTERFACE_VERSION 2
49#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
50#include <gnu-versions.h>
51#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
52#define ELIDE_CODE
53#endif
54#endif
55
56#ifndef ELIDE_CODE
57
58
59/* This needs to come after some library #include 33/* This needs to come after some library #include
60 to get __GNU_LIBRARY__ defined. */ 34 to get __GNU_LIBRARY__ defined. */
61#ifdef __GNU_LIBRARY__ 35#ifdef __GNU_LIBRARY__
@@ -67,14 +41,20 @@
67#endif 41#endif
68 42
69int 43int
70getopt_long (argc, argv, options, long_options, opt_index) 44getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
71 int argc; 45 const struct option *long_options, int *opt_index)
72 char *const *argv;
73 const char *options;
74 const struct option *long_options;
75 int *opt_index;
76{ 46{
77 return _getopt_internal (argc, argv, options, long_options, opt_index, 0); 47 return _getopt_internal (argc, (char **) argv, options, long_options,
48 opt_index, 0, 0);
49}
50
51int
52_getopt_long_r (int argc, char **argv, const char *options,
53 const struct option *long_options, int *opt_index,
54 struct _getopt_data *d)
55{
56 return _getopt_internal_r (argc, argv, options, long_options, opt_index,
57 0, 0, d);
78} 58}
79 59
80/* Like getopt_long, but '-' as well as '--' can indicate a long option. 60/* Like getopt_long, but '-' as well as '--' can indicate a long option.
@@ -83,31 +63,30 @@ getopt_long (argc, argv, options, long_options, opt_index)
83 instead. */ 63 instead. */
84 64
85int 65int
86getopt_long_only (argc, argv, options, long_options, opt_index) 66getopt_long_only (int argc, char *__getopt_argv_const *argv,
87 int argc; 67 const char *options,
88 char *const *argv; 68 const struct option *long_options, int *opt_index)
89 const char *options;
90 const struct option *long_options;
91 int *opt_index;
92{ 69{
93 return _getopt_internal (argc, argv, options, long_options, opt_index, 1); 70 return _getopt_internal (argc, (char **) argv, options, long_options,
71 opt_index, 1, 0);
94} 72}
95 73
96# ifdef _LIBC 74int
97libc_hidden_def (getopt_long) 75_getopt_long_only_r (int argc, char **argv, const char *options,
98libc_hidden_def (getopt_long_only) 76 const struct option *long_options, int *opt_index,
99# endif 77 struct _getopt_data *d)
78{
79 return _getopt_internal_r (argc, argv, options, long_options, opt_index,
80 1, 0, d);
81}
100 82
101#endif /* Not ELIDE_CODE. */
102 83
103#ifdef TEST 84#ifdef TEST
104 85
105#include <stdio.h> 86#include <stdio.h>
106 87
107int 88int
108main (argc, argv) 89main (int argc, char **argv)
109 int argc;
110 char **argv;
111{ 90{
112 int c; 91 int c;
113 int digit_optind = 0; 92 int digit_optind = 0;
diff --git a/lib-src/getopt.h b/lib-src/getopt_.h
index 953a7d15252..2c2c1d458ef 100644
--- a/lib-src/getopt.h
+++ b/lib-src/getopt_.h
@@ -1,5 +1,6 @@
1/* Declarations for getopt. 1/* Declarations for getopt.
2 Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc. 2 Copyright (C) 1989-1994,1996-1999,2001,2003,2004
3 Free Software Foundation, Inc.
3 This file is part of the GNU C Library. 4 This file is part of the GNU C Library.
4 5
5 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
@@ -22,6 +23,64 @@
22# define _GETOPT_H 1 23# define _GETOPT_H 1
23#endif 24#endif
24 25
26/* Standalone applications should #define __GETOPT_PREFIX to an
27 identifier that prefixes the external functions and variables
28 defined in this header. When this happens, include the
29 headers that might declare getopt so that they will not cause
30 confusion if included after this file. Then systematically rename
31 identifiers so that they do not collide with the system functions
32 and variables. Renaming avoids problems with some compilers and
33 linkers. */
34#if defined __GETOPT_PREFIX && !defined __need_getopt
35# include <stdlib.h>
36# include <stdio.h>
37# if HAVE_UNISTD_H
38# include <unistd.h>
39# endif
40# undef __need_getopt
41# undef getopt
42# undef getopt_long
43# undef getopt_long_only
44# undef optarg
45# undef opterr
46# undef optind
47# undef optopt
48# define __GETOPT_CONCAT(x, y) x ## y
49# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
50# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
51# define getopt __GETOPT_ID (getopt)
52# define getopt_long __GETOPT_ID (getopt_long)
53# define getopt_long_only __GETOPT_ID (getopt_long_only)
54# define optarg __GETOPT_ID (optarg)
55# define opterr __GETOPT_ID (opterr)
56# define optind __GETOPT_ID (optind)
57# define optopt __GETOPT_ID (optopt)
58#endif
59
60/* Standalone applications get correct prototypes for getopt_long and
61 getopt_long_only; they declare "char **argv". libc uses prototypes
62 with "char *const *argv" that are incorrect because getopt_long and
63 getopt_long_only can permute argv; this is required for backward
64 compatibility (e.g., for LSB 2.0.1).
65
66 This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
67 but it caused redefinition warnings if both unistd.h and getopt.h were
68 included, since unistd.h includes getopt.h having previously defined
69 __need_getopt.
70
71 The only place where __getopt_argv_const is used is in definitions
72 of getopt_long and getopt_long_only below, but these are visible
73 only if __need_getopt is not defined, so it is quite safe to rewrite
74 the conditional as follows:
75*/
76#if !defined __need_getopt
77# if defined __GETOPT_PREFIX
78# define __getopt_argv_const /* empty */
79# else
80# define __getopt_argv_const const
81# endif
82#endif
83
25/* If __GNU_LIBRARY__ is not already defined, either we are being used 84/* If __GNU_LIBRARY__ is not already defined, either we are being used
26 standalone, or this is the first header included in the source file. 85 standalone, or this is the first header included in the source file.
27 If we are being used with glibc, we need to include <features.h>, but 86 If we are being used with glibc, we need to include <features.h>, but
@@ -33,6 +92,17 @@
33# include <ctype.h> 92# include <ctype.h>
34#endif 93#endif
35 94
95#ifndef __THROW
96# ifndef __GNUC_PREREQ
97# define __GNUC_PREREQ(maj, min) (0)
98# endif
99# if defined __cplusplus && __GNUC_PREREQ (2,8)
100# define __THROW throw ()
101# else
102# define __THROW
103# endif
104#endif
105
36#ifdef __cplusplus 106#ifdef __cplusplus
37extern "C" { 107extern "C" {
38#endif 108#endif
@@ -77,7 +147,7 @@ extern int optopt;
77 The field `has_arg' is: 147 The field `has_arg' is:
78 no_argument (or 0) if the option does not take an argument, 148 no_argument (or 0) if the option does not take an argument,
79 required_argument (or 1) if the option requires an argument, 149 required_argument (or 1) if the option requires an argument,
80 optional_argument (or 2) if the option takes an optional argument. 150 optional_argument (or 2) if the option takes an optional argument.
81 151
82 If the field `flag' is not NULL, it points to a variable that is set 152 If the field `flag' is not NULL, it points to a variable that is set
83 to the value given in the field `val' when the option is found, but 153 to the value given in the field `val' when the option is found, but
@@ -92,11 +162,7 @@ extern int optopt;
92 162
93struct option 163struct option
94{ 164{
95# if (defined __STDC__ && __STDC__) || defined __cplusplus
96 const char *name; 165 const char *name;
97# else
98 char *name;
99# endif
100 /* has_arg can't be an enum because some compilers complain about 166 /* has_arg can't be an enum because some compilers complain about
101 type mismatches in all the code that assumes it is an int. */ 167 type mismatches in all the code that assumes it is an int. */
102 int has_arg; 168 int has_arg;
@@ -136,39 +202,20 @@ struct option
136 arguments to the option '\0'. This behavior is specific to the GNU 202 arguments to the option '\0'. This behavior is specific to the GNU
137 `getopt'. */ 203 `getopt'. */
138 204
139#if (defined __STDC__ && __STDC__) || defined __cplusplus 205extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
140# ifdef __GNU_LIBRARY__ 206 __THROW;
141/* Many other libraries have conflicting prototypes for getopt, with
142 differences in the consts, in stdlib.h. To avoid compilation
143 errors, only prototype getopt for the GNU C library. */
144extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
145# else /* not __GNU_LIBRARY__ */
146extern int getopt ();
147# endif /* __GNU_LIBRARY__ */
148
149# ifndef __need_getopt
150extern int getopt_long (int ___argc, char *const *___argv,
151 const char *__shortopts,
152 const struct option *__longopts, int *__longind);
153extern int getopt_long_only (int ___argc, char *const *___argv,
154 const char *__shortopts,
155 const struct option *__longopts, int *__longind);
156 207
157/* Internal only. Users should not call this directly. */ 208#ifndef __need_getopt
158extern int _getopt_internal (int ___argc, char *const *___argv, 209extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
210 const char *__shortopts,
211 const struct option *__longopts, int *__longind)
212 __THROW;
213extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
159 const char *__shortopts, 214 const char *__shortopts,
160 const struct option *__longopts, int *__longind, 215 const struct option *__longopts, int *__longind)
161 int __long_only); 216 __THROW;
162# endif
163#else /* not __STDC__ */
164extern int getopt ();
165# ifndef __need_getopt
166extern int getopt_long ();
167extern int getopt_long_only ();
168 217
169extern int _getopt_internal (); 218#endif
170# endif
171#endif /* __STDC__ */
172 219
173#ifdef __cplusplus 220#ifdef __cplusplus
174} 221}
@@ -179,5 +226,5 @@ extern int _getopt_internal ();
179 226
180#endif /* getopt.h */ 227#endif /* getopt.h */
181 228
182/* arch-tag: 9adb7828-e6a6-40cd-8512-0cdf1f20ddd4 229/* arch-tag: e36f5607-3ac6-4cdc-9aa7-c26c6525fe9b
183 (do not change this comment) */ 230 (do not change this comment) */
diff --git a/lib-src/getopt_int.h b/lib-src/getopt_int.h
new file mode 100644
index 00000000000..6d47d2f0b8c
--- /dev/null
+++ b/lib-src/getopt_int.h
@@ -0,0 +1,134 @@
1/* Internal declarations for getopt.
2 Copyright (C) 1989-1994,1996-1999,2001,2003,2004
3 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation,
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
19
20#ifndef _GETOPT_INT_H
21#define _GETOPT_INT_H 1
22
23extern int _getopt_internal (int ___argc, char **___argv,
24 const char *__shortopts,
25 const struct option *__longopts, int *__longind,
26 int __long_only, int __posixly_correct);
27
28
29/* Reentrant versions which can handle parsing multiple argument
30 vectors at the same time. */
31
32/* Data type for reentrant functions. */
33struct _getopt_data
34{
35 /* These have exactly the same meaning as the corresponding global
36 variables, except that they are used for the reentrant
37 versions of getopt. */
38 int optind;
39 int opterr;
40 int optopt;
41 char *optarg;
42
43 /* Internal members. */
44
45 /* True if the internal members have been initialized. */
46 int __initialized;
47
48 /* The next char to be scanned in the option-element
49 in which the last option character we returned was found.
50 This allows us to pick up the scan where we left off.
51
52 If this is zero, or a null string, it means resume the scan
53 by advancing to the next ARGV-element. */
54 char *__nextchar;
55
56 /* Describe how to deal with options that follow non-option ARGV-elements.
57
58 If the caller did not specify anything,
59 the default is REQUIRE_ORDER if the environment variable
60 POSIXLY_CORRECT is defined, PERMUTE otherwise.
61
62 REQUIRE_ORDER means don't recognize them as options;
63 stop option processing when the first non-option is seen.
64 This is what Unix does.
65 This mode of operation is selected by either setting the environment
66 variable POSIXLY_CORRECT, or using `+' as the first character
67 of the list of option characters, or by calling getopt.
68
69 PERMUTE is the default. We permute the contents of ARGV as we
70 scan, so that eventually all the non-options are at the end.
71 This allows options to be given in any order, even with programs
72 that were not written to expect this.
73
74 RETURN_IN_ORDER is an option available to programs that were
75 written to expect options and other ARGV-elements in any order
76 and that care about the ordering of the two. We describe each
77 non-option ARGV-element as if it were the argument of an option
78 with character code 1. Using `-' as the first character of the
79 list of option characters selects this mode of operation.
80
81 The special argument `--' forces an end of option-scanning regardless
82 of the value of `ordering'. In the case of RETURN_IN_ORDER, only
83 `--' can cause `getopt' to return -1 with `optind' != ARGC. */
84
85 enum
86 {
87 REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
88 } __ordering;
89
90 /* If the POSIXLY_CORRECT environment variable is set
91 or getopt was called. */
92 int __posixly_correct;
93
94
95 /* Handle permutation of arguments. */
96
97 /* Describe the part of ARGV that contains non-options that have
98 been skipped. `first_nonopt' is the index in ARGV of the first
99 of them; `last_nonopt' is the index after the last of them. */
100
101 int __first_nonopt;
102 int __last_nonopt;
103
104#if defined _LIBC && defined USE_NONOPTION_FLAGS
105 int __nonoption_flags_max_len;
106 int __nonoption_flags_len;
107# endif
108};
109
110/* The initializer is necessary to set OPTIND and OPTERR to their
111 default values and to clear the initialization flag. */
112#define _GETOPT_DATA_INITIALIZER { 1, 1 }
113
114extern int _getopt_internal_r (int ___argc, char **___argv,
115 const char *__shortopts,
116 const struct option *__longopts, int *__longind,
117 int __long_only, int __posixly_correct,
118 struct _getopt_data *__data);
119
120extern int _getopt_long_r (int ___argc, char **___argv,
121 const char *__shortopts,
122 const struct option *__longopts, int *__longind,
123 struct _getopt_data *__data);
124
125extern int _getopt_long_only_r (int ___argc, char **___argv,
126 const char *__shortopts,
127 const struct option *__longopts,
128 int *__longind,
129 struct _getopt_data *__data);
130
131#endif /* getopt_int.h */
132
133/* arch-tag: 8bfc548f-23d6-46aa-b5b5-2739b0edaf79
134 (do not change this comment) */
diff --git a/nt/inc/gettext.h b/lib-src/gettext.h
index cd251314cb4..ba484b3d1d9 100755..100644
--- a/nt/inc/gettext.h
+++ b/lib-src/gettext.h
@@ -1,20 +1,19 @@
1/* Convenience header for conditional use of GNU <libintl.h>. 1/* Convenience header for conditional use of GNU <libintl.h>.
2 Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. 2 Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify it 4 This program is free software; you can redistribute it and/or modify
5 under the terms of the GNU Library General Public License as published 5 it under the terms of the GNU General Public License as published by
6 by the Free Software Foundation; either version 2, or (at your option) 6 the Free Software Foundation; either version 2, or (at your option)
7 any later version. 7 any later version.
8 8
9 This program is distributed in the hope that it will be useful, 9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 Library General Public License for more details. 12 GNU General Public License for more details.
13 13
14 You should have received a copy of the GNU Library General Public 14 You should have received a copy of the GNU General Public License along
15 License along with this program; if not, write to the Free Software 15 with this program; if not, write to the Free Software Foundation,
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17 USA. */
18 17
19#ifndef _LIBGETTEXT_H 18#ifndef _LIBGETTEXT_H
20#define _LIBGETTEXT_H 1 19#define _LIBGETTEXT_H 1
@@ -37,6 +36,16 @@
37# include <locale.h> 36# include <locale.h>
38#endif 37#endif
39 38
39/* Many header files from the libstdc++ coming with g++ 3.3 or newer include
40 <libintl.h>, which chokes if dcgettext is defined as a macro. So include
41 it now, to make later inclusions of <libintl.h> a NOP. */
42#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3)
43# include <cstdlib>
44# if (__GLIBC__ >= 2) || _GLIBCXX_HAVE_LIBINTL_H
45# include <libintl.h>
46# endif
47#endif
48
40/* Disabled NLS. 49/* Disabled NLS.
41 The casts to 'const char *' serve the purpose of producing warnings 50 The casts to 'const char *' serve the purpose of producing warnings
42 for invalid uses of the value returned from these functions. 51 for invalid uses of the value returned from these functions.
@@ -68,5 +77,5 @@
68 77
69#endif /* _LIBGETTEXT_H */ 78#endif /* _LIBGETTEXT_H */
70 79
71/* arch-tag: 07b35a70-3531-4cda-9674-2968467143ec 80/* arch-tag: 3d01bb8e-82e3-4674-9812-de4c4224f7d1
72 (do not change this comment) */ 81 (do not change this comment) */
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index d8e8c205b3b..48ce5a2f80f 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -286,6 +286,7 @@ install: $(INSTALL_FILES)
286clean: 286clean:
287 - $(DEL) *~ DOC* $(COMPILER_TEMP_FILES) 287 - $(DEL) *~ DOC* $(COMPILER_TEMP_FILES)
288 - $(DEL) ctags.c 288 - $(DEL) ctags.c
289 - $(DEL) getopt.h
289 - $(DEL_TREE) $(OBJDIR) 290 - $(DEL_TREE) $(OBJDIR)
290 291
291cleanall: clean 292cleanall: clean
@@ -301,6 +302,8 @@ cleanall: clean
301 $(CP) $(ALL_DEPS) $@ 302 $(CP) $(ALL_DEPS) $@
302../src/paths.h: ../nt/paths.h 303../src/paths.h: ../nt/paths.h
303 $(CP) $(ALL_DEPS) $@ 304 $(CP) $(ALL_DEPS) $@
305getopt.h: getopt_.h
306 $(CP) $(ALL_DEPS) $@
304 307
305### DEPENDENCIES ### 308### DEPENDENCIES ###
306 309
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e0f12487fb4..5ae09a0e9ec 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,173 @@
12005-07-28 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * net/ange-ftp.el (ange-ftp-gateway-fatal-msgs)
4 (ange-ftp-pending-error-line): New vars.
5 (ange-ftp-process-handle-line, ange-ftp-process-filter): Use them
6 to handle the non-fatal no-route-to-host messages.
7 (internal-ange-ftp-mode): Make the no-match regexp more efficient.
8
92005-07-28 Juanma Barranquero <lekktu@gmail.com>
10
11 * isearch.el (isearch-mode-map, isearch-other-meta-char)
12 (isearch-quote-char, isearch-printing-char)
13 (isearch-text-char-description): "?\ " -> "?\s".
14 (isearch-lazy-highlight-cleanup)
15 (isearch-lazy-highlight-initial-delay)
16 (isearch-lazy-highlight-interval)
17 (isearch-lazy-highlight-max-at-a-time)
18 (isearch-lazy-highlight-face, isearch-lazy-highlight-cleanup):
19 Declare with define-obsolete-*-alias macros.
20 (isearch-forward): Fix typo in docstring.
21 (search-invisible, search-ring-yank-pointer)
22 (regexp-search-ring-yank-pointer): Doc fixes.
23
24 * recentf.el (recentf-menu-append-commands-p): Declare with
25 `define-obsolete-variable-alias'.
26 (recentf-max-saved-items, recentf-menu-filter)
27 (recentf-arrange-by-rule-subfilter): Doc fixes.
28 (recentf-menu-append-commands-flag)
29 (recentf-initialize-file-name-history, recentf-expand-file-name)
30 (recentf-clear-data): Fix typos in docstrings.
31
322005-07-28 Nick Roberts <nickrob@snap.net.nz>
33
34 * progmodes/gdb-ui.el: Smarten comments.
35 (gdb-info-breakpoints-custom): Use nowarn when finding file.
36
372005-07-27 Dan Nicolaescu <dann@ics.uci.edu>
38
39 * term/apollo.el (terminal-init-apollo): New function containing
40 all former top level forms in the file.
41 * term/bobcat.el (terminal-init-bobcat):
42 * term/cygwin.el (terminal-init-cygwin):
43 * term/iris-ansi.el (terminal-init-iris-ansi):
44 * term/linux.el (terminal-init-linux):
45 * term/news.el (terminal-init-news):
46 * term/rxvt.el (terminal-init-rxvt):
47 * term/sun.el (terminal-init-sun):
48 * term/tvi970.el (terminal-init-tvi970):
49 * term/vt100.el (terminal-init-vt100):
50 * term/vt102.el (terminal-init-vt102):
51 * term/vt125.el (terminal-init-vt125):
52 * term/vt200.el (terminal-init-vt200):
53 * term/vt201.el (terminal-init-vt201):
54 * term/vt220.el (terminal-init-vt220):
55 * term/vt240.el (terminal-init-vt240):
56 * term/vt300.el (terminal-init-vt300):
57 * term/vt320.el (terminal-init-vt320):
58 * term/vt400.el (terminal-init-vt400):
59 * term/vt420.el (terminal-init-vt420):
60 * term/wyse50.el (terminal-init-wyse50):
61 * term/xterm.el (terminal-init-xterm): Likewise.
62
63 * term/README: Describe the terminal-init-* functionality.
64
65 * startup.el (command-line): After loading the terminal
66 initialization file call the corresponding terminal initialization
67 function.
68
692005-07-27 Kenichi Handa <handa@m17n.org>
70
71 * ps-bdf.el (bdf-read-font-info): Ignore glyphs whose ENCODING is
72 negative.
73
74 * ps-mule.el (ps-mule-bitmap-prologue): Fix arguments to
75 setcharwidth.
76 (ps-mule-composition-prologue): Fix for the case that
77 RelativeCompose is false.
78
792005-07-26 Stefan Monnier <monnier@iro.umontreal.ca>
80
81 * smerge-mode.el (smerge-ediff): Use insert-buffer-substring.
82
83 * descr-text.el (describe-char): Handle the case where the list of
84 chars is displayed in a separate frame.
85 Be a bit more discriminating when looking for the char.
86
872005-07-26 Juanma Barranquero <lekktu@gmail.com>
88
89 * bookmark.el (bookmark-automatically-show-annotations)
90 (bookmark-read-annotation-text-func): Doc fixes.
91 (bookmark-save): Improve argument/docstring consistency.
92 (bookmark-get-bookmark, bookmark-get-bookmark-record)
93 (bookmark-alist-from-buffer)
94 (bookmark-upgrade-file-format-from-0)
95 (bookmark-grok-file-format-version)
96 (bookmark-maybe-upgrade-file-format, bookmark-kill-line)
97 (bookmark-read-annotation-mode)
98 (bookmark-insert-current-bookmark, bookmark-jump)
99 (bookmark-exit-hook): Fix typos in docstrings.
100 (bookmark-exit-hooks): Define as obsolete alias.
101 (bookmark-exit-hook-internal): Run `bookmark-exit-hook',
102 not `bookmark-exit-hooks'. Fix docstring.
103 (bookmark-bmenu-select): "?\ " -> "?\s".
104
1052005-07-25 Ari Roponen <arjuropo@cc.jyu.fi> (tiny change)
106
107 * startup.el (command-line): Fix typo.
108
1092005-07-24 Richard M. Stallman <rms@gnu.org>
110
111 * tooltip.el (tooltip-mode): Test emacs-basic-display,
112 not emacs-quick-startup.
113
1142005-07-24 Juanma Barranquero <lekktu@gmail.com>
115
116 * emacs-lisp/re-builder.el (reb-with-current-window): Delete.
117 (reb-next-match, reb-show-subexp): Use `with-selected-window'
118 instead of `reb-with-current-window'.
119 (reb-prev-match): Likewise. Also, don't move left if the search
120 was unsuccessful.
121 (reb-initialize-buffer): New function.
122 (re-builder, reb-change-syntax): Use it.
123
124 * man.el (Man-goto-page): Make second argument NOERROR optional.
125
1262005-07-23 Richard M. Stallman <rms@gnu.org>
127
128 * man.el (Man-bgproc-sentinel): Check here for failure to find
129 any man page in the output, and report the error here.
130 (Man-arguments): Make it permanent local.
131 (Man-goto-page): New arg NOERROR. Never kill the current buffer.
132 (Man-mode): Pass t for NOERROR.
133
134 * progmodes/grep.el (grep-error-face): Use font-lock-keyword-face.
135 (grep-mode-font-lock-keywords):
136 Don't use compilation-...-face for messages that are not file names.
137
138 * progmodes/compile.el (compilation-mode-font-lock-keywords):
139 Don't use compilation-...-face for messages that are not file names.
140
1412005-07-22 Juri Linkov <juri@jurta.org>
142
143 * simple.el (line-move-1): Fix comments.
144
145 * startup.el (normal-splash-screen): Update menu name.
146
147 * tempo.el (tempo-insert-template): Fix 2005-07-16 change.
148
1492005-07-22 Dan Nicolaescu <dann@ics.uci.edu>
150
151 * term/xterm.el: Load term/rxvt if the terminal is actually an
152 rxvt terminal.
153 (xterm-rxvt-set-background-mode): Remove, not used anymore.
154
155 * term/rxvt.el (function-key-map): Use substitute-key-definition
156 to bind {C,S,C-S}-{f1-f10}. Add a few missing key bindings.
157
158 * term/cygwin.el: New file.
159
1602005-07-22 Kim F. Storm <storm@cua.dk>
161
162 * image-file.el (insert-image-file, image-file-yank-handler):
163 Fix last change to maintain a (unique) yank-handler on yanked images.
164
1652005-07-22 Eduardo Mu,Aq(Boz <emufer@terra.es> (tiny change)
166
167 * dired.el (dired-move-to-filename-regexp): Recognize the B suffix
168 of the file size (as in "177B" for 177 bytes). This happens with
169 "ls -lh" on FreeBSD.
170
12005-07-22 Juanma Barranquero <lekktu@gmail.com> 1712005-07-22 Juanma Barranquero <lekktu@gmail.com>
2 172
3 * hilit-chg.el (highlight-changes-global-initial-state) 173 * hilit-chg.el (highlight-changes-global-initial-state)
@@ -215,20 +385,20 @@
215 385
216 * textmodes/org.el (org-table-column-names) 386 * textmodes/org.el (org-table-column-names)
217 (org-table-column-name-regexp) 387 (org-table-column-name-regexp)
218 (org-table-named-field-locations): New variables. 388 (org-table-named-field-locations): New variables.
219 (org-archive-subtree): Protect `this-command' when calling 389 (org-archive-subtree): Protect `this-command' when calling
220 `org-copy-subtree' and `org-cut-subtree', to avoid appending to 390 `org-copy-subtree' and `org-cut-subtree', to avoid appending to
221 the kill buffer. 391 the kill buffer.
222 (org-complete): Remove fixed-formula completion. 392 (org-complete): Remove fixed-formula completion.
223 (org-edit-formulas-map): New variable. 393 (org-edit-formulas-map): New variable.
224 (org-table-edit-formulas): New command. 394 (org-table-edit-formulas): New command.
225 (org-finish-edit-formulas, org-abort-edit-formulas) 395 (org-finish-edit-formulas, org-abort-edit-formulas)
226 (org-show-variable, org-table-get-vertical-vector): New functions. 396 (org-show-variable, org-table-get-vertical-vector): New functions.
227 (org-table-maybe-eval-formula): Handle `:=' fields. 397 (org-table-maybe-eval-formula): Handle `:=' fields.
228 (org-table-get-stored-formulas, org-table-store-formulas) 398 (org-table-get-stored-formulas, org-table-store-formulas)
229 (org-table-get-formula, org-table-modify-formulas) 399 (org-table-get-formula, org-table-modify-formulas)
230 (org-table-replace-in-formulas): Handle named field formulas. 400 (org-table-replace-in-formulas): Handle named field formulas.
231 (org-table-get-specials): Store locations of named fields. 401 (org-table-get-specials): Store locations of named fields.
232 402
2332005-07-19 Juri Linkov <juri@jurta.org> 4032005-07-19 Juri Linkov <juri@jurta.org>
234 404
@@ -290,8 +460,8 @@
290 more than 88 colors. Use green for light backgrounds with 460 more than 88 colors. Use green for light backgrounds with
291 8 colors, and yellow for dark backgrounds with 8 colors. 461 8 colors, and yellow for dark backgrounds with 8 colors.
292 462
293 * font-lock.el (font-lock-regexp-grouping-backslash): Don't 463 * font-lock.el (font-lock-regexp-grouping-backslash):
294 inherit from escape-glyph (use bold for all cases). 464 Don't inherit from escape-glyph (use bold for all cases).
295 465
296 * info.el (info-xref-visited): Use light foreground color `violet' 466 * info.el (info-xref-visited): Use light foreground color `violet'
297 for dark backgrounds instead of dark color `magenta3'. 467 for dark backgrounds instead of dark color `magenta3'.
@@ -388,8 +558,8 @@
388 `insert-buffer'. 558 `insert-buffer'.
389 559
390 * calendar/icalendar.el (icalendar--get-unfolded-buffer): 560 * calendar/icalendar.el (icalendar--get-unfolded-buffer):
391 * progmodes/ada-mode.el (ada-make-body): Use 561 * progmodes/ada-mode.el (ada-make-body):
392 `insert-buffer-substring' and `goto-char', not `insert-buffer'. 562 Use `insert-buffer-substring' and `goto-char', not `insert-buffer'.
393 563
394 * dired.el (dired-log): 564 * dired.el (dired-log):
395 * tar-mode.el (tar-subfile-save-buffer): 565 * tar-mode.el (tar-subfile-save-buffer):
@@ -483,8 +653,8 @@
483 653
484 * emulation/viper-init.el (viper-activate-input-method): Avoid warning. 654 * emulation/viper-init.el (viper-activate-input-method): Avoid warning.
485 655
486 * emacs-lisp/re-builder.el (reb-cook-regexp): Avoid 656 * emacs-lisp/re-builder.el (reb-cook-regexp):
487 warning calling lre-compile-string. 657 Avoid warning calling lre-compile-string.
488 (reb-color-display-p): Avoid warning. 658 (reb-color-display-p): Avoid warning.
489 659
490 * calculator.el (calculator-last-input): Guard uses 660 * calculator.el (calculator-last-input): Guard uses
@@ -501,8 +671,8 @@
501 (checkdoc-overlay-start, checkdoc-overlay-end) 671 (checkdoc-overlay-start, checkdoc-overlay-end)
502 (checkdoc-mode-line-update, checkdoc-char=): 672 (checkdoc-mode-line-update, checkdoc-char=):
503 Define such that compiler knows they are defined. 673 Define such that compiler knows they are defined.
504 (checkdoc-call-eval-buffer): Deleted. Use eval-buffer directly. 674 (checkdoc-call-eval-buffer): Delete. Use eval-buffer directly.
505 (checkdoc-read-event): Deleted. Use read-event directly. 675 (checkdoc-read-event): Delete. Use read-event directly.
506 676
507 * whitespace.el (whitespace-make-overlay) 677 * whitespace.el (whitespace-make-overlay)
508 (whitespace-overlay-put, whitespace-delete-overlay) 678 (whitespace-overlay-put, whitespace-delete-overlay)
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 51a5e0469e5..1f0d671afb4 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -169,7 +169,7 @@ recently set ones come first, oldest ones come last)."
169 169
170 170
171(defcustom bookmark-automatically-show-annotations t 171(defcustom bookmark-automatically-show-annotations t
172 "*nil means don't show annotations when jumping to a bookmark." 172 "*Non-nil means show annotations when jumping to a bookmark."
173 :type 'boolean 173 :type 'boolean
174 :group 'bookmark) 174 :group 'bookmark)
175 175
@@ -333,14 +333,14 @@ through a file easier.")
333 333
334 334
335(defun bookmark-get-bookmark (bookmark) 335(defun bookmark-get-bookmark (bookmark)
336 "Return the full entry for BOOKMARK in bookmark-alist. 336 "Return the full entry for BOOKMARK in `bookmark-alist'.
337If BOOKMARK is not a string, return nil." 337If BOOKMARK is not a string, return nil."
338 (when (stringp bookmark) 338 (when (stringp bookmark)
339 (assoc-string bookmark bookmark-alist bookmark-completion-ignore-case))) 339 (assoc-string bookmark bookmark-alist bookmark-completion-ignore-case)))
340 340
341 341
342(defun bookmark-get-bookmark-record (bookmark) 342(defun bookmark-get-bookmark-record (bookmark)
343 "Return the guts of the entry for BOOKMARK in bookmark-alist. 343 "Return the guts of the entry for BOOKMARK in `bookmark-alist'.
344That is, all information but the name." 344That is, all information but the name."
345 (car (cdr (bookmark-get-bookmark bookmark)))) 345 (car (cdr (bookmark-get-bookmark bookmark))))
346 346
@@ -443,8 +443,7 @@ That is, all information but the name."
443 (list (cons 'info-node node))))) 443 (list (cons 'info-node node)))))
444 444
445 (message "%S" (assq 'info-node (bookmark-get-bookmark-record bookmark))) 445 (message "%S" (assq 'info-node (bookmark-get-bookmark-record bookmark)))
446 (sit-for 4) 446 (sit-for 4))
447 )
448 447
449 448
450(defvar bookmark-history nil 449(defvar bookmark-history nil
@@ -619,7 +618,7 @@ You should never need to change this.")
619 618
620 619
621(defun bookmark-alist-from-buffer () 620(defun bookmark-alist-from-buffer ()
622 "Return a bookmark-alist (in any format) from the current buffer. 621 "Return a `bookmark-alist' (in any format) from the current buffer.
623The buffer must of course contain bookmark format information. 622The buffer must of course contain bookmark format information.
624Does not care from where in the buffer it is called, and does not 623Does not care from where in the buffer it is called, and does not
625affect point." 624affect point."
@@ -659,7 +658,7 @@ affect point."
659 658
660(defun bookmark-upgrade-file-format-from-0 () 659(defun bookmark-upgrade-file-format-from-0 ()
661 "Upgrade a bookmark file of format 0 (the original format) to format 1. 660 "Upgrade a bookmark file of format 0 (the original format) to format 1.
662This expects to be called from point-min in a bookmark file." 661This expects to be called from `point-min' in a bookmark file."
663 (message "Upgrading bookmark format from 0 to %d..." 662 (message "Upgrading bookmark format from 0 to %d..."
664 bookmark-file-format-version) 663 bookmark-file-format-version)
665 (let* ((old-list (bookmark-alist-from-buffer)) 664 (let* ((old-list (bookmark-alist-from-buffer))
@@ -676,7 +675,7 @@ This expects to be called from point-min in a bookmark file."
676 675
677(defun bookmark-grok-file-format-version () 676(defun bookmark-grok-file-format-version ()
678 "Return an integer which is the file-format version of this bookmark file. 677 "Return an integer which is the file-format version of this bookmark file.
679This expects to be called from point-min in a bookmark file." 678This expects to be called from `point-min' in a bookmark file."
680 (if (looking-at "^;;;;") 679 (if (looking-at "^;;;;")
681 (save-excursion 680 (save-excursion
682 (save-match-data 681 (save-match-data
@@ -691,7 +690,7 @@ This expects to be called from point-min in a bookmark file."
691(defun bookmark-maybe-upgrade-file-format () 690(defun bookmark-maybe-upgrade-file-format ()
692 "Check the file-format version of this bookmark file. 691 "Check the file-format version of this bookmark file.
693If the version is not up-to-date, upgrade it automatically. 692If the version is not up-to-date, upgrade it automatically.
694This expects to be called from point-min in a bookmark file." 693This expects to be called from `point-min' in a bookmark file."
695 (let ((version (bookmark-grok-file-format-version))) 694 (let ((version (bookmark-grok-file-format-version)))
696 (cond 695 (cond
697 ((= version bookmark-file-format-version) 696 ((= version bookmark-file-format-version)
@@ -783,7 +782,7 @@ the list of bookmarks.\)"
783(defun bookmark-kill-line (&optional newline-too) 782(defun bookmark-kill-line (&optional newline-too)
784 "Kill from point to end of line. 783 "Kill from point to end of line.
785If optional arg NEWLINE-TOO is non-nil, delete the newline too. 784If optional arg NEWLINE-TOO is non-nil, delete the newline too.
786Does not affect the kill-ring." 785Does not affect the kill ring."
787 (let ((eol (save-excursion (end-of-line) (point)))) 786 (let ((eol (save-excursion (end-of-line) (point))))
788 (delete-region (point) eol) 787 (delete-region (point) eol)
789 (if (and newline-too (looking-at "\n")) 788 (if (and newline-too (looking-at "\n"))
@@ -842,11 +841,11 @@ the bookmark (and file, and point) specified in buffer local variables."
842 841
843(defvar bookmark-read-annotation-text-func 'bookmark-default-annotation-text 842(defvar bookmark-read-annotation-text-func 'bookmark-default-annotation-text
844 "Function to return default text to use for a bookmark annotation. 843 "Function to return default text to use for a bookmark annotation.
845It takes the name of the bookmark, as a string, as an arg.") 844It takes one argument, the name of the bookmark, as a string.")
846 845
847(defun bookmark-read-annotation-mode (buf point parg bookmark) 846(defun bookmark-read-annotation-mode (buf point parg bookmark)
848 "Mode for composing annotations for a bookmark. 847 "Mode for composing annotations for a bookmark.
849Wants BUF POINT PARG and BOOKMARK. 848Wants BUF, POINT, PARG, and BOOKMARK.
850When you have finished composing, type \\[bookmark-send-annotation] to send 849When you have finished composing, type \\[bookmark-send-annotation] to send
851the annotation. 850the annotation.
852 851
@@ -933,7 +932,7 @@ Lines beginning with `#' are ignored."
933 932
934 933
935(defun bookmark-insert-current-bookmark () 934(defun bookmark-insert-current-bookmark ()
936 "Insert this buffer's value of bookmark-current-bookmark. 935 "Insert this buffer's value of `bookmark-current-bookmark'.
937Default to file name if it's nil." 936Default to file name if it's nil."
938 (interactive) 937 (interactive)
939 (let ((str 938 (let ((str
@@ -1044,7 +1043,7 @@ bookmarks. See help on function `bookmark-load' for more about
1044this. 1043this.
1045 1044
1046If the file pointed to by BOOKMARK no longer exists, you will be asked 1045If the file pointed to by BOOKMARK no longer exists, you will be asked
1047if you wish to give the bookmark a new location, and bookmark-jump 1046if you wish to give the bookmark a new location, and `bookmark-jump'
1048will then jump to the new location, as well as recording it in place 1047will then jump to the new location, as well as recording it in place
1049of the old one in the permanent bookmark record." 1048of the old one in the permanent bookmark record."
1050 (interactive 1049 (interactive
@@ -1304,8 +1303,8 @@ Saves by default in the file defined by the variable
1304`bookmark-default-file'. With a prefix arg, save it in file FILE 1303`bookmark-default-file'. With a prefix arg, save it in file FILE
1305\(second argument\). 1304\(second argument\).
1306 1305
1307If you are calling this from Lisp, the two arguments are PREFIX-ARG 1306If you are calling this from Lisp, the two arguments are PARG and
1308and FILE, and if you just want it to write to the default file, then 1307FILE, and if you just want it to write to the default file, then
1309pass no arguments. Or pass in nil and FILE, and it will save in FILE 1308pass no arguments. Or pass in nil and FILE, and it will save in FILE
1310instead. If you pass in one argument, and it is non-nil, then the 1309instead. If you pass in one argument, and it is non-nil, then the
1311user will be interactively queried for a file to save in. 1310user will be interactively queried for a file to save in.
@@ -1804,7 +1803,7 @@ You can mark bookmarks with the \\<bookmark-bmenu-mode-map>\\[bookmark-bmenu-mar
1804 (setq tem (bookmark-bmenu-bookmark)) 1803 (setq tem (bookmark-bmenu-bookmark))
1805 (let ((inhibit-read-only t)) 1804 (let ((inhibit-read-only t))
1806 (delete-char -1) 1805 (delete-char -1)
1807 (insert ?\ )) 1806 (insert ?\s))
1808 (or (string-equal tem bmrk) 1807 (or (string-equal tem bmrk)
1809 (member tem others) 1808 (member tem others)
1810 (setq others (cons tem others)))) 1809 (setq others (cons tem others))))
@@ -2093,7 +2092,7 @@ strings returned are not."
2093 (format "-*- %s (%d) -*-" name iter) 2092 (format "-*- %s (%d) -*-" name iter)
2094 (nreverse lst)) 2093 (nreverse lst))
2095 pane-list))) 2094 pane-list)))
2096 2095
2097 ;; Popup the menu and return the string. 2096 ;; Popup the menu and return the string.
2098 (x-popup-menu event (cons (concat "-*- " name " -*-") 2097 (x-popup-menu event (cons (concat "-*- " name " -*-")
2099 (nreverse pane-list))))) 2098 (nreverse pane-list)))))
@@ -2141,12 +2140,14 @@ strings returned are not."
2141 2140
2142;;; Exit Hook, called from kill-emacs-hook 2141;;; Exit Hook, called from kill-emacs-hook
2143(defvar bookmark-exit-hook nil 2142(defvar bookmark-exit-hook nil
2144 "Hook run when emacs exits.") 2143 "Hook run when Emacs exits.")
2144
2145(define-obsolete-variable-alias 'bookmark-exit-hooks 'bookmark-exit-hook "22.1")
2145 2146
2146(defun bookmark-exit-hook-internal () 2147(defun bookmark-exit-hook-internal ()
2147 "Save bookmark state, if necessary, at Emacs exit time. 2148 "Save bookmark state, if necessary, at Emacs exit time.
2148This also runs `bookmark-exit-hooks'." 2149This also runs `bookmark-exit-hook'."
2149 (run-hooks 'bookmark-exit-hooks) 2150 (run-hooks 'bookmark-exit-hook)
2150 (and bookmark-alist 2151 (and bookmark-alist
2151 (bookmark-time-to-save-p t) 2152 (bookmark-time-to-save-p t)
2152 (bookmark-save))) 2153 (bookmark-save)))
diff --git a/lisp/dired.el b/lisp/dired.el
index 0ba369e4640..880d31d9b41 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1865,11 +1865,11 @@ DIR must be a directory name, not a file name."
1865 ;; The "[0-9]" below requires the previous column to end in a digit. 1865 ;; The "[0-9]" below requires the previous column to end in a digit.
1866 ;; This avoids recognizing `1 may 1997' as a date in the line: 1866 ;; This avoids recognizing `1 may 1997' as a date in the line:
1867 ;; -r--r--r-- 1 may 1997 1168 Oct 19 16:49 README 1867 ;; -r--r--r-- 1 may 1997 1168 Oct 19 16:49 README
1868 ;; The "[kKMGTPEZY]?" below supports "ls -alh" output. 1868 ;; The "[BkKMGTPEZY]?" below supports "ls -alh" output.
1869 ;; The ".*" below finds the last match if there are multiple matches. 1869 ;; The ".*" below finds the last match if there are multiple matches.
1870 ;; This avoids recognizing `jservice 10 1024' as a date in the line: 1870 ;; This avoids recognizing `jservice 10 1024' as a date in the line:
1871 ;; drwxr-xr-x 3 jservice 10 1024 Jul 2 1997 esg-host 1871 ;; drwxr-xr-x 3 jservice 10 1024 Jul 2 1997 esg-host
1872 (concat ".*[0-9][kKMGTPEZY]?" s 1872 (concat ".*[0-9][BkKMGTPEZY]?" s
1873 "\\(" western "\\|" western-comma "\\|" japanese "\\|" iso "\\)" 1873 "\\(" western "\\|" western-comma "\\|" japanese "\\|" iso "\\)"
1874 s "+")) 1874 s "+"))
1875 "Regular expression to match up to the file name in a directory listing. 1875 "Regular expression to match up to the file name in a directory listing.
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index bdfe79b3b6a..e0a3c5ed285 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -299,20 +299,6 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
299 (add-hook 'kill-buffer-hook 'reb-kill-buffer) 299 (add-hook 'kill-buffer-hook 'reb-kill-buffer)
300 (reb-auto-update nil nil nil)) 300 (reb-auto-update nil nil nil))
301 301
302
303;; Handy macro for doing things in other windows
304(defmacro reb-with-current-window (window &rest body)
305 "With WINDOW selected evaluate BODY forms and reselect previous window."
306
307 (let ((oldwindow (make-symbol "*oldwindow*")))
308 `(let ((,oldwindow (selected-window)))
309 (select-window ,window)
310 (unwind-protect
311 (progn
312 ,@body)
313 (select-window ,oldwindow)))))
314(put 'reb-with-current-window 'lisp-indent-function 0)
315
316(defun reb-color-display-p () 302(defun reb-color-display-p ()
317 "Return t if display is capable of displaying colors." 303 "Return t if display is capable of displaying colors."
318 (eq 'color 304 (eq 'color
@@ -330,6 +316,15 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
330 "Return binding for SYMBOL in the RE Builder target buffer." 316 "Return binding for SYMBOL in the RE Builder target buffer."
331 `(with-current-buffer reb-target-buffer ,symbol)) 317 `(with-current-buffer reb-target-buffer ,symbol))
332 318
319(defun reb-initialize-buffer ()
320 "Initialize the current buffer as a RE Builder buffer."
321 (erase-buffer)
322 (reb-insert-regexp)
323 (goto-char (+ 2 (point-min)))
324 (cond ((reb-lisp-syntax-p)
325 (reb-lisp-mode))
326 (t (reb-mode))))
327
333;;; This is to help people find this in Apropos. 328;;; This is to help people find this in Apropos.
334;;;###autoload 329;;;###autoload
335(defalias 'regexp-builder 're-builder) 330(defalias 'regexp-builder 're-builder)
@@ -349,13 +344,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
349 reb-window-config (current-window-configuration)) 344 reb-window-config (current-window-configuration))
350 (select-window (split-window (selected-window) (- (window-height) 4))) 345 (select-window (split-window (selected-window) (- (window-height) 4)))
351 (switch-to-buffer (get-buffer-create reb-buffer)) 346 (switch-to-buffer (get-buffer-create reb-buffer))
352 (erase-buffer) 347 (reb-initialize-buffer)))
353 (reb-insert-regexp)
354 (goto-char (+ 2 (point-min)))
355 (cond
356 ((reb-lisp-syntax-p)
357 (reb-lisp-mode))
358 (t (reb-mode)))))
359 348
360(defun reb-change-target-buffer (buf) 349(defun reb-change-target-buffer (buf)
361 "Change the target buffer and display it in the target window." 350 "Change the target buffer and display it in the target window."
@@ -393,8 +382,7 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
393 (interactive) 382 (interactive)
394 383
395 (reb-assert-buffer-in-window) 384 (reb-assert-buffer-in-window)
396 (reb-with-current-window 385 (with-selected-window reb-target-window
397 reb-target-window
398 (if (not (re-search-forward reb-regexp (point-max) t)) 386 (if (not (re-search-forward reb-regexp (point-max) t))
399 (message "No more matches.") 387 (message "No more matches.")
400 (reb-show-subexp 388 (reb-show-subexp
@@ -406,13 +394,15 @@ Except for Lisp syntax this is the same as `reb-regexp'.")
406 (interactive) 394 (interactive)
407 395
408 (reb-assert-buffer-in-window) 396 (reb-assert-buffer-in-window)
409 (reb-with-current-window reb-target-window 397 (with-selected-window reb-target-window
410 (goto-char (1- (point))) 398 (let ((p (point)))
411 (if (not (re-search-backward reb-regexp (point-min) t)) 399 (goto-char (1- p))
412 (message "No more matches.") 400 (if (re-search-backward reb-regexp (point-min) t)
413 (reb-show-subexp 401 (reb-show-subexp
414 (or (and reb-subexp-mode reb-subexp-displayed) 0) 402 (or (and reb-subexp-mode reb-subexp-displayed) 0)
415 t)))) 403 t)
404 (goto-char p)
405 (message "No more matches.")))))
416 406
417(defun reb-toggle-case () 407(defun reb-toggle-case ()
418 "Toggle case sensitivity of searches for RE Builder target buffer." 408 "Toggle case sensitivity of searches for RE Builder target buffer."
@@ -449,7 +439,7 @@ On color displays this just puts point to the end of the expression as
449the match should already be marked by an overlay. 439the match should already be marked by an overlay.
450On other displays jump to the beginning and the end of it. 440On other displays jump to the beginning and the end of it.
451If the optional PAUSE is non-nil then pause at the end in any case." 441If the optional PAUSE is non-nil then pause at the end in any case."
452 (reb-with-current-window reb-target-window 442 (with-selected-window reb-target-window
453 (if (not (reb-color-display-p)) 443 (if (not (reb-color-display-p))
454 (progn (goto-char (match-beginning subexp)) 444 (progn (goto-char (match-beginning subexp))
455 (sit-for reb-blink-delay))) 445 (sit-for reb-blink-delay)))
@@ -479,14 +469,9 @@ Optional argument SYNTAX must be specified if called non-interactively."
479 (if (memq syntax '(read string lisp-re sregex rx)) 469 (if (memq syntax '(read string lisp-re sregex rx))
480 (let ((buffer (get-buffer reb-buffer))) 470 (let ((buffer (get-buffer reb-buffer)))
481 (setq reb-re-syntax syntax) 471 (setq reb-re-syntax syntax)
482 (if buffer 472 (when buffer
483 (with-current-buffer buffer 473 (with-current-buffer buffer
484 (erase-buffer) 474 (reb-initialize-buffer))))
485 (reb-insert-regexp)
486 (goto-char (+ 2 (point-min)))
487 (cond ((reb-lisp-syntax-p)
488 (reb-lisp-mode))
489 (t (reb-mode))))))
490 (error "Invalid syntax: %s" syntax))) 475 (error "Invalid syntax: %s" syntax)))
491 476
492 477
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 33f639380a6..7bc733ad90f 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,36 @@
12005-07-28 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * rfc2231.el (rfc2231-parse-string): Take care that not only a
4 segmented parameter but also other parameters might be there.
5
62005-07-26 Katsumi Yamaoka <yamaoka@jpl.org>
7
8 * gnus-art.el (gnus-article-next-page-1): Don't scroll if there're
9 fewer lines than that of scroll-margin.
10 (gnus-article-prev-page): Narrow the range to bind scroll-in-place.
11
122005-07-25 Katsumi Yamaoka <yamaoka@jpl.org>
13
14 * gnus-art.el (gnus-article-next-page): Revert.
15 (gnus-article-beginning-of-window): New macro.
16 (gnus-article-next-page-1): Use it.
17 (gnus-article-prev-page): Ditto.
18 (gnus-mime-save-part-and-strip): Use insert-buffer-substring
19 instead of insert-buffer.
20 (gnus-mime-delete-part): Ditto.
21 (gnus-article-edit-exit): Ditto.
22
23 * gnus-util.el (gnus-beginning-of-window): Remove.
24 (gnus-end-of-window): Remove.
25
26 * lpath.el: Don't bind scroll-margin.
27
282005-07-25 Simon Josefsson <jas@extundo.com>
29
30 * pgg.el (pgg-insert-url-with-w3): Don't load w3, it is possible
31 to have the url package without w3. Reported by Daiki Ueno
32 <ueno@unixuser.org> and Luigi Panzeri <matley@muppetslab.org>.
33
12005-07-21 Stefan Monnier <monnier@iro.umontreal.ca> 342005-07-21 Stefan Monnier <monnier@iro.umontreal.ca>
2 35
3 * mml.el (mml-minibuffer-read-disposition): Don't use inline by default 36 * mml.el (mml-minibuffer-read-disposition): Don't use inline by default
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 2be1afea77d..f7e3420e922 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -4117,7 +4117,7 @@ Deleting parts may malfunction or destroy the article; continue? ")
4117 ',gnus-newsgroup-ignored-charsets)) 4117 ',gnus-newsgroup-ignored-charsets))
4118 (mbl mml-buffer-list)) 4118 (mbl mml-buffer-list))
4119 (setq mml-buffer-list nil) 4119 (setq mml-buffer-list nil)
4120 (insert-buffer gnus-original-article-buffer) 4120 (insert-buffer-substring gnus-original-article-buffer)
4121 (mime-to-mml ',handles) 4121 (mime-to-mml ',handles)
4122 (setq gnus-article-mime-handles nil) 4122 (setq gnus-article-mime-handles nil)
4123 (let ((mbl1 mml-buffer-list)) 4123 (let ((mbl1 mml-buffer-list))
@@ -4199,7 +4199,7 @@ Deleting parts may malfunction or destroy the article; continue? ")
4199 ',gnus-newsgroup-ignored-charsets)) 4199 ',gnus-newsgroup-ignored-charsets))
4200 (mbl mml-buffer-list)) 4200 (mbl mml-buffer-list))
4201 (setq mml-buffer-list nil) 4201 (setq mml-buffer-list nil)
4202 (insert-buffer gnus-original-article-buffer) 4202 (insert-buffer-substring gnus-original-article-buffer)
4203 (mime-to-mml ',handles) 4203 (mime-to-mml ',handles)
4204 (setq gnus-article-mime-handles nil) 4204 (setq gnus-article-mime-handles nil)
4205 (let ((mbl1 mml-buffer-list)) 4205 (let ((mbl1 mml-buffer-list))
@@ -5160,7 +5160,7 @@ If given a numerical ARG, move forward ARG pages."
5160If end of article, return non-nil. Otherwise return nil. 5160If end of article, return non-nil. Otherwise return nil.
5161Argument LINES specifies lines to be scrolled up." 5161Argument LINES specifies lines to be scrolled up."
5162 (interactive "p") 5162 (interactive "p")
5163 (gnus-end-of-window) 5163 (move-to-window-line -1)
5164 (if (save-excursion 5164 (if (save-excursion
5165 (end-of-line) 5165 (end-of-line)
5166 (and (pos-visible-in-window-p) ;Not continuation line. 5166 (and (pos-visible-in-window-p) ;Not continuation line.
@@ -5182,20 +5182,38 @@ Argument LINES specifies lines to be scrolled up."
5182 (gnus-article-next-page-1 lines) 5182 (gnus-article-next-page-1 lines)
5183 nil)) 5183 nil))
5184 5184
5185(defmacro gnus-article-beginning-of-window ()
5186 "Move point to the beginning of the window.
5187In Emacs, the point is placed at the line number which `scroll-margin'
5188specifies."
5189 (if (featurep 'xemacs)
5190 '(move-to-window-line 0)
5191 '(move-to-window-line
5192 (min (max 0 scroll-margin)
5193 (max 1 (- (window-height)
5194 (if mode-line-format 1 0)
5195 (if (and (boundp 'header-line-format)
5196 (symbol-value 'header-line-format))
5197 1 0)))))))
5198
5185(defun gnus-article-next-page-1 (lines) 5199(defun gnus-article-next-page-1 (lines)
5186 (let ((scroll-in-place nil)) 5200 (unless (and (not (featurep 'xemacs))
5201 (> (symbol-value 'scroll-margin) 0)
5202 (<= (count-lines (window-start) (point-max))
5203 (symbol-value 'scroll-margin)))
5187 (condition-case () 5204 (condition-case ()
5188 (scroll-up lines) 5205 (let ((scroll-in-place nil))
5206 (scroll-up lines))
5189 (end-of-buffer 5207 (end-of-buffer
5190 ;; Long lines may cause an end-of-buffer error. 5208 ;; Long lines may cause an end-of-buffer error.
5191 (goto-char (point-max))))) 5209 (goto-char (point-max))))
5192 (gnus-beginning-of-window)) 5210 (gnus-article-beginning-of-window)))
5193 5211
5194(defun gnus-article-prev-page (&optional lines) 5212(defun gnus-article-prev-page (&optional lines)
5195 "Show previous page of current article. 5213 "Show previous page of current article.
5196Argument LINES specifies lines to be scrolled down." 5214Argument LINES specifies lines to be scrolled down."
5197 (interactive "p") 5215 (interactive "p")
5198 (gnus-beginning-of-window) 5216 (move-to-window-line 0)
5199 (if (and gnus-page-broken 5217 (if (and gnus-page-broken
5200 (bobp) 5218 (bobp)
5201 (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer? 5219 (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer?
@@ -5203,13 +5221,13 @@ Argument LINES specifies lines to be scrolled down."
5203 (gnus-narrow-to-page -1) ;Go to previous page. 5221 (gnus-narrow-to-page -1) ;Go to previous page.
5204 (goto-char (point-max)) 5222 (goto-char (point-max))
5205 (recenter -1)) 5223 (recenter -1))
5206 (let ((scroll-in-place nil)) 5224 (prog1
5207 (prog1 5225 (condition-case ()
5208 (condition-case () 5226 (let ((scroll-in-place nil))
5209 (scroll-down lines) 5227 (scroll-down lines))
5210 (beginning-of-buffer 5228 (beginning-of-buffer
5211 (goto-char (point-min)))) 5229 (goto-char (point-min))))
5212 (gnus-beginning-of-window))))) 5230 (gnus-article-beginning-of-window))))
5213 5231
5214(defun gnus-article-only-boring-p () 5232(defun gnus-article-only-boring-p ()
5215 "Decide whether there is only boring text remaining in the article. 5233 "Decide whether there is only boring text remaining in the article.
@@ -5818,7 +5836,7 @@ groups."
5818 (window-start (window-start))) 5836 (window-start (window-start)))
5819 (erase-buffer) 5837 (erase-buffer)
5820 (if (gnus-buffer-live-p gnus-original-article-buffer) 5838 (if (gnus-buffer-live-p gnus-original-article-buffer)
5821 (insert-buffer gnus-original-article-buffer)) 5839 (insert-buffer-substring gnus-original-article-buffer))
5822 (let ((winconf gnus-prev-winconf)) 5840 (let ((winconf gnus-prev-winconf))
5823 (kill-all-local-variables) 5841 (kill-all-local-variables)
5824 (gnus-article-mode) 5842 (gnus-article-mode)
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 363b9c2f4a0..925555e1ff0 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1577,30 +1577,6 @@ empty directories from OLD-PATH."
1577 (defalias 'gnus-set-process-query-on-exit-flag 1577 (defalias 'gnus-set-process-query-on-exit-flag
1578 'process-kill-without-query)) 1578 'process-kill-without-query))
1579 1579
1580(defun gnus-beginning-of-window ()
1581 "Move point to the beginning of the window."
1582 (move-to-window-line
1583 (if (featurep 'xemacs)
1584 0
1585 (min scroll-margin
1586 (max 1 (- (window-height)
1587 (if mode-line-format 1 0)
1588 (if (and (boundp 'header-line-format)
1589 (symbol-value 'header-line-format))
1590 1 0)))))))
1591
1592(defun gnus-end-of-window ()
1593 "Move point to the end of the window."
1594 (move-to-window-line
1595 (if (featurep 'xemacs)
1596 -1
1597 (max (- -1 scroll-margin)
1598 (- -1 (max 1 (- (window-height)
1599 (if mode-line-format 1 0)
1600 (if (and (boundp 'header-line-format)
1601 (symbol-value 'header-line-format))
1602 1 0))))))))
1603
1604(provide 'gnus-util) 1580(provide 'gnus-util)
1605 1581
1606;;; arch-tag: f94991af-d32b-4c97-8c26-ca12a934de49 1582;;; arch-tag: f94991af-d32b-4c97-8c26-ca12a934de49
diff --git a/lisp/gnus/pgg.el b/lisp/gnus/pgg.el
index 91b56c57a4f..8d72fd31502 100644
--- a/lisp/gnus/pgg.el
+++ b/lisp/gnus/pgg.el
@@ -410,7 +410,6 @@ within the region."
410 410
411(defun pgg-insert-url-with-w3 (url) 411(defun pgg-insert-url-with-w3 (url)
412 (ignore-errors 412 (ignore-errors
413 (require 'w3)
414 (require 'url) 413 (require 'url)
415 (let (buffer-file-name) 414 (let (buffer-file-name)
416 (url-insert-file-contents url)))) 415 (url-insert-file-contents url))))
diff --git a/lisp/gnus/rfc2231.el b/lisp/gnus/rfc2231.el
index 0a6cfdb2af1..4c39ba6c7fd 100644
--- a/lisp/gnus/rfc2231.el
+++ b/lisp/gnus/rfc2231.el
@@ -1,6 +1,6 @@
1;;; rfc2231.el --- Functions for decoding rfc2231 headers 1;;; rfc2231.el --- Functions for decoding rfc2231 headers
2 2
3;; Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 3;; Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005
4;; Free Software Foundation, Inc. 4;; Free Software Foundation, Inc.
5 5
6;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 6;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -52,7 +52,7 @@ The list will be on the form
52 (prev-value "") 52 (prev-value "")
53 display-name mailbox c display-string parameters 53 display-name mailbox c display-string parameters
54 attribute value type subtype number encoded 54 attribute value type subtype number encoded
55 prev-attribute) 55 prev-attribute prev-encoded)
56 (ietf-drums-init (mail-header-remove-whitespace 56 (ietf-drums-init (mail-header-remove-whitespace
57 (mail-header-remove-comments string))) 57 (mail-header-remove-comments string)))
58 (let ((table (copy-syntax-table ietf-drums-syntax-table))) 58 (let ((table (copy-syntax-table ietf-drums-syntax-table)))
@@ -106,9 +106,14 @@ The list will be on the form
106 ;; See if we have any previous continuations. 106 ;; See if we have any previous continuations.
107 (when (and prev-attribute 107 (when (and prev-attribute
108 (not (eq prev-attribute attribute))) 108 (not (eq prev-attribute attribute)))
109 (push (cons prev-attribute prev-value) parameters) 109 (push (cons prev-attribute
110 (if prev-encoded
111 (rfc2231-decode-encoded-string prev-value)
112 prev-value))
113 parameters)
110 (setq prev-attribute nil 114 (setq prev-attribute nil
111 prev-value "")) 115 prev-value ""
116 prev-encoded nil))
112 (unless (eq c ?=) 117 (unless (eq c ?=)
113 (error "Invalid header: %s" string)) 118 (error "Invalid header: %s" string))
114 (forward-char 1) 119 (forward-char 1)
@@ -127,7 +132,8 @@ The list will be on the form
127 (error "Invalid header: %s" string))) 132 (error "Invalid header: %s" string)))
128 (if number 133 (if number
129 (setq prev-attribute attribute 134 (setq prev-attribute attribute
130 prev-value (concat prev-value value)) 135 prev-value (concat prev-value value)
136 prev-encoded encoded)
131 (push (cons attribute 137 (push (cons attribute
132 (if encoded 138 (if encoded
133 (rfc2231-decode-encoded-string value) 139 (rfc2231-decode-encoded-string value)
@@ -137,7 +143,7 @@ The list will be on the form
137 ;; Take care of any final continuations. 143 ;; Take care of any final continuations.
138 (when prev-attribute 144 (when prev-attribute
139 (push (cons prev-attribute 145 (push (cons prev-attribute
140 (if encoded 146 (if prev-encoded
141 (rfc2231-decode-encoded-string prev-value) 147 (rfc2231-decode-encoded-string prev-value)
142 prev-value)) 148 prev-value))
143 parameters)) 149 parameters))
diff --git a/lisp/image-file.el b/lisp/image-file.el
index be95470184c..6b88b84e19f 100644
--- a/lisp/image-file.el
+++ b/lisp/image-file.el
@@ -118,7 +118,8 @@ the command `insert-file-contents'."
118 (create-image data nil t)) 118 (create-image data nil t))
119 (props 119 (props
120 `(display ,image 120 `(display ,image
121 yank-handler (image-file-yank-handler) 121 yank-handler
122 (image-file-yank-handler nil t)
122 intangible ,image 123 intangible ,image
123 rear-nonsticky (display intangible) 124 rear-nonsticky (display intangible)
124 ;; This a cheap attempt to make the whole buffer 125 ;; This a cheap attempt to make the whole buffer
@@ -141,12 +142,18 @@ the command `insert-file-contents'."
141;; recognized as two different images. 142;; recognized as two different images.
142(defun image-file-yank-handler (string) 143(defun image-file-yank-handler (string)
143 "Yank handler for inserting an image into a buffer." 144 "Yank handler for inserting an image into a buffer."
144 (let ((image (get-text-property 0 'display string))) 145 (let ((len (length string))
146 (image (get-text-property 0 'display string)))
147 (remove-text-properties 0 len yank-excluded-properties string)
145 (if (consp image) 148 (if (consp image)
146 (put-text-property 0 (length string) 149 (add-text-properties 0
147 'display 150 (or (next-single-property-change 0 'image-counter string)
148 (cons (car image) (cdr image)) 151 (length string))
149 string)) 152 `(display
153 ,(cons (car image) (cdr image))
154 yank-handler
155 ,(cons 'image-file-yank-handler '(nil t)))
156 string))
150 (insert string))) 157 (insert string)))
151 158
152(put 'image-file-handler 'safe-magic t) 159(put 'image-file-handler 'safe-magic t)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 90a12b7a7b9..e72b011fc40 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -122,8 +122,8 @@ a tab, a carriage return (control-M), a newline, and `]+'."
122 122
123(defcustom search-invisible 'open 123(defcustom search-invisible 'open
124 "If t incremental search can match hidden text. 124 "If t incremental search can match hidden text.
125nil means don't match invisible text. 125A nil value means don't match invisible text.
126If the value is `open', if the text matched is made invisible by 126When the value is `open', if the text matched is made invisible by
127an overlay having an `invisible' property and that overlay has a property 127an overlay having an `invisible' property and that overlay has a property
128`isearch-open-invisible', then incremental search will show the contents. 128`isearch-open-invisible', then incremental search will show the contents.
129\(This applies when using `outline.el' and `hideshow.el'.) 129\(This applies when using `outline.el' and `hideshow.el'.)
@@ -188,10 +188,10 @@ to the search status stack.")
188 188
189(defvar search-ring-yank-pointer nil 189(defvar search-ring-yank-pointer nil
190 "Index in `search-ring' of last string reused. 190 "Index in `search-ring' of last string reused.
191nil if none yet.") 191It is nil if none yet.")
192(defvar regexp-search-ring-yank-pointer nil 192(defvar regexp-search-ring-yank-pointer nil
193 "Index in `regexp-search-ring' of last string reused. 193 "Index in `regexp-search-ring' of last string reused.
194nil if none yet.") 194It is nil if none yet.")
195 195
196(defcustom search-ring-update nil 196(defcustom search-ring-update nil
197 "*Non-nil if advancing or retreating in the search ring should cause search. 197 "*Non-nil if advancing or retreating in the search ring should cause search.
@@ -246,22 +246,25 @@ If this is nil, extra highlighting can be \"manually\" removed with
246\\[lazy-highlight-cleanup]." 246\\[lazy-highlight-cleanup]."
247 :type 'boolean 247 :type 'boolean
248 :group 'lazy-highlight) 248 :group 'lazy-highlight)
249(defvaralias 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup) 249(define-obsolete-variable-alias 'isearch-lazy-highlight-cleanup
250(make-obsolete-variable 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup "22.1") 250 'lazy-highlight-cleanup
251 "22.1")
251 252
252(defcustom lazy-highlight-initial-delay 0.25 253(defcustom lazy-highlight-initial-delay 0.25
253 "*Seconds to wait before beginning to lazily highlight all matches." 254 "*Seconds to wait before beginning to lazily highlight all matches."
254 :type 'number 255 :type 'number
255 :group 'lazy-highlight) 256 :group 'lazy-highlight)
256(defvaralias 'isearch-lazy-highlight-initial-delay 'lazy-highlight-initial-delay) 257(define-obsolete-variable-alias 'isearch-lazy-highlight-initial-delay
257(make-obsolete-variable 'isearch-lazy-highlight-initial-delay 'lazy-highlight-initial-delay "22.1") 258 'lazy-highlight-initial-delay
259 "22.1")
258 260
259(defcustom lazy-highlight-interval 0 ; 0.0625 261(defcustom lazy-highlight-interval 0 ; 0.0625
260 "*Seconds between lazily highlighting successive matches." 262 "*Seconds between lazily highlighting successive matches."
261 :type 'number 263 :type 'number
262 :group 'lazy-highlight) 264 :group 'lazy-highlight)
263(defvaralias 'isearch-lazy-highlight-interval 'lazy-highlight-interval) 265(define-obsolete-variable-alias 'isearch-lazy-highlight-interval
264(make-obsolete-variable 'isearch-lazy-highlight-interval 'lazy-highlight-interval "22.1") 266 'lazy-highlight-interval
267 "22.1")
265 268
266(defcustom lazy-highlight-max-at-a-time 20 269(defcustom lazy-highlight-max-at-a-time 20
267 "*Maximum matches to highlight at a time (for `lazy-highlight'). 270 "*Maximum matches to highlight at a time (for `lazy-highlight').
@@ -271,8 +274,9 @@ A value of nil means highlight all matches."
271 :type '(choice (const :tag "All" nil) 274 :type '(choice (const :tag "All" nil)
272 (integer :tag "Some")) 275 (integer :tag "Some"))
273 :group 'lazy-highlight) 276 :group 'lazy-highlight)
274(defvaralias 'isearch-lazy-highlight-max-at-a-time 'lazy-highlight-max-at-a-time) 277(define-obsolete-variable-alias 'isearch-lazy-highlight-max-at-a-time
275(make-obsolete-variable 'isearch-lazy-highlight-max-at-a-time 'lazy-highlight-max-at-a-time "22.1") 278 'lazy-highlight-max-at-a-time
279 "22.1")
276 280
277(defface lazy-highlight 281(defface lazy-highlight
278 '((((class color) (min-colors 88) (background light)) 282 '((((class color) (min-colors 88) (background light))
@@ -288,8 +292,9 @@ A value of nil means highlight all matches."
288 :group 'lazy-highlight) 292 :group 'lazy-highlight)
289(put 'isearch-lazy-highlight-face 'face-alias 'lazy-highlight) 293(put 'isearch-lazy-highlight-face 'face-alias 'lazy-highlight)
290(defvar lazy-highlight-face 'lazy-highlight) 294(defvar lazy-highlight-face 'lazy-highlight)
291(defvaralias 'isearch-lazy-highlight-face 'lazy-highlight-face) 295(define-obsolete-variable-alias 'isearch-lazy-highlight-face
292(make-obsolete-variable 'isearch-lazy-highlight-face 'lazy-highlight-face "22.1") 296 'lazy-highlight-face
297 "22.1")
293 298
294;; Define isearch-mode keymap. 299;; Define isearch-mode keymap.
295 300
@@ -308,12 +313,12 @@ A value of nil means highlight all matches."
308 ;; We need these explicit definitions because, in a dense keymap, 313 ;; We need these explicit definitions because, in a dense keymap,
309 ;; the binding for t does not affect characters. 314 ;; the binding for t does not affect characters.
310 ;; We use a dense keymap to save space. 315 ;; We use a dense keymap to save space.
311 (while (< i ?\ ) 316 (while (< i ?\s)
312 (define-key map (make-string 1 i) 'isearch-other-control-char) 317 (define-key map (make-string 1 i) 'isearch-other-control-char)
313 (setq i (1+ i))) 318 (setq i (1+ i)))
314 319
315 ;; Single-byte printing chars extend the search string by default. 320 ;; Single-byte printing chars extend the search string by default.
316 (setq i ?\ ) 321 (setq i ?\s)
317 (while (< i 256) 322 (while (< i 256)
318 (define-key map (vector i) 'isearch-printing-char) 323 (define-key map (vector i) 'isearch-printing-char)
319 (setq i (1+ i))) 324 (setq i (1+ i)))
@@ -527,7 +532,7 @@ Type \\[isearch-quote-char] to quote control character to search for it.
527Type \\[isearch-query-replace] to start `query-replace' with string to\ 532Type \\[isearch-query-replace] to start `query-replace' with string to\
528 replace from last search string. 533 replace from last search string.
529Type \\[isearch-query-replace-regexp] to start `query-replace-regexp'\ 534Type \\[isearch-query-replace-regexp] to start `query-replace-regexp'\
530 with string to replace from last search string.. 535 with string to replace from last search string.
531 536
532Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. 537Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity.
533Type \\[isearch-toggle-regexp] to toggle regular-expression mode. 538Type \\[isearch-toggle-regexp] to toggle regular-expression mode.
@@ -1653,7 +1658,7 @@ Isearch mode."
1653 ;; directly to avoid the input method and keyboard 1658 ;; directly to avoid the input method and keyboard
1654 ;; coding system translating it. 1659 ;; coding system translating it.
1655 (if (and (integerp key) 1660 (if (and (integerp key)
1656 (>= key ?\ ) (/= key 127) (< key 256)) 1661 (>= key ?\s) (/= key 127) (< key 256))
1657 (progn 1662 (progn
1658 (isearch-process-search-char key) 1663 (isearch-process-search-char key)
1659 (setq keylist (cdr keylist))) 1664 (setq keylist (cdr keylist)))
@@ -1745,7 +1750,7 @@ Isearch mode."
1745 ;; Assume character codes 0200 - 0377 stand for characters in some 1750 ;; Assume character codes 0200 - 0377 stand for characters in some
1746 ;; single-byte character set, and convert them to Emacs 1751 ;; single-byte character set, and convert them to Emacs
1747 ;; characters. 1752 ;; characters.
1748 (if (and isearch-regexp (= char ?\ )) 1753 (if (and isearch-regexp (= char ?\s))
1749 (if (subregexp-context-p isearch-string (length isearch-string)) 1754 (if (subregexp-context-p isearch-string (length isearch-string))
1750 (isearch-process-search-string "[ ]" " ") 1755 (isearch-process-search-string "[ ]" " ")
1751 (isearch-process-search-char char)) 1756 (isearch-process-search-char char))
@@ -1766,7 +1771,7 @@ Isearch mode."
1766 (interactive) 1771 (interactive)
1767 (let ((char last-command-char)) 1772 (let ((char last-command-char))
1768 (if (= char ?\S-\ ) 1773 (if (= char ?\S-\ )
1769 (setq char ?\ )) 1774 (setq char ?\s))
1770 (if (and enable-multibyte-characters 1775 (if (and enable-multibyte-characters
1771 (>= char ?\200) 1776 (>= char ?\200)
1772 (<= char ?\377)) 1777 (<= char ?\377))
@@ -2196,7 +2201,7 @@ since they have special meaning in a regexp."
2196 2201
2197(defun isearch-text-char-description (c) 2202(defun isearch-text-char-description (c)
2198 (cond 2203 (cond
2199 ((< c ?\ ) (format "^%c" (+ c 64))) 2204 ((< c ?\s) (format "^%c" (+ c 64)))
2200 ((= c ?\^?) "^?") 2205 ((= c ?\^?) "^?")
2201 (t (char-to-string c)))) 2206 (t (char-to-string c))))
2202 2207
@@ -2283,8 +2288,9 @@ is nil. This function is called when exiting an incremental search if
2283 (cancel-timer isearch-lazy-highlight-timer) 2288 (cancel-timer isearch-lazy-highlight-timer)
2284 (setq isearch-lazy-highlight-timer nil))) 2289 (setq isearch-lazy-highlight-timer nil)))
2285 2290
2286(defalias 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup) 2291(define-obsolete-function-alias 'isearch-lazy-highlight-cleanup
2287(make-obsolete 'isearch-lazy-highlight-cleanup 'lazy-highlight-cleanup "22.1") 2292 'lazy-highlight-cleanup
2293 "22.1")
2288 2294
2289(defun isearch-lazy-highlight-new-loop (&optional beg end) 2295(defun isearch-lazy-highlight-new-loop (&optional beg end)
2290 "Cleanup any previous `lazy-highlight' loop and begin a new one. 2296 "Cleanup any previous `lazy-highlight' loop and begin a new one.
diff --git a/lisp/man.el b/lisp/man.el
index cb62aa65e94..ed6112e1978 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -352,6 +352,7 @@ Otherwise, the value is whatever the function
352(make-variable-buffer-local 'Man-page-mode-string) 352(make-variable-buffer-local 'Man-page-mode-string)
353(make-variable-buffer-local 'Man-original-frame) 353(make-variable-buffer-local 'Man-original-frame)
354(make-variable-buffer-local 'Man-arguments) 354(make-variable-buffer-local 'Man-arguments)
355(put 'Man-arguments 'permanent-local t)
355 356
356(setq-default Man-sections-alist nil) 357(setq-default Man-sections-alist nil)
357(setq-default Man-refpages-alist nil) 358(setq-default Man-refpages-alist nil)
@@ -1005,8 +1006,15 @@ manpage command."
1005 (if Man-fontify-manpage-flag 1006 (if Man-fontify-manpage-flag
1006 (Man-fontify-manpage) 1007 (Man-fontify-manpage)
1007 (Man-cleanup-manpage)) 1008 (Man-cleanup-manpage))
1009
1008 (run-hooks 'Man-cooked-hook) 1010 (run-hooks 'Man-cooked-hook)
1009 (Man-mode) 1011 (Man-mode)
1012
1013 (if (not Man-page-list)
1014 (let ((args Man-arguments))
1015 (kill-buffer (current-buffer))
1016 (error "Can't find the %s manpage" args)))
1017
1010 (set-buffer-modified-p nil) 1018 (set-buffer-modified-p nil)
1011 )) 1019 ))
1012 ;; Restore case-fold-search before calling 1020 ;; Restore case-fold-search before calling
@@ -1082,7 +1090,7 @@ The following key bindings are currently in effect in the buffer:
1082 (Man-build-page-list) 1090 (Man-build-page-list)
1083 (Man-strip-page-headers) 1091 (Man-strip-page-headers)
1084 (Man-unindent) 1092 (Man-unindent)
1085 (Man-goto-page 1) 1093 (Man-goto-page 1 t)
1086 (run-mode-hooks 'Man-mode-hook)) 1094 (run-mode-hooks 'Man-mode-hook))
1087 1095
1088(defsubst Man-build-section-alist () 1096(defsubst Man-build-section-alist ()
@@ -1342,35 +1350,32 @@ Specify which REFERENCE to use; default is based on word at point."
1342 (interactive) 1350 (interactive)
1343 (quit-window)) 1351 (quit-window))
1344 1352
1345(defun Man-goto-page (page) 1353(defun Man-goto-page (page &optional noerror)
1346 "Go to the manual page on page PAGE." 1354 "Go to the manual page on page PAGE."
1347 (interactive 1355 (interactive
1348 (if (not Man-page-list) 1356 (if (not Man-page-list)
1349 (let ((args Man-arguments)) 1357 (error "Not a man page buffer")
1350 (kill-buffer (current-buffer))
1351 (error "Can't find the %s manpage" args))
1352 (if (= (length Man-page-list) 1) 1358 (if (= (length Man-page-list) 1)
1353 (error "You're looking at the only manpage in the buffer") 1359 (error "You're looking at the only manpage in the buffer")
1354 (list (read-minibuffer (format "Go to manpage [1-%d]: " 1360 (list (read-minibuffer (format "Go to manpage [1-%d]: "
1355 (length Man-page-list))))))) 1361 (length Man-page-list)))))))
1356 (if (not Man-page-list) 1362 (if (and (not Man-page-list) (not noerror))
1357 (let ((args Man-arguments)) 1363 (error "Not a man page buffer"))
1358 (kill-buffer (current-buffer)) 1364 (when Man-page-list
1359 (error "Can't find the %s manpage" args))) 1365 (if (or (< page 1)
1360 (if (or (< page 1) 1366 (> page (length Man-page-list)))
1361 (> page (length Man-page-list))) 1367 (error "No manpage %d found" page))
1362 (error "No manpage %d found" page)) 1368 (let* ((page-range (nth (1- page) Man-page-list))
1363 (let* ((page-range (nth (1- page) Man-page-list)) 1369 (page-start (car page-range))
1364 (page-start (car page-range)) 1370 (page-end (car (cdr page-range))))
1365 (page-end (car (cdr page-range)))) 1371 (setq Man-current-page page
1366 (setq Man-current-page page 1372 Man-page-mode-string (Man-make-page-mode-string))
1367 Man-page-mode-string (Man-make-page-mode-string)) 1373 (widen)
1368 (widen) 1374 (goto-char page-start)
1369 (goto-char page-start) 1375 (narrow-to-region page-start page-end)
1370 (narrow-to-region page-start page-end) 1376 (Man-build-section-alist)
1371 (Man-build-section-alist) 1377 (Man-build-references-alist)
1372 (Man-build-references-alist) 1378 (goto-char (point-min)))))
1373 (goto-char (point-min))))
1374 1379
1375 1380
1376(defun Man-next-manpage () 1381(defun Man-next-manpage ()
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index e8647dfc221..330fead2393 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -743,6 +743,21 @@ These mean that the FTP process should (or already has) been killed."
743 :group 'ange-ftp 743 :group 'ange-ftp
744 :type 'regexp) 744 :type 'regexp)
745 745
746(defcustom ange-ftp-potential-error-msgs
747 ;; On Mac OS X we sometimes get things like:
748 ;;
749 ;; ftp> open ftp.nluug.nl
750 ;; Trying 2001:610:1:80aa:192:87:102:36...
751 ;; ftp: connect to address 2001:610:1:80aa:192:87:102:36: No route to host
752 ;; Trying 192.87.102.36...
753 ;; Connected to ftp.nluug.nl.
754 "^ftp: connect to address .*: No route to host"
755 "*Regular expression matching ftp messages that can indicate serious errors.
756These mean that something went wrong, but they may be followed by more
757messages indicating that the error was somehow corrected."
758 :group 'ange-ftp
759 :type 'regexp)
760
746(defcustom ange-ftp-gateway-fatal-msgs 761(defcustom ange-ftp-gateway-fatal-msgs
747 "No route to host\\|Connection closed\\|No such host\\|Login incorrect" 762 "No route to host\\|Connection closed\\|No such host\\|Login incorrect"
748 "*Regular expression matching login failure messages from rlogin/telnet." 763 "*Regular expression matching login failure messages from rlogin/telnet."
@@ -1071,6 +1086,7 @@ All HOST values should be in lower case.")
1071(defvar ange-ftp-xfer-size nil) 1086(defvar ange-ftp-xfer-size nil)
1072(defvar ange-ftp-process-string nil) 1087(defvar ange-ftp-process-string nil)
1073(defvar ange-ftp-process-result-line nil) 1088(defvar ange-ftp-process-result-line nil)
1089(defvar ange-ftp-pending-error-line nil)
1074(defvar ange-ftp-process-busy nil) 1090(defvar ange-ftp-process-busy nil)
1075(defvar ange-ftp-process-result nil) 1091(defvar ange-ftp-process-result nil)
1076(defvar ange-ftp-process-multi-skip nil) 1092(defvar ange-ftp-process-multi-skip nil)
@@ -1544,6 +1560,7 @@ good, skip, fatal, or unknown."
1544 ((string-match ange-ftp-good-msgs line) 1560 ((string-match ange-ftp-good-msgs line)
1545 (setq ange-ftp-process-busy nil 1561 (setq ange-ftp-process-busy nil
1546 ange-ftp-process-result t 1562 ange-ftp-process-result t
1563 ange-ftp-pending-error-line nil
1547 ange-ftp-process-result-line line)) 1564 ange-ftp-process-result-line line))
1548 ;; Check this before checking for errors. 1565 ;; Check this before checking for errors.
1549 ;; Otherwise the last line of these three seems to be an error: 1566 ;; Otherwise the last line of these three seems to be an error:
@@ -1552,11 +1569,17 @@ good, skip, fatal, or unknown."
1552 ;; 230-"ftp.stsci.edu: unknown host", the new IP address will be... 1569 ;; 230-"ftp.stsci.edu: unknown host", the new IP address will be...
1553 ((string-match ange-ftp-multi-msgs line) 1570 ((string-match ange-ftp-multi-msgs line)
1554 (setq ange-ftp-process-multi-skip t)) 1571 (setq ange-ftp-process-multi-skip t))
1572 ((string-match ange-ftp-potential-error-msgs line)
1573 ;; This looks like an error, but we have to keep reading the output
1574 ;; to see if it was fixed or not. E.g. it may indicate that IPv6
1575 ;; failed, but maybe a subsequent IPv4 fallback succeeded.
1576 (set (make-local-variable 'ange-ftp-pending-error-line) line)
1577 t)
1555 ((string-match ange-ftp-fatal-msgs line) 1578 ((string-match ange-ftp-fatal-msgs line)
1556 (delete-process proc) 1579 (delete-process proc)
1557 (setq ange-ftp-process-busy nil 1580 (setq ange-ftp-process-busy nil
1558 ange-ftp-process-result-line line)) 1581 ange-ftp-process-result-line line))
1559 (ange-ftp-process-multi-skip 1582 (ange-ftp-process-multi-skip
1560 t) 1583 t)
1561 (t 1584 (t
1562 (setq ange-ftp-process-busy nil 1585 (setq ange-ftp-process-busy nil
@@ -1651,12 +1674,21 @@ good, skip, fatal, or unknown."
1651 (string-match "\n" ange-ftp-process-string)) 1674 (string-match "\n" ange-ftp-process-string))
1652 (let ((line (substring ange-ftp-process-string 1675 (let ((line (substring ange-ftp-process-string
1653 0 1676 0
1654 (match-beginning 0)))) 1677 (match-beginning 0)))
1678 (seen-prompt nil))
1655 (setq ange-ftp-process-string (substring ange-ftp-process-string 1679 (setq ange-ftp-process-string (substring ange-ftp-process-string
1656 (match-end 0))) 1680 (match-end 0)))
1657 (while (string-match "^ftp> *" line) 1681 (while (string-match "^ftp> *" line)
1682 (setq seen-prompt t)
1658 (setq line (substring line (match-end 0)))) 1683 (setq line (substring line (match-end 0))))
1659 (ange-ftp-process-handle-line line proc))) 1684 (if (not (and seen-prompt ange-ftp-pending-error-line))
1685 (ange-ftp-process-handle-line line proc)
1686 ;; If we've seen a potential error message and it
1687 ;; hasn't been cancelled by a good message before
1688 ;; seeing a propt, then the error was real.
1689 (delete-process proc)
1690 (setq ange-ftp-process-busy nil
1691 ange-ftp-process-result-line ange-ftp-pending-error-line))))
1660 1692
1661 ;; has the ftp client finished? if so then do some clean-up 1693 ;; has the ftp client finished? if so then do some clean-up
1662 ;; actions. 1694 ;; actions.
@@ -1988,7 +2020,7 @@ on the gateway machine to do the ftp instead."
1988 (make-local-variable 'comint-password-prompt-regexp) 2020 (make-local-variable 'comint-password-prompt-regexp)
1989 ;; This is a regexp that can't match anything. 2021 ;; This is a regexp that can't match anything.
1990 ;; ange-ftp has its own ways of handling passwords. 2022 ;; ange-ftp has its own ways of handling passwords.
1991 (setq comint-password-prompt-regexp "^a\\'z") 2023 (setq comint-password-prompt-regexp "\\`a\\`")
1992 (make-local-variable 'paragraph-start) 2024 (make-local-variable 'paragraph-start)
1993 (setq paragraph-start comint-prompt-regexp) 2025 (setq paragraph-start comint-prompt-regexp)
1994 (run-mode-hooks 'internal-ange-ftp-mode-hook)) 2026 (run-mode-hooks 'internal-ange-ftp-mode-hook))
@@ -4543,9 +4575,9 @@ NEWNAME should be the name to give the new compressed or uncompressed file.")
4543 (setq ange-ftp-ls-cache-file nil) ;Stop confusing Dired. 4575 (setq ange-ftp-ls-cache-file nil) ;Stop confusing Dired.
4544 0) 4576 0)
4545 4577
4546;;; This is turned off because it has nothing properly to do 4578;; This is turned off because it has nothing properly to do
4547;;; with dired. It could be reasonable to adapt this to 4579;; with dired. It could be reasonable to adapt this to
4548;;; replace ange-ftp-copy-file. 4580;; replace ange-ftp-copy-file.
4549 4581
4550;;;;; ------------------------------------------------------------ 4582;;;;; ------------------------------------------------------------
4551;;;;; Noddy support for async copy-file within dired. 4583;;;;; Noddy support for async copy-file within dired.
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index d3cbf142222..ff41a964ecc 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -377,13 +377,13 @@ you may also want to change `compilation-page-delimiter'.")
377 '(;; configure output lines. 377 '(;; configure output lines.
378 ("^[Cc]hecking \\(?:[Ff]or \\|[Ii]f \\|[Ww]hether \\(?:to \\)?\\)?\\(.+\\)\\.\\.\\. *\\(?:(cached) *\\)?\\(\\(yes\\(?: .+\\)?\\)\\|no\\|\\(.*\\)\\)$" 378 ("^[Cc]hecking \\(?:[Ff]or \\|[Ii]f \\|[Ww]hether \\(?:to \\)?\\)?\\(.+\\)\\.\\.\\. *\\(?:(cached) *\\)?\\(\\(yes\\(?: .+\\)?\\)\\|no\\|\\(.*\\)\\)$"
379 (1 font-lock-variable-name-face) 379 (1 font-lock-variable-name-face)
380 (2 (compilation-face '(4 . 3)))) 380 (2 font-lock-keyword-face))
381 ;; Command output lines. Recognize `make[n]:' lines too. 381 ;; Command output lines. Recognize `make[n]:' lines too.
382 ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:" 382 ("^\\([[:alnum:]_/.+-]+\\)\\(\\[\\([0-9]+\\)\\]\\)?[ \t]*:"
383 (1 font-lock-function-name-face) (3 compilation-line-face nil t)) 383 (1 font-lock-function-name-face) (3 compilation-line-face nil t))
384 (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1) 384 (" --?o\\(?:utfile\\|utput\\)?[= ]?\\(\\S +\\)" . 1)
385 ("^Compilation finished" . compilation-info-face) 385 ("^Compilation finished" . font-lock-keyword-face)
386 ("^Compilation exited abnormally" . compilation-error-face)) 386 ("^Compilation exited abnormally" . font-lock-keyword-face))
387 "Additional things to highlight in Compilation mode. 387 "Additional things to highlight in Compilation mode.
388This gets tacked on the end of the generated expressions.") 388This gets tacked on the end of the generated expressions.")
389 389
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 8a426a37365..8e574e912c6 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -524,9 +524,9 @@ Also display the main routine in the disassembly buffer if present."
524 (setq gdb-pending-triggers 524 (setq gdb-pending-triggers
525 (delq 'gdb-var-update gdb-pending-triggers)) 525 (delq 'gdb-var-update gdb-pending-triggers))
526 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) 526 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
527 ;; dummy command to update speedbar at right time 527 ;; Dummy command to update speedbar at right time.
528 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn)) 528 (gdb-enqueue-input (list "server pwd\n" 'gdb-speedbar-timer-fn))
529 ;; keep gdb-pending-triggers non-nil till end 529 ;; Keep gdb-pending-triggers non-nil till end.
530 (push 'gdb-speedbar-timer gdb-pending-triggers))) 530 (push 'gdb-speedbar-timer gdb-pending-triggers)))
531 531
532(defun gdb-speedbar-timer-fn () 532(defun gdb-speedbar-timer-fn ()
@@ -1023,7 +1023,7 @@ happens to be appropriate."
1023 (gdb-invalidate-threads) 1023 (gdb-invalidate-threads)
1024 (unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3. 1024 (unless (eq system-type 'darwin) ;Breaks on Darwin's GDB-5.3.
1025 ;; FIXME: with GDB-6 on Darwin, this might very well work. 1025 ;; FIXME: with GDB-6 on Darwin, this might very well work.
1026 ;; only needed/used with speedbar/watch expressions 1026 ;; Only needed/used with speedbar/watch expressions.
1027 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame)) 1027 (when (and (boundp 'speedbar-frame) (frame-live-p speedbar-frame))
1028 (setq gdb-var-changed t) ; force update 1028 (setq gdb-var-changed t) ; force update
1029 (dolist (var gdb-var-list) 1029 (dolist (var gdb-var-list)
@@ -1043,9 +1043,9 @@ happens to be appropriate."
1043 (if gdb-flush-pending-output 1043 (if gdb-flush-pending-output
1044 nil 1044 nil
1045 (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log)) 1045 (if gdb-enable-debug-log (push (cons 'recv string) gdb-debug-log))
1046 ;; Recall the left over gud-marker-acc from last time 1046 ;; Recall the left over gud-marker-acc from last time.
1047 (setq gud-marker-acc (concat gud-marker-acc string)) 1047 (setq gud-marker-acc (concat gud-marker-acc string))
1048 ;; Start accumulating output for the GUD buffer 1048 ;; Start accumulating output for the GUD buffer.
1049 (let ((output "")) 1049 (let ((output ""))
1050 ;; 1050 ;;
1051 ;; Process all the complete markers in this chunk. 1051 ;; Process all the complete markers in this chunk.
@@ -1295,7 +1295,7 @@ static char *magick[] = {
1295 :weight bold)) 1295 :weight bold))
1296 "Face for enabled breakpoint icon in fringe." 1296 "Face for enabled breakpoint icon in fringe."
1297 :group 'gud) 1297 :group 'gud)
1298;; compatibility alias for old name 1298;; Compatibility alias for old name.
1299(put 'breakpoint-enabled-bitmap-face 'face-alias 'breakpoint-enabled) 1299(put 'breakpoint-enabled-bitmap-face 'face-alias 'breakpoint-enabled)
1300 1300
1301(defface breakpoint-disabled 1301(defface breakpoint-disabled
@@ -1306,13 +1306,13 @@ static char *magick[] = {
1306 (((background light)) :foreground "grey40")) 1306 (((background light)) :foreground "grey40"))
1307 "Face for disabled breakpoint icon in fringe." 1307 "Face for disabled breakpoint icon in fringe."
1308 :group 'gud) 1308 :group 'gud)
1309;; compatibility alias for old name 1309;; Compatibility alias for old name.
1310(put 'breakpoint-disabled-bitmap-face 'face-alias 'breakpoint-disabled) 1310(put 'breakpoint-disabled-bitmap-face 'face-alias 'breakpoint-disabled)
1311 1311
1312;;-put breakpoint icons in relevant margins (even those set in the GUD buffer) 1312;; Put breakpoint icons in relevant margins (even those set in the GUD buffer).
1313(defun gdb-info-breakpoints-custom () 1313(defun gdb-info-breakpoints-custom ()
1314 (let ((flag) (bptno)) 1314 (let ((flag) (bptno))
1315 ;; remove all breakpoint-icons in source buffers but not assembler buffer 1315 ;; Remove all breakpoint-icons in source buffers but not assembler buffer.
1316 (dolist (buffer (buffer-list)) 1316 (dolist (buffer (buffer-list))
1317 (with-current-buffer buffer 1317 (with-current-buffer buffer
1318 (if (and (eq gud-minor-mode 'gdba) 1318 (if (and (eq gud-minor-mode 'gdba)
@@ -1342,13 +1342,14 @@ static char *magick[] = {
1342 (setq file (cdr (assoc bptno gdb-location-alist)))) 1342 (setq file (cdr (assoc bptno gdb-location-alist))))
1343 (if (and file 1343 (if (and file
1344 (not (string-equal file "File not found"))) 1344 (not (string-equal file "File not found")))
1345 (with-current-buffer (find-file-noselect file) 1345 (with-current-buffer
1346 (find-file-noselect file 'nowarn)
1346 (set (make-local-variable 'gud-minor-mode) 1347 (set (make-local-variable 'gud-minor-mode)
1347 'gdba) 1348 'gdba)
1348 (set (make-local-variable 'tool-bar-map) 1349 (set (make-local-variable 'tool-bar-map)
1349 gud-tool-bar-map) 1350 gud-tool-bar-map)
1350 ;; only want one breakpoint icon at each 1351 ;; Only want one breakpoint icon at each
1351 ;; location 1352 ;; location.
1352 (save-excursion 1353 (save-excursion
1353 (goto-line (string-to-number line)) 1354 (goto-line (string-to-number line))
1354 (gdb-put-breakpoint-icon (eq flag ?y) bptno))) 1355 (gdb-put-breakpoint-icon (eq flag ?y) bptno)))
@@ -1388,11 +1389,7 @@ static char *magick[] = {
1388 (with-selected-window (posn-window posn) 1389 (with-selected-window (posn-window posn)
1389 (save-excursion 1390 (save-excursion
1390 (goto-char (posn-point posn)) 1391 (goto-char (posn-point posn))
1391 (if 1392 (if (posn-object posn)
1392; (or
1393 (posn-object posn)
1394; (eq (car (fringe-bitmaps-at-pos (posn-point posn)))
1395; 'breakpoint))
1396 (gdb-enqueue-input 1393 (gdb-enqueue-input
1397 (list 1394 (list
1398 (let ((bptno (get-text-property 1395 (let ((bptno (get-text-property
@@ -1980,7 +1977,7 @@ corresponding to the mode line clicked."
1980 'mouse-1 1977 'mouse-1
1981 #'(lambda () (interactive) 1978 #'(lambda () (interactive)
1982 (let ((gdb-memory-address 1979 (let ((gdb-memory-address
1983 ;; let GDB do the arithmetic 1980 ;; Let GDB do the arithmetic.
1984 (concat 1981 (concat
1985 gdb-memory-address " - " 1982 gdb-memory-address " - "
1986 (number-to-string 1983 (number-to-string
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 8f6dd73cba1..dce17ed1306 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -277,7 +277,8 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
277(defvar grep-hit-face compilation-info-face 277(defvar grep-hit-face compilation-info-face
278 "Face name to use for grep hits.") 278 "Face name to use for grep hits.")
279 279
280(defvar grep-error-face compilation-error-face 280;; compilation-error-face is wrong for this; it's designed to look like a link.
281(defvar grep-error-face font-lock-keyword-face
281 "Face name to use for grep error messages.") 282 "Face name to use for grep error messages.")
282 283
283(defvar grep-match-face 'match 284(defvar grep-match-face 'match
@@ -291,12 +292,12 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
291 ;; remove match from grep-regexp-alist before fontifying 292 ;; remove match from grep-regexp-alist before fontifying
292 ("^Grep finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*" 293 ("^Grep finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*"
293 (0 '(face nil message nil help-echo nil mouse-face nil) t) 294 (0 '(face nil message nil help-echo nil mouse-face nil) t)
294 (1 grep-hit-face nil t) 295 (1 font-lock-keyword-face nil t)
295 (2 grep-error-face nil t)) 296 (2 font-lock-keyword-face nil t))
296 ("^Grep \\(exited abnormally\\) with code \\([0-9]+\\).*" 297 ("^Grep \\(exited abnormally\\) with code \\([0-9]+\\).*"
297 (0 '(face nil message nil help-echo nil mouse-face nil) t) 298 (0 '(face nil message nil help-echo nil mouse-face nil) t)
298 (1 compilation-warning-face) 299 (1 grep-error-face)
299 (2 compilation-line-face)) 300 (2 grep-error-face))
300 ;; Highlight grep matches and delete markers 301 ;; Highlight grep matches and delete markers
301 ("\\(\033\\[01;31m\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)" 302 ("\\(\033\\[01;31m\\)\\(.*?\\)\\(\033\\[[0-9]*m\\)"
302 ;; Refontification does not work after the markers have been 303 ;; Refontification does not work after the markers have been
diff --git a/lisp/ps-bdf.el b/lisp/ps-bdf.el
index 97356b01029..c4e8a444aff 100644
--- a/lisp/ps-bdf.el
+++ b/lisp/ps-bdf.el
@@ -272,18 +272,20 @@ CODE, where N and CODE are in the following relation:
272 (while (search-forward "\nSTARTCHAR" nil t) 272 (while (search-forward "\nSTARTCHAR" nil t)
273 (setq offset (line-beginning-position)) 273 (setq offset (line-beginning-position))
274 (search-forward "\nENCODING") 274 (search-forward "\nENCODING")
275 (setq code (read (current-buffer)) 275 (setq code (read (current-buffer)))
276 code0 (lsh code -8) 276 (if (< code 0)
277 code1 (logand code 255) 277 (search-forward "ENDCHAR")
278 min-code (min min-code code) 278 (setq code0 (lsh code -8)
279 max-code (max max-code code) 279 code1 (logand code 255)
280 min-code0 (min min-code0 code0) 280 min-code (min min-code code)
281 max-code0 (max max-code0 code0) 281 max-code (max max-code code)
282 min-code1 (min min-code1 code1) 282 min-code0 (min min-code0 code0)
283 max-code1 (max max-code1 code1)) 283 max-code0 (max max-code0 code0)
284 (search-forward "ENDCHAR") 284 min-code1 (min min-code1 code1)
285 (setq maxlen (max maxlen (- (point) offset)) 285 max-code1 (max max-code1 code1))
286 glyph-list (cons (cons code offset) glyph-list))) 286 (search-forward "ENDCHAR")
287 (setq maxlen (max maxlen (- (point) offset))
288 glyph-list (cons (cons code offset) glyph-list))))
287 289
288 (setq code-range 290 (setq code-range
289 (vector min-code0 max-code0 min-code1 max-code1 291 (vector min-code0 max-code0 min-code1 max-code1
diff --git a/lisp/recentf.el b/lisp/recentf.el
index 57280a7b4bc..dcb962c3f19 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -65,7 +65,7 @@ You should define the options of your own filters in this group."
65 65
66(defcustom recentf-max-saved-items 20 66(defcustom recentf-max-saved-items 20
67 "*Maximum number of items of the recent list that will be saved. 67 "*Maximum number of items of the recent list that will be saved.
68nil means to save the whole list. 68A nil value means to save the whole list.
69See the command `recentf-save-list'." 69See the command `recentf-save-list'."
70 :group 'recentf 70 :group 'recentf
71 :type 'integer) 71 :type 'integer)
@@ -145,7 +145,7 @@ The default is to call `find-file' to edit the selected file."
145 145
146(defcustom recentf-menu-filter nil 146(defcustom recentf-menu-filter nil
147 "*Function used to filter files displayed in the recentf menu. 147 "*Function used to filter files displayed in the recentf menu.
148nil means no filter. The following functions are predefined: 148A nil value means no filter. The following functions are predefined:
149 149
150- `recentf-sort-ascending' 150- `recentf-sort-ascending'
151 Sort menu items in ascending order. 151 Sort menu items in ascending order.
@@ -199,16 +199,14 @@ elements (see `recentf-make-menu-element' for menu element form)."
199 :set 'recentf-menu-customization-changed) 199 :set 'recentf-menu-customization-changed)
200 200
201(defcustom recentf-menu-append-commands-flag t 201(defcustom recentf-menu-append-commands-flag t
202 "*non-nil means to append command items to the menu." 202 "*Non-nil means to append command items to the menu."
203 :group 'recentf 203 :group 'recentf
204 :type 'boolean 204 :type 'boolean
205 :set 'recentf-menu-customization-changed) 205 :set 'recentf-menu-customization-changed)
206 206
207(defvaralias 'recentf-menu-append-commands-p 207(define-obsolete-variable-alias 'recentf-menu-append-commands-p
208 'recentf-menu-append-commands-flag) 208 'recentf-menu-append-commands-flag
209(make-obsolete-variable 'recentf-menu-append-commands-p 209 "22.1")
210 'recentf-menu-append-commands-flag
211 "22.1")
212 210
213(defcustom recentf-auto-cleanup 'mode 211(defcustom recentf-auto-cleanup 'mode
214 "*Define when to automatically cleanup the recent list. 212 "*Define when to automatically cleanup the recent list.
@@ -244,7 +242,7 @@ cleanup the list."
244 (recentf-auto-cleanup)))) 242 (recentf-auto-cleanup))))
245 243
246(defcustom recentf-initialize-file-name-history t 244(defcustom recentf-initialize-file-name-history t
247 "*non-nil means to initialize `file-name-history' with the recent list. 245 "*Non-nil means to initialize `file-name-history' with the recent list.
248If `file-name-history' is not empty, do nothing." 246If `file-name-history' is not empty, do nothing."
249 :group 'recentf 247 :group 'recentf
250 :type 'boolean) 248 :type 'boolean)
@@ -350,8 +348,8 @@ filenames."
350(defsubst recentf-expand-file-name (name) 348(defsubst recentf-expand-file-name (name)
351 "Convert filename NAME to absolute, and canonicalize it. 349 "Convert filename NAME to absolute, and canonicalize it.
352See also the function `expand-file-name'. 350See also the function `expand-file-name'.
353If defined, call the function `recentf-filename-handler' to post 351If defined, call the function `recentf-filename-handler'
354process the canonical name." 352to postprocess the canonical name."
355 (let* ((filename (expand-file-name name))) 353 (let* ((filename (expand-file-name name)))
356 (or (and recentf-filename-handler 354 (or (and recentf-filename-handler
357 (funcall recentf-filename-handler filename)) 355 (funcall recentf-filename-handler filename))
@@ -557,7 +555,7 @@ menu-elements (no sub-menu)."
557 555
558(defun recentf-clear-data () 556(defun recentf-clear-data ()
559 "Clear data used to build the recentf menu. 557 "Clear data used to build the recentf menu.
560This force a rebuild of the menu." 558This forces a rebuild of the menu."
561 (easy-menu-remove-item (recentf-menu-bar) 559 (easy-menu-remove-item (recentf-menu-bar)
562 recentf-menu-path recentf-menu-title) 560 recentf-menu-path recentf-menu-title)
563 (setq recentf-data-cache nil)) 561 (setq recentf-data-cache nil))
@@ -703,7 +701,7 @@ defined."
703 701
704(defcustom recentf-arrange-by-rule-subfilter nil 702(defcustom recentf-arrange-by-rule-subfilter nil
705 "*Function called by a rule based filter to filter sub-menu elements. 703 "*Function called by a rule based filter to filter sub-menu elements.
706nil means no filter. See also `recentf-menu-filter'. 704A nil value means no filter. See also `recentf-menu-filter'.
707You can't use another rule based filter here." 705You can't use another rule based filter here."
708 :group 'recentf-filters 706 :group 'recentf-filters
709 :type '(choice (const nil) function) 707 :type '(choice (const nil) function)
diff --git a/lisp/simple.el b/lisp/simple.el
index 32b83c465ae..7d6a9febb3b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3491,8 +3491,8 @@ Outline mode sets this."
3491 ;; at least go to end of line. 3491 ;; at least go to end of line.
3492 (end-of-line)) 3492 (end-of-line))
3493 ((< arg 0) 3493 ((< arg 0)
3494 ;; If we did not move down as far as desired, 3494 ;; If we did not move up as far as desired,
3495 ;; at least go to end of line. 3495 ;; at least go to beginning of line.
3496 (beginning-of-line)) 3496 (beginning-of-line))
3497 (t 3497 (t
3498 (line-move-finish (or goal-column temporary-goal-column) 3498 (line-move-finish (or goal-column temporary-goal-column)
diff --git a/lisp/smerge-mode.el b/lisp/smerge-mode.el
index 45e68750cb3..a40486ffd07 100644
--- a/lisp/smerge-mode.el
+++ b/lisp/smerge-mode.el
@@ -670,7 +670,7 @@ buffer names."
670 (ediff-cleanup-mess) 670 (ediff-cleanup-mess)
671 (with-current-buffer buf 671 (with-current-buffer buf
672 (erase-buffer) 672 (erase-buffer)
673 (insert-buffer buffer-C) 673 (insert-buffer-substring buffer-C)
674 (kill-buffer buffer-A) 674 (kill-buffer buffer-A)
675 (kill-buffer buffer-B) 675 (kill-buffer buffer-B)
676 (kill-buffer buffer-C) 676 (kill-buffer buffer-C)
diff --git a/lisp/startup.el b/lisp/startup.el
index 2f71a9ba352..59fdc75dd09 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -575,7 +575,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
575 575
576 ;; Choose a reasonable location for temporary files. 576 ;; Choose a reasonable location for temporary files.
577 (custom-reevaluate-setting 'temporary-file-directory) 577 (custom-reevaluate-setting 'temporary-file-directory)
578 (custom-reevaluate-setting 'small-emporary-file-directory) 578 (custom-reevaluate-setting 'small-temporary-file-directory)
579 (custom-reevaluate-setting 'auto-save-file-name-transforms) 579 (custom-reevaluate-setting 'auto-save-file-name-transforms)
580 580
581 ;; See if we should import version-control from the environment variable. 581 ;; See if we should import version-control from the environment variable.
@@ -984,7 +984,13 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
984 (setq term 984 (setq term
985 (if (setq hyphend (string-match "[-_][^-_]+$" term)) 985 (if (setq hyphend (string-match "[-_][^-_]+$" term))
986 (substring term 0 hyphend) 986 (substring term 0 hyphend)
987 nil))))) 987 nil)))
988 (when term
989 ;; The terminal file has been loaded, now call the terminal
990 ;; specific initialization function.
991 (let ((term-init-func (intern (concat "terminal-init-" term))))
992 (when (fboundp term-init-func)
993 (funcall term-init-func))))))
988 994
989 ;; Update the out-of-memory error message based on user's key bindings 995 ;; Update the out-of-memory error message based on user's key bindings
990 ;; for save-some-buffers. 996 ;; for save-some-buffers.
@@ -1346,7 +1352,7 @@ You can do basic editing with the menu bar and scroll bar using the mouse.
1346 1352
1347Useful File menu items: 1353Useful File menu items:
1348Exit Emacs (or type Control-x followed by Control-c) 1354Exit Emacs (or type Control-x followed by Control-c)
1349Recover Session Recover files you were editing before a crash 1355Recover Crashed Session Recover files you were editing before a crash
1350 1356
1351Important Help menu items: 1357Important Help menu items:
1352Emacs Tutorial Learn how to use Emacs efficiently 1358Emacs Tutorial Learn how to use Emacs efficiently
diff --git a/lisp/tempo.el b/lisp/tempo.el
index 915d3a430d8..282885e2d65 100644
--- a/lisp/tempo.el
+++ b/lisp/tempo.el
@@ -303,7 +303,7 @@ mode, ON-REGION is ignored and assumed true if the region is active."
303 transient-mark-mode 303 transient-mark-mode
304 mark-active) 304 mark-active)
305 (if (featurep 'xemacs) 305 (if (featurep 'xemacs)
306 zmacs-regions (mark))) 306 (and zmacs-regions (mark))))
307 (setq on-region t)) 307 (setq on-region t))
308 (and on-region 308 (and on-region
309 (set-marker tempo-region-start (min (mark) (point))) 309 (set-marker tempo-region-start (min (mark) (point)))
diff --git a/lisp/term/README b/lisp/term/README
index 76c64435af1..581f321d3ba 100644
--- a/lisp/term/README
+++ b/lisp/term/README
@@ -8,7 +8,12 @@ that exists, the last hyphen and what follows it is stripped. If that doesn't
8yield a file that exists, the previous hyphen is stripped, and so on until all 8yield a file that exists, the previous hyphen is stripped, and so on until all
9hyphens are gone. For example, if the terminal type is `aaa-48-foo', Emacs 9hyphens are gone. For example, if the terminal type is `aaa-48-foo', Emacs
10will try first `term/aaa-48-foo.el', then `term/aaa-48.el' and finally 10will try first `term/aaa-48-foo.el', then `term/aaa-48.el' and finally
11`term/aaa.el'. 11`term/aaa.el'. Each terminal specific file should contain a function
12named terminal-init-TERMINALNAME (eg terminal-init-aaa-48 for
13term/aaa-48.el) that Emacs will call in order to initialize the
14terminal. The terminal files should not contain any top level forms
15that are executed when the file is loaded, all the initialization
16actions are performed by the terminal-init-TERMINALNAME functions.
12 17
13 When writing terminal packages, there are some things it is good to keep in 18 When writing terminal packages, there are some things it is good to keep in
14mind. 19mind.
diff --git a/lisp/term/apollo.el b/lisp/term/apollo.el
index 1d04fd35245..749ff85a0a6 100644
--- a/lisp/term/apollo.el
+++ b/lisp/term/apollo.el
@@ -1,6 +1,7 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2 2(defun terminal-init-apollo ()
3(load "term/vt100" nil t) 3 "Terminal initialization function for apollo."
4 (load "term/vt100" nil t))
4 5
5;;; arch-tag: c72f446f-e6b7-4749-90a4-bd68632adacf 6;;; arch-tag: c72f446f-e6b7-4749-90a4-bd68632adacf
6;;; apollo.el ends here 7;;; apollo.el ends here
diff --git a/lisp/term/bobcat.el b/lisp/term/bobcat.el
index b11a4ff8309..82401f7bf71 100644
--- a/lisp/term/bobcat.el
+++ b/lisp/term/bobcat.el
@@ -1,7 +1,10 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2;;; HP terminals usually encourage using ^H as the rubout character 2
3(keyboard-translate ?\177 ?\^h) 3(defun terminal-init-bobcat ()
4(keyboard-translate ?\^h ?\177) 4 "Terminal initialization function for bobcat."
5 ;; HP terminals usually encourage using ^H as the rubout character
6 (keyboard-translate ?\177 ?\^h)
7 (keyboard-translate ?\^h ?\177))
5 8
6;;; arch-tag: 754e4520-0a3e-4e6e-8ca5-9481b1f85cf7 9;;; arch-tag: 754e4520-0a3e-4e6e-8ca5-9481b1f85cf7
7;;; bobcat.el ends here 10;;; bobcat.el ends here
diff --git a/lisp/term/cygwin.el b/lisp/term/cygwin.el
new file mode 100644
index 00000000000..3bdd5d3aa05
--- /dev/null
+++ b/lisp/term/cygwin.el
@@ -0,0 +1,10 @@
1;;; cygwin.el --- support for the Cygwin terminal -*- no-byte-compile: t -*-
2
3;;; The Cygwin terminal can't really display underlines.
4
5(defun terminal-init-cygwin ()
6 "Terminal initialization function for cygwin."
7 (tty-no-underline))
8
9;; arch-tag: ca81ce67-3c41-4883-a29b-4c3d64a21191
10;;; cygwin.el ends here
diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el
index eae2f419378..ef59860b606 100644
--- a/lisp/term/iris-ansi.el
+++ b/lisp/term/iris-ansi.el
@@ -1,6 +1,6 @@
1;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps -*- no-byte-compile: t -*- 1;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps -*- no-byte-compile: t -*-
2 2
3;; Copyright (C) 1997 Free Software Foundation, Inc. 3;; Copyright (C) 1997, 2005 Free Software Foundation, Inc.
4 4
5;; Author: Dan Nicolaescu <dann@ics.uci.edu> 5;; Author: Dan Nicolaescu <dann@ics.uci.edu>
6 6
@@ -25,302 +25,306 @@
25 25
26;;; Code: 26;;; Code:
27 27
28(define-key function-key-map "\e[120q" [S-escape]) 28(defun iris-ansi-initialize-terminal ()
29(define-key function-key-map "\e[121q" [C-escape]) 29 "Terminal initialization function for iris-ansi."
30 30 (define-key function-key-map "\e[120q" [S-escape])
31(define-key function-key-map "\e[001q" [f1]) 31 (define-key function-key-map "\e[121q" [C-escape])
32(define-key function-key-map "\e[013q" [S-f1]) 32
33(define-key function-key-map "\e[025q" [C-f1]) 33 (define-key function-key-map "\e[001q" [f1])
34 34 (define-key function-key-map "\e[013q" [S-f1])
35 35 (define-key function-key-map "\e[025q" [C-f1])
36(define-key function-key-map "\e[002q" [f2]) 36
37(define-key function-key-map "\e[014q" [S-f2]) 37
38(define-key function-key-map "\e[026q" [C-f2]) 38 (define-key function-key-map "\e[002q" [f2])
39(define-key function-key-map "\e[038q" [M-f2]) 39 (define-key function-key-map "\e[014q" [S-f2])
40 40 (define-key function-key-map "\e[026q" [C-f2])
41(define-key function-key-map "\e[003q" [f3]) 41 (define-key function-key-map "\e[038q" [M-f2])
42(define-key function-key-map "\e[015q" [S-f3]) 42
43(define-key function-key-map "\e[027q" [C-f3]) 43 (define-key function-key-map "\e[003q" [f3])
44 44 (define-key function-key-map "\e[015q" [S-f3])
45 45 (define-key function-key-map "\e[027q" [C-f3])
46(define-key function-key-map "\e[004q" [f4]) 46
47(define-key function-key-map "\e[016q" [S-f4]) 47
48(define-key function-key-map "\e[028q" [C-f4]) 48 (define-key function-key-map "\e[004q" [f4])
49 49 (define-key function-key-map "\e[016q" [S-f4])
50 50 (define-key function-key-map "\e[028q" [C-f4])
51(define-key function-key-map "\e[005q" [f5]) 51
52(define-key function-key-map "\e[017q" [S-f5]) 52
53(define-key function-key-map "\e[029q" [C-f5]) 53 (define-key function-key-map "\e[005q" [f5])
54 54 (define-key function-key-map "\e[017q" [S-f5])
55 55 (define-key function-key-map "\e[029q" [C-f5])
56(define-key function-key-map "\e[006q" [f6]) 56
57(define-key function-key-map "\e[018q" [S-f6]) 57
58(define-key function-key-map "\e[030q" [C-f6]) 58 (define-key function-key-map "\e[006q" [f6])
59 59 (define-key function-key-map "\e[018q" [S-f6])
60 60 (define-key function-key-map "\e[030q" [C-f6])
61(define-key function-key-map "\e[007q" [f7]) 61
62(define-key function-key-map "\e[019q" [S-f7]) 62
63(define-key function-key-map "\e[031q" [C-f7]) 63 (define-key function-key-map "\e[007q" [f7])
64 64 (define-key function-key-map "\e[019q" [S-f7])
65 65 (define-key function-key-map "\e[031q" [C-f7])
66(define-key function-key-map "\e[008q" [f8]) 66
67(define-key function-key-map "\e[020q" [S-f8]) 67
68(define-key function-key-map "\e[032q" [C-f8]) 68 (define-key function-key-map "\e[008q" [f8])
69 69 (define-key function-key-map "\e[020q" [S-f8])
70 70 (define-key function-key-map "\e[032q" [C-f8])
71(define-key function-key-map "\e[009q" [f9]) 71
72(define-key function-key-map "\e[021q" [S-f9]) 72
73(define-key function-key-map "\e[033q" [C-f9]) 73 (define-key function-key-map "\e[009q" [f9])
74 74 (define-key function-key-map "\e[021q" [S-f9])
75 75 (define-key function-key-map "\e[033q" [C-f9])
76(define-key function-key-map "\e[010q" [f10]) 76
77(define-key function-key-map "\e[022q" [S-f10]) 77
78(define-key function-key-map "\e[034q" [C-f10]) 78 (define-key function-key-map "\e[010q" [f10])
79 79 (define-key function-key-map "\e[022q" [S-f10])
80 80 (define-key function-key-map "\e[034q" [C-f10])
81(define-key function-key-map "\e[011q" [f11]) 81
82(define-key function-key-map "\e[023q" [S-f11]) 82
83(define-key function-key-map "\e[035q" [C-f11]) 83 (define-key function-key-map "\e[011q" [f11])
84(define-key function-key-map "\e[047q" [M-f11]) 84 (define-key function-key-map "\e[023q" [S-f11])
85 85 (define-key function-key-map "\e[035q" [C-f11])
86(define-key function-key-map "\e[012q" [f12]) 86 (define-key function-key-map "\e[047q" [M-f11])
87(define-key function-key-map "\e[024q" [S-f12]) 87
88(define-key function-key-map "\e[036q" [C-f12]) 88 (define-key function-key-map "\e[012q" [f12])
89(define-key function-key-map "\e[048q" [M-f12]) 89 (define-key function-key-map "\e[024q" [S-f12])
90 90 (define-key function-key-map "\e[036q" [C-f12])
91 91 (define-key function-key-map "\e[048q" [M-f12])
92(define-key function-key-map "\e[057q" [C-`]) 92
93(define-key function-key-map "\e[115q" [M-`]) 93
94 94 (define-key function-key-map "\e[057q" [?\C-`])
95(define-key function-key-map "\e[049q" [?\C-1]) 95 (define-key function-key-map "\e[115q" [?\M-`])
96(define-key function-key-map "\e[058q" [?\M-1]) 96
97 97 (define-key function-key-map "\e[049q" [?\C-1])
98 98 (define-key function-key-map "\e[058q" [?\M-1])
99(define-key function-key-map "\e[059q" [?\M-2]) 99
100 100
101(define-key function-key-map "\e[050q" [?\C-3]) 101 (define-key function-key-map "\e[059q" [?\M-2])
102(define-key function-key-map "\e[060q" [?\M-3]) 102
103 103 (define-key function-key-map "\e[050q" [?\C-3])
104(define-key function-key-map "\e[051q" [?\C-4]) 104 (define-key function-key-map "\e[060q" [?\M-3])
105(define-key function-key-map "\e[061q" [?\M-4]) 105
106 106 (define-key function-key-map "\e[051q" [?\C-4])
107(define-key function-key-map "\e[052q" [?\C-5]) 107 (define-key function-key-map "\e[061q" [?\M-4])
108(define-key function-key-map "\e[062q" [?\M-5]) 108
109 109 (define-key function-key-map "\e[052q" [?\C-5])
110 110 (define-key function-key-map "\e[062q" [?\M-5])
111(define-key function-key-map "\e[063q" [?\M-6]) 111
112 112
113(define-key function-key-map "\e[053q" [?\C-7]) 113 (define-key function-key-map "\e[063q" [?\M-6])
114(define-key function-key-map "\e[064q" [?\M-7]) 114
115 115 (define-key function-key-map "\e[053q" [?\C-7])
116(define-key function-key-map "\e[054q" [?\C-8]) 116 (define-key function-key-map "\e[064q" [?\M-7])
117(define-key function-key-map "\e[065q" [?\M-8]) 117
118 118 (define-key function-key-map "\e[054q" [?\C-8])
119(define-key function-key-map "\e[055q" [?\C-9]) 119 (define-key function-key-map "\e[065q" [?\M-8])
120(define-key function-key-map "\e[066q" [?\M-9]) 120
121 121 (define-key function-key-map "\e[055q" [?\C-9])
122(define-key function-key-map "\e[056q" [?\C-0]) 122 (define-key function-key-map "\e[066q" [?\M-9])
123(define-key function-key-map "\e[067q" [?\M-0]) 123
124 124 (define-key function-key-map "\e[056q" [?\C-0])
125(define-key function-key-map "\e[068q" [?\M--]) 125 (define-key function-key-map "\e[067q" [?\M-0])
126 126
127(define-key function-key-map "\e[069q" [?\C-=]) 127 (define-key function-key-map "\e[068q" [?\M--])
128(define-key function-key-map "\e[070q" [?\M-=]) 128
129 129 (define-key function-key-map "\e[069q" [?\C-=])
130;; I don't know what to do with those. 130 (define-key function-key-map "\e[070q" [?\M-=])
131;(define-key function-key-map "^H" [<del>]) 131
132;(define-key function-key-map "^H" [S-<del>]) 132 ;; I don't know what to do with those.
133;(define-key function-key-map "\177" [C-<del>]) 133 ;;(define-key function-key-map "^H" [<del>])
134;(define-key function-key-map "\e[071q" [M-<del>]) 134 ;;(define-key function-key-map "^H" [S-<del>])
135 135 ;;(define-key function-key-map "\177" [C-<del>])
136(define-key function-key-map "\e[Z" [?\S-\t]) 136 ;;(define-key function-key-map "\e[071q" [M-<del>])
137(define-key function-key-map "\e[072q" [?\C-\t]) 137
138;; This only works if you remove the M-TAB keybing from the system.4Dwmrc 138 (define-key function-key-map "\e[Z" [?\S-\t])
139;; our your ~/.4Dwmrc, if you use the 4Dwm window manager. 139 (define-key function-key-map "\e[072q" [?\C-\t])
140(define-key function-key-map "\e[073q" [?\M-\t]) 140 ;; This only works if you remove the M-TAB keybing from the system.4Dwmrc
141 141 ;; our your ~/.4Dwmrc, if you use the 4Dwm window manager.
142(define-key function-key-map "\e[074q" [?\M-q]) 142 (define-key function-key-map "\e[073q" [?\M-\t])
143 143
144(define-key function-key-map "\e[075q" [?\M-w]) 144 (define-key function-key-map "\e[074q" [?\M-q])
145 145
146(define-key function-key-map "\e[076q" [?\M-e]) 146 (define-key function-key-map "\e[075q" [?\M-w])
147 147
148(define-key function-key-map "\e[077q" [?\M-r]) 148 (define-key function-key-map "\e[076q" [?\M-e])
149 149
150(define-key function-key-map "\e[078q" [?\M-t]) 150 (define-key function-key-map "\e[077q" [?\M-r])
151 151
152(define-key function-key-map "\e[079q" [?\M-y]) 152 (define-key function-key-map "\e[078q" [?\M-t])
153 153
154(define-key function-key-map "\e[080q" [?\M-u]) 154 (define-key function-key-map "\e[079q" [?\M-y])
155 155
156(define-key function-key-map "\e[081q" [?\M-i]) 156 (define-key function-key-map "\e[080q" [?\M-u])
157 157
158(define-key function-key-map "\e[082q" [?\M-o]) 158 (define-key function-key-map "\e[081q" [?\M-i])
159 159
160(define-key function-key-map "\e[083q" [?\M-p]) 160 (define-key function-key-map "\e[082q" [?\M-o])
161 161
162(define-key function-key-map "\e[084q" [?\M-\[]) 162 (define-key function-key-map "\e[083q" [?\M-p])
163 163
164(define-key function-key-map "\e[085q" [?\M-\]]) 164 (define-key function-key-map "\e[084q" [?\M-\[])
165 165
166(define-key function-key-map "\e[086q" [?\M-\\]) 166 (define-key function-key-map "\e[085q" [?\M-\]])
167 167
168(define-key function-key-map "\e[087q" [?\M-a]) 168 (define-key function-key-map "\e[086q" [?\M-\\])
169 169
170(define-key function-key-map "\e[088q" [?\M-s]) 170 (define-key function-key-map "\e[087q" [?\M-a])
171 171
172(define-key function-key-map "\e[089q" [?\M-d]) 172 (define-key function-key-map "\e[088q" [?\M-s])
173 173
174(define-key function-key-map "\e[090q" [?\M-f]) 174 (define-key function-key-map "\e[089q" [?\M-d])
175 175
176(define-key function-key-map "\e[091q" [?\M-g]) 176 (define-key function-key-map "\e[090q" [?\M-f])
177 177
178(define-key function-key-map "\e[092q" [?\M-h]) 178 (define-key function-key-map "\e[091q" [?\M-g])
179 179
180(define-key function-key-map "\e[093q" [?\M-j]) 180 (define-key function-key-map "\e[092q" [?\M-h])
181 181
182(define-key function-key-map "\e[094q" [?\M-k]) 182 (define-key function-key-map "\e[093q" [?\M-j])
183 183
184(define-key function-key-map "\e[095q" [?\M-l]) 184 (define-key function-key-map "\e[094q" [?\M-k])
185 185
186(define-key function-key-map "\e[096q" [?\C-\;]) 186 (define-key function-key-map "\e[095q" [?\M-l])
187(define-key function-key-map "\e[097q" [?\M-:]) ;; we are cheating 187
188 ;; here, this is realy 188 (define-key function-key-map "\e[096q" [?\C-\;])
189 ;; M-;, but M-: 189 (define-key function-key-map "\e[097q" [?\M-:]) ;; we are cheating
190 ;; generates the same 190 ;; here, this is
191 ;; string and is more 191 ;; realy M-;, but
192 ;; usefull. 192 ;; M-: generates the
193 193 ;; same string and
194(define-key function-key-map "\e[098q" [?\C-']) 194 ;; is more usefull.
195(define-key function-key-map "\e[099q" [?\M-']) 195
196 196 (define-key function-key-map "\e[098q" [?\C-'])
197(define-key function-key-map "\e[100q" [?\M-\n]) 197 (define-key function-key-map "\e[099q" [?\M-'])
198 198
199(define-key function-key-map "\e[101q" [?\M-z]) 199 (define-key function-key-map "\e[100q" [?\M-\n])
200 200
201(define-key function-key-map "\e[102q" [?\M-x]) 201 (define-key function-key-map "\e[101q" [?\M-z])
202 202
203(define-key function-key-map "\e[103q" [?\M-c]) 203 (define-key function-key-map "\e[102q" [?\M-x])
204 204
205(define-key function-key-map "\e[104q" [?\M-v]) 205 (define-key function-key-map "\e[103q" [?\M-c])
206 206
207(define-key function-key-map "\e[105q" [?\M-b]) 207 (define-key function-key-map "\e[104q" [?\M-v])
208 208
209(define-key function-key-map "\e[106q" [M-n]) 209 (define-key function-key-map "\e[105q" [?\M-b])
210 210
211(define-key function-key-map "\e[107q" [M-m]) 211 (define-key function-key-map "\e[106q" [M-n])
212 212
213(define-key function-key-map "\e[108q" [?\C-,]) 213 (define-key function-key-map "\e[107q" [M-m])
214(define-key function-key-map "\e[109q" [?\M-,]) 214
215 215 (define-key function-key-map "\e[108q" [?\C-,])
216(define-key function-key-map "\e[110q" [?\C-.]) 216 (define-key function-key-map "\e[109q" [?\M-,])
217(define-key function-key-map "\e[111q" [?\M-.]) 217
218 218 (define-key function-key-map "\e[110q" [?\C-.])
219(define-key function-key-map "\e[112q" [?\C-/]) 219 (define-key function-key-map "\e[111q" [?\M-.])
220(define-key function-key-map "\e[113q" [?\M-/]) 220
221 221 (define-key function-key-map "\e[112q" [?\C-/])
222(define-key function-key-map "\e[139q" [insert]) 222 (define-key function-key-map "\e[113q" [?\M-/])
223(define-key function-key-map "\e[139q" [S-insert]) 223
224(define-key function-key-map "\e[140q" [C-insert]) 224 (define-key function-key-map "\e[139q" [insert])
225(define-key function-key-map "\e[141q" [M-insert]) 225 (define-key function-key-map "\e[139q" [S-insert])
226 226 (define-key function-key-map "\e[140q" [C-insert])
227(define-key function-key-map "\e[H" [home]) 227 (define-key function-key-map "\e[141q" [M-insert])
228(define-key function-key-map "\e[143q" [S-home]) 228
229(define-key function-key-map "\e[144q" [C-home]) 229 (define-key function-key-map "\e[H" [home])
230 230 (define-key function-key-map "\e[143q" [S-home])
231 231 (define-key function-key-map "\e[144q" [C-home])
232(define-key function-key-map "\e[150q" [prior]) 232
233(define-key function-key-map "\e[151q" [S-prior]) ;; those don't seem 233
234 (define-key function-key-map "\e[150q" [prior])
235 (define-key function-key-map "\e[151q" [S-prior]) ;; those don't
236 ;; seem to
237 ;; generate
238 ;; anything
239 (define-key function-key-map "\e[152q" [C-prior])
240
241
242 ;; (define-key function-key-map "^?" [delete])
243 (define-key function-key-map "\e[P" [S-delete])
244 (define-key function-key-map "\e[142q" [C-delete])
245 (define-key function-key-map "\e[M" [M-delete])
246
247 (define-key function-key-map "\e[146q" [end])
248 (define-key function-key-map "\e[147q" [S-end]) ;; those don't seem
234 ;; to generate 249 ;; to generate
235 ;; anything 250 ;; anything
236(define-key function-key-map "\e[152q" [C-prior]) 251 (define-key function-key-map "\e[148q" [C-end])
237 252
238 253 (define-key function-key-map "\e[154q" [next])
239;; (define-key function-key-map "^?" [delete]) ?? something else seems to take care of this. 254 (define-key function-key-map "\e[155q" [S-next])
240(define-key function-key-map "\e[P" [S-delete]) 255 (define-key function-key-map "\e[156q" [C-next])
241(define-key function-key-map "\e[142q" [C-delete]) 256
242(define-key function-key-map "\e[M" [M-delete]) 257
243 258 (define-key function-key-map "\e[161q" [S-up])
244(define-key function-key-map "\e[146q" [end]) 259 (define-key function-key-map "\e[162q" [C-up])
245(define-key function-key-map "\e[147q" [S-end]) ;; those don't seem to 260 (define-key function-key-map "\e[163q" [M-up])
246 ;; generate anything 261
247(define-key function-key-map "\e[148q" [C-end]) 262 (define-key function-key-map "\e[158q" [S-left])
248 263 (define-key function-key-map "\e[159q" [C-left])
249(define-key function-key-map "\e[154q" [next]) 264 (define-key function-key-map "\e[160q" [M-left])
250(define-key function-key-map "\e[155q" [S-next]) 265
251(define-key function-key-map "\e[156q" [C-next]) 266 (define-key function-key-map "\e[164q" [S-down])
252 267 (define-key function-key-map "\e[165q" [C-down])
253 268 (define-key function-key-map "\e[166q" [M-down])
254(define-key function-key-map "\e[161q" [S-up]) 269
255(define-key function-key-map "\e[162q" [C-up]) 270 (define-key function-key-map "\e[167q" [S-right])
256(define-key function-key-map "\e[163q" [M-up]) 271 (define-key function-key-map "\e[168q" [C-right])
257 272 (define-key function-key-map "\e[169q" [M-right])
258(define-key function-key-map "\e[158q" [S-left]) 273
259(define-key function-key-map "\e[159q" [C-left]) 274 ;; Keypad functions, most of those are untested.
260(define-key function-key-map "\e[160q" [M-left]) 275 (define-key function-key-map "\e[179q" [?\C-/])
261 276 (define-key function-key-map "\e[180q" [?\M-/])
262(define-key function-key-map "\e[164q" [S-down]) 277
263(define-key function-key-map "\e[165q" [C-down]) 278 (define-key function-key-map "\e[187q" [?\C-*])
264(define-key function-key-map "\e[166q" [M-down]) 279 (define-key function-key-map "\e[188q" [?\M-*])
265 280
266(define-key function-key-map "\e[167q" [S-right]) 281 (define-key function-key-map "\e[198q" [?\C--])
267(define-key function-key-map "\e[168q" [C-right]) 282 (define-key function-key-map "\e[199q" [?\M--])
268(define-key function-key-map "\e[169q" [M-right]) 283
269 284 ;; Something else takes care of home, up, prior, down, left, right, next
270;; Keypad functions, most of those are untested. 285 ;;(define-key function-key-map "\e[H" [home])
271(define-key function-key-map "\e[179q" [?\C-/]) 286 (define-key function-key-map "\e[172q" [C-home])
272(define-key function-key-map "\e[180q" [?\M-/]) 287
273 288 ;;(define-key function-key-map "\e[A" [up])
274(define-key function-key-map "\e[187q" [?\C-*]) 289 (define-key function-key-map "\e[182q" [C-up])
275(define-key function-key-map "\e[188q" [?\M-*]) 290
276 291
277(define-key function-key-map "\e[198q" [?\C--]) 292 ;;(define-key function-key-map "\e[150q" [prior])
278(define-key function-key-map "\e[199q" [?\M--]) 293 (define-key function-key-map "\e[190q" [C-prior])
279 294
280;; Something else takes care of home, up, prior, down, left, right, next 295
281;(define-key function-key-map "\e[H" [home]) 296 (define-key function-key-map "\e[200q" [?\C-+])
282(define-key function-key-map "\e[172q" [C-home]) 297 (define-key function-key-map "\e[201q" [?\M-+])
283 298
284;(define-key function-key-map "\e[A" [up]) 299 ;;(define-key function-key-map "\e[D" [left])
285(define-key function-key-map "\e[182q" [C-up]) 300 (define-key function-key-map "\e[174q" [C-left])
286 301
287 302
288;(define-key function-key-map "\e[150q" [prior]) 303 (define-key function-key-map "\e[000q" [begin])
289(define-key function-key-map "\e[190q" [C-prior]) 304 (define-key function-key-map "\e[184q" [C-begin])
290 305
291 306
292(define-key function-key-map "\e[200q" [?\C-+]) 307 ;;(define-key function-key-map "\e[C" [right])
293(define-key function-key-map "\e[201q" [?\M-+]) 308 (define-key function-key-map "\e[192q" [C-right])
294 309
295;(define-key function-key-map "\e[D" [left]) 310 ;;(define-key function-key-map "\e[146q" [end])
296(define-key function-key-map "\e[174q" [C-left]) 311 (define-key function-key-map "\e[176q" [C-end])
297 312
298 313 ;;(define-key function-key-map "\e[B" [down])
299(define-key function-key-map "\e[000q" [begin]) 314 (define-key function-key-map "\e[186q" [C-down])
300(define-key function-key-map "\e[184q" [C-begin]) 315
301 316 ;;(define-key function-key-map "\e[154q" [next])
302 317 (define-key function-key-map "\e[194q" [C-next])
303;(define-key function-key-map "\e[C" [right]) 318
304(define-key function-key-map "\e[192q" [C-right]) 319
305 320 (define-key function-key-map "\e[100q" [M-enter])
306;(define-key function-key-map "\e[146q" [end]) 321
307(define-key function-key-map "\e[176q" [C-end]) 322 (define-key function-key-map "\e[139q" [insert])
308 323 (define-key function-key-map "\e[178q" [C-inset])
309;(define-key function-key-map "\e[B" [down]) 324
310(define-key function-key-map "\e[186q" [C-down]) 325 (define-key function-key-map "\e[P" [delete])
311 326 (define-key function-key-map "\e[196q" [C-delete])
312;(define-key function-key-map "\e[154q" [next]) 327 (define-key function-key-map "\e[197q" [M-delete]))
313(define-key function-key-map "\e[194q" [C-next])
314
315
316(define-key function-key-map "\e[100q" [M-enter])
317
318(define-key function-key-map "\e[139q" [insert])
319(define-key function-key-map "\e[178q" [C-inset])
320
321(define-key function-key-map "\e[P" [delete])
322(define-key function-key-map "\e[196q" [C-delete])
323(define-key function-key-map "\e[197q" [M-delete])
324 328
325;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b 329;;; arch-tag: b1d0e73a-bb7d-47be-9fb2-6fb126469a1b
326;;; iris-ansi.el ends here 330;;; iris-ansi.el ends here
diff --git a/lisp/term/linux.el b/lisp/term/linux.el
index 71b9e0d4bcf..7fa9a96e9bd 100644
--- a/lisp/term/linux.el
+++ b/lisp/term/linux.el
@@ -1,19 +1,21 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2;; The Linux console handles Latin-1 by default. 2;; The Linux console handles Latin-1 by default.
3 3
4(unless (terminal-coding-system) 4(defun terminal-init-linux ()
5 (set-terminal-coding-system 'iso-latin-1)) 5 "Terminal initialization function for linux."
6 (unless (terminal-coding-system)
7 (set-terminal-coding-system 'iso-latin-1))
6 8
7;; It can't really display underlines. 9 ;; It can't really display underlines.
8(tty-no-underline) 10 (tty-no-underline)
9 11
10;; Make Latin-1 input characters work, too. 12 ;; Make Latin-1 input characters work, too.
11;; Meta will continue to work, because the kernel 13 ;; Meta will continue to work, because the kernel
12;; turns that into Escape. 14 ;; turns that into Escape.
13 15
14(let ((value (current-input-mode))) 16 (let ((value (current-input-mode)))
15 ;; The third arg only matters in that it is not t or nil. 17 ;; The third arg only matters in that it is not t or nil.
16 (set-input-mode (nth 0 value) (nth 1 value) 'iso-latin-1 (nth 3 value))) 18 (set-input-mode (nth 0 value) (nth 1 value) 'iso-latin-1 (nth 3 value))))
17 19
18;;; arch-tag: 5d0c4f63-739b-4862-abf3-041fe42adb8f 20;;; arch-tag: 5d0c4f63-739b-4862-abf3-041fe42adb8f
19;;; linux.el ends here 21;;; linux.el ends here
diff --git a/lisp/term/news.el b/lisp/term/news.el
index 7a24eaf5a0c..f8a4934f8bc 100644
--- a/lisp/term/news.el
+++ b/lisp/term/news.el
@@ -1,6 +1,6 @@
1;;; news.el --- keypad and function key bindings for the Sony NEWS keyboard -*- no-byte-compile: t -*- 1;;; news.el --- keypad and function key bindings for the Sony NEWS keyboard -*- no-byte-compile: t -*-
2 2
3;; Copyright (C) 1989, 1993 Free Software Foundation, Inc. 3;; Copyright (C) 1989, 1993, 2005 Free Software Foundation, Inc.
4 4
5;; Author: FSF 5;; Author: FSF
6;; Keywords: terminals 6;; Keywords: terminals
@@ -28,47 +28,49 @@
28 28
29;;; Code: 29;;; Code:
30 30
31(if (boundp 'news-fkey-prefix) 31(defun terminal-init-news ()
32 nil 32 "Terminal initialization function for news."
33 ;; The terminal initialization should already have set up some keys 33 (if (boundp 'news-fkey-prefix)
34 (setq news-fkey-prefix (lookup-key function-key-map "\eO")) 34 nil
35 (if (not (keymapp news-fkey-prefix)) 35 ;; The terminal initialization should already have set up some keys
36 (error "What? Your news termcap/terminfo has no keycaps in it")) 36 (setq news-fkey-prefix (lookup-key function-key-map "\eO"))
37 (if (not (keymapp news-fkey-prefix))
38 (error "What? Your news termcap/terminfo has no keycaps in it"))
37 39
38 ;; Termcap or terminfo will set these 40 ;; Termcap or terminfo will set these
39 ;; (define-key news-fkey-prefix "P" [f1]) 41 ;; (define-key news-fkey-prefix "P" [f1])
40 ;; (define-key news-fkey-prefix "Q" [f2]) 42 ;; (define-key news-fkey-prefix "Q" [f2])
41 ;; (define-key news-fkey-prefix "R" [f3]) 43 ;; (define-key news-fkey-prefix "R" [f3])
42 ;; (define-key news-fkey-prefix "S" [f4]) 44 ;; (define-key news-fkey-prefix "S" [f4])
43 ;; (define-key news-fkey-prefix "T" [f5]) 45 ;; (define-key news-fkey-prefix "T" [f5])
44 ;; (define-key news-fkey-prefix "U" [f6]) 46 ;; (define-key news-fkey-prefix "U" [f6])
45 ;; (define-key news-fkey-prefix "V" [f7]) 47 ;; (define-key news-fkey-prefix "V" [f7])
46 ;; (define-key news-fkey-prefix "W" [f8]) 48 ;; (define-key news-fkey-prefix "W" [f8])
47 ;; (define-key news-fkey-prefix "X" [f9]) 49 ;; (define-key news-fkey-prefix "X" [f9])
48 ;; (define-key news-fkey-prefix "Y" [f10]) 50 ;; (define-key news-fkey-prefix "Y" [f10])
49 51
50 ;; Terminfo will set these 52 ;; Terminfo will set these
51 (define-key news-fkey-prefix "a" [execute]) 53 (define-key news-fkey-prefix "a" [execute])
52 (define-key news-fkey-prefix "b" [select]) 54 (define-key news-fkey-prefix "b" [select])
53 (define-key news-fkey-prefix "c" [cancel]) 55 (define-key news-fkey-prefix "c" [cancel])
54 (define-key news-fkey-prefix "M" [kp-enter]) 56 (define-key news-fkey-prefix "M" [kp-enter])
55 (define-key news-fkey-prefix "q" [kp-1]) 57 (define-key news-fkey-prefix "q" [kp-1])
56 (define-key news-fkey-prefix "s" [kp-3]) 58 (define-key news-fkey-prefix "s" [kp-3])
57 (define-key news-fkey-prefix "u" [kp-5]) 59 (define-key news-fkey-prefix "u" [kp-5])
58 (define-key news-fkey-prefix "w" [kp-7]) 60 (define-key news-fkey-prefix "w" [kp-7])
59 (define-key news-fkey-prefix "y" [kp-9]) 61 (define-key news-fkey-prefix "y" [kp-9])
60 62
61 ;; These aren't in either termcap or terminfo's repertoire 63 ;; These aren't in either termcap or terminfo's repertoire
62 (define-key news-fkey-prefix "m" [kp-subtract]) 64 (define-key news-fkey-prefix "m" [kp-subtract])
63 (define-key news-fkey-prefix "k" [kp-add]) 65 (define-key news-fkey-prefix "k" [kp-add])
64 (define-key news-fkey-prefix "l" [kp-separator]) 66 (define-key news-fkey-prefix "l" [kp-separator])
65 (define-key news-fkey-prefix "n" [kp-decimal]) 67 (define-key news-fkey-prefix "n" [kp-decimal])
66 (define-key news-fkey-prefix "p" [kp-0]) 68 (define-key news-fkey-prefix "p" [kp-0])
67 (define-key news-fkey-prefix "r" [kp-2]) 69 (define-key news-fkey-prefix "r" [kp-2])
68 (define-key news-fkey-prefix "t" [kp-4]) 70 (define-key news-fkey-prefix "t" [kp-4])
69 (define-key news-fkey-prefix "v" [kp-6]) 71 (define-key news-fkey-prefix "v" [kp-6])
70 (define-key news-fkey-prefix "x" [kp-8]) 72 (define-key news-fkey-prefix "x" [kp-8])
71 ) 73 ))
72 74
73;;; arch-tag: bfe141a0-623b-4b42-b753-5d9353776c5e 75;;; arch-tag: bfe141a0-623b-4b42-b753-5d9353776c5e
74;;; news.el ends here 76;;; news.el ends here
diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index 8dcd1826e0a..f0e9dd7b5b1 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -1,6 +1,6 @@
1;;; rxvt.el --- define function key sequences and standard colors for rxvt 1;;; rxvt.el --- define function key sequences and standard colors for rxvt
2 2
3;; Copyright (C) 2002 Free Software Foundation, Inc. 3;; Copyright (C) 2002, 2005 Free Software Foundation, Inc.
4 4
5;; Author: Eli Zaretskii 5;; Author: Eli Zaretskii
6;; Keywords: terminals 6;; Keywords: terminals
@@ -26,73 +26,143 @@
26 26
27;;; Code: 27;;; Code:
28 28
29;; Set up function-key-map entries that termcap and terminfo don't know. 29(defun terminal-init-rxvt ()
30(let ((map (make-sparse-keymap))) 30 "Terminal initialization function for rxvt."
31 (define-key map "\e[A" [up]) 31 ;; The terminal intialization C code file might have initialized
32 (define-key map "\e[B" [down]) 32 ;; function keys F11->F42 from the termcap/terminfo information. On
33 (define-key map "\e[C" [right]) 33 ;; a PC-style keyboard these keys correspond to
34 (define-key map "\e[D" [left]) 34 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C-, C-S-. The
35 (define-key map "\e[7~" [home]) 35 ;; code here subsitutes the corresponding defintions in
36 (define-key map "\e[2~" [insert]) 36 ;; function-key-map. This substitution is needed because if a key
37 (define-key map "\e[3~" [delete]) 37 ;; definition if found in function-key-map, there are no further
38 (define-key map "\e[4~" [select]) 38 ;; lookups in other keymaps.
39 (define-key map "\e[5~" [prior]) 39 (substitute-key-definition [f11] [S-f1] function-key-map)
40 (define-key map "\e[6~" [next]) 40 (substitute-key-definition [f12] [S-f2] function-key-map)
41 (define-key map "\e[11~" [f1]) 41 (substitute-key-definition [f13] [S-f3] function-key-map)
42 (define-key map "\e[12~" [f2]) 42 (substitute-key-definition [f14] [S-f4] function-key-map)
43 (define-key map "\e[13~" [f3]) 43 (substitute-key-definition [f15] [S-f5] function-key-map)
44 (define-key map "\e[14~" [f4]) 44 (substitute-key-definition [f16] [S-f6] function-key-map)
45 (define-key map "\e[15~" [f5]) 45 (substitute-key-definition [f17] [S-f7] function-key-map)
46 (define-key map "\e[17~" [f6]) 46 (substitute-key-definition [f18] [S-f8] function-key-map)
47 (define-key map "\e[18~" [f7]) 47 (substitute-key-definition [f19] [S-f9] function-key-map)
48 (define-key map "\e[19~" [f8]) 48 (substitute-key-definition [f20] [S-f10] function-key-map)
49 (define-key map "\e[20~" [f9]) 49
50 (define-key map "\e[21~" [f10]) 50 (substitute-key-definition [f23] [C-f1] function-key-map)
51 (define-key map "\e[23~" [f11]) 51 (substitute-key-definition [f24] [C-f2] function-key-map)
52 (define-key map "\e[24~" [f12]) 52 (substitute-key-definition [f25] [C-f3] function-key-map)
53 (define-key map "\e[29~" [print]) 53 (substitute-key-definition [f26] [C-f4] function-key-map)
54 54 (substitute-key-definition [f27] [C-f5] function-key-map)
55 (define-key map "\e[11^" [C-f1]) 55 (substitute-key-definition [f28] [C-f6] function-key-map)
56 (define-key map "\e[12^" [C-f2]) 56 (substitute-key-definition [f29] [C-f7] function-key-map)
57 (define-key map "\e[13^" [C-f3]) 57 (substitute-key-definition [f30] [C-f8] function-key-map)
58 (define-key map "\e[14^" [C-f4]) 58 (substitute-key-definition [f31] [C-f9] function-key-map)
59 (define-key map "\e[15^" [C-f5]) 59 (substitute-key-definition [f32] [C-f10] function-key-map)
60 (define-key map "\e[17^" [C-f6]) 60
61 (define-key map "\e[18^" [C-f7]) 61 (substitute-key-definition [f33] [C-S-f1] function-key-map)
62 (define-key map "\e[19^" [C-f8]) 62 (substitute-key-definition [f34] [C-S-f2] function-key-map)
63 (define-key map "\e[20^" [C-f9]) 63 (substitute-key-definition [f35] [C-S-f3] function-key-map)
64 (define-key map "\e[21^" [C-f10]) 64 (substitute-key-definition [f36] [C-S-f4] function-key-map)
65 (define-key map "\e[23^" [C-f11]) 65 (substitute-key-definition [f37] [C-S-f5] function-key-map)
66 (define-key map "\e[24^" [C-f12]) 66 (substitute-key-definition [f38] [C-S-f6] function-key-map)
67 67 (substitute-key-definition [f39] [C-S-f7] function-key-map)
68 (define-key map "\e[29~" [print]) 68 (substitute-key-definition [f40] [C-S-f8] function-key-map)
69 69 (substitute-key-definition [f41] [C-S-f9] function-key-map)
70 (define-key map "\e[2;2~" [S-insert]) 70 (substitute-key-definition [f42] [C-S-f10] function-key-map)
71 (define-key map "\e[3$" [S-delete]) 71
72 72 ;; Set up function-key-map entries that termcap and terminfo don't know.
73 (define-key map "\e[2^" [C-insert]) 73 (let ((map (make-sparse-keymap)))
74 (define-key map "\e[3^" [C-delete]) 74 (define-key map "\e[A" [up])
75 (define-key map "\e[5^" [C-prior]) 75 (define-key map "\e[B" [down])
76 (define-key map "\e[6^" [C-next]) 76 (define-key map "\e[C" [right])
77 (define-key map "\eOd" [C-left]) 77 (define-key map "\e[D" [left])
78 (define-key map "\eOc" [C-right]) 78 (define-key map "\e[7~" [home])
79 (define-key map "\eOa" [C-up]) 79 (define-key map "\e[2~" [insert])
80 (define-key map "\eOb" [C-down]) 80 (define-key map "\e[3~" [delete])
81 81 (define-key map "\e[4~" [select])
82 (define-key map "\e[5$" [S-prior]) 82 (define-key map "\e[5~" [prior])
83 (define-key map "\e[6$" [S-next]) 83 (define-key map "\e[6~" [next])
84 (define-key map "\e[8$" [S-end]) 84 (define-key map "\e[11~" [f1])
85 (define-key map "\e[7$" [S-home]) 85 (define-key map "\e[12~" [f2])
86 (define-key map "\e[d" [S-left]) 86 (define-key map "\e[13~" [f3])
87 (define-key map "\e[c" [S-right]) 87 (define-key map "\e[14~" [f4])
88 (define-key map "\e[a" [S-up]) 88 (define-key map "\e[15~" [f5])
89 (define-key map "\e[b" [S-down]) 89 (define-key map "\e[17~" [f6])
90 90 (define-key map "\e[18~" [f7])
91 ;; Use inheritance to let the main keymap override those defaults. 91 (define-key map "\e[19~" [f8])
92 ;; This way we don't override terminfo-derived settings or settings 92 (define-key map "\e[20~" [f9])
93 ;; made in the .emacs file. 93 (define-key map "\e[21~" [f10])
94 (set-keymap-parent map (keymap-parent function-key-map)) 94 ;; The strings emitted by f11 and f12 are the same as the strings
95 (set-keymap-parent function-key-map map)) 95 ;; emitted by S-f1 and S-f2, so don't define f11 and f12.
96 ;; (define-key map "\e[23~" [f11])
97 ;; (define-key map "\e[24~" [f12])
98 (define-key map "\e[29~" [print])
99
100 (define-key map "\e[11^" [C-f1])
101 (define-key map "\e[12^" [C-f2])
102 (define-key map "\e[13^" [C-f3])
103 (define-key map "\e[14^" [C-f4])
104 (define-key map "\e[15^" [C-f5])
105 (define-key map "\e[17^" [C-f6])
106 (define-key map "\e[18^" [C-f7])
107 (define-key map "\e[19^" [C-f8])
108 (define-key map "\e[20^" [C-f9])
109 (define-key map "\e[21^" [C-f10])
110
111 (define-key map "\e[23~" [S-f1])
112 (define-key map "\e[24~" [S-f2])
113 (define-key map "\e[25~" [S-f3])
114 (define-key map "\e[26~" [S-f4])
115 (define-key map "\e[28~" [S-f5])
116 (define-key map "\e[29~" [S-f6])
117 (define-key map "\e[31~" [S-f7])
118 (define-key map "\e[32~" [S-f8])
119 (define-key map "\e[33~" [S-f9])
120 (define-key map "\e[34~" [S-f10])
121
122 (define-key map "\e[23^" [C-S-f1])
123 (define-key map "\e[24^" [C-S-f2])
124 (define-key map "\e[25^" [C-S-f3])
125 (define-key map "\e[26^" [C-S-f4])
126 (define-key map "\e[28^" [C-S-f5])
127 (define-key map "\e[29^" [C-S-f6])
128 (define-key map "\e[31^" [C-S-f7])
129 (define-key map "\e[32^" [C-S-f8])
130 (define-key map "\e[33^" [C-S-f9])
131 (define-key map "\e[34^" [C-S-f10])
132
133 (define-key map "\e[2^" [C-insert])
134 (define-key map "\e[3^" [C-delete])
135 (define-key map "\e[5^" [C-prior])
136 (define-key map "\e[6^" [C-next])
137 (define-key map "\e[7^" [C-home])
138 (define-key map "\e[8^" [C-end])
139 (define-key map "\eOd" [C-left])
140 (define-key map "\eOc" [C-right])
141 (define-key map "\eOa" [C-up])
142 (define-key map "\eOb" [C-down])
143
144 (define-key map "\e[2;2~" [S-insert])
145 (define-key map "\e[3$" [S-delete])
146 (define-key map "\e[5$" [S-prior])
147 (define-key map "\e[6$" [S-next])
148 (define-key map "\e[8$" [S-end])
149 (define-key map "\e[7$" [S-home])
150 (define-key map "\e[d" [S-left])
151 (define-key map "\e[c" [S-right])
152 (define-key map "\e[a" [S-up])
153 (define-key map "\e[b" [S-down])
154
155 ;; Use inheritance to let the main keymap override those defaults.
156 ;; This way we don't override terminfo-derived settings or settings
157 ;; made in the .emacs file.
158 (set-keymap-parent map (keymap-parent function-key-map))
159 (set-keymap-parent function-key-map map))
160
161 ;; Initialize colors and background mode.
162 (rxvt-register-default-colors)
163 (rxvt-set-background-mode)
164 ;; This recomputes all the default faces given the colors we've just set up.
165 (tty-set-up-initial-frame-faces))
96 166
97;; Set up colors, for those versions of rxvt that support it. 167;; Set up colors, for those versions of rxvt that support it.
98(defvar rxvt-standard-colors 168(defvar rxvt-standard-colors
@@ -166,11 +236,5 @@ for the currently selected frame."
166 (setq default-frame-background-mode 'dark))) 236 (setq default-frame-background-mode 'dark)))
167 (frame-set-background-mode (selected-frame)))) 237 (frame-set-background-mode (selected-frame))))
168 238
169;; Do it!
170(rxvt-register-default-colors)
171(rxvt-set-background-mode)
172;; This recomputes all the default faces given the colors we've just set up.
173(tty-set-up-initial-frame-faces)
174
175;;; arch-tag: 20cf2fb6-6318-4bab-9dbf-1d15048f2257 239;;; arch-tag: 20cf2fb6-6318-4bab-9dbf-1d15048f2257
176;;; rxvt.el ends here 240;;; rxvt.el ends here
diff --git a/lisp/term/sun.el b/lisp/term/sun.el
index 18010e0b343..7d857ca1266 100644
--- a/lisp/term/sun.el
+++ b/lisp/term/sun.el
@@ -1,6 +1,6 @@
1;;; sun.el --- keybinding for standard default sunterm keys 1;;; sun.el --- keybinding for standard default sunterm keys
2 2
3;; Copyright (C) 1987, 2001 Free Software Foundation, Inc. 3;; Copyright (C) 1987, 2001, 2005 Free Software Foundation, Inc.
4 4
5;; Author: Jeff Peck <peck@sun.com> 5;; Author: Jeff Peck <peck@sun.com>
6;; Keywords: terminals 6;; Keywords: terminals
@@ -93,58 +93,6 @@
93;; 93;;
94 94
95(defvar sun-raw-prefix (make-sparse-keymap)) 95(defvar sun-raw-prefix (make-sparse-keymap))
96(define-key function-key-map "\e[" sun-raw-prefix)
97
98(define-key sun-raw-prefix "210z" [r3])
99(define-key sun-raw-prefix "213z" [r6])
100(define-key sun-raw-prefix "214z" [r7])
101(define-key sun-raw-prefix "216z" [r9])
102(define-key sun-raw-prefix "218z" [r11])
103(define-key sun-raw-prefix "220z" [r13])
104(define-key sun-raw-prefix "222z" [r15])
105(define-key sun-raw-prefix "193z" [redo])
106(define-key sun-raw-prefix "194z" [props])
107(define-key sun-raw-prefix "195z" [undo])
108;; (define-key sun-raw-prefix "196z" 'ignore) ; Expose-down
109;; (define-key sun-raw-prefix "197z" [put])
110;; (define-key sun-raw-prefix "198z" 'ignore) ; Open-down
111;; (define-key sun-raw-prefix "199z" [get])
112(define-key sun-raw-prefix "200z" [find])
113;; (define-key sun-raw-prefix "201z" 'kill-region-and-unmark) ; Delete
114(define-key sun-raw-prefix "224z" [f1])
115(define-key sun-raw-prefix "225z" [f2])
116(define-key sun-raw-prefix "226z" [f3])
117(define-key sun-raw-prefix "227z" [f4])
118(define-key sun-raw-prefix "228z" [f5])
119(define-key sun-raw-prefix "229z" [f6])
120(define-key sun-raw-prefix "230z" [f7])
121(define-key sun-raw-prefix "231z" [f8])
122(define-key sun-raw-prefix "232z" [f9])
123(define-key sun-raw-prefix "233z" [f10])
124(define-key sun-raw-prefix "234z" [f11])
125(define-key sun-raw-prefix "235z" [f12])
126(define-key sun-raw-prefix "A" [up]) ; R8
127(define-key sun-raw-prefix "B" [down]) ; R14
128(define-key sun-raw-prefix "C" [right]) ; R12
129(define-key sun-raw-prefix "D" [left]) ; R10
130
131(global-set-key [r3] 'backward-page)
132(global-set-key [r6] 'forward-page)
133(global-set-key [r7] 'beginning-of-buffer)
134(global-set-key [r9] 'scroll-down)
135(global-set-key [r11] 'recenter)
136(global-set-key [r13] 'end-of-buffer)
137(global-set-key [r15] 'scroll-up)
138(global-set-key [redo] 'redraw-display) ;FIXME: collides with default.
139(global-set-key [props] 'list-buffers)
140(global-set-key [put] 'sun-select-region)
141(global-set-key [get] 'sun-yank-selection)
142(global-set-key [find] 'exchange-point-and-mark)
143(global-set-key [f3] 'scroll-down-in-place)
144(global-set-key [f4] 'scroll-up-in-place)
145(global-set-key [f6] 'shrink-window)
146(global-set-key [f7] 'enlarge-window)
147
148 96
149;; Since .emacs gets loaded before this file, a hook is supplied 97;; Since .emacs gets loaded before this file, a hook is supplied
150;; for you to put your own bindings in. 98;; for you to put your own bindings in.
@@ -152,13 +100,6 @@
152(defvar sun-raw-prefix-hooks nil 100(defvar sun-raw-prefix-hooks nil
153 "List of forms to evaluate after setting sun-raw-prefix.") 101 "List of forms to evaluate after setting sun-raw-prefix.")
154 102
155(when sun-raw-prefix-hooks
156 (message "sun-raw-prefix-hooks is obsolete! Use term-setup-hook instead!")
157 (let ((hooks sun-raw-prefix-hooks))
158 (while hooks
159 (eval (car hooks))
160 (setq hooks (cdr hooks)))))
161
162 103
163;;; This section adds definitions for the emacstool users 104;;; This section adds definitions for the emacstool users
164;; emacstool event filter converts function keys to C-x*{c}{lrt} 105;; emacstool event filter converts function keys to C-x*{c}{lrt}
@@ -188,44 +129,6 @@
188(defvar suntool-map (make-sparse-keymap) 129(defvar suntool-map (make-sparse-keymap)
189 "*Keymap for Emacstool bindings.") 130 "*Keymap for Emacstool bindings.")
190 131
191(define-key suntool-map "gr" 'beginning-of-buffer) ; r7
192(define-key suntool-map "iR" 'backward-page) ; R9
193(define-key suntool-map "ir" 'scroll-down) ; r9
194(define-key suntool-map "kr" 'recenter) ; r11
195(define-key suntool-map "mr" 'end-of-buffer) ; r13
196(define-key suntool-map "oR" 'forward-page) ; R15
197(define-key suntool-map "or" 'scroll-up) ; r15
198(define-key suntool-map "b\M-L" 'rerun-prev-command) ; M-AGAIN
199(define-key suntool-map "b\M-l" 'prev-complex-command) ; M-Again
200(define-key suntool-map "bl" 'redraw-display) ; Again
201(define-key suntool-map "cl" 'list-buffers) ; Props
202(define-key suntool-map "dl" 'undo) ; Undo
203(define-key suntool-map "el" 'ignore) ; Expose-Open
204(define-key suntool-map "fl" 'sun-select-region) ; Put
205(define-key suntool-map "f," 'copy-region-as-kill) ; C-Put
206(define-key suntool-map "gl" 'ignore) ; Open-Open
207(define-key suntool-map "hl" 'sun-yank-selection) ; Get
208(define-key suntool-map "h," 'yank) ; C-Get
209(define-key suntool-map "il" 'research-forward) ; Find
210(define-key suntool-map "i," 're-search-forward) ; C-Find
211(define-key suntool-map "i\M-l" 'research-backward) ; M-Find
212(define-key suntool-map "i\M-," 're-search-backward) ; C-M-Find
213
214(define-key suntool-map "jL" 'yank) ; DELETE
215(define-key suntool-map "jl" 'kill-region-and-unmark) ; Delete
216(define-key suntool-map "j\M-l" 'exchange-point-and-mark); M-Delete
217(define-key suntool-map "j,"
218 (lambda () (interactive) (pop-mark))) ; C-Delete
219
220(define-key suntool-map "fT" 'shrink-window-horizontally) ; T6
221(define-key suntool-map "gT" 'enlarge-window-horizontally) ; T7
222(define-key suntool-map "ft" 'shrink-window) ; t6
223(define-key suntool-map "gt" 'enlarge-window) ; t7
224(define-key suntool-map "cT" (lambda (n) (interactive "p") (scroll-down n)))
225(define-key suntool-map "dT" (lambda (n) (interactive "p") (scroll-up n)))
226(define-key suntool-map "ct" 'scroll-down-in-place) ; t3
227(define-key suntool-map "dt" 'scroll-up-in-place) ; t4
228(define-key ctl-x-map "*" suntool-map)
229 132
230;; Since .emacs gets loaded before this file, a hook is supplied 133;; Since .emacs gets loaded before this file, a hook is supplied
231;; for you to put your own bindings in. 134;; for you to put your own bindings in.
@@ -233,13 +136,6 @@
233(defvar suntool-map-hooks nil 136(defvar suntool-map-hooks nil
234 "List of forms to evaluate after setting suntool-map.") 137 "List of forms to evaluate after setting suntool-map.")
235 138
236(when suntool-map-hooks
237 (message "suntool-map-hooks is obsolete! Use term-setup-hook instead!")
238 (let ((hooks suntool-map-hooks))
239 (while hooks
240 (eval (car hooks))
241 (setq hooks (cdr hooks)))))
242
243;; 139;;
244;; If running under emacstool, arrange to call suspend-emacstool 140;; If running under emacstool, arrange to call suspend-emacstool
245;; instead of suspend-emacs. 141;; instead of suspend-emacs.
@@ -251,6 +147,115 @@
251(autoload 'sun-mouse-handler "sun-mouse" 147(autoload 'sun-mouse-handler "sun-mouse"
252 "Sun Emacstool handler for mouse blips (not loaded)." t) 148 "Sun Emacstool handler for mouse blips (not loaded)." t)
253 149
150(defun terminal-init-sun ()
151 "Terminal initialization function for sun."
152 (define-key function-key-map "\e[" sun-raw-prefix)
153
154 (define-key sun-raw-prefix "210z" [r3])
155 (define-key sun-raw-prefix "213z" [r6])
156 (define-key sun-raw-prefix "214z" [r7])
157 (define-key sun-raw-prefix "216z" [r9])
158 (define-key sun-raw-prefix "218z" [r11])
159 (define-key sun-raw-prefix "220z" [r13])
160 (define-key sun-raw-prefix "222z" [r15])
161 (define-key sun-raw-prefix "193z" [redo])
162 (define-key sun-raw-prefix "194z" [props])
163 (define-key sun-raw-prefix "195z" [undo])
164 ;; (define-key sun-raw-prefix "196z" 'ignore) ; Expose-down
165 ;; (define-key sun-raw-prefix "197z" [put])
166 ;; (define-key sun-raw-prefix "198z" 'ignore) ; Open-down
167 ;; (define-key sun-raw-prefix "199z" [get])
168 (define-key sun-raw-prefix "200z" [find])
169 ;; (define-key sun-raw-prefix "201z" 'kill-region-and-unmark) ; Delete
170 (define-key sun-raw-prefix "224z" [f1])
171 (define-key sun-raw-prefix "225z" [f2])
172 (define-key sun-raw-prefix "226z" [f3])
173 (define-key sun-raw-prefix "227z" [f4])
174 (define-key sun-raw-prefix "228z" [f5])
175 (define-key sun-raw-prefix "229z" [f6])
176 (define-key sun-raw-prefix "230z" [f7])
177 (define-key sun-raw-prefix "231z" [f8])
178 (define-key sun-raw-prefix "232z" [f9])
179 (define-key sun-raw-prefix "233z" [f10])
180 (define-key sun-raw-prefix "234z" [f11])
181 (define-key sun-raw-prefix "235z" [f12])
182 (define-key sun-raw-prefix "A" [up]) ; R8
183 (define-key sun-raw-prefix "B" [down]) ; R14
184 (define-key sun-raw-prefix "C" [right]) ; R12
185 (define-key sun-raw-prefix "D" [left]) ; R10
186
187 (global-set-key [r3] 'backward-page)
188 (global-set-key [r6] 'forward-page)
189 (global-set-key [r7] 'beginning-of-buffer)
190 (global-set-key [r9] 'scroll-down)
191 (global-set-key [r11] 'recenter)
192 (global-set-key [r13] 'end-of-buffer)
193 (global-set-key [r15] 'scroll-up)
194 (global-set-key [redo] 'redraw-display) ;FIXME: collides with default.
195 (global-set-key [props] 'list-buffers)
196 (global-set-key [put] 'sun-select-region)
197 (global-set-key [get] 'sun-yank-selection)
198 (global-set-key [find] 'exchange-point-and-mark)
199 (global-set-key [f3] 'scroll-down-in-place)
200 (global-set-key [f4] 'scroll-up-in-place)
201 (global-set-key [f6] 'shrink-window)
202 (global-set-key [f7] 'enlarge-window)
203
204 (when sun-raw-prefix-hooks
205 (message "sun-raw-prefix-hooks is obsolete! Use term-setup-hook instead!")
206 (let ((hooks sun-raw-prefix-hooks))
207 (while hooks
208 (eval (car hooks))
209 (setq hooks (cdr hooks)))))
210
211 (define-key suntool-map "gr" 'beginning-of-buffer) ; r7
212 (define-key suntool-map "iR" 'backward-page) ; R9
213 (define-key suntool-map "ir" 'scroll-down) ; r9
214 (define-key suntool-map "kr" 'recenter) ; r11
215 (define-key suntool-map "mr" 'end-of-buffer) ; r13
216 (define-key suntool-map "oR" 'forward-page) ; R15
217 (define-key suntool-map "or" 'scroll-up) ; r15
218 (define-key suntool-map "b\M-L" 'rerun-prev-command) ; M-AGAIN
219 (define-key suntool-map "b\M-l" 'prev-complex-command) ; M-Again
220 (define-key suntool-map "bl" 'redraw-display) ; Again
221 (define-key suntool-map "cl" 'list-buffers) ; Props
222 (define-key suntool-map "dl" 'undo) ; Undo
223 (define-key suntool-map "el" 'ignore) ; Expose-Open
224 (define-key suntool-map "fl" 'sun-select-region) ; Put
225 (define-key suntool-map "f," 'copy-region-as-kill) ; C-Put
226 (define-key suntool-map "gl" 'ignore) ; Open-Open
227 (define-key suntool-map "hl" 'sun-yank-selection) ; Get
228 (define-key suntool-map "h," 'yank) ; C-Get
229 (define-key suntool-map "il" 'research-forward) ; Find
230 (define-key suntool-map "i," 're-search-forward) ; C-Find
231 (define-key suntool-map "i\M-l" 'research-backward) ; M-Find
232 (define-key suntool-map "i\M-," 're-search-backward) ; C-M-Find
233
234 (define-key suntool-map "jL" 'yank) ; DELETE
235 (define-key suntool-map "jl" 'kill-region-and-unmark) ; Delete
236 (define-key suntool-map "j\M-l" 'exchange-point-and-mark) ; M-Delete
237 (define-key suntool-map "j,"
238 (lambda () (interactive) (pop-mark))) ; C-Delete
239
240 (define-key suntool-map "fT" 'shrink-window-horizontally) ; T6
241 (define-key suntool-map "gT" 'enlarge-window-horizontally) ; T7
242 (define-key suntool-map "ft" 'shrink-window) ; t6
243 (define-key suntool-map "gt" 'enlarge-window) ; t7
244 (define-key suntool-map "cT" (lambda (n) (interactive "p") (scroll-down n)))
245 (define-key suntool-map "dT" (lambda (n) (interactive "p") (scroll-up n)))
246 (define-key suntool-map "ct" 'scroll-down-in-place) ; t3
247 (define-key suntool-map "dt" 'scroll-up-in-place) ; t4
248 (define-key ctl-x-map "*" suntool-map)
249
250 (when suntool-map-hooks
251 (message "suntool-map-hooks is obsolete! Use term-setup-hook instead!")
252 (let ((hooks suntool-map-hooks))
253 (while hooks
254 (eval (car hooks))
255 (setq hooks (cdr hooks)))))
256
257 (define-key ctl-x-map "\C-@" 'sun-mouse-once))
258
254(defun emacstool-init () 259(defun emacstool-init ()
255 "Set up Emacstool window, if you know you are in an emacstool." 260 "Set up Emacstool window, if you know you are in an emacstool."
256 ;; Make sure sun-mouse and sun-fns are loaded. 261 ;; Make sure sun-mouse and sun-fns are loaded.
@@ -272,7 +277,6 @@
272 (interactive) 277 (interactive)
273 (emacstool-init) 278 (emacstool-init)
274 (sun-mouse-handler)) ; Now, execute this mouse blip. 279 (sun-mouse-handler)) ; Now, execute this mouse blip.
275(define-key ctl-x-map "\C-@" 'sun-mouse-once)
276 280
277;;; arch-tag: db761d47-fd7d-42b4-aae1-04fa116b6ba6 281;;; arch-tag: db761d47-fd7d-42b4-aae1-04fa116b6ba6
278;;; sun.el ends here 282;;; sun.el ends here
diff --git a/lisp/term/tvi970.el b/lisp/term/tvi970.el
index c24464fbbd5..f7bc8c852a9 100644
--- a/lisp/term/tvi970.el
+++ b/lisp/term/tvi970.el
@@ -3,7 +3,7 @@
3;; Author: Jim Blandy <jimb@occs.cs.oberlin.edu>, January 1992 3;; Author: Jim Blandy <jimb@occs.cs.oberlin.edu>, January 1992
4;; Keywords: terminals 4;; Keywords: terminals
5 5
6;; Copyright (C) 1992 Free Software Foundation, Inc. 6;; Copyright (C) 1992, 2005 Free Software Foundation, Inc.
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
@@ -28,77 +28,80 @@
28 28
29;;; Code: 29;;; Code:
30 30
31(or (lookup-key function-key-map "\e[") 31(defun terminal-init-tvi970 ()
32 (define-key function-key-map "\e[" (make-keymap))) 32 "Terminal initialization function for tvi970."
33;; (or (lookup-key function-key-map "\eO") 33 (or (lookup-key function-key-map "\e[")
34;; (define-key function-key-map "\eO" (make-keymap))) 34 (define-key function-key-map "\e[" (make-keymap)))
35 35 ;; (or (lookup-key function-key-map "\eO")
36;; Miscellaneous keys 36 ;; (define-key function-key-map "\eO" (make-keymap)))
37(mapcar (function (lambda (key-binding) 37
38 (define-key function-key-map 38 ;; Miscellaneous keys
39 (car key-binding) (nth 1 key-binding)))) 39 (mapcar (function (lambda (key-binding)
40 '( 40 (define-key function-key-map
41 ;; These are set up by termcap or terminfo 41 (car key-binding) (nth 1 key-binding))))
42 ;; ("\eOP" [kp-f1]) 42 '(
43 ;; ("\eOQ" [kp-f2]) 43 ;; These are set up by termcap or terminfo
44 ;; ("\eOR" [kp-f3]) 44 ;; ("\eOP" [kp-f1])
45 ;; ("\eOS" [kp-f4]) 45 ;; ("\eOQ" [kp-f2])
46 46 ;; ("\eOR" [kp-f3])
47 ;; These might br set by terminfo 47 ;; ("\eOS" [kp-f4])
48 ("\e[H" [home]) 48
49 ("\e[Z" [backtab]) 49 ;; These might br set by terminfo
50 ("\e[i" [print]) 50 ("\e[H" [home])
51 ("\e[@" [insert]) 51 ("\e[Z" [backtab])
52 ("\e[L" [insertline]) 52 ("\e[i" [print])
53 ("\e[M" [deleteline]) 53 ("\e[@" [insert])
54 ("\e[U" [next]) ;; actually the `page' key 54 ("\e[L" [insertline])
55 55 ("\e[M" [deleteline])
56 ;; These won't be set up by either 56 ("\e[U" [next]) ;; actually the `page' key
57 ("\eOm" [kp-subtract]) 57
58 ("\eOl" [kp-separator]) 58 ;; These won't be set up by either
59 ("\eOn" [kp-decimal]) 59 ("\eOm" [kp-subtract])
60 ("\eOM" [kp-enter]) 60 ("\eOl" [kp-separator])
61 61 ("\eOn" [kp-decimal])
62 ;; These won't be set up by either either 62 ("\eOM" [kp-enter])
63 ("\e[K" [key_eol]) ;; Not an X keysym 63
64 ("\e[J" [key_eos]) ;; Not an X keysym 64 ;; These won't be set up by either either
65 ("\e[2J" [key_clear]) ;; Not an X keysym 65 ("\e[K" [key_eol]) ;; Not an X keysym
66 ("\e[P" [key_dc]) ;; Not an X keysym 66 ("\e[J" [key_eos]) ;; Not an X keysym
67 ("\e[g" [S-tab]) ;; Not an X keysym 67 ("\e[2J" [key_clear]) ;; Not an X keysym
68 ("\e[2N" [clearentry]) ;; Not an X keysym 68 ("\e[P" [key_dc]) ;; Not an X keysym
69 ("\e[2K" [S-clearentry]) ;; Not an X keysym 69 ("\e[g" [S-tab]) ;; Not an X keysym
70 ("\e[E" [?\C-j]) ;; Not an X keysym 70 ("\e[2N" [clearentry]) ;; Not an X keysym
71 ("\e[g" [S-backtab]) ;; Not an X keysym 71 ("\e[2K" [S-clearentry]) ;; Not an X keysym
72 ("\e[?1i" [key_sprint]) ;; Not an X keysym 72 ("\e[E" [?\C-j]) ;; Not an X keysym
73 ("\e[4h" [key_sic]) ;; Not an X keysym 73 ("\e[g" [S-backtab]) ;; Not an X keysym
74 ("\e[4l" [S-delete]) ;; Not an X keysym 74 ("\e[?1i" [key_sprint]) ;; Not an X keysym
75 ("\e[Q" [S-insertline]) ;; Not an X keysym 75 ("\e[4h" [key_sic]) ;; Not an X keysym
76 ("\e[1Q" [key_sdl]) ;; Not an X keysym 76 ("\e[4l" [S-delete]) ;; Not an X keysym
77 ("\e[19l" [key_seol]) ;; Not an X keysym 77 ("\e[Q" [S-insertline]) ;; Not an X keysym
78 ("\e[19h" [S-erasepage]) ;; Not an X keysym 78 ("\e[1Q" [key_sdl]) ;; Not an X keysym
79 ("\e[V" [S-page]) ;; Not an X keysym 79 ("\e[19l" [key_seol]) ;; Not an X keysym
80 ("\eS" [send]) ;; Not an X keysym 80 ("\e[19h" [S-erasepage]) ;; Not an X keysym
81 ("\e5" [S-send]) ;; Not an X keysym 81 ("\e[V" [S-page]) ;; Not an X keysym
82 )) 82 ("\eS" [send]) ;; Not an X keysym
83 83 ("\e5" [S-send]) ;; Not an X keysym
84;; The numeric keypad keys. 84 ))
85(let ((i 0)) 85
86 (while (< i 10) 86 ;; The numeric keypad keys.
87 (define-key function-key-map 87 (let ((i 0))
88 (format "\eO%c" (+ i ?p)) 88 (while (< i 10)
89 (vector (intern (format "kp-%d" i)))) 89 (define-key function-key-map
90 (setq i (1+ i)))) 90 (format "\eO%c" (+ i ?p))
91;; The numbered function keys. 91 (vector (intern (format "kp-%d" i))))
92(let ((i 0)) 92 (setq i (1+ i))))
93 (while (< i 16) 93 ;; The numbered function keys.
94 (define-key function-key-map 94 (let ((i 0))
95 (format "\e?%c" (+ i ?a)) 95 (while (< i 16)
96 (vector (intern (format "f%d" (1+ i))))) 96 (define-key function-key-map
97 (define-key function-key-map 97 (format "\e?%c" (+ i ?a))
98 (format "\e?%c" (+ i ?A)) 98 (vector (intern (format "f%d" (1+ i)))))
99 (vector (intern (format "S-f%d" (1+ i))))) 99 (define-key function-key-map
100 (setq i (1+ i)))) 100 (format "\e?%c" (+ i ?A))
101 101 (vector (intern (format "S-f%d" (1+ i)))))
102 (setq i (1+ i))))
103
104 (tvi970-set-keypad-mode 1))
102 105
103;;; Should keypad numbers send ordinary digits or distinct escape sequences? 106;;; Should keypad numbers send ordinary digits or distinct escape sequences?
104(defvar tvi970-keypad-numeric nil 107(defvar tvi970-keypad-numeric nil
@@ -121,7 +124,5 @@ With a negative argument, select numeric keypad mode."
121 (> (prefix-numeric-value arg) 0))) 124 (> (prefix-numeric-value arg) 0)))
122 (send-string-to-terminal (if tvi970-keypad-numeric "\e=" "\e>"))) 125 (send-string-to-terminal (if tvi970-keypad-numeric "\e=" "\e>")))
123 126
124(tvi970-set-keypad-mode 1)
125
126;;; arch-tag: c1334cf0-1462-41c3-a963-c077d175f8f0 127;;; arch-tag: c1334cf0-1462-41c3-a963-c077d175f8f0
127;;; tvi970.el ends here 128;;; tvi970.el ends here
diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el
index dfe011c0f6e..6b44e941813 100644
--- a/lisp/term/vt100.el
+++ b/lisp/term/vt100.el
@@ -36,8 +36,12 @@
36;;; Code: 36;;; Code:
37 37
38;; Set up function-key-map entries that termcap and terminfo don't know. 38;; Set up function-key-map entries that termcap and terminfo don't know.
39(load "term/lk201" nil t)
40 39
40
41(defun terminal-init-vt100 ()
42 "Terminal initialization function for vt100."
43 (load "term/lk201" nil t))
44
41;;; Controlling the screen width. 45;;; Controlling the screen width.
42(defvar vt100-wide-mode (= (frame-width) 132) 46(defvar vt100-wide-mode (= (frame-width) 132)
43 "t if vt100 is in 132-column mode.") 47 "t if vt100 is in 132-column mode.")
diff --git a/lisp/term/vt102.el b/lisp/term/vt102.el
index 887f63837eb..ad780ed5081 100644
--- a/lisp/term/vt102.el
+++ b/lisp/term/vt102.el
@@ -1,6 +1,8 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2 2
3(load "term/vt100" nil t) 3(defun terminal-init-vt102 ()
4 "Terminal initialization function for vt102."
5 (load "term/vt100" nil t))
4 6
5;;; arch-tag: 6e839cfc-125a-4574-82f1-c23a51f7c50f 7;;; arch-tag: 6e839cfc-125a-4574-82f1-c23a51f7c50f
6;;; vt102.el ends here 8;;; vt102.el ends here
diff --git a/lisp/term/vt125.el b/lisp/term/vt125.el
index 458e0dafc22..2221e597aed 100644
--- a/lisp/term/vt125.el
+++ b/lisp/term/vt125.el
@@ -1,6 +1,8 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2 2
3(load "term/vt100" nil t) 3(defun terminal-init-vt125 ()
4 "Terminal initialization function for vt125."
5 (load "term/vt100" nil t))
4 6
5;;; arch-tag: 1d92d70f-dd55-4a1d-9088-e215a4883801 7;;; arch-tag: 1d92d70f-dd55-4a1d-9088-e215a4883801
6;;; vt125.el ends here 8;;; vt125.el ends here
diff --git a/lisp/term/vt200.el b/lisp/term/vt200.el
index 0ff0a30f567..e1215d15023 100644
--- a/lisp/term/vt200.el
+++ b/lisp/term/vt200.el
@@ -1,10 +1,12 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2;; For our purposes we can treat the vt200 and vt100 almost alike. 2;; For our purposes we can treat the vt200 and vt100 almost alike.
3;; Most differences are handled by the termcap entry. 3;; Most differences are handled by the termcap entry.
4(load "term/vt100" nil t)
5 4
6;; Make F11 an escape key. 5(defun terminal-init-vt200 ()
7(define-key function-key-map "\e[23~" [?\e]) 6 "Terminal initialization function for vt200."
7 (load "term/vt100" nil t)
8 ;; Make F11 an escape key.
9 (define-key function-key-map "\e[23~" [?\e]))
8 10
9;;; arch-tag: 0f78f583-9f32-4237-b106-28bcfff21d89 11;;; arch-tag: 0f78f583-9f32-4237-b106-28bcfff21d89
10;;; vt200.el ends here 12;;; vt200.el ends here
diff --git a/lisp/term/vt201.el b/lisp/term/vt201.el
index d7deeaf11c7..315030ab687 100644
--- a/lisp/term/vt201.el
+++ b/lisp/term/vt201.el
@@ -1,10 +1,11 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2;; For our purposes we can treat the vt200 and vt100 almost alike. 2;; For our purposes we can treat the vt200 and vt100 almost alike.
3;; Most differences are handled by the termcap entry. 3;; Most differences are handled by the termcap entry.
4(load "term/vt100" nil t) 4(defun terminal-init-vt201 ()
5 5 "Terminal initialization function for vt201."
6;; Make F11 an escape key. 6 (load "term/vt100" nil t)
7(define-key function-key-map "\e[23~" [?\e]) 7 ;; Make F11 an escape key.
8 (define-key function-key-map "\e[23~" [?\e]))
8 9
9;;; arch-tag: a6abb38f-60ea-449e-a9e9-3fb8572c52ae 10;;; arch-tag: a6abb38f-60ea-449e-a9e9-3fb8572c52ae
10;;; vt201.el ends here 11;;; vt201.el ends here
diff --git a/lisp/term/vt220.el b/lisp/term/vt220.el
index 7ea1e3b57fa..cccd2a6dfb7 100644
--- a/lisp/term/vt220.el
+++ b/lisp/term/vt220.el
@@ -1,10 +1,11 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2;; For our purposes we can treat the vt200 and vt100 almost alike. 2;; For our purposes we can treat the vt200 and vt100 almost alike.
3;; Most differences are handled by the termcap entry. 3;; Most differences are handled by the termcap entry.
4(load "term/vt100" nil t) 4(defun terminal-init-vt220 ()
5 5 "Terminal initialization function for vt220."
6;; Make F11 an escape key. 6 (load "term/vt100" nil t)
7(define-key function-key-map "\e[23~" [?\e]) 7 ;; Make F11 an escape key.
8 (define-key function-key-map "\e[23~" [?\e]))
8 9
9;;; arch-tag: 98fc4867-a20d-46a1-a276-d7be31e49871 10;;; arch-tag: 98fc4867-a20d-46a1-a276-d7be31e49871
10;;; vt220.el ends here 11;;; vt220.el ends here
diff --git a/lisp/term/vt240.el b/lisp/term/vt240.el
index 05f0bebe50f..bb3931edac8 100644
--- a/lisp/term/vt240.el
+++ b/lisp/term/vt240.el
@@ -1,10 +1,11 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2;; For our purposes we can treat the vt200 and vt100 almost alike. 2;; For our purposes we can treat the vt200 and vt100 almost alike.
3;; Most differences are handled by the termcap entry. 3;; Most differences are handled by the termcap entry.
4(load "term/vt100" nil t) 4(defun terminal-init-vt240 ()
5 5 "Terminal initialization function for vt240."
6;; Make F11 an escape key. 6 (load "term/vt100" nil t)
7(define-key function-key-map "\e[23~" [?\e]) 7 ;; Make F11 an escape key.
8 (define-key function-key-map "\e[23~" [?\e]))
8 9
9;;; arch-tag: d9f88e9c-02dc-49ff-871c-a415f08e4eb7 10;;; arch-tag: d9f88e9c-02dc-49ff-871c-a415f08e4eb7
10;;; vt240.el ends here 11;;; vt240.el ends here
diff --git a/lisp/term/vt300.el b/lisp/term/vt300.el
index 871ed234bc6..ff600f47a1e 100644
--- a/lisp/term/vt300.el
+++ b/lisp/term/vt300.el
@@ -1,8 +1,9 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(load "term/vt100" nil t) 2(defun terminal-init-vt300 ()
3 3 "Terminal initialization function for vt300."
4;; Make F11 an escape key. 4 (load "term/vt100" nil t)
5(define-key function-key-map "\e[23~" [?\e]) 5 ;; Make F11 an escape key.
6 (define-key function-key-map "\e[23~" [?\e]))
6 7
7;;; arch-tag: 876831c9-a6f2-444a-b033-706e6fbc149f 8;;; arch-tag: 876831c9-a6f2-444a-b033-706e6fbc149f
8;;; vt300.el ends here 9;;; vt300.el ends here
diff --git a/lisp/term/vt320.el b/lisp/term/vt320.el
index c99b8672fc1..fb7772c7b5b 100644
--- a/lisp/term/vt320.el
+++ b/lisp/term/vt320.el
@@ -1,8 +1,9 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(load "term/vt100" nil t) 2(defun terminal-init-vt320 ()
3 3 "Terminal initialization function for vt320."
4;; Make F11 an escape key. 4 (load "term/vt100" nil t)
5(define-key function-key-map "\e[23~" [?\e]) 5 ;; Make F11 an escape key.
6 (define-key function-key-map "\e[23~" [?\e]))
6 7
7;;; arch-tag: f9f4c954-0b9e-45f9-b450-a320d32abd9c 8;;; arch-tag: f9f4c954-0b9e-45f9-b450-a320d32abd9c
8;;; vt320.el ends here 9;;; vt320.el ends here
diff --git a/lisp/term/vt400.el b/lisp/term/vt400.el
index 666266e2bf5..97c0c5d7372 100644
--- a/lisp/term/vt400.el
+++ b/lisp/term/vt400.el
@@ -1,8 +1,9 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(load "term/vt100" nil t) 2(defun terminal-init-vt400 ()
3 3 "Terminal initialization function for vt400."
4;; Make F11 an escape key. 4 (load "term/vt100" nil t)
5(define-key function-key-map "\e[23~" [?\e]) 5 ;; Make F11 an escape key.
6 (define-key function-key-map "\e[23~" [?\e]))
6 7
7;;; arch-tag: a70809c5-6b21-42cc-ba20-536683e5e7d5 8;;; arch-tag: a70809c5-6b21-42cc-ba20-536683e5e7d5
8;;; vt400.el ends here 9;;; vt400.el ends here
diff --git a/lisp/term/vt420.el b/lisp/term/vt420.el
index 9ed5fbe135b..65ffa759c17 100644
--- a/lisp/term/vt420.el
+++ b/lisp/term/vt420.el
@@ -1,8 +1,9 @@
1;; -*- no-byte-compile: t -*- 1;; -*- no-byte-compile: t -*-
2(load "term/vt100" nil t) 2(defun terminal-init-vt420 ()
3 3 "Terminal initialization function for vt420."
4;; Make F11 an escape key. 4 (load "term/vt100" nil t)
5(define-key function-key-map "\e[23~" [?\e]) 5 ;; Make F11 an escape key.
6 (define-key function-key-map "\e[23~" [?\e]))
6 7
7;;; arch-tag: df2f897c-3a12-4b3c-9259-df089f96c160 8;;; arch-tag: df2f897c-3a12-4b3c-9259-df089f96c160
8;;; vt420.el ends here 9;;; vt420.el ends here
diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el
index 562f5c728c0..64c489d7204 100644
--- a/lisp/term/wyse50.el
+++ b/lisp/term/wyse50.el
@@ -1,6 +1,6 @@
1;;; wyse50.el --- terminal support code for Wyse 50 -*- no-byte-compile: t -*- 1;;; wyse50.el --- terminal support code for Wyse 50 -*- no-byte-compile: t -*-
2 2
3;; Copyright (C) 1989, 1993, 1994 Free Software Foundation, Inc. 3;; Copyright (C) 1989, 1993, 1994, 2005 Free Software Foundation, Inc.
4 4
5;; Author: Daniel Pfeiffer <occitan@esperanto.org>, 5;; Author: Daniel Pfeiffer <occitan@esperanto.org>,
6;; Jim Blandy <jimb@occs.cs.oberlin.edu> 6;; Jim Blandy <jimb@occs.cs.oberlin.edu>
@@ -37,74 +37,92 @@
37 37
38;;; Code: 38;;; Code:
39 39
40(define-key function-key-map "\C-a" (make-keymap)) 40(defun terminal-init-wyse50 ()
41(mapcar (function (lambda (key-definition) 41 "Terminal initialization function for wyse50."
42 (define-key function-key-map 42 (define-key function-key-map "\C-a" (make-keymap))
43 (car key-definition) (nth 1 key-definition)))) 43 (mapcar (function (lambda (key-definition)
44 '( 44 (define-key function-key-map
45 ;; These might be set up by termcap and terminfo 45 (car key-definition) (nth 1 key-definition))))
46 ("\C-k" [up]) 46 '(
47 ("\C-j" [down]) 47 ;; These might be set up by termcap and terminfo
48 ("\C-l" [right]) 48 ("\C-k" [up])
49 ("\C-h" [left]) 49 ("\C-j" [down])
50 ("\^a@\^m" [f1]) 50 ("\C-l" [right])
51 ("\^aA\^m" [f2]) 51 ("\C-h" [left])
52 ("\^aB\^m" [f3]) 52 ("\^a@\^m" [f1])
53 ("\^aC\^m" [f4]) 53 ("\^aA\^m" [f2])
54 ("\^aD\^m" [f5]) 54 ("\^aB\^m" [f3])
55 ("\^aE\^m" [f6]) 55 ("\^aC\^m" [f4])
56 ("\^aF\^m" [f7]) 56 ("\^aD\^m" [f5])
57 ("\^aG\^m" [f8]) 57 ("\^aE\^m" [f6])
58 ("\^aH\^m" [f9]) 58 ("\^aF\^m" [f7])
59 59 ("\^aG\^m" [f8])
60 ;; These might be set up by terminfo 60 ("\^aH\^m" [f9])
61 ("\eK" [next]) 61
62 ("\eT" [clearline]) 62 ;; These might be set up by terminfo
63 ("\^^" [home]) 63 ("\eK" [next])
64 ("\e\^^" [end]) 64 ("\eT" [clearline])
65 ("\eQ" [insert]) 65 ("\^^" [home])
66 ("\eE" [insertline]) 66 ("\e\^^" [end])
67 ("\eR" [deleteline]) 67 ("\eQ" [insert])
68 ("\eP" [print]) 68 ("\eE" [insertline])
69 ("\er" [replace]) 69 ("\eR" [deleteline])
70 ("\^aI\^m" [f10]) 70 ("\eP" [print])
71 ("\^aJ\^m" [f11]) 71 ("\er" [replace])
72 ("\^aK\^m" [f12]) 72 ("\^aI\^m" [f10])
73 ("\^aL\^m" [f13]) 73 ("\^aJ\^m" [f11])
74 ("\^aM\^m" [f14]) 74 ("\^aK\^m" [f12])
75 ("\^aN\^m" [f15]) 75 ("\^aL\^m" [f13])
76 ("\^aO\^m" [f16]) 76 ("\^aM\^m" [f14])
77 ("\^a`\^m" [f17]) 77 ("\^aN\^m" [f15])
78 ("\^aa\^m" [f18]) 78 ("\^aO\^m" [f16])
79 ("\^ab\^m" [f19]) 79 ("\^a`\^m" [f17])
80 ("\^ac\^m" [f20]) 80 ("\^aa\^m" [f18])
81 ("\^ad\^m" [f21]) 81 ("\^ab\^m" [f19])
82 ("\^ae\^m" [f22]) 82 ("\^ac\^m" [f20])
83 ("\^af\^m" [f23]) 83 ("\^ad\^m" [f21])
84 ("\^ag\^m" [f24]) 84 ("\^ae\^m" [f22])
85 ("\^ah\^m" [f25]) 85 ("\^af\^m" [f23])
86 ("\^ai\^m" [f26]) 86 ("\^ag\^m" [f24])
87 ("\^aj\^m" [f27]) 87 ("\^ah\^m" [f25])
88 ("\^ak\^m" [f28]) 88 ("\^ai\^m" [f26])
89 ("\^al\^m" [f29]) 89 ("\^aj\^m" [f27])
90 ("\^am\^m" [f30]) 90 ("\^ak\^m" [f28])
91 ("\^an\^m" [f31]) 91 ("\^al\^m" [f29])
92 ("\^ao\^m" [f32]) 92 ("\^am\^m" [f30])
93 93 ("\^an\^m" [f31])
94 ;; Terminfo may know about these, but X won't 94 ("\^ao\^m" [f32])
95 ("\eI" [key-stab]) ;; Not an X keysym 95
96 ("\eJ" [key-snext]) ;; Not an X keysym 96 ;; Terminfo may know about these, but X won't
97 ("\eY" [key-clear]) ;; Not an X keysym 97 ("\eI" [key-stab]) ;; Not an X keysym
98 98 ("\eJ" [key-snext]) ;; Not an X keysym
99 ;; These are totally strange :-) 99 ("\eY" [key-clear]) ;; Not an X keysym
100 ("\eW" [?\C-?]) ;; Not an X keysym 100
101 ("\^a\^k\^m" [funct-up]) ;; Not an X keysym 101 ;; These are totally strange :-)
102 ("\^a\^j\^m" [funct-down]) ;; Not an X keysym 102 ("\eW" [?\C-?]) ;; Not an X keysym
103 ("\^a\^l\^m" [funct-right]) ;; Not an X keysym 103 ("\^a\^k\^m" [funct-up]) ;; Not an X keysym
104 ("\^a\^h\^m" [funct-left]) ;; Not an X keysym 104 ("\^a\^j\^m" [funct-down]) ;; Not an X keysym
105 ("\^a\^m\^m" [funct-return]) ;; Not an X keysym 105 ("\^a\^l\^m" [funct-right]) ;; Not an X keysym
106 ("\^a\^i\^m" [funct-tab]) ;; Not an X keysym 106 ("\^a\^h\^m" [funct-left]) ;; Not an X keysym
107)) 107 ("\^a\^m\^m" [funct-return]) ;; Not an X keysym
108 ("\^a\^i\^m" [funct-tab]) ;; Not an X keysym
109 ))
110
111 ;; Miscellaneous hacks
112
113 ;; This is an ugly hack for a nasty problem:
114 ;; Wyse 50 takes one character cell to store video attributes (which seems to
115 ;; explain width 79 rather than 80, column 1 is not used!!!).
116 ;; On killing (C-x C-c) the end inverse code (on column 1 of line 24)
117 ;; of the mode line is overwritten AFTER all the y-or-n questions.
118 ;; This causes the attribute to remain in effect until the mode line has
119 ;; scrolled of the screen. Suspending (C-z) does not cause this problem.
120 ;; On such terminals, Emacs should sacrifice the first and last character of
121 ;; each mode line, rather than a whole screen column!
122 (add-hook 'kill-emacs-hook
123 (function (lambda () (interactive)
124 (send-string-to-terminal
125 (concat "\ea23R" (1+ (frame-width)) "C\eG0"))))))
108 126
109(defun enable-arrow-keys () 127(defun enable-arrow-keys ()
110 "To be called by term-setup-hook. Overrides 6 Emacs standard keys 128 "To be called by term-setup-hook. Overrides 6 Emacs standard keys
@@ -131,22 +149,5 @@ M-r M-x move-to-window-line, Funct up-arrow or down-arrow are similar
131 ("\er" nil))) 149 ("\er" nil)))
132 (fset 'enable-arrow-keys nil)) 150 (fset 'enable-arrow-keys nil))
133 151
134
135;;; Miscellaneous hacks
136
137;;; This is an ugly hack for a nasty problem:
138;;; Wyse 50 takes one character cell to store video attributes (which seems to
139;;; explain width 79 rather than 80, column 1 is not used!!!).
140;;; On killing (C-x C-c) the end inverse code (on column 1 of line 24)
141;;; of the mode line is overwritten AFTER all the y-or-n questions.
142;;; This causes the attribute to remain in effect until the mode line has
143;;; scrolled of the screen. Suspending (C-z) does not cause this problem.
144;;; On such terminals, Emacs should sacrifice the first and last character of
145;;; each mode line, rather than a whole screen column!
146(add-hook 'kill-emacs-hook
147 (function (lambda () (interactive)
148 (send-string-to-terminal
149 (concat "\ea23R" (1+ (frame-width)) "C\eG0")))))
150
151;;; arch-tag: b6a05d37-eead-4cf6-b997-0f956c68881c 152;;; arch-tag: b6a05d37-eead-4cf6-b997-0f956c68881c
152;;; wyse50.el ends here 153;;; wyse50.el ends here
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 17d7cde0e8a..d0c26aa4b94 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -26,222 +26,238 @@
26 26
27;;; Code: 27;;; Code:
28 28
29;;; The terminal intialization C code file might have initialized 29(defun terminal-init-xterm ()
30;;; function keys F13->F60 from the termcap/terminfo information. On 30 "Terminal initialization function for xterm."
31;;; a PC-style keyboard these keys correspond to 31 ;; rxvt terminals sometimes set the TERM variable to "xterm", but
32;;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The 32 ;; rxvt's keybindings that are incompatible with xterm's. It is
33;;; code here subsitutes the corresponding defintions in 33 ;; better in that case to use rxvt's initializion function.
34;;; function-key-map. This substitution is needed because if a key 34 (if (and (getenv "COLORTERM")
35;;; definition if found in function-key-map, there are no further 35 (string-match "\\`rxvt" (getenv "COLORTERM")))
36;;; lookups in other keymaps. 36 (progn
37(substitute-key-definition [f13] [S-f1] function-key-map) 37 (load "term/rxvt")
38(substitute-key-definition [f14] [S-f2] function-key-map) 38 (terminal-init-rxvt))
39(substitute-key-definition [f15] [S-f3] function-key-map) 39
40(substitute-key-definition [f16] [S-f4] function-key-map) 40 ;; The terminal intialization C code file might have initialized
41(substitute-key-definition [f17] [S-f5] function-key-map) 41 ;; function keys F13->F60 from the termcap/terminfo information. On
42(substitute-key-definition [f18] [S-f6] function-key-map) 42 ;; a PC-style keyboard these keys correspond to
43(substitute-key-definition [f19] [S-f7] function-key-map) 43 ;; MODIFIER-FUNCTION_KEY, where modifier is S-, C, A-, C-S-. The
44(substitute-key-definition [f20] [S-f8] function-key-map) 44 ;; code here subsitutes the corresponding defintions in
45(substitute-key-definition [f21] [S-f9] function-key-map) 45 ;; function-key-map. This substitution is needed because if a key
46(substitute-key-definition [f22] [S-f10] function-key-map) 46 ;; definition if found in function-key-map, there are no further
47(substitute-key-definition [f23] [S-f11] function-key-map) 47 ;; lookups in other keymaps.
48(substitute-key-definition [f24] [S-f12] function-key-map) 48 (substitute-key-definition [f13] [S-f1] function-key-map)
49 49 (substitute-key-definition [f14] [S-f2] function-key-map)
50(substitute-key-definition [f25] [C-f1] function-key-map) 50 (substitute-key-definition [f15] [S-f3] function-key-map)
51(substitute-key-definition [f26] [C-f2] function-key-map) 51 (substitute-key-definition [f16] [S-f4] function-key-map)
52(substitute-key-definition [f27] [C-f3] function-key-map) 52 (substitute-key-definition [f17] [S-f5] function-key-map)
53(substitute-key-definition [f28] [C-f4] function-key-map) 53 (substitute-key-definition [f18] [S-f6] function-key-map)
54(substitute-key-definition [f29] [C-f5] function-key-map) 54 (substitute-key-definition [f19] [S-f7] function-key-map)
55(substitute-key-definition [f30] [C-f6] function-key-map) 55 (substitute-key-definition [f20] [S-f8] function-key-map)
56(substitute-key-definition [f31] [C-f7] function-key-map) 56 (substitute-key-definition [f21] [S-f9] function-key-map)
57(substitute-key-definition [f32] [C-f8] function-key-map) 57 (substitute-key-definition [f22] [S-f10] function-key-map)
58(substitute-key-definition [f33] [C-f9] function-key-map) 58 (substitute-key-definition [f23] [S-f11] function-key-map)
59(substitute-key-definition [f34] [C-f10] function-key-map) 59 (substitute-key-definition [f24] [S-f12] function-key-map)
60(substitute-key-definition [f35] [C-f11] function-key-map) 60
61(substitute-key-definition [f36] [C-f12] function-key-map) 61 (substitute-key-definition [f25] [C-f1] function-key-map)
62 62 (substitute-key-definition [f26] [C-f2] function-key-map)
63(substitute-key-definition [f37] [C-S-f1] function-key-map) 63 (substitute-key-definition [f27] [C-f3] function-key-map)
64(substitute-key-definition [f38] [C-S-f2] function-key-map) 64 (substitute-key-definition [f28] [C-f4] function-key-map)
65(substitute-key-definition [f39] [C-S-f3] function-key-map) 65 (substitute-key-definition [f29] [C-f5] function-key-map)
66(substitute-key-definition [f40] [C-S-f4] function-key-map) 66 (substitute-key-definition [f30] [C-f6] function-key-map)
67(substitute-key-definition [f41] [C-S-f5] function-key-map) 67 (substitute-key-definition [f31] [C-f7] function-key-map)
68(substitute-key-definition [f42] [C-S-f6] function-key-map) 68 (substitute-key-definition [f32] [C-f8] function-key-map)
69(substitute-key-definition [f43] [C-S-f7] function-key-map) 69 (substitute-key-definition [f33] [C-f9] function-key-map)
70(substitute-key-definition [f44] [C-S-f8] function-key-map) 70 (substitute-key-definition [f34] [C-f10] function-key-map)
71(substitute-key-definition [f45] [C-S-f9] function-key-map) 71 (substitute-key-definition [f35] [C-f11] function-key-map)
72(substitute-key-definition [f46] [C-S-f10] function-key-map) 72 (substitute-key-definition [f36] [C-f12] function-key-map)
73(substitute-key-definition [f47] [C-S-f11] function-key-map) 73
74(substitute-key-definition [f48] [C-S-f12] function-key-map) 74 (substitute-key-definition [f37] [C-S-f1] function-key-map)
75 75 (substitute-key-definition [f38] [C-S-f2] function-key-map)
76(substitute-key-definition [f49] [A-f1] function-key-map) 76 (substitute-key-definition [f39] [C-S-f3] function-key-map)
77(substitute-key-definition [f50] [A-f2] function-key-map) 77 (substitute-key-definition [f40] [C-S-f4] function-key-map)
78(substitute-key-definition [f51] [A-f3] function-key-map) 78 (substitute-key-definition [f41] [C-S-f5] function-key-map)
79(substitute-key-definition [f52] [A-f4] function-key-map) 79 (substitute-key-definition [f42] [C-S-f6] function-key-map)
80(substitute-key-definition [f53] [A-f5] function-key-map) 80 (substitute-key-definition [f43] [C-S-f7] function-key-map)
81(substitute-key-definition [f54] [A-f6] function-key-map) 81 (substitute-key-definition [f44] [C-S-f8] function-key-map)
82(substitute-key-definition [f55] [A-f7] function-key-map) 82 (substitute-key-definition [f45] [C-S-f9] function-key-map)
83(substitute-key-definition [f56] [A-f8] function-key-map) 83 (substitute-key-definition [f46] [C-S-f10] function-key-map)
84(substitute-key-definition [f57] [A-f9] function-key-map) 84 (substitute-key-definition [f47] [C-S-f11] function-key-map)
85(substitute-key-definition [f58] [A-f10] function-key-map) 85 (substitute-key-definition [f48] [C-S-f12] function-key-map)
86(substitute-key-definition [f59] [A-f11] function-key-map) 86
87(substitute-key-definition [f60] [A-f12] function-key-map) 87 (substitute-key-definition [f49] [A-f1] function-key-map)
88 88 (substitute-key-definition [f50] [A-f2] function-key-map)
89(let ((map (make-sparse-keymap))) 89 (substitute-key-definition [f51] [A-f3] function-key-map)
90 (define-key map "\e[A" [up]) 90 (substitute-key-definition [f52] [A-f4] function-key-map)
91 (define-key map "\e[B" [down]) 91 (substitute-key-definition [f53] [A-f5] function-key-map)
92 (define-key map "\e[C" [right]) 92 (substitute-key-definition [f54] [A-f6] function-key-map)
93 (define-key map "\e[D" [left]) 93 (substitute-key-definition [f55] [A-f7] function-key-map)
94 (define-key map "\e[1~" [home]) 94 (substitute-key-definition [f56] [A-f8] function-key-map)
95 (define-key map "\e[2~" [insert]) 95 (substitute-key-definition [f57] [A-f9] function-key-map)
96 (define-key map "\e[3~" [delete]) 96 (substitute-key-definition [f58] [A-f10] function-key-map)
97 (define-key map "\e[4~" [select]) 97 (substitute-key-definition [f59] [A-f11] function-key-map)
98 (define-key map "\e[5~" [prior]) 98 (substitute-key-definition [f60] [A-f12] function-key-map)
99 (define-key map "\e[6~" [next]) 99
100 (define-key map "\e[11~" [f1]) 100 (let ((map (make-sparse-keymap)))
101 (define-key map "\e[12~" [f2]) 101 (define-key map "\e[A" [up])
102 (define-key map "\e[13~" [f3]) 102 (define-key map "\e[B" [down])
103 (define-key map "\e[14~" [f4]) 103 (define-key map "\e[C" [right])
104 (define-key map "\e[15~" [f5]) 104 (define-key map "\e[D" [left])
105 (define-key map "\e[17~" [f6]) 105 (define-key map "\e[1~" [home])
106 (define-key map "\e[18~" [f7]) 106 (define-key map "\e[2~" [insert])
107 (define-key map "\e[19~" [f8]) 107 (define-key map "\e[3~" [delete])
108 (define-key map "\e[20~" [f9]) 108 (define-key map "\e[4~" [select])
109 (define-key map "\e[21~" [f10]) 109 (define-key map "\e[5~" [prior])
110 (define-key map "\e[23~" [f11]) 110 (define-key map "\e[6~" [next])
111 (define-key map "\e[24~" [f12]) 111 (define-key map "\e[11~" [f1])
112 (define-key map "\e[29~" [print]) 112 (define-key map "\e[12~" [f2])
113 113 (define-key map "\e[13~" [f3])
114 (define-key map "\eOP" [f1]) 114 (define-key map "\e[14~" [f4])
115 (define-key map "\eOQ" [f2]) 115 (define-key map "\e[15~" [f5])
116 (define-key map "\eOR" [f3]) 116 (define-key map "\e[17~" [f6])
117 (define-key map "\eOS" [f4]) 117 (define-key map "\e[18~" [f7])
118 118 (define-key map "\e[19~" [f8])
119 (define-key map "\eO2P" [S-f1]) 119 (define-key map "\e[20~" [f9])
120 (define-key map "\eO2Q" [S-f2]) 120 (define-key map "\e[21~" [f10])
121 (define-key map "\eO2R" [S-f3]) 121 (define-key map "\e[23~" [f11])
122 (define-key map "\eO2S" [S-f4]) 122 (define-key map "\e[24~" [f12])
123 (define-key map "\e[15;2~" [S-f5]) 123 (define-key map "\e[29~" [print])
124 (define-key map "\e[17;2~" [S-f6]) 124
125 (define-key map "\e[18;2~" [S-f7]) 125 (define-key map "\eOP" [f1])
126 (define-key map "\e[19;2~" [S-f8]) 126 (define-key map "\eOQ" [f2])
127 (define-key map "\e[20;2~" [S-f9]) 127 (define-key map "\eOR" [f3])
128 (define-key map "\e[21;2~" [S-f10]) 128 (define-key map "\eOS" [f4])
129 (define-key map "\e[23;2~" [S-f11]) 129
130 (define-key map "\e[24;2~" [S-f12]) 130 (define-key map "\eO2P" [S-f1])
131 131 (define-key map "\eO2Q" [S-f2])
132 (define-key map "\eO5P" [C-f1]) 132 (define-key map "\eO2R" [S-f3])
133 (define-key map "\eO5Q" [C-f2]) 133 (define-key map "\eO2S" [S-f4])
134 (define-key map "\eO5R" [C-f3]) 134 (define-key map "\e[15;2~" [S-f5])
135 (define-key map "\eO5S" [C-f4]) 135 (define-key map "\e[17;2~" [S-f6])
136 (define-key map "\e[15;5~" [C-f5]) 136 (define-key map "\e[18;2~" [S-f7])
137 (define-key map "\e[17;5~" [C-f6]) 137 (define-key map "\e[19;2~" [S-f8])
138 (define-key map "\e[18;5~" [C-f7]) 138 (define-key map "\e[20;2~" [S-f9])
139 (define-key map "\e[19;5~" [C-f8]) 139 (define-key map "\e[21;2~" [S-f10])
140 (define-key map "\e[20;5~" [C-f9]) 140 (define-key map "\e[23;2~" [S-f11])
141 (define-key map "\e[21;5~" [C-f10]) 141 (define-key map "\e[24;2~" [S-f12])
142 (define-key map "\e[23;5~" [C-f11]) 142
143 (define-key map "\e[24;5~" [C-f12]) 143 (define-key map "\eO5P" [C-f1])
144 144 (define-key map "\eO5Q" [C-f2])
145 (define-key map "\eO6P" [C-S-f1]) 145 (define-key map "\eO5R" [C-f3])
146 (define-key map "\eO6Q" [C-S-f2]) 146 (define-key map "\eO5S" [C-f4])
147 (define-key map "\eO6R" [C-S-f3]) 147 (define-key map "\e[15;5~" [C-f5])
148 (define-key map "\eO6S" [C-S-f4]) 148 (define-key map "\e[17;5~" [C-f6])
149 (define-key map "\e[15;6~" [C-S-f5]) 149 (define-key map "\e[18;5~" [C-f7])
150 (define-key map "\e[17;6~" [C-S-f6]) 150 (define-key map "\e[19;5~" [C-f8])
151 (define-key map "\e[18;6~" [C-S-f7]) 151 (define-key map "\e[20;5~" [C-f9])
152 (define-key map "\e[19;6~" [C-S-f8]) 152 (define-key map "\e[21;5~" [C-f10])
153 (define-key map "\e[20;6~" [C-S-f9]) 153 (define-key map "\e[23;5~" [C-f11])
154 (define-key map "\e[21;6~" [C-S-f10]) 154 (define-key map "\e[24;5~" [C-f12])
155 (define-key map "\e[23;6~" [C-S-f11]) 155
156 (define-key map "\e[24;6~" [C-S-f12]) 156 (define-key map "\eO6P" [C-S-f1])
157 157 (define-key map "\eO6Q" [C-S-f2])
158 (define-key map "\eO3P" [A-f1]) 158 (define-key map "\eO6R" [C-S-f3])
159 (define-key map "\eO3Q" [A-f2]) 159 (define-key map "\eO6S" [C-S-f4])
160 (define-key map "\eO3R" [A-f3]) 160 (define-key map "\e[15;6~" [C-S-f5])
161 (define-key map "\eO3S" [A-f4]) 161 (define-key map "\e[17;6~" [C-S-f6])
162 (define-key map "\e[15;3~" [A-f5]) 162 (define-key map "\e[18;6~" [C-S-f7])
163 (define-key map "\e[17;3~" [A-f6]) 163 (define-key map "\e[19;6~" [C-S-f8])
164 (define-key map "\e[18;3~" [A-f7]) 164 (define-key map "\e[20;6~" [C-S-f9])
165 (define-key map "\e[19;3~" [A-f8]) 165 (define-key map "\e[21;6~" [C-S-f10])
166 (define-key map "\e[20;3~" [A-f9]) 166 (define-key map "\e[23;6~" [C-S-f11])
167 (define-key map "\e[21;3~" [A-f10]) 167 (define-key map "\e[24;6~" [C-S-f12])
168 (define-key map "\e[23;3~" [A-f11]) 168
169 (define-key map "\e[24;3~" [A-f12]) 169 (define-key map "\eO3P" [A-f1])
170 170 (define-key map "\eO3Q" [A-f2])
171 (define-key map "\e[1;2A" [S-up]) 171 (define-key map "\eO3R" [A-f3])
172 (define-key map "\e[1;2B" [S-down]) 172 (define-key map "\eO3S" [A-f4])
173 (define-key map "\e[1;2C" [S-right]) 173 (define-key map "\e[15;3~" [A-f5])
174 (define-key map "\e[1;2D" [S-left]) 174 (define-key map "\e[17;3~" [A-f6])
175 (define-key map "\e[1;2F" [S-end]) 175 (define-key map "\e[18;3~" [A-f7])
176 (define-key map "\e[1;2H" [S-home]) 176 (define-key map "\e[19;3~" [A-f8])
177 177 (define-key map "\e[20;3~" [A-f9])
178 (define-key map "\e[1;5A" [C-up]) 178 (define-key map "\e[21;3~" [A-f10])
179 (define-key map "\e[1;5B" [C-down]) 179 (define-key map "\e[23;3~" [A-f11])
180 (define-key map "\e[1;5C" [C-right]) 180 (define-key map "\e[24;3~" [A-f12])
181 (define-key map "\e[1;5D" [C-left]) 181
182 (define-key map "\e[1;5F" [C-end]) 182 (define-key map "\e[1;2A" [S-up])
183 (define-key map "\e[1;5H" [C-home]) 183 (define-key map "\e[1;2B" [S-down])
184 184 (define-key map "\e[1;2C" [S-right])
185 (define-key map "\e[1;6A" [C-S-up]) 185 (define-key map "\e[1;2D" [S-left])
186 (define-key map "\e[1;6B" [C-S-down]) 186 (define-key map "\e[1;2F" [S-end])
187 (define-key map "\e[1;6C" [C-S-right]) 187 (define-key map "\e[1;2H" [S-home])
188 (define-key map "\e[1;6D" [C-S-left]) 188
189 (define-key map "\e[1;6F" [C-S-end]) 189 (define-key map "\e[1;5A" [C-up])
190 (define-key map "\e[1;6H" [C-S-home]) 190 (define-key map "\e[1;5B" [C-down])
191 191 (define-key map "\e[1;5C" [C-right])
192 (define-key map "\e[1;3A" [A-up]) 192 (define-key map "\e[1;5D" [C-left])
193 (define-key map "\e[1;3B" [A-down]) 193 (define-key map "\e[1;5F" [C-end])
194 (define-key map "\e[1;3C" [A-right]) 194 (define-key map "\e[1;5H" [C-home])
195 (define-key map "\e[1;3D" [A-left]) 195
196 (define-key map "\e[1;3F" [A-end]) 196 (define-key map "\e[1;6A" [C-S-up])
197 (define-key map "\e[1;3H" [A-home]) 197 (define-key map "\e[1;6B" [C-S-down])
198 198 (define-key map "\e[1;6C" [C-S-right])
199 (define-key map "\e[2;2~" [S-insert]) 199 (define-key map "\e[1;6D" [C-S-left])
200 (define-key map "\e[3;2~" [S-delete]) 200 (define-key map "\e[1;6F" [C-S-end])
201 (define-key map "\e[5;2~" [S-prior]) 201 (define-key map "\e[1;6H" [C-S-home])
202 (define-key map "\e[6;2~" [S-next]) 202
203 203 (define-key map "\e[1;3A" [A-up])
204 (define-key map "\e[2;5~" [C-insert]) 204 (define-key map "\e[1;3B" [A-down])
205 (define-key map "\e[3;5~" [C-delete]) 205 (define-key map "\e[1;3C" [A-right])
206 (define-key map "\e[5;5~" [C-prior]) 206 (define-key map "\e[1;3D" [A-left])
207 (define-key map "\e[6;5~" [C-next]) 207 (define-key map "\e[1;3F" [A-end])
208 208 (define-key map "\e[1;3H" [A-home])
209 (define-key map "\e[2;6~" [C-S-insert]) 209
210 (define-key map "\e[3;6~" [C-S-delete]) 210 (define-key map "\e[2;2~" [S-insert])
211 (define-key map "\e[5;6~" [C-S-prior]) 211 (define-key map "\e[3;2~" [S-delete])
212 (define-key map "\e[6;6~" [C-S-next]) 212 (define-key map "\e[5;2~" [S-prior])
213 213 (define-key map "\e[6;2~" [S-next])
214 (define-key map "\e[2;3~" [A-insert]) 214
215 (define-key map "\e[3;3~" [A-delete]) 215 (define-key map "\e[2;5~" [C-insert])
216 (define-key map "\e[5;3~" [A-prior]) 216 (define-key map "\e[3;5~" [C-delete])
217 (define-key map "\e[6;3~" [A-next]) 217 (define-key map "\e[5;5~" [C-prior])
218 218 (define-key map "\e[6;5~" [C-next])
219 (define-key map "\eOA" [up]) 219
220 (define-key map "\eOB" [down]) 220 (define-key map "\e[2;6~" [C-S-insert])
221 (define-key map "\eOC" [right]) 221 (define-key map "\e[3;6~" [C-S-delete])
222 (define-key map "\eOD" [left]) 222 (define-key map "\e[5;6~" [C-S-prior])
223 (define-key map "\eOF" [end]) 223 (define-key map "\e[6;6~" [C-S-next])
224 (define-key map "\eOH" [home]) 224
225 225 (define-key map "\e[2;3~" [A-insert])
226 (define-key map "\eO2A" [S-up]) 226 (define-key map "\e[3;3~" [A-delete])
227 (define-key map "\eO2B" [S-down]) 227 (define-key map "\e[5;3~" [A-prior])
228 (define-key map "\eO2C" [S-right]) 228 (define-key map "\e[6;3~" [A-next])
229 (define-key map "\eO2D" [S-left]) 229
230 (define-key map "\eO2F" [S-end]) 230 (define-key map "\eOA" [up])
231 (define-key map "\eO2H" [S-home]) 231 (define-key map "\eOB" [down])
232 232 (define-key map "\eOC" [right])
233 (define-key map "\eO5A" [C-up]) 233 (define-key map "\eOD" [left])
234 (define-key map "\eO5B" [C-down]) 234 (define-key map "\eOF" [end])
235 (define-key map "\eO5C" [C-right]) 235 (define-key map "\eOH" [home])
236 (define-key map "\eO5D" [C-left]) 236
237 (define-key map "\eO5F" [C-end]) 237 (define-key map "\eO2A" [S-up])
238 (define-key map "\eO5H" [C-home]) 238 (define-key map "\eO2B" [S-down])
239 239 (define-key map "\eO2C" [S-right])
240 ;; Use inheritance to let the main keymap override those defaults. 240 (define-key map "\eO2D" [S-left])
241 ;; This way we don't override terminfo-derived settings or settings 241 (define-key map "\eO2F" [S-end])
242 ;; made in the .emacs file. 242 (define-key map "\eO2H" [S-home])
243 (set-keymap-parent map (keymap-parent function-key-map)) 243
244 (set-keymap-parent function-key-map map)) 244 (define-key map "\eO5A" [C-up])
245 (define-key map "\eO5B" [C-down])
246 (define-key map "\eO5C" [C-right])
247 (define-key map "\eO5D" [C-left])
248 (define-key map "\eO5F" [C-end])
249 (define-key map "\eO5H" [C-home])
250
251 ;; Use inheritance to let the main keymap override those defaults.
252 ;; This way we don't override terminfo-derived settings or settings
253 ;; made in the .emacs file.
254 (set-keymap-parent map (keymap-parent function-key-map))
255 (set-keymap-parent function-key-map map))
256
257 ;; Do it!
258 (xterm-register-default-colors)
259 ;; This recomputes all the default faces given the colors we've just set up.
260 (tty-set-up-initial-frame-faces)))
245 261
246;; Set up colors, for those versions of xterm that support it. 262;; Set up colors, for those versions of xterm that support it.
247(defvar xterm-standard-colors 263(defvar xterm-standard-colors
@@ -359,38 +375,5 @@ versions of xterm."
359 ;; right colors, so clear them. 375 ;; right colors, so clear them.
360 (clear-face-cache))) 376 (clear-face-cache)))
361 377
362;; rxvt puts the default colors into an environment variable
363;; COLORFGBG. We use this to set the background mode in a more
364;; intelligent way than the default guesswork in startup.el.
365(defun xterm-rxvt-set-background-mode ()
366 "Set background mode as appropriate for the default rxvt colors."
367 (let ((fgbg (getenv "COLORFGBG"))
368 bg rgb)
369 (setq default-frame-background-mode 'light)
370 (when (and fgbg
371 (string-match ".*;\\([0-9][0-9]?\\)\\'" fgbg))
372 (setq bg (string-to-number (substring fgbg (match-beginning 1))))
373 ;; The next line assumes that xterm-standard-colors are ordered
374 ;; by the color index in the ascending order!
375 (setq rgb (car (cddr (nth bg xterm-standard-colors))))
376 ;; See the commentary in frame-set-background-mode about the
377 ;; computation below.
378 (if (< (apply '+ rgb)
379 ;; The following line assumes that white is the 15th
380 ;; color in xterm-standard-colors.
381 (* (apply '+ (car (cddr (nth 15 xterm-standard-colors)))) 0.6))
382 (setq default-frame-background-mode 'dark)))
383 (frame-set-background-mode (selected-frame))))
384
385;; Do it!
386(xterm-register-default-colors)
387;; If this xterm is actually a disguised rxvt, be more intelligent about
388;; determining the background mode.
389(and (getenv "COLORTERM")
390 (string-match "\\`rxvt" (getenv "COLORTERM"))
391 (xterm-rxvt-set-background-mode))
392;; This recomputes all the default faces given the colors we've just set up.
393(tty-set-up-initial-frame-faces)
394
395;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a 378;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a
396;;; xterm.el ends here 379;;; xterm.el ends here
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 309edde1749..c8991c07e54 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -159,7 +159,7 @@ This might return nil if the event did not occur over a buffer."
159With ARG, turn tooltip mode on if and only if ARG is positive." 159With ARG, turn tooltip mode on if and only if ARG is positive."
160 :global t 160 :global t
161 :init-value (not (or noninteractive 161 :init-value (not (or noninteractive
162 emacs-quick-startup 162 emacs-basic-display
163 (not (display-graphic-p)) 163 (not (display-graphic-p))
164 (not (fboundp 'x-show-tip)))) 164 (not (fboundp 'x-show-tip))))
165 :initialize 'custom-initialize-safe-default 165 :initialize 'custom-initialize-safe-default
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 5ed7f2165ce..f6a94881dfd 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,18 @@
12005-07-27 Luc Teirlinck <teirllm@auburn.edu>
2
3 * modes.texi (Defining Minor Modes): The keyword for the initial
4 value is :init-value, not :initial-value.
5
62005-07-23 Eli Zaretskii <eliz@gnu.org>
7
8 * loading.texi (Autoload): Make the `doctor' example be consistent
9 with what's in current loaddefs.el. Describe the "fn" magic in
10 the usage portion of the doc string.
11
122005-07-22 Richard M. Stallman <rms@gnu.org>
13
14 * internals.texi (Garbage Collection): Clarify previous change.
15
12005-07-21 Stefan Monnier <monnier@iro.umontreal.ca> 162005-07-21 Stefan Monnier <monnier@iro.umontreal.ca>
2 17
3 * internals.texi (Garbage Collection): Add gc-cons-percentage. 18 * internals.texi (Garbage Collection): Add gc-cons-percentage.
diff --git a/lispref/internals.texi b/lispref/internals.texi
index 61b643bd54a..5cc0fe6e497 100644
--- a/lispref/internals.texi
+++ b/lispref/internals.texi
@@ -369,15 +369,14 @@ until the subsequent garbage collection, at which time
369@end defopt 369@end defopt
370 370
371@defopt gc-cons-percentage 371@defopt gc-cons-percentage
372The value of this variable is the minimum portion of the heap that 372The value of this variable specifies the amount of consing before a
373should be allocated before a garbage collection takes place. It is 373garbage collection occurs, as a fraction of the current heap size.
374used only if the specified size is larger than 374This criterion and @code{gc-cons-threshold} apply in parallel, and
375@code{gc-cons-threshold}. 375garbage collection occurs only when both criteria are satisfied.
376 376
377As the heap size increases, the time to perform a garbage collection 377As the heap size increases, the time to perform a garbage collection
378increases, so in order to compensate, this variable tries to 378increases. Thus, it can be desirable to do them less frequently in
379correspondingly reduce the frequency of collection by letting Emacs 379proportion.
380allocate more memory between each collection.
381@end defopt 380@end defopt
382 381
383 The value returned by @code{garbage-collect} describes the amount of 382 The value returned by @code{garbage-collect} describes the amount of
diff --git a/lispref/loading.texi b/lispref/loading.texi
index 4049877e782..b64a0ce6736 100644
--- a/lispref/loading.texi
+++ b/lispref/loading.texi
@@ -481,17 +481,22 @@ autoloading with a magic comment:
481Here's what that produces in @file{loaddefs.el}: 481Here's what that produces in @file{loaddefs.el}:
482 482
483@smallexample 483@smallexample
484(autoload 'doctor "doctor" "\ 484(autoload (quote doctor) "doctor" "\
485Switch to *doctor* buffer and start giving psychotherapy." 485Switch to *doctor* buffer and start giving psychotherapy.
486 t) 486
487\(fn)" t nil)
487@end smallexample 488@end smallexample
488 489
489@noindent 490@noindent
491@cindex @code{fn} in function's documentation string
490The backslash and newline immediately following the double-quote are a 492The backslash and newline immediately following the double-quote are a
491convention used only in the preloaded uncompiled Lisp files such as 493convention used only in the preloaded uncompiled Lisp files such as
492@file{loaddefs.el}; they tell @code{make-docfile} to put the 494@file{loaddefs.el}; they tell @code{make-docfile} to put the
493documentation string in the @file{etc/DOC} file. @xref{Building Emacs}. 495documentation string in the @file{etc/DOC} file. @xref{Building Emacs}.
494See also the commentary in @file{lib-src/make-docfile.c}. 496See also the commentary in @file{lib-src/make-docfile.c}. @samp{(fn)}
497in the usage part of the documentation string is replaced with the
498function's name when the various help functions (@pxref{Help
499Functions}) display it.
495 500
496 If you write a function definition with an unusual macro that is not 501 If you write a function definition with an unusual macro that is not
497one of the known and recognized function definition methods, use of an 502one of the known and recognized function definition methods, use of an
diff --git a/lispref/modes.texi b/lispref/modes.texi
index 132c309cb96..053e7a511e8 100644
--- a/lispref/modes.texi
+++ b/lispref/modes.texi
@@ -1472,7 +1472,7 @@ When Hungry mode is enabled, the control delete key
1472gobbles all preceding whitespace except the last. 1472gobbles all preceding whitespace except the last.
1473See the command \\[hungry-electric-delete]." 1473See the command \\[hungry-electric-delete]."
1474 ;; The initial value. 1474 ;; The initial value.
1475 :initial-value nil 1475 :init-value nil
1476 ;; The indicator for the mode line. 1476 ;; The indicator for the mode line.
1477 :lighter " Hungry" 1477 :lighter " Hungry"
1478 ;; The minor mode bindings. 1478 ;; The minor mode bindings.
diff --git a/m4/getopt.m4 b/m4/getopt.m4
new file mode 100644
index 00000000000..dbcc44d9095
--- /dev/null
+++ b/m4/getopt.m4
@@ -0,0 +1,82 @@
1# getopt.m4 serial 10
2dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7# The getopt module assume you want GNU getopt, with getopt_long etc,
8# rather than vanilla POSIX getopt. This means your your code should
9# always include <getopt.h> for the getopt prototypes.
10
11AC_DEFUN([gl_GETOPT_SUBSTITUTE],
12[
13 AC_LIBOBJ([getopt])
14 AC_LIBOBJ([getopt1])
15 gl_GETOPT_SUBSTITUTE_HEADER
16 gl_PREREQ_GETOPT
17])
18
19AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
20[
21 GETOPT_H=getopt.h
22 AC_DEFINE([__GETOPT_PREFIX], [[rpl_]],
23 [Define to rpl_ if the getopt replacement functions and variables
24 should be used.])
25 AC_SUBST([GETOPT_H])
26])
27
28AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
29[
30 GETOPT_H=
31 AC_CHECK_HEADERS([getopt.h], [], [GETOPT_H=getopt.h])
32 if test -z "$GETOPT_H"; then
33 AC_CHECK_FUNCS([getopt_long_only], [], [GETOPT_H=getopt.h])
34 fi
35
36 dnl BSD getopt_long uses an incompatible method to reset option processing,
37 dnl and (as of 2004-10-15) mishandles optional option-arguments.
38 if test -z "$GETOPT_H"; then
39 AC_CHECK_DECL([optreset], [GETOPT_H=getopt.h], [], [#include <getopt.h>])
40 fi
41
42 dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
43 dnl option string (as of 2005-05-05).
44 if test -z "$GETOPT_H"; then
45 AC_CACHE_CHECK([for working GNU getopt function], [gl_cv_func_gnu_getopt],
46 [AC_RUN_IFELSE(
47 [AC_LANG_PROGRAM([#include <getopt.h>],
48 [[
49 char *myargv[3];
50 myargv[0] = "conftest";
51 myargv[1] = "-+";
52 myargv[2] = 0;
53 return getopt (2, myargv, "+a") != '?';
54 ]])],
55 [gl_cv_func_gnu_getopt=yes],
56 [gl_cv_func_gnu_getopt=no],
57 [dnl cross compiling - pessimistically guess based on decls
58 dnl Solaris 10 getopt doesn't handle `+' as a leading character in an
59 dnl option string (as of 2005-05-05).
60 AC_CHECK_DECL([getopt_clip],
61 [gl_cv_func_gnu_getopt=no], [gl_cv_func_gnu_getopt=yes],
62 [#include <getopt.h>])])])
63 if test "$gl_cv_func_gnu_getopt" = "no"; then
64 GETOPT_H=getopt.h
65 fi
66 fi
67])
68
69AC_DEFUN([gl_GETOPT_IFELSE],
70[
71 AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
72 AS_IF([test -n "$GETOPT_H"], [$1], [$2])
73])
74
75AC_DEFUN([gl_GETOPT], [gl_GETOPT_IFELSE([gl_GETOPT_SUBSTITUTE])])
76
77# Prerequisites of lib/getopt*.
78AC_DEFUN([gl_PREREQ_GETOPT], [:])
79
80ifelse(dnl Do not change this comment
81 arch-tag: 6c64a021-551c-4a7f-9c63-cd7e1ce54707
82)dnl
diff --git a/make-dist b/make-dist
index 9f2c4bb1280..3381ee770eb 100755
--- a/make-dist
+++ b/make-dist
@@ -6,7 +6,7 @@
6#### be distributed. This means that if you add a file with an odd name, 6#### be distributed. This means that if you add a file with an odd name,
7#### you should make sure that this script will include it. 7#### you should make sure that this script will include it.
8 8
9# Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2005 9# Copyright (C) 1995, 1997, 1998, 2000, 2001, 2002, 2005
10# Free Software Foundation, Inc. 10# Free Software Foundation, Inc.
11# 11#
12# This file is part of GNU Emacs. 12# This file is part of GNU Emacs.
@@ -323,7 +323,7 @@ for subdir in lisp site-lisp lispref lispintro \
323 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \ 323 nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
324 etc etc/e etc/images etc/images/gnus etc/images/smilies \ 324 etc etc/e etc/images etc/images/gnus etc/images/smilies \
325 etc/tree-widget etc/tree-widget/default etc/tree-widget/folder \ 325 etc/tree-widget etc/tree-widget/default etc/tree-widget/folder \
326 info man msdos vms mac mac/inc mac/inc/sys \ 326 info man m4 msdos vms mac mac/inc mac/inc/sys \
327 mac/src mac/Emacs.app mac/Emacs.app/Contents \ 327 mac/src mac/Emacs.app mac/Emacs.app/Contents \
328 mac/Emacs.app/Contents/MacOS mac/Emacs.app/Contents/Resources \ 328 mac/Emacs.app/Contents/MacOS mac/Emacs.app/Contents/Resources \
329 mac/Emacs.app/Contents/Resources/English.lproj 329 mac/Emacs.app/Contents/Resources/English.lproj
@@ -487,8 +487,13 @@ echo "Making links to \`lib-src'"
487 done 487 done
488 cd ../${tempdir}/lib-src 488 cd ../${tempdir}/lib-src
489 rm -f Makefile.c 489 rm -f Makefile.c
490 rm -f getopt.h
490 rm -f =* TAGS) 491 rm -f =* TAGS)
491 492
493echo "Making links to \`m4'"
494(cd m4
495 ln *.m4 ../${tempdir}/m4)
496
492echo "Making links to \`nt'" 497echo "Making links to \`nt'"
493(cd nt 498(cd nt
494 ln emacs.rc config.nt [a-z]*.c ../${tempdir}/nt 499 ln emacs.rc config.nt [a-z]*.c ../${tempdir}/nt
diff --git a/man/ChangeLog b/man/ChangeLog
index 43edb631b9c..5e72353f896 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,13 @@
12005-07-27 Reiner Steib <Reiner.Steib@gmx.de>
2
3 * gnus.texi (Startup Files): Fix name of gnus-site-init-file.
4 Mention that gnus-init-file is not read when Emacs is invoked with
5 --no-init-file or -q.
6
72005-07-22 Eli Zaretskii <eliz@gnu.org>
8
9 * files.texi (Quoted File Names): Add index entry.
10
12005-07-19 Carsten Dominik <dominik@science.uva.nl> 112005-07-19 Carsten Dominik <dominik@science.uva.nl>
2 12
3 * org.texi: Version 3.14 13 * org.texi: Version 3.14
diff --git a/man/files.texi b/man/files.texi
index c1f32bcf7ad..bc217de7b18 100644
--- a/man/files.texi
+++ b/man/files.texi
@@ -3256,6 +3256,7 @@ File Names}).
3256@section Quoted File Names 3256@section Quoted File Names
3257 3257
3258@cindex quoting file names 3258@cindex quoting file names
3259@cindex file names, quote special characters
3259 You can @dfn{quote} an absolute file name to prevent special 3260 You can @dfn{quote} an absolute file name to prevent special
3260characters and syntax in it from having their special effects. 3261characters and syntax in it from having their special effects.
3261The way to do this is to add @samp{/:} at the beginning. 3262The way to do this is to add @samp{/:} at the beginning.
diff --git a/man/gnus.texi b/man/gnus.texi
index b1d5be22651..3317b85e3e3 100644
--- a/man/gnus.texi
+++ b/man/gnus.texi
@@ -1468,15 +1468,17 @@ startup files. If you want to turn backup creation off, say something like:
1468@vindex gnus-init-file 1468@vindex gnus-init-file
1469@vindex gnus-site-init-file 1469@vindex gnus-site-init-file
1470When Gnus starts, it will read the @code{gnus-site-init-file} 1470When Gnus starts, it will read the @code{gnus-site-init-file}
1471(@file{.../site-lisp/gnus} by default) and @code{gnus-init-file} 1471(@file{.../site-lisp/gnus-init} by default) and @code{gnus-init-file}
1472(@file{~/.gnus} by default) files. These are normal Emacs Lisp files 1472(@file{~/.gnus} by default) files. These are normal Emacs Lisp files
1473and can be used to avoid cluttering your @file{~/.emacs} and 1473and can be used to avoid cluttering your @file{~/.emacs} and
1474@file{site-init} files with Gnus stuff. Gnus will also check for files 1474@file{site-init} files with Gnus stuff. Gnus will also check for files
1475with the same names as these, but with @file{.elc} and @file{.el} 1475with the same names as these, but with @file{.elc} and @file{.el}
1476suffixes. In other words, if you have set @code{gnus-init-file} to 1476suffixes. In other words, if you have set @code{gnus-init-file} to
1477@file{~/.gnus}, it will look for @file{~/.gnus.elc}, @file{~/.gnus.el}, 1477@file{~/.gnus}, it will look for @file{~/.gnus.elc}, @file{~/.gnus.el},
1478and finally @file{~/.gnus} (in this order). 1478and finally @file{~/.gnus} (in this order). If Emacs was invoked with
1479 1479the @option{-q} or @option{--no-init-file} options (@pxref{Initial
1480Options, ,Initial Options, emacs, The Emacs Manual}), Gnus doesn't read
1481@code{gnus-init-file}.
1480 1482
1481 1483
1482@node Auto Save 1484@node Auto Save
diff --git a/nt/.gitignore b/nt/.gitignore
index c577a6a341f..e371584228b 100644
--- a/nt/.gitignore
+++ b/nt/.gitignore
@@ -1,3 +1,5 @@
1*-spd 1*-spd
2*.pdb 2*.pdb
3.arch-inventory 3.arch-inventory
4makefile
5config.log
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 3d846d9f837..c3dec7b121b 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,18 @@
12005-07-29 Juanma Barranquero <lekktu@gmail.com>
2
3 * configure.bat: Don't create lisp/Makefile.unix.
4
52005-07-28 Juanma Barranquero <lekktu@gmail.com>
6
7 * .cvsignore: Add `makefile' and `config.log'.
8
92005-07-26 Paul Eggert <eggert@cs.ucla.edu>
10
11 Merge gnulib getopt implementation into Emacs.
12
13 * inc/gettext.h: Remove; no longer needed now that
14 lib-src/gettext.h exists.
15
12005-07-16 Eli Zaretskii <eliz@gnu.org> 162005-07-16 Eli Zaretskii <eliz@gnu.org>
2 17
3 * configure.bat: Finish config.log with a line that indicates that 18 * configure.bat: Finish config.log with a line that indicates that
diff --git a/nt/configure.bat b/nt/configure.bat
index bf78ed52bbe..b5f78f2ab51 100755
--- a/nt/configure.bat
+++ b/nt/configure.bat
@@ -1,7 +1,7 @@
1@echo off 1@echo off
2rem ---------------------------------------------------------------------- 2rem ----------------------------------------------------------------------
3rem Configuration script for MS Windows 95/98/Me and NT/2000/XP 3rem Configuration script for MS Windows 95/98/Me and NT/2000/XP
4rem Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 4rem Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
5rem Free Software Foundation, Inc. 5rem Free Software Foundation, Inc.
6 6
7rem This file is part of GNU Emacs. 7rem This file is part of GNU Emacs.
@@ -499,7 +499,6 @@ copy /b config.settings+%MAKECMD%.defs+..\src\makefile.w32-in ..\src\makefile
499copy /b config.settings+%MAKECMD%.defs+..\man\makefile.w32-in ..\man\makefile 499copy /b config.settings+%MAKECMD%.defs+..\man\makefile.w32-in ..\man\makefile
500copy /b config.settings+%MAKECMD%.defs+..\lispref\makefile.w32-in ..\lispref\makefile 500copy /b config.settings+%MAKECMD%.defs+..\lispref\makefile.w32-in ..\lispref\makefile
501copy /b config.settings+%MAKECMD%.defs+..\lispintro\makefile.w32-in ..\lispintro\makefile 501copy /b config.settings+%MAKECMD%.defs+..\lispintro\makefile.w32-in ..\lispintro\makefile
502if not exist ..\lisp\Makefile.unix rename ..\lisp\Makefile.in Makefile.unix
503if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile 502if exist ..\lisp\makefile rm -f ../lisp/[Mm]akefile
504copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile 503copy /b config.settings+%MAKECMD%.defs+..\lisp\makefile.w32-in ..\lisp\makefile
505rem Use the default (no-op) Makefile.in if the nt version is not present. 504rem Use the default (no-op) Makefile.in if the nt version is not present.
diff --git a/src/ChangeLog b/src/ChangeLog
index 5f04eec4768..e23f9bdacbf 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,85 @@
12005-07-28 Juanma Barranquero <lekktu@gmail.com>
2
3 * w32fns.c (my_set_window_pos, my_show_window): Don't declare.
4 (my_create_window, my_create_tip_window): Make static.
5
6 * w32term.c (my_show_window, my_set_window_pos, my_set_focus)
7 (my_set_foreground_window, my_destroy_window): Make static.
8
92005-07-26 Paul Eggert <eggert@cs.ucla.edu>
10
11 Merge gnulib getopt implementation into Emacs.
12
13 * s/cygwin.h (C_SWITCH_SYSTEM): Remove, since gettext.h is
14 now part of lib-src.
15
162005-07-26 Stefan Monnier <monnier@iro.umontreal.ca>
17
18 * eval.c (Fdefvar): Allow (defvar enable-multibyte-characters).
19
202005-07-25 Jason Rumney <jasonr@gnu.org>
21
22 * w32menu.c (w32_menu_display_help): Suppress tooltip when
23 navigating menus with the keyboard.
24
252005-07-23 Richard M. Stallman <rms@gnu.org>
26
27 * insdel.c (syms_of_insdel): staticpro combine_after_change_buffer.
28
29 * bytecode.c (MAYBE_GC): Test gc_cons_threshold and
30 gc_relative_threshold, one by one.
31
32 * keyboard.c (read_char): Test gc_cons_threshold.
33 (syms_of_keyboard): staticpro Qecho_area_clear_hook.
34
35 * eval.c (Feval, Ffuncall): Test gc_cons_threshold and
36 gc_relative_threshold, one by one.
37
38 * alloc.c (gc_cons_threshold): Not static.
39 (gc_cons_combined_threshold): Var deleted.
40 (gc_relative_threshold): New variable.
41 (Fgarbage_collect, init_alloc_once): Compute gc_relative_threshold
42 instead of gc_cons_combined_threshold.
43
44 * lisp.h (gc_cons_threshold, gc_relative_threshold): Declare.
45 (gc_cons_combined_threshold): Declaration deleted.
46
472005-07-23 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
48
49 * mac.c: Don't include stdlib.h or string.h.
50 (Fdo_applescript, Fmac_file_name_to_posix)
51 (Fmac_file_name_to_posix): Doc fixes.
52 [TARGET_API_MAC_CARBON] (Fmac_get_preference)
53 (Fmac_code_convert_string): Likewise.
54 [MAC_OSX] (init_mac_osx_environment): Fall back on terminal mode
55 if the executable is not contained in a bundle.
56
57 * macfns.c: Don't include stdlib.h or string.h. Include atimer.h.
58 (gray_width, gray_height): Remove defines.
59 (gray_bits, gray_bitmap_width, gray_bitmap_height)
60 (gray_bitmap_bits): Remove variables.
61 (lispy_function_keys): Remove extern.
62 (free_frame_menubar): Add extern.
63 (x_window_to_frame): Remove function.
64 (unwind_create_tip_frame): Add declaration.
65 (x_set_name_internal): New function.
66 (x_set_name, x_set_title): Use it.
67 (Fx_create_frame, Fx_display_grayscale_p, Fx_display_pixel_width)
68 (Fx_display_pixel_height, Fx_display_planes)
69 (Fx_display_color_cells, Fx_server_max_request_size)
70 (Fx_server_vendor, Fx_server_version, Fx_display_screens)
71 (Fx_display_mm_height, Fx_display_mm_width)
72 (Fx_display_backing_store, Fx_display_visual_class)
73 (Fx_display_save_under, Fx_synchronize, Fx_show_tip): Doc fixes.
74
75 * macmenu.c (Fx_popup_menu, Fx_popup_dialog): Doc fixes.
76
77 * macselect.c (Fx_own_selection_internal): Follow error
78 conventions.
79 (Fx_get_selection_internal, Fx_selection_owner_p)
80 (Fx_selection_exists_p): Doc fixes.
81 (syms_of_macselect) <selection-converter-alist>: Likewise.
82
12005-07-21 Juanma Barranquero <lekktu@gmail.com> 832005-07-21 Juanma Barranquero <lekktu@gmail.com>
2 84
3 * buffer.c (syms_of_buffer) <cursor-type>: Doc fix. 85 * buffer.c (syms_of_buffer) <cursor-type>: Doc fix.
diff --git a/src/alloc.c b/src/alloc.c
index 5c5252b1ba1..35bdfc8a93a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -172,10 +172,14 @@ EMACS_INT misc_objects_consed;
172EMACS_INT intervals_consed; 172EMACS_INT intervals_consed;
173EMACS_INT strings_consed; 173EMACS_INT strings_consed;
174 174
175/* Number of bytes of consing since GC before another GC should be done. */ 175/* Minimum number of bytes of consing since GC before next GC. */
176
177EMACS_INT gc_cons_threshold;
178
179/* Similar minimum, computed from Vgc_cons_percentage. */
180
181EMACS_INT gc_relative_threshold;
176 182
177static EMACS_INT gc_cons_threshold;
178EMACS_INT gc_cons_combined_threshold;
179static Lisp_Object Vgc_cons_percentage; 183static Lisp_Object Vgc_cons_percentage;
180 184
181/* Nonzero during GC. */ 185/* Nonzero during GC. */
@@ -4856,12 +4860,10 @@ returns nil, because real GC can't be done. */)
4856 if (gc_cons_threshold < 10000) 4860 if (gc_cons_threshold < 10000)
4857 gc_cons_threshold = 10000; 4861 gc_cons_threshold = 10000;
4858 4862
4859 gc_cons_combined_threshold = gc_cons_threshold;
4860
4861 if (FLOATP (Vgc_cons_percentage)) 4863 if (FLOATP (Vgc_cons_percentage))
4862 { /* Set gc_cons_combined_threshold. */ 4864 { /* Set gc_cons_combined_threshold. */
4863 EMACS_INT total = 0; 4865 EMACS_INT total = 0;
4864 EMACS_INT threshold; 4866
4865 total += total_conses * sizeof (struct Lisp_Cons); 4867 total += total_conses * sizeof (struct Lisp_Cons);
4866 total += total_symbols * sizeof (struct Lisp_Symbol); 4868 total += total_symbols * sizeof (struct Lisp_Symbol);
4867 total += total_markers * sizeof (union Lisp_Misc); 4869 total += total_markers * sizeof (union Lisp_Misc);
@@ -4871,10 +4873,10 @@ returns nil, because real GC can't be done. */)
4871 total += total_intervals * sizeof (struct interval); 4873 total += total_intervals * sizeof (struct interval);
4872 total += total_strings * sizeof (struct Lisp_String); 4874 total += total_strings * sizeof (struct Lisp_String);
4873 4875
4874 threshold = total * XFLOAT_DATA (Vgc_cons_percentage); 4876 gc_relative_threshold = total * XFLOAT_DATA (Vgc_cons_percentage);
4875 if (threshold > gc_cons_combined_threshold)
4876 gc_cons_combined_threshold = threshold;
4877 } 4877 }
4878 else
4879 gc_relative_threshold = 0;
4878 4880
4879 if (garbage_collection_messages) 4881 if (garbage_collection_messages)
4880 { 4882 {
@@ -5965,7 +5967,8 @@ init_alloc_once ()
5965 staticidx = 0; 5967 staticidx = 0;
5966 consing_since_gc = 0; 5968 consing_since_gc = 0;
5967 gc_cons_threshold = 100000 * sizeof (Lisp_Object); 5969 gc_cons_threshold = 100000 * sizeof (Lisp_Object);
5968 gc_cons_combined_threshold = gc_cons_threshold; 5970 gc_relative_threshold = 0;
5971
5969#ifdef VIRT_ADDR_VARIES 5972#ifdef VIRT_ADDR_VARIES
5970 malloc_sbrk_unused = 1<<22; /* A large number */ 5973 malloc_sbrk_unused = 1<<22; /* A large number */
5971 malloc_sbrk_used = 100000; /* as reasonable as any number */ 5974 malloc_sbrk_used = 100000; /* as reasonable as any number */
diff --git a/src/bytecode.c b/src/bytecode.c
index 580fdc67119..c9ab56b18d1 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -355,13 +355,14 @@ unmark_byte_stack ()
355/* Garbage collect if we have consed enough since the last time. 355/* Garbage collect if we have consed enough since the last time.
356 We do this at every branch, to avoid loops that never GC. */ 356 We do this at every branch, to avoid loops that never GC. */
357 357
358#define MAYBE_GC() \ 358#define MAYBE_GC() \
359 if (consing_since_gc > gc_cons_combined_threshold) \ 359 if (consing_since_gc > gc_cons_threshold \
360 { \ 360 && consing_since_gc > gc_relative_threshold) \
361 BEFORE_POTENTIAL_GC (); \ 361 { \
362 Fgarbage_collect (); \ 362 BEFORE_POTENTIAL_GC (); \
363 AFTER_POTENTIAL_GC (); \ 363 Fgarbage_collect (); \
364 } \ 364 AFTER_POTENTIAL_GC (); \
365 } \
365 else 366 else
366 367
367/* Check for jumping out of range. */ 368/* Check for jumping out of range. */
diff --git a/src/config.in b/src/config.in
index d3369641a8f..f2afed2ecb1 100644
--- a/src/config.in
+++ b/src/config.in
@@ -191,6 +191,12 @@ Boston, MA 02110-1301, USA. */
191/* Define to 1 if you have the `getloadavg' function. */ 191/* Define to 1 if you have the `getloadavg' function. */
192#undef HAVE_GETLOADAVG 192#undef HAVE_GETLOADAVG
193 193
194/* Define to 1 if you have the <getopt.h> header file. */
195#undef HAVE_GETOPT_H
196
197/* Define to 1 if you have the `getopt_long_only' function. */
198#undef HAVE_GETOPT_LONG_ONLY
199
194/* Define to 1 if you have the `getpagesize' function. */ 200/* Define to 1 if you have the `getpagesize' function. */
195#undef HAVE_GETPAGESIZE 201#undef HAVE_GETPAGESIZE
196 202
@@ -785,9 +791,9 @@ Boston, MA 02110-1301, USA. */
785/* If using the C implementation of alloca, define if you know the 791/* If using the C implementation of alloca, define if you know the
786 direction of stack growth for your system; otherwise it will be 792 direction of stack growth for your system; otherwise it will be
787 automatically deduced at run-time. 793 automatically deduced at run-time.
788 STACK_DIRECTION > 0 => grows toward higher addresses 794 STACK_DIRECTION > 0 => grows toward higher addresses
789 STACK_DIRECTION < 0 => grows toward lower addresses 795 STACK_DIRECTION < 0 => grows toward lower addresses
790 STACK_DIRECTION = 0 => direction of growth unknown */ 796 STACK_DIRECTION = 0 => direction of growth unknown */
791#undef STACK_DIRECTION 797#undef STACK_DIRECTION
792 798
793/* Define to 1 if you have the ANSI C header files. */ 799/* Define to 1 if you have the ANSI C header files. */
@@ -846,6 +852,10 @@ Boston, MA 02110-1301, USA. */
846/* Define for large files, on AIX-style hosts. */ 852/* Define for large files, on AIX-style hosts. */
847#undef _LARGE_FILES 853#undef _LARGE_FILES
848 854
855/* Define to rpl_ if the getopt replacement functions and variables should be
856 used. */
857#undef __GETOPT_PREFIX
858
849/* Define like PROTOTYPES; this can be used by system headers. */ 859/* Define like PROTOTYPES; this can be used by system headers. */
850#undef __PROTOTYPES 860#undef __PROTOTYPES
851 861
diff --git a/src/eval.c b/src/eval.c
index 26d1ce967a7..56fe670f1b1 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -807,18 +807,6 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
807 register Lisp_Object sym, tem, tail; 807 register Lisp_Object sym, tem, tail;
808 808
809 sym = Fcar (args); 809 sym = Fcar (args);
810 if (SYMBOL_CONSTANT_P (sym))
811 {
812 /* For updward compatibility, allow (defvar :foo (quote :foo)). */
813 tem = Fcar (Fcdr (args));
814 if (! (CONSP (tem)
815 && EQ (XCAR (tem), Qquote)
816 && CONSP (XCDR (tem))
817 && EQ (XCAR (XCDR (tem)), sym)))
818 error ("Constant symbol `%s' specified in defvar",
819 SDATA (SYMBOL_NAME (sym)));
820 }
821
822 tail = Fcdr (args); 810 tail = Fcdr (args);
823 if (!NILP (Fcdr (Fcdr (tail)))) 811 if (!NILP (Fcdr (Fcdr (tail))))
824 error ("Too many arguments"); 812 error ("Too many arguments");
@@ -826,6 +814,18 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
826 tem = Fdefault_boundp (sym); 814 tem = Fdefault_boundp (sym);
827 if (!NILP (tail)) 815 if (!NILP (tail))
828 { 816 {
817 if (SYMBOL_CONSTANT_P (sym))
818 {
819 /* For upward compatibility, allow (defvar :foo (quote :foo)). */
820 Lisp_Object tem = Fcar (tail);
821 if (! (CONSP (tem)
822 && EQ (XCAR (tem), Qquote)
823 && CONSP (XCDR (tem))
824 && EQ (XCAR (XCDR (tem)), sym)))
825 error ("Constant symbol `%s' specified in defvar",
826 SDATA (SYMBOL_NAME (sym)));
827 }
828
829 if (NILP (tem)) 829 if (NILP (tem))
830 Fset_default (sym, Feval (Fcar (tail))); 830 Fset_default (sym, Feval (Fcar (tail)));
831 else 831 else
@@ -2094,7 +2094,8 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0,
2094 return form; 2094 return form;
2095 2095
2096 QUIT; 2096 QUIT;
2097 if (consing_since_gc > gc_cons_combined_threshold) 2097 if (consing_since_gc > gc_cons_threshold
2098 && consing_since_gc > gc_relative_threshold)
2098 { 2099 {
2099 GCPRO1 (form); 2100 GCPRO1 (form);
2100 Fgarbage_collect (); 2101 Fgarbage_collect ();
@@ -2794,7 +2795,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2794 register int i; 2795 register int i;
2795 2796
2796 QUIT; 2797 QUIT;
2797 if (consing_since_gc > gc_cons_combined_threshold) 2798 if (consing_since_gc > gc_cons_threshold
2799 && consing_since_gc > gc_relative_threshold)
2798 Fgarbage_collect (); 2800 Fgarbage_collect ();
2799 2801
2800 if (++lisp_eval_depth > max_lisp_eval_depth) 2802 if (++lisp_eval_depth > max_lisp_eval_depth)
diff --git a/src/insdel.c b/src/insdel.c
index b4ec4d4ee34..981c45c2dbd 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -2426,6 +2426,7 @@ void
2426syms_of_insdel () 2426syms_of_insdel ()
2427{ 2427{
2428 staticpro (&combine_after_change_list); 2428 staticpro (&combine_after_change_list);
2429 staticpro (&combine_after_change_buffer);
2429 combine_after_change_list = Qnil; 2430 combine_after_change_list = Qnil;
2430 combine_after_change_buffer = Qnil; 2431 combine_after_change_buffer = Qnil;
2431 2432
diff --git a/src/keyboard.c b/src/keyboard.c
index 9da6ce92471..87a4ce3c997 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2778,7 +2778,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu)
2778 available, garbage collect if there has been enough 2778 available, garbage collect if there has been enough
2779 consing going on to make it worthwhile. */ 2779 consing going on to make it worthwhile. */
2780 if (!detect_input_pending_run_timers (0) 2780 if (!detect_input_pending_run_timers (0)
2781 && consing_since_gc > gc_cons_combined_threshold / 2) 2781 && consing_since_gc > gc_cons_threshold / 2)
2782 Fgarbage_collect (); 2782 Fgarbage_collect ();
2783 2783
2784 redisplay (); 2784 redisplay ();
@@ -11280,6 +11280,7 @@ might happen repeatedly and make Emacs nonfunctional. */);
11280 doc: /* Normal hook run when clearing the echo area. */); 11280 doc: /* Normal hook run when clearing the echo area. */);
11281#endif 11281#endif
11282 Qecho_area_clear_hook = intern ("echo-area-clear-hook"); 11282 Qecho_area_clear_hook = intern ("echo-area-clear-hook");
11283 staticpro (&Qecho_area_clear_hook);
11283 SET_SYMBOL_VALUE (Qecho_area_clear_hook, Qnil); 11284 SET_SYMBOL_VALUE (Qecho_area_clear_hook, Qnil);
11284 11285
11285 DEFVAR_LISP ("lucid-menu-bar-dirty-flag", &Vlucid_menu_bar_dirty_flag, 11286 DEFVAR_LISP ("lucid-menu-bar-dirty-flag", &Vlucid_menu_bar_dirty_flag,
diff --git a/src/lisp.h b/src/lisp.h
index aaee9dcc879..086cce3ce9f 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1886,9 +1886,11 @@ extern Lisp_Object Vascii_canon_table, Vascii_eqv_table;
1886 1886
1887extern int consing_since_gc; 1887extern int consing_since_gc;
1888 1888
1889/* Threshold for doing another gc. */ 1889/* Thresholds for doing another gc. */
1890 1890
1891extern EMACS_INT gc_cons_combined_threshold; 1891extern EMACS_INT gc_cons_threshold;
1892
1893extern EMACS_INT gc_relative_threshold;
1892 1894
1893/* Structure for recording stack slots that need marking. */ 1895/* Structure for recording stack slots that need marking. */
1894 1896
diff --git a/src/mac.c b/src/mac.c
index 11dd93aa88d..5558cbb797e 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -59,11 +59,9 @@ Boston, MA 02110-1301, USA. */
59#include <dirent.h> 59#include <dirent.h>
60#include <sys/types.h> 60#include <sys/types.h>
61#include <sys/stat.h> 61#include <sys/stat.h>
62#include <string.h>
63#include <pwd.h> 62#include <pwd.h>
64#include <grp.h> 63#include <grp.h>
65#include <sys/param.h> 64#include <sys/param.h>
66#include <stdlib.h>
67#include <fcntl.h> 65#include <fcntl.h>
68#if __MWERKS__ 66#if __MWERKS__
69#include <unistd.h> 67#include <unistd.h>
@@ -3447,7 +3445,7 @@ mac_get_object_from_code(OSType defCode)
3447 3445
3448DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, 1, 0, 3446DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, 1, 0,
3449 doc: /* Get the creator code of FILENAME as a four character string. */) 3447 doc: /* Get the creator code of FILENAME as a four character string. */)
3450 (filename) 3448 (filename)
3451 Lisp_Object filename; 3449 Lisp_Object filename;
3452{ 3450{
3453 OSErr status; 3451 OSErr status;
@@ -3502,7 +3500,7 @@ DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1,
3502 3500
3503DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0, 3501DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0,
3504 doc: /* Get the type code of FILENAME as a four character string. */) 3502 doc: /* Get the type code of FILENAME as a four character string. */)
3505 (filename) 3503 (filename)
3506 Lisp_Object filename; 3504 Lisp_Object filename;
3507{ 3505{
3508 OSErr status; 3506 OSErr status;
@@ -3559,7 +3557,7 @@ DEFUN ("mac-set-file-creator", Fmac_set_file_creator, Smac_set_file_creator, 1,
3559 doc: /* Set creator code of file FILENAME to CODE. 3557 doc: /* Set creator code of file FILENAME to CODE.
3560If non-nil, CODE must be a 4-character string. Otherwise, 'EMAx' is 3558If non-nil, CODE must be a 4-character string. Otherwise, 'EMAx' is
3561assumed. Return non-nil if successful. */) 3559assumed. Return non-nil if successful. */)
3562 (filename, code) 3560 (filename, code)
3563 Lisp_Object filename, code; 3561 Lisp_Object filename, code;
3564{ 3562{
3565 OSErr status; 3563 OSErr status;
@@ -3619,7 +3617,7 @@ assumed. Return non-nil if successful. */)
3619DEFUN ("mac-set-file-type", Fmac_set_file_type, Smac_set_file_type, 2, 2, 0, 3617DEFUN ("mac-set-file-type", Fmac_set_file_type, Smac_set_file_type, 2, 2, 0,
3620 doc: /* Set file code of file FILENAME to CODE. 3618 doc: /* Set file code of file FILENAME to CODE.
3621CODE must be a 4-character string. Return non-nil if successful. */) 3619CODE must be a 4-character string. Return non-nil if successful. */)
3622 (filename, code) 3620 (filename, code)
3623 Lisp_Object filename, code; 3621 Lisp_Object filename, code;
3624{ 3622{
3625 OSErr status; 3623 OSErr status;
@@ -3766,12 +3764,12 @@ do_applescript (char *script, char **result)
3766 3764
3767 3765
3768DEFUN ("do-applescript", Fdo_applescript, Sdo_applescript, 1, 1, 0, 3766DEFUN ("do-applescript", Fdo_applescript, Sdo_applescript, 1, 1, 0,
3769 doc: /* Compile and execute AppleScript SCRIPT and retrieve and return the result. 3767 doc: /* Compile and execute AppleScript SCRIPT and return the result.
3770If compilation and execution are successful, the resulting script 3768If compilation and execution are successful, the resulting script
3771value is returned as a string. Otherwise the function aborts and 3769value is returned as a string. Otherwise the function aborts and
3772displays the error message returned by the AppleScript scripting 3770displays the error message returned by the AppleScript scripting
3773component. */) 3771component. */)
3774 (script) 3772 (script)
3775 Lisp_Object script; 3773 Lisp_Object script;
3776{ 3774{
3777 char *result, *temp; 3775 char *result, *temp;
@@ -3811,16 +3809,15 @@ component. */)
3811 3809
3812DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix, 3810DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix,
3813 Smac_file_name_to_posix, 1, 1, 0, 3811 Smac_file_name_to_posix, 1, 1, 0,
3814 doc: /* Convert Macintosh filename to Posix form. */) 3812 doc: /* Convert Macintosh FILENAME to Posix form. */)
3815 (mac_filename) 3813 (filename)
3816 Lisp_Object mac_filename; 3814 Lisp_Object filename;
3817{ 3815{
3818 char posix_filename[MAXPATHLEN+1]; 3816 char posix_filename[MAXPATHLEN+1];
3819 3817
3820 CHECK_STRING (mac_filename); 3818 CHECK_STRING (filename);
3821 3819
3822 if (mac_to_posix_pathname (SDATA (mac_filename), posix_filename, 3820 if (mac_to_posix_pathname (SDATA (filename), posix_filename, MAXPATHLEN))
3823 MAXPATHLEN))
3824 return build_string (posix_filename); 3821 return build_string (posix_filename);
3825 else 3822 else
3826 return Qnil; 3823 return Qnil;
@@ -3829,16 +3826,15 @@ DEFUN ("mac-file-name-to-posix", Fmac_file_name_to_posix,
3829 3826
3830DEFUN ("posix-file-name-to-mac", Fposix_file_name_to_mac, 3827DEFUN ("posix-file-name-to-mac", Fposix_file_name_to_mac,
3831 Sposix_file_name_to_mac, 1, 1, 0, 3828 Sposix_file_name_to_mac, 1, 1, 0,
3832 doc: /* Convert Posix filename to Mac form. */) 3829 doc: /* Convert Posix FILENAME to Mac form. */)
3833 (posix_filename) 3830 (filename)
3834 Lisp_Object posix_filename; 3831 Lisp_Object filename;
3835{ 3832{
3836 char mac_filename[MAXPATHLEN+1]; 3833 char mac_filename[MAXPATHLEN+1];
3837 3834
3838 CHECK_STRING (posix_filename); 3835 CHECK_STRING (filename);
3839 3836
3840 if (posix_to_mac_pathname (SDATA (posix_filename), mac_filename, 3837 if (posix_to_mac_pathname (SDATA (filename), mac_filename, MAXPATHLEN))
3841 MAXPATHLEN))
3842 return build_string (mac_filename); 3838 return build_string (mac_filename);
3843 else 3839 else
3844 return Qnil; 3840 return Qnil;
@@ -3853,8 +3849,8 @@ DEFUN ("mac-get-preference", Fmac_get_preference, Smac_get_preference, 1, 4, 0,
3853 doc: /* Return the application preference value for KEY. 3849 doc: /* Return the application preference value for KEY.
3854KEY is either a string specifying a preference key, or a list of key 3850KEY is either a string specifying a preference key, or a list of key
3855strings. If it is a list, the (i+1)-th element is used as a key for 3851strings. If it is a list, the (i+1)-th element is used as a key for
3856the CFDictionary value obtained by the i-th element. If lookup is 3852the CFDictionary value obtained by the i-th element. Return nil if
3857failed at some stage, nil is returned. 3853lookup is failed at some stage.
3858 3854
3859Optional arg APPLICATION is an application ID string. If omitted or 3855Optional arg APPLICATION is an application ID string. If omitted or
3860nil, that stands for the current application. 3856nil, that stands for the current application.
@@ -3885,7 +3881,7 @@ CFDictionary. If HASH-BOUND is a negative integer or nil, always
3885generate alists. If HASH-BOUND >= 0, generate an alist if the number 3881generate alists. If HASH-BOUND >= 0, generate an alist if the number
3886of keys in the dictionary is smaller than HASH-BOUND, and a hash table 3882of keys in the dictionary is smaller than HASH-BOUND, and a hash table
3887otherwise. */) 3883otherwise. */)
3888 (key, application, format, hash_bound) 3884 (key, application, format, hash_bound)
3889 Lisp_Object key, application, format, hash_bound; 3885 Lisp_Object key, application, format, hash_bound;
3890{ 3886{
3891 CFStringRef app_id, key_str; 3887 CFStringRef app_id, key_str;
@@ -4122,9 +4118,8 @@ charset string, or an integer as a CFStringEncoding value.
4122On Mac OS X 10.2 and later, you can do Unicode Normalization by 4118On Mac OS X 10.2 and later, you can do Unicode Normalization by
4123specifying the optional argument NORMALIZATION-FORM with a symbol NFD, 4119specifying the optional argument NORMALIZATION-FORM with a symbol NFD,
4124NFKD, NFC, NFKC, HFS+D, or HFS+C. 4120NFKD, NFC, NFKC, HFS+D, or HFS+C.
4125On successful conversion, returns the result string, else returns 4121On successful conversion, return the result string, else return nil. */)
4126nil. */) 4122 (string, source, target, normalization_form)
4127 (string, source, target, normalization_form)
4128 Lisp_Object string, source, target, normalization_form; 4123 Lisp_Object string, source, target, normalization_form;
4129{ 4124{
4130 Lisp_Object result = Qnil; 4125 Lisp_Object result = Qnil;
@@ -4183,7 +4178,7 @@ nil. */)
4183 4178
4184DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, Smac_clear_font_name_table, 0, 0, 0, 4179DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, Smac_clear_font_name_table, 0, 0, 0,
4185 doc: /* Clear the font name table. */) 4180 doc: /* Clear the font name table. */)
4186 () 4181 ()
4187{ 4182{
4188 check_mac (); 4183 check_mac ();
4189 mac_clear_font_name_table (); 4184 mac_clear_font_name_table ();
@@ -4483,8 +4478,13 @@ init_mac_osx_environment ()
4483 app_bundle_pathname. */ 4478 app_bundle_pathname. */
4484 4479
4485 bundle = CFBundleGetMainBundle (); 4480 bundle = CFBundleGetMainBundle ();
4486 if (!bundle) 4481 if (!bundle || CFBundleGetIdentifier (bundle) == NULL)
4487 return; 4482 {
4483 /* We could not find the bundle identifier. For now, prevent
4484 the fatal error by bringing it up in the terminal. */
4485 inhibit_window_system = 1;
4486 return;
4487 }
4488 4488
4489 bundleURL = CFBundleCopyBundleURL (bundle); 4489 bundleURL = CFBundleCopyBundleURL (bundle);
4490 if (!bundleURL) 4490 if (!bundleURL)
diff --git a/src/macfns.c b/src/macfns.c
index a37ddde3458..615c312f3ac 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -21,58 +21,34 @@ Boston, MA 02110-1301, USA. */
21/* Contributed by Andrew Choi (akochoi@mac.com). */ 21/* Contributed by Andrew Choi (akochoi@mac.com). */
22 22
23#include <config.h> 23#include <config.h>
24
25#include <stdio.h> 24#include <stdio.h>
26#include <math.h> 25#include <math.h>
27#include <limits.h>
28#include <errno.h>
29 26
30#include "lisp.h" 27#include "lisp.h"
31#include "charset.h"
32#include "macterm.h" 28#include "macterm.h"
33#include "frame.h" 29#include "frame.h"
34#include "window.h" 30#include "window.h"
35#include "buffer.h" 31#include "buffer.h"
36#include "dispextern.h"
37#include "fontset.h"
38#include "intervals.h" 32#include "intervals.h"
33#include "dispextern.h"
39#include "keyboard.h" 34#include "keyboard.h"
40#include "blockinput.h" 35#include "blockinput.h"
41#include "epaths.h" 36#include <epaths.h>
42#include "termhooks.h" 37#include "charset.h"
43#include "coding.h" 38#include "coding.h"
39#include "fontset.h"
44#include "systime.h" 40#include "systime.h"
41#include "termhooks.h"
42#include "atimer.h"
45 43
46/* #include "bitmaps/gray.xbm" */
47#define gray_width 2
48#define gray_height 2
49static unsigned char gray_bits[] = {
50 0x01, 0x02};
51
52/*#include <commdlg.h>
53#include <shellapi.h>*/
54#include <ctype.h> 44#include <ctype.h>
55#include <sys/types.h> 45#include <sys/types.h>
56#include <sys/stat.h> 46#include <sys/stat.h>
47#include <limits.h>
48#include <errno.h>
57#include <sys/param.h> 49#include <sys/param.h>
58 50
59#include <stdlib.h> 51extern void free_frame_menubar ();
60#include <string.h>
61
62/*extern void free_frame_menubar ();
63extern double atof ();
64extern int w32_console_toggle_lock_key (int vk_code, Lisp_Object new_state);
65extern int quit_char;*/
66
67extern char *lispy_function_keys[];
68
69/* The gray bitmap `bitmaps/gray'. This is done because macterm.c uses
70 it, and including `bitmaps/gray' more than once is a problem when
71 config.h defines `static' as an empty replacement string. */
72
73int gray_bitmap_width = gray_width;
74int gray_bitmap_height = gray_height;
75unsigned char *gray_bitmap_bits = gray_bits;
76 52
77/* Non-zero means we're allowed to display an hourglass cursor. */ 53/* Non-zero means we're allowed to display an hourglass cursor. */
78 54
@@ -109,46 +85,13 @@ Lisp_Object Vx_no_window_manager;
109 85
110Lisp_Object Vx_pixel_size_width_font_regexp; 86Lisp_Object Vx_pixel_size_width_font_regexp;
111 87
112/* Evaluate this expression to rebuild the section of syms_of_macfns
113 that initializes and staticpros the symbols declared below. Note
114 that Emacs 18 has a bug that keeps C-x C-e from being able to
115 evaluate this expression.
116
117(progn
118 ;; Accumulate a list of the symbols we want to initialize from the
119 ;; declarations at the top of the file.
120 (goto-char (point-min))
121 (search-forward "/\*&&& symbols declared here &&&*\/\n")
122 (let (symbol-list)
123 (while (looking-at "Lisp_Object \\(Q[a-z_]+\\)")
124 (setq symbol-list
125 (cons (buffer-substring (match-beginning 1) (match-end 1))
126 symbol-list))
127 (forward-line 1))
128 (setq symbol-list (nreverse symbol-list))
129 ;; Delete the section of syms_of_... where we initialize the symbols.
130 (search-forward "\n /\*&&& init symbols here &&&*\/\n")
131 (let ((start (point)))
132 (while (looking-at "^ Q")
133 (forward-line 2))
134 (kill-region start (point)))
135 ;; Write a new symbol initialization section.
136 (while symbol-list
137 (insert (format " %s = intern (\"" (car symbol-list)))
138 (let ((start (point)))
139 (insert (substring (car symbol-list) 1))
140 (subst-char-in-region start (point) ?_ ?-))
141 (insert (format "\");\n staticpro (&%s);\n" (car symbol-list)))
142 (setq symbol-list (cdr symbol-list)))))
143
144 */
145
146/*&&& symbols declared here &&&*/
147Lisp_Object Qnone; 88Lisp_Object Qnone;
148Lisp_Object Qsuppress_icon; 89Lisp_Object Qsuppress_icon;
149Lisp_Object Qundefined_color; 90Lisp_Object Qundefined_color;
150Lisp_Object Qcancel_timer; 91Lisp_Object Qcancel_timer;
151 92
93/* In dispnew.c */
94
152extern Lisp_Object Vwindow_system_version; 95extern Lisp_Object Vwindow_system_version;
153 96
154#if 0 /* Use xstricmp instead. */ 97#if 0 /* Use xstricmp instead. */
@@ -243,40 +186,11 @@ check_x_display_info (frame)
243 186
244 return dpyinfo; 187 return dpyinfo;
245} 188}
246
247/* Return the Emacs frame-object corresponding to a mac window.
248 It could be the frame's main window or an icon window. */
249
250/* This function can be called during GC, so use GC_xxx type test macros. */
251
252struct frame *
253x_window_to_frame (dpyinfo, wdesc)
254 struct mac_display_info *dpyinfo;
255 WindowPtr wdesc;
256{
257 Lisp_Object tail, frame;
258 struct frame *f;
259
260 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
261 {
262 frame = XCAR (tail);
263 if (!GC_FRAMEP (frame))
264 continue;
265 f = XFRAME (frame);
266 if (!FRAME_W32_P (f) || FRAME_MAC_DISPLAY_INFO (f) != dpyinfo)
267 continue;
268 /*if (f->output_data.w32->hourglass_window == wdesc)
269 return f;*/
270
271 /* MAC_TODO: Check tooltips when supported. */
272 if (FRAME_MAC_WINDOW (f) == wdesc)
273 return f;
274 }
275 return 0;
276}
277 189
278 190
191
279static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); 192static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
193static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
280 194
281void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 195void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
282void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 196void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
@@ -302,6 +216,8 @@ static Lisp_Object x_default_scroll_bar_color_parameter P_ ((struct frame *,
302 216
303extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *)); 217extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *));
304 218
219
220
305/* Store the screen positions of frame F into XPTR and YPTR. 221/* Store the screen positions of frame F into XPTR and YPTR.
306 These are the positions of the containing window manager window, 222 These are the positions of the containing window manager window,
307 not Emacs's own window. */ 223 not Emacs's own window. */
@@ -1834,8 +1750,49 @@ x_set_tool_bar_lines (f, value, oldval)
1834} 1750}
1835 1751
1836 1752
1753
1754/* Set the Mac window title to NAME for frame F. */
1755
1756static void
1757x_set_name_internal (f, name)
1758 FRAME_PTR f;
1759 Lisp_Object name;
1760{
1761 if (FRAME_MAC_WINDOW (f))
1762 {
1763 if (STRING_MULTIBYTE (name))
1764#if TARGET_API_MAC_CARBON
1765 name = ENCODE_UTF_8 (name);
1766#else
1767 name = ENCODE_SYSTEM (name);
1768#endif
1769
1770 BLOCK_INPUT;
1771
1772 {
1773#if TARGET_API_MAC_CARBON
1774 CFStringRef windowTitle =
1775 cfstring_create_with_utf8_cstring (SDATA (name));
1776
1777 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
1778 CFRelease (windowTitle);
1779#else
1780 Str255 windowTitle;
1781 if (strlen (SDATA (name)) < 255)
1782 {
1783 strcpy (windowTitle, SDATA (name));
1784 c2pstr (windowTitle);
1785 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
1786 }
1787#endif
1788 }
1789
1790 UNBLOCK_INPUT;
1791 }
1792}
1793
1837/* Change the name of frame F to NAME. If NAME is nil, set F's name to 1794/* Change the name of frame F to NAME. If NAME is nil, set F's name to
1838 w32_id_name. 1795 mac_id_name.
1839 1796
1840 If EXPLICIT is non-zero, that indicates that lisp code is setting the 1797 If EXPLICIT is non-zero, that indicates that lisp code is setting the
1841 name; if NAME is a string, set F's name to NAME and set 1798 name; if NAME is a string, set F's name to NAME and set
@@ -1865,7 +1822,7 @@ x_set_name (f, name, explicit)
1865 else if (f->explicit_name) 1822 else if (f->explicit_name)
1866 return; 1823 return;
1867 1824
1868 /* If NAME is nil, set the name to the w32_id_name. */ 1825 /* If NAME is nil, set the name to the mac_id_name. */
1869 if (NILP (name)) 1826 if (NILP (name))
1870 { 1827 {
1871 /* Check for no change needed in this very common case 1828 /* Check for no change needed in this very common case
@@ -1889,37 +1846,7 @@ x_set_name (f, name, explicit)
1889 if (! NILP (f->title)) 1846 if (! NILP (f->title))
1890 name = f->title; 1847 name = f->title;
1891 1848
1892 if (FRAME_MAC_WINDOW (f)) 1849 x_set_name_internal (f, name);
1893 {
1894 if (STRING_MULTIBYTE (name))
1895#if TARGET_API_MAC_CARBON
1896 name = ENCODE_UTF_8 (name);
1897#else
1898 name = ENCODE_SYSTEM (name);
1899#endif
1900
1901 BLOCK_INPUT;
1902
1903 {
1904#if TARGET_API_MAC_CARBON
1905 CFStringRef windowTitle =
1906 cfstring_create_with_utf8_cstring (SDATA (name));
1907
1908 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
1909 CFRelease (windowTitle);
1910#else
1911 Str255 windowTitle;
1912 if (strlen (SDATA (name)) < 255)
1913 {
1914 strcpy (windowTitle, SDATA (name));
1915 c2pstr (windowTitle);
1916 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
1917 }
1918#endif
1919 }
1920
1921 UNBLOCK_INPUT;
1922 }
1923} 1850}
1924 1851
1925/* This function should be called when the user's lisp code has 1852/* This function should be called when the user's lisp code has
@@ -1970,38 +1897,10 @@ x_set_title (f, name, old_name)
1970 1897
1971 if (NILP (name)) 1898 if (NILP (name))
1972 name = f->name; 1899 name = f->name;
1900 else
1901 CHECK_STRING (name);
1973 1902
1974 if (FRAME_MAC_WINDOW (f)) 1903 x_set_name_internal (f, name);
1975 {
1976 if (STRING_MULTIBYTE (name))
1977#if TARGET_API_MAC_CARBON
1978 name = ENCODE_UTF_8 (name);
1979#else
1980 name = ENCODE_SYSTEM (name);
1981#endif
1982
1983 BLOCK_INPUT;
1984
1985 {
1986#if TARGET_API_MAC_CARBON
1987 CFStringRef windowTitle =
1988 cfstring_create_with_utf8_cstring (SDATA (name));
1989
1990 SetWindowTitleWithCFString (FRAME_MAC_WINDOW (f), windowTitle);
1991 CFRelease (windowTitle);
1992#else
1993 Str255 windowTitle;
1994 if (strlen (SDATA (name)) < 255)
1995 {
1996 strcpy (windowTitle, SDATA (name));
1997 c2pstr (windowTitle);
1998 SetWTitle (FRAME_MAC_WINDOW (f), windowTitle);
1999 }
2000#endif
2001 }
2002
2003 UNBLOCK_INPUT;
2004 }
2005} 1904}
2006 1905
2007void 1906void
@@ -2470,7 +2369,7 @@ unwind_create_frame (frame)
2470 2369
2471DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame, 2370DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
2472 1, 1, 0, 2371 1, 1, 0,
2473 doc: /* Make a new window, which is called a \"frame\" in Emacs terms. 2372 doc: /* Make a new window, which is called a "frame" in Emacs terms.
2474Returns an Emacs frame object. 2373Returns an Emacs frame object.
2475ALIST is an alist of frame parameters. 2374ALIST is an alist of frame parameters.
2476If the parameters specify that the frame should not have a minibuffer, 2375If the parameters specify that the frame should not have a minibuffer,
@@ -2479,7 +2378,7 @@ then `default-minibuffer-frame' must be a frame whose minibuffer can
2479be shared by the new frame. 2378be shared by the new frame.
2480 2379
2481This function is an internal primitive--use `make-frame' instead. */) 2380This function is an internal primitive--use `make-frame' instead. */)
2482 (parms) 2381 (parms)
2483 Lisp_Object parms; 2382 Lisp_Object parms;
2484{ 2383{
2485 struct frame *f; 2384 struct frame *f;
@@ -2804,7 +2703,7 @@ x_get_focus_frame (frame)
2804 2703
2805DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0, 2704DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
2806 doc: /* Internal function called by `color-defined-p', which see. */) 2705 doc: /* Internal function called by `color-defined-p', which see. */)
2807 (color, frame) 2706 (color, frame)
2808 Lisp_Object color, frame; 2707 Lisp_Object color, frame;
2809{ 2708{
2810 XColor foo; 2709 XColor foo;
@@ -2820,7 +2719,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
2820 2719
2821DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0, 2720DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
2822 doc: /* Internal function called by `color-values', which see. */) 2721 doc: /* Internal function called by `color-values', which see. */)
2823 (color, frame) 2722 (color, frame)
2824 Lisp_Object color, frame; 2723 Lisp_Object color, frame;
2825{ 2724{
2826 XColor foo; 2725 XColor foo;
@@ -2843,7 +2742,7 @@ DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
2843 2742
2844DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0, 2743DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
2845 doc: /* Internal function called by `display-color-p', which see. */) 2744 doc: /* Internal function called by `display-color-p', which see. */)
2846 (display) 2745 (display)
2847 Lisp_Object display; 2746 Lisp_Object display;
2848{ 2747{
2849 struct mac_display_info *dpyinfo = check_x_display_info (display); 2748 struct mac_display_info *dpyinfo = check_x_display_info (display);
@@ -2856,12 +2755,12 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
2856 2755
2857DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p, 2756DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p,
2858 0, 1, 0, 2757 0, 1, 0,
2859 doc: /* Return t if the X display supports shades of gray. 2758 doc: /* Return t if DISPLAY supports shades of gray.
2860Note that color displays do support shades of gray. 2759Note that color displays do support shades of gray.
2861The optional argument DISPLAY specifies which display to ask about. 2760The optional argument DISPLAY specifies which display to ask about.
2862DISPLAY should be either a frame or a display name (a string). 2761DISPLAY should be either a frame or a display name (a string).
2863If omitted or nil, that stands for the selected frame's display. */) 2762If omitted or nil, that stands for the selected frame's display. */)
2864 (display) 2763 (display)
2865 Lisp_Object display; 2764 Lisp_Object display;
2866{ 2765{
2867 struct mac_display_info *dpyinfo = check_x_display_info (display); 2766 struct mac_display_info *dpyinfo = check_x_display_info (display);
@@ -2874,11 +2773,11 @@ If omitted or nil, that stands for the selected frame's display. */)
2874 2773
2875DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width, 2774DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
2876 0, 1, 0, 2775 0, 1, 0,
2877 doc: /* Returns the width in pixels of the X display DISPLAY. 2776 doc: /* Returns the width in pixels of DISPLAY.
2878The optional argument DISPLAY specifies which display to ask about. 2777The optional argument DISPLAY specifies which display to ask about.
2879DISPLAY should be either a frame or a display name (a string). 2778DISPLAY should be either a frame or a display name (a string).
2880If omitted or nil, that stands for the selected frame's display. */) 2779If omitted or nil, that stands for the selected frame's display. */)
2881 (display) 2780 (display)
2882 Lisp_Object display; 2781 Lisp_Object display;
2883{ 2782{
2884 struct mac_display_info *dpyinfo = check_x_display_info (display); 2783 struct mac_display_info *dpyinfo = check_x_display_info (display);
@@ -2888,11 +2787,11 @@ If omitted or nil, that stands for the selected frame's display. */)
2888 2787
2889DEFUN ("x-display-pixel-height", Fx_display_pixel_height, 2788DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
2890 Sx_display_pixel_height, 0, 1, 0, 2789 Sx_display_pixel_height, 0, 1, 0,
2891 doc: /* Returns the height in pixels of the X display DISPLAY. 2790 doc: /* Returns the height in pixels of DISPLAY.
2892The optional argument DISPLAY specifies which display to ask about. 2791The optional argument DISPLAY specifies which display to ask about.
2893DISPLAY should be either a frame or a display name (a string). 2792DISPLAY should be either a frame or a display name (a string).
2894If omitted or nil, that stands for the selected frame's display. */) 2793If omitted or nil, that stands for the selected frame's display. */)
2895 (display) 2794 (display)
2896 Lisp_Object display; 2795 Lisp_Object display;
2897{ 2796{
2898 struct mac_display_info *dpyinfo = check_x_display_info (display); 2797 struct mac_display_info *dpyinfo = check_x_display_info (display);
@@ -2902,11 +2801,11 @@ If omitted or nil, that stands for the selected frame's display. */)
2902 2801
2903DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes, 2802DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
2904 0, 1, 0, 2803 0, 1, 0,
2905 doc: /* Returns the number of bitplanes of the display DISPLAY. 2804 doc: /* Returns the number of bitplanes of DISPLAY.
2906The optional argument DISPLAY specifies which display to ask about. 2805The optional argument DISPLAY specifies which display to ask about.
2907DISPLAY should be either a frame or a display name (a string). 2806DISPLAY should be either a frame or a display name (a string).
2908If omitted or nil, that stands for the selected frame's display. */) 2807If omitted or nil, that stands for the selected frame's display. */)
2909 (display) 2808 (display)
2910 Lisp_Object display; 2809 Lisp_Object display;
2911{ 2810{
2912 struct mac_display_info *dpyinfo = check_x_display_info (display); 2811 struct mac_display_info *dpyinfo = check_x_display_info (display);
@@ -2916,11 +2815,11 @@ If omitted or nil, that stands for the selected frame's display. */)
2916 2815
2917DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells, 2816DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
2918 0, 1, 0, 2817 0, 1, 0,
2919 doc: /* Returns the number of color cells of the display DISPLAY. 2818 doc: /* Returns the number of color cells of DISPLAY.
2920The optional argument DISPLAY specifies which display to ask about. 2819The optional argument DISPLAY specifies which display to ask about.
2921DISPLAY should be either a frame or a display name (a string). 2820DISPLAY should be either a frame or a display name (a string).
2922If omitted or nil, that stands for the selected frame's display. */) 2821If omitted or nil, that stands for the selected frame's display. */)
2923 (display) 2822 (display)
2924 Lisp_Object display; 2823 Lisp_Object display;
2925{ 2824{
2926 struct mac_display_info *dpyinfo = check_x_display_info (display); 2825 struct mac_display_info *dpyinfo = check_x_display_info (display);
@@ -2932,11 +2831,11 @@ If omitted or nil, that stands for the selected frame's display. */)
2932DEFUN ("x-server-max-request-size", Fx_server_max_request_size, 2831DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
2933 Sx_server_max_request_size, 2832 Sx_server_max_request_size,
2934 0, 1, 0, 2833 0, 1, 0,
2935 doc: /* Returns the maximum request size of the server of display DISPLAY. 2834 doc: /* Returns the maximum request size of the server of DISPLAY.
2936The optional argument DISPLAY specifies which display to ask about. 2835The optional argument DISPLAY specifies which display to ask about.
2937DISPLAY should be either a frame or a display name (a string). 2836DISPLAY should be either a frame or a display name (a string).
2938If omitted or nil, that stands for the selected frame's display. */) 2837If omitted or nil, that stands for the selected frame's display. */)
2939 (display) 2838 (display)
2940 Lisp_Object display; 2839 Lisp_Object display;
2941{ 2840{
2942 struct mac_display_info *dpyinfo = check_x_display_info (display); 2841 struct mac_display_info *dpyinfo = check_x_display_info (display);
@@ -2945,18 +2844,18 @@ If omitted or nil, that stands for the selected frame's display. */)
2945} 2844}
2946 2845
2947DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0, 2846DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
2948 doc: /* Returns the vendor ID string of the Mac OS system (Apple). 2847 doc: /* Returns the "vendor ID" string of the Mac OS system (Apple).
2949The optional argument DISPLAY specifies which display to ask about. 2848The optional argument DISPLAY specifies which display to ask about.
2950DISPLAY should be either a frame or a display name (a string). 2849DISPLAY should be either a frame or a display name (a string).
2951If omitted or nil, that stands for the selected frame's display. */) 2850If omitted or nil, that stands for the selected frame's display. */)
2952 (display) 2851 (display)
2953 Lisp_Object display; 2852 Lisp_Object display;
2954{ 2853{
2955 return build_string ("Apple Computers"); 2854 return build_string ("Apple Computers");
2956} 2855}
2957 2856
2958DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0, 2857DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
2959 doc: /* Returns the version numbers of the server of display DISPLAY. 2858 doc: /* Returns the version numbers of the Mac OS system.
2960The value is a list of three integers: the major and minor 2859The value is a list of three integers: the major and minor
2961version numbers, and the vendor-specific release 2860version numbers, and the vendor-specific release
2962number. See also the function `x-server-vendor'. 2861number. See also the function `x-server-vendor'.
@@ -2964,7 +2863,7 @@ number. See also the function `x-server-vendor'.
2964The optional argument DISPLAY specifies which display to ask about. 2863The optional argument DISPLAY specifies which display to ask about.
2965DISPLAY should be either a frame or a display name (a string). 2864DISPLAY should be either a frame or a display name (a string).
2966If omitted or nil, that stands for the selected frame's display. */) 2865If omitted or nil, that stands for the selected frame's display. */)
2967 (display) 2866 (display)
2968 Lisp_Object display; 2867 Lisp_Object display;
2969{ 2868{
2970 int mac_major_version; 2869 int mac_major_version;
@@ -2989,22 +2888,22 @@ If omitted or nil, that stands for the selected frame's display. */)
2989} 2888}
2990 2889
2991DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0, 2890DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
2992 doc: /* Return the number of screens on the server of display DISPLAY. 2891 doc: /* Return the number of screens on the server of DISPLAY.
2993The optional argument DISPLAY specifies which display to ask about. 2892The optional argument DISPLAY specifies which display to ask about.
2994DISPLAY should be either a frame or a display name (a string). 2893DISPLAY should be either a frame or a display name (a string).
2995If omitted or nil, that stands for the selected frame's display. */) 2894If omitted or nil, that stands for the selected frame's display. */)
2996 (display) 2895 (display)
2997 Lisp_Object display; 2896 Lisp_Object display;
2998{ 2897{
2999 return make_number (1); 2898 return make_number (1);
3000} 2899}
3001 2900
3002DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0, 2901DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 1, 0,
3003 doc: /* Return the height in millimeters of the X display DISPLAY. 2902 doc: /* Return the height in millimeters of DISPLAY.
3004The optional argument DISPLAY specifies which display to ask about. 2903The optional argument DISPLAY specifies which display to ask about.
3005DISPLAY should be either a frame or a display name (a string). 2904DISPLAY should be either a frame or a display name (a string).
3006If omitted or nil, that stands for the selected frame's display. */) 2905If omitted or nil, that stands for the selected frame's display. */)
3007 (display) 2906 (display)
3008 Lisp_Object display; 2907 Lisp_Object display;
3009{ 2908{
3010 /* MAC_TODO: this is an approximation, and only of the main display */ 2909 /* MAC_TODO: this is an approximation, and only of the main display */
@@ -3015,11 +2914,11 @@ If omitted or nil, that stands for the selected frame's display. */)
3015} 2914}
3016 2915
3017DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, 2916DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
3018 doc: /* Return the width in millimeters of the X display DISPLAY. 2917 doc: /* Return the width in millimeters of DISPLAY.
3019The optional argument DISPLAY specifies which display to ask about. 2918The optional argument DISPLAY specifies which display to ask about.
3020DISPLAY should be either a frame or a display name (a string). 2919DISPLAY should be either a frame or a display name (a string).
3021If omitted or nil, that stands for the selected frame's display. */) 2920If omitted or nil, that stands for the selected frame's display. */)
3022 (display) 2921 (display)
3023 Lisp_Object display; 2922 Lisp_Object display;
3024{ 2923{
3025 /* MAC_TODO: this is an approximation, and only of the main display */ 2924 /* MAC_TODO: this is an approximation, and only of the main display */
@@ -3031,12 +2930,12 @@ If omitted or nil, that stands for the selected frame's display. */)
3031 2930
3032DEFUN ("x-display-backing-store", Fx_display_backing_store, 2931DEFUN ("x-display-backing-store", Fx_display_backing_store,
3033 Sx_display_backing_store, 0, 1, 0, 2932 Sx_display_backing_store, 0, 1, 0,
3034 doc: /* Returns an indication of whether display DISPLAY does backing store. 2933 doc: /* Returns an indication of whether DISPLAY does backing store.
3035The value may be `always', `when-mapped', or `not-useful'. 2934The value may be `always', `when-mapped', or `not-useful'.
3036The optional argument DISPLAY specifies which display to ask about. 2935The optional argument DISPLAY specifies which display to ask about.
3037DISPLAY should be either a frame or a display name (a string). 2936DISPLAY should be either a frame or a display name (a string).
3038If omitted or nil, that stands for the selected frame's display. */) 2937If omitted or nil, that stands for the selected frame's display. */)
3039 (display) 2938 (display)
3040 Lisp_Object display; 2939 Lisp_Object display;
3041{ 2940{
3042 return intern ("not-useful"); 2941 return intern ("not-useful");
@@ -3044,14 +2943,14 @@ If omitted or nil, that stands for the selected frame's display. */)
3044 2943
3045DEFUN ("x-display-visual-class", Fx_display_visual_class, 2944DEFUN ("x-display-visual-class", Fx_display_visual_class,
3046 Sx_display_visual_class, 0, 1, 0, 2945 Sx_display_visual_class, 0, 1, 0,
3047 doc: /* Returns the visual class of the display DISPLAY. 2946 doc: /* Returns the visual class of DISPLAY.
3048The value is one of the symbols `static-gray', `gray-scale', 2947The value is one of the symbols `static-gray', `gray-scale',
3049`static-color', `pseudo-color', `true-color', or `direct-color'. 2948`static-color', `pseudo-color', `true-color', or `direct-color'.
3050 2949
3051The optional argument DISPLAY specifies which display to ask about. 2950The optional argument DISPLAY specifies which display to ask about.
3052DISPLAY should be either a frame or a display name (a string). 2951DISPLAY should be either a frame or a display name (a string).
3053If omitted or nil, that stands for the selected frame's display. */) 2952If omitted or nil, that stands for the selected frame's display. */)
3054 (display) 2953 (display)
3055 Lisp_Object display; 2954 Lisp_Object display;
3056{ 2955{
3057 struct mac_display_info *dpyinfo = check_x_display_info (display); 2956 struct mac_display_info *dpyinfo = check_x_display_info (display);
@@ -3075,11 +2974,11 @@ If omitted or nil, that stands for the selected frame's display. */)
3075 2974
3076DEFUN ("x-display-save-under", Fx_display_save_under, 2975DEFUN ("x-display-save-under", Fx_display_save_under,
3077 Sx_display_save_under, 0, 1, 0, 2976 Sx_display_save_under, 0, 1, 0,
3078 doc: /* Returns t if the display DISPLAY supports the save-under feature. 2977 doc: /* Returns t if DISPLAY supports the save-under feature.
3079The optional argument DISPLAY specifies which display to ask about. 2978The optional argument DISPLAY specifies which display to ask about.
3080DISPLAY should be either a frame or a display name (a string). 2979DISPLAY should be either a frame or a display name (a string).
3081If omitted or nil, that stands for the selected frame's display. */) 2980If omitted or nil, that stands for the selected frame's display. */)
3082 (display) 2981 (display)
3083 Lisp_Object display; 2982 Lisp_Object display;
3084{ 2983{
3085 return Qnil; 2984 return Qnil;
@@ -3169,7 +3068,7 @@ DISPLAY is the name of the display to connect to.
3169Optional second arg XRM-STRING is a string of resources in xrdb format. 3068Optional second arg XRM-STRING is a string of resources in xrdb format.
3170If the optional third arg MUST-SUCCEED is non-nil, 3069If the optional third arg MUST-SUCCEED is non-nil,
3171terminate Emacs if we can't open the connection. */) 3070terminate Emacs if we can't open the connection. */)
3172 (display, xrm_string, must_succeed) 3071 (display, xrm_string, must_succeed)
3173 Lisp_Object display, xrm_string, must_succeed; 3072 Lisp_Object display, xrm_string, must_succeed;
3174{ 3073{
3175 unsigned char *xrm_option; 3074 unsigned char *xrm_option;
@@ -3214,8 +3113,8 @@ DEFUN ("x-close-connection", Fx_close_connection,
3214 doc: /* Close the connection to DISPLAY's server. 3113 doc: /* Close the connection to DISPLAY's server.
3215For DISPLAY, specify either a frame or a display name (a string). 3114For DISPLAY, specify either a frame or a display name (a string).
3216If DISPLAY is nil, that stands for the selected frame's display. */) 3115If DISPLAY is nil, that stands for the selected frame's display. */)
3217 (display) 3116 (display)
3218 Lisp_Object display; 3117 Lisp_Object display;
3219{ 3118{
3220 struct mac_display_info *dpyinfo = check_x_display_info (display); 3119 struct mac_display_info *dpyinfo = check_x_display_info (display);
3221 int i; 3120 int i;
@@ -3241,7 +3140,7 @@ If DISPLAY is nil, that stands for the selected frame's display. */)
3241 3140
3242DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0, 3141DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
3243 doc: /* Return the list of display names that Emacs has connections to. */) 3142 doc: /* Return the list of display names that Emacs has connections to. */)
3244 () 3143 ()
3245{ 3144{
3246 Lisp_Object tail, result; 3145 Lisp_Object tail, result;
3247 3146
@@ -3253,13 +3152,8 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
3253} 3152}
3254 3153
3255DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0, 3154DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
3256 doc: /* If ON is non-nil, report errors as soon as the erring request is made. 3155 doc: /* This is a noop on Mac OS systems. */)
3257If ON is nil, allow buffering of requests. 3156 (on, display)
3258This is a noop on Mac OS systems.
3259The optional second argument DISPLAY specifies which display to act on.
3260DISPLAY should be either a frame or a display name (a string).
3261If DISPLAY is omitted or nil, that stands for the selected frame's display. */)
3262 (on, display)
3263 Lisp_Object display, on; 3157 Lisp_Object display, on;
3264{ 3158{
3265 return Qnil; 3159 return Qnil;
@@ -3318,7 +3212,7 @@ DEFUN ("x-delete-window-property", Fx_delete_window_property,
3318 Sx_delete_window_property, 1, 2, 0, 3212 Sx_delete_window_property, 1, 2, 0,
3319 doc: /* Remove window property PROP from X window of FRAME. 3213 doc: /* Remove window property PROP from X window of FRAME.
3320FRAME nil or omitted means use the selected frame. Value is PROP. */) 3214FRAME nil or omitted means use the selected frame. Value is PROP. */)
3321 (prop, frame) 3215 (prop, frame)
3322 Lisp_Object prop, frame; 3216 Lisp_Object prop, frame;
3323{ 3217{
3324#if 0 /* MAC_TODO : port window properties to Mac */ 3218#if 0 /* MAC_TODO : port window properties to Mac */
@@ -3346,7 +3240,7 @@ DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
3346If FRAME is nil or omitted, use the selected frame. Value is nil 3240If FRAME is nil or omitted, use the selected frame. Value is nil
3347if FRAME hasn't a property with name PROP or if PROP has no string 3241if FRAME hasn't a property with name PROP or if PROP has no string
3348value. */) 3242value. */)
3349 (prop, frame) 3243 (prop, frame)
3350 Lisp_Object prop, frame; 3244 Lisp_Object prop, frame;
3351{ 3245{
3352#if 0 /* MAC_TODO : port window properties to Mac */ 3246#if 0 /* MAC_TODO : port window properties to Mac */
@@ -3948,7 +3842,7 @@ compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
3948 3842
3949DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0, 3843DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
3950 doc: /* Show STRING in a "tooltip" window on frame FRAME. 3844 doc: /* Show STRING in a "tooltip" window on frame FRAME.
3951A tooltip window is a small X window displaying a string. 3845A tooltip window is a small window displaying a string.
3952 3846
3953FRAME nil or omitted means use the selected frame. 3847FRAME nil or omitted means use the selected frame.
3954 3848
@@ -3958,7 +3852,7 @@ change the tooltip's appearance.
3958Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil 3852Automatically hide the tooltip after TIMEOUT seconds. TIMEOUT nil
3959means use the default timeout of 5 seconds. 3853means use the default timeout of 5 seconds.
3960 3854
3961If the list of frame parameters PARAMS contains a `left' parameters, 3855If the list of frame parameters PARMS contains a `left' parameter,
3962the tooltip is displayed at that x-position. Otherwise it is 3856the tooltip is displayed at that x-position. Otherwise it is
3963displayed at the mouse position, with offset DX added (default is 5 if 3857displayed at the mouse position, with offset DX added (default is 5 if
3964DX isn't specified). Likewise for the y-position; if a `top' frame 3858DX isn't specified). Likewise for the y-position; if a `top' frame
@@ -4216,7 +4110,7 @@ Use a file selection dialog.
4216Select DEFAULT-FILENAME in the dialog's file selection box, if 4110Select DEFAULT-FILENAME in the dialog's file selection box, if
4217specified. Ensure that file exists if MUSTMATCH is non-nil. 4111specified. Ensure that file exists if MUSTMATCH is non-nil.
4218If ONLY-DIR-P is non-nil, the user can only select directories. */) 4112If ONLY-DIR-P is non-nil, the user can only select directories. */)
4219 (prompt, dir, default_filename, mustmatch, only_dir_p) 4113 (prompt, dir, default_filename, mustmatch, only_dir_p)
4220 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; 4114 Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
4221{ 4115{
4222 struct frame *f = SELECTED_FRAME (); 4116 struct frame *f = SELECTED_FRAME ();
diff --git a/src/macmenu.c b/src/macmenu.c
index ab266f6f0b5..c7ee0dfaf21 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -611,37 +611,48 @@ cleanup_popup_menu (arg)
611 611
612DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, 612DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0,
613 doc: /* Pop up a deck-of-cards menu and return user's selection. 613 doc: /* Pop up a deck-of-cards menu and return user's selection.
614POSITION is a position specification. This is either a mouse button 614POSITION is a position specification. This is either a mouse button event
615event or a list ((XOFFSET YOFFSET) WINDOW) where XOFFSET and YOFFSET 615or a list ((XOFFSET YOFFSET) WINDOW)
616are positions in pixels from the top left corner of WINDOW's frame 616where XOFFSET and YOFFSET are positions in pixels from the top left
617\(WINDOW may be a frame object instead of a window). This controls the 617corner of WINDOW. (WINDOW may be a window or a frame object.)
618position of the center of the first line in the first pane of the 618This controls the position of the top left of the menu as a whole.
619menu, not the top left of the menu as a whole. If POSITION is t, it 619If POSITION is t, it means to use the current mouse position.
620means to use the current mouse position.
621 620
622MENU is a specifier for a menu. For the simplest case, MENU is a keymap. 621MENU is a specifier for a menu. For the simplest case, MENU is a keymap.
623The menu items come from key bindings that have a menu string as well as 622The menu items come from key bindings that have a menu string as well as
624a definition; actually, the \"definition\" in such a key binding looks like 623a definition; actually, the "definition" in such a key binding looks like
625\(STRING . REAL-DEFINITION). To give the menu a title, put a string into 624\(STRING . REAL-DEFINITION). To give the menu a title, put a string into
626the keymap as a top-level element. 625the keymap as a top-level element.
627 626
628If REAL-DEFINITION is nil, that puts a nonselectable string in the menu. 627If REAL-DEFINITION is nil, that puts a nonselectable string in the menu.
629Otherwise, REAL-DEFINITION should be a valid key binding definition. 628Otherwise, REAL-DEFINITION should be a valid key binding definition.
630 629
631You can also use a list of keymaps as MENU. Then each keymap makes a 630You can also use a list of keymaps as MENU.
632separate pane. When MENU is a keymap or a list of keymaps, the return 631 Then each keymap makes a separate pane.
633value is a list of events.
634 632
635Alternatively, you can specify a menu of multiple panes with a list of 633When MENU is a keymap or a list of keymaps, the return value is the
636the form (TITLE PANE1 PANE2...), where each pane is a list of 634list of events corresponding to the user's choice. Note that
637form (TITLE ITEM1 ITEM2...). 635`x-popup-menu' does not actually execute the command bound to that
638Each ITEM is normally a cons cell (STRING . VALUE); but a string can 636sequence of events.
639appear as an item--that makes a nonselectable line in the menu. 637
638Alternatively, you can specify a menu of multiple panes
639 with a list of the form (TITLE PANE1 PANE2...),
640where each pane is a list of form (TITLE ITEM1 ITEM2...).
641Each ITEM is normally a cons cell (STRING . VALUE);
642but a string can appear as an item--that makes a nonselectable line
643in the menu.
640With this form of menu, the return value is VALUE from the chosen item. 644With this form of menu, the return value is VALUE from the chosen item.
641 645
642If POSITION is nil, don't display the menu at all, just precalculate the 646If POSITION is nil, don't display the menu at all, just precalculate the
643cached information about equivalent key sequences. */) 647cached information about equivalent key sequences.
644 (position, menu) 648
649If the user gets rid of the menu without making a valid choice, for
650instance by clicking the mouse away from a valid choice or by typing
651keyboard input, then this normally results in a quit and
652`x-popup-menu' does not return. But if POSITION is a mouse button
653event (indicating that the user invoked the menu with the mouse) then
654no quit occurs and `x-popup-menu' returns nil. */)
655 (position, menu)
645 Lisp_Object position, menu; 656 Lisp_Object position, menu;
646{ 657{
647 Lisp_Object keymap, tem; 658 Lisp_Object keymap, tem;
@@ -840,7 +851,7 @@ If POSITION is t, it means to use the frame the mouse is on.
840The dialog box appears in the middle of the specified frame. 851The dialog box appears in the middle of the specified frame.
841 852
842CONTENTS specifies the alternatives to display in the dialog box. 853CONTENTS specifies the alternatives to display in the dialog box.
843It is a list of the form (TITLE ITEM1 ITEM2...). 854It is a list of the form (DIALOG ITEM1 ITEM2...).
844Each ITEM is a cons cell (STRING . VALUE). 855Each ITEM is a cons cell (STRING . VALUE).
845The return value is VALUE from the chosen item. 856The return value is VALUE from the chosen item.
846 857
@@ -850,8 +861,12 @@ on the left of the dialog box and all following items on the right.
850\(By default, approximately half appear on each side.) 861\(By default, approximately half appear on each side.)
851 862
852If HEADER is non-nil, the frame title for the box is "Information", 863If HEADER is non-nil, the frame title for the box is "Information",
853otherwise it is "Question". */) 864otherwise it is "Question".
854 (position, contents, header) 865
866If the user gets rid of the dialog box without making a valid choice,
867for instance using the window manager, then this produces a quit and
868`x-popup-dialog' does not return. */)
869 (position, contents, header)
855 Lisp_Object position, contents, header; 870 Lisp_Object position, contents, header;
856{ 871{
857 FRAME_PTR f = NULL; 872 FRAME_PTR f = NULL;
diff --git a/src/macselect.c b/src/macselect.c
index 94fe591a206..63221ba3a90 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -712,7 +712,7 @@ anything that the functions on `selection-converter-alist' know about. */)
712{ 712{
713 check_mac (); 713 check_mac ();
714 CHECK_SYMBOL (selection_name); 714 CHECK_SYMBOL (selection_name);
715 if (NILP (selection_value)) error ("selection-value may not be nil"); 715 if (NILP (selection_value)) error ("SELECTION-VALUE may not be nil");
716 x_own_selection (selection_name, selection_value); 716 x_own_selection (selection_name, selection_value);
717 return selection_value; 717 return selection_value;
718} 718}
@@ -724,11 +724,11 @@ anything that the functions on `selection-converter-alist' know about. */)
724 724
725DEFUN ("x-get-selection-internal", Fx_get_selection_internal, 725DEFUN ("x-get-selection-internal", Fx_get_selection_internal,
726 Sx_get_selection_internal, 2, 3, 0, 726 Sx_get_selection_internal, 2, 3, 0,
727 doc: /* Return text selected from some Mac window. 727 doc: /* Return text selected from some Mac application.
728SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'. 728SELECTION is a symbol, typically `PRIMARY', `SECONDARY', or `CLIPBOARD'.
729TYPE is the type of data desired, typically `STRING'. 729TYPE is the type of data desired, typically `STRING'.
730TIME_STAMP is ignored on Mac. */) 730TIME_STAMP is ignored on Mac. */)
731 (selection_symbol, target_type, time_stamp) 731 (selection_symbol, target_type, time_stamp)
732 Lisp_Object selection_symbol, target_type, time_stamp; 732 Lisp_Object selection_symbol, target_type, time_stamp;
733{ 733{
734 Lisp_Object val = Qnil; 734 Lisp_Object val = Qnil;
@@ -821,7 +821,7 @@ Disowning it means there is no such selection. */)
821 821
822DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p, 822DEFUN ("x-selection-owner-p", Fx_selection_owner_p, Sx_selection_owner_p,
823 0, 1, 0, 823 0, 1, 0,
824 doc: /* Whether the current Emacs process owns the given Selection. 824 doc: /* Whether the current Emacs process owns the given SELECTION.
825The arg should be the name of the selection in question, typically one of 825The arg should be the name of the selection in question, typically one of
826the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 826the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
827For convenience, the symbol nil is the same as `PRIMARY', 827For convenience, the symbol nil is the same as `PRIMARY',
@@ -866,7 +866,7 @@ and t is the same as `SECONDARY'. */)
866 866
867DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p, 867DEFUN ("x-selection-exists-p", Fx_selection_exists_p, Sx_selection_exists_p,
868 0, 1, 0, 868 0, 1, 0,
869 doc: /* Whether there is an owner for the given Selection. 869 doc: /* Whether there is an owner for the given SELECTION.
870The arg should be the name of the selection in question, typically one of 870The arg should be the name of the selection in question, typically one of
871the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'. 871the symbols `PRIMARY', `SECONDARY', or `CLIPBOARD'.
872For convenience, the symbol nil is the same as `PRIMARY', 872For convenience, the symbol nil is the same as `PRIMARY',
@@ -1077,7 +1077,7 @@ a desired type to which the selection should be converted;
1077and the local selection value (whatever was given to `x-own-selection'). 1077and the local selection value (whatever was given to `x-own-selection').
1078 1078
1079The function should return the value to send to the Scrap Manager 1079The function should return the value to send to the Scrap Manager
1080\(a string). A return value of nil 1080\(must be a string). A return value of nil
1081means that the conversion could not be done. 1081means that the conversion could not be done.
1082A return value which is the symbol `NULL' 1082A return value which is the symbol `NULL'
1083means that a side-effect was executed, 1083means that a side-effect was executed,
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
index 0094ef793dc..ac977b8cb52 100644
--- a/src/s/cygwin.h
+++ b/src/s/cygwin.h
@@ -1,7 +1,7 @@
1/* Template for system description header files. 1/* Template for system description header files.
2 This file describes the parameters that system description files 2 This file describes the parameters that system description files
3 should define or not. 3 should define or not.
4 Copyright (C) 1985, 1986, 1992, 1999 Free Software Foundation, Inc. 4 Copyright (C) 1985, 1986, 1992, 1999, 2005 Free Software Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -123,8 +123,6 @@ Boston, MA 02110-1301, USA. */
123 emacs lisp pointers */ 123 emacs lisp pointers */
124#define DATA_SEG_BITS 0x20000000 124#define DATA_SEG_BITS 0x20000000
125#define LINKER $(CC) -Wl,--image-base,DATA_SEG_BITS 125#define LINKER $(CC) -Wl,--image-base,DATA_SEG_BITS
126/* gettext.h is in a strange place */
127#define C_SWITCH_SYSTEM -I/usr/share/gettext
128 126
129/* Use terminfo instead of termcap. Fewer environment variables to 127/* Use terminfo instead of termcap. Fewer environment variables to
130 go wrong, more terminal types. */ 128 go wrong, more terminal types. */
diff --git a/src/w32fns.c b/src/w32fns.c
index 6bcb668aa8b..063b71cf293 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -396,10 +396,10 @@ x_window_to_frame (dpyinfo, wdesc)
396} 396}
397 397
398 398
399BOOL my_show_window P_ ((struct frame *, HWND, int));
400void my_set_window_pos P_ ((HWND, HWND, int, int, int, int, UINT));
401static Lisp_Object unwind_create_frame P_ ((Lisp_Object)); 399static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
402static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object)); 400static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
401static void my_create_window P_ ((struct frame *));
402static void my_create_tip_window P_ ((struct frame *));
403 403
404/* TODO: Native Input Method support; see x_create_im. */ 404/* TODO: Native Input Method support; see x_create_im. */
405void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 405void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
@@ -3848,7 +3848,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3848 return 0; 3848 return 0;
3849} 3849}
3850 3850
3851void 3851static void
3852my_create_window (f) 3852my_create_window (f)
3853 struct frame * f; 3853 struct frame * f;
3854{ 3854{
@@ -3864,7 +3864,7 @@ my_create_window (f)
3864 indirectly via the Window thread, as we do not need to process Window 3864 indirectly via the Window thread, as we do not need to process Window
3865 messages for the tooltip. Creating tooltips indirectly also creates 3865 messages for the tooltip. Creating tooltips indirectly also creates
3866 deadlocks when tooltips are created for menu items. */ 3866 deadlocks when tooltips are created for menu items. */
3867void 3867static void
3868my_create_tip_window (f) 3868my_create_tip_window (f)
3869 struct frame *f; 3869 struct frame *f;
3870{ 3870{
diff --git a/src/w32menu.c b/src/w32menu.c
index 065355f8755..0e4902b6ce4 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -2418,8 +2418,11 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
2418 struct frame *f = x_window_to_frame (&one_w32_display_info, owner); 2418 struct frame *f = x_window_to_frame (&one_w32_display_info, owner);
2419 Lisp_Object frame, help; 2419 Lisp_Object frame, help;
2420 2420
2421 /* No help echo on owner-draw menu items. */ 2421 /* No help echo on owner-draw menu items, or when the keyboard is used
2422 if (flags & MF_OWNERDRAW || flags & MF_POPUP) 2422 to navigate the menus, since tooltips are distracting if they pop
2423 up elsewhere. */
2424 if (flags & MF_OWNERDRAW || flags & MF_POPUP
2425 || !(flags & MF_MOUSESELECT))
2423 help = Qnil; 2426 help = Qnil;
2424 else 2427 else
2425 { 2428 {
diff --git a/src/w32term.c b/src/w32term.c
index 543b5883bc2..fa9f05ef57c 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -299,6 +299,11 @@ static void x_draw_hollow_cursor P_ ((struct window *, struct glyph_row *));
299static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int, 299static void x_draw_bar_cursor P_ ((struct window *, struct glyph_row *, int,
300 enum text_cursor_kinds)); 300 enum text_cursor_kinds));
301static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, int, HDC)); 301static void w32_clip_to_row P_ ((struct window *, struct glyph_row *, int, HDC));
302static BOOL my_show_window P_ ((struct frame *, HWND, int));
303static void my_set_window_pos P_ ((HWND, HWND, int, int, int, int, UINT));
304static void my_set_focus P_ ((struct frame *, HWND));
305static void my_set_foreground_window P_ ((HWND));
306static void my_destroy_window P_ ((struct frame *, HWND));
302 307
303static Lisp_Object Qvendor_specific_keysyms; 308static Lisp_Object Qvendor_specific_keysyms;
304 309
@@ -3783,7 +3788,7 @@ my_create_scrollbar (f, bar)
3783 3788
3784/*#define ATTACH_THREADS*/ 3789/*#define ATTACH_THREADS*/
3785 3790
3786BOOL 3791static BOOL
3787my_show_window (FRAME_PTR f, HWND hwnd, int how) 3792my_show_window (FRAME_PTR f, HWND hwnd, int how)
3788{ 3793{
3789#ifndef ATTACH_THREADS 3794#ifndef ATTACH_THREADS
@@ -3794,7 +3799,7 @@ my_show_window (FRAME_PTR f, HWND hwnd, int how)
3794#endif 3799#endif
3795} 3800}
3796 3801
3797void 3802static void
3798my_set_window_pos (HWND hwnd, HWND hwndAfter, 3803my_set_window_pos (HWND hwnd, HWND hwndAfter,
3799 int x, int y, int cx, int cy, UINT flags) 3804 int x, int y, int cx, int cy, UINT flags)
3800{ 3805{
@@ -3812,7 +3817,7 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter,
3812#endif 3817#endif
3813} 3818}
3814 3819
3815void 3820static void
3816my_set_focus (f, hwnd) 3821my_set_focus (f, hwnd)
3817 struct frame * f; 3822 struct frame * f;
3818 HWND hwnd; 3823 HWND hwnd;
@@ -3821,14 +3826,15 @@ my_set_focus (f, hwnd)
3821 (WPARAM) hwnd, 0); 3826 (WPARAM) hwnd, 0);
3822} 3827}
3823 3828
3824void 3829static void
3825my_set_foreground_window (hwnd) 3830my_set_foreground_window (hwnd)
3826 HWND hwnd; 3831 HWND hwnd;
3827{ 3832{
3828 SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0); 3833 SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0);
3829} 3834}
3830 3835
3831void 3836
3837static void
3832my_destroy_window (f, hwnd) 3838my_destroy_window (f, hwnd)
3833 struct frame * f; 3839 struct frame * f;
3834 HWND hwnd; 3840 HWND hwnd;