aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2007-10-19 00:00:21 +0000
committerMiles Bader2007-10-19 00:00:21 +0000
commit9c8020a8df03dc67a56d7df15664dcf7ace54bf0 (patch)
tree09b0646addff3c39f9e96ba89c04bdcc038a87a7
parentdfc3268dfa133a2e0a677f1af7c1ee548eae065d (diff)
parentbd3164743080f3eb5fc316aca7cc5322ca58fe33 (diff)
downloademacs-9c8020a8df03dc67a56d7df15664dcf7ace54bf0.tar.gz
emacs-9c8020a8df03dc67a56d7df15664dcf7ace54bf0.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 890-898) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 122-128) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 257-258) - Merge from emacs--rel--22 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-270
-rw-r--r--ChangeLog9
-rw-r--r--FTP6
-rw-r--r--admin/ChangeLog16
-rwxr-xr-xadmin/make-emacs2
-rwxr-xr-xadmin/nt/makedist.bat8
-rwxr-xr-xconfigure186
-rw-r--r--configure.in35
-rw-r--r--doc/emacs/ChangeLog45
-rw-r--r--doc/emacs/basic.texi2
-rw-r--r--doc/emacs/building.texi2
-rw-r--r--doc/emacs/calendar.texi11
-rw-r--r--doc/emacs/custom.texi2
-rw-r--r--doc/emacs/fixit.texi4
-rw-r--r--doc/emacs/frames.texi4
-rw-r--r--doc/emacs/glossary.texi2
-rw-r--r--doc/emacs/text.texi44
-rw-r--r--doc/emacs/trouble.texi2
-rw-r--r--doc/lispref/ChangeLog6
-rw-r--r--doc/lispref/text.texi11
-rw-r--r--etc/NEWS10
-rw-r--r--etc/NEWS.222
-rw-r--r--etc/PROBLEMS7
-rw-r--r--lisp/ChangeLog277
-rw-r--r--lisp/bindings.el29
-rw-r--r--lisp/bs.el283
-rw-r--r--lisp/dired.el4
-rw-r--r--lisp/doc-view.el425
-rw-r--r--lisp/emacs-lisp/advice.el15
-rw-r--r--lisp/emacs-lisp/find-func.el2
-rw-r--r--lisp/emerge.el6
-rw-r--r--lisp/eshell/esh-cmd.el2
-rw-r--r--lisp/faces.el11
-rw-r--r--lisp/files.el1
-rw-r--r--lisp/filesets.el41
-rw-r--r--lisp/gnus/ChangeLog12
-rw-r--r--lisp/gnus/gnus-sum.el4
-rw-r--r--lisp/gnus/gnus-util.el9
-rw-r--r--lisp/gnus/gnus-win.el3
-rw-r--r--lisp/help-fns.el2
-rw-r--r--lisp/ibuf-ext.el4
-rw-r--r--lisp/indent.el4
-rw-r--r--lisp/international/encoded-kb.el89
-rw-r--r--lisp/loadhist.el61
-rw-r--r--lisp/longlines.el27
-rw-r--r--lisp/mail/sendmail.el21
-rw-r--r--lisp/net/tramp.el13
-rw-r--r--lisp/progmodes/cc-menus.el4
-rw-r--r--lisp/progmodes/compile.el15
-rw-r--r--lisp/progmodes/delphi.el2
-rw-r--r--lisp/server.el19
-rw-r--r--lisp/simple.el44
-rw-r--r--lisp/term/xterm.el12
-rw-r--r--lisp/textmodes/artist.el22
-rw-r--r--lisp/textmodes/fill.el146
-rw-r--r--lisp/textmodes/ispell.el10
-rw-r--r--lisp/textmodes/org.el107
-rw-r--r--lisp/time.el2
-rw-r--r--lisp/tutorial.el5
-rw-r--r--lisp/vc-hooks.el7
-rw-r--r--lisp/vc.el56
-rw-r--r--lisp/xt-mouse.el45
-rw-r--r--nt/ChangeLog4
-rw-r--r--nt/makefile.w32-in2
-rw-r--r--src/ChangeLog105
-rw-r--r--src/alloc.c25
-rw-r--r--src/buffer.c27
-rw-r--r--src/coding.c12
-rw-r--r--src/config.in2
-rw-r--r--src/data.c99
-rw-r--r--src/dired.c7
-rw-r--r--src/doc.c10
-rw-r--r--src/eval.c13
-rw-r--r--src/fileio.c3
-rw-r--r--src/fns.c6
-rw-r--r--src/frame.c3
-rw-r--r--src/keyboard.c24
-rw-r--r--src/keymap.c18
-rw-r--r--src/lisp.h60
-rw-r--r--src/lread.c2
-rw-r--r--src/macfns.c4
-rw-r--r--src/macselect.c6
-rw-r--r--src/macterm.c4
-rw-r--r--src/minibuf.c8
-rw-r--r--src/print.c6
-rw-r--r--src/process.c32
-rw-r--r--src/textprop.c44
-rw-r--r--src/w32fns.c8
-rw-r--r--src/w32menu.c8
-rw-r--r--src/window.c14
-rw-r--r--src/xdisp.c32
-rw-r--r--src/xfns.c4
-rw-r--r--src/xselect.c6
92 files changed, 1843 insertions, 1012 deletions
diff --git a/ChangeLog b/ChangeLog
index f771639cb3d..387fcfc73f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
12007-10-17 Chong Yidong <cyd@stupidchicken.com>
2
3 * configure.in (HAVE_RES_INIT): Define if res_init() exists.
4 (HAVE_LIBRESOLV): Also define if we are using res_init().
5
62007-10-17 Glenn Morris <rgm@gnu.org>
7
8 * FTP: Remove file, since it's just a duplicate of one in etc/.
9
12007-10-05 Eli Zaretskii <eliz@gnu.org> 102007-10-05 Eli Zaretskii <eliz@gnu.org>
2 11
3 * config.bat: Fix configuring `doc' due to changes in the 12 * config.bat: Fix configuring `doc' due to changes in the
diff --git a/FTP b/FTP
deleted file mode 100644
index 0337d464c30..00000000000
--- a/FTP
+++ /dev/null
@@ -1,6 +0,0 @@
1For information about how to obtain GNU Emacs and other GNU software
2by FTP, please see <http://www.gnu.org/order/ftp.html>.
3
4Information about Emacs is also available at
5<http://www.gnu.org/software/emacs/>.
6
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 10cec99a09b..e73eb21327c 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,7 @@
12007-10-17 Juanma Barranquero <lekktu@gmail.com>
2
3 * make-emacs: Doc fix.
4
12007-08-28 Glenn Morris <rgm@gnu.org> 52007-08-28 Glenn Morris <rgm@gnu.org>
2 6
3 * admin.el: Provide self. 7 * admin.el: Provide self.
@@ -167,7 +171,7 @@
1672005-10-17 Bill Wohler <wohler@newt.com> 1712005-10-17 Bill Wohler <wohler@newt.com>
168 172
169 * FOR-RELEASE (DOCUMENTATION): Removed lisp/toolbar from list 173 * FOR-RELEASE (DOCUMENTATION): Removed lisp/toolbar from list
170 since it's gone. Also marked mh-e as done. 174 since it's gone. Also marked mh-e as done.
171 175
1722005-10-11 Juanma Barranquero <lekktu@gmail.com> 1762005-10-11 Juanma Barranquero <lekktu@gmail.com>
173 177
@@ -213,11 +217,11 @@
213 217
2142005-03-30 Marcelo Toledo <marcelo@marcelotoledo.org> 2182005-03-30 Marcelo Toledo <marcelo@marcelotoledo.org>
215 219
216 * FOR-RELEASE (Documentation): Added check the Emacs Tutorial. The 220 * FOR-RELEASE (Documentation): Added check the Emacs Tutorial.
217 first line of every tutorial must begin with a sentence saying 221 The first line of every tutorial must begin with a sentence saying
218 "Emacs Tutorial" in the respective language. This should be 222 "Emacs Tutorial" in the respective language. This should be
219 followed by "See end for copying conditions", likewise in the 223 followed by "See end for copying conditions", likewise in the
220 respective language. 224 respective language.
221 225
2222005-03-29 Luc Teirlinck <teirllm@auburn.edu> 2262005-03-29 Luc Teirlinck <teirllm@auburn.edu>
223 227
diff --git a/admin/make-emacs b/admin/make-emacs
index 23b4e1c6374..94bf2092a8b 100755
--- a/admin/make-emacs
+++ b/admin/make-emacs
@@ -68,7 +68,7 @@ Build Emacs.
68 --help show this help 68 --help show this help
69 --all make clean versionclean first 69 --all make clean versionclean first
70 --boot make boostrap, log to boot.log 70 --boot make boostrap, log to boot.log
71 --enable-checking ENABLE_CHECKING=1 (implies Lisp union type) 71 --enable-checking ENABLE_CHECKING=1
72 --no-warn disable warnings 72 --no-warn disable warnings
73 --check-marked GC_CHECK_MARKED_OBJECTS=1 73 --check-marked GC_CHECK_MARKED_OBJECTS=1
74 --optim no debug defines 74 --optim no debug defines
diff --git a/admin/nt/makedist.bat b/admin/nt/makedist.bat
index 5afef00e9b3..db9446db36e 100755
--- a/admin/nt/makedist.bat
+++ b/admin/nt/makedist.bat
@@ -35,8 +35,8 @@ copy %3\README.W32 emacs-%1\README.W32
35rem Info-ZIP zip seems to be broken on Windows. 35rem Info-ZIP zip seems to be broken on Windows.
36rem It always writes to zip.zip and treats the zipfile argument as one 36rem It always writes to zip.zip and treats the zipfile argument as one
37rem of the files to go in it. 37rem of the files to go in it.
38rem zip -9 -r %2-bin-i386 emacs-%1/BUGS emacs-%1/README emacs-%1/README.W32 emacs-%1/INSTALL emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim -x emacs.mdp *.pdb *.opt *~ CVS 38rem zip -9 -r %2-bin-i386 emacs-%1/BUGS emacs-%1/COPYING emacs-%1/README emacs-%1/README.W32 emacs-%1/INSTALL emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim -x emacs.mdp *.pdb *.opt *~ CVS
397z a -tZIP -mx=9 -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory %2-bin-i386.zip emacs-%1/BUGS emacs-%1/README emacs-%1/README.W32 emacs-%1/INSTALL emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim emacs-%1/site-lisp 397z a -tZIP -mx=9 -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory %2-bin-i386.zip emacs-%1/BUGS emacs-%1/COPYING emacs-%1/README emacs-%1/README.W32 emacs-%1/INSTALL emacs-%1/bin emacs-%1/etc emacs-%1/info emacs-%1/lisp emacs-%1/leim emacs-%1/site-lisp
40del emacs-%1\README.W32 40del emacs-%1\README.W32
41if not (%4) == () goto end 41if not (%4) == () goto end
42 42
@@ -49,8 +49,8 @@ copy %3\dump.bat emacs-%1\bin\dump.bat
49rem Info-ZIP zip seems to be broken on Windows. 49rem Info-ZIP zip seems to be broken on Windows.
50rem It always writes to zip.zip and treats the zipfile argument as one 50rem It always writes to zip.zip and treats the zipfile argument as one
51rem of the files to go in it. 51rem of the files to go in it.
52rem zip -9 -r %2-barebin-i386.zip emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC-X 52rem zip -9 -r %2-barebin-i386.zip emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC-X emacs-%1/COPYING
537z a -tZIP -mx=9 %2-barebin-i386.zip emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC-X 537z a -tZIP -mx=9 %2-barebin-i386.zip emacs-%1/README.W32 emacs-%1/bin emacs-%1/etc/DOC-X emacs-%1/COPYING
54del emacs-%1\README.W32 54del emacs-%1\README.W32
55if not (%4) == () goto end 55if not (%4) == () goto end
56 56
diff --git a/configure b/configure
index a52e4dab258..ae2dc481843 100755
--- a/configure
+++ b/configure
@@ -16312,10 +16312,9 @@ done
16312 16312
16313 16313
16314 16314
16315
16316for ac_func in gethostname getdomainname dup2 \ 16315for ac_func in gethostname getdomainname dup2 \
16317rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \ 16316rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
16318random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \ 16317random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
16319strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \ 16318strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
16320utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \ 16319utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \
16321__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \ 16320__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
@@ -18922,13 +18921,11 @@ _ACEOF
18922cat confdefs.h >>conftest.$ac_ext 18921cat confdefs.h >>conftest.$ac_ext
18923cat >>conftest.$ac_ext <<_ACEOF 18922cat >>conftest.$ac_ext <<_ACEOF
18924/* end confdefs.h. */ 18923/* end confdefs.h. */
18925#include <sys/types.h> /* for off_t */ 18924#include <stdio.h>
18926 #include <stdio.h>
18927int 18925int
18928main () 18926main ()
18929{ 18927{
18930int (*fp) (FILE *, off_t, int) = fseeko; 18928return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
18931 return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
18932 ; 18929 ;
18933 return 0; 18930 return 0;
18934} 18931}
@@ -18968,13 +18965,11 @@ cat confdefs.h >>conftest.$ac_ext
18968cat >>conftest.$ac_ext <<_ACEOF 18965cat >>conftest.$ac_ext <<_ACEOF
18969/* end confdefs.h. */ 18966/* end confdefs.h. */
18970#define _LARGEFILE_SOURCE 1 18967#define _LARGEFILE_SOURCE 1
18971#include <sys/types.h> /* for off_t */ 18968#include <stdio.h>
18972 #include <stdio.h>
18973int 18969int
18974main () 18970main ()
18975{ 18971{
18976int (*fp) (FILE *, off_t, int) = fseeko; 18972return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0);
18977 return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
18978 ; 18973 ;
18979 return 0; 18974 return 0;
18980} 18975}
@@ -20003,10 +19998,165 @@ _ACEOF
20003fi 19998fi
20004 19999
20005 20000
20001# Do we have res_init, for detecting changes in /etc/resolv.conf?
20002
20003resolv=no
20004{ echo "$as_me:$LINENO: checking for res_init" >&5
20005echo $ECHO_N "checking for res_init... $ECHO_C" >&6; }
20006if test "${ac_cv_func_res_init+set}" = set; then
20007 echo $ECHO_N "(cached) $ECHO_C" >&6
20008else
20009 cat >conftest.$ac_ext <<_ACEOF
20010/* confdefs.h. */
20011_ACEOF
20012cat confdefs.h >>conftest.$ac_ext
20013cat >>conftest.$ac_ext <<_ACEOF
20014/* end confdefs.h. */
20015/* Define res_init to an innocuous variant, in case <limits.h> declares res_init.
20016 For example, HP-UX 11i <limits.h> declares gettimeofday. */
20017#define res_init innocuous_res_init
20018
20019/* System header to define __stub macros and hopefully few prototypes,
20020 which can conflict with char res_init (); below.
20021 Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
20022 <limits.h> exists even on freestanding compilers. */
20023
20024#ifdef __STDC__
20025# include <limits.h>
20026#else
20027# include <assert.h>
20028#endif
20029
20030#undef res_init
20031
20032/* Override any GCC internal prototype to avoid an error.
20033 Use char because int might match the return type of a GCC
20034 builtin and then its argument prototype would still apply. */
20035#ifdef __cplusplus
20036extern "C"
20037#endif
20038char res_init ();
20039/* The GNU C library defines this for functions which it implements
20040 to always fail with ENOSYS. Some functions are actually named
20041 something starting with __ and the normal name is an alias. */
20042#if defined __stub_res_init || defined __stub___res_init
20043choke me
20044#endif
20045
20046int
20047main ()
20048{
20049return res_init ();
20050 ;
20051 return 0;
20052}
20053_ACEOF
20054rm -f conftest.$ac_objext conftest$ac_exeext
20055if { (ac_try="$ac_link"
20056case "(($ac_try" in
20057 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20058 *) ac_try_echo=$ac_try;;
20059esac
20060eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20061 (eval "$ac_link") 2>conftest.er1
20062 ac_status=$?
20063 grep -v '^ *+' conftest.er1 >conftest.err
20064 rm -f conftest.er1
20065 cat conftest.err >&5
20066 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20067 (exit $ac_status); } && {
20068 test -z "$ac_c_werror_flag" ||
20069 test ! -s conftest.err
20070 } && test -s conftest$ac_exeext &&
20071 $as_test_x conftest$ac_exeext; then
20072 ac_cv_func_res_init=yes
20073else
20074 echo "$as_me: failed program was:" >&5
20075sed 's/^/| /' conftest.$ac_ext >&5
20076
20077 ac_cv_func_res_init=no
20078fi
20079
20080rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
20081 conftest$ac_exeext conftest.$ac_ext
20082fi
20083{ echo "$as_me:$LINENO: result: $ac_cv_func_res_init" >&5
20084echo "${ECHO_T}$ac_cv_func_res_init" >&6; }
20085if test $ac_cv_func_res_init = yes; then
20086 have_res_init=yes
20087else
20088 have_res_init=no
20089fi
20090
20091if test "$have_res_init" = no; then
20092 OLIBS="$LIBS"
20093 LIBS="$LIBS -lresolv"
20094 { echo "$as_me:$LINENO: checking for res_init with -lresolv" >&5
20095echo $ECHO_N "checking for res_init with -lresolv... $ECHO_C" >&6; }
20096 cat >conftest.$ac_ext <<_ACEOF
20097/* confdefs.h. */
20098_ACEOF
20099cat confdefs.h >>conftest.$ac_ext
20100cat >>conftest.$ac_ext <<_ACEOF
20101/* end confdefs.h. */
20102#include <netinet/in.h>
20103#include <arpa/nameser.h>
20104#include <resolv.h>
20105int
20106main ()
20107{
20108res_init();
20109 ;
20110 return 0;
20111}
20112_ACEOF
20113rm -f conftest.$ac_objext conftest$ac_exeext
20114if { (ac_try="$ac_link"
20115case "(($ac_try" in
20116 *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
20117 *) ac_try_echo=$ac_try;;
20118esac
20119eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
20120 (eval "$ac_link") 2>conftest.er1
20121 ac_status=$?
20122 grep -v '^ *+' conftest.er1 >conftest.err
20123 rm -f conftest.er1
20124 cat conftest.err >&5
20125 echo "$as_me:$LINENO: \$? = $ac_status" >&5
20126 (exit $ac_status); } && {
20127 test -z "$ac_c_werror_flag" ||
20128 test ! -s conftest.err
20129 } && test -s conftest$ac_exeext &&
20130 $as_test_x conftest$ac_exeext; then
20131 have_res_init=yes
20132else
20133 echo "$as_me: failed program was:" >&5
20134sed 's/^/| /' conftest.$ac_ext >&5
20135
20136 have_res_init=no
20137fi
20138
20139rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
20140 conftest$ac_exeext conftest.$ac_ext
20141 { echo "$as_me:$LINENO: result: $have_res_init" >&5
20142echo "${ECHO_T}$have_res_init" >&6; }
20143 if test "$have_res_init" = yes ; then
20144 resolv=yes
20145 fi
20146 LIBS="$OLIBS"
20147fi
20148
20149if test "$have_res_init" = yes; then
20150
20151cat >>confdefs.h <<\_ACEOF
20152#define HAVE_RES_INIT 1
20153_ACEOF
20154
20155fi
20156
20006# Do we need the Hesiod library to provide the support routines? 20157# Do we need the Hesiod library to provide the support routines?
20007if test "$with_hesiod" = yes ; then 20158if test "$with_hesiod" = yes ; then
20008 # Don't set $LIBS here -- see comments above. 20159 # Don't set $LIBS here -- see comments above.
20009 resolv=no
20010 { echo "$as_me:$LINENO: checking for res_send" >&5 20160 { echo "$as_me:$LINENO: checking for res_send" >&5
20011echo $ECHO_N "checking for res_send... $ECHO_C" >&6; } 20161echo $ECHO_N "checking for res_send... $ECHO_C" >&6; }
20012if test "${ac_cv_func_res_send+set}" = set; then 20162if test "${ac_cv_func_res_send+set}" = set; then
@@ -20312,11 +20462,6 @@ fi
20312 20462
20313 if test "$resolv" = yes ; then 20463 if test "$resolv" = yes ; then
20314 RESOLVLIB=-lresolv 20464 RESOLVLIB=-lresolv
20315
20316cat >>confdefs.h <<\_ACEOF
20317#define HAVE_LIBRESOLV 1
20318_ACEOF
20319
20320 else 20465 else
20321 RESOLVLIB= 20466 RESOLVLIB=
20322 fi 20467 fi
@@ -20479,6 +20624,15 @@ fi
20479 20624
20480fi 20625fi
20481 20626
20627# Do we need libresolv (due to res_init or Hesiod)?
20628if test "$resolv" = yes ; then
20629
20630cat >>confdefs.h <<\_ACEOF
20631#define HAVE_LIBRESOLV 1
20632_ACEOF
20633
20634fi
20635
20482# These tell us which Kerberos-related libraries to use. 20636# These tell us which Kerberos-related libraries to use.
20483if test "${with_kerberos+set}" = set; then 20637if test "${with_kerberos+set}" = set; then
20484 20638
diff --git a/configure.in b/configure.in
index d1b8f492a41..489d9f1a7a0 100644
--- a/configure.in
+++ b/configure.in
@@ -2794,7 +2794,7 @@ AC_CHECK_HEADERS(maillock.h)
2794 2794
2795AC_CHECK_FUNCS(gethostname getdomainname dup2 \ 2795AC_CHECK_FUNCS(gethostname getdomainname dup2 \
2796rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \ 2796rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
2797random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime res_init setsid \ 2797random lrand48 bcopy bcmp logb frexp fmod rint cbrt ftime setsid \
2798strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \ 2798strerror fpathconf select mktime euidaccess getpagesize tzset setlocale \
2799utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \ 2799utimes setrlimit setpgid getcwd getwd shutdown getaddrinfo \
2800__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \ 2800__fpending mblen mbrlen mbsinit strsignal setitimer ualarm index rindex \
@@ -2838,17 +2838,38 @@ AC_CHECK_FUNCS(getpt)
2838# than to expect to find it in ncurses. 2838# than to expect to find it in ncurses.
2839AC_CHECK_LIB(ncurses, tparm) 2839AC_CHECK_LIB(ncurses, tparm)
2840 2840
2841# Do we have res_init, for detecting changes in /etc/resolv.conf?
2842
2843resolv=no
2844AC_CHECK_FUNC(res_init, have_res_init=yes, have_res_init=no)
2845if test "$have_res_init" = no; then
2846 OLIBS="$LIBS"
2847 LIBS="$LIBS -lresolv"
2848 AC_MSG_CHECKING(for res_init with -lresolv)
2849 AC_TRY_LINK([#include <netinet/in.h>
2850#include <arpa/nameser.h>
2851#include <resolv.h> ],
2852 [res_init();],
2853 have_res_init=yes, have_res_init=no)
2854 AC_MSG_RESULT($have_res_init)
2855 if test "$have_res_init" = yes ; then
2856 resolv=yes
2857 fi
2858 LIBS="$OLIBS"
2859fi
2860
2861if test "$have_res_init" = yes; then
2862 AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
2863fi
2864
2841# Do we need the Hesiod library to provide the support routines? 2865# Do we need the Hesiod library to provide the support routines?
2842if test "$with_hesiod" = yes ; then 2866if test "$with_hesiod" = yes ; then
2843 # Don't set $LIBS here -- see comments above. 2867 # Don't set $LIBS here -- see comments above.
2844 resolv=no
2845 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, , 2868 AC_CHECK_FUNC(res_send, , [AC_CHECK_FUNC(__res_send, ,
2846 [AC_CHECK_LIB(resolv, res_send, resolv=yes, 2869 [AC_CHECK_LIB(resolv, res_send, resolv=yes,
2847 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])]) 2870 [AC_CHECK_LIB(resolv, __res_send, resolv=yes)])])])
2848 if test "$resolv" = yes ; then 2871 if test "$resolv" = yes ; then
2849 RESOLVLIB=-lresolv 2872 RESOLVLIB=-lresolv
2850 AC_DEFINE(HAVE_LIBRESOLV, 1,
2851 [Define to 1 if you have the resolv library (-lresolv).])
2852 else 2873 else
2853 RESOLVLIB= 2874 RESOLVLIB=
2854 fi 2875 fi
@@ -2858,6 +2879,12 @@ if test "$with_hesiod" = yes ; then
2858 :, $RESOLVLIB)]) 2879 :, $RESOLVLIB)])
2859fi 2880fi
2860 2881
2882# Do we need libresolv (due to res_init or Hesiod)?
2883if test "$resolv" = yes ; then
2884 AC_DEFINE(HAVE_LIBRESOLV, 1,
2885 [Define to 1 if you have the resolv library (-lresolv).])
2886fi
2887
2861# These tell us which Kerberos-related libraries to use. 2888# These tell us which Kerberos-related libraries to use.
2862if test "${with_kerberos+set}" = set; then 2889if test "${with_kerberos+set}" = set; then
2863 AC_CHECK_LIB(com_err, com_err) 2890 AC_CHECK_LIB(com_err, com_err)
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 9d5e6158f3f..68c150a67c9 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,38 @@
12007-10-18 Martin Rudalics <rudalics@gmx.at>
2
3 * trouble.texi (Quitting): Fix typo.
4
52007-10-18 Glenn Morris <rgm@gnu.org>
6
7 * frames.texi (Mode Line Mouse): Mention minor mode names.
8
92007-10-17 Juri Linkov <juri@jurta.org>
10
11 * text.texi (Fill Commands): Undocument fill-paragraph-or-region.
12 fill-paragraph operates on the active region in Transient Mark mode.
13 (Fill Prefix, Format Indentation): Replace fill-paragraph-or-region
14 with fill-paragraph.
15
16 * basic.texi (Arguments): Replace fill-paragraph-or-region with
17 fill-paragraph.
18
19 * fixit.texi (Spelling): ispell-word operates on the active region
20 in Transient Mark mode.
21
222007-10-17 Aaron S. Hawley <aaronh@garden.org>
23
24 * building.texi (Source Buffers):
25 * custom.texi (Init Non-ASCII):
26 * glossary.texi (Glossary): Use "key binding" consistently.
27
282007-10-17 Juanma Barranquero <lekktu@gmail.com>
29
30 * calendar.texi (Diary): Fix directive.
31
322007-10-16 Richard Stallman <rms@gnu.org>
33
34 * calendar.texi (Diary): Clarify text about diary file example.
35
12007-10-13 Eric S. Raymond <esr@snark.thyrsus.com> 362007-10-13 Eric S. Raymond <esr@snark.thyrsus.com>
2 37
3 * files.texi: Capitalize node names according to convention. 38 * files.texi: Capitalize node names according to convention.
@@ -10,7 +45,7 @@
10 45
11 * emacs.texi: 46 * emacs.texi:
12 * files.texi (Version Systems): Minor fixes to version-control material 47 * files.texi (Version Systems): Minor fixes to version-control material
13 suggseted by RMS and Robert J. Chassell. 48 suggested by RMS and Robert J. Chassell.
14 49
152007-10-10 Eric S. Raymond <esr@snark.thyrsus.com> 502007-10-10 Eric S. Raymond <esr@snark.thyrsus.com>
16 51
@@ -18,9 +53,9 @@
18 * vc-xtra.texi: 53 * vc-xtra.texi:
19 * vc1-xtra.texi: 54 * vc1-xtra.texi:
20 * vc2-xtra.texi: Merge in changes for new VC with fileset-oriented 55 * vc2-xtra.texi: Merge in changes for new VC with fileset-oriented
21 operations. Change of terminology from 'version' to `revision'. 56 operations. Change of terminology from `version' to `revision'.
22 Revise text for adequate description of VCSes with monotonic IDs. 57 Revise text for adequate description of VCSes with monotonic IDs.
23 * emacs.texi: Change of terminology from 'version' to `revision'. 58 * emacs.texi: Change of terminology from `version' to `revision'.
24 59
252007-10-09 Eric S. Raymond <esr@snark.thyrsus.com> 602007-10-09 Eric S. Raymond <esr@snark.thyrsus.com>
26 61
@@ -53,7 +88,7 @@
532007-10-06 Eric S. Raymond <esr@snark.thyrsus.com> 882007-10-06 Eric S. Raymond <esr@snark.thyrsus.com>
54 89
55 * files.texi: Update the section on version control for 2007 90 * files.texi: Update the section on version control for 2007
56 conditions. None of these changes are new-VC-specific; that 91 conditions. None of these changes are new-VC-specific; that
57 will come later. 92 will come later.
58 93
592007-09-15 Glenn Morris <rgm@gnu.org> 942007-09-15 Glenn Morris <rgm@gnu.org>
@@ -173,7 +208,7 @@
173 208
1742007-06-24 Karl Berry <karl@gnu.org> 2092007-06-24 Karl Berry <karl@gnu.org>
175 210
176 * emacs.texi: new Back-Cover Text. 211 * emacs.texi: New Back-Cover Text.
177 212
1782007-06-07 Alan Mackenzie <acm@muc.de> 2132007-06-07 Alan Mackenzie <acm@muc.de>
179 214
diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi
index 418d54f677b..333985e4a4a 100644
--- a/doc/emacs/basic.texi
+++ b/doc/emacs/basic.texi
@@ -707,7 +707,7 @@ C-n} (move down a good fraction of a screen), @kbd{C-u C-u C-o} (make
707``a lot'' of blank lines), and @kbd{C-u C-k} (kill four lines). 707``a lot'' of blank lines), and @kbd{C-u C-k} (kill four lines).
708 708
709 Some commands care whether there is an argument, but ignore its 709 Some commands care whether there is an argument, but ignore its
710value. For example, the command @kbd{M-q} (@code{fill-paragraph-or-region}) 710value. For example, the command @kbd{M-q} (@code{fill-paragraph})
711fills text; with an argument, it justifies the text as well. 711fills text; with an argument, it justifies the text as well.
712(@xref{Filling}, for more information on @kbd{M-q}.) Plain @kbd{C-u} 712(@xref{Filling}, for more information on @kbd{M-q}.) Plain @kbd{C-u}
713is a handy way of providing an argument for such commands. 713is a handy way of providing an argument for such commands.
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 5689bf1fe34..45210118f77 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -911,7 +911,7 @@ places.
911 911
912@c @findex gdb-mouse-set-clear-breakpoint 912@c @findex gdb-mouse-set-clear-breakpoint
913@c @findex gdb-mouse-toggle-breakpoint 913@c @findex gdb-mouse-toggle-breakpoint
914Many GDB commands can be entered using keybindings or the tool bar but 914Many GDB commands can be entered using key bindings or the tool bar but
915sometimes it is quicker to use the fringe. These commands either 915sometimes it is quicker to use the fringe. These commands either
916manipulate breakpoints or control program execution. When there is no 916manipulate breakpoints or control program execution. When there is no
917fringe, you can use the margin but this is only present when the 917fringe, you can use the margin but this is only present when the
diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi
index 1357784b920..6b285094735 100644
--- a/doc/emacs/calendar.texi
+++ b/doc/emacs/calendar.texi
@@ -989,9 +989,8 @@ events for today, for the immediate future, or for any specified
989date. 989date.
990 990
991 The name of the diary file is specified by the variable 991 The name of the diary file is specified by the variable
992@code{diary-file}; @file{~/diary} is the default. A sample diary file 992@code{diary-file}; @file{~/diary} is the default. Here's an example
993is (note that the file format is essentially the same as that used by 993showing what that file looks like:
994the external shell utility @samp{calendar}):
995 994
996@example 995@example
99712/22/1988 Twentieth wedding anniversary!! 99612/22/1988 Twentieth wedding anniversary!!
@@ -1008,8 +1007,10 @@ April 15, 1989 Income tax due.
1008@end example 1007@end example
1009 1008
1010@noindent 1009@noindent
1011This example uses extra spaces to align the event descriptions of most 1010This format is essentially the same as the one used by the system's
1012of the entries. Such formatting is purely a matter of taste. 1011@command{calendar} utility. This example uses extra spaces to align
1012the event descriptions of most of the entries. Such formatting is
1013purely a matter of taste.
1013 1014
1014 Although you probably will start by creating a diary manually, Emacs 1015 Although you probably will start by creating a diary manually, Emacs
1015provides a number of commands to let you view, add, and change diary 1016provides a number of commands to let you view, add, and change diary
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 1276c45af70..29d1c902b7c 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -2505,7 +2505,7 @@ Type @kbd{C-q}, followed by the key you want to bind, to insert @var{char}.
2505 2505
2506 @strong{Warning:} if you change the keyboard encoding, or change 2506 @strong{Warning:} if you change the keyboard encoding, or change
2507between multibyte and unibyte mode, or anything that would alter which 2507between multibyte and unibyte mode, or anything that would alter which
2508code @kbd{C-q} would insert for that character, this keybinding may 2508code @kbd{C-q} would insert for that character, this key binding may
2509stop working. It is therefore advisable to use one and only one 2509stop working. It is therefore advisable to use one and only one
2510coding system, for your init file as well as the files you edit. For 2510coding system, for your init file as well as the files you edit. For
2511example, don't mix the @samp{latin-1} and @samp{latin-9} coding 2511example, don't mix the @samp{latin-1} and @samp{latin-9} coding
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi
index d1577e2f528..2d827f5a1a2 100644
--- a/doc/emacs/fixit.texi
+++ b/doc/emacs/fixit.texi
@@ -325,7 +325,9 @@ you give an explicit command to do so.
325 To check the spelling of the word around or before point, and 325 To check the spelling of the word around or before point, and
326optionally correct it as well, use the command @kbd{M-$} 326optionally correct it as well, use the command @kbd{M-$}
327(@code{ispell-word}). If the word is not correct, the command offers 327(@code{ispell-word}). If the word is not correct, the command offers
328you various alternatives for what to do about it. 328you various alternatives for what to do about it. When the mark is
329active in Transient Mark mode, this command operates on the active
330region like @code{ispell-region}.
329 331
330@findex ispell-buffer 332@findex ispell-buffer
331@findex ispell-region 333@findex ispell-region
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index a45b582b455..e1207738cfa 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -430,8 +430,8 @@ This menu is for specifying the frame's default font.
430 You can use mouse clicks on window mode lines to select and manipulate 430 You can use mouse clicks on window mode lines to select and manipulate
431windows. 431windows.
432 432
433 Some areas of the mode line, such as the buffer name and the major 433 Some areas of the mode line, such as the buffer name, and major and minor
434mode name, have their own special mouse bindings. These areas are 434mode names, have their own special mouse bindings. These areas are
435highlighted when you hold the mouse over them, and information about 435highlighted when you hold the mouse over them, and information about
436the special bindings will be displayed (@pxref{Tooltips}). This 436the special bindings will be displayed (@pxref{Tooltips}). This
437section's commands do not apply in those areas. 437section's commands do not apply in those areas.
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index f289c2ca1cb..a9109de667b 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -658,7 +658,7 @@ Justification means adding extra spaces within lines of text to make
658them extend exactly to a specified width. 658them extend exactly to a specified width.
659@xref{Format Justification}. 659@xref{Format Justification}.
660 660
661@item Keybinding 661@item Key Binding
662See `binding.' 662See `binding.'
663 663
664@item Keyboard Macro 664@item Keyboard Macro
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 9cfd4ffe922..c151c75e8bb 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -486,11 +486,9 @@ The section on init files says how to arrange this permanently for yourself.
486 486
487@table @kbd 487@table @kbd
488@item M-q 488@item M-q
489Fill current paragraph or active region (@code{fill-paragraph-or-region}). 489Fill current paragraph (@code{fill-paragraph}).
490@item C-x f 490@item C-x f
491Set the fill column (@code{set-fill-column}). 491Set the fill column (@code{set-fill-column}).
492@item M-x fill-paragraph
493Fill current paragraph (@code{fill-paragraph}).
494@item M-x fill-region 492@item M-x fill-region
495Fill each paragraph in the region (@code{fill-region}). 493Fill each paragraph in the region (@code{fill-region}).
496@item M-x fill-region-as-paragraph 494@item M-x fill-region-as-paragraph
@@ -499,39 +497,35 @@ Fill the region, considering it as one paragraph.
499Center a line. 497Center a line.
500@end table 498@end table
501 499
500@kindex M-q
502@findex fill-paragraph 501@findex fill-paragraph
503 To refill a paragraph, use @kbd{M-x fill-paragraph}. This operates 502 To refill a paragraph, use the command @kbd{M-q}
504on the paragraph that point is inside, or the one after point if point 503(@code{fill-paragraph}). This operates on the paragraph that point is
505is between paragraphs. Refilling works by removing all the 504inside, or the one after point if point is between paragraphs.
506line-breaks, then inserting new ones where necessary. 505Refilling works by removing all the line-breaks, then inserting new ones
506where necessary. When the mark is active in Transient Mark mode, this
507command operates on the active region like @code{fill-region}.
507 508
508@findex fill-region 509@findex fill-region
509 To refill many paragraphs, use @kbd{M-x fill-region}, which 510 To refill many paragraphs, use @kbd{M-x fill-region}, which
510finds the paragraphs in the region and fills each of them. 511finds the paragraphs in the region and fills each of them.
511 512
512@kindex M-q
513@findex fill-paragraph-or-region
514 The command @kbd{M-q} (@code{fill-paragraph-or-region}), operates on
515the active region like @code{fill-region} when the mark is active in
516Transient Mark mode. Otherwise, it operates on the current paragraph
517like @code{fill-paragraph}.
518
519@findex fill-region-as-paragraph 513@findex fill-region-as-paragraph
520 @kbd{M-q}, @code{fill-paragraph} and @code{fill-region} use the same 514 @kbd{M-q} and @code{fill-region} use the same criteria as @kbd{M-h}
521criteria as @kbd{M-h} for finding paragraph boundaries (@pxref{Paragraphs}). 515for finding paragraph boundaries (@pxref{Paragraphs}). For more
522For more control, you can use @kbd{M-x fill-region-as-paragraph}, 516control, you can use @kbd{M-x fill-region-as-paragraph}, which refills
523which refills everything between point and mark as a single paragraph. 517everything between point and mark as a single paragraph. This command
524This command deletes any blank lines within the region, so separate 518deletes any blank lines within the region, so separate blocks of text
525blocks of text end up combined into one block. 519end up combined into one block.
526 520
527@cindex justification 521@cindex justification
528 A numeric argument to @kbd{M-q} tells it to @dfn{justify} the text 522 A numeric argument to @kbd{M-q} tells it to @dfn{justify} the text
529as well as filling it. This means that extra spaces are inserted to 523as well as filling it. This means that extra spaces are inserted to
530make the right margin line up exactly at the fill column. To remove 524make the right margin line up exactly at the fill column. To remove
531the extra spaces, use @kbd{M-q} with no argument. (Likewise for 525the extra spaces, use @kbd{M-q} with no argument. (Likewise for
532@code{fill-paragraph} and @code{fill-region}.) Another way to control 526@code{fill-region}.) Another way to control justification, and choose
533justification, and choose other styles of filling, is with the 527other styles of filling, is with the @code{justification} text
534@code{justification} text property; see @ref{Format Justification}. 528property; see @ref{Format Justification}.
535 529
536@kindex M-s @r{(Text mode)} 530@kindex M-s @r{(Text mode)}
537@cindex centering 531@cindex centering
@@ -595,7 +589,7 @@ fill prefix automatically (@pxref{Adaptive Fill}).
595@item C-x . 589@item C-x .
596Set the fill prefix (@code{set-fill-prefix}). 590Set the fill prefix (@code{set-fill-prefix}).
597@item M-q 591@item M-q
598Fill a paragraph using current fill prefix (@code{fill-paragraph-or-region}). 592Fill a paragraph using current fill prefix (@code{fill-paragraph}).
599@item M-x fill-individual-paragraphs 593@item M-x fill-individual-paragraphs
600Fill the region, considering each change of indentation as starting a 594Fill the region, considering each change of indentation as starting a
601new paragraph. 595new paragraph.
@@ -2256,7 +2250,7 @@ margin width either with a numeric argument or in the minibuffer.
2256 2250
2257 Sometimes, as a result of editing, the filling of a paragraph becomes 2251 Sometimes, as a result of editing, the filling of a paragraph becomes
2258messed up---parts of the paragraph may extend past the left or right 2252messed up---parts of the paragraph may extend past the left or right
2259margins. When this happens, use @kbd{M-q} (@code{fill-paragraph-or-region}) to 2253margins. When this happens, use @kbd{M-q} (@code{fill-paragraph}) to
2260refill the paragraph. 2254refill the paragraph.
2261 2255
2262 The fill prefix, if any, works in addition to the specified paragraph 2256 The fill prefix, if any, works in addition to the specified paragraph
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index ea494445a4e..494637c8eeb 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -84,7 +84,7 @@ waiting for the operating system to do something, quitting is
84impossible unless special pains are taken for the particular system 84impossible unless special pains are taken for the particular system
85call within Emacs where the waiting occurs. We have done this for the 85call within Emacs where the waiting occurs. We have done this for the
86system calls that users are likely to want to quit from, but it's 86system calls that users are likely to want to quit from, but it's
87possible you will a case not handled. In one very common 87possible you will encounter a case not handled. In one very common
88case---waiting for file input or output using NFS---Emacs itself knows 88case---waiting for file input or output using NFS---Emacs itself knows
89how to quit, but many NFS implementations simply do not allow user 89how to quit, but many NFS implementations simply do not allow user
90programs to stop waiting for NFS when the NFS server is hung. 90programs to stop waiting for NFS when the NFS server is hung.
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index d95597e940b..e0d9db962f9 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,9 @@
12007-10-17 Juri Linkov <juri@jurta.org>
2
3 * text.texi (Filling): Update arguments of fill-paragraph.
4 fill-paragraph operates on the active region in Transient Mark mode.
5 Remove fill-paragraph-or-region.
6
12007-10-13 Karl Berry <karl@gnu.org> 72007-10-13 Karl Berry <karl@gnu.org>
2 8
3 * elisp.texi (@dircategory): Move to after @copying, 9 * elisp.texi (@dircategory): Move to after @copying,
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index daaaf6c9b9d..5b935bc6e23 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -1432,11 +1432,14 @@ as @code{full}.
1432 When you call the filling functions interactively, using a prefix 1432 When you call the filling functions interactively, using a prefix
1433argument implies the value @code{full} for @var{justify}. 1433argument implies the value @code{full} for @var{justify}.
1434 1434
1435@deffn Command fill-paragraph justify 1435@deffn Command fill-paragraph &optional justify region
1436This command fills the paragraph at or after point. If 1436This command fills the paragraph at or after point. If
1437@var{justify} is non-@code{nil}, each line is justified as well. 1437@var{justify} is non-@code{nil}, each line is justified as well.
1438It uses the ordinary paragraph motion commands to find paragraph 1438It uses the ordinary paragraph motion commands to find paragraph
1439boundaries. @xref{Paragraphs,,, emacs, The GNU Emacs Manual}. 1439boundaries. @xref{Paragraphs,,, emacs, The GNU Emacs Manual}.
1440Interactively, when @var{region} is non-@code{nil} in Transient Mark
1441mode and the mark is active, this command calls @code{fill-region}
1442on the active region.
1440@end deffn 1443@end deffn
1441 1444
1442@deffn Command fill-region start end &optional justify nosqueeze to-eop 1445@deffn Command fill-region start end &optional justify nosqueeze to-eop
@@ -1453,12 +1456,6 @@ The variable @code{paragraph-separate} controls how to distinguish
1453paragraphs. @xref{Standard Regexps}. 1456paragraphs. @xref{Standard Regexps}.
1454@end deffn 1457@end deffn
1455 1458
1456@deffn Command fill-paragraph-or-region justify
1457In Transient Mark mode, when the mark is active, this command calls
1458@code{fill-region} on the active region. Otherwise, it calls
1459@code{fill-paragraph}.
1460@end deffn
1461
1462@deffn Command fill-individual-paragraphs start end &optional justify citation-regexp 1459@deffn Command fill-individual-paragraphs start end &optional justify citation-regexp
1463This command fills each paragraph in the region according to its 1460This command fills each paragraph in the region according to its
1464individual fill prefix. Thus, if the lines of a paragraph were indented 1461individual fill prefix. Thus, if the lines of a paragraph were indented
diff --git a/etc/NEWS b/etc/NEWS
index 21cb6b3ffff..62258f67ff4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -83,6 +83,9 @@ recenter the visited source file. Its value can be a number (for example,
83** The mode-line displays a `@' if the default-directory for the current buffer 83** The mode-line displays a `@' if the default-directory for the current buffer
84is on a remote machine, or a hyphen otherwise. 84is on a remote machine, or a hyphen otherwise.
85 85
86** The mode-line displays a mode menu when mouse-1 is clicked on a minor mode,
87in the same way as it already did for major modes.
88
86** The new command balance-windows-area balances windows both vertically 89** The new command balance-windows-area balances windows both vertically
87and horizontally. 90and horizontally.
88 91
@@ -118,8 +121,9 @@ following arguments.
118+++ 121+++
119** M-q now fills the region if the region is active and 122** M-q now fills the region if the region is active and
120`transient-mark-mode' is turned on. Otherwise, it fills the current 123`transient-mark-mode' is turned on. Otherwise, it fills the current
121paragraph. The new command bound to M-q is `fill-paragraph-or-region'. 124paragraph.
122 125
126+++
123** M-$ now checks spelling of the region if the region is active and 127** M-$ now checks spelling of the region if the region is active and
124`transient-mark-mode' is turned on. Otherwise, it checks spelling of the 128`transient-mark-mode' is turned on. Otherwise, it checks spelling of the
125word at point. 129word at point.
@@ -132,6 +136,10 @@ word at point.
132 136
133** New command kill-matching-buffers kills buffers whose name matches a regexp. 137** New command kill-matching-buffers kills buffers whose name matches a regexp.
134 138
139** `interprogram-paste-function' can now return one string or a list
140of strings. In the latter case, Emacs puts the second and following
141strings on the kill ring.
142
135** Minibuffer changes: 143** Minibuffer changes:
136 144
137*** isearch started in the minibuffer searches in the minibuffer history. 145*** isearch started in the minibuffer searches in the minibuffer history.
diff --git a/etc/NEWS.22 b/etc/NEWS.22
index 2b7c82dd7b6..867c58c47a4 100644
--- a/etc/NEWS.22
+++ b/etc/NEWS.22
@@ -324,7 +324,7 @@ need to quote the space with a C-q. The underlying changes in the
324keymaps that are active in the minibuffer are described below under 324keymaps that are active in the minibuffer are described below under
325"New keymaps for typing file names". 325"New keymaps for typing file names".
326 326
327If you want the old behavior back, put these two key bindings to your 327If you want the old behavior back, add these two key bindings to your
328~/.emacs init file: 328~/.emacs init file:
329 329
330 (define-key minibuffer-local-filename-completion-map 330 (define-key minibuffer-local-filename-completion-map
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 7ebf7ae8edd..d098fcc2c11 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -2204,6 +2204,13 @@ month names with consistent widths for some locales on some versions
2204of Windows. This is caused by a deficiency in the underlying system 2204of Windows. This is caused by a deficiency in the underlying system
2205library function. 2205library function.
2206 2206
2207The functions set-time-zone-rule, and display-time-world (which uses it)
2208do not work on Windows. Fixing this is difficult, since Windows uses
2209localtime for the system clock, and any attempt to change the timezone
2210would have to be accompanied by a clock change for the results to remain
2211consistent. The way in which these functions are used is not intended to
2212cause such system-wide disruption.
2213
2207Files larger than 4GB cause overflow in the size (represented as a 2214Files larger than 4GB cause overflow in the size (represented as a
220832-bit integer) reported by `file-attributes'. This affects Dired as 221532-bit integer) reported by `file-attributes'. This affects Dired as
2209well, since the Windows port uses a Lisp emulation of `ls' that relies 2216well, since the Windows port uses a Lisp emulation of `ls' that relies
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d3fde16c4fa..4fe538b3bd4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,269 @@
12007-10-18 Johan Bockg,Ae(Brd <bojohan@gnu.org>
2
3 * net/tramp.el (tramp-rfn-eshadow-update-overlay): Save excursion.
4 Use `save-restriction' rather than `widen'.
5
62007-10-18 Richard Stallman <rms@gnu.org>
7
8 * time.el (display-time-world-time-format): Display day # not month #.
9
102007-10-18 Reiner Steib <Reiner.Steib@gmx.de>
11
12 * files.el (auto-mode-alist): Don't use doc-view for PS and EPS.
13
14 * doc-view.el: Remove version keyword.
15 (doc-view-ghostscript-program, doc-view-dvipdfm-program)
16 (doc-view-ps2pdf-program): Use executable-find. Simplify custom type.
17 (doc-view-ghostscript-options): Improve custom type.
18 (doc-view-cache-directory, doc-view-conversion-buffer)
19 (doc-view-conversion-refresh-interval): Simplify custom type.
20
212007-10-18 Tassilo Horn <tassilo@member.fsf.org>
22
23 * doc-view.el (doc-view-dvi->pdf-sentinel, doc-view-dvi->pdf)
24 (doc-view-pdf/ps->png-sentinel, doc-view-pdf/ps->png)
25 (doc-view-pdf->txt-sentinel, doc-view-pdf->txt)
26 (doc-view-ps->pdf-sentinel, doc-view-ps->pdf): Remove superfluous
27 messages.
28 (doc-view-mode-map): Use the image-mode scrolling commands. Don't
29 rebind C-x k.
30
312007-10-18 Reiner Steib <Reiner.Steib@gmx.de>
32
33 * doc-view.el (doc-view-ghostscript-options, doc-view-ps->pdf):
34 Add comment about "-dSAFER".
35
362007-10-18 Stefan Monnier <monnier@iro.umontreal.ca>
37
38 * term/xterm.el: Don't require xt-mouse.
39 (terminal-init-xterm): Run terminal-init-xterm-hook rather than
40 calling turn-on-xterm-mouse-tracking-on-terminal directly.
41
42 * xt-mouse.el: Don't change the global function-key-map anny more.
43 (xterm-mouse-mode): Use terminal-init-xterm-hook.
44 Don't use after-make-frame-functions now that term/xterm.el calls
45 us directly.
46 (turn-on-xterm-mouse-tracking, turn-off-xterm-mouse-tracking):
47 Use turn-*-xterm-mouse-tracking-on-terminal. Only once per terminal.
48 (turn-on-xterm-mouse-tracking-on-terminal): Make param optional.
49 Setup input-decode-map and remember that xterm-mouse-mode was
50 enabled in this terminal.
51 (turn-off-xterm-mouse-tracking-on-terminal): Only disable on those
52 terminals where it has been enabled.
53
54 * faces.el (tty-create-frame-with-faces): Make sure not only
55 tty-run-terminal-initialization but also set-locale-environment
56 are run only once per terminal.
57 (tty-run-terminal-initialization): Don't check if the terminal was
58 already initted.
59
60 * international/encoded-kb.el (encoded-kbd-setup-display): Be careful
61 not to remove keymaps that just happen to inherit from one of ours.
62 When setting up our keymap, make sure it won't be accidentally
63 modified by someone else.
64
652007-10-18 Thien-Thi Nguyen <ttn@gnuvola.org>
66
67 * textmodes/artist.el (artist-previous-line, artist-next-line):
68 * dired.el (dired-next-line, dired-previous-line):
69 * progmodes/delphi.el (delphi-newline):
70 * textmodes/org.el (org-columns-eval):
71 Use forward-line.
72
73 * emerge.el (emerge-setup): Use insert-buffer-substring.
74 (emerge-prepare-error-list, emerge-setup-with-ancestor): Likewise.
75
762007-10-18 Juanma Barranquero <lekktu@gmail.com>
77
78 * textmodes/fill.el (fill-individual-paragraphs): Doc fix.
79 (adaptive-fill-function): Doc fix. Remove * from docstring.
80
812007-10-18 Tom Horsley <tom.horsley@att.net>
82
83 * simple.el (interprogram-paste-function): Doc fix.
84 (current-kill): Accept list of strings as well
85 as single string from `interprogram-paste-function'.
86
872007-10-18 Glenn Morris <rgm@gnu.org>
88
89 * ibuf-ext.el (ibuffer-saved-filter-groups): Doc fix.
90
912007-10-18 Drew Adams <drew.adams@oracle.com>
92
93 * bindings.el (mode-line-minor-mode-keymap):
94 Add mouse-minor-mode-menu on mouse-1.
95 (mode-line-modes): Add mouse-1 to help-echo text.
96 (mouse-minor-mode-menu, minor-mode-menu-from-indicator):
97 New functions.
98 (mode-line-minor-mode-help): Doc fix.
99
1002007-10-17 Juri Linkov <juri@jurta.org>
101
102 * textmodes/fill.el (fill-paragraph-or-region): Remove function
103 at the request of RMS.
104 (fill-paragraph): Change `arg' to optional `justify'. Add interactive
105 arg `region'. Fix docstring. At the first `or' branch add call to
106 `fill-region' if it the region is active in transient-mark-mode.
107
108 * bindings.el (esc-map): Bind M-q to fill-paragraph
109 instead of fill-paragraph-or-region.
110
111 * tutorial.el (tutorial--default-keys): Replace fill-paragraph-or-region
112 with fill-paragraph.
113
114 * textmodes/ispell.el (ispell-word): Add interactive arg `region'.
115 Fix docstring.
116
117 * indent.el (indent-for-tab-command): Change interactive spec from
118 "P" to "p". Add check for interactive arg before indenting the
119 active region.
120
121 * files.el (auto-mode-alist): Add \\. before PDF/PS/DVI extensions.
122 Regroup.
123
1242007-10-17 Juanma Barranquero <lekktu@gmail.com>
125
126 * emacs-lisp/find-func.el: Don't require loadhist.
127
128 * loadhist.el (feature-symbols, file-provides, file-requires)
129 (file-set-intersect, file-dependents): Simplify.
130 (unload-feature-special-hooks): Update list of special hooks.
131
1322007-10-17 Tassilo Horn <tassilo@member.fsf.org>
133
134 * bindings.el (completion-ignored-extensions): Remove pdf and dvi
135 extensions since they can be viewed with doc-view.
136
137 * files.el (auto-mode-alist): Make doc-view-mode the default mode
138 for pdf, ps and dvi files.
139
140 * doc-view.el: Make doc-view-mode the standard mode for viewing
141 pdf, [e]ps and dvi files and add binding C-c C-c to toggle between
142 text and image display. Add binding C-c C-e to switch to an
143 editing mode.
144 (doc-view-ghostscript-options, doc-view-ps->pdf): Add "-dSAFER" to
145 avoid security problems when rendering files from untrusted sources.
146
1472007-10-17 Aaron Hawley <aaronh@garden.org>
148
149 * tutorial.el (tutorial--save-tutorial): Display message when tutorial
150 position is not saved.
151
1522007-10-17 Reiner Steib <Reiner.Steib@gmx.de>
153
154 * doc-view.el: Mention xpdf. Fix spelling of Ghostscript.
155 (doc-view-ghostscript-options): Fix typo in doc string.
156
1572007-10-17 Stefan Monnier <monnier@iro.umontreal.ca>
158
159 * progmodes/compile.el (compilation-next-error-function): Fix timestamp
160 handling, so compilation-fake-loc works again.
161
162 * server.el (server-select-display): Nop if we do not support m-f-o-d.
163 (server-process-filter): Revert last change.
164
165 * vc.el (vc-diff-sentinel, vc-diff-internal): Revert some change in the
166 behavior unrelated to filesets.
167
1682007-10-17 Chong Yidong <cyd@stupidchicken.com>
169
170 * longlines.el (longlines-wrap-follows-window-size): Integer value
171 specifies wrapping margin.
172 (longlines-mode, longlines-window-change-function):
173 Set window-specific wrapping margin based on the above.
174
1752007-10-17 John Wiegley <johnw@newartisans.com>
176
177 * eshell/esh-cmd.el (eshell-complex-commands): Add "ls".
178
1792007-10-17 Dan Nicolaescu <dann@ics.uci.edu>
180
181 * server.el (server-process-filter): Only set display if X11 is
182 supported.
183
1842007-10-17 Glenn Morris <rgm@gnu.org>
185
186 * progmodes/cc-menus.el (cc-imenu-c++-generic-expression):
187 Tweak regexp to avoid stack overflow.
188
1892007-10-16 Stefan Monnier <monnier@iro.umontreal.ca>
190
191 * simple.el (reindent-then-newline-and-indent): Don't assume that
192 indent-according-to-mode preserves point.
193
1942007-10-16 Juanma Barranquero <lekktu@gmail.com>
195
196 * bs.el (bs--make-header-match-string, bs-show-in-buffer)
197 (bs--nth-wrapper): Simplify.
198 (bs-select, bs--insert-one-entry): Simplify. Use `when'.
199 (bs-buffer-list): Simplify. Use `when'. Use `string-match-p'.
200 (bs-sort-buffer-interns-are-last): Use `string-match-p'.
201 (bs-attributes-list, bs-max-window-height, bs-must-always-show-regexp)
202 (bs-maximal-buffer-name-column, bs-minimal-buffer-name-column)
203 (bs-configurations, bs-default-configuration)
204 (bs-alternative-configuration, bs-cycle-configuration-name)
205 (bs-string-show-always, bs-string-show-never, bs-string-current)
206 (bs-string-current-marked, bs-string-marked, bs-string-show-normally)
207 (bs-sort-functions, bs-default-sort-name): Remove * in docstrings.
208 (bs--redisplay, bs--goto-current-buffer, bs--current-buffer, bs-delete)
209 (bs-apply-sort-faces, bs-next-config-aux): Use `when'.
210 (bs--window-config-coming-from): Revert 2006-11-09 change.
211 (bs--restore-window-config): Keep the selected frame.
212 (bs--track-window-changes, bs--remove-hooks): New functions.
213 (bs-mode): Use `define-derived-mode'. Set hook to track window changes.
214 (bs--create-header): Remove.
215 (bs--create-header-line): New function, based on `bs--create-header'.
216 (bs--show-header): Use `bs--create-header-line'.
217 (bs--show-with-configuration): Revert 2006-11-09 change.
218 Don't reuse window unless it is visible on the selected frame.
219 Restore window configuration (possibly in a different frame)
220 before creating any window.
221
2222007-10-16 Glenn Morris <rgm@gnu.org>
223
224 * simple.el (blink-matching-open): Don't report false errors with
225 the `$' syntax class.
226
2272007-10-16 Richard Stallman <rms@gnu.org>
228
229 * emacs-lisp/advice.el (ad-get-advice-info): Change to a function.
230 (ad-get-advice-info-macro): New macro, like old ad-get-advice-info.
231 (ad-is-advised, ad-get-advice-info-field)
232 (ad-set-advice-info-field): Use ad-get-advice-info-macro.
233
2342007-10-15 Stefan Monnier <monnier@iro.umontreal.ca>
235
236 * vc-hooks.el (vc-workfile-version): Compatibility alias.
237 (vc-default-working-revision): Compatibility for backends.
238
2392007-10-15 Juanma Barranquero <lekktu@gmail.com>
240
241 * filesets.el (filesets-alist-get): Use `let' rather than `let*'.
242 (filesets-ormap, filesets-sort-case-sensitive-flag)
243 (filesets-remake-shortcut, filesets-ingroup-collect-files):
244 Fix typos in docstrings.
245 (filesets-conditional-sort, filesets-find-or-display-file)
246 (filesets-data-get-name, filesets-data-get-data)
247 (filesets-data-set, filesets-cmd-query-replace-getargs)
248 (filesets-ingroup-collect): Doc fixes.
249
2502007-10-15 Sam Steingold <sds@gnu.org>
251
252 * mail/sendmail.el (sendmail-error-reporting-interactive)
253 (sendmail-error-reporting-non-interactive): New variables for
254 sendmail error reporting options to simplify support for imperfect
255 sendmail emulators.
256 (sendmail-send-it): Use them instead of list literals.
257
2582007-10-15 Juanma Barranquero <lekktu@gmail.com>
259
260 * help-fns.el: Revert previous change; it creates a
261 dependency loop between advice.el and help-fns.el.
262
2632007-10-15 Juanma Barranquero <lekktu@gmail.com>
264
265 * help-fns.el: Require advice when compiling.
266
12007-10-14 Drew Adams <drew.adams@oracle.com> 2672007-10-14 Drew Adams <drew.adams@oracle.com>
2 268
3 * emacs-lisp/ring.el (ring-convert-sequence-to-ring) 269 * emacs-lisp/ring.el (ring-convert-sequence-to-ring)
@@ -99,8 +365,8 @@
99 365
1002007-10-13 Dan Nicolaescu <dann@ics.uci.edu> 3662007-10-13 Dan Nicolaescu <dann@ics.uci.edu>
101 367
102 * frame.el (select-frame-set-input-focus): Fix typo 368 * frame.el (select-frame-set-input-focus): Fix typo "max" -> "mac".
103 "max" -> "mac". Do not use a single clause cond. 369 Do not use a single clause cond.
104 370
105 * cus-start.el (all): Use test that does not match the X11 version 371 * cus-start.el (all): Use test that does not match the X11 version
106 for mac. 372 for mac.
@@ -148,7 +414,7 @@
148 (idlwave-complete-in-buffer): 414 (idlwave-complete-in-buffer):
149 * textmodes/org.el (org-export-as-html, org-export-as-ascii) 415 * textmodes/org.el (org-export-as-html, org-export-as-ascii)
150 (org-fast-tag-selection): 416 (org-fast-tag-selection):
151 * textmodes/reftex-sel.el (reftex-select-item): Use mapc rather 417 * textmodes/reftex-sel.el (reftex-select-item): Use mapc rather
152 than mapcar. 418 than mapcar.
153 419
1542007-10-13 Dan Nicolaescu <dann@ics.uci.edu> 4202007-10-13 Dan Nicolaescu <dann@ics.uci.edu>
@@ -170,9 +436,8 @@
170 and some leftover logic regarding dedicated frames. If showing 436 and some leftover logic regarding dedicated frames. If showing
171 concise startup screen, fit window to buffer. 437 concise startup screen, fit window to buffer.
172 (command-line-1): If we will be using the splash screen, use 438 (command-line-1): If we will be using the splash screen, use
173 find-file instead of find-file-other-window to find additional 439 find-file instead of find-file-other-window to find additional files.
174 files. Comment out unused code for coping with the old sit-for 440 Comment out unused code for coping with the old sit-for behavior.
175 behavior.
176 441
1772007-10-12 Stefan Monnier <monnier@iro.umontreal.ca> 4422007-10-12 Stefan Monnier <monnier@iro.umontreal.ca>
178 443
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 0e7bd15a494..19819c15d60 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -289,6 +289,7 @@ Keymap to display on major mode.")
289 289
290(defvar mode-line-minor-mode-keymap 290(defvar mode-line-minor-mode-keymap
291 (let ((map (make-sparse-keymap))) 291 (let ((map (make-sparse-keymap)))
292 (define-key map [mode-line down-mouse-1] 'mouse-minor-mode-menu)
292 (define-key map [mode-line mouse-2] 'mode-line-minor-mode-help) 293 (define-key map [mode-line mouse-2] 'mode-line-minor-mode-help)
293 (define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1) 294 (define-key map [mode-line down-mouse-3] 'mode-line-mode-menu-1)
294 (define-key map [header-line down-mouse-3] 'mode-line-mode-menu-1) 295 (define-key map [header-line down-mouse-3] 'mode-line-mode-menu-1)
@@ -331,7 +332,7 @@ Keymap to display on minor modes.")
331 '("" mode-line-process) 332 '("" mode-line-process)
332 `(:propertize ("" minor-mode-alist) 333 `(:propertize ("" minor-mode-alist)
333 mouse-face mode-line-highlight 334 mouse-face mode-line-highlight
334 help-echo "mouse-2: minor mode help, mouse-3: toggle minor modes" 335 help-echo "mouse-1: minor mode, mouse-2: minor mode help, mouse-3: toggle minor modes"
335 local-map ,mode-line-minor-mode-keymap) 336 local-map ,mode-line-minor-mode-keymap)
336 (propertize "%n" 'help-echo "mouse-2: widen" 337 (propertize "%n" 'help-echo "mouse-2: widen"
337 'mouse-face 'mode-line-highlight 338 'mouse-face 'mode-line-highlight
@@ -492,8 +493,28 @@ Menu of mode operations in the mode line.")
492 (interactive "@e") 493 (interactive "@e")
493 (x-popup-menu event mode-line-mode-menu)) 494 (x-popup-menu event mode-line-mode-menu))
494 495
496(defun mouse-minor-mode-menu (event)
497 "Show minor-mode menu for EVENT on minor modes area of the mode line."
498 (interactive "@e")
499 (let ((indicator (car (nth 4 (car (cdr event))))))
500 (minor-mode-menu-from-indicator indicator)))
501
502(defun minor-mode-menu-from-indicator (indicator)
503 "Show menu, if any, for minor mode specified by INDICATOR.
504Interactively, INDICATOR is read using completion."
505 (interactive (list (completing-read "Minor mode indicator: "
506 (describe-minor-mode-completion-table-for-indicator))))
507 (let ((minor-mode (lookup-minor-mode-from-indicator indicator)))
508 (if minor-mode
509 (let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist)))
510 (menu (and (keymapp map) (lookup-key map [menu-bar]))))
511 (if menu
512 (popup-menu menu)
513 (message "No menu for minor mode `%s'" minor-mode)))
514 (error "Cannot find minor mode for `%s'" indicator))))
515
495(defun mode-line-minor-mode-help (event) 516(defun mode-line-minor-mode-help (event)
496 "Describe minor mode for EVENT occurred on minor modes area of the mode line." 517 "Describe minor mode for EVENT on minor modes area of the mode line."
497 (interactive "@e") 518 (interactive "@e")
498 (let ((indicator (car (nth 4 (car (cdr event)))))) 519 (let ((indicator (car (nth 4 (car (cdr event))))))
499 (describe-minor-mode-from-indicator indicator))) 520 (describe-minor-mode-from-indicator indicator)))
@@ -536,7 +557,7 @@ is okay. See `mode-line-format'.")
536 '(".elc" ".lof" 557 '(".elc" ".lof"
537 ".glo" ".idx" ".lot" 558 ".glo" ".idx" ".lot"
538 ;; TeX-related 559 ;; TeX-related
539 ".dvi" ".fmt" ".tfm" ".pdf" 560 ".fmt" ".tfm"
540 ;; Java compiled 561 ;; Java compiled
541 ".class" 562 ".class"
542 ;; CLISP 563 ;; CLISP
@@ -1035,7 +1056,7 @@ language you are using."
1035(define-key ctl-x-map "rw" 'window-configuration-to-register) 1056(define-key ctl-x-map "rw" 'window-configuration-to-register)
1036(define-key ctl-x-map "rf" 'frame-configuration-to-register) 1057(define-key ctl-x-map "rf" 'frame-configuration-to-register)
1037 1058
1038(define-key esc-map "q" 'fill-paragraph-or-region) 1059(define-key esc-map "q" 'fill-paragraph)
1039(define-key ctl-x-map "." 'set-fill-prefix) 1060(define-key ctl-x-map "." 'set-fill-prefix)
1040 1061
1041(define-key esc-map "{" 'backward-paragraph) 1062(define-key esc-map "{" 'backward-paragraph)
diff --git a/lisp/bs.el b/lisp/bs.el
index 6390bd2dd81..bb2dbae83c0 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -158,7 +158,7 @@
158 ("" 2 2 left " ") 158 ("" 2 2 left " ")
159 ("File" 12 12 left bs--get-file-name) 159 ("File" 12 12 left bs--get-file-name)
160 ("" 2 2 left " ")) 160 ("" 2 2 left " "))
161 "*List specifying the layout of a Buffer Selection Menu buffer. 161 "List specifying the layout of a Buffer Selection Menu buffer.
162Each entry specifies a column and is a list of the form of: 162Each entry specifies a column and is a list of the form of:
163\(HEADER MINIMUM-LENGTH MAXIMUM-LENGTH ALIGNMENT FUN-OR-STRING) 163\(HEADER MINIMUM-LENGTH MAXIMUM-LENGTH ALIGNMENT FUN-OR-STRING)
164 164
@@ -180,12 +180,7 @@ return a string representing the column's value."
180 180
181(defun bs--make-header-match-string () 181(defun bs--make-header-match-string ()
182 "Return a regexp matching the first line of a Buffer Selection Menu buffer." 182 "Return a regexp matching the first line of a Buffer Selection Menu buffer."
183 (let ((res "^\\(") 183 (concat "^\\(" (mapconcat #'car bs-attributes-list " *") " *$\\)"))
184 (ele bs-attributes-list))
185 (while ele
186 (setq res (concat res (car (car ele)) " *"))
187 (setq ele (cdr ele)))
188 (concat res "$\\)")))
189 184
190;; Font-Lock-Settings 185;; Font-Lock-Settings
191(defvar bs-mode-font-lock-keywords 186(defvar bs-mode-font-lock-keywords
@@ -206,7 +201,7 @@ return a string representing the column's value."
206 "Default font lock expressions for Buffer Selection Menu.") 201 "Default font lock expressions for Buffer Selection Menu.")
207 202
208(defcustom bs-max-window-height 20 203(defcustom bs-max-window-height 20
209 "*Maximal window height of Buffer Selection Menu." 204 "Maximal window height of Buffer Selection Menu."
210 :group 'bs-appearance 205 :group 'bs-appearance
211 :type 'integer) 206 :type 'integer)
212 207
@@ -224,7 +219,7 @@ it is reset to nil. Use `bs-must-always-show-regexp' to specify buffers
224that must always be shown regardless of the configuration.") 219that must always be shown regardless of the configuration.")
225 220
226(defcustom bs-must-always-show-regexp nil 221(defcustom bs-must-always-show-regexp nil
227 "*Regular expression for specifying buffers to show always. 222 "Regular expression for specifying buffers to show always.
228A buffer whose name matches this regular expression will 223A buffer whose name matches this regular expression will
229be shown regardless of current configuration of Buffer Selection Menu." 224be shown regardless of current configuration of Buffer Selection Menu."
230 :group 'bs 225 :group 'bs
@@ -246,7 +241,7 @@ The function gets two arguments - the buffers to compare.
246It must return non-nil if the first buffer should sort before the second.") 241It must return non-nil if the first buffer should sort before the second.")
247 242
248(defcustom bs-maximal-buffer-name-column 45 243(defcustom bs-maximal-buffer-name-column 45
249 "*Maximum column width for buffer names. 244 "Maximum column width for buffer names.
250The column for buffer names has dynamic width. The width depends on 245The column for buffer names has dynamic width. The width depends on
251maximal and minimal length of names of buffers to show. The maximal 246maximal and minimal length of names of buffers to show. The maximal
252width is bounded by `bs-maximal-buffer-name-column'. 247width is bounded by `bs-maximal-buffer-name-column'.
@@ -255,7 +250,7 @@ See also `bs-minimal-buffer-name-column'."
255 :type 'integer) 250 :type 'integer)
256 251
257(defcustom bs-minimal-buffer-name-column 15 252(defcustom bs-minimal-buffer-name-column 15
258 "*Minimum column width for buffer names. 253 "Minimum column width for buffer names.
259The column for buffer names has dynamic width. The width depends on 254The column for buffer names has dynamic width. The width depends on
260maximal and minimal length of names of buffers to show. The minimal 255maximal and minimal length of names of buffers to show. The minimal
261width is bounded by `bs-minimal-buffer-name-column'. 256width is bounded by `bs-minimal-buffer-name-column'.
@@ -272,7 +267,7 @@ See also `bs-maximal-buffer-name-column'."
272 ("files-and-scratch" "^\\*scratch\\*$" nil nil bs-visits-non-file 267 ("files-and-scratch" "^\\*scratch\\*$" nil nil bs-visits-non-file
273 bs-sort-buffer-interns-are-last) 268 bs-sort-buffer-interns-are-last)
274 ("all-intern-last" nil nil nil nil bs-sort-buffer-interns-are-last)) 269 ("all-intern-last" nil nil nil nil bs-sort-buffer-interns-are-last))
275 "*List of all configurations you can use in the Buffer Selection Menu. 270 "List of all configurations you can use in the Buffer Selection Menu.
276A configuration describes which buffers appear in Buffer Selection Menu 271A configuration describes which buffers appear in Buffer Selection Menu
277and also the order of buffers. A configuration is a list with 272and also the order of buffers. A configuration is a list with
278six elements. The first element is a string and describes the configuration. 273six elements. The first element is a string and describes the configuration.
@@ -284,7 +279,7 @@ By setting these variables you define a configuration."
284 :type '(repeat sexp)) 279 :type '(repeat sexp))
285 280
286(defcustom bs-default-configuration "files" 281(defcustom bs-default-configuration "files"
287 "*Name of default configuration used by the Buffer Selection Menu. 282 "Name of default configuration used by the Buffer Selection Menu.
288\\<bs-mode-map> 283\\<bs-mode-map>
289Will be changed using key \\[bs-select-next-configuration]. 284Will be changed using key \\[bs-select-next-configuration].
290Must be a string used in `bs-configurations' for naming a configuration." 285Must be a string used in `bs-configurations' for naming a configuration."
@@ -292,7 +287,7 @@ Must be a string used in `bs-configurations' for naming a configuration."
292 :type 'string) 287 :type 'string)
293 288
294(defcustom bs-alternative-configuration "all" 289(defcustom bs-alternative-configuration "all"
295 "*Name of configuration used when calling `bs-show' with \ 290 "Name of configuration used when calling `bs-show' with \
296\\[universal-argument] as prefix key. 291\\[universal-argument] as prefix key.
297Must be a string used in `bs-configurations' for naming a configuration." 292Must be a string used in `bs-configurations' for naming a configuration."
298 :group 'bs 293 :group 'bs
@@ -303,7 +298,7 @@ Must be a string used in `bs-configurations' for naming a configuration."
303Must be a string used in `bs-configurations' for naming a configuration.") 298Must be a string used in `bs-configurations' for naming a configuration.")
304 299
305(defcustom bs-cycle-configuration-name nil 300(defcustom bs-cycle-configuration-name nil
306 "*Name of configuration used when cycling through the buffer list. 301 "Name of configuration used when cycling through the buffer list.
307A value of nil means to use current configuration `bs-default-configuration'. 302A value of nil means to use current configuration `bs-default-configuration'.
308Must be a string used in `bs-configurations' for naming a configuration." 303Must be a string used in `bs-configurations' for naming a configuration."
309 :group 'bs 304 :group 'bs
@@ -311,32 +306,32 @@ Must be a string used in `bs-configurations' for naming a configuration."
311 string)) 306 string))
312 307
313(defcustom bs-string-show-always "+" 308(defcustom bs-string-show-always "+"
314 "*String added in column 1 indicating a buffer will always be shown." 309 "String added in column 1 indicating a buffer will always be shown."
315 :group 'bs-appearance 310 :group 'bs-appearance
316 :type 'string) 311 :type 'string)
317 312
318(defcustom bs-string-show-never "-" 313(defcustom bs-string-show-never "-"
319 "*String added in column 1 indicating a buffer will never be shown." 314 "String added in column 1 indicating a buffer will never be shown."
320 :group 'bs-appearance 315 :group 'bs-appearance
321 :type 'string) 316 :type 'string)
322 317
323(defcustom bs-string-current "." 318(defcustom bs-string-current "."
324 "*String added in column 1 indicating the current buffer." 319 "String added in column 1 indicating the current buffer."
325 :group 'bs-appearance 320 :group 'bs-appearance
326 :type 'string) 321 :type 'string)
327 322
328(defcustom bs-string-current-marked "#" 323(defcustom bs-string-current-marked "#"
329 "*String added in column 1 indicating the current buffer when it is marked." 324 "String added in column 1 indicating the current buffer when it is marked."
330 :group 'bs-appearance 325 :group 'bs-appearance
331 :type 'string) 326 :type 'string)
332 327
333(defcustom bs-string-marked ">" 328(defcustom bs-string-marked ">"
334 "*String added in column 1 indicating a marked buffer." 329 "String added in column 1 indicating a marked buffer."
335 :group 'bs-appearance 330 :group 'bs-appearance
336 :type 'string) 331 :type 'string)
337 332
338(defcustom bs-string-show-normally " " 333(defcustom bs-string-show-normally " "
339 "*String added in column 1 indicating an unmarked buffer." 334 "String added in column 1 indicating an unmarked buffer."
340 :group 'bs-appearance 335 :group 'bs-appearance
341 :type 'string) 336 :type 'string)
342 337
@@ -390,7 +385,7 @@ A value of `always' means to show buffer regardless of the configuration.")
390 ("by mode" bs--sort-by-mode "Mode" region) 385 ("by mode" bs--sort-by-mode "Mode" region)
391 ("by filename" bs--sort-by-filename "File" region) 386 ("by filename" bs--sort-by-filename "File" region)
392 ("by nothing" nil nil nil)) 387 ("by nothing" nil nil nil))
393 "*List of all possible sorting aspects for Buffer Selection Menu. 388 "List of all possible sorting aspects for Buffer Selection Menu.
394You can add a new entry with a call to `bs-define-sort-function'. 389You can add a new entry with a call to `bs-define-sort-function'.
395Each element is a list of four elements (NAME FUNCTION REGEXP-FOR-SORTING FACE). 390Each element is a list of four elements (NAME FUNCTION REGEXP-FOR-SORTING FACE).
396NAME specifies the sort order defined by function FUNCTION. 391NAME specifies the sort order defined by function FUNCTION.
@@ -425,7 +420,7 @@ The new sort aspect will be inserted into list `bs-sort-functions'."
425This is an element of `bs-sort-functions'.") 420This is an element of `bs-sort-functions'.")
426 421
427(defcustom bs-default-sort-name "by nothing" 422(defcustom bs-default-sort-name "by nothing"
428 "*Name of default sort behavior. 423 "Name of default sort behavior.
429Must be \"by nothing\" or a string used in `bs-sort-functions' for 424Must be \"by nothing\" or a string used in `bs-sort-functions' for
430naming a sort behavior. Default is \"by nothing\" which means no sorting." 425naming a sort behavior. Default is \"by nothing\" which means no sorting."
431 :group 'bs 426 :group 'bs
@@ -445,7 +440,6 @@ defined by current configuration `bs-current-configuration'.")
445 440
446(defvar bs--window-config-coming-from nil 441(defvar bs--window-config-coming-from nil
447 "Window configuration before starting Buffer Selection Menu.") 442 "Window configuration before starting Buffer Selection Menu.")
448(make-variable-frame-local 'bs--window-config-coming-from)
449 443
450(defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*" 444(defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*"
451 "Regular expression specifying which buffers never to show. 445 "Regular expression specifying which buffers never to show.
@@ -529,45 +523,43 @@ a special function. SORT-DESCRIPTION is an element of `bs-sort-functions'."
529 (setq sort-description (or sort-description bs--current-sort-function) 523 (setq sort-description (or sort-description bs--current-sort-function)
530 list (or list (buffer-list))) 524 list (or list (buffer-list)))
531 (let ((result nil)) 525 (let ((result nil))
532 (while list 526 (dolist (buf list)
533 (let* ((buffername (buffer-name (car list))) 527 (let* ((buffername (buffer-name buf))
534 (int-show-never (string-match bs--intern-show-never buffername)) 528 (int-show-never (string-match-p bs--intern-show-never buffername))
535 (ext-show-never (and bs-dont-show-regexp 529 (ext-show-never (and bs-dont-show-regexp
536 (string-match bs-dont-show-regexp 530 (string-match-p bs-dont-show-regexp
537 buffername))) 531 buffername)))
538 (extern-must-show (or (and bs-must-always-show-regexp 532 (extern-must-show (or (and bs-must-always-show-regexp
539 (string-match 533 (string-match-p
540 bs-must-always-show-regexp 534 bs-must-always-show-regexp
541 buffername)) 535 buffername))
542 (and bs-must-show-regexp 536 (and bs-must-show-regexp
543 (string-match bs-must-show-regexp 537 (string-match-p bs-must-show-regexp
544 buffername)))) 538 buffername))))
545 (extern-show-never-from-fun (and bs-dont-show-function 539 (extern-show-never-from-fun (and bs-dont-show-function
546 (funcall bs-dont-show-function 540 (funcall bs-dont-show-function
547 (car list)))) 541 buf)))
548 (extern-must-show-from-fun (and bs-must-show-function 542 (extern-must-show-from-fun (and bs-must-show-function
549 (funcall bs-must-show-function 543 (funcall bs-must-show-function
550 (car list)))) 544 buf)))
551 (show-flag (buffer-local-value 'bs-buffer-show-mark (car list)))) 545 (show-flag (buffer-local-value 'bs-buffer-show-mark buf)))
552 (if (or (eq show-flag 'always) 546 (when (or (eq show-flag 'always)
553 (and (or bs--show-all (not (eq show-flag 'never))) 547 (and (or bs--show-all (not (eq show-flag 'never)))
554 (not int-show-never) 548 (not int-show-never)
555 (or bs--show-all 549 (or bs--show-all
556 extern-must-show 550 extern-must-show
557 extern-must-show-from-fun 551 extern-must-show-from-fun
558 (and (not ext-show-never) 552 (and (not ext-show-never)
559 (not extern-show-never-from-fun))))) 553 (not extern-show-never-from-fun)))))
560 (setq result (cons (car list) 554 (setq result (cons buf result)))))
561 result)))
562 (setq list (cdr list))))
563 (setq result (reverse result)) 555 (setq result (reverse result))
564 ;; The current buffer which was the start point of bs should be an element 556 ;; The current buffer which was the start point of bs should be an element
565 ;; of result list, so that we can leave with space and be back in the 557 ;; of result list, so that we can leave with space and be back in the
566 ;; buffer we started bs-show. 558 ;; buffer we started bs-show.
567 (if (and bs--buffer-coming-from 559 (when (and bs--buffer-coming-from
568 (buffer-live-p bs--buffer-coming-from) 560 (buffer-live-p bs--buffer-coming-from)
569 (not (memq bs--buffer-coming-from result))) 561 (not (memq bs--buffer-coming-from result)))
570 (setq result (cons bs--buffer-coming-from result))) 562 (setq result (cons bs--buffer-coming-from result)))
571 ;; sorting 563 ;; sorting
572 (if (and sort-description 564 (if (and sort-description
573 (nth 1 sort-description)) 565 (nth 1 sort-description))
@@ -587,8 +579,8 @@ If KEEP-LINE-P is non-nil the point will stay on current line.
587SORT-DESCRIPTION is an element of `bs-sort-functions'." 579SORT-DESCRIPTION is an element of `bs-sort-functions'."
588 (let ((line (1+ (count-lines 1 (point))))) 580 (let ((line (1+ (count-lines 1 (point)))))
589 (bs-show-in-buffer (bs-buffer-list nil sort-description)) 581 (bs-show-in-buffer (bs-buffer-list nil sort-description))
590 (if keep-line-p 582 (when keep-line-p
591 (goto-line line)) 583 (goto-line line))
592 (beginning-of-line))) 584 (beginning-of-line)))
593 585
594(defun bs--goto-current-buffer () 586(defun bs--goto-current-buffer ()
@@ -602,10 +594,10 @@ actually the line which begins with character in `bs-string-current' or
602 point) 594 point)
603 (save-excursion 595 (save-excursion
604 (goto-char (point-min)) 596 (goto-char (point-min))
605 (if (search-forward-regexp regexp nil t) 597 (when (search-forward-regexp regexp nil t)
606 (setq point (- (point) 1)))) 598 (setq point (1- (point)))))
607 (if point 599 (when point
608 (goto-char point)))) 600 (goto-char point))))
609 601
610(defun bs--current-config-message () 602(defun bs--current-config-message ()
611 "Return a string describing the current `bs-mode' configuration." 603 "Return a string describing the current `bs-mode' configuration."
@@ -614,7 +606,23 @@ actually the line which begins with character in `bs-string-current' or
614 (format "Show buffer by configuration %S" 606 (format "Show buffer by configuration %S"
615 bs-current-configuration))) 607 bs-current-configuration)))
616 608
617(defun bs-mode () 609(defun bs--track-window-changes (frame)
610 "Track window changes to refresh the buffer list.
611Used from `window-size-change-functions'."
612 (let ((win (get-buffer-window "*buffer-selection*" frame)))
613 (when win
614 (with-selected-window win
615 (bs-refresh)
616 (bs--set-window-height)))))
617
618(defun bs--remove-hooks ()
619 "Remove `bs--track-window-changes' and auxiliary hooks."
620 (remove-hook 'window-size-change-functions 'bs--track-window-changes)
621 ;; Remove itself
622 (remove-hook 'kill-buffer-hook 'bs--remove-hooks t)
623 (remove-hook 'change-major-mode-hook 'bs--remove-hooks t))
624
625(define-derived-mode bs-mode nil "Buffer-Selection-Menu"
618 "Major mode for editing a subset of Emacs' buffers. 626 "Major mode for editing a subset of Emacs' buffers.
619\\<bs-mode-map> 627\\<bs-mode-map>
620Aside from two header lines each line describes one buffer. 628Aside from two header lines each line describes one buffer.
@@ -647,27 +655,27 @@ available Buffer Selection Menu configuration.
647to show always. 655to show always.
648\\[bs-visit-tags-table] -- call `visit-tags-table' on current line's buffer. 656\\[bs-visit-tags-table] -- call `visit-tags-table' on current line's buffer.
649\\[bs-help] -- display this help text." 657\\[bs-help] -- display this help text."
650 (interactive)
651 (kill-all-local-variables)
652 (use-local-map bs-mode-map)
653 (make-local-variable 'font-lock-defaults) 658 (make-local-variable 'font-lock-defaults)
654 (make-local-variable 'font-lock-verbose) 659 (make-local-variable 'font-lock-verbose)
655 (make-local-variable 'font-lock-global-modes) 660 (make-local-variable 'font-lock-global-modes)
656 (buffer-disable-undo) 661 (buffer-disable-undo)
657 (setq major-mode 'bs-mode 662 (setq buffer-read-only t
658 mode-name "Buffer-Selection-Menu"
659 buffer-read-only t
660 truncate-lines t 663 truncate-lines t
661 show-trailing-whitespace nil 664 show-trailing-whitespace nil
662 font-lock-global-modes '(not bs-mode) 665 font-lock-global-modes '(not bs-mode)
663 font-lock-defaults '(bs-mode-font-lock-keywords t) 666 font-lock-defaults '(bs-mode-font-lock-keywords t)
664 font-lock-verbose nil) 667 font-lock-verbose nil)
665 (run-mode-hooks 'bs-mode-hook)) 668 (add-hook 'window-size-change-functions 'bs--track-window-changes)
669 (add-hook 'kill-buffer-hook 'bs--remove-hooks nil t)
670 (add-hook 'change-major-mode-hook 'bs--remove-hooks nil t))
666 671
667(defun bs--restore-window-config () 672(defun bs--restore-window-config ()
668 "Restore window configuration on the current frame." 673 "Restore window configuration on the current frame."
669 (when bs--window-config-coming-from 674 (when bs--window-config-coming-from
670 (set-window-configuration bs--window-config-coming-from) 675 (let ((frame (selected-frame)))
676 (unwind-protect
677 (set-window-configuration bs--window-config-coming-from)
678 (select-frame frame)))
671 (setq bs--window-config-coming-from nil))) 679 (setq bs--window-config-coming-from nil)))
672 680
673(defun bs-kill () 681(defun bs-kill ()
@@ -705,8 +713,8 @@ Raise an error if not on a buffer line."
705 (beginning-of-line) 713 (beginning-of-line)
706 (let ((line (+ (- bs-header-lines-length) 714 (let ((line (+ (- bs-header-lines-length)
707 (count-lines 1 (point))))) 715 (count-lines 1 (point)))))
708 (if (< line 0) 716 (when (< line 0)
709 (error "You are on a header row")) 717 (error "You are on a header row"))
710 (nth line bs-current-list))) 718 (nth line bs-current-list)))
711 719
712(defun bs--update-current-line () 720(defun bs--update-current-line ()
@@ -736,19 +744,18 @@ Leave Buffer Selection Menu."
736 (bury-buffer (current-buffer)) 744 (bury-buffer (current-buffer))
737 (bs--restore-window-config) 745 (bs--restore-window-config)
738 (switch-to-buffer buffer) 746 (switch-to-buffer buffer)
739 (if bs--marked-buffers 747 (when bs--marked-buffers
740 ;; Some marked buffers for selection 748 ;; Some marked buffers for selection
741 (let* ((all (delq buffer bs--marked-buffers)) 749 (let* ((all (delq buffer bs--marked-buffers))
742 (height (/ (1- (frame-height)) (1+ (length all))))) 750 (height (/ (1- (frame-height)) (1+ (length all)))))
743 (delete-other-windows) 751 (delete-other-windows)
744 (switch-to-buffer buffer) 752 (switch-to-buffer buffer)
745 (while all 753 (dolist (buf all)
746 (split-window nil height) 754 (split-window nil height)
747 (other-window 1) 755 (other-window 1)
748 (switch-to-buffer (car all)) 756 (switch-to-buffer buf))
749 (setq all (cdr all))) 757 ;; goto window we have started bs.
750 ;; goto window we have started bs. 758 (other-window 1)))))
751 (other-window 1)))))
752 759
753(defun bs-select-other-window () 760(defun bs-select-other-window ()
754 "Select current line's buffer by `switch-to-buffer-other-window'. 761 "Select current line's buffer by `switch-to-buffer-other-window'.
@@ -912,11 +919,10 @@ WHAT is a value of nil, `never', or `always'."
912 (delete-region (point) (save-excursion 919 (delete-region (point) (save-excursion
913 (end-of-line) 920 (end-of-line)
914 (if (eobp) (point) (1+ (point))))) 921 (if (eobp) (point) (1+ (point)))))
915 (if (eobp) 922 (when (eobp)
916 (progn 923 (backward-delete-char 1)
917 (backward-delete-char 1) 924 (beginning-of-line)
918 (beginning-of-line) 925 (recenter -1))
919 (recenter -1)))
920 (bs--set-window-height))) 926 (bs--set-window-height)))
921 927
922(defun bs-delete-backward () 928(defun bs-delete-backward ()
@@ -945,14 +951,14 @@ Default is `bs--current-sort-function'."
945 bs--current-sort-function))) 951 bs--current-sort-function)))
946 (save-excursion 952 (save-excursion
947 (goto-char (point-min)) 953 (goto-char (point-min))
948 (if (and (nth 2 sort-description) 954 (when (and (nth 2 sort-description)
949 (search-forward-regexp (nth 2 sort-description) nil t)) 955 (search-forward-regexp (nth 2 sort-description) nil t))
950 (let ((inhibit-read-only t)) 956 (let ((inhibit-read-only t))
951 (put-text-property (match-beginning 0) 957 (put-text-property (match-beginning 0)
952 (match-end 0) 958 (match-end 0)
953 'face 959 'face
954 (or (nth 3 sort-description) 960 (or (nth 3 sort-description)
955 'region))))))) 961 'region)))))))
956 962
957(defun bs-toggle-show-all () 963(defun bs-toggle-show-all ()
958 "Toggle show all buffers / show buffers with current configuration." 964 "Toggle show all buffers / show buffers with current configuration."
@@ -983,10 +989,8 @@ Uses function `vc-toggle-read-only'."
983 989
984(defun bs--nth-wrapper (count fun &rest args) 990(defun bs--nth-wrapper (count fun &rest args)
985 "Call COUNT times function FUN with arguments ARGS." 991 "Call COUNT times function FUN with arguments ARGS."
986 (setq count (or count 1)) 992 (dotimes (i (or count 1))
987 (while (> count 0) 993 (apply fun args)))
988 (apply fun args)
989 (setq count (1- count))))
990 994
991(defun bs-up (arg) 995(defun bs-up (arg)
992 "Move cursor vertically up ARG lines in Buffer Selection Menu." 996 "Move cursor vertically up ARG lines in Buffer Selection Menu."
@@ -1026,7 +1030,7 @@ A value of nil means BUFFER belongs to a file."
1026 1030
1027(defun bs-sort-buffer-interns-are-last (b1 b2) 1031(defun bs-sort-buffer-interns-are-last (b1 b2)
1028 "Function for sorting internal buffers at the end of all buffers." 1032 "Function for sorting internal buffers at the end of all buffers."
1029 (string-match "^\\*" (buffer-name b2))) 1033 (string-match-p "^\\*" (buffer-name b2)))
1030 1034
1031;; ---------------------------------------------------------------------- 1035;; ----------------------------------------------------------------------
1032;; Configurations: 1036;; Configurations:
@@ -1108,8 +1112,8 @@ Will return the first if START-NAME is at end."
1108 (length (length list)) 1112 (length (length list))
1109 pos) 1113 pos)
1110 (while (and assocs (not pos)) 1114 (while (and assocs (not pos))
1111 (if (string= (car (car assocs)) start-name) 1115 (when (string= (car (car assocs)) start-name)
1112 (setq pos (- length (length assocs)))) 1116 (setq pos (- length (length assocs))))
1113 (setq assocs (cdr assocs))) 1117 (setq assocs (cdr assocs)))
1114 (setq pos (1+ pos)) 1118 (setq pos (1+ pos))
1115 (if (eq pos length) 1119 (if (eq pos length)
@@ -1151,10 +1155,9 @@ and move point to current buffer."
1151 (erase-buffer) 1155 (erase-buffer)
1152 (setq bs--name-entry-length name-entry-length) 1156 (setq bs--name-entry-length name-entry-length)
1153 (bs--show-header) 1157 (bs--show-header)
1154 (while list 1158 (dolist (buffer list)
1155 (bs--insert-one-entry (car list)) 1159 (bs--insert-one-entry buffer)
1156 (insert "\n") 1160 (insert "\n"))
1157 (setq list (cdr list)))
1158 (delete-backward-char 1) 1161 (delete-backward-char 1)
1159 (bs--set-window-height) 1162 (bs--set-window-height)
1160 (bs--goto-current-buffer) 1163 (bs--goto-current-buffer)
@@ -1348,27 +1351,21 @@ It goes over all columns described in `bs-attributes-list'
1348and evaluates corresponding string. Inserts string in current buffer; 1351and evaluates corresponding string. Inserts string in current buffer;
1349normally *buffer-selection*." 1352normally *buffer-selection*."
1350 (let ((string "") 1353 (let ((string "")
1351 (columns bs-attributes-list)
1352 (to-much 0) 1354 (to-much 0)
1353 (apply-args (append (list bs--buffer-coming-from bs-current-list)))) 1355 (apply-args (append (list bs--buffer-coming-from bs-current-list))))
1354 (save-excursion 1356 (save-excursion
1355 (while columns 1357 (set-buffer buffer)
1356 (set-buffer buffer) 1358 (dolist (column bs-attributes-list)
1357 (let ((min (bs--get-value (nth 1 (car columns)))) 1359 (let* ((min (bs--get-value (nth 1 column)))
1358 ;;(max (bs--get-value (nth 2 (car columns)))) refered no more 1360 (new-string (bs--format-aux (bs--get-value (nth 4 column) ; fun
1359 (align (nth 3 (car columns))) 1361 apply-args)
1360 (fun (nth 4 (car columns))) 1362 (nth 3 column) ; align
1361 (val nil) 1363 (- min to-much)))
1362 new-string) 1364 (len (length new-string)))
1363 (setq val (bs--get-value fun apply-args))
1364 (setq new-string (bs--format-aux val align (- min to-much)))
1365 (setq string (concat string new-string)) 1365 (setq string (concat string new-string))
1366 (if (> (length new-string) min) 1366 (when (> len min)
1367 (setq to-much (- (length new-string) min))) 1367 (setq to-much (- len min))))))
1368 ) ; let 1368 (insert string)))
1369 (setq columns (cdr columns))))
1370 (insert string)
1371 string))
1372 1369
1373(defun bs--format-aux (string align len) 1370(defun bs--format-aux (string align len)
1374 "Pad STRING to length LEN with alignment ALIGN. 1371 "Pad STRING to length LEN with alignment ALIGN.
@@ -1382,28 +1379,26 @@ ALIGN is one of the symbols `left', `middle', or `right'."
1382 1379
1383(defun bs--show-header () 1380(defun bs--show-header ()
1384 "Insert header for Buffer Selection Menu in current buffer." 1381 "Insert header for Buffer Selection Menu in current buffer."
1385 (dolist (string (bs--create-header)) 1382 (insert (bs--create-header-line #'identity)
1386 (insert string "\n"))) 1383 "\n"
1384 (bs--create-header-line (lambda (title)
1385 (make-string (length title) ?-)))
1386 "\n"))
1387 1387
1388(defun bs--get-name-length () 1388(defun bs--get-name-length ()
1389 "Return value of `bs--name-entry-length'." 1389 "Return value of `bs--name-entry-length'."
1390 bs--name-entry-length) 1390 bs--name-entry-length)
1391 1391
1392(defun bs--create-header () 1392(defun bs--create-header-line (col)
1393 "Return all header lines used in Buffer Selection Menu as a list of strings." 1393 "Generate a line for the header.
1394 (list (mapconcat (lambda (column) 1394COL is called for each column in `bs-attributes-list' as a
1395 (bs--format-aux (bs--get-value (car column)) 1395function of one argument, the string heading for the column."
1396 (nth 3 column) ; align 1396 (mapconcat (lambda (column)
1397 (bs--get-value (nth 1 column)))) 1397 (bs--format-aux (funcall col (bs--get-value (car column)))
1398 bs-attributes-list 1398 (nth 3 column) ; align
1399 "") 1399 (bs--get-value (nth 1 column))))
1400 (mapconcat (lambda (column) 1400 bs-attributes-list
1401 (let ((length (length (bs--get-value (car column))))) 1401 ""))
1402 (bs--format-aux (make-string length ?-)
1403 (nth 3 column) ; align
1404 (bs--get-value (nth 1 column)))))
1405 bs-attributes-list
1406 "")))
1407 1402
1408(defun bs--show-with-configuration (name &optional arg) 1403(defun bs--show-with-configuration (name &optional arg)
1409 "Display buffer list of configuration with name NAME. 1404 "Display buffer list of configuration with name NAME.
@@ -1424,14 +1419,14 @@ for buffer selection."
1424 (setq bs--buffer-coming-from (current-buffer))) 1419 (setq bs--buffer-coming-from (current-buffer)))
1425 (let ((liste (bs-buffer-list)) 1420 (let ((liste (bs-buffer-list))
1426 (active-window (get-window-with-predicate 1421 (active-window (get-window-with-predicate
1427 (lambda (w) 1422 (lambda (w)
1428 (string= (buffer-name (window-buffer w)) 1423 (string= (buffer-name (window-buffer w))
1429 "*buffer-selection*"))))) 1424 "*buffer-selection*"))
1425 nil (selected-frame))))
1430 (if active-window 1426 (if active-window
1431 (select-window active-window) 1427 (select-window active-window)
1432 (modify-frame-parameters nil 1428 (bs--restore-window-config)
1433 (list (cons 'bs--window-config-coming-from 1429 (setq bs--window-config-coming-from (current-window-configuration))
1434 (current-window-configuration))))
1435 (when (> (window-height (selected-window)) 7) 1430 (when (> (window-height (selected-window)) 7)
1436 (split-window-vertically) 1431 (split-window-vertically)
1437 (other-window 1))) 1432 (other-window 1)))
diff --git a/lisp/dired.el b/lisp/dired.el
index 7bdb195543a..16b53acb6da 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1682,14 +1682,14 @@ Otherwise, for buffers inheriting from dired-mode, call `toggle-read-only'."
1682 "Move down lines then position at filename. 1682 "Move down lines then position at filename.
1683Optional prefix ARG says how many lines to move; default is one line." 1683Optional prefix ARG says how many lines to move; default is one line."
1684 (interactive "p") 1684 (interactive "p")
1685 (next-line arg) 1685 (forward-line arg)
1686 (dired-move-to-filename)) 1686 (dired-move-to-filename))
1687 1687
1688(defun dired-previous-line (arg) 1688(defun dired-previous-line (arg)
1689 "Move up lines then position at filename. 1689 "Move up lines then position at filename.
1690Optional prefix ARG says how many lines to move; default is one line." 1690Optional prefix ARG says how many lines to move; default is one line."
1691 (interactive "p") 1691 (interactive "p")
1692 (previous-line arg) 1692 (forward-line (- arg))
1693 (dired-move-to-filename)) 1693 (dired-move-to-filename))
1694 1694
1695(defun dired-next-dirline (arg &optional opoint) 1695(defun dired-next-dirline (arg &optional opoint)
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index d7d2bb47abb..d93a8ca316d 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -5,7 +5,6 @@
5;; Author: Tassilo Horn <tassilo@member.fsf.org> 5;; Author: Tassilo Horn <tassilo@member.fsf.org>
6;; Maintainer: Tassilo Horn <tassilo@member.fsf.org> 6;; Maintainer: Tassilo Horn <tassilo@member.fsf.org>
7;; Keywords: files, pdf, ps, dvi 7;; Keywords: files, pdf, ps, dvi
8;; Version: <2007-10-02 Tue 18:21>
9 8
10;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
11 10
@@ -26,9 +25,9 @@
26 25
27;;; Requirements: 26;;; Requirements:
28 27
29;; doc-view.el requires GNU Emacs 22.1 or newer. You also need GhostScript, 28;; doc-view.el requires GNU Emacs 22.1 or newer. You also need Ghostscript,
30;; `dvipdfm' which comes with TeTeX and `pdftotext', which comes with poppler 29;; `dvipdfm' which comes with teTeX and `pdftotext', which comes with xpdf
31;; (http://poppler.freedesktop.org/). 30;; (http://www.foolabs.com/xpdf/) or poppler (http://poppler.freedesktop.org/).
32 31
33;;; Commentary: 32;;; Commentary:
34 33
@@ -37,16 +36,19 @@
37;; inside an Emacs buffer. This buffer uses `doc-view-mode' which provides 36;; inside an Emacs buffer. This buffer uses `doc-view-mode' which provides
38;; convenient key bindings for browsing the document. 37;; convenient key bindings for browsing the document.
39;; 38;;
40;; To use it simply do 39;; To use it simply open a document file with
41;; 40;;
42;; M-x doc-view RET 41;; C-x C-f ~/path/to/document RET
43;; 42;;
44;; and you'll be queried for a document to open. 43;; and the document will be converted and displayed, if your emacs supports png
44;; images. With `C-c C-c' you can toggle between the rendered images
45;; representation and the source text representation of the document. With
46;; `C-c C-e' you can switch to an appropriate editing mode for the document.
45;; 47;;
46;; Since conversion may take some time all the PNG images are cached in a 48;; Since conversion may take some time all the PNG images are cached in a
47;; subdirectory of `doc-view-cache-directory' and reused when you want to view 49;; subdirectory of `doc-view-cache-directory' and reused when you want to view
48;; that file again. This reusing can be omitted if you provide a prefx 50;; that file again. To reconvert a document hit `g' (`doc-view-reconvert-doc')
49;; argument to `doc-view'. To delete all cached files use 51;; when displaying the document. To delete all cached files use
50;; `doc-view-clear-cache'. To open the cache with dired, so that you can tidy 52;; `doc-view-clear-cache'. To open the cache with dired, so that you can tidy
51;; it out use `doc-view-dired-cache'. 53;; it out use `doc-view-dired-cache'.
52;; 54;;
@@ -67,8 +69,6 @@
67;; bottom-right corner of the desired slice. To reset the slice use 69;; bottom-right corner of the desired slice. To reset the slice use
68;; `doc-view-reset-slice' (bound to `s r'). 70;; `doc-view-reset-slice' (bound to `s r').
69;; 71;;
70;; Dired users should have a look at `doc-view-dired'.
71;;
72;; You can also search within the document. The command `doc-view-search' 72;; You can also search within the document. The command `doc-view-search'
73;; (bound to `C-s') queries for a search regexp and initializes a list of all 73;; (bound to `C-s') queries for a search regexp and initializes a list of all
74;; matching pages and messages how many match-pages were found. After that you 74;; matching pages and messages how many match-pages were found. After that you
@@ -80,17 +80,16 @@
80;; conversion. When that finishes and you're still viewing the document 80;; conversion. When that finishes and you're still viewing the document
81;; (i.e. you didn't switch to another buffer) you're queried for the regexp 81;; (i.e. you didn't switch to another buffer) you're queried for the regexp
82;; then. 82;; then.
83;;
84;; Dired users can simply hit `v' on a document file. If it's a PS, PDF or DVI
85;; it will be opened using `doc-view-mode'.
86;;
83 87
84;;; Configuration: 88;;; Configuration:
85 89
86;; Basically doc-view should be quite usable with its standard settings, so 90;; If the images are too small or too big you should set the "-rXXX" option in
87;; putting 91;; `doc-view-ghostscript-options' to another value. (The bigger your screen,
88;; 92;; the higher the value.)
89;; (require 'doc-view)
90;;
91;; into your `user-init-file' should be enough. If the images are too small or
92;; too big you should set the "-rXXX" option in `doc-view-ghostscript-options'
93;; to another value. (The bigger your screen, the higher the value.)
94;; 93;;
95;; This and all other options can be set with the customization interface. 94;; This and all other options can be set with the customization interface.
96;; Simply do 95;; Simply do
@@ -102,6 +101,7 @@
102;;; Code: 101;;; Code:
103 102
104(require 'dired) 103(require 'dired)
104(require 'image-mode)
105(eval-when-compile (require 'cl)) 105(eval-when-compile (require 'cl))
106 106
107;;;; Customization Options 107;;;; Customization Options
@@ -114,50 +114,51 @@
114 :group 'multimedia 114 :group 'multimedia
115 :prefix "doc-view-") 115 :prefix "doc-view-")
116 116
117(defcustom doc-view-ghostscript-program "gs" 117(defcustom doc-view-ghostscript-program (executable-find "gs")
118 "Program to convert PS and PDF files to PNG." 118 "Program to convert PS and PDF files to PNG."
119 :type '(file) 119 :type 'file
120 :group 'doc-view) 120 :group 'doc-view)
121 121
122(defcustom doc-view-ghostscript-options 122(defcustom doc-view-ghostscript-options
123 '("-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4" 123 '("-dSAFER" ;; Avoid security problems when rendering files from untrusted
124 "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET" 124 ;; sources.
125 "-r100") 125 "-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4"
126 "A list of options to give to ghostview." 126 "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET" "-r100")
127 :type '(sexp) 127 "A list of options to give to ghostscript."
128 :type '(repeat string)
128 :group 'doc-view) 129 :group 'doc-view)
129 130
130(defcustom doc-view-dvipdfm-program "dvipdfm" 131(defcustom doc-view-dvipdfm-program (executable-find "dvipdfm")
131 "Program to convert DVI files to PDF. 132 "Program to convert DVI files to PDF.
132 133
133DVI file will be converted to PDF before the resulting PDF is 134DVI file will be converted to PDF before the resulting PDF is
134converted to PNG." 135converted to PNG."
135 :type '(file) 136 :type 'file
136 :group 'doc-view) 137 :group 'doc-view)
137 138
138(defcustom doc-view-ps2pdf-program "ps2pdf" 139(defcustom doc-view-ps2pdf-program (executable-find "ps2pdf")
139 "Program to convert PS files to PDF. 140 "Program to convert PS files to PDF.
140 141
141PS files will be converted to PDF before searching is possible." 142PS files will be converted to PDF before searching is possible."
142 :type '(file) 143 :type 'file
143 :group 'doc-view) 144 :group 'doc-view)
144 145
145(defcustom doc-view-pdftotext-program "pdftotext" 146(defcustom doc-view-pdftotext-program (executable-find "pdftotext")
146 "Program to convert PDF files to plain text. 147 "Program to convert PDF files to plain text.
147 148
148Needed for searching." 149Needed for searching."
149 :type '(file) 150 :type 'file
150 :group 'doc-view) 151 :group 'doc-view)
151 152
152(defcustom doc-view-cache-directory (concat temporary-file-directory 153(defcustom doc-view-cache-directory (concat temporary-file-directory
153 "doc-view") 154 "doc-view")
154 "The base directory, where the PNG images will be saved." 155 "The base directory, where the PNG images will be saved."
155 :type '(directory) 156 :type 'directory
156 :group 'doc-view) 157 :group 'doc-view)
157 158
158(defcustom doc-view-conversion-buffer "*doc-view conversion output*" 159(defcustom doc-view-conversion-buffer "*doc-view conversion output*"
159 "The buffer where messages from the converter programs go to." 160 "The buffer where messages from the converter programs go to."
160 :type '(string) 161 :type 'string
161 :group 'doc-view) 162 :group 'doc-view)
162 163
163(defcustom doc-view-conversion-refresh-interval 3 164(defcustom doc-view-conversion-refresh-interval 3
@@ -166,7 +167,7 @@ After such an refresh newly converted pages will be available for
166viewing. If set to nil there won't be any refreshes and the 167viewing. If set to nil there won't be any refreshes and the
167pages won't be displayed before conversion of the whole document 168pages won't be displayed before conversion of the whole document
168has finished." 169has finished."
169 :type '(string) 170 :type 'integer
170 :group 'doc-view) 171 :group 'doc-view)
171 172
172;;;; Internal Variables 173;;;; Internal Variables
@@ -201,7 +202,10 @@ has finished."
201(defvar doc-view-current-info nil 202(defvar doc-view-current-info nil
202 "Only used internally.") 203 "Only used internally.")
203 204
204;;;; DocView Keymap 205(defvar doc-view-current-display nil
206 "Only used internally.")
207
208;;;; DocView Keymaps
205 209
206(defvar doc-view-mode-map 210(defvar doc-view-mode-map
207 (let ((map (make-sparse-keymap))) 211 (let ((map (make-sparse-keymap)))
@@ -218,7 +222,6 @@ has finished."
218 ;; Killing/burying the buffer (and the process) 222 ;; Killing/burying the buffer (and the process)
219 (define-key map (kbd "q") 'bury-buffer) 223 (define-key map (kbd "q") 'bury-buffer)
220 (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer) 224 (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer)
221 (define-key map (kbd "C-x k") 'doc-view-kill-proc-and-buffer)
222 ;; Slicing the image 225 ;; Slicing the image
223 (define-key map (kbd "s s") 'doc-view-set-slice) 226 (define-key map (kbd "s s") 'doc-view-set-slice)
224 (define-key map (kbd "s m") 'doc-view-set-slice-using-mouse) 227 (define-key map (kbd "s m") 'doc-view-set-slice-using-mouse)
@@ -229,15 +232,40 @@ has finished."
229 (define-key map (kbd "C-S-n") 'doc-view-search-next-match) 232 (define-key map (kbd "C-S-n") 'doc-view-search-next-match)
230 (define-key map (kbd "C-S-p") 'doc-view-search-previous-match) 233 (define-key map (kbd "C-S-p") 'doc-view-search-previous-match)
231 ;; Scrolling 234 ;; Scrolling
235 (define-key map (kbd "<right>") 'image-forward-hscroll)
236 (define-key map (kbd "<left>") 'image-backward-hscroll)
237 (define-key map (kbd "<down>") 'image-next-line)
238 (define-key map (kbd "<up>") 'image-previous-line)
239 (define-key map (kbd "C-f") 'image-forward-hscroll)
240 (define-key map (kbd "C-b") 'image-backward-hscroll)
241 (define-key map (kbd "C-n") 'image-next-line)
242 (define-key map (kbd "C-p") 'image-previous-line)
232 (define-key map (kbd "C-v") 'scroll-up) 243 (define-key map (kbd "C-v") 'scroll-up)
233 (define-key map (kbd "<mouse-4>") 'mwheel-scroll) 244 (define-key map (kbd "<mouse-4>") 'mwheel-scroll)
234 (define-key map (kbd "<mouse-5>") 'mwheel-scroll) 245 (define-key map (kbd "<mouse-5>") 'mwheel-scroll)
235 (define-key map (kbd "M-v") 'scroll-down) 246 (define-key map (kbd "M-v") 'scroll-down)
236 ;; Show the tooltip 247 ;; Show the tooltip
237 (define-key map (kbd "C-t") 'doc-view-show-tooltip) 248 (define-key map (kbd "C-t") 'doc-view-show-tooltip)
249 ;; Toggle between text and image display or editing
250 (define-key map (kbd "C-c C-c") 'doc-view-toggle-display)
251 (define-key map (kbd "C-c C-e") 'doc-view-edit-doc)
252 ;; Reconvert the current document
253 (define-key map (kbd "g") 'doc-view-reconvert-doc)
238 (suppress-keymap map) 254 (suppress-keymap map)
239 map) 255 map)
240 "Keymap used by `doc-view-mode'.") 256 "Keymap used by `doc-view-mode' when displaying a doc as a set of images.")
257
258(defvar doc-view-mode-text-map
259 (let ((map (make-sparse-keymap)))
260 ;; Toggle between text and image display or editing
261 (define-key map (kbd "C-c C-c") 'doc-view-toggle-display)
262 (define-key map (kbd "C-c C-e") 'doc-view-edit-doc)
263 ;; Killing/burying the buffer (and the process)
264 (define-key map (kbd "q") 'bury-buffer)
265 (define-key map (kbd "k") 'doc-view-kill-proc-and-buffer)
266 (define-key map (kbd "C-x k") 'doc-view-kill-proc-and-buffer)
267 map)
268 "Keymap used by `doc-view-mode' when displaying a document as text.")
241 269
242;;;; Navigation Commands 270;;;; Navigation Commands
243 271
@@ -271,16 +299,16 @@ has finished."
271 (setq contexts (concat contexts " - \"" m "\"\n"))) 299 (setq contexts (concat contexts " - \"" m "\"\n")))
272 contexts))))) 300 contexts)))))
273 ;; Update the buffer 301 ;; Update the buffer
274 (setq inhibit-read-only t) 302 (let ((inhibit-read-only t))
275 (erase-buffer) 303 (erase-buffer)
276 (let ((beg (point))) 304 (let ((beg (point)))
277 (doc-view-insert-image (nth (1- page) doc-view-current-files) 305 (doc-view-insert-image (nth (1- page) doc-view-current-files)
278 :pointer 'arrow) 306 :pointer 'arrow)
279 (put-text-property beg (point) 'help-echo doc-view-current-info)) 307 (put-text-property beg (point) 'help-echo doc-view-current-info))
280 (insert "\n" doc-view-current-info) 308 (insert "\n" doc-view-current-info)
281 (goto-char (point-min)) 309 (goto-char (point-min))
282 (forward-char) 310 (forward-char))
283 (setq inhibit-read-only nil))) 311 (set-buffer-modified-p nil)))
284 312
285(defun doc-view-next-page (&optional arg) 313(defun doc-view-next-page (&optional arg)
286 "Browse ARG pages forward." 314 "Browse ARG pages forward."
@@ -317,52 +345,71 @@ has finished."
317 (error (doc-view-previous-page) 345 (error (doc-view-previous-page)
318 (goto-char (point-max))))) 346 (goto-char (point-max)))))
319 347
348(defun doc-view-kill-proc ()
349 "Kill the current converter process."
350 (interactive)
351 (when doc-view-current-converter-process
352 (kill-process doc-view-current-converter-process))
353 (when doc-view-current-timer
354 (cancel-timer doc-view-current-timer)
355 (setq doc-view-current-timer nil))
356 (setq mode-line-process nil))
357
320(defun doc-view-kill-proc-and-buffer () 358(defun doc-view-kill-proc-and-buffer ()
321 "Kill the current converter process and buffer." 359 "Kill the current converter process and buffer."
322 (interactive) 360 (interactive)
361 (doc-view-kill-proc)
323 (when (eq major-mode 'doc-view-mode) 362 (when (eq major-mode 'doc-view-mode)
324 (when doc-view-current-converter-process
325 (kill-process doc-view-current-converter-process))
326 (when doc-view-current-timer
327 (cancel-timer doc-view-current-timer)
328 (setq doc-view-current-timer nil))
329 (kill-buffer (current-buffer)))) 363 (kill-buffer (current-buffer))))
330 364
331;;;; Conversion Functions 365;;;; Conversion Functions
332 366
333(defun doc-view-file-name-to-directory-name (file) 367(defun doc-view-reconvert-doc (&rest args)
334 "Return the directory where the png files of FILE should be saved. 368 "Reconvert the current document.
335 369Should be invoked when the cached images aren't up-to-date."
336It'a a subdirectory of `doc-view-cache-directory'." 370 (interactive)
371 (let ((inhibit-read-only t)
372 (doc doc-view-current-doc))
373 (doc-view-kill-proc)
374 ;; Clear the old cached files
375 (when (file-exists-p (doc-view-current-cache-dir))
376 (dired-delete-file (doc-view-current-cache-dir) 'always))
377 (doc-view-kill-proc-and-buffer)
378 (find-file doc)))
379
380(defun doc-view-current-cache-dir ()
381 "Return the directory where the png files of the current doc should be saved.
382It's a subdirectory of `doc-view-cache-directory'."
337 (if doc-view-current-cache-dir 383 (if doc-view-current-cache-dir
338 doc-view-current-cache-dir 384 doc-view-current-cache-dir
339 (file-name-as-directory 385 (setq doc-view-current-cache-dir
340 (concat (file-name-as-directory doc-view-cache-directory) 386 (file-name-as-directory
341 (with-temp-buffer 387 (concat (file-name-as-directory doc-view-cache-directory)
342 (insert-file-contents-literally file) 388 (let ((doc doc-view-current-doc))
343 (md5 (current-buffer))))))) 389 (with-temp-buffer
390 (insert-file-contents-literally doc)
391 (md5 (current-buffer)))))))))
344 392
345(defun doc-view-dvi->pdf-sentinel (proc event) 393(defun doc-view-dvi->pdf-sentinel (proc event)
346 "If DVI->PDF conversion was successful, convert the PDF to PNG now." 394 "If DVI->PDF conversion was successful, convert the PDF to PNG now."
347 (if (not (string-match "finished" event)) 395 (if (not (string-match "finished" event))
348 (message "DocView: dvi->pdf process changed status to %s." event) 396 (message "DocView: dvi->pdf process changed status to %s." event)
349 (set-buffer (process-get proc 'buffer)) 397 (set-buffer (process-get proc 'buffer))
350 (setq doc-view-current-converter-process nil) 398 (setq doc-view-current-converter-process nil
351 (message "DocView: finished conversion from DVI to PDF!") 399 mode-line-process nil)
352 ;; Now go on converting this PDF to a set of PNG files. 400 ;; Now go on converting this PDF to a set of PNG files.
353 (let* ((pdf (process-get proc 'pdf-file)) 401 (let* ((pdf (process-get proc 'pdf-file))
354 (png (concat (doc-view-file-name-to-directory-name 402 (png (concat (doc-view-current-cache-dir)
355 doc-view-current-doc)
356 "page-%d.png"))) 403 "page-%d.png")))
357 (doc-view-pdf/ps->png pdf png)))) 404 (doc-view-pdf/ps->png pdf png))))
358 405
359(defun doc-view-dvi->pdf (dvi pdf) 406(defun doc-view-dvi->pdf (dvi pdf)
360 "Convert DVI to PDF asynchrounously." 407 "Convert DVI to PDF asynchrounously."
361 (message "DocView: converting DVI to PDF now!")
362 (setq doc-view-current-converter-process 408 (setq doc-view-current-converter-process
363 (start-process "doc-view-dvi->pdf" doc-view-conversion-buffer 409 (start-process "dvi->pdf" doc-view-conversion-buffer
364 doc-view-dvipdfm-program 410 doc-view-dvipdfm-program
365 "-o" pdf dvi)) 411 "-o" pdf dvi)
412 mode-line-process (list (format ":%s" doc-view-current-converter-process)))
366 (set-process-sentinel doc-view-current-converter-process 413 (set-process-sentinel doc-view-current-converter-process
367 'doc-view-dvi->pdf-sentinel) 414 'doc-view-dvi->pdf-sentinel)
368 (process-put doc-view-current-converter-process 'buffer (current-buffer)) 415 (process-put doc-view-current-converter-process 'buffer (current-buffer))
@@ -373,24 +420,24 @@ It'a a subdirectory of `doc-view-cache-directory'."
373 (if (not (string-match "finished" event)) 420 (if (not (string-match "finished" event))
374 (message "DocView: converter process changed status to %s." event) 421 (message "DocView: converter process changed status to %s." event)
375 (set-buffer (process-get proc 'buffer)) 422 (set-buffer (process-get proc 'buffer))
376 (setq doc-view-current-converter-process nil) 423 (setq doc-view-current-converter-process nil
424 mode-line-process nil)
377 (when doc-view-current-timer 425 (when doc-view-current-timer
378 (cancel-timer doc-view-current-timer) 426 (cancel-timer doc-view-current-timer)
379 (setq doc-view-current-timer nil)) 427 (setq doc-view-current-timer nil))
380 (message "DocView: finished conversion from PDF/PS to PNG!")
381 ;; Yippie, finished. Update the display! 428 ;; Yippie, finished. Update the display!
382 (doc-view-display doc-view-current-doc))) 429 (doc-view-display doc-view-current-doc)))
383 430
384(defun doc-view-pdf/ps->png (pdf-ps png) 431(defun doc-view-pdf/ps->png (pdf-ps png)
385 "Convert PDF-PS to PNG asynchrounously." 432 "Convert PDF-PS to PNG asynchrounously."
386 (message "DocView: converting PDF or PS to PNG now!")
387 (setq doc-view-current-converter-process 433 (setq doc-view-current-converter-process
388 (apply 'start-process 434 (apply 'start-process
389 (append (list "doc-view-pdf/ps->png" doc-view-conversion-buffer 435 (append (list "pdf/ps->png" doc-view-conversion-buffer
390 doc-view-ghostscript-program) 436 doc-view-ghostscript-program)
391 doc-view-ghostscript-options 437 doc-view-ghostscript-options
392 (list (concat "-sOutputFile=" png)) 438 (list (concat "-sOutputFile=" png))
393 (list pdf-ps)))) 439 (list pdf-ps)))
440 mode-line-process (list (format ":%s" doc-view-current-converter-process)))
394 (process-put doc-view-current-converter-process 441 (process-put doc-view-current-converter-process
395 'buffer (current-buffer)) 442 'buffer (current-buffer))
396 (set-process-sentinel doc-view-current-converter-process 443 (set-process-sentinel doc-view-current-converter-process
@@ -398,7 +445,7 @@ It'a a subdirectory of `doc-view-cache-directory'."
398 (when doc-view-conversion-refresh-interval 445 (when doc-view-conversion-refresh-interval
399 (setq doc-view-current-timer 446 (setq doc-view-current-timer
400 (run-at-time "1 secs" doc-view-conversion-refresh-interval 447 (run-at-time "1 secs" doc-view-conversion-refresh-interval
401 'doc-view-display 448 'doc-view-display-maybe
402 doc-view-current-doc)))) 449 doc-view-current-doc))))
403 450
404(defun doc-view-pdf->txt-sentinel (proc event) 451(defun doc-view-pdf->txt-sentinel (proc event)
@@ -407,8 +454,8 @@ It'a a subdirectory of `doc-view-cache-directory'."
407 (let ((current-buffer (current-buffer)) 454 (let ((current-buffer (current-buffer))
408 (proc-buffer (process-get proc 'buffer))) 455 (proc-buffer (process-get proc 'buffer)))
409 (set-buffer proc-buffer) 456 (set-buffer proc-buffer)
410 (setq doc-view-current-converter-process nil) 457 (setq doc-view-current-converter-process nil
411 (message "DocView: finished conversion from PDF to TXT!") 458 mode-line-process nil)
412 ;; If the user looks at the DocView buffer where the conversion was 459 ;; If the user looks at the DocView buffer where the conversion was
413 ;; performed, search anew. This time it will be queried for a regexp. 460 ;; performed, search anew. This time it will be queried for a regexp.
414 (when (eq current-buffer proc-buffer) 461 (when (eq current-buffer proc-buffer)
@@ -416,11 +463,11 @@ It'a a subdirectory of `doc-view-cache-directory'."
416 463
417(defun doc-view-pdf->txt (pdf txt) 464(defun doc-view-pdf->txt (pdf txt)
418 "Convert PDF to TXT asynchrounously." 465 "Convert PDF to TXT asynchrounously."
419 (message "DocView: converting PDF to TXT now!")
420 (setq doc-view-current-converter-process 466 (setq doc-view-current-converter-process
421 (start-process "doc-view-pdf->txt" doc-view-conversion-buffer 467 (start-process "pdf->txt" doc-view-conversion-buffer
422 doc-view-pdftotext-program "-raw" 468 doc-view-pdftotext-program "-raw"
423 pdf txt)) 469 pdf txt)
470 mode-line-process (list (format ":%s" doc-view-current-converter-process)))
424 (set-process-sentinel doc-view-current-converter-process 471 (set-process-sentinel doc-view-current-converter-process
425 'doc-view-pdf->txt-sentinel) 472 'doc-view-pdf->txt-sentinel)
426 (process-put doc-view-current-converter-process 'buffer (current-buffer))) 473 (process-put doc-view-current-converter-process 'buffer (current-buffer)))
@@ -429,65 +476,45 @@ It'a a subdirectory of `doc-view-cache-directory'."
429 (if (not (string-match "finished" event)) 476 (if (not (string-match "finished" event))
430 (message "DocView: converter process changed status to %s." event) 477 (message "DocView: converter process changed status to %s." event)
431 (set-buffer (process-get proc 'buffer)) 478 (set-buffer (process-get proc 'buffer))
432 (setq doc-view-current-converter-process nil) 479 (setq doc-view-current-converter-process nil
433 (message "DocView: finished conversion from PS to PDF!") 480 mode-line-process nil)
434 ;; Now we can transform to plain text. 481 ;; Now we can transform to plain text.
435 (doc-view-pdf->txt (process-get proc 'pdf-file) 482 (doc-view-pdf->txt (process-get proc 'pdf-file)
436 (concat (doc-view-file-name-to-directory-name 483 (concat (doc-view-current-cache-dir)
437 doc-view-current-doc)
438 "doc.txt")))) 484 "doc.txt"))))
439 485
440(defun doc-view-ps->pdf (ps pdf) 486(defun doc-view-ps->pdf (ps pdf)
441 "Convert PS to PDF asynchronously." 487 "Convert PS to PDF asynchronously."
442 (message "DocView: converting PS to PDF now!")
443 (setq doc-view-current-converter-process 488 (setq doc-view-current-converter-process
444 (start-process "doc-view-ps->pdf" doc-view-conversion-buffer 489 (start-process "ps->pdf" doc-view-conversion-buffer
445 doc-view-ps2pdf-program 490 doc-view-ps2pdf-program
446 ps pdf)) 491 ps pdf
492 ;; Avoid security problems when rendering files from
493 ;; untrusted sources.
494 "-dSAFER")
495 mode-line-process (list (format ":%s" doc-view-current-converter-process)))
447 (set-process-sentinel doc-view-current-converter-process 496 (set-process-sentinel doc-view-current-converter-process
448 'doc-view-ps->pdf-sentinel) 497 'doc-view-ps->pdf-sentinel)
449 (process-put doc-view-current-converter-process 'buffer (current-buffer)) 498 (process-put doc-view-current-converter-process 'buffer (current-buffer))
450 (process-put doc-view-current-converter-process 'pdf-file pdf)) 499 (process-put doc-view-current-converter-process 'pdf-file pdf))
451 500
452(defun doc-view-convert-doc (doc) 501(defun doc-view-convert-current-doc ()
453 "Convert DOC to a set of png files, one file per page. 502 "Convert `doc-view-current-doc' to a set of png files, one file per page.
454 503Those files are saved in the directory given by the function
455Those files are saved in the directory given by 504`doc-view-current-cache-dir'."
456`doc-view-file-name-to-directory-name'."
457 (clear-image-cache) 505 (clear-image-cache)
458 (let* ((dir (doc-view-file-name-to-directory-name doc)) 506 (let ((png-file (concat (doc-view-current-cache-dir)
459 (png-file (concat (file-name-as-directory dir) "page-%d.png"))) 507 "page-%d.png")))
460 (when (file-exists-p dir) 508 (make-directory doc-view-current-cache-dir t)
461 (dired-delete-file dir 'always)) 509 (if (not (string= (file-name-extension doc-view-current-doc) "dvi"))
462 (make-directory dir t)
463 (if (not (string= (file-name-extension doc) "dvi"))
464 ;; Convert to PNG images. 510 ;; Convert to PNG images.
465 (doc-view-pdf/ps->png doc png-file) 511 (doc-view-pdf/ps->png doc-view-current-doc png-file)
466 ;; DVI files have to be converted to PDF before GhostScript can process 512 ;; DVI files have to be converted to PDF before Ghostscript can process
467 ;; it. 513 ;; it.
468 (doc-view-dvi->pdf doc 514 (doc-view-dvi->pdf doc-view-current-doc
469 (concat (file-name-as-directory dir) 515 (concat (file-name-as-directory doc-view-current-cache-dir)
470 "doc.pdf"))))) 516 "doc.pdf")))))
471 517
472;;;; DocView Mode
473
474(define-derived-mode doc-view-mode nil "DocView"
475 "Major mode in DocView buffers.
476
477\\{doc-view-mode-map}"
478 :group 'doc-view
479 (setq buffer-read-only t)
480 (make-local-variable 'doc-view-current-files)
481 (make-local-variable 'doc-view-current-doc)
482 (make-local-variable 'doc-view-current-image)
483 (make-local-variable 'doc-view-current-page)
484 (make-local-variable 'doc-view-current-converter-process)
485 (make-local-variable 'doc-view-current-timer)
486 (make-local-variable 'doc-view-current-slice)
487 (make-local-variable 'doc-view-current-cache-dir)
488 (make-local-variable 'doc-view-current-info)
489 (make-local-variable 'doc-view-current-search-matches))
490
491;;;; Slicing 518;;;; Slicing
492 519
493(defun doc-view-set-slice (x y width height) 520(defun doc-view-set-slice (x y width height)
@@ -555,19 +582,22 @@ Predicate for sorting `doc-view-current-files'."
555 nil 582 nil
556 (string< a b)))) 583 (string< a b))))
557 584
585(defun doc-view-display-maybe (doc)
586 "Call `doc-view-display' iff we're in the image display."
587 (when (eq doc-view-current-display 'image)
588 (doc-view-display doc)))
589
558(defun doc-view-display (doc) 590(defun doc-view-display (doc)
559 "Start viewing the document DOC." 591 "Start viewing the document DOC."
560 (let ((dir (doc-view-file-name-to-directory-name doc))) 592 (set-buffer (get-file-buffer doc))
561 (set-buffer (format "*DocView: %s*" doc)) 593 (setq doc-view-current-files
562 (setq doc-view-current-files 594 (sort (directory-files (doc-view-current-cache-dir) t
563 (sort (directory-files dir t "page-[0-9]+\\.png" t) 595 "page-[0-9]+\\.png" t)
564 'doc-view-sort)) 596 'doc-view-sort))
565 (when (> (length doc-view-current-files) 0) 597 (when (> (length doc-view-current-files) 0)
566 (doc-view-goto-page doc-view-current-page)))) 598 (doc-view-goto-page doc-view-current-page)))
567 599
568(defun doc-view-buffer-message () 600(defun doc-view-buffer-message ()
569 (setq inhibit-read-only t)
570 (erase-buffer)
571 (insert (propertize "Welcome to DocView!" 'face 'bold) 601 (insert (propertize "Welcome to DocView!" 'face 'bold)
572 "\n" 602 "\n"
573 " 603 "
@@ -580,12 +610,58 @@ For now these keys are useful:
580 610
581`q' : Bury this buffer. Conversion will go on in background. 611`q' : Bury this buffer. Conversion will go on in background.
582`k' : Kill the conversion process and this buffer.\n") 612`k' : Kill the conversion process and this buffer.\n")
583 (setq inhibit-read-only nil)) 613 (set-buffer-modified-p nil))
584 614
585(defun doc-view-show-tooltip () 615(defun doc-view-show-tooltip ()
586 (interactive) 616 (interactive)
587 (tooltip-show doc-view-current-info)) 617 (tooltip-show doc-view-current-info))
588 618
619;;;;; Toggle between text and image display
620
621(defun doc-view-toggle-display ()
622 "Start or stop displaying a document file as a set of images.
623This command toggles between showing the text of the document
624file and showing the document as a set of images."
625 (interactive)
626 (if (get-text-property (point-min) 'display)
627 ;; Switch to text display
628 (let ((inhibit-read-only t))
629 (erase-buffer)
630 (insert-file-contents doc-view-current-doc)
631 (use-local-map doc-view-mode-text-map)
632 (setq mode-name "DocView[text]"
633 doc-view-current-display 'text)
634 (if (called-interactively-p)
635 (message "Repeat this command to go back to displaying the file as images")))
636 ;; Switch to image display
637 (let ((inhibit-read-only t))
638 (erase-buffer)
639 (doc-view-buffer-message)
640 (setq doc-view-current-page (or doc-view-current-page 1))
641 (if (file-exists-p (doc-view-current-cache-dir))
642 (progn
643 (message "DocView: using cached files!")
644 (doc-view-display doc-view-current-doc))
645 (doc-view-convert-current-doc))
646 (use-local-map doc-view-mode-map)
647 (setq mode-name (format "DocView")
648 doc-view-current-display 'image)
649 (if (called-interactively-p)
650 (message "Repeat this command to go back to displaying the file as text"))))
651 (set-buffer-modified-p nil))
652
653;;;;; Leave doc-view-mode and open the file for edit
654
655(defun doc-view-edit-doc ()
656 "Leave `doc-view-mode' and open the current doc with an appropriate editing mode."
657 (interactive)
658 (let ((filename doc-view-current-doc)
659 (auto-mode-alist (append '(("\\.[eE]?[pP][sS]\\'" . ps-mode)
660 ("\\.\\(pdf\\|PDF\\|dvi\\|DVI\\)$" . fundamental-mode))
661 auto-mode-alist)))
662 (kill-buffer (current-buffer))
663 (find-file filename)))
664
589;;;; Searching 665;;;; Searching
590 666
591(defun doc-view-search-internal (regexp file) 667(defun doc-view-search-internal (regexp file)
@@ -636,8 +712,7 @@ conversion finished."
636 (interactive) 712 (interactive)
637 ;; New search, so forget the old results. 713 ;; New search, so forget the old results.
638 (setq doc-view-current-search-matches nil) 714 (setq doc-view-current-search-matches nil)
639 (let ((txt (concat (doc-view-file-name-to-directory-name 715 (let ((txt (concat (doc-view-current-cache-dir)
640 doc-view-current-doc)
641 "doc.txt"))) 716 "doc.txt")))
642 (if (file-readable-p txt) 717 (if (file-readable-p txt)
643 (progn 718 (progn
@@ -660,14 +735,12 @@ conversion finished."
660 ;; Doc is a PS, so convert it to PDF (which will be converted to 735 ;; Doc is a PS, so convert it to PDF (which will be converted to
661 ;; TXT thereafter). 736 ;; TXT thereafter).
662 (doc-view-ps->pdf doc-view-current-doc 737 (doc-view-ps->pdf doc-view-current-doc
663 (concat (doc-view-file-name-to-directory-name 738 (concat (doc-view-current-cache-dir)
664 doc-view-current-doc)
665 "doc.pdf"))) 739 "doc.pdf")))
666 ((string= ext "dvi") 740 ((string= ext "dvi")
667 ;; Doc is a DVI. This means that a doc.pdf already exists in its 741 ;; Doc is a DVI. This means that a doc.pdf already exists in its
668 ;; cache subdirectory. 742 ;; cache subdirectory.
669 (doc-view-pdf->txt (concat (doc-view-file-name-to-directory-name 743 (doc-view-pdf->txt (concat (doc-view-current-cache-dir)
670 doc-view-current-doc)
671 "doc.pdf") 744 "doc.pdf")
672 txt)) 745 txt))
673 (t (error "DocView doesn't know what to do")))))))) 746 (t (error "DocView doesn't know what to do"))))))))
@@ -698,52 +771,42 @@ conversion finished."
698 (y-or-n-p "No more matches before current page. Wrap to last match? ")) 771 (y-or-n-p "No more matches before current page. Wrap to last match? "))
699 (doc-view-goto-page (caar (last doc-view-current-search-matches))))))) 772 (doc-view-goto-page (caar (last doc-view-current-search-matches)))))))
700 773
701;;;; User Interface Commands 774;;;; User interface commands and the mode
702 775
703;;;###autoload 776(put 'doc-view-mode 'mode-class 'special)
704(defun doc-view (no-cache &optional file)
705 "Convert FILE to png and start viewing it.
706If no FILE is given, query for on.
707If this FILE is still in the cache, don't convert and use the
708existing page files. With prefix arg NO-CACHE, don't use the
709cached files and convert anew."
710 (interactive "P")
711 (if (not (and (image-type-available-p 'png)
712 (display-images-p)))
713 (message "DocView: your emacs or display doesn't support png images.")
714 (let* ((doc (or file
715 (expand-file-name
716 (let ((completion-ignored-extensions
717 ;; Don't hide files doc-view can display
718 (remove-if (lambda (str)
719 (string-match "\\.\\(ps\\|pdf\\|dvi\\)$"
720 str))
721 completion-ignored-extensions)))
722 (read-file-name "File: " nil nil t)))))
723 (buffer (get-buffer-create (format "*DocView: %s*" doc)))
724 (dir (doc-view-file-name-to-directory-name doc)))
725 (switch-to-buffer buffer)
726 (doc-view-buffer-message)
727 (doc-view-mode)
728 (setq doc-view-current-doc doc)
729 (setq doc-view-current-page 1)
730 (if (not (and (file-exists-p dir)
731 (not no-cache)))
732 (progn
733 (setq doc-view-current-cache-dir nil)
734 (doc-view-convert-doc doc-view-current-doc))
735 (message "DocView: using cached files!")
736 (doc-view-display doc-view-current-doc)))))
737 777
738(defun doc-view-dired (no-cache) 778;;;###autoload
739 "View the current dired file with doc-view. 779(define-derived-mode doc-view-mode nil "DocView"
740NO-CACHE is the same as in `doc-view'. 780 "Major mode in DocView buffers.
741 781You can use \\<doc-view-mode-map>\\[doc-view-toggle-display] to
742You might want to bind this command to a dired key, e.g. 782toggle between display as a set of images and display as text."
743 783 :group 'doc-view
744 (define-key dired-mode-map (kbd \"C-c d\") 'doc-view-dired)" 784 (make-local-variable 'doc-view-current-files)
745 (interactive "P") 785 (make-local-variable 'doc-view-current-doc)
746 (doc-view no-cache (dired-get-file-for-visit))) 786 (make-local-variable 'doc-view-current-image)
787 (make-local-variable 'doc-view-current-page)
788 (make-local-variable 'doc-view-current-converter-process)
789 (make-local-variable 'doc-view-current-timer)
790 (make-local-variable 'doc-view-current-slice)
791 (make-local-variable 'doc-view-current-cache-dir)
792 (make-local-variable 'doc-view-current-info)
793 (make-local-variable 'doc-view-current-search-matches)
794 (setq doc-view-current-doc (buffer-file-name))
795 (insert-file-contents doc-view-current-doc)
796 (use-local-map doc-view-mode-text-map)
797 (setq mode-name "DocView[text]"
798 doc-view-current-display 'text
799 buffer-read-only t
800 revert-buffer-function 'doc-view-reconvert-doc)
801 ;; Switch to image display if possible
802 (if (and (display-images-p)
803 (image-type-available-p 'png)
804 (not (get-text-property (point-min) 'display)))
805 (doc-view-toggle-display))
806 (message
807 "%s"
808 (substitute-command-keys
809 "Type \\[doc-view-toggle-display] to toggle between image and text display.")))
747 810
748(defun doc-view-clear-cache () 811(defun doc-view-clear-cache ()
749 "Delete the whole cache (`doc-view-cache-directory')." 812 "Delete the whole cache (`doc-view-cache-directory')."
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index cabd0dd391e..4a5c9149a43 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -2013,7 +2013,10 @@ On each iteration VAR will be bound to the name of an advised function
2013(if (not (get 'ad-do-advised-functions 'lisp-indent-hook)) 2013(if (not (get 'ad-do-advised-functions 'lisp-indent-hook))
2014 (put 'ad-do-advised-functions 'lisp-indent-hook 1)) 2014 (put 'ad-do-advised-functions 'lisp-indent-hook 1))
2015 2015
2016(defmacro ad-get-advice-info (function) 2016(defun ad-get-advice-info (function)
2017 (get function 'ad-advice-info))
2018
2019(defmacro ad-get-advice-info-macro (function)
2017 `(get ,function 'ad-advice-info)) 2020 `(get ,function 'ad-advice-info))
2018 2021
2019(defmacro ad-set-advice-info (function advice-info) 2022(defmacro ad-set-advice-info (function advice-info)
@@ -2025,7 +2028,7 @@ On each iteration VAR will be bound to the name of an advised function
2025(defmacro ad-is-advised (function) 2028(defmacro ad-is-advised (function)
2026 "Return non-nil if FUNCTION has any advice info associated with it. 2029 "Return non-nil if FUNCTION has any advice info associated with it.
2027This does not mean that the advice is also active." 2030This does not mean that the advice is also active."
2028 (list 'ad-get-advice-info function)) 2031 (list 'ad-get-advice-info-macro function))
2029 2032
2030(defun ad-initialize-advice-info (function) 2033(defun ad-initialize-advice-info (function)
2031 "Initialize the advice info for FUNCTION. 2034 "Initialize the advice info for FUNCTION.
@@ -2035,16 +2038,16 @@ Assumes that FUNCTION has not yet been advised."
2035 2038
2036(defmacro ad-get-advice-info-field (function field) 2039(defmacro ad-get-advice-info-field (function field)
2037 "Retrieve the value of the advice info FIELD of FUNCTION." 2040 "Retrieve the value of the advice info FIELD of FUNCTION."
2038 `(cdr (assq ,field (ad-get-advice-info ,function)))) 2041 `(cdr (assq ,field (ad-get-advice-info-macro ,function))))
2039 2042
2040(defun ad-set-advice-info-field (function field value) 2043(defun ad-set-advice-info-field (function field value)
2041 "Destructively modify VALUE of the advice info FIELD of FUNCTION." 2044 "Destructively modify VALUE of the advice info FIELD of FUNCTION."
2042 (and (ad-is-advised function) 2045 (and (ad-is-advised function)
2043 (cond ((assq field (ad-get-advice-info function)) 2046 (cond ((assq field (ad-get-advice-info-macro function))
2044 ;; A field with that name is already present: 2047 ;; A field with that name is already present:
2045 (rplacd (assq field (ad-get-advice-info function)) value)) 2048 (rplacd (assq field (ad-get-advice-info-macro function)) value))
2046 (t;; otherwise, create a new field with that name: 2049 (t;; otherwise, create a new field with that name:
2047 (nconc (ad-get-advice-info function) 2050 (nconc (ad-get-advice-info-macro function)
2048 (list (cons field value))))))) 2051 (list (cons field value)))))))
2049 2052
2050;; Don't make this a macro so we can use it as a predicate: 2053;; Don't make this a macro so we can use it as a predicate:
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 6a259ffd4f7..20b91b10547 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -46,8 +46,6 @@
46 46
47;;; Code: 47;;; Code:
48 48
49(require 'loadhist)
50
51;;; User variables: 49;;; User variables:
52 50
53(defgroup find-function nil 51(defgroup find-function nil
diff --git a/lisp/emerge.el b/lisp/emerge.el
index 0c1b3b170cd..fd002409a7f 100644
--- a/lisp/emerge.el
+++ b/lisp/emerge.el
@@ -633,7 +633,7 @@ This is *not* a user option, since Emerge uses it for its own processing.")
633 (if output-file 633 (if output-file
634 (concat "Output to file: " output-file) 634 (concat "Output to file: " output-file)
635 (concat "Output to buffer: " (buffer-name merge-buffer)))) 635 (concat "Output to buffer: " (buffer-name merge-buffer))))
636 (insert-buffer emerge-A-buffer) 636 (save-excursion (insert-buffer-substring emerge-A-buffer))
637 (emerge-set-keys) 637 (emerge-set-keys)
638 (setq emerge-difference-list (emerge-make-diff-list file-A file-B)) 638 (setq emerge-difference-list (emerge-make-diff-list file-A file-B))
639 (setq emerge-number-of-differences (length emerge-difference-list)) 639 (setq emerge-number-of-differences (length emerge-difference-list))
@@ -712,7 +712,7 @@ This is *not* a user option, since Emerge uses it for its own processing.")
712 (emerge-eval-in-buffer 712 (emerge-eval-in-buffer
713 emerge-diff-error-buffer 713 emerge-diff-error-buffer
714 (erase-buffer) 714 (erase-buffer)
715 (insert-buffer emerge-diff-buffer) 715 (save-excursion (insert-buffer-substring emerge-diff-buffer))
716 (delete-matching-lines ok-regexp))) 716 (delete-matching-lines ok-regexp)))
717 717
718;;; Top-level and setup functions for three-file mode. 718;;; Top-level and setup functions for three-file mode.
@@ -802,7 +802,7 @@ This is *not* a user option, since Emerge uses it for its own processing.")
802 (if output-file 802 (if output-file
803 (concat "Output to file: " output-file) 803 (concat "Output to file: " output-file)
804 (concat "Output to buffer: " (buffer-name merge-buffer)))) 804 (concat "Output to buffer: " (buffer-name merge-buffer))))
805 (insert-buffer emerge-A-buffer) 805 (save-excursion (insert-buffer-substring emerge-A-buffer))
806 (emerge-set-keys) 806 (emerge-set-keys)
807 (setq emerge-difference-list 807 (setq emerge-difference-list
808 (emerge-make-diff3-list file-A file-B file-ancestor)) 808 (emerge-make-diff3-list file-A file-B file-ancestor))
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index d3194f3625a..f999bdcdf6d 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -204,7 +204,7 @@ which may be modified directly. Any return value is ignored."
204 :type 'hook 204 :type 'hook
205 :group 'eshell-cmd) 205 :group 'eshell-cmd)
206 206
207(defcustom eshell-complex-commands nil 207(defcustom eshell-complex-commands '("ls")
208 "*A list of commands names or functions, that determine complexity. 208 "*A list of commands names or functions, that determine complexity.
209That is, if a command is defined by a function named eshell/NAME, 209That is, if a command is defined by a function named eshell/NAME,
210and NAME is part of this list, it is invoked as a complex command. 210and NAME is part of this list, it is invoked as a complex command.
diff --git a/lisp/faces.el b/lisp/faces.el
index 8a0ba7d221f..1ced221692d 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1947,8 +1947,10 @@ created."
1947 (modify-frame-parameters frame '((interprogram-cut-function . nil))) 1947 (modify-frame-parameters frame '((interprogram-cut-function . nil)))
1948 (modify-frame-parameters frame '((interprogram-paste-function . nil))) 1948 (modify-frame-parameters frame '((interprogram-paste-function . nil)))
1949 1949
1950 (set-locale-environment nil frame) 1950 (unless (terminal-parameter frame 'terminal-initted)
1951 (tty-run-terminal-initialization frame) 1951 (set-terminal-parameter frame 'terminal-initted t)
1952 (set-locale-environment nil frame)
1953 (tty-run-terminal-initialization frame))
1952 (frame-set-background-mode frame) 1954 (frame-set-background-mode frame)
1953 (face-set-after-frame-default frame) 1955 (face-set-after-frame-default frame)
1954 (setq success t)) 1956 (setq success t))
@@ -1981,10 +1983,7 @@ terminal type to a different value."
1981 ;; Load library for our terminal type. 1983 ;; Load library for our terminal type.
1982 ;; User init file can set term-file-prefix to nil to prevent this. 1984 ;; User init file can set term-file-prefix to nil to prevent this.
1983 (with-selected-frame frame 1985 (with-selected-frame frame
1984 (unless (or (null term-file-prefix) 1986 (unless (null term-file-prefix)
1985 ;; Don't reinitialize the terminal each time a new
1986 ;; frame is opened on it.
1987 (terminal-parameter frame 'terminal-initted))
1988 (let* (term-init-func) 1987 (let* (term-init-func)
1989 ;; First, load the terminal initialization file, if it is 1988 ;; First, load the terminal initialization file, if it is
1990 ;; available and it hasn't been loaded already. 1989 ;; available and it hasn't been loaded already.
diff --git a/lisp/files.el b/lisp/files.el
index be28dec4c40..6d03ad24dbe 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2060,6 +2060,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\)\\'" . archive-mode)
2060 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode) 2060 ("\\.\\(diffs?\\|patch\\|rej\\)\\'" . diff-mode)
2061 ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG 2061 ("\\.\\(dif\\|pat\\)\\'" . diff-mode) ; for MSDOG
2062 ("\\.[eE]?[pP][sS]\\'" . ps-mode) 2062 ("\\.[eE]?[pP][sS]\\'" . ps-mode)
2063 ("\\.\\(?:PDF\\|DVI\\|pdf\\|dvi\\)" . doc-view-mode)
2063 ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode) 2064 ("configure\\.\\(ac\\|in\\)\\'" . autoconf-mode)
2064 ("BROWSE\\'" . ebrowse-tree-mode) 2065 ("BROWSE\\'" . ebrowse-tree-mode)
2065 ("\\.ebrowse\\'" . ebrowse-tree-mode) 2066 ("\\.ebrowse\\'" . ebrowse-tree-mode)
diff --git a/lisp/filesets.el b/lisp/filesets.el
index e5dde847853..d7a7dc9efa0 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -158,7 +158,7 @@ COND-FN takes one argument: the current element."
158 (setq rv (append rv (list elt))))))) 158 (setq rv (append rv (list elt)))))))
159 159
160(defun filesets-ormap (fsom-pred lst) 160(defun filesets-ormap (fsom-pred lst)
161 "Return the tail of FSOM-LST for the head of which FSOM-PRED is non-nil." 161 "Return the tail of LST for the head of which FSOM-PRED is non-nil."
162 (let ((fsom-lst lst) 162 (let ((fsom-lst lst)
163 (fsom-rv nil)) 163 (fsom-rv nil))
164 (while (and (not (null fsom-lst)) 164 (while (and (not (null fsom-lst))
@@ -535,7 +535,7 @@ computer environments."
535 :group 'filesets) 535 :group 'filesets)
536 536
537(defcustom filesets-sort-case-sensitive-flag t 537(defcustom filesets-sort-case-sensitive-flag t
538 "Non-nil means sorting of the filesete menu is case sensitive." 538 "Non-nil means sorting of the filesets menu is case sensitive."
539 :set (function filesets-set-default) 539 :set (function filesets-set-default)
540 :type 'boolean 540 :type 'boolean
541 :group 'filesets) 541 :group 'filesets)
@@ -1091,10 +1091,7 @@ If NEGATIVE is non-nil, remove all directory names."
1091 "Return a sorted copy of LST, LST being a list of strings. 1091 "Return a sorted copy of LST, LST being a list of strings.
1092If `filesets-sort-menu-flag' is nil, return LST itself. 1092If `filesets-sort-menu-flag' is nil, return LST itself.
1093 1093
1094ACCESS-FN ... function to get the string value of LST's elements. 1094ACCESS-FN ... function to get the string value of LST's elements."
1095
1096If SIMPLY-DO-IT is non-nil, the list is sorted regardless of
1097`filesets-sort-menu-flag'."
1098 (if filesets-sort-menu-flag 1095 (if filesets-sort-menu-flag
1099 (let* ((fni (or access-fn 1096 (let* ((fni (or access-fn
1100 (function identity))) 1097 (function identity)))
@@ -1363,7 +1360,7 @@ not be opened."
1363 (find-file file))) 1360 (find-file file)))
1364 1361
1365(defun filesets-find-or-display-file (&optional file viewer) 1362(defun filesets-find-or-display-file (&optional file viewer)
1366 "Visit FILE using an external viewer or open it in an Emacs buffer." 1363 "Visit FILE using an external VIEWER or open it in an Emacs buffer."
1367 (interactive) 1364 (interactive)
1368 (let* ((file (or file 1365 (let* ((file (or file
1369 (read-file-name "Find file: " nil nil viewer))) 1366 (read-file-name "Find file: " nil nil viewer)))
@@ -1414,24 +1411,24 @@ not be opened."
1414 something))) 1411 something)))
1415 1412
1416(defun filesets-data-get-name (entry) 1413(defun filesets-data-get-name (entry)
1417 "Access to `filesets-data'. Get the entry's name." 1414 "Access to `filesets-data'. Get the ENTRY's name."
1418 (car entry)) 1415 (car entry))
1419 1416
1420(defun filesets-data-get-data (entry) 1417(defun filesets-data-get-data (entry)
1421 "Access to `filesets-data'. Get the entry's data section." 1418 "Access to `filesets-data'. Get the ENTRY's data section."
1422 (cdr entry)) 1419 (cdr entry))
1423 1420
1424(defun filesets-alist-get (alist key &optional default carp) 1421(defun filesets-alist-get (alist key &optional default carp)
1425 "Get KEY's value in the association list ALIST. 1422 "Get KEY's value in the association list ALIST.
1426Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil." 1423Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil."
1427 (let* ((elt (assoc key alist))) 1424 (let ((elt (assoc key alist)))
1428 (cond 1425 (cond
1429 (elt 1426 (elt
1430 (if carp 1427 (if carp
1431 (cadr elt) 1428 (cadr elt)
1432 (cdr elt))) 1429 (cdr elt)))
1433 (default default) 1430 (default default)
1434 (t nil)))) 1431 (t nil))))
1435 1432
1436(defun filesets-data-get (entry key &optional default carp) 1433(defun filesets-data-get (entry key &optional default carp)
1437 "Extract the value for KEY in the data part of fileset ENTRY. 1434 "Extract the value for KEY in the data part of fileset ENTRY.
@@ -1439,7 +1436,7 @@ Return DEFAULT if not found. Return (car VALUE) if CARP is non-nil."
1439 (filesets-alist-get (filesets-data-get-data entry) key default carp)) 1436 (filesets-alist-get (filesets-data-get-data entry) key default carp))
1440 1437
1441(defun filesets-data-set (entry key value) 1438(defun filesets-data-set (entry key value)
1442 "Set the value for KEY in the data part of fileset ENTRY." 1439 "Set the VALUE for KEY in the data part of fileset ENTRY."
1443 (let* ((alist (filesets-data-get-data entry)) 1440 (let* ((alist (filesets-data-get-data entry))
1444 (elt (assoc key alist))) 1441 (elt (assoc key alist)))
1445 (if elt 1442 (if elt
@@ -1666,9 +1663,9 @@ Replace <file-name> or <<file-name>> with filename."
1666 filesets-commands))) 1663 filesets-commands)))
1667 1664
1668 1665
1669;;; sampe commands 1666;;; sample commands
1670(defun filesets-cmd-query-replace-getargs () 1667(defun filesets-cmd-query-replace-getargs ()
1671 "Get arguments for `filesets-cmd-query-replace'." 1668 "Get arguments for `query-replace' and `query-replace-regexp'."
1672 (let* ((from-string (read-string "Filesets query replace: " 1669 (let* ((from-string (read-string "Filesets query replace: "
1673 "" 1670 ""
1674 'query-replace-history)) 1671 'query-replace-history))
@@ -1875,7 +1872,7 @@ User will be queried, if no fileset name is provided."
1875 (browse-url filesets-homepage)) 1872 (browse-url filesets-homepage))
1876 1873
1877(defun filesets-remake-shortcut (count submenu) 1874(defun filesets-remake-shortcut (count submenu)
1878 "Remake a submenus shortcut when wrapping long menus." 1875 "Remake a submenu's shortcut when wrapping long menus."
1879 (let* ((name (concat (filesets-get-shortcut count) 1876 (let* ((name (concat (filesets-get-shortcut count)
1880 (substring (elt submenu 0) 2)))) 1877 (substring (elt submenu 0) 2))))
1881 (if (listp submenu) 1878 (if (listp submenu)
@@ -2032,7 +2029,7 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
2032 (lax-plist-put filesets-ingroup-cache emaster this)))) 2029 (lax-plist-put filesets-ingroup-cache emaster this))))
2033 2030
2034(defun filesets-ingroup-collect-files (fs &optional remdupl-flag master depth) 2031(defun filesets-ingroup-collect-files (fs &optional remdupl-flag master depth)
2035 "Helper function for `filesets-ingroup-collect'. Collect file names." 2032 "Helper function for `filesets-ingroup-collect'. Collect file names."
2036 (let* ((master (or master 2033 (let* ((master (or master
2037 (filesets-entry-get-master fs))) 2034 (filesets-entry-get-master fs)))
2038 (remdupl-flag (or remdupl-flag 2035 (remdupl-flag (or remdupl-flag
@@ -2146,7 +2143,7 @@ FS is a fileset's name. FLIST is a list returned by
2146 `([,nm (filesets-file-open nil ',master ',fsn)]))))))))) 2143 `([,nm (filesets-file-open nil ',master ',fsn)])))))))))
2147 2144
2148(defun filesets-ingroup-collect (fs remdupl-flag master) 2145(defun filesets-ingroup-collect (fs remdupl-flag master)
2149 "Collect names of included files & build submenu." 2146 "Collect names of included files and build submenu."
2150 (filesets-ingroup-cache-put master nil) 2147 (filesets-ingroup-cache-put master nil)
2151 (filesets-message 2 "Filesets: parsing %S" master) 2148 (filesets-message 2 "Filesets: parsing %S" master)
2152 (filesets-ingroup-collect-build-menu 2149 (filesets-ingroup-collect-build-menu
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 89d9d75c60e..59a32921dc5 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,15 @@
12007-10-15 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus-util.el (gnus-string<): New function.
4
5 * gnus-sum.el (gnus-article-sort-by-author)
6 (gnus-article-sort-by-subject): Use it.
7
82007-10-15 Katsumi Yamaoka <yamaoka@jpl.org>
9
10 * gnus-win.el (gnus-configure-windows): Focus on the frame for which
11 the frame-focus tag is set in gnus-buffer-configuration.
12
12007-10-04 Juanma Barranquero <lekktu@gmail.com> 132007-10-04 Juanma Barranquero <lekktu@gmail.com>
2 14
3 * sieve-manage.el (sieve-manage-interactive-login): Doc fix. 15 * sieve-manage.el (sieve-manage-interactive-login): Doc fix.
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 36e93796a63..8fb18d3a990 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -4674,7 +4674,7 @@ using some other form will lead to serious barfage."
4674 4674
4675(defsubst gnus-article-sort-by-author (h1 h2) 4675(defsubst gnus-article-sort-by-author (h1 h2)
4676 "Sort articles by root author." 4676 "Sort articles by root author."
4677 (string-lessp 4677 (gnus-string<
4678 (let ((extract (funcall 4678 (let ((extract (funcall
4679 gnus-extract-address-components 4679 gnus-extract-address-components
4680 (mail-header-from h1)))) 4680 (mail-header-from h1))))
@@ -4691,7 +4691,7 @@ using some other form will lead to serious barfage."
4691 4691
4692(defsubst gnus-article-sort-by-subject (h1 h2) 4692(defsubst gnus-article-sort-by-subject (h1 h2)
4693 "Sort articles by root subject." 4693 "Sort articles by root subject."
4694 (string-lessp 4694 (gnus-string<
4695 (downcase (gnus-simplify-subject-re (mail-header-subject h1))) 4695 (downcase (gnus-simplify-subject-re (mail-header-subject h1)))
4696 (downcase (gnus-simplify-subject-re (mail-header-subject h2))))) 4696 (downcase (gnus-simplify-subject-re (mail-header-subject h2)))))
4697 4697
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 74aacdd2860..3d3e4148c2d 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -290,6 +290,15 @@ is slower."
290 (not (or (string< s1 s2) 290 (not (or (string< s1 s2)
291 (string= s1 s2)))) 291 (string= s1 s2))))
292 292
293(defun gnus-string< (s1 s2)
294 "Return t if first arg string is less than second in lexicographic order.
295Case is significant if and only if `case-fold-search' is nil.
296Symbols are also allowed; their print names are used instead."
297 (if case-fold-search
298 (string-lessp (downcase (if (symbolp s1) (symbol-name s1) s1))
299 (downcase (if (symbolp s2) (symbol-name s2) s2)))
300 (string-lessp s1 s2)))
301
293;;; Time functions. 302;;; Time functions.
294 303
295(defun gnus-file-newer-than (file date) 304(defun gnus-file-newer-than (file date)
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
index 5c57aaa1886..7e1609cc196 100644
--- a/lisp/gnus/gnus-win.el
+++ b/lisp/gnus/gnus-win.el
@@ -471,7 +471,8 @@ See the Gnus manual for an explanation of the syntax used.")
471 (gnus-configure-frame split) 471 (gnus-configure-frame split)
472 (run-hooks 'gnus-configure-windows-hook) 472 (run-hooks 'gnus-configure-windows-hook)
473 (when gnus-window-frame-focus 473 (when gnus-window-frame-focus
474 (select-frame (window-frame gnus-window-frame-focus)))))))) 474 (gnus-select-frame-set-input-focus
475 (window-frame gnus-window-frame-focus))))))))
475 476
476(defun gnus-delete-windows-in-gnusey-frames () 477(defun gnus-delete-windows-in-gnusey-frames ()
477 "Do a `delete-other-windows' in all frames that have Gnus windows." 478 "Do a `delete-other-windows' in all frames that have Gnus windows."
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index bf8d5f9a209..befd83c76ef 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -239,7 +239,7 @@ face (according to `face-differs-from-default-p')."
239 ".elc")) 239 ".elc"))
240 load-path)) 240 load-path))
241 (str (if (and elc-file (file-readable-p elc-file)) 241 (str (if (and elc-file (file-readable-p elc-file))
242 (with-temp-buffer 242 (with-temp-buffer
243 (insert-file-contents-literally elc-file nil 0 256) 243 (insert-file-contents-literally elc-file nil 0 256)
244 (buffer-string)))) 244 (buffer-string))))
245 (src-file (and str 245 (src-file (and str
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 7847bed6f2d..2c39b736097 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -180,8 +180,8 @@ QUALIFIERS is a list of the same form as
180 180
181See also the variables `ibuffer-filter-groups', 181See also the variables `ibuffer-filter-groups',
182`ibuffer-filtering-qualifiers', `ibuffer-filtering-alist', and the 182`ibuffer-filtering-qualifiers', `ibuffer-filtering-alist', and the
183functions `ibuffer-switch-to-saved-filter-group', 183functions `ibuffer-switch-to-saved-filter-groups',
184`ibuffer-save-filter-group'." 184`ibuffer-save-filter-groups'."
185 :type '(repeat sexp) 185 :type '(repeat sexp)
186 :group 'ibuffer) 186 :group 'ibuffer)
187 187
diff --git a/lisp/indent.el b/lisp/indent.el
index db8958bd1ca..77354444cfa 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -86,10 +86,10 @@ If `transient-mark-mode' is turned on the region is active,
86indent the region. 86indent the region.
87The function actually called to indent the line is determined by the value of 87The function actually called to indent the line is determined by the value of
88`indent-line-function'." 88`indent-line-function'."
89 (interactive "P") 89 (interactive "p")
90 (cond 90 (cond
91 ;; The region is active, indent it. 91 ;; The region is active, indent it.
92 ((and transient-mark-mode mark-active 92 ((and arg transient-mark-mode mark-active
93 (not (eq (region-beginning) (region-end)))) 93 (not (eq (region-beginning) (region-end))))
94 (indent-region (region-beginning) (region-end))) 94 (indent-region (region-beginning) (region-end)))
95 ((or ;; indent-to-left-margin is only meant for indenting, 95 ((or ;; indent-to-left-margin is only meant for indenting,
diff --git a/lisp/international/encoded-kb.el b/lisp/international/encoded-kb.el
index 1ebdcd5cabd..d482b465250 100644
--- a/lisp/international/encoded-kb.el
+++ b/lisp/international/encoded-kb.el
@@ -338,38 +338,63 @@ DISPLAY may be a display id, a frame, or nil for the selected frame's display."
338 (when frame 338 (when frame
339 (with-selected-frame frame 339 (with-selected-frame frame
340 ;; Remove any previous encoded-kb keymap from input-decode-map. 340 ;; Remove any previous encoded-kb keymap from input-decode-map.
341 (let ((m input-decode-map)) 341 (let ((m input-decode-map)
342 (if (equal (keymap-prompt m) "encoded-kb") 342 (child nil))
343 (setq input-decode-map (keymap-parent m)) 343 (while (keymapp m)
344 (while (keymap-parent m) 344 (if (not (equal (keymap-prompt m) "encoded-kb"))
345 (if (equal (keymap-prompt (keymap-parent m)) "encoded-kb") 345 (progn
346 (set-keymap-parent m (keymap-parent (keymap-parent m)))) 346 (setq child m)
347 (setq m (keymap-parent m))))) 347 (setq m (keymap-parent m)))
348 348 ;; We've found an encoded-kb map, but maybe the prompt we get
349 (if (keyboard-coding-system) 349 ;; is really inherited from the encoded-kb map.
350 ;; We are turning on Encoded-kbd mode. 350 (let (mp)
351 (let ((coding (keyboard-coding-system)) 351 (while (and (keymapp (setq mp (keymap-parent m)))
352 (keymap (make-sparse-keymap "encoded-kb")) 352 (equal (keymap-prompt mp) "encoded-kb"))
353 (cim (current-input-mode)) 353 (setq child m)
354 result) 354 (setq m mp))
355 (set-keymap-parent keymap input-decode-map) 355 ;; (assert (equal (keymap-prompt m) "encoded-kb"))
356 (setq input-decode-map keymap) 356 ;; (assert (eq mp (keymap-parent m)))
357 (unless (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode) 357 ;; (assert (not (and (keymapp mp)
358 (set-terminal-parameter nil 'encoded-kbd-saved-input-mode (nth 2 cim))) 358 ;; (equal (keymap-prompt mp) "encoded-kb"))))
359 (setq result (and coding (encoded-kbd-setup-keymap keymap coding))) 359 ;; (assert (eq m (if child
360 (if result 360 ;; (keymap-parent child) input-decode-map)))
361 (when (and (eq result 8) 361 ;; We can finally do the actual removal.
362 (memq (nth 2 cim) '(t nil))) 362 (if child
363 (set-input-meta-mode 'use-8th-bit)) 363 (set-keymap-parent child mp)
364 (set-terminal-parameter nil 'encoded-kbd-saved-input-meta-mode nil) 364 (setq input-decode-map mp))
365 (error "Unsupported coding system in Encoded-kbd mode: %S" 365 (setq m mp))))))
366 coding))) 366
367 ;; We are turning off Encoded-kbd mode. 367 (if (keyboard-coding-system)
368 (when (and (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode) 368 ;; We are turning on Encoded-kbd mode.
369 (not (equal (nth 2 (current-input-mode)) 369 (let ((coding (keyboard-coding-system))
370 (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)))) 370 (keymap (make-sparse-keymap "encoded-kb"))
371 (set-input-meta-mode (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode))) 371 (cim (current-input-mode))
372 (set-terminal-parameter nil 'saved-input-meta-mode nil)))))) 372 result)
373 ;; Place `keymap' as the immediate parent of input-decode-map
374 ;; rather than on top, so that later `define-key' on
375 ;; input-decode-map don't end up accidentally changing our
376 ;; part of the keymap, which would lead to bugs when/if we later
377 ;; on remove that part.
378 (set-keymap-parent keymap (keymap-parent input-decode-map))
379 (set-keymap-parent input-decode-map keymap)
380 (unless (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)
381 (set-terminal-parameter nil 'encoded-kbd-saved-input-mode
382 (nth 2 cim)))
383 (setq result (and coding (encoded-kbd-setup-keymap keymap coding)))
384 (if result
385 (when (and (eq result 8)
386 (memq (nth 2 cim) '(t nil)))
387 (set-input-meta-mode 'use-8th-bit))
388 (set-terminal-parameter
389 nil 'encoded-kbd-saved-input-meta-mode nil)
390 (error "Unsupported coding system in Encoded-kbd mode: %S"
391 coding)))
392 ;; We are turning off Encoded-kbd mode.
393 (let ((old (terminal-parameter nil 'encoded-kbd-saved-input-meta-mode)))
394 (when (and old (not (equal (nth 2 (current-input-mode)) old)))
395 (set-input-meta-mode old))
396 (set-terminal-parameter
397 nil 'encoded-kbd-saved-input-meta-mode nil))))))
373 398
374(provide 'encoded-kb) 399(provide 'encoded-kb)
375 400
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 4e9ee480d65..95de0d822a3 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -38,12 +38,11 @@
38 "Return the file and list of definitions associated with FEATURE. 38 "Return the file and list of definitions associated with FEATURE.
39The value is actually the element of `load-history' 39The value is actually the element of `load-history'
40for the file that did (provide FEATURE)." 40for the file that did (provide FEATURE)."
41 (catch 'foundit 41 (catch 'foundit
42 (mapc (lambda (x) 42 (let ((element (cons 'provide feature)))
43 (if (member (cons 'provide feature) (cdr x)) 43 (dolist (x load-history nil)
44 (throw 'foundit x))) 44 (when (member element (cdr x))
45 load-history) 45 (throw 'foundit x))))))
46 nil))
47 46
48(defun feature-file (feature) 47(defun feature-file (feature)
49 "Return the file name from which a given FEATURE was loaded. 48 "Return the file name from which a given FEATURE was loaded.
@@ -72,32 +71,25 @@ A library name is equivalent to the file name that `load-library' would load."
72 "Return the list of features provided by FILE as it was loaded. 71 "Return the list of features provided by FILE as it was loaded.
73FILE can be a file name, or a library name. 72FILE can be a file name, or a library name.
74A library name is equivalent to the file name that `load-library' would load." 73A library name is equivalent to the file name that `load-library' would load."
75 (let ((symbols (file-loadhist-lookup file)) 74 (let (provides)
76 provides) 75 (dolist (x (file-loadhist-lookup file) provides)
77 (mapc (lambda (x) 76 (when (eq (car-safe x) 'provide)
78 (if (and (consp x) (eq (car x) 'provide)) 77 (push x provides)))))
79 (setq provides (cons (cdr x) provides))))
80 symbols)
81 provides))
82 78
83(defun file-requires (file) 79(defun file-requires (file)
84 "Return the list of features required by FILE as it was loaded. 80 "Return the list of features required by FILE as it was loaded.
85FILE can be a file name, or a library name. 81FILE can be a file name, or a library name.
86A library name is equivalent to the file name that `load-library' would load." 82A library name is equivalent to the file name that `load-library' would load."
87 (let ((symbols (file-loadhist-lookup file)) 83 (let (requires)
88 requires) 84 (dolist (x (file-loadhist-lookup file) requires)
89 (mapc (lambda (x) 85 (when (eq (car-safe x) 'require)
90 (if (and (consp x) (eq (car x) 'require)) 86 (push x requires)))))
91 (setq requires (cons (cdr x) requires))))
92 symbols)
93 requires))
94 87
95(defsubst file-set-intersect (p q) 88(defsubst file-set-intersect (p q)
96 "Return the set intersection of two lists." 89 "Return the set intersection of two lists."
97 (let ((ret nil)) 90 (let (ret)
98 (dolist (x p ret) 91 (dolist (x p ret)
99 (if (memq x q) (setq ret (cons x ret)))) 92 (when (memq x q) (push x ret)))))
100 ret))
101 93
102(defun file-dependents (file) 94(defun file-dependents (file)
103 "Return the list of loaded libraries that depend on FILE. 95 "Return the list of loaded libraries that depend on FILE.
@@ -107,9 +99,8 @@ A library name is equivalent to the file name that `load-library' would load."
107 (let ((provides (file-provides file)) 99 (let ((provides (file-provides file))
108 (dependents nil)) 100 (dependents nil))
109 (dolist (x load-history dependents) 101 (dolist (x load-history dependents)
110 (if (file-set-intersect provides (file-requires (car x))) 102 (when (file-set-intersect provides (file-requires (car x)))
111 (setq dependents (cons (car x) dependents)))) 103 (push (car x) dependents)))))
112 dependents))
113 104
114(defun read-feature (prompt &optional loaded-p) 105(defun read-feature (prompt &optional loaded-p)
115 "Read feature name from the minibuffer, prompting with string PROMPT. 106 "Read feature name from the minibuffer, prompting with string PROMPT.
@@ -126,15 +117,19 @@ from a file."
126 117
127(defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks) 118(defvaralias 'loadhist-hook-functions 'unload-feature-special-hooks)
128(defvar unload-feature-special-hooks 119(defvar unload-feature-special-hooks
129 '(after-change-functions 120 '(after-change-functions after-insert-file-functions
130 after-insert-file-functions auto-fill-function 121 after-make-frame-functions auto-fill-function before-change-functions
131 before-change-functions blink-paren-function 122 blink-paren-function buffer-access-fontify-functions command-line-functions
132 buffer-access-fontify-functions command-line-functions 123 comment-indent-function compilation-finish-functions
133 comment-indent-function kill-buffer-query-functions 124 disabled-command-function find-file-not-found-functions
134 kill-emacs-query-functions lisp-indent-function 125 font-lock-beginning-of-syntax-function font-lock-fontify-buffer-function
135 mouse-position-function 126 font-lock-fontify-region-function font-lock-mark-block-function
127 font-lock-syntactic-face-function font-lock-unfontify-buffer-function
128 font-lock-unfontify-region-function kill-buffer-query-functions
129 kill-emacs-query-functions lisp-indent-function mouse-position-function
136 redisplay-end-trigger-functions temp-buffer-show-function 130 redisplay-end-trigger-functions temp-buffer-show-function
137 window-scroll-functions window-size-change-functions 131 window-scroll-functions window-size-change-functions
132 write-contents-functions write-file-functions
138 write-region-annotate-functions) 133 write-region-annotate-functions)
139 "A list of special hooks from Info node `(elisp)Standard Hooks'. 134 "A list of special hooks from Info node `(elisp)Standard Hooks'.
140 135
diff --git a/lisp/longlines.el b/lisp/longlines.el
index 07977910a22..c820150c27a 100644
--- a/lisp/longlines.el
+++ b/lisp/longlines.el
@@ -55,7 +55,11 @@ when the file is saved to disk."
55 "Non-nil means wrapping and filling happen at the edge of the window. 55 "Non-nil means wrapping and filling happen at the edge of the window.
56Otherwise, `fill-column' is used, regardless of the window size. This 56Otherwise, `fill-column' is used, regardless of the window size. This
57does not work well when the buffer is displayed in multiple windows 57does not work well when the buffer is displayed in multiple windows
58with differing widths." 58with differing widths.
59
60If the value is an integer, that specifies the distance from the
61right edge of the window at which wrapping occurs. For any other
62non-nil value, wrapping occurs 2 characters from the right edge."
59 :group 'longlines 63 :group 'longlines
60 :type 'boolean) 64 :type 'boolean)
61 65
@@ -117,8 +121,14 @@ are indicated with a symbol."
117 'longlines-search-function) 121 'longlines-search-function)
118 (add-to-list 'buffer-substring-filters 'longlines-encode-string) 122 (add-to-list 'buffer-substring-filters 'longlines-encode-string)
119 (when longlines-wrap-follows-window-size 123 (when longlines-wrap-follows-window-size
120 (set (make-local-variable 'fill-column) 124 (let ((dw (if (and (integerp longlines-wrap-follows-window-size)
121 (- (window-width) window-min-width)) 125 (>= longlines-wrap-follows-window-size 0)
126 (< longlines-wrap-follows-window-size
127 (window-width)))
128 longlines-wrap-follows-window-size
129 2)))
130 (set (make-local-variable 'fill-column)
131 (- (window-width) dw)))
122 (add-hook 'window-configuration-change-hook 132 (add-hook 'window-configuration-change-hook
123 'longlines-window-change-function nil t)) 133 'longlines-window-change-function nil t))
124 (let ((buffer-undo-list t) 134 (let ((buffer-undo-list t)
@@ -415,9 +425,14 @@ This is called by `post-command-hook' after each command."
415(defun longlines-window-change-function () 425(defun longlines-window-change-function ()
416 "Re-wrap the buffer if the window width has changed. 426 "Re-wrap the buffer if the window width has changed.
417This is called by `window-configuration-change-hook'." 427This is called by `window-configuration-change-hook'."
418 (when (/= fill-column (- (window-width) window-min-width)) 428 (let ((dw (if (and (integerp longlines-wrap-follows-window-size)
419 (setq fill-column (- (window-width) window-min-width)) 429 (>= longlines-wrap-follows-window-size 0)
420 (longlines-wrap-region (point-min) (point-max)))) 430 (< longlines-wrap-follows-window-size (window-width)))
431 longlines-wrap-follows-window-size
432 2)))
433 (when (/= fill-column (- (window-width) dw))
434 (setq fill-column (- (window-width) dw))
435 (longlines-wrap-region (point-min) (point-max)))))
421 436
422;; Isearch 437;; Isearch
423 438
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 34a0aa0ad82..e8d896be246 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -991,6 +991,19 @@ See also the function `select-message-coding-system'.")
991 nil) 991 nil)
992 (t (error "Invalid value for `mail-from-style'"))))) 992 (t (error "Invalid value for `mail-from-style'")))))
993 993
994;; Normally you will not need to modify these options unless you are
995;; using some non-genuine substitute for sendmail which does not
996;; implement each and every option that the original supports.
997;; E.g., ssmtp does not support "-odb", so, if your site uses it,
998;; you will need to modify `sendmail-error-reporting-non-interactive'
999;; in your site-init.el.
1000(defvar sendmail-error-reporting-interactive
1001 ;; These mean "report errors to terminal" and "deliver interactively"
1002 '("-oep" "-odi"))
1003(defvar sendmail-error-reporting-non-interactive
1004 ;; These mean "report errors by mail" and "deliver in background".
1005 '("-oem" "-odb"))
1006
994(defun sendmail-send-it () 1007(defun sendmail-send-it ()
995 "Send the current mail buffer using the Sendmail package. 1008 "Send the current mail buffer using the Sendmail package.
996This is a suitable value for `send-mail-function'. It sends using the 1009This is a suitable value for `send-mail-function'. It sends using the
@@ -1135,12 +1148,8 @@ external program defined by `sendmail-program'."
1135 (and mail-alias-file 1148 (and mail-alias-file
1136 (list (concat "-oA" mail-alias-file))) 1149 (list (concat "-oA" mail-alias-file)))
1137 (if mail-interactive 1150 (if mail-interactive
1138 ;; These mean "report errors to terminal" 1151 sendmail-error-reporting-interactive
1139 ;; and "deliver interactively" 1152 sendmail-error-reporting-non-interactive)
1140 '("-oep" "-odi")
1141 ;; These mean "report errors by mail"
1142 ;; and "deliver in background".
1143 '("-oem" "-odb"))
1144 ;; Get the addresses from the message 1153 ;; Get the addresses from the message
1145 ;; unless this is a resend. 1154 ;; unless this is a resend.
1146 ;; We must not do that for a resend 1155 ;; We must not do that for a resend
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c8b2a72aad0..0af9c457995 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2092,12 +2092,13 @@ been set up by `rfn-eshadow-setup-minibuffer'."
2092 (symbol-value 'rfn-eshadow-overlay)) 2092 (symbol-value 'rfn-eshadow-overlay))
2093 (funcall (symbol-function 'minibuffer-prompt-end))))) 2093 (funcall (symbol-function 'minibuffer-prompt-end)))))
2094 (when (file-remote-p (buffer-substring-no-properties end (point-max))) 2094 (when (file-remote-p (buffer-substring-no-properties end (point-max)))
2095 (narrow-to-region 2095 (save-excursion
2096 (1+ (or (string-match "/" (buffer-string) end) end)) (point-max)) 2096 (save-restriction
2097 (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay) 2097 (narrow-to-region
2098 (rfn-eshadow-update-overlay-hook nil)) 2098 (1+ (or (string-match "/" (buffer-string) end) end)) (point-max))
2099 (funcall (symbol-function 'rfn-eshadow-update-overlay))) 2099 (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
2100 (widen)))) 2100 (rfn-eshadow-update-overlay-hook nil))
2101 (funcall (symbol-function 'rfn-eshadow-update-overlay))))))))
2101 2102
2102(when (boundp 'rfn-eshadow-update-overlay-hook) 2103(when (boundp 'rfn-eshadow-update-overlay-hook)
2103 (add-hook 'rfn-eshadow-update-overlay-hook 2104 (add-hook 'rfn-eshadow-update-overlay-hook
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index 95359689b9f..eced014d4e6 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -106,7 +106,9 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.")
106 (nil 106 (nil
107 ,(concat 107 ,(concat
108 "^\\<" ; line MUST start with word char 108 "^\\<" ; line MUST start with word char
109 "[^()]*" ; no parentheses before 109 ;; \n added to prevent overflow in regexp matcher.
110 ;; http://lists.gnu.org/archive/html/emacs-pretest-bug/2007-02/msg00021.html
111 "[^()\n]*" ; no parentheses before
110 "[^" c-alnum "_:<>~]" ; match any non-identifier char 112 "[^" c-alnum "_:<>~]" ; match any non-identifier char
111 "\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name 113 "\\([" c-alpha "_][" c-alnum "_:<>~]*\\)" ; match function name
112 "\\([ \t\n]\\|\\\\\n\\)*(" ; see above, BUT the arg list 114 "\\([ \t\n]\\|\\\\\n\\)*(" ; see above, BUT the arg list
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 9ed7ba09de9..482cfee1b9b 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1658,10 +1658,15 @@ This is the value of `next-error-function' in Compilation buffers."
1658 ;; in the same process and buffer). 1658 ;; in the same process and buffer).
1659 ;; So, recalculate all markers for that file. 1659 ;; So, recalculate all markers for that file.
1660 (unless (and (nth 3 loc) (marker-buffer (nth 3 loc)) 1660 (unless (and (nth 3 loc) (marker-buffer (nth 3 loc))
1661 (equal (nth 4 loc) 1661 ;; There may be no timestamp info if the loc is a `fake-loc'.
1662 (setq timestamp 1662 ;; So we skip the time-check here, although we should maybe
1663 (with-current-buffer (marker-buffer (nth 3 loc)) 1663 ;; change `compilation-fake-loc' to add timestamp info.
1664 (visited-file-modtime))))) 1664 (or (null (nth 4 loc))
1665 (equal (nth 4 loc)
1666 (setq timestamp
1667 (with-current-buffer
1668 (marker-buffer (nth 3 loc))
1669 (visited-file-modtime))))))
1665 (with-current-buffer (compilation-find-file marker (caar (nth 2 loc)) 1670 (with-current-buffer (compilation-find-file marker (caar (nth 2 loc))
1666 (cadr (car (nth 2 loc)))) 1671 (cadr (car (nth 2 loc))))
1667 (save-restriction 1672 (save-restriction
@@ -1711,7 +1716,7 @@ region and the first line of the next region."
1711 (or (consp file) (setq file (list file))) 1716 (or (consp file) (setq file (list file)))
1712 (setq file (compilation-get-file-structure file)) 1717 (setq file (compilation-get-file-structure file))
1713 ;; Between the current call to compilation-fake-loc and the first occurrence 1718 ;; Between the current call to compilation-fake-loc and the first occurrence
1714 ;; of an error message referring to `file', the data is only kept is the 1719 ;; of an error message referring to `file', the data is only kept in the
1715 ;; weak hash-table compilation-locs, so we need to prevent this entry 1720 ;; weak hash-table compilation-locs, so we need to prevent this entry
1716 ;; in compilation-locs from being GC'd away. --Stef 1721 ;; in compilation-locs from being GC'd away. --Stef
1717 (push file compilation-gcpro) 1722 (push file compilation-gcpro)
diff --git a/lisp/progmodes/delphi.el b/lisp/progmodes/delphi.el
index 6cbef6f426d..7c2417fde1a 100644
--- a/lisp/progmodes/delphi.el
+++ b/lisp/progmodes/delphi.el
@@ -1642,7 +1642,7 @@ before the indent, the point is moved to the indent."
1642 (when delphi-newline-always-indents 1642 (when delphi-newline-always-indents
1643 ;; Indent both the (now) previous and current line first. 1643 ;; Indent both the (now) previous and current line first.
1644 (save-excursion 1644 (save-excursion
1645 (previous-line 1) 1645 (forward-line -1)
1646 (delphi-indent-line)) 1646 (delphi-indent-line))
1647 (delphi-indent-line))) 1647 (delphi-indent-line)))
1648 1648
diff --git a/lisp/server.el b/lisp/server.el
index 22b947ea9f8..70d2283b0eb 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -325,7 +325,10 @@ message."
325 325
326(defun server-select-display (display) 326(defun server-select-display (display)
327 ;; If the current frame is on `display' we're all set. 327 ;; If the current frame is on `display' we're all set.
328 (unless (equal (frame-parameter (selected-frame) 'display) display) 328 ;; Similarly if we are unable to open a frames on other displays, there's
329 ;; nothing more we can do.
330 (unless (or (not (fboundp 'make-frame-on-display))
331 (equal (frame-parameter (selected-frame) 'display) display))
329 ;; Otherwise, look for an existing frame there and select it. 332 ;; Otherwise, look for an existing frame there and select it.
330 (dolist (frame (frame-list)) 333 (dolist (frame (frame-list))
331 (when (equal (frame-parameter frame 'display) display) 334 (when (equal (frame-parameter frame 'display) display)
@@ -505,11 +508,11 @@ kill any existing server communications subprocess."
505 (when server-use-tcp 508 (when server-use-tcp
506 (let ((auth-key 509 (let ((auth-key
507 (loop 510 (loop
508 ;; The auth key is a 64-byte string of random chars in the 511 ;; The auth key is a 64-byte string of random chars in the
509 ;; range `!'..`~'. 512 ;; range `!'..`~'.
510 for i below 64 513 for i below 64
511 collect (+ 33 (random 94)) into auth 514 collect (+ 33 (random 94)) into auth
512 finally return (concat auth)))) 515 finally return (concat auth))))
513 (process-put server-process :auth-key auth-key) 516 (process-put server-process :auth-key auth-key)
514 (with-temp-file server-file 517 (with-temp-file server-file
515 (set-buffer-multibyte nil) 518 (set-buffer-multibyte nil)
@@ -831,8 +834,8 @@ The following commands are accepted by the client:
831 ;; Open X frames on the given display instead of the default. 834 ;; Open X frames on the given display instead of the default.
832 ((and (equal "-display" arg) 835 ((and (equal "-display" arg)
833 (string-match "\\([^ ]*\\) " request)) 836 (string-match "\\([^ ]*\\) " request))
834 (setq display (match-string 1 request) 837 (setq display (match-string 1 request))
835 request (substring request (match-end 0)))) 838 (setq request (substring request (match-end 0))))
836 839
837 ;; -window-system: Open a new X frame. 840 ;; -window-system: Open a new X frame.
838 ((equal "-window-system" arg) 841 ((equal "-window-system" arg)
diff --git a/lisp/simple.el b/lisp/simple.el
index f2055faf385..5c3b55edd7b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1,7 +1,8 @@
1;;; simple.el --- basic editing commands for Emacs 1;;; simple.el --- basic editing commands for Emacs
2 2
3;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 3;; Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
4;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 4;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
5;; Free Software Foundation, Inc.
5 6
6;; Maintainer: FSF 7;; Maintainer: FSF
7;; Keywords: internal 8;; Keywords: internal
@@ -632,7 +633,9 @@ column specified by the function `current-left-margin'."
632 (newline) 633 (newline)
633 (save-excursion 634 (save-excursion
634 (goto-char pos) 635 (goto-char pos)
635 (indent-according-to-mode) 636 ;; Usually indent-according-to-mode should "preserve" point, but it is
637 ;; not guaranteed; e.g. indent-to-left-margin doesn't.
638 (save-excursion (indent-according-to-mode))
636 (delete-horizontal-space t)) 639 (delete-horizontal-space t))
637 (indent-according-to-mode))) 640 (indent-according-to-mode)))
638 641
@@ -2561,6 +2564,11 @@ of the Emacs kill ring should be used. If the function returns a
2561string, then the caller of the function \(usually `current-kill') 2564string, then the caller of the function \(usually `current-kill')
2562should put this string in the kill ring as the latest kill. 2565should put this string in the kill ring as the latest kill.
2563 2566
2567This function may also return a list of strings if the window
2568system supports multiple selections. The first string will be
2569used as the pasted text, but the other will be placed in the
2570kill ring for easy access via `yank-pop'.
2571
2564Note that the function should return a string only if a program other 2572Note that the function should return a string only if a program other
2565than Emacs has provided a string for pasting; if Emacs provided the 2573than Emacs has provided a string for pasting; if Emacs provided the
2566most recent string, the function should return nil. If it is 2574most recent string, the function should return nil. If it is
@@ -2644,11 +2652,11 @@ If `interprogram-cut-function' is set, pass the resulting kill to it."
2644 2652
2645(defun current-kill (n &optional do-not-move) 2653(defun current-kill (n &optional do-not-move)
2646 "Rotate the yanking point by N places, and then return that kill. 2654 "Rotate the yanking point by N places, and then return that kill.
2647If N is zero, `interprogram-paste-function' is set, and calling it 2655If N is zero, `interprogram-paste-function' is set, and calling it returns a
2648returns a string, then that string is added to the front of the 2656string or list of strings, then that string (or list) is added to the front
2649kill ring and returned as the latest kill. 2657of the kill ring and the string (or first string in the list) is returned as
2650If optional arg DO-NOT-MOVE is non-nil, then don't actually move the 2658the latest kill. If optional arg DO-NOT-MOVE is non-nil, then don't
2651yanking point; just return the Nth kill forward." 2659actually move the yanking point; just return the Nth kill forward."
2652 (let ((interprogram-paste (and (= n 0) 2660 (let ((interprogram-paste (and (= n 0)
2653 interprogram-paste-function 2661 interprogram-paste-function
2654 (funcall interprogram-paste-function)))) 2662 (funcall interprogram-paste-function))))
@@ -2658,8 +2666,10 @@ yanking point; just return the Nth kill forward."
2658 ;; text to the kill ring, so Emacs doesn't try to own the 2666 ;; text to the kill ring, so Emacs doesn't try to own the
2659 ;; selection, with identical text. 2667 ;; selection, with identical text.
2660 (let ((interprogram-cut-function nil)) 2668 (let ((interprogram-cut-function nil))
2661 (kill-new interprogram-paste)) 2669 (if (listp interprogram-paste)
2662 interprogram-paste) 2670 (mapc 'kill-new (nreverse interprogram-paste))
2671 (kill-new interprogram-paste)))
2672 (car kill-ring))
2663 (or kill-ring (error "Kill ring is empty")) 2673 (or kill-ring (error "Kill ring is empty"))
2664 (let ((ARGth-kill-element 2674 (let ((ARGth-kill-element
2665 (nthcdr (mod (- n (length kill-ring-yank-pointer)) 2675 (nthcdr (mod (- n (length kill-ring-yank-pointer))
@@ -4657,6 +4667,8 @@ it skips the contents of comments that end before point."
4657 (point)))))) 4667 (point))))))
4658 (let* ((oldpos (point)) 4668 (let* ((oldpos (point))
4659 (message-log-max nil) ; Don't log messages about paren matching. 4669 (message-log-max nil) ; Don't log messages about paren matching.
4670 (atdollar (eq (syntax-class (syntax-after (1- oldpos))) 8))
4671 (isdollar)
4660 (blinkpos 4672 (blinkpos
4661 (save-excursion 4673 (save-excursion
4662 (save-restriction 4674 (save-restriction
@@ -4674,20 +4686,28 @@ it skips the contents of comments that end before point."
4674 (matching-paren 4686 (matching-paren
4675 (and blinkpos 4687 (and blinkpos
4676 ;; Not syntax '$'. 4688 ;; Not syntax '$'.
4677 (not (eq (syntax-class (syntax-after blinkpos)) 8)) 4689 (not (setq isdollar
4690 (eq (syntax-class (syntax-after blinkpos)) 8)))
4678 (let ((syntax (syntax-after blinkpos))) 4691 (let ((syntax (syntax-after blinkpos)))
4679 (and (consp syntax) 4692 (and (consp syntax)
4680 (eq (syntax-class syntax) 4) 4693 (eq (syntax-class syntax) 4)
4681 (cdr syntax)))))) 4694 (cdr syntax))))))
4682 (cond 4695 (cond
4683 ((not (or (eq matching-paren (char-before oldpos)) 4696 ;; isdollar is for:
4697 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00871.html
4698 ((not (or (and isdollar blinkpos)
4699 (and atdollar (not blinkpos)) ; see below
4700 (eq matching-paren (char-before oldpos))
4684 ;; The cdr might hold a new paren-class info rather than 4701 ;; The cdr might hold a new paren-class info rather than
4685 ;; a matching-char info, in which case the two CDRs 4702 ;; a matching-char info, in which case the two CDRs
4686 ;; should match. 4703 ;; should match.
4687 (eq matching-paren (cdr (syntax-after (1- oldpos)))))) 4704 (eq matching-paren (cdr (syntax-after (1- oldpos))))))
4688 (message "Mismatched parentheses")) 4705 (message "Mismatched parentheses"))
4689 ((not blinkpos) 4706 ((not blinkpos)
4690 (if (not blink-matching-paren-distance) 4707 (or blink-matching-paren-distance
4708 ;; Don't complain when `$' with no blinkpos, because it
4709 ;; could just be the first one typed in the buffer.
4710 atdollar
4691 (message "Unmatched parenthesis"))) 4711 (message "Unmatched parenthesis")))
4692 ((pos-visible-in-window-p blinkpos) 4712 ((pos-visible-in-window-p blinkpos)
4693 ;; Matching open within window, temporarily move to blinkpos but only 4713 ;; Matching open within window, temporarily move to blinkpos but only
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 1c4b60706aa..a60aa90255f 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -27,8 +27,6 @@
27 27
28;;; Code: 28;;; Code:
29 29
30(eval-when-compile (require 'xt-mouse))
31
32(defvar xterm-function-map 30(defvar xterm-function-map
33 (let ((map (make-sparse-keymap))) 31 (let ((map (make-sparse-keymap)))
34 32
@@ -469,12 +467,8 @@
469 ;; This recomputes all the default faces given the colors we've just set up. 467 ;; This recomputes all the default faces given the colors we've just set up.
470 (tty-set-up-initial-frame-faces) 468 (tty-set-up-initial-frame-faces)
471 469
472 (when xterm-mouse-mode
473 (turn-on-xterm-mouse-tracking-on-terminal
474 (frame-terminal (selected-frame))))
475
476 ;; Try to turn on the modifyOtherKeys feature on modern xterms. 470 ;; Try to turn on the modifyOtherKeys feature on modern xterms.
477 ;; When it is turned on much more key bindings work: things like 471 ;; When it is turned on many more key bindings work: things like
478 ;; C-. C-, etc. 472 ;; C-. C-, etc.
479 ;; To do that we need to find out if the current terminal supports 473 ;; To do that we need to find out if the current terminal supports
480 ;; modifyOtherKeys. At this time only xterm does. 474 ;; modifyOtherKeys. At this time only xterm does.
@@ -506,7 +500,9 @@
506 ;; need to deal with modify-other-keys. 500 ;; need to deal with modify-other-keys.
507 (push (frame-terminal (selected-frame)) 501 (push (frame-terminal (selected-frame))
508 xterm-modify-other-keys-terminal-list) 502 xterm-modify-other-keys-terminal-list)
509 (xterm-turn-on-modify-other-keys))))))) 503 (xterm-turn-on-modify-other-keys))))))
504
505 (run-hooks 'terminal-init-xterm-hook))
510 506
511;; Set up colors, for those versions of xterm that support it. 507;; Set up colors, for those versions of xterm that support it.
512(defvar xterm-standard-colors 508(defvar xterm-standard-colors
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index bc0434e151a..f0442904185 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -4383,13 +4383,10 @@ With non-nil ARG, set the last point."
4383If N is negative, move cursor down." 4383If N is negative, move cursor down."
4384 (interactive "p") 4384 (interactive "p")
4385 (let ((col (artist-current-column))) 4385 (let ((col (artist-current-column)))
4386 (if (not artist-key-is-drawing) 4386 (forward-line (- n))
4387 (progn 4387 (move-to-column col t))
4388 (previous-line n) 4388 (when artist-key-is-drawing
4389 (move-to-column col t)) 4389 (artist-key-do-continously-common)))
4390 (previous-line n)
4391 (move-to-column col t)
4392 (artist-key-do-continously-common))))
4393 4390
4394 4391
4395(defun artist-next-line (&optional n) 4392(defun artist-next-line (&optional n)
@@ -4397,13 +4394,10 @@ If N is negative, move cursor down."
4397If N is negative, move cursor up." 4394If N is negative, move cursor up."
4398 (interactive "p") 4395 (interactive "p")
4399 (let ((col (artist-current-column))) 4396 (let ((col (artist-current-column)))
4400 (if (not artist-key-is-drawing) 4397 (forward-line n)
4401 (progn 4398 (move-to-column col t))
4402 (next-line n) 4399 (when artist-key-is-drawing
4403 (move-to-column col t)) 4400 (artist-key-do-continously-common)))
4404 (next-line n)
4405 (move-to-column col t)
4406 (artist-key-do-continously-common))))
4407 4401
4408(defun artist-backward-char (&optional n) 4402(defun artist-backward-char (&optional n)
4409 "Move cursor backward optional N chars (default is 1), updating curr shape. 4403 "Move cursor backward optional N chars (default is 1), updating curr shape.
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index e0f80b1b118..9cbdca0de87 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -117,8 +117,8 @@ if it would act as a paragraph-starter on the second line."
117 :group 'fill) 117 :group 'fill)
118 118
119(defcustom adaptive-fill-function nil 119(defcustom adaptive-fill-function nil
120 "*Function to call to choose a fill prefix for a paragraph, or nil. 120 "Function to call to choose a fill prefix for a paragraph, or nil.
121nil means the function has not determined the fill prefix." 121A nil value means the function has not determined the fill prefix."
122 :type '(choice (const nil) function) 122 :type '(choice (const nil) function)
123 :group 'fill) 123 :group 'fill)
124 124
@@ -757,10 +757,10 @@ space does not end a sentence, so don't break a line there."
757 (narrow-to-region (minibuffer-prompt-end) (point-max)) 757 (narrow-to-region (minibuffer-prompt-end) (point-max))
758 (fill-paragraph arg))) 758 (fill-paragraph arg)))
759 759
760(defun fill-paragraph (arg) 760(defun fill-paragraph (&optional justify region)
761 "Fill paragraph at or after point. 761 "Fill paragraph at or after point.
762 762
763If ARG is non-nil (interactively, with prefix argument), justify as well. 763If JUSTIFY is non-nil (interactively, with prefix argument), justify as well.
764If `sentence-end-double-space' is non-nil, then period followed by one 764If `sentence-end-double-space' is non-nil, then period followed by one
765space does not end a sentence, so don't break a line there. 765space does not end a sentence, so don't break a line there.
766the variable `fill-column' controls the width for filling. 766the variable `fill-column' controls the width for filling.
@@ -768,64 +768,73 @@ the variable `fill-column' controls the width for filling.
768If `fill-paragraph-function' is non-nil, we call it (passing our 768If `fill-paragraph-function' is non-nil, we call it (passing our
769argument to it), and if it returns non-nil, we simply return its value. 769argument to it), and if it returns non-nil, we simply return its value.
770 770
771If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling." 771If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling.
772
773Interactively (when `region' is non-nil) in Transient Mark mode when
774the mark is active, call `fill-region' to fill each of the paragraphs
775in the active region."
772 (interactive (progn 776 (interactive (progn
773 (barf-if-buffer-read-only) 777 (barf-if-buffer-read-only)
774 (list (if current-prefix-arg 'full)))) 778 (list (if current-prefix-arg 'full) t)))
775 ;; First try fill-paragraph-function. 779 (or
776 (or (and (not (eq fill-paragraph-function t)) 780 ;; 1. Fill the region if it is active when called interactively.
777 (or fill-paragraph-function 781 (and region transient-mark-mode mark-active
778 (and (minibufferp (current-buffer)) 782 (not (eq (region-beginning) (region-end)))
779 (= 1 (point-min)))) 783 (fill-region (region-beginning) (region-end) justify))
780 (let ((function (or fill-paragraph-function 784 ;; 2. Try fill-paragraph-function.
781 ;; In the minibuffer, don't count the width 785 (and (not (eq fill-paragraph-function t))
782 ;; of the prompt. 786 (or fill-paragraph-function
783 'fill-minibuffer-function)) 787 (and (minibufferp (current-buffer))
784 ;; If fill-paragraph-function is set, it probably takes care 788 (= 1 (point-min))))
785 ;; of comments and stuff. If not, it will have to set 789 (let ((function (or fill-paragraph-function
786 ;; fill-paragraph-handle-comment back to t explicitly or 790 ;; In the minibuffer, don't count the width
787 ;; return nil. 791 ;; of the prompt.
788 (fill-paragraph-handle-comment nil) 792 'fill-minibuffer-function))
789 (fill-paragraph-function t)) 793 ;; If fill-paragraph-function is set, it probably takes care
790 (funcall function arg))) 794 ;; of comments and stuff. If not, it will have to set
791 ;; Then try our syntax-aware filling code. 795 ;; fill-paragraph-handle-comment back to t explicitly or
792 (and fill-paragraph-handle-comment 796 ;; return nil.
793 ;; Our code only handles \n-terminated comments right now. 797 (fill-paragraph-handle-comment nil)
794 comment-start (equal comment-end "") 798 (fill-paragraph-function t))
795 (let ((fill-paragraph-handle-comment nil)) 799 (funcall function justify)))
796 (fill-comment-paragraph arg))) 800 ;; 3. Try our syntax-aware filling code.
797 ;; If it all fails, default to the good ol' text paragraph filling. 801 (and fill-paragraph-handle-comment
798 (let ((before (point)) 802 ;; Our code only handles \n-terminated comments right now.
799 (paragraph-start paragraph-start) 803 comment-start (equal comment-end "")
800 ;; Fill prefix used for filling the paragraph. 804 (let ((fill-paragraph-handle-comment nil))
801 fill-pfx) 805 (fill-comment-paragraph justify)))
802 ;; Try to prevent code sections and comment sections from being 806 ;; 4. If it all fails, default to the good ol' text paragraph filling.
803 ;; filled together. 807 (let ((before (point))
804 (when (and fill-paragraph-handle-comment comment-start-skip) 808 (paragraph-start paragraph-start)
805 (setq paragraph-start 809 ;; Fill prefix used for filling the paragraph.
806 (concat paragraph-start "\\|[ \t]*\\(?:" 810 fill-pfx)
807 comment-start-skip "\\)"))) 811 ;; Try to prevent code sections and comment sections from being
808 (save-excursion 812 ;; filled together.
809 ;; To make sure the return value of forward-paragraph is meaningful, 813 (when (and fill-paragraph-handle-comment comment-start-skip)
810 ;; we have to start from the beginning of line, otherwise skipping 814 (setq paragraph-start
811 ;; past the last few chars of a paragraph-separator would count as 815 (concat paragraph-start "\\|[ \t]*\\(?:"
812 ;; a paragraph (and not skipping any chars at EOB would not count 816 comment-start-skip "\\)")))
813 ;; as a paragraph even if it is). 817 (save-excursion
814 (move-to-left-margin) 818 ;; To make sure the return value of forward-paragraph is meaningful,
815 (if (not (zerop (forward-paragraph))) 819 ;; we have to start from the beginning of line, otherwise skipping
816 ;; There's no paragraph at or after point: give up. 820 ;; past the last few chars of a paragraph-separator would count as
817 (setq fill-pfx "") 821 ;; a paragraph (and not skipping any chars at EOB would not count
818 (let ((end (point)) 822 ;; as a paragraph even if it is).
819 (beg (progn (backward-paragraph) (point)))) 823 (move-to-left-margin)
820 (goto-char before) 824 (if (not (zerop (forward-paragraph)))
821 (setq fill-pfx 825 ;; There's no paragraph at or after point: give up.
822 (if use-hard-newlines 826 (setq fill-pfx "")
823 ;; Can't use fill-region-as-paragraph, since this 827 (let ((end (point))
824 ;; paragraph may still contain hard newlines. See 828 (beg (progn (backward-paragraph) (point))))
825 ;; fill-region. 829 (goto-char before)
826 (fill-region beg end arg) 830 (setq fill-pfx
827 (fill-region-as-paragraph beg end arg)))))) 831 (if use-hard-newlines
828 fill-pfx))) 832 ;; Can't use fill-region-as-paragraph, since this
833 ;; paragraph may still contain hard newlines. See
834 ;; fill-region.
835 (fill-region beg end justify)
836 (fill-region-as-paragraph beg end justify))))))
837 fill-pfx)))
829 838
830(defun fill-comment-paragraph (&optional justify) 839(defun fill-comment-paragraph (&optional justify)
831 "Fill current comment. 840 "Fill current comment.
@@ -1012,18 +1021,6 @@ space does not end a sentence, so don't break a line there."
1012 (goto-char end)))) 1021 (goto-char end))))
1013 fill-pfx)) 1022 fill-pfx))
1014 1023
1015(defun fill-paragraph-or-region (arg)
1016 "Fill the active region or current paragraph.
1017In Transient Mark mode, when the mark is active, it calls `fill-region'
1018on the active region. Otherwise, it calls `fill-paragraph'."
1019 (interactive (progn
1020 (barf-if-buffer-read-only)
1021 (list (if current-prefix-arg 'full))))
1022 (if (and transient-mark-mode mark-active
1023 (not (eq (region-beginning) (region-end))))
1024 (fill-region (region-beginning) (region-end) arg)
1025 (fill-paragraph arg)))
1026
1027 1024
1028(defcustom default-justification 'left 1025(defcustom default-justification 'left
1029 "*Method of justifying text not otherwise specified. 1026 "*Method of justifying text not otherwise specified.
@@ -1367,8 +1364,8 @@ These lines are filled together.
1367When calling from a program, pass the range to fill 1364When calling from a program, pass the range to fill
1368as the first two arguments. 1365as the first two arguments.
1369 1366
1370Optional third and fourth arguments JUSTIFY and MAIL-FLAG: 1367Optional third and fourth arguments JUSTIFY and CITATION-REGEXP:
1371JUSTIFY to justify paragraphs (prefix arg), 1368JUSTIFY to justify paragraphs (prefix arg).
1372When filling a mail message, pass a regexp for CITATION-REGEXP 1369When filling a mail message, pass a regexp for CITATION-REGEXP
1373which will match the prefix of a line which is a citation marker 1370which will match the prefix of a line which is a citation marker
1374plus whitespace, but no other kind of prefix. 1371plus whitespace, but no other kind of prefix.
@@ -1456,6 +1453,7 @@ Also, if CITATION-REGEXP is non-nil, don't fill header lines."
1456 (fill-region-as-paragraph start (point) justify) 1453 (fill-region-as-paragraph start (point) justify)
1457 (if (and (bolp) (not had-newline)) 1454 (if (and (bolp) (not had-newline))
1458 (delete-char -1)))))))) 1455 (delete-char -1))))))))
1456
1459(defun fill-individual-paragraphs-prefix (citation-regexp) 1457(defun fill-individual-paragraphs-prefix (citation-regexp)
1460 (let* ((adaptive-fill-first-line-regexp ".*") 1458 (let* ((adaptive-fill-first-line-regexp ".*")
1461 (just-one-line-prefix 1459 (just-one-line-prefix
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 253c29f408e..926e0debda1 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1536,7 +1536,7 @@ This allows it to improve the suggestion list based on actual mispellings."
1536 (translate-region pos (point) translation-table-for-input)))) 1536 (translate-region pos (point) translation-table-for-input))))
1537 1537
1538;;;###autoload 1538;;;###autoload
1539(defun ispell-word (&optional following quietly continue) 1539(defun ispell-word (&optional following quietly continue region)
1540 "Check spelling of word under or before the cursor. 1540 "Check spelling of word under or before the cursor.
1541If the word is not found in dictionary, display possible corrections 1541If the word is not found in dictionary, display possible corrections
1542in a window allowing you to choose one. 1542in a window allowing you to choose one.
@@ -1550,6 +1550,9 @@ when called interactively, non-corrective messages are suppressed.
1550With a prefix argument (or if CONTINUE is non-nil), 1550With a prefix argument (or if CONTINUE is non-nil),
1551resume interrupted spell-checking of a buffer or region. 1551resume interrupted spell-checking of a buffer or region.
1552 1552
1553Interactively, in Transient Mark mode when the mark is active, call
1554`ispell-region' to check the active region for spelling errors.
1555
1553Word syntax is controlled by the definition of the chosen dictionary, 1556Word syntax is controlled by the definition of the chosen dictionary,
1554which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'. 1557which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'.
1555 1558
@@ -1562,10 +1565,9 @@ nil word is correct or spelling is accepted.
1562\"word\" word corrected from word list. 1565\"word\" word corrected from word list.
1563\(\"word\" arg\) word is hand entered. 1566\(\"word\" arg\) word is hand entered.
1564quit spell session exited." 1567quit spell session exited."
1565 1568 (interactive (list ispell-following-word ispell-quietly current-prefix-arg t))
1566 (interactive (list ispell-following-word ispell-quietly current-prefix-arg))
1567 (cond 1569 (cond
1568 ((and transient-mark-mode mark-active 1570 ((and region transient-mark-mode mark-active
1569 (not (eq (region-beginning) (region-end)))) 1571 (not (eq (region-beginning) (region-end))))
1570 (ispell-region (region-beginning) (region-end))) 1572 (ispell-region (region-beginning) (region-end)))
1571 (continue (ispell-continue)) 1573 (continue (ispell-continue))
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 6c48c47d3ad..5487609343b 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -129,7 +129,7 @@
129 (progn 129 (progn
130 (if pc-mode (partial-completion-mode -1)) 130 (if pc-mode (partial-completion-mode -1))
131 ,@body) 131 ,@body)
132 (if pc-mode (partial-completion-mode 1))))) 132 (if pc-mode (partial-completion-mode 1)))))
133 133
134;;; The custom variables 134;;; The custom variables
135 135
@@ -1399,7 +1399,7 @@ When this variable is nil, `C-c C-c' give you the prompts, and
1399`C-u C-c C-c' trigger the fasttrack." 1399`C-u C-c C-c' trigger the fasttrack."
1400 :group 'org-remember 1400 :group 'org-remember
1401 :type 'boolean) 1401 :type 'boolean)
1402 1402
1403(defcustom org-remember-default-headline "" 1403(defcustom org-remember-default-headline ""
1404 "The headline that should be the default location in the notes file. 1404 "The headline that should be the default location in the notes file.
1405When filing remember notes, the cursor will start at that position. 1405When filing remember notes, the cursor will start at that position.
@@ -2702,7 +2702,7 @@ directory where the exported Org-mode files lives."
2702 (repeat 2702 (repeat
2703 (cons 2703 (cons
2704 (choice :tag "Type" 2704 (choice :tag "Type"
2705 (const :html) (const :LaTeX) 2705 (const :html) (const :LaTeX)
2706 (const :ascii) (const :ical) (const :xoxo)) 2706 (const :ascii) (const :ical) (const :xoxo))
2707 (directory))))) 2707 (directory)))))
2708 2708
@@ -3516,7 +3516,7 @@ color of the frame."
3516 ;; Make sure that a fixed-width face is used when we have a column table. 3516 ;; Make sure that a fixed-width face is used when we have a column table.
3517 (set-face-attribute 'org-column nil 3517 (set-face-attribute 'org-column nil
3518 :height (face-attribute 'default :height) 3518 :height (face-attribute 'default :height)
3519 :family (face-attribute 'default :family))) 3519 :family (face-attribute 'default :family)))
3520 3520
3521(defface org-warning 3521(defface org-warning
3522 (org-compatible-face 3522 (org-compatible-face
@@ -5544,7 +5544,7 @@ Works for outline headings and for plain lists alike."
5544 (cond 5544 (cond
5545 ((org-on-heading-p) (org-do-demote)) 5545 ((org-on-heading-p) (org-do-demote))
5546 ((org-at-item-p) (org-indent-item 1)))) 5546 ((org-at-item-p) (org-indent-item 1))))
5547 5547
5548;;; Promotion and Demotion 5548;;; Promotion and Demotion
5549 5549
5550(defun org-promote-subtree () 5550(defun org-promote-subtree ()
@@ -6064,7 +6064,7 @@ If WITH-CASE is non-nil, the sorting will be case-sensitive."
6064 (if (string-match org-priority-regexp x) 6064 (if (string-match org-priority-regexp x)
6065 (string-to-char (match-string 2 x)) 6065 (string-to-char (match-string 2 x))
6066 org-default-priority)) 6066 org-default-priority))
6067 comparefun (if (= dcst sorting-type) '< '>))) 6067 comparefun (if (= dcst sorting-type) '< '>)))
6068 (t (error "Invalid sorting type `%c'" sorting-type))) 6068 (t (error "Invalid sorting type `%c'" sorting-type)))
6069 6069
6070 (sort (mapcar (lambda (x) (cons (funcall extractfun (car x)) (cdr x))) 6070 (sort (mapcar (lambda (x) (cons (funcall extractfun (car x)) (cdr x)))
@@ -6778,7 +6778,7 @@ off orgstruct-mode will *not* remove these additonal settings."
6778 (orgstruct-make-binding 'org-cycle 102 [(tab)] "\C-i")) 6778 (orgstruct-make-binding 'org-cycle 102 [(tab)] "\C-i"))
6779 (org-defkey orgstruct-mode-map "\C-i" 6779 (org-defkey orgstruct-mode-map "\C-i"
6780 (orgstruct-make-binding 'org-cycle 103 "\C-i" [(tab)])) 6780 (orgstruct-make-binding 'org-cycle 103 "\C-i" [(tab)]))
6781 6781
6782 (org-defkey orgstruct-mode-map "\M-\C-m" 6782 (org-defkey orgstruct-mode-map "\M-\C-m"
6783 (orgstruct-make-binding 'org-insert-heading 105 6783 (orgstruct-make-binding 'org-insert-heading 105
6784 "\M-\C-m" [(meta return)])) 6784 "\M-\C-m" [(meta return)]))
@@ -6789,10 +6789,10 @@ off orgstruct-mode will *not* remove these additonal settings."
6789 (org-defkey orgstruct-mode-map [(shift meta return)] 6789 (org-defkey orgstruct-mode-map [(shift meta return)]
6790 (orgstruct-make-binding 'org-insert-todo-heading 107 6790 (orgstruct-make-binding 'org-insert-todo-heading 107
6791 [(meta return)] "\M-\C-m")) 6791 [(meta return)] "\M-\C-m"))
6792 6792
6793 (unless org-local-vars 6793 (unless org-local-vars
6794 (setq org-local-vars (org-get-local-variables))) 6794 (setq org-local-vars (org-get-local-variables)))
6795 6795
6796 t)) 6796 t))
6797 6797
6798(defun orgstruct-make-binding (fun n &rest keys) 6798(defun orgstruct-make-binding (fun n &rest keys)
@@ -6843,7 +6843,7 @@ Possible values in the list of contexts are `table', `headline', and `item'."
6843 (kill-buffer "*Org tmp*") 6843 (kill-buffer "*Org tmp*")
6844 (delq nil 6844 (delq nil
6845 (mapcar 6845 (mapcar
6846 (lambda (x) 6846 (lambda (x)
6847 (setq x 6847 (setq x
6848 (if (symbolp x) 6848 (if (symbolp x)
6849 (list x) 6849 (list x)
@@ -11258,12 +11258,12 @@ according to FMT (default from `org-email-link-description-format')."
11258 (if description (concat "[" description "]") "") 11258 (if description (concat "[" description "]") "")
11259 "]")) 11259 "]"))
11260 11260
11261(defconst org-link-escape-chars 11261(defconst org-link-escape-chars
11262 '((" " . "%20") 11262 '((" " . "%20")
11263 ("[" . "%5B") 11263 ("[" . "%5B")
11264 ("]" . "%5d") 11264 ("]" . "%5d")
11265 ("\340" . "%E0") ; `a 11265 ("\340" . "%E0") ; `a
11266 ("\342" . "%E2") ; ^a 11266 ("\342" . "%E2") ; ^a
11267 ("\347" . "%E7") ; ,c 11267 ("\347" . "%E7") ; ,c
11268 ("\350" . "%E8") ; `e 11268 ("\350" . "%E8") ; `e
11269 ("\351" . "%E9") ; 'e 11269 ("\351" . "%E9") ; 'e
@@ -11280,7 +11280,7 @@ according to FMT (default from `org-email-link-description-format')."
11280 "Association list of escapes for some characters problematic in links. 11280 "Association list of escapes for some characters problematic in links.
11281This is the list that is used for internal purposes.") 11281This is the list that is used for internal purposes.")
11282 11282
11283(defconst org-link-escape-chars-browser 11283(defconst org-link-escape-chars-browser
11284 '((" " . "%20")) 11284 '((" " . "%20"))
11285 "Association list of escapes for some characters problematic in links. 11285 "Association list of escapes for some characters problematic in links.
11286This is the list that is used before handing over to the browser.") 11286This is the list that is used before handing over to the browser.")
@@ -11459,7 +11459,7 @@ With three \\[universal-argument] prefixes, negate the meaning of
11459 (setq org-stored-links (delq (assoc link org-stored-links) 11459 (setq org-stored-links (delq (assoc link org-stored-links)
11460 org-stored-links))) 11460 org-stored-links)))
11461 (setq desc (or desc (nth 1 entry))))) 11461 (setq desc (or desc (nth 1 entry)))))
11462 11462
11463 (if (string-match org-plain-link-re link) 11463 (if (string-match org-plain-link-re link)
11464 ;; URL-like link, normalize the use of angular brackets. 11464 ;; URL-like link, normalize the use of angular brackets.
11465 (setq link (org-make-link (org-remove-angle-brackets link)))) 11465 (setq link (org-make-link (org-remove-angle-brackets link))))
@@ -12537,7 +12537,7 @@ to be run from that hook to fucntion properly."
12537 (when (string-match "\\S-" ins) 12537 (when (string-match "\\S-" ins)
12538 (or (equal (char-before) ?:) (insert ":")) 12538 (or (equal (char-before) ?:) (insert ":"))
12539 (insert ins) 12539 (insert ins)
12540 (or (equal (char-after) ?:) (insert ":"))))) 12540 (or (equal (char-after) ?:) (insert ":")))))
12541 (char 12541 (char
12542 (setq org-time-was-given (equal (upcase char) char)) 12542 (setq org-time-was-given (equal (upcase char) char))
12543 (setq time (org-read-date (equal (upcase char) "U") t nil 12543 (setq time (org-read-date (equal (upcase char) "U") t nil
@@ -12710,7 +12710,7 @@ See also the variable `org-reverse-note-order'."
12710 (org-end-of-subtree t) 12710 (org-end-of-subtree t)
12711 (org-paste-subtree level txt)) 12711 (org-paste-subtree level txt))
12712 (t (error "This should not happen")))) 12712 (t (error "This should not happen"))))
12713 12713
12714 ((and (bobp) (not reversed)) 12714 ((and (bobp) (not reversed))
12715 ;; Put it at the end, one level below level 1 12715 ;; Put it at the end, one level below level 1
12716 (save-restriction 12716 (save-restriction
@@ -12718,7 +12718,7 @@ See also the variable `org-reverse-note-order'."
12718 (goto-char (point-max)) 12718 (goto-char (point-max))
12719 (if (not (bolp)) (newline)) 12719 (if (not (bolp)) (newline))
12720 (org-paste-subtree (org-get-legal-level 1 1) txt))) 12720 (org-paste-subtree (org-get-legal-level 1 1) txt)))
12721 12721
12722 ((and (bobp) reversed) 12722 ((and (bobp) reversed)
12723 ;; Put it at the start, as level 1 12723 ;; Put it at the start, as level 1
12724 (save-restriction 12724 (save-restriction
@@ -13834,7 +13834,7 @@ also TODO lines."
13834 (setq match (completing-read 13834 (setq match (completing-read
13835 "Match: " 'org-tags-completion-function nil nil nil 13835 "Match: " 'org-tags-completion-function nil nil nil
13836 'org-tags-history)))) 13836 'org-tags-history))))
13837 13837
13838 ;; Parse the string and create a lisp form 13838 ;; Parse the string and create a lisp form
13839 (let ((match0 match) 13839 (let ((match0 match)
13840 (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|\\([[:alnum:]]+\\)=\\({[^}]+}\\|\"[^\"]+\"\\)\\|[[:alnum:]_@]+\\)")) 13840 (re (org-re "^&?\\([-+:]\\)?\\({[^}]+}\\|LEVEL=\\([0-9]+\\)\\|\\([[:alnum:]]+\\)=\\({[^}]+}\\|\"[^\"]+\"\\)\\|[[:alnum:]_@]+\\)"))
@@ -13997,12 +13997,12 @@ With prefix ARG, realign all tags in headings in the current buffer."
13997 (while (string-match "[-+&]+" tags) 13997 (while (string-match "[-+&]+" tags)
13998 ;; No boolean logic, just a list 13998 ;; No boolean logic, just a list
13999 (setq tags (replace-match ":" t t tags)))) 13999 (setq tags (replace-match ":" t t tags))))
14000 14000
14001 (if (string-match "\\`[\t ]*\\'" tags) 14001 (if (string-match "\\`[\t ]*\\'" tags)
14002 (setq tags "") 14002 (setq tags "")
14003 (unless (string-match ":$" tags) (setq tags (concat tags ":"))) 14003 (unless (string-match ":$" tags) (setq tags (concat tags ":")))
14004 (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) 14004 (unless (string-match "^:" tags) (setq tags (concat ":" tags))))
14005 14005
14006 ;; Insert new tags at the correct column 14006 ;; Insert new tags at the correct column
14007 (beginning-of-line 1) 14007 (beginning-of-line 1)
14008 (cond 14008 (cond
@@ -14321,7 +14321,7 @@ Returns the new tags string, or nil to not change the current settings."
14321 (let (tags) 14321 (let (tags)
14322 (save-excursion 14322 (save-excursion
14323 (goto-char (point-min)) 14323 (goto-char (point-min))
14324 (while (re-search-forward 14324 (while (re-search-forward
14325 (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t) 14325 (org-re "[ \t]:\\([[:alnum:]_@:]+\\):[ \t\r\n]") nil t)
14326 (when (equal (char-after (point-at-bol 0)) ?*) 14326 (when (equal (char-after (point-at-bol 0)) ?*)
14327 (mapc (lambda (x) (add-to-list 'tags x)) 14327 (mapc (lambda (x) (add-to-list 'tags x))
@@ -14469,7 +14469,7 @@ If WHICH is nil or `all', get all properties. If WHICH is
14469 (unless (member key excluded) 14469 (unless (member key excluded)
14470 (push (cons key (or value "")) props))))) 14470 (push (cons key (or value "")) props)))))
14471 (append sum-props (nreverse props))))))) 14471 (append sum-props (nreverse props)))))))
14472 14472
14473(defun org-entry-get (pom property &optional inherit) 14473(defun org-entry-get (pom property &optional inherit)
14474 "Get value of PROPERTY for entry at point-or-marker POM. 14474 "Get value of PROPERTY for entry at point-or-marker POM.
14475If INHERIT is non-nil and the entry does not have the property, 14475If INHERIT is non-nil and the entry does not have the property,
@@ -14636,7 +14636,7 @@ internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING."
14636(defun org-set-property (property value) 14636(defun org-set-property (property value)
14637 "In the current entry, set PROPERTY to VALUE." 14637 "In the current entry, set PROPERTY to VALUE."
14638 (interactive 14638 (interactive
14639 (let* ((prop (completing-read "Property: " 14639 (let* ((prop (completing-read "Property: "
14640 (mapcar 'list (org-buffer-property-keys)))) 14640 (mapcar 'list (org-buffer-property-keys))))
14641 (cur (org-entry-get nil prop)) 14641 (cur (org-entry-get nil prop))
14642 (allowed (org-property-get-allowed-values nil prop 'table)) 14642 (allowed (org-property-get-allowed-values nil prop 'table))
@@ -14657,7 +14657,7 @@ internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING."
14657 (let* ((prop (completing-read 14657 (let* ((prop (completing-read
14658 "Property: " (org-entry-properties nil 'standard)))) 14658 "Property: " (org-entry-properties nil 'standard))))
14659 (list prop))) 14659 (list prop)))
14660 (message (concat "Property " property 14660 (message (concat "Property " property
14661 (if (org-entry-delete nil property) 14661 (if (org-entry-delete nil property)
14662 " deleted" 14662 " deleted"
14663 " was not present in the entry")))) 14663 " was not present in the entry"))))
@@ -14666,7 +14666,7 @@ internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING."
14666 "Remove PROPERTY globally, from all entries." 14666 "Remove PROPERTY globally, from all entries."
14667 (interactive 14667 (interactive
14668 (let* ((prop (completing-read 14668 (let* ((prop (completing-read
14669 "Globally remove property: " 14669 "Globally remove property: "
14670 (mapcar 'list (org-buffer-property-keys))))) 14670 (mapcar 'list (org-buffer-property-keys)))))
14671 (list prop))) 14671 (list prop)))
14672 (save-excursion 14672 (save-excursion
@@ -14703,7 +14703,7 @@ completion."
14703 (let (vals) 14703 (let (vals)
14704 (cond 14704 (cond
14705 ((equal property "TODO") 14705 ((equal property "TODO")
14706 (setq vals (org-with-point-at pom 14706 (setq vals (org-with-point-at pom
14707 (append org-todo-keywords-1 '(""))))) 14707 (append org-todo-keywords-1 '("")))))
14708 ((equal property "PRIORITY") 14708 ((equal property "PRIORITY")
14709 (let ((n org-lowest-priority)) 14709 (let ((n org-lowest-priority))
@@ -14713,7 +14713,7 @@ completion."
14713 ((member property org-special-properties)) 14713 ((member property org-special-properties))
14714 (t 14714 (t
14715 (setq vals (org-entry-get pom (concat property "_ALL") 'inherit)) 14715 (setq vals (org-entry-get pom (concat property "_ALL") 'inherit))
14716 14716
14717 (when (and vals (string-match "\\S-" vals)) 14717 (when (and vals (string-match "\\S-" vals))
14718 (setq vals (car (read-from-string (concat "(" vals ")")))) 14718 (setq vals (car (read-from-string (concat "(" vals ")"))))
14719 (setq vals (mapcar (lambda (x) 14719 (setq vals (mapcar (lambda (x)
@@ -14843,7 +14843,7 @@ This is the compiled version of the format.")
14843 (beginning-of-line 1) 14843 (beginning-of-line 1)
14844 (and (looking-at "\\(\\**\\)\\(\\* \\)") 14844 (and (looking-at "\\(\\**\\)\\(\\* \\)")
14845 (org-get-level-face 2)))) 14845 (org-get-level-face 2))))
14846 (color (list :foreground 14846 (color (list :foreground
14847 (face-attribute (or level-face 'default) :foreground))) 14847 (face-attribute (or level-face 'default) :foreground)))
14848 props pom property ass width f string ov column) 14848 props pom property ass width f string ov column)
14849 ;; Check if the entry is in another buffer. 14849 ;; Check if the entry is in another buffer.
@@ -14988,7 +14988,7 @@ Where possible, use the standard interface for changing this line."
14988 nval eval allowed) 14988 nval eval allowed)
14989 (when (equal key "ITEM") 14989 (when (equal key "ITEM")
14990 (error "Cannot edit item headline from here")) 14990 (error "Cannot edit item headline from here"))
14991 14991
14992 (cond 14992 (cond
14993 ((equal key "TODO") 14993 ((equal key "TODO")
14994 (setq eval '(org-with-point-at pom 14994 (setq eval '(org-with-point-at pom
@@ -15021,7 +15021,7 @@ Where possible, use the standard interface for changing this line."
15021 (remove-text-properties (1- bol) eol '(read-only t)) 15021 (remove-text-properties (1- bol) eol '(read-only t))
15022 (unwind-protect 15022 (unwind-protect
15023 (progn 15023 (progn
15024 (setq org-columns-overlays 15024 (setq org-columns-overlays
15025 (org-delete-all line-overlays org-columns-overlays)) 15025 (org-delete-all line-overlays org-columns-overlays))
15026 (mapc 'org-delete-overlay line-overlays) 15026 (mapc 'org-delete-overlay line-overlays)
15027 (org-columns-eval eval)) 15027 (org-columns-eval eval))
@@ -15040,7 +15040,7 @@ Where possible, use the standard interface for changing this line."
15040 (allowed (org-entry-get (point) key1 t)) 15040 (allowed (org-entry-get (point) key1 t))
15041 nval) 15041 nval)
15042 (setq nval (read-string "Allowed: " allowed)) 15042 (setq nval (read-string "Allowed: " allowed))
15043 (org-entry-put 15043 (org-entry-put
15044 (cond ((marker-position org-entry-property-inherited-from) 15044 (cond ((marker-position org-entry-property-inherited-from)
15045 org-entry-property-inherited-from) 15045 org-entry-property-inherited-from)
15046 ((marker-position org-columns-top-level-marker) 15046 ((marker-position org-columns-top-level-marker)
@@ -15050,8 +15050,7 @@ Where possible, use the standard interface for changing this line."
15050(defun org-columns-eval (form) 15050(defun org-columns-eval (form)
15051 (let (hidep) 15051 (let (hidep)
15052 (save-excursion 15052 (save-excursion
15053 (beginning-of-line 1) 15053 (forward-line 1)
15054 (next-line 1)
15055 (setq hidep (org-on-heading-p 1))) 15054 (setq hidep (org-on-heading-p 1)))
15056 (eval form) 15055 (eval form)
15057 (and hidep (hide-entry)))) 15056 (and hidep (hide-entry))))
@@ -15099,7 +15098,7 @@ Where possible, use the standard interface for changing this line."
15099 (remove-text-properties (1- bol) eol '(read-only t)) 15098 (remove-text-properties (1- bol) eol '(read-only t))
15100 (unwind-protect 15099 (unwind-protect
15101 (progn 15100 (progn
15102 (setq org-columns-overlays 15101 (setq org-columns-overlays
15103 (org-delete-all line-overlays org-columns-overlays)) 15102 (org-delete-all line-overlays org-columns-overlays))
15104 (mapc 'org-delete-overlay line-overlays) 15103 (mapc 'org-delete-overlay line-overlays)
15105 (org-columns-eval '(org-entry-put pom key nval))) 15104 (org-columns-eval '(org-entry-put pom key nval)))
@@ -15250,7 +15249,7 @@ Where possible, use the standard interface for changing this line."
15250 (error "Cannot shift this column further to the left")) 15249 (error "Cannot shift this column further to the left"))
15251 (backward-char 1) 15250 (backward-char 1)
15252 (org-columns-move-right) 15251 (org-columns-move-right)
15253 (backward-char 1))) 15252 (backward-char 1)))
15254 15253
15255(defun org-columns-store-format () 15254(defun org-columns-store-format ()
15256 "Store the text version of the current columns format in appropriate place. 15255 "Store the text version of the current columns format in appropriate place.
@@ -15348,7 +15347,7 @@ display, or in the #+COLUMNS line of the current buffer."
15348 (setq pos (org-overlay-start ov)) 15347 (setq pos (org-overlay-start ov))
15349 (goto-char pos) 15348 (goto-char pos)
15350 (when (setq val (cdr (assoc property 15349 (when (setq val (cdr (assoc property
15351 (get-text-property 15350 (get-text-property
15352 (point-at-bol) 'org-summaries)))) 15351 (point-at-bol) 'org-summaries))))
15353 (setq fmt (org-overlay-get ov 'org-columns-format)) 15352 (setq fmt (org-overlay-get ov 'org-columns-format))
15354 (org-overlay-put ov 'org-columns-value val) 15353 (org-overlay-put ov 'org-columns-value val)
@@ -15404,7 +15403,7 @@ display, or in the #+COLUMNS line of the current buffer."
15404 (if flag str val) format)))) 15403 (if flag str val) format))))
15405 (aset lflag level t)) 15404 (aset lflag level t))
15406 ;; clear accumulators for deeper levels 15405 ;; clear accumulators for deeper levels
15407 (loop for l from (1+ level) to (1- lmax) do 15406 (loop for l from (1+ level) to (1- lmax) do
15408 (aset lsum l 0) 15407 (aset lsum l 0)
15409 (aset lflag l nil))) 15408 (aset lflag l nil)))
15410 ((>= level last-level) 15409 ((>= level last-level)
@@ -15720,7 +15719,7 @@ user."
15720 minute (if (match-end 3) 15719 minute (if (match-end 3)
15721 (string-to-number (match-string 3 ans)) 15720 (string-to-number (match-string 3 ans))
15722 0) 15721 0)
15723 pm (equal ?p 15722 pm (equal ?p
15724 (string-to-char (downcase (match-string 4 ans))))) 15723 (string-to-char (downcase (match-string 4 ans)))))
15725 (if (and (= hour 12) (not pm)) 15724 (if (and (= hour 12) (not pm))
15726 (setq hour 0) 15725 (setq hour 0)
@@ -16354,7 +16353,7 @@ in the timestamp determines what will be changed."
16354 (setq ng 6 new (car (rassoc (+ n (cdr (assoc (match-string 6 s) idx))) idx)))) 16353 (setq ng 6 new (car (rassoc (+ n (cdr (assoc (match-string 6 s) idx))) idx))))
16355 ((org-pos-in-match-range pos 5) 16354 ((org-pos-in-match-range pos 5)
16356 (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s)))))))) 16355 (setq ng 5 new (format "%d" (max 1 (+ n (string-to-number (match-string 5 s))))))))
16357 16356
16358 (when ng 16357 (when ng
16359 (setq s (concat 16358 (setq s (concat
16360 (substring s 0 (match-beginning ng)) 16359 (substring s 0 (match-beginning ng))
@@ -16421,28 +16420,28 @@ belonging to the category \"Work\"."
16421 (require 'org) 16420 (require 'org)
16422 (if (equal filter '(4)) 16421 (if (equal filter '(4))
16423 (setq filter (read-from-minibuffer "Regexp filter: "))) 16422 (setq filter (read-from-minibuffer "Regexp filter: ")))
16424 (let* ((today (org-date-to-gregorian 16423 (let* ((today (org-date-to-gregorian
16425 (time-to-days (current-time)))) 16424 (time-to-days (current-time))))
16426 (files org-agenda-files) entries file) 16425 (files org-agenda-files) entries file)
16427 (while (setq file (pop files)) 16426 (while (setq file (pop files))
16428 (setq entries (append entries (org-agenda-get-day-entries 16427 (setq entries (append entries (org-agenda-get-day-entries
16429 file today :timestamp)))) 16428 file today :timestamp))))
16430 (setq entries (delq nil entries)) 16429 (setq entries (delq nil entries))
16431 (mapc 16430 (mapc
16432 (lambda(x) 16431 (lambda(x)
16433 (let* ((evt (org-trim (get-text-property 1 'txt x))) 16432 (let* ((evt (org-trim (get-text-property 1 'txt x)))
16434 (cat (get-text-property 1 'org-category x)) 16433 (cat (get-text-property 1 'org-category x))
16435 (tod (get-text-property 1 'time-of-day x)) 16434 (tod (get-text-property 1 'time-of-day x))
16436 (ok (or (and (stringp filter) (string-match filter evt)) 16435 (ok (or (and (stringp filter) (string-match filter evt))
16437 (and (not (null filter)) (listp filter) 16436 (and (not (null filter)) (listp filter)
16438 (or (string-match 16437 (or (string-match
16439 (cadr (assoc 'category filter)) cat) 16438 (cadr (assoc 'category filter)) cat)
16440 (string-match 16439 (string-match
16441 (cadr (assoc 'headline filter)) evt)))))) 16440 (cadr (assoc 'headline filter)) evt))))))
16442 ;; (setq evt (set-text-properties 0 (length event) nil evt)) 16441 ;; (setq evt (set-text-properties 0 (length event) nil evt))
16443 (when (and ok tod) 16442 (when (and ok tod)
16444 (setq tod (number-to-string tod) 16443 (setq tod (number-to-string tod)
16445 tod (when (string-match 16444 tod (when (string-match
16446 "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod) 16445 "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod)
16447 (concat (match-string 1 tod) ":" 16446 (concat (match-string 1 tod) ":"
16448 (match-string 2 tod)))) 16447 (match-string 2 tod))))
@@ -16923,7 +16922,7 @@ the returned times will be formatted strings."
16923 (setq total-time (+ (or total-time 0) 16922 (setq total-time (+ (or total-time 0)
16924 org-clock-file-total-minutes))))))) 16923 org-clock-file-total-minutes)))))))
16925 (goto-char pos) 16924 (goto-char pos)
16926 16925
16927 (unless (eq scope 'agenda) 16926 (unless (eq scope 'agenda)
16928 (org-clock-sum ts te) 16927 (org-clock-sum ts te)
16929 (goto-char (point-min)) 16928 (goto-char (point-min))
@@ -16968,7 +16967,7 @@ the returned times will be formatted strings."
16968 (insert-before-markers 16967 (insert-before-markers
16969 "|-\n|" 16968 "|-\n|"
16970 (if (eq scope 'agenda) "|" "") 16969 (if (eq scope 'agenda) "|" "")
16971 "|" 16970 "|"
16972 "*Total time*| " 16971 "*Total time*| "
16973 (format "*%d:%02d*" h m) 16972 (format "*%d:%02d*" h m)
16974 "|\n|-\n") 16973 "|\n|-\n")
@@ -19766,7 +19765,7 @@ With prefix ARG, go forward that many times the current span."
19766 (list (car org-agenda-last-arguments) sd nd t))) 19765 (list (car org-agenda-last-arguments) sd nd t)))
19767 (org-agenda-redo) 19766 (org-agenda-redo)
19768 (org-agenda-find-today-or-agenda)))) 19767 (org-agenda-find-today-or-agenda))))
19769 19768
19770(defun org-agenda-earlier (arg) 19769(defun org-agenda-earlier (arg)
19771 "Go backward in time by the current span. 19770 "Go backward in time by the current span.
19772With prefix ARG, go backward that many times the current span." 19771With prefix ARG, go backward that many times the current span."
@@ -20480,7 +20479,7 @@ be used to request time specification in the time stamp."
20480 (save-excursion 20479 (save-excursion
20481 (org-back-to-heading t) 20480 (org-back-to-heading t)
20482 (if (looking-at 20481 (if (looking-at
20483 (if no-tags 20482 (if no-tags
20484 (org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@]+:[ \t]*\\)?$") 20483 (org-re "\\*+[ \t]+\\([^\n\r]*?\\)\\([ \t]+:[[:alnum:]:_@]+:[ \t]*\\)?$")
20485 "\\*+[ \t]+\\([^\r\n]*\\)")) 20484 "\\*+[ \t]+\\([^\r\n]*\\)"))
20486 (match-string 1) ""))) 20485 (match-string 1) "")))
@@ -21530,7 +21529,7 @@ translations. There is currently no way for users to extend this.")
21530 (setq fmt (pop formatters)) 21529 (setq fmt (pop formatters))
21531 (when (car fmt) 21530 (when (car fmt)
21532 (goto-char (point-min)) 21531 (goto-char (point-min))
21533 (while (re-search-forward (concat "^#\\+" (cadr fmt) 21532 (while (re-search-forward (concat "^#\\+" (cadr fmt)
21534 ":[ \t]*\\(.*\\)") nil t) 21533 ":[ \t]*\\(.*\\)") nil t)
21535 (replace-match "\\1" t) 21534 (replace-match "\\1" t)
21536 (add-text-properties 21535 (add-text-properties
@@ -21538,7 +21537,7 @@ translations. There is currently no way for users to extend this.")
21538 '(org-protected t)))) 21537 '(org-protected t))))
21539 (goto-char (point-min)) 21538 (goto-char (point-min))
21540 (while (re-search-forward 21539 (while (re-search-forward
21541 (concat "^#\\+" 21540 (concat "^#\\+"
21542 (caddr fmt) "\\>.*\\(\\(\n.*\\)*?\n\\)#\\+" 21541 (caddr fmt) "\\>.*\\(\\(\n.*\\)*?\n\\)#\\+"
21543 (cadddr fmt) "\\>.*\n?") nil t) 21542 (cadddr fmt) "\\>.*\n?") nil t)
21544 (if (car fmt) 21543 (if (car fmt)
@@ -21689,7 +21688,7 @@ translations. There is currently no way for users to extend this.")
21689 (add-text-properties (point) (1+ (point-at-eol)) 21688 (add-text-properties (point) (1+ (point-at-eol))
21690 (list :org-license-to-kill t))))) 21689 (list :org-license-to-kill t)))))
21691 title)) 21690 title))
21692 21691
21693(defun org-solidify-link-text (s &optional alist) 21692(defun org-solidify-link-text (s &optional alist)
21694 "Take link text and make a safe target out of it." 21693 "Take link text and make a safe target out of it."
21695 (save-match-data 21694 (save-match-data
@@ -22778,7 +22777,7 @@ lang=\"%s\" xml:lang=\"%s\">
22778 (if (and (string-match org-todo-line-regexp line) 22777 (if (and (string-match org-todo-line-regexp line)
22779 (match-beginning 2)) 22778 (match-beginning 2))
22780 22779
22781 (setq line 22780 (setq line
22782 (concat (substring line 0 (match-beginning 2)) 22781 (concat (substring line 0 (match-beginning 2))
22783 "<span class=\"" 22782 "<span class=\""
22784 (if (member (match-string 2 line) 22783 (if (member (match-string 2 line)
@@ -23112,14 +23111,14 @@ lang=\"%s\" xml:lang=\"%s\">
23112 (lambda (x) 23111 (lambda (x)
23113 (setq gr (pop org-table-colgroup-info)) 23112 (setq gr (pop org-table-colgroup-info))
23114 (format "%s<COL align=\"%s\"></COL>%s" 23113 (format "%s<COL align=\"%s\"></COL>%s"
23115 (if (memq gr '(:start :startend)) 23114 (if (memq gr '(:start :startend))
23116 (prog1 23115 (prog1
23117 (if colgropen "</colgroup>\n<colgroup>" "<colgroup>") 23116 (if colgropen "</colgroup>\n<colgroup>" "<colgroup>")
23118 (setq colgropen t)) 23117 (setq colgropen t))
23119 "") 23118 "")
23120 (if (> (/ (float x) nlines) org-table-number-fraction) 23119 (if (> (/ (float x) nlines) org-table-number-fraction)
23121 "right" "left") 23120 "right" "left")
23122 (if (memq gr '(:end :startend)) 23121 (if (memq gr '(:end :startend))
23123 (progn (setq colgropen nil) "</colgroup>") 23122 (progn (setq colgropen nil) "</colgroup>")
23124 ""))) 23123 "")))
23125 fnum "") 23124 fnum "")
diff --git a/lisp/time.el b/lisp/time.el
index 8bc14974315..4d94fb7aeb3 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -127,7 +127,7 @@ LABEL is a string to display to label that zone's time."
127 :type '(repeat (list string string)) 127 :type '(repeat (list string string))
128 :version "23.1") 128 :version "23.1")
129 129
130(defcustom display-time-world-time-format "%A %m %B %R %Z" 130(defcustom display-time-world-time-format "%A %d %B %R %Z"
131 "Format of the time displayed, see `format-time-string'." 131 "Format of the time displayed, see `format-time-string'."
132 :group 'display-time 132 :group 'display-time
133 :type 'string 133 :type 'string
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 26fb0e503f7..336593891ab 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -291,7 +291,7 @@ LEFT and RIGHT are the elements to compare."
291 ;; * MODE LINE 291 ;; * MODE LINE
292 (describe-mode [?\C-h ?m]) 292 (describe-mode [?\C-h ?m])
293 (set-fill-column [?\C-x ?f]) 293 (set-fill-column [?\C-x ?f])
294 (fill-paragraph-or-region [?\M-q]) 294 (fill-paragraph [?\M-q])
295 295
296 ;; * SEARCHING 296 ;; * SEARCHING
297 (isearch-forward [?\C-s]) 297 (isearch-forward [?\C-s])
@@ -665,7 +665,8 @@ position where the display of changed bindings was inserted."
665 ;; This runs in a hook so protect it: 665 ;; This runs in a hook so protect it:
666 (condition-case err 666 (condition-case err
667 (if (y-or-n-p "Save your position in the tutorial? ") 667 (if (y-or-n-p "Save your position in the tutorial? ")
668 (tutorial--save-tutorial-to (tutorial--saved-file))) 668 (tutorial--save-tutorial-to (tutorial--saved-file))
669 (message "Tutorial position not saved"))
669 (error (message "Error saving tutorial state: %s" 670 (error (message "Error saving tutorial state: %s"
670 (error-message-string err))))) 671 (error-message-string err)))))
671 672
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 92c6c734483..e28a01d35e6 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -556,6 +556,13 @@ If FILE is not registered, this function always returns nil."
556 (if (vc-backend file) 556 (if (vc-backend file)
557 (vc-file-setprop file 'vc-working-revision 557 (vc-file-setprop file 'vc-working-revision
558 (vc-call working-revision file))))) 558 (vc-call working-revision file)))))
559;; Backward compatibility.
560(define-obsolete-function-alias
561 'vc-workfile-version 'vc-working-revision "23.1")
562(defun vc-default-working-revision (backend file)
563 (message
564 "`working-revision' not found: using the old `workfile-version' instead")
565 (vc-call-backend backend 'workfile-version file))
559 566
560(defun vc-default-registered (backend file) 567(defun vc-default-registered (backend file)
561 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." 568 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates."
diff --git a/lisp/vc.el b/lisp/vc.el
index a0db56ce6d7..0cf800c2ddd 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1873,24 +1873,17 @@ The meaning of REV1 and REV2 is the same as for `vc-revision-diff'."
1873(make-obsolete 'vc-diff-switches-list 'vc-switches "22.1") 1873(make-obsolete 'vc-diff-switches-list 'vc-switches "22.1")
1874 1874
1875(defun vc-diff-sentinel (verbose rev1-name rev2-name) 1875(defun vc-diff-sentinel (verbose rev1-name rev2-name)
1876 ;; Did changes get generated into the buffer? 1876 ;; The empty sync output case has already been handled, so the only
1877 (if (not (zerop (buffer-size (get-buffer "*vc-diff*")))) 1877 ;; possibility of an empty output is for an async process, in which case
1878 (progn 1878 ;; it's important to insert the "diffs end here" message in the buffer
1879 (pop-to-buffer "*vc-diff*") 1879 ;; since the user may miss a message in the echo area.
1880 ;; Gnus-5.8.5 sets up an autoload for diff-mode, even if it's 1880 (when verbose
1881 ;; not available. Work around that. 1881 (let ((inhibit-read-only t))
1882 (if (require 'diff-mode nil t) (diff-mode)) 1882 (if (eq (buffer-size) 0)
1883 (when verbose 1883 (insert "No differences found.\n")
1884 (let (buffer-read-only) 1884 (insert (format "\n\nDiffs between %s and %s end here." rev1-name rev2-name)))))
1885 (goto-char (point-max)) 1885 (goto-char (point-min))
1886 (insert (format "\n\nDiffs between %s and %s end here." rev1-name rev2-name)) 1886 (shrink-window-if-larger-than-buffer))
1887 (goto-char (point-min))
1888 (insert (format "Diffs between %s and %s:\n\n" rev1-name rev2-name))))
1889 (shrink-window-if-larger-than-buffer)
1890 t)
1891 (progn
1892 (message "No changes between %s and %s" rev1-name rev2-name)
1893 nil)))
1894 1887
1895(defun vc-diff-internal (backend async files rev1 rev2 &optional verbose) 1888(defun vc-diff-internal (backend async files rev1 rev2 &optional verbose)
1896 "Report diffs between two revisions of a fileset. 1889 "Report diffs between two revisions of a fileset.
@@ -1927,12 +1920,20 @@ returns t if the buffer had changes, nil otherwise."
1927 (let ((vc-disable-async-diff (not async))) 1920 (let ((vc-disable-async-diff (not async)))
1928 (vc-call-backend backend 'diff filtered rev1 rev2 "*vc-diff*"))) 1921 (vc-call-backend backend 'diff filtered rev1 rev2 "*vc-diff*")))
1929 (set-buffer "*vc-diff*") 1922 (set-buffer "*vc-diff*")
1930 ;; This odd-looking code is because in the non-async case we 1923 (if (and (zerop (buffer-size))
1931 ;; actually want to pass the return value from vc-diff-sentinel 1924 (not (get-buffer-process (current-buffer))))
1932 ;; back to the caller. 1925 ;; Treat this case specially so as not to pop the buffer.
1933 (if async 1926 (progn
1934 (vc-exec-after `(vc-diff-sentinel ,verbose ,rev1-name ,rev2-name)) 1927 (message "No changes between %s and %s" rev1-name rev2-name)
1935 (vc-diff-sentinel verbose rev1-name rev2-name)))) 1928 nil)
1929 (pop-to-buffer (current-buffer))
1930 ;; Gnus-5.8.5 sets up an autoload for diff-mode, even if it's
1931 ;; not available. Work around that.
1932 (if (require 'diff-mode nil t) (diff-mode))
1933 (vc-exec-after `(vc-diff-sentinel ,verbose ,rev1-name ,rev2-name))
1934 ;; In the async case, we return t even if there are no differences
1935 ;; because we don't know that yet.
1936 t)))
1936 1937
1937;;;###autoload 1938;;;###autoload
1938(defun vc-history-diff (backend files rev1 rev2) 1939(defun vc-history-diff (backend files rev1 rev2)
@@ -3031,10 +3032,7 @@ to provide the `find-revision' operation instead."
3031 (vc-register))) 3032 (vc-register)))
3032 3033
3033(defalias 'vc-default-logentry-check 'ignore) 3034(defalias 'vc-default-logentry-check 'ignore)
3034 3035(defalias 'vc-default-check-headers 'ignore)
3035(defun vc-default-check-headers (backend)
3036 "Default implementation of check-headers; always returns nil."
3037 nil)
3038 3036
3039(defun vc-default-log-view-mode (backend) (log-view-mode)) 3037(defun vc-default-log-view-mode (backend) (log-view-mode))
3040 3038
@@ -3116,7 +3114,7 @@ to provide the `find-revision' operation instead."
3116 (and (not vc-make-backup-files) (delete-file backup-name)))))) 3114 (and (not vc-make-backup-files) (delete-file backup-name))))))
3117 (message "Checking out %s...done" file)))) 3115 (message "Checking out %s...done" file))))
3118 3116
3119(defun vc-default-revision-completion-table (backend file) nil) 3117(defalias 'vc-default-revision-completion-table 'ignore)
3120 3118
3121(defun vc-check-headers () 3119(defun vc-check-headers ()
3122 "Check if the current file has any headers in it." 3120 "Check if the current file has any headers in it."
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index 15aebb08ab2..adb6f08943c 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -45,9 +45,6 @@
45 45
46(defvar xterm-mouse-debug-buffer nil) 46(defvar xterm-mouse-debug-buffer nil)
47 47
48;; XXX Perhaps this should be terminal-local instead. --lorentey
49(define-key function-key-map "\e[M" 'xterm-mouse-translate)
50
51(defvar xterm-mouse-last) 48(defvar xterm-mouse-last)
52 49
53;; Mouse events symbols must have an 'event-kind property with 50;; Mouse events symbols must have an 'event-kind property with
@@ -78,7 +75,7 @@
78 (error "Unexpected escape sequence from XTerm"))) 75 (error "Unexpected escape sequence from XTerm")))
79 76
80 (let* ((click (if is-click down (xterm-mouse-event))) 77 (let* ((click (if is-click down (xterm-mouse-event)))
81 (click-command (nth 0 click)) 78 ;; (click-command (nth 0 click))
82 (click-data (nth 1 click)) 79 (click-data (nth 1 click))
83 (click-where (nth 1 click-data))) 80 (click-where (nth 1 click-data)))
84 (if (memq down-binding '(nil ignore)) 81 (if (memq down-binding '(nil ignore))
@@ -209,14 +206,15 @@ down the SHIFT key while pressing the mouse button."
209 ;; Turn it on 206 ;; Turn it on
210 (progn 207 (progn
211 ;; Frame creation and deletion. 208 ;; Frame creation and deletion.
212 (add-hook 'after-make-frame-functions 209 (add-hook 'terminal-init-xterm-hook
213 'turn-on-xterm-mouse-tracking-on-terminal) 210 'turn-on-xterm-mouse-tracking-on-terminal)
211
214 (add-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) 212 (add-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame)
215 213
216 ;; Restore normal mouse behaviour outside Emacs. 214 ;; Restore normal mouse behaviour outside Emacs.
217 (add-hook 'suspend-tty-functions 215 (add-hook 'suspend-tty-functions
218 'turn-off-xterm-mouse-tracking-on-terminal) 216 'turn-off-xterm-mouse-tracking-on-terminal)
219 (add-hook 'resume-tty-functions 217 (add-hook 'resume-tty-functions
220 'turn-on-xterm-mouse-tracking-on-terminal) 218 'turn-on-xterm-mouse-tracking-on-terminal)
221 (add-hook 'suspend-hook 'turn-off-xterm-mouse-tracking) 219 (add-hook 'suspend-hook 'turn-off-xterm-mouse-tracking)
222 (add-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking) 220 (add-hook 'suspend-resume-hook 'turn-on-xterm-mouse-tracking)
@@ -224,8 +222,6 @@ down the SHIFT key while pressing the mouse button."
224 (setq mouse-position-function #'xterm-mouse-position-function) 222 (setq mouse-position-function #'xterm-mouse-position-function)
225 (turn-on-xterm-mouse-tracking)) 223 (turn-on-xterm-mouse-tracking))
226 ;; Turn it off 224 ;; Turn it off
227 (remove-hook 'after-make-frame-functions
228 'turn-on-xterm-mouse-tracking-on-terminal)
229 (remove-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame) 225 (remove-hook 'delete-frame-functions 'xterm-mouse-handle-delete-frame)
230 (remove-hook 'suspend-tty-functions 226 (remove-hook 'suspend-tty-functions
231 'turn-off-xterm-mouse-tracking-on-terminal) 227 'turn-off-xterm-mouse-tracking-on-terminal)
@@ -239,28 +235,35 @@ down the SHIFT key while pressing the mouse button."
239 235
240(defun turn-on-xterm-mouse-tracking () 236(defun turn-on-xterm-mouse-tracking ()
241 "Enable Emacs mouse tracking in xterm." 237 "Enable Emacs mouse tracking in xterm."
242 (dolist (f (frame-list)) 238 (dolist (terminal (delete-dups (mapcar 'frame-terminal (frame-list))))
243 (when (eq t (frame-live-p f)) 239 (turn-on-xterm-mouse-tracking-on-terminal terminal)))
244 (with-selected-frame f
245 (when xterm-mouse-mode
246 (send-string-to-terminal "\e[?1000h"))))))
247 240
248(defun turn-off-xterm-mouse-tracking (&optional force) 241(defun turn-off-xterm-mouse-tracking (&optional force)
249 "Disable Emacs mouse tracking in xterm." 242 "Disable Emacs mouse tracking in xterm."
250 (dolist (f (frame-list)) 243 (dolist (terminal (delete-dups (mapcar 'frame-terminal (frame-list))))
251 (when (eq t (frame-live-p f)) 244 (turn-off-xterm-mouse-tracking-on-terminal terminal)))
252 (with-selected-frame f
253 (when (or force xterm-mouse-mode)
254 (send-string-to-terminal "\e[?1000l"))))))
255 245
256(defun turn-on-xterm-mouse-tracking-on-terminal (terminal) 246(defun turn-on-xterm-mouse-tracking-on-terminal (&optional terminal)
257 "Enable xterm mouse tracking on TERMINAL." 247 "Enable xterm mouse tracking on TERMINAL."
258 (when (and xterm-mouse-mode (eq t (terminal-live-p terminal))) 248 (when (and xterm-mouse-mode (eq t (terminal-live-p terminal)))
249 (unless (terminal-parameter terminal 'xterm-mouse-mode)
250 ;; Simulate selecting a terminal by selecting one of its frames ;-(
251 (with-selected-frame (car (frames-on-display-list terminal))
252 (define-key input-decode-map "\e[M" 'xterm-mouse-translate))
253 (set-terminal-parameter terminal 'xterm-mouse-mode t))
259 (send-string-to-terminal "\e[?1000h" terminal))) 254 (send-string-to-terminal "\e[?1000h" terminal)))
260 255
261(defun turn-off-xterm-mouse-tracking-on-terminal (terminal) 256(defun turn-off-xterm-mouse-tracking-on-terminal (terminal)
262 "Disable xterm mouse tracking on TERMINAL." 257 "Disable xterm mouse tracking on TERMINAL."
263 (when (and xterm-mouse-mode (eq t (terminal-live-p terminal))) 258 ;; Only send the disable command to those terminals to which we've already
259 ;; sent the enable command.
260 (when (and (terminal-parameter terminal 'xterm-mouse-mode)
261 (eq t (terminal-live-p terminal)))
262 ;; We could remove the key-binding and unset the `xterm-mouse-mode'
263 ;; terminal parameter, but it seems less harmful to send this escape
264 ;; command too many times (or to catch an unintended key sequence), than
265 ;; to send it too few times (or to fail to let xterm-mouse events
266 ;; pass by untranslated).
264 (send-string-to-terminal "\e[?1000l" terminal))) 267 (send-string-to-terminal "\e[?1000l" terminal)))
265 268
266(defun xterm-mouse-handle-delete-frame (frame) 269(defun xterm-mouse-handle-delete-frame (frame)
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 4a8f353782b..c0d8d7a5050 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,7 @@
12007-10-18 Jason Rumney <jasonr@gnu.org>
2
3 * makefile.w32-in (install): Install COPYING in top-level and bin dirs.
4
12007-09-27 Jason Rumney <jasonr@gnu.org> 52007-09-27 Jason Rumney <jasonr@gnu.org>
2 6
3 * gmake.defs (COMCTL32): New system library. 7 * gmake.defs (COMCTL32): New system library.
diff --git a/nt/makefile.w32-in b/nt/makefile.w32-in
index 155f201aa1e..5cb13a79e9a 100644
--- a/nt/makefile.w32-in
+++ b/nt/makefile.w32-in
@@ -211,6 +211,8 @@ install: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
211 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF) 211 $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
212 - $(CP_DIR) icons $(INSTALL_DIR)/etc 212 - $(CP_DIR) icons $(INSTALL_DIR)/etc
213 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF) 213 $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
214 $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
215 - $(CP) ../COPYING $(INSTALL_DIR)/bin
214 - $(DEL) ../same-dir.tst 216 - $(DEL) ../same-dir.tst
215 - $(DEL) $(INSTALL_DIR)/same-dir.tst 217 - $(DEL) $(INSTALL_DIR)/same-dir.tst
216 218
diff --git a/src/ChangeLog b/src/ChangeLog
index 4ba46df0f23..c50b6286407 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,103 @@
12007-10-18 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * keyboard.c (read_key_sequence): Undo a change introduced by multi-tty
4 which caused key-translation-map to applied repeatedly (thus breaking
5 double-mode).
6
72007-10-17 Stefan Monnier <monnier@iro.umontreal.ca>
8
9 * xselect.c (x_own_selection, x_handle_selection_clear)
10 (x_clear_frame_selections):
11 * w32menu.c (list_of_panes, list_of_items):
12 * w32fns.c (w32_color_map_lookup, Fx_create_frame, Fx_display_list):
13 * textprop.c (validate_plist, interval_has_all_properties)
14 (interval_has_some_properties, interval_has_some_properties_list)
15 (add_properties, text_property_list):
16 * process.c (Fget_buffer_process, list_processes_1, status_notify):
17 * minibuf.c (Fassoc_string):
18 * macselect.c (x_own_selection, x_clear_frame_selections)
19 (Fx_disown_selection_internal):
20 * keymap.c (Fcommand_remapping, where_is_internal, describe_map_tree):
21 Use CONSP rather than !NILP and XC[AD]R rather than Fc[ad]r.
22
232007-10-17 Chong Yidong <cyd@stupidchicken.com>
24
25 * process.c: Link to libs for calling res_init() if available.
26 (Fmake_network_process): Call res_init() before getaddrinfo or
27 gethostbyname, if possible.
28
292007-10-17 Stefan Monnier <monnier@iro.umontreal.ca>
30
31 * lread.c (read1): Set pvectype for char_tables.
32
33 * lisp.h (XMISCANY, XMARKER, XINTFWD, XBOOLFWD, XOBJFWD, XOVERLAY)
34 (XBUFFER_OBJFWD, XBUFFER_LOCAL_VALUE, XKBOARD_OBJFWD, XSAVE_VALUE):
35 Add type checks.
36 (SOME_BUFFER_LOCAL_VALUEP, GC_SOME_BUFFER_LOCAL_VALUEP): Remove.
37
38 * alloc.c (free_misc): Use XMISCTYPE.
39 (live_misc_p, gc_sweep): Use Lisp_Misc_Any.
40
412007-10-17 Glenn Morris <rgm@gnu.org>
42
43 * minibuf.c (Qcompletion_ignore_case): New Lisp_Object.
44 (syms_of_minibuf): Add Qcompletion_ignore_case.
45 * dired.c (Qcompletion_ignore_case): Change to external.
46 (syms_of_dired) [VMS]: Remove Qcompletion_ignore_case.
47 * fileio.c (Qcompletion_ignore_case): New external Lisp_Object.
48 (Fread_file_name): Use it rather than intern'ing.
49
50 * coding.c (Qcompletion_ignore_case): New external Lisp_Object.
51 (Fread_coding_system): Ignore case of user input.
52
532007-10-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
54
55 * xdisp.c (handle_display_prop): Ignore display specs after
56 replacing one when string text is being replaced.
57 (handle_single_display_spec): Pretend as if characters with display
58 property haven't been consumed only when buffer text is being replaced.
59
602007-10-16 Stefan Monnier <monnier@iro.umontreal.ca>
61
62 * xfns.c (Fx_create_frame, Fx_display_list):
63 * window.c (window_fixed_size_p, enlarge_window)
64 (shrink_window_lowest_first):
65 * macterm.c (init_font_name_table):
66 * macfns.c (Fx_create_frame, Fx_display_list):
67 * lread.c (close_load_descs):
68 * keyboard.c (read_char_x_menu_prompt):
69 * fns.c (Fmember, Fmemql, Fdelete, Fset_char_table_parent):
70 * coding.c (code_convert_region_unwind): Test the type of an object
71 rather than just !NILP before extracting data from it.
72
73 * alloc.c (Fpurecopy): Set the pvec tag on pseudo vectors.
74
75 * lisp.h (enum Lisp_Misc_Type): Del Lisp_Misc_Some_Buffer_Local_Value.
76 (XMISCANY): New macro.
77 (XMISCTYPE): Use it.
78 (struct Lisp_Misc_Any): New type.
79 (union Lisp_Misc): Use it.
80 (struct Lisp_Buffer_Local_Value): Add `local_if_set' bit.
81 * data.c (Fboundp, store_symval_forwarding, swap_in_global_binding)
82 (find_symbol_value, set_internal, default_value, Fset_default)
83 (Fmake_variable_buffer_local, Fmake_local_variable)
84 (Fkill_local_variable, Fmake_variable_frame_local, Flocal_variable_p)
85 (Flocal_variable_if_set_p, Fvariable_binding_locus):
86 The SOME_BUFFER_LOCAL_VALUEP distinction is replaced by local_if_set.
87 * alloc.c (allocate_buffer): Set the size and tag.
88 (allocate_misc, mark_maybe_object, mark_object, survives_gc_p):
89 Use XMISCANY.
90 (die): Follow the GNU convention for error messages.
91 * print.c (print_object): SOME_BUFFER_LOCAL_VALUEP -> local_if_set.
92 * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): Don't set the
93 tag any more.
94 (set_buffer_internal_1):
95 * frame.c (store_frame_param):
96 * eval.c (specbind):
97 * xdisp.c (select_frame_for_redisplay): Drop SOME_BUFFER_LOCAL_VALUEP.
98
99 * doc.c (Fsnarf_documentation): Simplify.
100
12007-10-14 Juanma Barranquero <lekktu@gmail.com> 1012007-10-14 Juanma Barranquero <lekktu@gmail.com>
2 102
3 * w32term.c (w32_font_is_double_byte, my_create_scrollbar): Make static. 103 * w32term.c (w32_font_is_double_byte, my_create_scrollbar): Make static.
@@ -68,6 +168,11 @@
68 168
69 * puresize.h (BASE_PURESIZE): Increase to 1170000. 169 * puresize.h (BASE_PURESIZE): Increase to 1170000.
70 170
1712007-10-09 Richard Stallman <rms@gnu.org>
172
173 * xdisp.c (handle_invisible_prop): After setting up an ellipsis,
174 return HANDLED_RETURN.
175
712007-10-08 Martin Rudalics <rudalics@gmx.at> 1762007-10-08 Martin Rudalics <rudalics@gmx.at>
72 177
73 * keyboard.c (kbd_buffer_get_event): Break loop waiting for input 178 * keyboard.c (kbd_buffer_get_event): Break loop waiting for input
diff --git a/src/alloc.c b/src/alloc.c
index ed003af3ea8..295da59d026 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1153,6 +1153,8 @@ allocate_buffer ()
1153 struct buffer *b 1153 struct buffer *b
1154 = (struct buffer *) lisp_malloc (sizeof (struct buffer), 1154 = (struct buffer *) lisp_malloc (sizeof (struct buffer),
1155 MEM_TYPE_BUFFER); 1155 MEM_TYPE_BUFFER);
1156 b->size = sizeof (struct buffer) / sizeof (EMACS_INT);
1157 XSETPVECTYPE (b, PVEC_BUFFER);
1156 return b; 1158 return b;
1157} 1159}
1158 1160
@@ -3307,7 +3309,7 @@ allocate_misc ()
3307 --total_free_markers; 3309 --total_free_markers;
3308 consing_since_gc += sizeof (union Lisp_Misc); 3310 consing_since_gc += sizeof (union Lisp_Misc);
3309 misc_objects_consed++; 3311 misc_objects_consed++;
3310 XMARKER (val)->gcmarkbit = 0; 3312 XMISCANY (val)->gcmarkbit = 0;
3311 return val; 3313 return val;
3312} 3314}
3313 3315
@@ -3317,7 +3319,7 @@ void
3317free_misc (misc) 3319free_misc (misc)
3318 Lisp_Object misc; 3320 Lisp_Object misc;
3319{ 3321{
3320 XMISC (misc)->u_marker.type = Lisp_Misc_Free; 3322 XMISCTYPE (misc) = Lisp_Misc_Free;
3321 XMISC (misc)->u_free.chain = marker_free_list; 3323 XMISC (misc)->u_free.chain = marker_free_list;
3322 marker_free_list = XMISC (misc); 3324 marker_free_list = XMISC (misc);
3323 3325
@@ -4033,7 +4035,7 @@ live_misc_p (m, p)
4033 && offset < (MARKER_BLOCK_SIZE * sizeof b->markers[0]) 4035 && offset < (MARKER_BLOCK_SIZE * sizeof b->markers[0])
4034 && (b != marker_block 4036 && (b != marker_block
4035 || offset / sizeof b->markers[0] < marker_block_index) 4037 || offset / sizeof b->markers[0] < marker_block_index)
4036 && ((union Lisp_Misc *) p)->u_marker.type != Lisp_Misc_Free); 4038 && ((union Lisp_Misc *) p)->u_any.type != Lisp_Misc_Free);
4037 } 4039 }
4038 else 4040 else
4039 return 0; 4041 return 0;
@@ -4164,7 +4166,7 @@ mark_maybe_object (obj)
4164 break; 4166 break;
4165 4167
4166 case Lisp_Misc: 4168 case Lisp_Misc:
4167 mark_p = (live_misc_p (m, po) && !XMARKER (obj)->gcmarkbit); 4169 mark_p = (live_misc_p (m, po) && !XMISCANY (obj)->gcmarkbit);
4168 break; 4170 break;
4169 4171
4170 case Lisp_Int: 4172 case Lisp_Int:
@@ -5613,14 +5615,13 @@ mark_object (arg)
5613 5615
5614 case Lisp_Misc: 5616 case Lisp_Misc:
5615 CHECK_ALLOCATED_AND_LIVE (live_misc_p); 5617 CHECK_ALLOCATED_AND_LIVE (live_misc_p);
5616 if (XMARKER (obj)->gcmarkbit) 5618 if (XMISCANY (obj)->gcmarkbit)
5617 break; 5619 break;
5618 XMARKER (obj)->gcmarkbit = 1; 5620 XMISCANY (obj)->gcmarkbit = 1;
5619 5621
5620 switch (XMISCTYPE (obj)) 5622 switch (XMISCTYPE (obj))
5621 { 5623 {
5622 case Lisp_Misc_Buffer_Local_Value: 5624 case Lisp_Misc_Buffer_Local_Value:
5623 case Lisp_Misc_Some_Buffer_Local_Value:
5624 { 5625 {
5625 register struct Lisp_Buffer_Local_Value *ptr 5626 register struct Lisp_Buffer_Local_Value *ptr
5626 = XBUFFER_LOCAL_VALUE (obj); 5627 = XBUFFER_LOCAL_VALUE (obj);
@@ -5806,7 +5807,7 @@ survives_gc_p (obj)
5806 break; 5807 break;
5807 5808
5808 case Lisp_Misc: 5809 case Lisp_Misc:
5809 survives_p = XMARKER (obj)->gcmarkbit; 5810 survives_p = XMISCANY (obj)->gcmarkbit;
5810 break; 5811 break;
5811 5812
5812 case Lisp_String: 5813 case Lisp_String:
@@ -6103,9 +6104,9 @@ gc_sweep ()
6103 6104
6104 for (i = 0; i < lim; i++) 6105 for (i = 0; i < lim; i++)
6105 { 6106 {
6106 if (!mblk->markers[i].u_marker.gcmarkbit) 6107 if (!mblk->markers[i].u_any.gcmarkbit)
6107 { 6108 {
6108 if (mblk->markers[i].u_marker.type == Lisp_Misc_Marker) 6109 if (mblk->markers[i].u_any.type == Lisp_Misc_Marker)
6109 unchain_marker (&mblk->markers[i].u_marker); 6110 unchain_marker (&mblk->markers[i].u_marker);
6110 /* Set the type of the freed object to Lisp_Misc_Free. 6111 /* Set the type of the freed object to Lisp_Misc_Free.
6111 We could leave the type alone, since nobody checks it, 6112 We could leave the type alone, since nobody checks it,
@@ -6118,7 +6119,7 @@ gc_sweep ()
6118 else 6119 else
6119 { 6120 {
6120 num_used++; 6121 num_used++;
6121 mblk->markers[i].u_marker.gcmarkbit = 0; 6122 mblk->markers[i].u_any.gcmarkbit = 0;
6122 } 6123 }
6123 } 6124 }
6124 lim = MARKER_BLOCK_SIZE; 6125 lim = MARKER_BLOCK_SIZE;
@@ -6256,7 +6257,7 @@ die (msg, file, line)
6256 const char *file; 6257 const char *file;
6257 int line; 6258 int line;
6258{ 6259{
6259 fprintf (stderr, "\r\nEmacs fatal error: %s:%d: %s\r\n", 6260 fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n",
6260 file, line, msg); 6261 file, line, msg);
6261 abort (); 6262 abort ();
6262} 6263}
diff --git a/src/buffer.c b/src/buffer.c
index d5f9541301d..416ff7e3702 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -362,8 +362,6 @@ The value is never nil. */)
362 362
363 b = (struct buffer *) allocate_buffer (); 363 b = (struct buffer *) allocate_buffer ();
364 364
365 b->size = sizeof (struct buffer) / sizeof (EMACS_INT);
366
367 /* An ordinary buffer uses its own struct buffer_text. */ 365 /* An ordinary buffer uses its own struct buffer_text. */
368 b->text = &b->own_text; 366 b->text = &b->own_text;
369 b->base_buffer = 0; 367 b->base_buffer = 0;
@@ -417,10 +415,7 @@ The value is never nil. */)
417 STRING_SET_INTERVALS (name, NULL_INTERVAL); 415 STRING_SET_INTERVALS (name, NULL_INTERVAL);
418 b->name = name; 416 b->name = name;
419 417
420 if (SREF (name, 0) != ' ') 418 b->undo_list = (SREF (name, 0) != ' ') ? Qnil : Qt;
421 b->undo_list = Qnil;
422 else
423 b->undo_list = Qt;
424 419
425 reset_buffer (b); 420 reset_buffer (b);
426 reset_buffer_local_variables (b, 1); 421 reset_buffer_local_variables (b, 1);
@@ -430,7 +425,6 @@ The value is never nil. */)
430 b->name = name; 425 b->name = name;
431 426
432 /* Put this in the alist of all live buffers. */ 427 /* Put this in the alist of all live buffers. */
433 XSETPVECTYPE (b, PVEC_BUFFER);
434 XSETBUFFER (buf, b); 428 XSETBUFFER (buf, b);
435 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil)); 429 Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
436 430
@@ -568,13 +562,10 @@ CLONE nil means the indirect buffer's state is reset to default values. */)
568 error ("Empty string for buffer name is not allowed"); 562 error ("Empty string for buffer name is not allowed");
569 563
570 b = (struct buffer *) allocate_buffer (); 564 b = (struct buffer *) allocate_buffer ();
571 b->size = sizeof (struct buffer) / sizeof (EMACS_INT);
572 XSETPVECTYPE (b, PVEC_BUFFER);
573 565
574 if (XBUFFER (base_buffer)->base_buffer) 566 b->base_buffer = (XBUFFER (base_buffer)->base_buffer
575 b->base_buffer = XBUFFER (base_buffer)->base_buffer; 567 ? XBUFFER (base_buffer)->base_buffer
576 else 568 : XBUFFER (base_buffer));
577 b->base_buffer = XBUFFER (base_buffer);
578 569
579 /* Use the base buffer's text object. */ 570 /* Use the base buffer's text object. */
580 b->text = b->base_buffer->text; 571 b->text = b->base_buffer->text;
@@ -1919,8 +1910,7 @@ set_buffer_internal_1 (b)
1919 for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1910 for (tail = b->local_var_alist; CONSP (tail); tail = XCDR (tail))
1920 { 1911 {
1921 valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); 1912 valcontents = SYMBOL_VALUE (XCAR (XCAR (tail)));
1922 if ((BUFFER_LOCAL_VALUEP (valcontents) 1913 if ((BUFFER_LOCAL_VALUEP (valcontents))
1923 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1924 && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, 1914 && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
1925 (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) 1915 (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem))))
1926 /* Just reference the variable 1916 /* Just reference the variable
@@ -1934,8 +1924,7 @@ set_buffer_internal_1 (b)
1934 for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1924 for (tail = old_buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
1935 { 1925 {
1936 valcontents = SYMBOL_VALUE (XCAR (XCAR (tail))); 1926 valcontents = SYMBOL_VALUE (XCAR (XCAR (tail)));
1937 if ((BUFFER_LOCAL_VALUEP (valcontents) 1927 if ((BUFFER_LOCAL_VALUEP (valcontents))
1938 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1939 && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue, 1928 && (tem = XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
1940 (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem)))) 1929 (BOOLFWDP (tem) || INTFWDP (tem) || OBJFWDP (tem))))
1941 /* Just reference the variable 1930 /* Just reference the variable
@@ -2509,7 +2498,7 @@ the normal hook `change-major-mode-hook'. */)
2509 /* Any which are supposed to be permanent, 2498 /* Any which are supposed to be permanent,
2510 make local again, with the same values they had. */ 2499 make local again, with the same values they had. */
2511 2500
2512 for (alist = oalist; !NILP (alist); alist = XCDR (alist)) 2501 for (alist = oalist; CONSP (alist); alist = XCDR (alist))
2513 { 2502 {
2514 sym = XCAR (XCAR (alist)); 2503 sym = XCAR (XCAR (alist));
2515 tem = Fget (sym, Qpermanent_local); 2504 tem = Fget (sym, Qpermanent_local);
@@ -2539,7 +2528,7 @@ swap_out_buffer_local_variables (b)
2539 XSETBUFFER (buffer, b); 2528 XSETBUFFER (buffer, b);
2540 oalist = b->local_var_alist; 2529 oalist = b->local_var_alist;
2541 2530
2542 for (alist = oalist; !NILP (alist); alist = XCDR (alist)) 2531 for (alist = oalist; CONSP (alist); alist = XCDR (alist))
2543 { 2532 {
2544 sym = XCAR (XCAR (alist)); 2533 sym = XCAR (XCAR (alist));
2545 2534
diff --git a/src/coding.c b/src/coding.c
index 2b518b903a4..c77aa338a1e 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -329,6 +329,8 @@ Lisp_Object Qtarget_idx;
329Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source; 329Lisp_Object Qinsufficient_source, Qinconsistent_eol, Qinvalid_source;
330Lisp_Object Qinterrupted, Qinsufficient_memory; 330Lisp_Object Qinterrupted, Qinsufficient_memory;
331 331
332extern Lisp_Object Qcompletion_ignore_case;
333
332/* If a symbol has this property, evaluate the value to define the 334/* If a symbol has this property, evaluate the value to define the
333 symbol as a coding system. */ 335 symbol as a coding system. */
334static Lisp_Object Qcoding_system_define_form; 336static Lisp_Object Qcoding_system_define_form;
@@ -7194,16 +7196,22 @@ DEFUN ("read-non-nil-coding-system", Fread_non_nil_coding_system,
7194 7196
7195DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0, 7197DEFUN ("read-coding-system", Fread_coding_system, Sread_coding_system, 1, 2, 0,
7196 doc: /* Read a coding system from the minibuffer, prompting with string PROMPT. 7198 doc: /* Read a coding system from the minibuffer, prompting with string PROMPT.
7197If the user enters null input, return second argument DEFAULT-CODING-SYSTEM. */) 7199If the user enters null input, return second argument DEFAULT-CODING-SYSTEM.
7200Ignores case when completing coding systems (all Emacs coding systems
7201are lower-case). */)
7198 (prompt, default_coding_system) 7202 (prompt, default_coding_system)
7199 Lisp_Object prompt, default_coding_system; 7203 Lisp_Object prompt, default_coding_system;
7200{ 7204{
7201 Lisp_Object val; 7205 Lisp_Object val;
7206 int count = SPECPDL_INDEX ();
7207
7202 if (SYMBOLP (default_coding_system)) 7208 if (SYMBOLP (default_coding_system))
7203 XSETSTRING (default_coding_system, XPNTR (SYMBOL_NAME (default_coding_system))); 7209 default_coding_system = SYMBOL_NAME (default_coding_system);
7210 specbind (Qcompletion_ignore_case, Qt);
7204 val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil, 7211 val = Fcompleting_read (prompt, Vcoding_system_alist, Qnil,
7205 Qt, Qnil, Qcoding_system_history, 7212 Qt, Qnil, Qcoding_system_history,
7206 default_coding_system, Qnil); 7213 default_coding_system, Qnil);
7214 unbind_to (count, Qnil);
7207 return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil)); 7215 return (SCHARS (val) == 0 ? Qnil : Fintern (val, Qnil));
7208} 7216}
7209 7217
diff --git a/src/config.in b/src/config.in
index 60be3c22003..c23ec13ac88 100644
--- a/src/config.in
+++ b/src/config.in
@@ -492,7 +492,7 @@ Boston, MA 02110-1301, USA. */
492/* Define to 1 if you have the `rename' function. */ 492/* Define to 1 if you have the `rename' function. */
493#undef HAVE_RENAME 493#undef HAVE_RENAME
494 494
495/* Define to 1 if you have the `res_init' function. */ 495/* Define to 1 if res_init is available. */
496#undef HAVE_RES_INIT 496#undef HAVE_RES_INIT
497 497
498/* Define to 1 if you have the `rindex' function. */ 498/* Define to 1 if you have the `rindex' function. */
diff --git a/src/data.c b/src/data.c
index 81cffcb38de..3139af1e001 100644
--- a/src/data.c
+++ b/src/data.c
@@ -584,8 +584,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
584 584
585 valcontents = SYMBOL_VALUE (symbol); 585 valcontents = SYMBOL_VALUE (symbol);
586 586
587 if (BUFFER_LOCAL_VALUEP (valcontents) 587 if (BUFFER_LOCAL_VALUEP (valcontents))
588 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
589 valcontents = swap_in_symval_forwarding (symbol, valcontents); 588 valcontents = swap_in_symval_forwarding (symbol, valcontents);
590 589
591 return (EQ (valcontents, Qunbound) ? Qnil : Qt); 590 return (EQ (valcontents, Qunbound) ? Qnil : Qt);
@@ -998,8 +997,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
998 default: 997 default:
999 def: 998 def:
1000 valcontents = SYMBOL_VALUE (symbol); 999 valcontents = SYMBOL_VALUE (symbol);
1001 if (BUFFER_LOCAL_VALUEP (valcontents) 1000 if (BUFFER_LOCAL_VALUEP (valcontents))
1002 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1003 XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval; 1001 XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval;
1004 else 1002 else
1005 SET_SYMBOL_VALUE (symbol, newval); 1003 SET_SYMBOL_VALUE (symbol, newval);
@@ -1016,8 +1014,7 @@ swap_in_global_binding (symbol)
1016 Lisp_Object valcontents, cdr; 1014 Lisp_Object valcontents, cdr;
1017 1015
1018 valcontents = SYMBOL_VALUE (symbol); 1016 valcontents = SYMBOL_VALUE (symbol);
1019 if (!BUFFER_LOCAL_VALUEP (valcontents) 1017 if (!BUFFER_LOCAL_VALUEP (valcontents))
1020 && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
1021 abort (); 1018 abort ();
1022 cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr; 1019 cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr;
1023 1020
@@ -1106,8 +1103,7 @@ find_symbol_value (symbol)
1106 CHECK_SYMBOL (symbol); 1103 CHECK_SYMBOL (symbol);
1107 valcontents = SYMBOL_VALUE (symbol); 1104 valcontents = SYMBOL_VALUE (symbol);
1108 1105
1109 if (BUFFER_LOCAL_VALUEP (valcontents) 1106 if (BUFFER_LOCAL_VALUEP (valcontents))
1110 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1111 valcontents = swap_in_symval_forwarding (symbol, valcontents); 1107 valcontents = swap_in_symval_forwarding (symbol, valcontents);
1112 1108
1113 if (MISCP (valcontents)) 1109 if (MISCP (valcontents))
@@ -1225,8 +1221,7 @@ set_internal (symbol, newval, buf, bindflag)
1225 && !let_shadows_buffer_binding_p (symbol)) 1221 && !let_shadows_buffer_binding_p (symbol))
1226 SET_PER_BUFFER_VALUE_P (buf, idx, 1); 1222 SET_PER_BUFFER_VALUE_P (buf, idx, 1);
1227 } 1223 }
1228 else if (BUFFER_LOCAL_VALUEP (valcontents) 1224 else if (BUFFER_LOCAL_VALUEP (valcontents))
1229 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1230 { 1225 {
1231 /* valcontents is a struct Lisp_Buffer_Local_Value. */ 1226 /* valcontents is a struct Lisp_Buffer_Local_Value. */
1232 if (XSYMBOL (symbol)->indirect_variable) 1227 if (XSYMBOL (symbol)->indirect_variable)
@@ -1271,7 +1266,7 @@ set_internal (symbol, newval, buf, bindflag)
1271 indicating that we're seeing the default value. 1266 indicating that we're seeing the default value.
1272 Likewise if the variable has been let-bound 1267 Likewise if the variable has been let-bound
1273 in the current buffer. */ 1268 in the current buffer. */
1274 if (bindflag || SOME_BUFFER_LOCAL_VALUEP (valcontents) 1269 if (bindflag || !XBUFFER_LOCAL_VALUE (valcontents)->local_if_set
1275 || let_shadows_buffer_binding_p (symbol)) 1270 || let_shadows_buffer_binding_p (symbol))
1276 { 1271 {
1277 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; 1272 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
@@ -1299,8 +1294,7 @@ set_internal (symbol, newval, buf, bindflag)
1299 } 1294 }
1300 1295
1301 /* Record which binding is now loaded. */ 1296 /* Record which binding is now loaded. */
1302 XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, 1297 XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1);
1303 tem1);
1304 1298
1305 /* Set `buffer' and `frame' slots for the binding now loaded. */ 1299 /* Set `buffer' and `frame' slots for the binding now loaded. */
1306 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf); 1300 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf);
@@ -1319,8 +1313,7 @@ set_internal (symbol, newval, buf, bindflag)
1319 /* If we just set a variable whose current binding is frame-local, 1313 /* If we just set a variable whose current binding is frame-local,
1320 store the new value in the frame parameter too. */ 1314 store the new value in the frame parameter too. */
1321 1315
1322 if (BUFFER_LOCAL_VALUEP (valcontents) 1316 if (BUFFER_LOCAL_VALUEP (valcontents))
1323 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1324 { 1317 {
1325 /* What binding is loaded right now? */ 1318 /* What binding is loaded right now? */
1326 current_alist_element 1319 current_alist_element
@@ -1362,8 +1355,7 @@ default_value (symbol)
1362 } 1355 }
1363 1356
1364 /* Handle user-created local variables. */ 1357 /* Handle user-created local variables. */
1365 if (BUFFER_LOCAL_VALUEP (valcontents) 1358 if (BUFFER_LOCAL_VALUEP (valcontents))
1366 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1367 { 1359 {
1368 /* If var is set up for a buffer that lacks a local value for it, 1360 /* If var is set up for a buffer that lacks a local value for it,
1369 the current value is nominally the default value. 1361 the current value is nominally the default value.
@@ -1447,8 +1439,7 @@ for this variable. */)
1447 return value; 1439 return value;
1448 } 1440 }
1449 1441
1450 if (!BUFFER_LOCAL_VALUEP (valcontents) 1442 if (!BUFFER_LOCAL_VALUEP (valcontents))
1451 && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
1452 return Fset (symbol, value); 1443 return Fset (symbol, value);
1453 1444
1454 /* Store new value into the DEFAULT-VALUE slot. */ 1445 /* Store new value into the DEFAULT-VALUE slot. */
@@ -1533,27 +1524,28 @@ The function `default-value' gets the default value and `set-default' sets it.
1533 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) 1524 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
1534 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); 1525 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
1535 1526
1536 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) 1527 if (BUFFER_OBJFWDP (valcontents))
1537 return variable; 1528 return variable;
1538 if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1529 else if (BUFFER_LOCAL_VALUEP (valcontents))
1530 newval = valcontents;
1531 else
1539 { 1532 {
1540 XMISCTYPE (SYMBOL_VALUE (variable)) = Lisp_Misc_Buffer_Local_Value; 1533 if (EQ (valcontents, Qunbound))
1541 return variable; 1534 SET_SYMBOL_VALUE (variable, Qnil);
1535 tem = Fcons (Qnil, Fsymbol_value (variable));
1536 XSETCAR (tem, tem);
1537 newval = allocate_misc ();
1538 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
1539 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
1540 XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer ();
1541 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
1542 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
1543 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1544 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
1545 XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
1546 SET_SYMBOL_VALUE (variable, newval);
1542 } 1547 }
1543 if (EQ (valcontents, Qunbound)) 1548 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 1;
1544 SET_SYMBOL_VALUE (variable, Qnil);
1545 tem = Fcons (Qnil, Fsymbol_value (variable));
1546 XSETCAR (tem, tem);
1547 newval = allocate_misc ();
1548 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
1549 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
1550 XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer ();
1551 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
1552 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
1553 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1554 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
1555 XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
1556 SET_SYMBOL_VALUE (variable, newval);
1557 return variable; 1549 return variable;
1558} 1550}
1559 1551
@@ -1589,7 +1581,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1589 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) 1581 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
1590 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); 1582 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
1591 1583
1592 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) 1584 if ((BUFFER_LOCAL_VALUEP (valcontents)
1585 && XBUFFER_LOCAL_VALUE (valcontents)->local_if_set)
1586 || BUFFER_OBJFWDP (valcontents))
1593 { 1587 {
1594 tem = Fboundp (variable); 1588 tem = Fboundp (variable);
1595 1589
@@ -1599,16 +1593,17 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1599 return variable; 1593 return variable;
1600 } 1594 }
1601 /* Make sure symbol is set up to hold per-buffer values. */ 1595 /* Make sure symbol is set up to hold per-buffer values. */
1602 if (!SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1596 if (!BUFFER_LOCAL_VALUEP (valcontents))
1603 { 1597 {
1604 Lisp_Object newval; 1598 Lisp_Object newval;
1605 tem = Fcons (Qnil, do_symval_forwarding (valcontents)); 1599 tem = Fcons (Qnil, do_symval_forwarding (valcontents));
1606 XSETCAR (tem, tem); 1600 XSETCAR (tem, tem);
1607 newval = allocate_misc (); 1601 newval = allocate_misc ();
1608 XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; 1602 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
1609 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); 1603 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
1610 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; 1604 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
1611 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; 1605 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
1606 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0;
1612 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; 1607 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
1613 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; 1608 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1614 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; 1609 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
@@ -1681,8 +1676,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1681 return variable; 1676 return variable;
1682 } 1677 }
1683 1678
1684 if (!BUFFER_LOCAL_VALUEP (valcontents) 1679 if (!BUFFER_LOCAL_VALUEP (valcontents))
1685 && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
1686 return variable; 1680 return variable;
1687 1681
1688 /* Get rid of this buffer's alist element, if any. */ 1682 /* Get rid of this buffer's alist element, if any. */
@@ -1743,8 +1737,7 @@ Buffer-local bindings take precedence over frame-local bindings. */)
1743 || BUFFER_OBJFWDP (valcontents)) 1737 || BUFFER_OBJFWDP (valcontents))
1744 error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable))); 1738 error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
1745 1739
1746 if (BUFFER_LOCAL_VALUEP (valcontents) 1740 if (BUFFER_LOCAL_VALUEP (valcontents))
1747 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1748 { 1741 {
1749 XBUFFER_LOCAL_VALUE (valcontents)->check_frame = 1; 1742 XBUFFER_LOCAL_VALUE (valcontents)->check_frame = 1;
1750 return variable; 1743 return variable;
@@ -1755,10 +1748,11 @@ Buffer-local bindings take precedence over frame-local bindings. */)
1755 tem = Fcons (Qnil, Fsymbol_value (variable)); 1748 tem = Fcons (Qnil, Fsymbol_value (variable));
1756 XSETCAR (tem, tem); 1749 XSETCAR (tem, tem);
1757 newval = allocate_misc (); 1750 newval = allocate_misc ();
1758 XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; 1751 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
1759 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); 1752 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
1760 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; 1753 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
1761 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; 1754 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
1755 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0;
1762 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; 1756 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
1763 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; 1757 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1764 XBUFFER_LOCAL_VALUE (newval)->check_frame = 1; 1758 XBUFFER_LOCAL_VALUE (newval)->check_frame = 1;
@@ -1789,8 +1783,7 @@ BUFFER defaults to the current buffer. */)
1789 variable = indirect_variable (variable); 1783 variable = indirect_variable (variable);
1790 1784
1791 valcontents = SYMBOL_VALUE (variable); 1785 valcontents = SYMBOL_VALUE (variable);
1792 if (BUFFER_LOCAL_VALUEP (valcontents) 1786 if (BUFFER_LOCAL_VALUEP (valcontents))
1793 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1794 { 1787 {
1795 Lisp_Object tail, elt; 1788 Lisp_Object tail, elt;
1796 1789
@@ -1838,15 +1831,14 @@ BUFFER defaults to the current buffer. */)
1838 1831
1839 valcontents = SYMBOL_VALUE (variable); 1832 valcontents = SYMBOL_VALUE (variable);
1840 1833
1841 /* This means that make-variable-buffer-local was done. */
1842 if (BUFFER_LOCAL_VALUEP (valcontents))
1843 return Qt;
1844 /* All these slots become local if they are set. */
1845 if (BUFFER_OBJFWDP (valcontents)) 1834 if (BUFFER_OBJFWDP (valcontents))
1835 /* All these slots become local if they are set. */
1846 return Qt; 1836 return Qt;
1847 if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1837 else if (BUFFER_LOCAL_VALUEP (valcontents))
1848 { 1838 {
1849 Lisp_Object tail, elt; 1839 Lisp_Object tail, elt;
1840 if (XBUFFER_LOCAL_VALUE (valcontents)->local_if_set)
1841 return Qt;
1850 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1842 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
1851 { 1843 {
1852 elt = XCAR (tail); 1844 elt = XCAR (tail);
@@ -1877,14 +1869,13 @@ If the current binding is global (the default), the value is nil. */)
1877 valcontents = XSYMBOL (variable)->value; 1869 valcontents = XSYMBOL (variable)->value;
1878 1870
1879 if (BUFFER_LOCAL_VALUEP (valcontents) 1871 if (BUFFER_LOCAL_VALUEP (valcontents)
1880 || SOME_BUFFER_LOCAL_VALUEP (valcontents)
1881 || BUFFER_OBJFWDP (valcontents)) 1872 || BUFFER_OBJFWDP (valcontents))
1882 { 1873 {
1883 /* For a local variable, record both the symbol and which 1874 /* For a local variable, record both the symbol and which
1884 buffer's or frame's value we are saving. */ 1875 buffer's or frame's value we are saving. */
1885 if (!NILP (Flocal_variable_p (variable, Qnil))) 1876 if (!NILP (Flocal_variable_p (variable, Qnil)))
1886 return Fcurrent_buffer (); 1877 return Fcurrent_buffer ();
1887 else if (!BUFFER_OBJFWDP (valcontents) 1878 else if (BUFFER_LOCAL_VALUEP (valcontents)
1888 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) 1879 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
1889 return XBUFFER_LOCAL_VALUE (valcontents)->frame; 1880 return XBUFFER_LOCAL_VALUE (valcontents)->frame;
1890 } 1881 }
diff --git a/src/dired.c b/src/dired.c
index b362eec62b5..ccd27dbb713 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -116,10 +116,10 @@ extern void filemodestring P_ ((struct stat *, char *));
116#endif 116#endif
117 117
118extern int completion_ignore_case; 118extern int completion_ignore_case;
119extern Lisp_Object Qcompletion_ignore_case;
119extern Lisp_Object Vcompletion_regexp_list; 120extern Lisp_Object Vcompletion_regexp_list;
120 121
121Lisp_Object Vcompletion_ignored_extensions; 122Lisp_Object Vcompletion_ignored_extensions;
122Lisp_Object Qcompletion_ignore_case;
123Lisp_Object Qdirectory_files; 123Lisp_Object Qdirectory_files;
124Lisp_Object Qdirectory_files_and_attributes; 124Lisp_Object Qdirectory_files_and_attributes;
125Lisp_Object Qfile_name_completion; 125Lisp_Object Qfile_name_completion;
@@ -1078,11 +1078,6 @@ syms_of_dired ()
1078 defsubr (&Sfile_attributes); 1078 defsubr (&Sfile_attributes);
1079 defsubr (&Sfile_attributes_lessp); 1079 defsubr (&Sfile_attributes_lessp);
1080 1080
1081#ifdef VMS
1082 Qcompletion_ignore_case = intern ("completion-ignore-case");
1083 staticpro (&Qcompletion_ignore_case);
1084#endif /* VMS */
1085
1086 DEFVAR_LISP ("completion-ignored-extensions", &Vcompletion_ignored_extensions, 1081 DEFVAR_LISP ("completion-ignored-extensions", &Vcompletion_ignored_extensions,
1087 doc: /* Completion ignores file names ending in any string in this list. 1082 doc: /* Completion ignores file names ending in any string in this list.
1088It does not ignore them if all possible completions end in one of 1083It does not ignore them if all possible completions end in one of
diff --git a/src/doc.c b/src/doc.c
index 3b335127a75..f491661a616 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -693,15 +693,17 @@ the same file name is found in the `doc-directory'. */)
693 if (fromfile[len-1] == 'c') 693 if (fromfile[len-1] == 'c')
694 fromfile[len-1] = 'o'; 694 fromfile[len-1] = 'o';
695 695
696 if (EQ (Fmember (build_string (fromfile), Vbuild_files), Qnil)) 696 skip_file = NILP (Fmember (build_string (fromfile),
697 skip_file = 1; 697 Vbuild_files));
698 else
699 skip_file = 0;
700 } 698 }
701 699
702 sym = oblookup (Vobarray, p + 2, 700 sym = oblookup (Vobarray, p + 2,
703 multibyte_chars_in_text (p + 2, end - p - 2), 701 multibyte_chars_in_text (p + 2, end - p - 2),
704 end - p - 2); 702 end - p - 2);
703 /* Check skip_file so that when a function is defined several
704 times in different files (typically, once in xterm, once in
705 w32term, ...), we only pay attention to the one that
706 matters. */
705 if (! skip_file && SYMBOLP (sym)) 707 if (! skip_file && SYMBOLP (sym))
706 { 708 {
707 /* Attach a docstring to a variable? */ 709 /* Attach a docstring to a variable? */
diff --git a/src/eval.c b/src/eval.c
index b69eea44c75..eaa1a6855f6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -468,7 +468,7 @@ usage: (prog1 FIRST BODY...) */)
468 struct gcpro gcpro1, gcpro2; 468 struct gcpro gcpro1, gcpro2;
469 register int argnum = 0; 469 register int argnum = 0;
470 470
471 if (NILP(args)) 471 if (NILP (args))
472 return Qnil; 472 return Qnil;
473 473
474 args_left = args; 474 args_left = args;
@@ -1043,10 +1043,10 @@ usage: (let VARLIST BODY...) */)
1043 GCPRO2 (args, *temps); 1043 GCPRO2 (args, *temps);
1044 gcpro2.nvars = 0; 1044 gcpro2.nvars = 0;
1045 1045
1046 for (argnum = 0; !NILP (varlist); varlist = Fcdr (varlist)) 1046 for (argnum = 0; CONSP (varlist); varlist = XCDR (varlist))
1047 { 1047 {
1048 QUIT; 1048 QUIT;
1049 elt = Fcar (varlist); 1049 elt = XCAR (varlist);
1050 if (SYMBOLP (elt)) 1050 if (SYMBOLP (elt))
1051 temps [argnum++] = Qnil; 1051 temps [argnum++] = Qnil;
1052 else if (! NILP (Fcdr (Fcdr (elt)))) 1052 else if (! NILP (Fcdr (Fcdr (elt))))
@@ -1058,9 +1058,9 @@ usage: (let VARLIST BODY...) */)
1058 UNGCPRO; 1058 UNGCPRO;
1059 1059
1060 varlist = Fcar (args); 1060 varlist = Fcar (args);
1061 for (argnum = 0; !NILP (varlist); varlist = Fcdr (varlist)) 1061 for (argnum = 0; CONSP (varlist); varlist = XCDR (varlist))
1062 { 1062 {
1063 elt = Fcar (varlist); 1063 elt = XCAR (varlist);
1064 tem = temps[argnum++]; 1064 tem = temps[argnum++];
1065 if (SYMBOLP (elt)) 1065 if (SYMBOLP (elt))
1066 specbind (elt, tem); 1066 specbind (elt, tem);
@@ -3285,7 +3285,6 @@ specbind (symbol, value)
3285 valcontents = XSYMBOL (symbol)->value; 3285 valcontents = XSYMBOL (symbol)->value;
3286 3286
3287 if (BUFFER_LOCAL_VALUEP (valcontents) 3287 if (BUFFER_LOCAL_VALUEP (valcontents)
3288 || SOME_BUFFER_LOCAL_VALUEP (valcontents)
3289 || BUFFER_OBJFWDP (valcontents)) 3288 || BUFFER_OBJFWDP (valcontents))
3290 { 3289 {
3291 Lisp_Object where, current_buffer; 3290 Lisp_Object where, current_buffer;
@@ -3296,7 +3295,7 @@ specbind (symbol, value)
3296 buffer's or frame's value we are saving. */ 3295 buffer's or frame's value we are saving. */
3297 if (!NILP (Flocal_variable_p (symbol, Qnil))) 3296 if (!NILP (Flocal_variable_p (symbol, Qnil)))
3298 where = current_buffer; 3297 where = current_buffer;
3299 else if (!BUFFER_OBJFWDP (valcontents) 3298 else if (BUFFER_LOCAL_VALUEP (valcontents)
3300 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) 3299 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
3301 where = XBUFFER_LOCAL_VALUE (valcontents)->frame; 3300 where = XBUFFER_LOCAL_VALUE (valcontents)->frame;
3302 else 3301 else
diff --git a/src/fileio.c b/src/fileio.c
index c9b6462e4a0..8b6f5ef1a84 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6079,6 +6079,7 @@ then any auto-save counts as "recent". */)
6079 6079
6080/* Reading and completing file names */ 6080/* Reading and completing file names */
6081extern Lisp_Object Ffile_name_completion (), Ffile_name_all_completions (); 6081extern Lisp_Object Ffile_name_completion (), Ffile_name_all_completions ();
6082extern Lisp_Object Qcompletion_ignore_case;
6082 6083
6083/* In the string VAL, change each $ to $$ and return the result. */ 6084/* In the string VAL, change each $ to $$ and return the result. */
6084 6085
@@ -6384,7 +6385,7 @@ and `read-file-name-function'. */)
6384 } 6385 }
6385 6386
6386 count = SPECPDL_INDEX (); 6387 count = SPECPDL_INDEX ();
6387 specbind (intern ("completion-ignore-case"), 6388 specbind (Qcompletion_ignore_case,
6388 read_file_name_completion_ignore_case ? Qt : Qnil); 6389 read_file_name_completion_ignore_case ? Qt : Qnil);
6389 specbind (intern ("minibuffer-completing-file-name"), Qt); 6390 specbind (intern ("minibuffer-completing-file-name"), Qt);
6390 specbind (intern ("read-file-name-predicate"), 6391 specbind (intern ("read-file-name-predicate"),
diff --git a/src/fns.c b/src/fns.c
index 9f7e422d757..82f9501f7aa 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1370,7 +1370,7 @@ The value is actually the tail of LIST whose car is ELT. */)
1370 Lisp_Object list; 1370 Lisp_Object list;
1371{ 1371{
1372 register Lisp_Object tail; 1372 register Lisp_Object tail;
1373 for (tail = list; !NILP (tail); tail = XCDR (tail)) 1373 for (tail = list; CONSP (tail); tail = XCDR (tail))
1374 { 1374 {
1375 register Lisp_Object tem; 1375 register Lisp_Object tem;
1376 CHECK_LIST_CONS (tail, list); 1376 CHECK_LIST_CONS (tail, list);
@@ -1421,7 +1421,7 @@ The value is actually the tail of LIST whose car is ELT. */)
1421 if (!FLOATP (elt)) 1421 if (!FLOATP (elt))
1422 return Fmemq (elt, list); 1422 return Fmemq (elt, list);
1423 1423
1424 for (tail = list; !NILP (tail); tail = XCDR (tail)) 1424 for (tail = list; CONSP (tail); tail = XCDR (tail))
1425 { 1425 {
1426 register Lisp_Object tem; 1426 register Lisp_Object tem;
1427 CHECK_LIST_CONS (tail, list); 1427 CHECK_LIST_CONS (tail, list);
@@ -1741,7 +1741,7 @@ to be sure of changing the value of `foo'. */)
1741 { 1741 {
1742 Lisp_Object tail, prev; 1742 Lisp_Object tail, prev;
1743 1743
1744 for (tail = seq, prev = Qnil; !NILP (tail); tail = XCDR (tail)) 1744 for (tail = seq, prev = Qnil; CONSP (tail); tail = XCDR (tail))
1745 { 1745 {
1746 CHECK_LIST_CONS (tail, seq); 1746 CHECK_LIST_CONS (tail, seq);
1747 1747
diff --git a/src/frame.c b/src/frame.c
index 389a94ae3e8..5c89c96a239 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2299,8 +2299,7 @@ store_frame_param (f, prop, val)
2299 { 2299 {
2300 Lisp_Object valcontents; 2300 Lisp_Object valcontents;
2301 valcontents = SYMBOL_VALUE (prop); 2301 valcontents = SYMBOL_VALUE (prop);
2302 if ((BUFFER_LOCAL_VALUEP (valcontents) 2302 if ((BUFFER_LOCAL_VALUEP (valcontents))
2303 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
2304 && XBUFFER_LOCAL_VALUE (valcontents)->check_frame 2303 && XBUFFER_LOCAL_VALUE (valcontents)->check_frame
2305 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame 2304 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame
2306 && XFRAME (XBUFFER_LOCAL_VALUE (valcontents)->frame) == f) 2305 && XFRAME (XBUFFER_LOCAL_VALUE (valcontents)->frame) == f)
diff --git a/src/keyboard.c b/src/keyboard.c
index 6d6ba6e0cc0..2002aded95d 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -8538,7 +8538,7 @@ read_char_x_menu_prompt (nmaps, maps, prev_event, used_mouse_menu)
8538 to indicate that they came from a mouse menu, 8538 to indicate that they came from a mouse menu,
8539 so that when present in last_nonmenu_event 8539 so that when present in last_nonmenu_event
8540 they won't confuse things. */ 8540 they won't confuse things. */
8541 for (tem = XCDR (value); !NILP (tem); tem = XCDR (tem)) 8541 for (tem = XCDR (value); CONSP (tem); tem = XCDR (tem))
8542 { 8542 {
8543 record_menu_key (XCAR (tem)); 8543 record_menu_key (XCAR (tem));
8544 if (SYMBOLP (XCAR (tem)) 8544 if (SYMBOLP (XCAR (tem))
@@ -9185,13 +9185,16 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9185 orig_keymap = get_local_map (PT, current_buffer, Qkeymap); 9185 orig_keymap = get_local_map (PT, current_buffer, Qkeymap);
9186 from_string = Qnil; 9186 from_string = Qnil;
9187 9187
9188 /* We jump here when the key sequence has been thoroughly changed, and 9188 /* The multi-tty merge moved the code below to right after
9189 we need to rescan it starting from the beginning. When we jump here, 9189 `replay_sequence' which caused alll these translation maps to be applied
9190 keybuf[0..mock_input] holds the sequence we should reread. */ 9190 repeatedly, even tho their doc says very clearly they are not applied to
9191 replay_sequence: 9191 their own output.
9192 9192 The reason for this move was: "We may switch keyboards between rescans,
9193 /* We may switch keyboards between rescans, so we need to 9193 so we need to reinitialize fkey and keytran before each replay".
9194 reinitialize fkey and keytran before each replay. */ 9194 This move was wrong (even if we switch keyboards, keybuf still holds the
9195 keys we've read already from the original keyboard and some of those keys
9196 may have already been translated). So there may still be a bug out there
9197 lurking. */
9195 indec.map = indec.parent = current_kboard->Vinput_decode_map; 9198 indec.map = indec.parent = current_kboard->Vinput_decode_map;
9196 fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map; 9199 fkey.map = fkey.parent = current_kboard->Vlocal_function_key_map;
9197 keytran.map = keytran.parent = Vkey_translation_map; 9200 keytran.map = keytran.parent = Vkey_translation_map;
@@ -9199,6 +9202,11 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9199 fkey.start = fkey.end = 0; 9202 fkey.start = fkey.end = 0;
9200 keytran.start = keytran.end = 0; 9203 keytran.start = keytran.end = 0;
9201 9204
9205 /* We jump here when the key sequence has been thoroughly changed, and
9206 we need to rescan it starting from the beginning. When we jump here,
9207 keybuf[0..mock_input] holds the sequence we should reread. */
9208 replay_sequence:
9209
9202 starting_buffer = current_buffer; 9210 starting_buffer = current_buffer;
9203 first_unbound = bufsize + 1; 9211 first_unbound = bufsize + 1;
9204 9212
diff --git a/src/keymap.c b/src/keymap.c
index b6243594beb..b5abb194e1f 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1280,9 +1280,9 @@ remapping in all currently active keymaps. */)
1280 { 1280 {
1281 Lisp_Object maps, binding; 1281 Lisp_Object maps, binding;
1282 1282
1283 for (maps = keymaps; !NILP (maps); maps = Fcdr (maps)) 1283 for (maps = keymaps; CONSP (maps); maps = XCDR (maps))
1284 { 1284 {
1285 binding = Flookup_key (Fcar (maps), command_remapping_vector, Qnil); 1285 binding = Flookup_key (XCAR (maps), command_remapping_vector, Qnil);
1286 if (!NILP (binding) && !INTEGERP (binding)) 1286 if (!NILP (binding) && !INTEGERP (binding))
1287 return binding; 1287 return binding;
1288 } 1288 }
@@ -2653,7 +2653,7 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2653 && !NILP (Fcommand_remapping (definition, Qnil, keymaps))) 2653 && !NILP (Fcommand_remapping (definition, Qnil, keymaps)))
2654 RETURN_UNGCPRO (Qnil); 2654 RETURN_UNGCPRO (Qnil);
2655 2655
2656 for (; !NILP (maps); maps = Fcdr (maps)) 2656 for (; CONSP (maps); maps = XCDR (maps))
2657 { 2657 {
2658 /* Key sequence to reach map, and the map that it reaches */ 2658 /* Key sequence to reach map, and the map that it reaches */
2659 register Lisp_Object this, map, tem; 2659 register Lisp_Object this, map, tem;
@@ -2665,8 +2665,8 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2665 Lisp_Object last; 2665 Lisp_Object last;
2666 int last_is_meta; 2666 int last_is_meta;
2667 2667
2668 this = Fcar (Fcar (maps)); 2668 this = Fcar (XCAR (maps));
2669 map = Fcdr (Fcar (maps)); 2669 map = Fcdr (XCAR (maps));
2670 last = make_number (XINT (Flength (this)) - 1); 2670 last = make_number (XINT (Flength (this)) - 1);
2671 last_is_meta = (XINT (last) >= 0 2671 last_is_meta = (XINT (last) >= 0
2672 && EQ (Faref (this, last), meta_prefix_char)); 2672 && EQ (Faref (this, last), meta_prefix_char));
@@ -3155,11 +3155,11 @@ key binding\n\
3155 Lisp_Object list; 3155 Lisp_Object list;
3156 3156
3157 /* Delete from MAPS each element that is for the menu bar. */ 3157 /* Delete from MAPS each element that is for the menu bar. */
3158 for (list = maps; !NILP (list); list = XCDR (list)) 3158 for (list = maps; CONSP (list); list = XCDR (list))
3159 { 3159 {
3160 Lisp_Object elt, prefix, tem; 3160 Lisp_Object elt, prefix, tem;
3161 3161
3162 elt = Fcar (list); 3162 elt = XCAR (list);
3163 prefix = Fcar (elt); 3163 prefix = Fcar (elt);
3164 if (XVECTOR (prefix)->size >= 1) 3164 if (XVECTOR (prefix)->size >= 1)
3165 { 3165 {
@@ -3186,11 +3186,11 @@ key binding\n\
3186 something = 1; 3186 something = 1;
3187 } 3187 }
3188 3188
3189 for (; !NILP (maps); maps = Fcdr (maps)) 3189 for (; CONSP (maps); maps = XCDR (maps))
3190 { 3190 {
3191 register Lisp_Object elt, prefix, tail; 3191 register Lisp_Object elt, prefix, tail;
3192 3192
3193 elt = Fcar (maps); 3193 elt = XCAR (maps);
3194 prefix = Fcar (elt); 3194 prefix = Fcar (elt);
3195 3195
3196 sub_shadows = Qnil; 3196 sub_shadows = Qnil;
diff --git a/src/lisp.h b/src/lisp.h
index 231cfcc7379..9ce5b3429e7 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -214,7 +214,6 @@ enum Lisp_Misc_Type
214 Lisp_Misc_Objfwd, 214 Lisp_Misc_Objfwd,
215 Lisp_Misc_Buffer_Objfwd, 215 Lisp_Misc_Buffer_Objfwd,
216 Lisp_Misc_Buffer_Local_Value, 216 Lisp_Misc_Buffer_Local_Value,
217 Lisp_Misc_Some_Buffer_Local_Value,
218 Lisp_Misc_Overlay, 217 Lisp_Misc_Overlay,
219 Lisp_Misc_Kboard_Objfwd, 218 Lisp_Misc_Kboard_Objfwd,
220 Lisp_Misc_Save_Value, 219 Lisp_Misc_Save_Value,
@@ -512,16 +511,20 @@ extern size_t pure_size;
512/* Misc types. */ 511/* Misc types. */
513 512
514#define XMISC(a) ((union Lisp_Misc *) XPNTR(a)) 513#define XMISC(a) ((union Lisp_Misc *) XPNTR(a))
515#define XMISCTYPE(a) (XMARKER (a)->type) 514#define XMISCANY(a) (eassert (MISCP (a)), &(XMISC(a)->u_any))
516#define XMARKER(a) (&(XMISC(a)->u_marker)) 515#define XMISCTYPE(a) (XMISCANY (a)->type)
517#define XINTFWD(a) (&(XMISC(a)->u_intfwd)) 516#define XMARKER(a) (eassert (MARKERP (a)), &(XMISC(a)->u_marker))
518#define XBOOLFWD(a) (&(XMISC(a)->u_boolfwd)) 517#define XINTFWD(a) (eassert (INTFWDP (a)), &(XMISC(a)->u_intfwd))
519#define XOBJFWD(a) (&(XMISC(a)->u_objfwd)) 518#define XBOOLFWD(a) (eassert (BOOLFWDP (a)), &(XMISC(a)->u_boolfwd))
520#define XBUFFER_OBJFWD(a) (&(XMISC(a)->u_buffer_objfwd)) 519#define XOBJFWD(a) (eassert (OBJFWDP (a)), &(XMISC(a)->u_objfwd))
521#define XBUFFER_LOCAL_VALUE(a) (&(XMISC(a)->u_buffer_local_value)) 520#define XOVERLAY(a) (eassert (OVERLAYP (a)), &(XMISC(a)->u_overlay))
522#define XOVERLAY(a) (&(XMISC(a)->u_overlay)) 521#define XSAVE_VALUE(a) (eassert (SAVE_VALUEP (a)), &(XMISC(a)->u_save_value))
523#define XKBOARD_OBJFWD(a) (&(XMISC(a)->u_kboard_objfwd)) 522#define XBUFFER_OBJFWD(a) \
524#define XSAVE_VALUE(a) (&(XMISC(a)->u_save_value)) 523 (eassert (BUFFER_OBJFWDP (a)), &(XMISC(a)->u_buffer_objfwd))
524#define XBUFFER_LOCAL_VALUE(a) \
525 (eassert (BUFFER_LOCAL_VALUEP (a)), &(XMISC(a)->u_buffer_local_value))
526#define XKBOARD_OBJFWD(a) \
527 (eassert (KBOARD_OBJFWDP (a)), &(XMISC(a)->u_kboard_objfwd))
525 528
526/* Pseudovector types. */ 529/* Pseudovector types. */
527 530
@@ -1108,6 +1111,13 @@ struct Lisp_Hash_Table
1108 1111
1109/* These structures are used for various misc types. */ 1112/* These structures are used for various misc types. */
1110 1113
1114struct Lisp_Misc_Any /* Supertype of all Misc types. */
1115{
1116 int type : 16; /* = Lisp_Misc_Marker */
1117 unsigned gcmarkbit : 1;
1118 int spacer : 15;
1119};
1120
1111struct Lisp_Marker 1121struct Lisp_Marker
1112{ 1122{
1113 int type : 16; /* = Lisp_Misc_Marker */ 1123 int type : 16; /* = Lisp_Misc_Marker */
@@ -1208,19 +1218,19 @@ struct Lisp_Buffer_Objfwd
1208 binding into `realvalue' (or through it). Also update 1218 binding into `realvalue' (or through it). Also update
1209 LOADED-BINDING to point to the newly loaded binding. 1219 LOADED-BINDING to point to the newly loaded binding.
1210 1220
1211 Lisp_Misc_Buffer_Local_Value and Lisp_Misc_Some_Buffer_Local_Value 1221 `local_if_set' indicates that merely setting the variable creates a local
1212 both use this kind of structure. With the former, merely setting 1222 binding for the current buffer. Otherwise the latter, setting the
1213 the variable creates a local binding for the current buffer. With 1223 variable does not do that; only make-local-variable does that. */
1214 the latter, setting the variable does not do that; only
1215 make-local-variable does that. */
1216 1224
1217struct Lisp_Buffer_Local_Value 1225struct Lisp_Buffer_Local_Value
1218 { 1226 {
1219 int type : 16; /* = Lisp_Misc_Buffer_Local_Value 1227 int type : 16; /* = Lisp_Misc_Buffer_Local_Value */
1220 or Lisp_Misc_Some_Buffer_Local_Value */
1221 unsigned gcmarkbit : 1; 1228 unsigned gcmarkbit : 1;
1222 int spacer : 12; 1229 int spacer : 11;
1223 1230
1231 /* 1 means that merely setting the variable creates a local
1232 binding for the current buffer */
1233 unsigned int local_if_set : 1;
1224 /* 1 means this variable is allowed to have frame-local bindings, 1234 /* 1 means this variable is allowed to have frame-local bindings,
1225 so check for them when looking for the proper binding. */ 1235 so check for them when looking for the proper binding. */
1226 unsigned int check_frame : 1; 1236 unsigned int check_frame : 1;
@@ -1310,7 +1320,8 @@ struct Lisp_Free
1310 1320
1311union Lisp_Misc 1321union Lisp_Misc
1312 { 1322 {
1313 struct Lisp_Free u_free; 1323 struct Lisp_Misc_Any u_any; /* Supertype of all Misc types. */
1324 struct Lisp_Free u_free; /* Includes padding to force alignment. */
1314 struct Lisp_Marker u_marker; 1325 struct Lisp_Marker u_marker;
1315 struct Lisp_Intfwd u_intfwd; 1326 struct Lisp_Intfwd u_intfwd;
1316 struct Lisp_Boolfwd u_boolfwd; 1327 struct Lisp_Boolfwd u_boolfwd;
@@ -1452,8 +1463,17 @@ typedef unsigned char UCHAR;
1452#define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd) 1463#define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
1453#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd) 1464#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
1454#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value) 1465#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
1466<<<<<<< TREE
1455#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value) 1467#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
1468=======
1469#define GC_BUFFER_LOCAL_VALUEP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
1470>>>>>>> MERGE-SOURCE
1456#define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd) 1471#define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
1472<<<<<<< TREE
1473=======
1474#define GC_KBOARD_OBJFWDP(x) (GC_MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
1475#define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value)
1476>>>>>>> MERGE-SOURCE
1457 1477
1458 1478
1459/* True if object X is a pseudovector whose code is CODE. */ 1479/* True if object X is a pseudovector whose code is CODE. */
diff --git a/src/lread.c b/src/lread.c
index 1bcad4672f0..a75e615acda 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1299,7 +1299,7 @@ close_load_descs ()
1299{ 1299{
1300#ifndef WINDOWSNT 1300#ifndef WINDOWSNT
1301 Lisp_Object tail; 1301 Lisp_Object tail;
1302 for (tail = load_descriptor_list; !NILP (tail); tail = XCDR (tail)) 1302 for (tail = load_descriptor_list; CONSP (tail); tail = XCDR (tail))
1303 emacs_close (XFASTINT (XCAR (tail))); 1303 emacs_close (XFASTINT (XCAR (tail)));
1304#endif 1304#endif
1305} 1305}
diff --git a/src/macfns.c b/src/macfns.c
index 9a9eb69fa63..708fe576f17 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -2826,7 +2826,7 @@ This function is an internal primitive--use `make-frame' instead. */)
2826 2826
2827 /* All remaining specified parameters, which have not been "used" 2827 /* All remaining specified parameters, which have not been "used"
2828 by x_get_arg and friends, now go in the misc. alist of the frame. */ 2828 by x_get_arg and friends, now go in the misc. alist of the frame. */
2829 for (tem = parameters; !NILP (tem); tem = XCDR (tem)) 2829 for (tem = parameters; CONSP (tem); tem = XCDR (tem))
2830 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 2830 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
2831 f->param_alist = Fcons (XCAR (tem), f->param_alist); 2831 f->param_alist = Fcons (XCAR (tem), f->param_alist);
2832 2832
@@ -3402,7 +3402,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
3402 Lisp_Object tail, result; 3402 Lisp_Object tail, result;
3403 3403
3404 result = Qnil; 3404 result = Qnil;
3405 for (tail = x_display_name_list; ! NILP (tail); tail = XCDR (tail)) 3405 for (tail = x_display_name_list; CONSP (tail); tail = XCDR (tail))
3406 result = Fcons (XCAR (XCAR (tail)), result); 3406 result = Fcons (XCAR (XCAR (tail)), result);
3407 3407
3408 return result; 3408 return result;
diff --git a/src/macselect.c b/src/macselect.c
index 9515a5774ec..f8038effd8b 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -487,7 +487,7 @@ x_own_selection (selection_name, selection_value)
487 if (!NILP (prev_value)) 487 if (!NILP (prev_value))
488 { 488 {
489 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ 489 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */
490 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 490 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest))
491 if (EQ (prev_value, Fcar (XCDR (rest)))) 491 if (EQ (prev_value, Fcar (XCDR (rest))))
492 { 492 {
493 XSETCDR (rest, Fcdr (XCDR (rest))); 493 XSETCDR (rest, Fcdr (XCDR (rest)));
@@ -619,7 +619,7 @@ x_clear_frame_selections (f)
619 } 619 }
620 620
621 /* Delete elements after the beginning of Vselection_alist. */ 621 /* Delete elements after the beginning of Vselection_alist. */
622 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 622 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest))
623 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest)))))))) 623 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest))))))))
624 { 624 {
625 /* Let random Lisp code notice that the selection has been stolen. */ 625 /* Let random Lisp code notice that the selection has been stolen. */
@@ -762,7 +762,7 @@ Disowning it means there is no such selection. */)
762 else 762 else
763 { 763 {
764 Lisp_Object rest; 764 Lisp_Object rest;
765 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 765 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest))
766 if (EQ (local_selection_data, Fcar (XCDR (rest)))) 766 if (EQ (local_selection_data, Fcar (XCDR (rest))))
767 { 767 {
768 XSETCDR (rest, Fcdr (XCDR (rest))); 768 XSETCDR (rest, Fcdr (XCDR (rest)));
diff --git a/src/macterm.c b/src/macterm.c
index a15f0b0fcfc..3c01a6618a2 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -8300,7 +8300,7 @@ init_font_name_table ()
8300 Lisp_Object rest = XCDR (XCDR (text_encoding_info)); 8300 Lisp_Object rest = XCDR (XCDR (text_encoding_info));
8301 8301
8302 if (size > 0 || style == normal) 8302 if (size > 0 || style == normal)
8303 for (; !NILP (rest); rest = XCDR (rest)) 8303 for (; CONSP (rest); rest = XCDR (rest))
8304 add_mac_font_name (name, size, style, SDATA (XCAR (rest))); 8304 add_mac_font_name (name, size, style, SDATA (XCAR (rest)));
8305 } 8305 }
8306 } 8306 }
@@ -8375,7 +8375,7 @@ init_font_name_table ()
8375 { 8375 {
8376 Lisp_Object rest = XCDR (XCDR (text_encoding_info)); 8376 Lisp_Object rest = XCDR (XCDR (text_encoding_info));
8377 8377
8378 for (; !NILP (rest); rest = XCDR (rest)) 8378 for (; CONSP (rest); rest = XCDR (rest))
8379 add_mac_font_name (name, assc_entry->fontSize, 8379 add_mac_font_name (name, assc_entry->fontSize,
8380 assc_entry->fontStyle, 8380 assc_entry->fontStyle,
8381 SDATA (XCAR (rest))); 8381 SDATA (XCAR (rest)));
diff --git a/src/minibuf.c b/src/minibuf.c
index 39d2f8e17be..340f6dae319 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -118,6 +118,7 @@ Lisp_Object Vread_buffer_function;
118/* Nonzero means completion ignores case. */ 118/* Nonzero means completion ignores case. */
119 119
120int completion_ignore_case; 120int completion_ignore_case;
121Lisp_Object Qcompletion_ignore_case;
121 122
122/* List of regexps that should restrict possible completions. */ 123/* List of regexps that should restrict possible completions. */
123 124
@@ -2109,10 +2110,10 @@ string rather than a cons cell whose car is a string. */)
2109 if (SYMBOLP (key)) 2110 if (SYMBOLP (key))
2110 key = Fsymbol_name (key); 2111 key = Fsymbol_name (key);
2111 2112
2112 for (tail = list; !NILP (tail); tail = Fcdr (tail)) 2113 for (tail = list; CONSP (tail); tail = XCDR (tail))
2113 { 2114 {
2114 register Lisp_Object elt, tem, thiscar; 2115 register Lisp_Object elt, tem, thiscar;
2115 elt = Fcar (tail); 2116 elt = XCAR (tail);
2116 thiscar = CONSP (elt) ? XCAR (elt) : elt; 2117 thiscar = CONSP (elt) ? XCAR (elt) : elt;
2117 if (SYMBOLP (thiscar)) 2118 if (SYMBOLP (thiscar))
2118 thiscar = Fsymbol_name (thiscar); 2119 thiscar = Fsymbol_name (thiscar);
@@ -2822,6 +2823,9 @@ syms_of_minibuf ()
2822 minibuf_save_list = Qnil; 2823 minibuf_save_list = Qnil;
2823 staticpro (&minibuf_save_list); 2824 staticpro (&minibuf_save_list);
2824 2825
2826 Qcompletion_ignore_case = intern ("completion-ignore-case");
2827 staticpro (&Qcompletion_ignore_case);
2828
2825 Qread_file_name_internal = intern ("read-file-name-internal"); 2829 Qread_file_name_internal = intern ("read-file-name-internal");
2826 staticpro (&Qread_file_name_internal); 2830 staticpro (&Qread_file_name_internal);
2827 2831
diff --git a/src/print.c b/src/print.c
index edd22abc038..c23e020eb8d 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2243,10 +2243,8 @@ print_object (obj, printcharfun, escapeflag)
2243 2243
2244 case Lisp_Misc_Buffer_Local_Value: 2244 case Lisp_Misc_Buffer_Local_Value:
2245 strout ("#<buffer_local_value ", -1, -1, printcharfun, 0); 2245 strout ("#<buffer_local_value ", -1, -1, printcharfun, 0);
2246 goto do_buffer_local; 2246 if (XBUFFER_LOCAL_VALUE (obj)->local_if_set)
2247 case Lisp_Misc_Some_Buffer_Local_Value: 2247 strout ("[local-if-set] ", -1, -1, printcharfun, 0);
2248 strout ("#<some_buffer_local_value ", -1, -1, printcharfun, 0);
2249 do_buffer_local:
2250 strout ("[realvalue] ", -1, -1, printcharfun, 0); 2248 strout ("[realvalue] ", -1, -1, printcharfun, 0);
2251 print_object (XBUFFER_LOCAL_VALUE (obj)->realvalue, 2249 print_object (XBUFFER_LOCAL_VALUE (obj)->realvalue,
2252 printcharfun, escapeflag); 2250 printcharfun, escapeflag);
diff --git a/src/process.c b/src/process.c
index d94e6d13866..6bcaef63303 100644
--- a/src/process.c
+++ b/src/process.c
@@ -121,6 +121,12 @@ Boston, MA 02110-1301, USA. */
121#include <sys/wait.h> 121#include <sys/wait.h>
122#endif 122#endif
123 123
124#ifdef HAVE_RES_INIT
125#include <netinet/in.h>
126#include <arpa/nameser.h>
127#include <resolv.h>
128#endif
129
124#include "lisp.h" 130#include "lisp.h"
125#include "systime.h" 131#include "systime.h"
126#include "systty.h" 132#include "systty.h"
@@ -732,9 +738,9 @@ BUFFER may be a buffer or the name of one. */)
732 buf = Fget_buffer (buffer); 738 buf = Fget_buffer (buffer);
733 if (NILP (buf)) return Qnil; 739 if (NILP (buf)) return Qnil;
734 740
735 for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) 741 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
736 { 742 {
737 proc = Fcdr (Fcar (tail)); 743 proc = Fcdr (XCAR (tail));
738 if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf)) 744 if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
739 return proc; 745 return proc;
740 } 746 }
@@ -1338,11 +1344,11 @@ list_processes_1 (query_only)
1338 w_buffer = 6; /* Buffer */ 1344 w_buffer = 6; /* Buffer */
1339 w_tty = 0; /* Omit if no ttys */ 1345 w_tty = 0; /* Omit if no ttys */
1340 1346
1341 for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) 1347 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
1342 { 1348 {
1343 int i; 1349 int i;
1344 1350
1345 proc = Fcdr (Fcar (tail)); 1351 proc = Fcdr (XCAR (tail));
1346 p = XPROCESS (proc); 1352 p = XPROCESS (proc);
1347 if (NILP (p->childp)) 1353 if (NILP (p->childp))
1348 continue; 1354 continue;
@@ -1401,11 +1407,11 @@ list_processes_1 (query_only)
1401 Findent_to (i_command, minspace); write_string ("-------", -1); 1407 Findent_to (i_command, minspace); write_string ("-------", -1);
1402 write_string ("\n", -1); 1408 write_string ("\n", -1);
1403 1409
1404 for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) 1410 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
1405 { 1411 {
1406 Lisp_Object symbol; 1412 Lisp_Object symbol;
1407 1413
1408 proc = Fcdr (Fcar (tail)); 1414 proc = Fcdr (XCAR (tail));
1409 p = XPROCESS (proc); 1415 p = XPROCESS (proc);
1410 if (NILP (p->childp)) 1416 if (NILP (p->childp))
1411 continue; 1417 continue;
@@ -3082,6 +3088,11 @@ usage: (make-network-process &rest ARGS) */)
3082 hints.ai_family = family; 3088 hints.ai_family = family;
3083 hints.ai_socktype = socktype; 3089 hints.ai_socktype = socktype;
3084 hints.ai_protocol = 0; 3090 hints.ai_protocol = 0;
3091
3092#ifdef HAVE_RES_INIT
3093 res_init ();
3094#endif
3095
3085 ret = getaddrinfo (SDATA (host), portstring, &hints, &res); 3096 ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
3086 if (ret) 3097 if (ret)
3087#ifdef HAVE_GAI_STRERROR 3098#ifdef HAVE_GAI_STRERROR
@@ -3127,6 +3138,11 @@ usage: (make-network-process &rest ARGS) */)
3127 as it may `hang' Emacs for a very long time. */ 3138 as it may `hang' Emacs for a very long time. */
3128 immediate_quit = 1; 3139 immediate_quit = 1;
3129 QUIT; 3140 QUIT;
3141
3142#ifdef HAVE_RES_INIT
3143 res_init ();
3144#endif
3145
3130 host_info_ptr = gethostbyname (SDATA (host)); 3146 host_info_ptr = gethostbyname (SDATA (host));
3131 immediate_quit = 0; 3147 immediate_quit = 0;
3132 3148
@@ -6689,12 +6705,12 @@ status_notify (deleting_process)
6689 that we run, we get called again to handle their status changes. */ 6705 that we run, we get called again to handle their status changes. */
6690 update_tick = process_tick; 6706 update_tick = process_tick;
6691 6707
6692 for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail)) 6708 for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
6693 { 6709 {
6694 Lisp_Object symbol; 6710 Lisp_Object symbol;
6695 register struct Lisp_Process *p; 6711 register struct Lisp_Process *p;
6696 6712
6697 proc = Fcdr (Fcar (tail)); 6713 proc = Fcdr (XCAR (tail));
6698 p = XPROCESS (proc); 6714 p = XPROCESS (proc);
6699 6715
6700 if (p->tick != p->update_tick) 6716 if (p->tick != p->update_tick)
diff --git a/src/textprop.c b/src/textprop.c
index 8ce5656e5a2..e8ba1d87afc 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -201,9 +201,9 @@ validate_plist (list)
201 { 201 {
202 register int i; 202 register int i;
203 register Lisp_Object tail; 203 register Lisp_Object tail;
204 for (i = 0, tail = list; !NILP (tail); i++) 204 for (i = 0, tail = list; CONSP (tail); i++)
205 { 205 {
206 tail = Fcdr (tail); 206 tail = XCDR (tail);
207 QUIT; 207 QUIT;
208 } 208 }
209 if (i & 1) 209 if (i & 1)
@@ -226,18 +226,18 @@ interval_has_all_properties (plist, i)
226 register int found; 226 register int found;
227 227
228 /* Go through each element of PLIST. */ 228 /* Go through each element of PLIST. */
229 for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1))) 229 for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1)))
230 { 230 {
231 sym1 = Fcar (tail1); 231 sym1 = XCAR (tail1);
232 found = 0; 232 found = 0;
233 233
234 /* Go through I's plist, looking for sym1 */ 234 /* Go through I's plist, looking for sym1 */
235 for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2))) 235 for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2)))
236 if (EQ (sym1, Fcar (tail2))) 236 if (EQ (sym1, XCAR (tail2)))
237 { 237 {
238 /* Found the same property on both lists. If the 238 /* Found the same property on both lists. If the
239 values are unequal, return zero. */ 239 values are unequal, return zero. */
240 if (! EQ (Fcar (Fcdr (tail1)), Fcar (Fcdr (tail2)))) 240 if (! EQ (Fcar (XCDR (tail1)), Fcar (XCDR (tail2))))
241 return 0; 241 return 0;
242 242
243 /* Property has same value on both lists; go to next one. */ 243 /* Property has same value on both lists; go to next one. */
@@ -263,13 +263,13 @@ interval_has_some_properties (plist, i)
263 register Lisp_Object tail1, tail2, sym; 263 register Lisp_Object tail1, tail2, sym;
264 264
265 /* Go through each element of PLIST. */ 265 /* Go through each element of PLIST. */
266 for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1))) 266 for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1)))
267 { 267 {
268 sym = Fcar (tail1); 268 sym = XCAR (tail1);
269 269
270 /* Go through i's plist, looking for tail1 */ 270 /* Go through i's plist, looking for tail1 */
271 for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2))) 271 for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2)))
272 if (EQ (sym, Fcar (tail2))) 272 if (EQ (sym, XCAR (tail2)))
273 return 1; 273 return 1;
274 } 274 }
275 275
@@ -287,12 +287,12 @@ interval_has_some_properties_list (list, i)
287 register Lisp_Object tail1, tail2, sym; 287 register Lisp_Object tail1, tail2, sym;
288 288
289 /* Go through each element of LIST. */ 289 /* Go through each element of LIST. */
290 for (tail1 = list; ! NILP (tail1); tail1 = XCDR (tail1)) 290 for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1))
291 { 291 {
292 sym = Fcar (tail1); 292 sym = Fcar (tail1);
293 293
294 /* Go through i's plist, looking for tail1 */ 294 /* Go through i's plist, looking for tail1 */
295 for (tail2 = i->plist; ! NILP (tail2); tail2 = XCDR (XCDR (tail2))) 295 for (tail2 = i->plist; CONSP (tail2); tail2 = XCDR (XCDR (tail2)))
296 if (EQ (sym, XCAR (tail2))) 296 if (EQ (sym, XCAR (tail2)))
297 return 1; 297 return 1;
298 } 298 }
@@ -391,21 +391,21 @@ add_properties (plist, i, object)
391 GCPRO3 (tail1, sym1, val1); 391 GCPRO3 (tail1, sym1, val1);
392 392
393 /* Go through each element of PLIST. */ 393 /* Go through each element of PLIST. */
394 for (tail1 = plist; ! NILP (tail1); tail1 = Fcdr (Fcdr (tail1))) 394 for (tail1 = plist; CONSP (tail1); tail1 = Fcdr (XCDR (tail1)))
395 { 395 {
396 sym1 = Fcar (tail1); 396 sym1 = XCAR (tail1);
397 val1 = Fcar (Fcdr (tail1)); 397 val1 = Fcar (XCDR (tail1));
398 found = 0; 398 found = 0;
399 399
400 /* Go through I's plist, looking for sym1 */ 400 /* Go through I's plist, looking for sym1 */
401 for (tail2 = i->plist; ! NILP (tail2); tail2 = Fcdr (Fcdr (tail2))) 401 for (tail2 = i->plist; CONSP (tail2); tail2 = Fcdr (XCDR (tail2)))
402 if (EQ (sym1, Fcar (tail2))) 402 if (EQ (sym1, XCAR (tail2)))
403 { 403 {
404 /* No need to gcpro, because tail2 protects this 404 /* No need to gcpro, because tail2 protects this
405 and it must be a cons cell (we get an error otherwise). */ 405 and it must be a cons cell (we get an error otherwise). */
406 register Lisp_Object this_cdr; 406 register Lisp_Object this_cdr;
407 407
408 this_cdr = Fcdr (tail2); 408 this_cdr = XCDR (tail2);
409 /* Found the property. Now check its value. */ 409 /* Found the property. Now check its value. */
410 found = 1; 410 found = 1;
411 411
@@ -1965,10 +1965,10 @@ text_property_list (object, start, end, prop)
1965 plist = i->plist; 1965 plist = i->plist;
1966 1966
1967 if (!NILP (prop)) 1967 if (!NILP (prop))
1968 for (; !NILP (plist); plist = Fcdr (Fcdr (plist))) 1968 for (; CONSP (plist); plist = Fcdr (XCDR (plist)))
1969 if (EQ (Fcar (plist), prop)) 1969 if (EQ (XCAR (plist), prop))
1970 { 1970 {
1971 plist = Fcons (prop, Fcons (Fcar (Fcdr (plist)), Qnil)); 1971 plist = Fcons (prop, Fcons (Fcar (XCDR (plist)), Qnil));
1972 break; 1972 break;
1973 } 1973 }
1974 1974
diff --git a/src/w32fns.c b/src/w32fns.c
index 74b2a0ed655..de5b6db3d77 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -850,11 +850,11 @@ w32_color_map_lookup (colorname)
850 850
851 BLOCK_INPUT; 851 BLOCK_INPUT;
852 852
853 for (tail = Vw32_color_map; !NILP (tail); tail = Fcdr (tail)) 853 for (tail = Vw32_color_map; CONSP (tail); tail = XCDR (tail))
854 { 854 {
855 register Lisp_Object elt, tem; 855 register Lisp_Object elt, tem;
856 856
857 elt = Fcar (tail); 857 elt = XCAR (tail);
858 if (!CONSP (elt)) continue; 858 if (!CONSP (elt)) continue;
859 859
860 tem = Fcar (elt); 860 tem = Fcar (elt);
@@ -4506,7 +4506,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4506 4506
4507 /* All remaining specified parameters, which have not been "used" 4507 /* All remaining specified parameters, which have not been "used"
4508 by x_get_arg and friends, now go in the misc. alist of the frame. */ 4508 by x_get_arg and friends, now go in the misc. alist of the frame. */
4509 for (tem = parameters; !NILP (tem); tem = XCDR (tem)) 4509 for (tem = parameters; CONSP (tem); tem = XCDR (tem))
4510 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 4510 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
4511 f->param_alist = Fcons (XCAR (tem), f->param_alist); 4511 f->param_alist = Fcons (XCAR (tem), f->param_alist);
4512 4512
@@ -6958,7 +6958,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
6958 Lisp_Object tail, result; 6958 Lisp_Object tail, result;
6959 6959
6960 result = Qnil; 6960 result = Qnil;
6961 for (tail = w32_display_name_list; ! NILP (tail); tail = XCDR (tail)) 6961 for (tail = w32_display_name_list; CONSP (tail); tail = XCDR (tail))
6962 result = Fcons (XCAR (XCAR (tail)), result); 6962 result = Fcons (XCAR (XCAR (tail)), result);
6963 6963
6964 return result; 6964 return result;
diff --git a/src/w32menu.c b/src/w32menu.c
index 986832b3e7c..c570385c3bb 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -568,10 +568,10 @@ list_of_panes (menu)
568 568
569 init_menu_items (); 569 init_menu_items ();
570 570
571 for (tail = menu; !NILP (tail); tail = Fcdr (tail)) 571 for (tail = menu; CONSP (tail); tail = XCDR (tail))
572 { 572 {
573 Lisp_Object elt, pane_name, pane_data; 573 Lisp_Object elt, pane_name, pane_data;
574 elt = Fcar (tail); 574 elt = XCAR (tail);
575 pane_name = Fcar (elt); 575 pane_name = Fcar (elt);
576 CHECK_STRING (pane_name); 576 CHECK_STRING (pane_name);
577 push_menu_pane (pane_name, Qnil); 577 push_menu_pane (pane_name, Qnil);
@@ -591,9 +591,9 @@ list_of_items (pane)
591{ 591{
592 Lisp_Object tail, item, item1; 592 Lisp_Object tail, item, item1;
593 593
594 for (tail = pane; !NILP (tail); tail = Fcdr (tail)) 594 for (tail = pane; CONSP (tail); tail = XCDR (tail))
595 { 595 {
596 item = Fcar (tail); 596 item = XCAR (tail);
597 if (STRINGP (item)) 597 if (STRINGP (item))
598 push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil, Qnil); 598 push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil, Qnil);
599 else if (NILP (item)) 599 else if (NILP (item))
diff --git a/src/window.c b/src/window.c
index 2fd4d286eba..766c291820f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2670,12 +2670,12 @@ window_fixed_size_p (w, width_p, check_siblings_p)
2670 { 2670 {
2671 Lisp_Object child; 2671 Lisp_Object child;
2672 2672
2673 for (child = w->prev; !NILP (child); child = XWINDOW (child)->prev) 2673 for (child = w->prev; WINDOWP (child); child = XWINDOW (child)->prev)
2674 if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) 2674 if (!window_fixed_size_p (XWINDOW (child), width_p, 0))
2675 break; 2675 break;
2676 2676
2677 if (NILP (child)) 2677 if (NILP (child))
2678 for (child = w->next; !NILP (child); child = XWINDOW (child)->next) 2678 for (child = w->next; WINDOWP (child); child = XWINDOW (child)->next)
2679 if (!window_fixed_size_p (XWINDOW (child), width_p, 0)) 2679 if (!window_fixed_size_p (XWINDOW (child), width_p, 0))
2680 break; 2680 break;
2681 2681
@@ -4291,10 +4291,10 @@ enlarge_window (window, delta, horiz_flag)
4291 4291
4292 /* Find the total we can get from other siblings without deleting them. */ 4292 /* Find the total we can get from other siblings without deleting them. */
4293 maximum = 0; 4293 maximum = 0;
4294 for (next = p->next; ! NILP (next); next = XWINDOW (next)->next) 4294 for (next = p->next; WINDOWP (next); next = XWINDOW (next)->next)
4295 maximum += (*sizefun) (next) - window_min_size (XWINDOW (next), 4295 maximum += (*sizefun) (next) - window_min_size (XWINDOW (next),
4296 horiz_flag, 0, 0); 4296 horiz_flag, 0, 0);
4297 for (prev = p->prev; ! NILP (prev); prev = XWINDOW (prev)->prev) 4297 for (prev = p->prev; WINDOWP (prev); prev = XWINDOW (prev)->prev)
4298 maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev), 4298 maximum += (*sizefun) (prev) - window_min_size (XWINDOW (prev),
4299 horiz_flag, 0, 0); 4299 horiz_flag, 0, 0);
4300 4300
@@ -4442,10 +4442,10 @@ enlarge_window (window, delta, horiz_flag)
4442 Lisp_Object s; 4442 Lisp_Object s;
4443 int n = 1; 4443 int n = 1;
4444 4444
4445 for (s = w->next; !NILP (s); s = XWINDOW (s)->next) 4445 for (s = w->next; WINDOWP (s); s = XWINDOW (s)->next)
4446 if (!window_fixed_size_p (XWINDOW (s), horiz_flag, 0)) 4446 if (!window_fixed_size_p (XWINDOW (s), horiz_flag, 0))
4447 ++n; 4447 ++n;
4448 for (s = w->prev; !NILP (s); s = XWINDOW (s)->prev) 4448 for (s = w->prev; WINDOWP (s); s = XWINDOW (s)->prev)
4449 if (!window_fixed_size_p (XWINDOW (s), horiz_flag, 0)) 4449 if (!window_fixed_size_p (XWINDOW (s), horiz_flag, 0))
4450 ++n; 4450 ++n;
4451 4451
@@ -4701,7 +4701,7 @@ shrink_window_lowest_first (w, height)
4701 /* Find the last child. We are taking space from lowest windows 4701 /* Find the last child. We are taking space from lowest windows
4702 first, so we iterate over children from the last child 4702 first, so we iterate over children from the last child
4703 backwards. */ 4703 backwards. */
4704 for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next) 4704 for (child = w->vchild; WINDOWP (child); child = XWINDOW (child)->next)
4705 last_child = child; 4705 last_child = child;
4706 4706
4707 /* Assign new heights. We leave only MIN_SAFE_WINDOW_HEIGHT. */ 4707 /* Assign new heights. We leave only MIN_SAFE_WINDOW_HEIGHT. */
diff --git a/src/xdisp.c b/src/xdisp.c
index fef50689ab5..a83ee8983dc 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -3844,7 +3844,13 @@ handle_display_prop (it)
3844 { 3844 {
3845 if (handle_single_display_spec (it, XCAR (prop), object, 3845 if (handle_single_display_spec (it, XCAR (prop), object,
3846 position, display_replaced_p)) 3846 position, display_replaced_p))
3847 display_replaced_p = 1; 3847 {
3848 display_replaced_p = 1;
3849 /* If some text in a string is replaced, `position' no
3850 longer points to the position of `object'. */
3851 if (STRINGP (object))
3852 break;
3853 }
3848 } 3854 }
3849 } 3855 }
3850 else if (VECTORP (prop)) 3856 else if (VECTORP (prop))
@@ -3853,7 +3859,13 @@ handle_display_prop (it)
3853 for (i = 0; i < ASIZE (prop); ++i) 3859 for (i = 0; i < ASIZE (prop); ++i)
3854 if (handle_single_display_spec (it, AREF (prop, i), object, 3860 if (handle_single_display_spec (it, AREF (prop, i), object,
3855 position, display_replaced_p)) 3861 position, display_replaced_p))
3856 display_replaced_p = 1; 3862 {
3863 display_replaced_p = 1;
3864 /* If some text in a string is replaced, `position' no
3865 longer points to the position of `object'. */
3866 if (STRINGP (object))
3867 break;
3868 }
3857 } 3869 }
3858 else 3870 else
3859 { 3871 {
@@ -4242,13 +4254,16 @@ handle_single_display_spec (it, spec, object, position,
4242 /* Say that we haven't consumed the characters with 4254 /* Say that we haven't consumed the characters with
4243 `display' property yet. The call to pop_it in 4255 `display' property yet. The call to pop_it in
4244 set_iterator_to_next will clean this up. */ 4256 set_iterator_to_next will clean this up. */
4245 *position = start_pos; 4257 if (BUFFERP (object))
4258 it->current.pos = start_pos;
4246 } 4259 }
4247 else if (CONSP (value) && EQ (XCAR (value), Qspace)) 4260 else if (CONSP (value) && EQ (XCAR (value), Qspace))
4248 { 4261 {
4249 it->method = GET_FROM_STRETCH; 4262 it->method = GET_FROM_STRETCH;
4250 it->object = value; 4263 it->object = value;
4251 *position = it->position = start_pos; 4264 it->position = start_pos;
4265 if (BUFFERP (object))
4266 it->current.pos = start_pos;
4252 } 4267 }
4253#ifdef HAVE_WINDOW_SYSTEM 4268#ifdef HAVE_WINDOW_SYSTEM
4254 else 4269 else
@@ -4262,7 +4277,8 @@ handle_single_display_spec (it, spec, object, position,
4262 /* Say that we haven't consumed the characters with 4277 /* Say that we haven't consumed the characters with
4263 `display' property yet. The call to pop_it in 4278 `display' property yet. The call to pop_it in
4264 set_iterator_to_next will clean this up. */ 4279 set_iterator_to_next will clean this up. */
4265 *position = start_pos; 4280 if (BUFFERP (object))
4281 it->current.pos = start_pos;
4266 } 4282 }
4267#endif /* HAVE_WINDOW_SYSTEM */ 4283#endif /* HAVE_WINDOW_SYSTEM */
4268 4284
@@ -10972,8 +10988,7 @@ select_frame_for_redisplay (frame)
10972 SYMBOLP (sym)) 10988 SYMBOLP (sym))
10973 && (sym = indirect_variable (sym), 10989 && (sym = indirect_variable (sym),
10974 val = SYMBOL_VALUE (sym), 10990 val = SYMBOL_VALUE (sym),
10975 (BUFFER_LOCAL_VALUEP (val) 10991 (BUFFER_LOCAL_VALUEP (val)))
10976 || SOME_BUFFER_LOCAL_VALUEP (val)))
10977 && XBUFFER_LOCAL_VALUE (val)->check_frame) 10992 && XBUFFER_LOCAL_VALUE (val)->check_frame)
10978 /* Use find_symbol_value rather than Fsymbol_value 10993 /* Use find_symbol_value rather than Fsymbol_value
10979 to avoid an error if it is void. */ 10994 to avoid an error if it is void. */
@@ -10985,8 +11000,7 @@ select_frame_for_redisplay (frame)
10985 SYMBOLP (sym)) 11000 SYMBOLP (sym))
10986 && (sym = indirect_variable (sym), 11001 && (sym = indirect_variable (sym),
10987 val = SYMBOL_VALUE (sym), 11002 val = SYMBOL_VALUE (sym),
10988 (BUFFER_LOCAL_VALUEP (val) 11003 (BUFFER_LOCAL_VALUEP (val)))
10989 || SOME_BUFFER_LOCAL_VALUEP (val)))
10990 && XBUFFER_LOCAL_VALUE (val)->check_frame) 11004 && XBUFFER_LOCAL_VALUE (val)->check_frame)
10991 find_symbol_value (sym); 11005 find_symbol_value (sym);
10992} 11006}
diff --git a/src/xfns.c b/src/xfns.c
index 8d21a69461a..fce3316b235 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -3675,7 +3675,7 @@ else
3675 3675
3676 /* All remaining specified parameters, which have not been "used" 3676 /* All remaining specified parameters, which have not been "used"
3677 by x_get_arg and friends, now go in the misc. alist of the frame. */ 3677 by x_get_arg and friends, now go in the misc. alist of the frame. */
3678 for (tem = parms; !NILP (tem); tem = XCDR (tem)) 3678 for (tem = parms; CONSP (tem); tem = XCDR (tem))
3679 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 3679 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
3680 f->param_alist = Fcons (XCAR (tem), f->param_alist); 3680 f->param_alist = Fcons (XCAR (tem), f->param_alist);
3681 3681
@@ -4363,7 +4363,7 @@ DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
4363 Lisp_Object tail, result; 4363 Lisp_Object tail, result;
4364 4364
4365 result = Qnil; 4365 result = Qnil;
4366 for (tail = x_display_name_list; ! NILP (tail); tail = XCDR (tail)) 4366 for (tail = x_display_name_list; CONSP (tail); tail = XCDR (tail))
4367 result = Fcons (XCAR (XCAR (tail)), result); 4367 result = Fcons (XCAR (XCAR (tail)), result);
4368 4368
4369 return result; 4369 return result;
diff --git a/src/xselect.c b/src/xselect.c
index d71ac42aa7c..0db5ef57767 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -442,7 +442,7 @@ x_own_selection (selection_name, selection_value)
442 if (!NILP (prev_value)) 442 if (!NILP (prev_value))
443 { 443 {
444 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */ 444 Lisp_Object rest; /* we know it's not the CAR, so it's easy. */
445 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 445 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest))
446 if (EQ (prev_value, Fcar (XCDR (rest)))) 446 if (EQ (prev_value, Fcar (XCDR (rest))))
447 { 447 {
448 XSETCDR (rest, Fcdr (XCDR (rest))); 448 XSETCDR (rest, Fcdr (XCDR (rest)));
@@ -1072,7 +1072,7 @@ x_handle_selection_clear (event)
1072 else 1072 else
1073 { 1073 {
1074 Lisp_Object rest; 1074 Lisp_Object rest;
1075 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 1075 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest))
1076 if (EQ (local_selection_data, Fcar (XCDR (rest)))) 1076 if (EQ (local_selection_data, Fcar (XCDR (rest))))
1077 { 1077 {
1078 XSETCDR (rest, Fcdr (XCDR (rest))); 1078 XSETCDR (rest, Fcdr (XCDR (rest)));
@@ -1153,7 +1153,7 @@ x_clear_frame_selections (f)
1153 } 1153 }
1154 1154
1155 /* Delete elements after the beginning of Vselection_alist. */ 1155 /* Delete elements after the beginning of Vselection_alist. */
1156 for (rest = Vselection_alist; !NILP (rest); rest = Fcdr (rest)) 1156 for (rest = Vselection_alist; CONSP (rest); rest = XCDR (rest))
1157 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest)))))))) 1157 if (EQ (frame, Fcar (Fcdr (Fcdr (Fcdr (Fcar (XCDR (rest))))))))
1158 { 1158 {
1159 /* Let random Lisp code notice that the selection has been stolen. */ 1159 /* Let random Lisp code notice that the selection has been stolen. */