aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2012-11-18 20:29:54 +0900
committerKenichi Handa2012-11-18 20:29:54 +0900
commite1d276cbf9e18f13101328f56bed1a1c0a66e63a (patch)
treef1fdfc9550866b9e323da072ff2eb38821996246
parent00dc3ead070e2e8017629f4d60d8366ac00c32cb (diff)
parentdfa8939b2827d23e02f3d7f6622e3a619ec6fd90 (diff)
downloademacs-e1d276cbf9e18f13101328f56bed1a1c0a66e63a.tar.gz
emacs-e1d276cbf9e18f13101328f56bed1a1c0a66e63a.zip
merge trunk
-rw-r--r--ChangeLog11
-rw-r--r--admin/CPP-DEFINES4
-rw-r--r--admin/ChangeLog11
-rwxr-xr-xadmin/merge-gnulib2
-rw-r--r--autogen/Makefile.in2
-rw-r--r--autogen/config.in6
-rwxr-xr-xautogen/configure5
-rw-r--r--configure.ac4
-rw-r--r--doc/emacs/ChangeLog9
-rw-r--r--doc/emacs/mark.texi11
-rw-r--r--doc/emacs/trouble.texi35
-rw-r--r--doc/lispref/ChangeLog53
-rw-r--r--doc/lispref/display.texi51
-rw-r--r--doc/lispref/frames.texi15
-rw-r--r--doc/lispref/internals.texi295
-rw-r--r--doc/lispref/keymaps.texi84
-rw-r--r--doc/lispref/loading.texi19
-rw-r--r--doc/lispref/macros.texi4
-rw-r--r--doc/lispref/minibuf.texi25
-rw-r--r--doc/lispref/windows.texi118
-rw-r--r--doc/misc/ChangeLog17
-rw-r--r--doc/misc/calc.texi53
-rw-r--r--doc/misc/cl.texi48
-rw-r--r--doc/misc/erc.texi64
-rw-r--r--etc/NEWS59
-rw-r--r--lib-src/ChangeLog10
-rw-r--r--lib-src/makefile.w32-in6
-rw-r--r--lib-src/movemail.c2
-rw-r--r--lib-src/update-game-score.c2
-rw-r--r--lib/gnulib.mk2
-rw-r--r--lisp/ChangeLog230
-rw-r--r--lisp/arc-mode.el2
-rw-r--r--lisp/calc/calc-forms.el339
-rw-r--r--lisp/calc/calc.el46
-rw-r--r--lisp/cedet/ChangeLog21
-rw-r--r--lisp/cedet/semantic/bovine/c.el6
-rw-r--r--lisp/cedet/semantic/fw.el9
-rw-r--r--lisp/cedet/semantic/lex-spp.el6
-rw-r--r--lisp/cedet/semantic/symref.el2
-rw-r--r--lisp/cedet/semantic/symref/list.el2
-rw-r--r--lisp/cedet/semantic/util.el2
-rw-r--r--lisp/descr-text.el2
-rw-r--r--lisp/dired.el1
-rw-r--r--lisp/dirtrack.el3
-rw-r--r--lisp/emacs-lisp/advice.el21
-rw-r--r--lisp/emacs-lisp/checkdoc.el2
-rw-r--r--lisp/emacs-lisp/cl-lib.el4
-rw-r--r--lisp/emacs-lisp/cl-loaddefs.el12
-rw-r--r--lisp/emacs-lisp/cl-macs.el18
-rw-r--r--lisp/emacs-lisp/eieio-datadebug.el2
-rw-r--r--lisp/emacs-lisp/nadvice.el100
-rw-r--r--lisp/emacs-lisp/syntax.el20
-rw-r--r--lisp/erc/ChangeLog4
-rw-r--r--lisp/erc/erc.el4
-rw-r--r--lisp/eshell/em-cmpl.el11
-rw-r--r--lisp/eshell/em-unix.el3
-rw-r--r--lisp/faces.el58
-rw-r--r--lisp/filecache.el151
-rw-r--r--lisp/generic-x.el3
-rw-r--r--lisp/gnus/ChangeLog14
-rw-r--r--lisp/gnus/gnus-diary.el12
-rw-r--r--lisp/gnus/gnus-logic.el13
-rw-r--r--lisp/gnus/gnus-score.el17
-rw-r--r--lisp/help-mode.el3
-rw-r--r--lisp/ibuffer.el25
-rw-r--r--lisp/image-dired.el2
-rw-r--r--lisp/image.el6
-rw-r--r--lisp/imenu.el4
-rw-r--r--lisp/info.el11
-rw-r--r--lisp/net/tramp-gvfs.el4
-rw-r--r--lisp/play/gamegrid.el2
-rw-r--r--lisp/printing.el6
-rw-r--r--lisp/speedbar.el1
-rw-r--r--lisp/subr.el20
-rw-r--r--lisp/term.el21
-rw-r--r--lisp/term/w32-win.el9
-rw-r--r--lisp/url/url-parse.el2
-rw-r--r--lisp/vc/vc-svn.el2
-rw-r--r--lisp/vcursor.el2
-rw-r--r--lisp/window.el178
-rw-r--r--lisp/woman.el9
-rw-r--r--nt/ChangeLog47
-rw-r--r--nt/config.nt32
-rw-r--r--nt/inc/ms-w32.h8
-rw-r--r--nt/inc/sys/socket.h2
-rw-r--r--nt/inc/sys/wait.h33
-rw-r--r--nt/inc/unistd.h21
-rw-r--r--nt/zipdist.bat11
-rw-r--r--src/ChangeLog148
-rw-r--r--src/callproc.c11
-rw-r--r--src/editfns.c4
-rw-r--r--src/emacs.c4
-rw-r--r--src/eval.c4
-rw-r--r--src/keyboard.c4
-rw-r--r--src/makefile.w32-in12
-rw-r--r--src/nsterm.m36
-rw-r--r--src/process.c114
-rw-r--r--src/sysdep.c33
-rw-r--r--src/term.c39
-rw-r--r--src/unexelf.c2
-rw-r--r--src/w32.c35
-rw-r--r--src/w32proc.c166
-rw-r--r--src/w32select.c2
-rw-r--r--src/w32term.h15
-rw-r--r--src/xfaces.c8
-rw-r--r--test/automated/advice-tests.el7
106 files changed, 2337 insertions, 935 deletions
diff --git a/ChangeLog b/ChangeLog
index f5f649aae6d..05e1a14d55d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
12012-11-17 Paul Eggert <eggert@cs.ucla.edu>
2
3 Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
4 * configure.ac: Do not check for fcntl.h.
5 * lib/gnulib.mk: Regenerate.
6
72012-11-16 Paul Eggert <eggert@cs.ucla.edu>
8
9 Remove no-longer-used pty_max_bytes variable.
10 * configure.ac (fpathconf): Remove unnecessary check.
11
12012-11-14 Paul Eggert <eggert@cs.ucla.edu> 122012-11-14 Paul Eggert <eggert@cs.ucla.edu>
2 13
3 Use faccessat, not access, when checking file permissions (Bug#12632). 14 Use faccessat, not access, when checking file permissions (Bug#12632).
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 0a4c14cb95c..ae8673452a3 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -150,9 +150,7 @@ HAVE_ENDGRENT
150HAVE_ENDPWENT 150HAVE_ENDPWENT
151HAVE_ENVIRON_DECL 151HAVE_ENVIRON_DECL
152HAVE_EUIDACCESS 152HAVE_EUIDACCESS
153HAVE_FCNTL_H
154HAVE_FORK 153HAVE_FORK
155HAVE_FPATHCONF
156HAVE_FREEIFADDRS 154HAVE_FREEIFADDRS
157HAVE_FREETYPE 155HAVE_FREETYPE
158HAVE_FSEEKO 156HAVE_FSEEKO
@@ -420,8 +418,6 @@ NSIG
420NSIG_MINIMUM 418NSIG_MINIMUM
421NULL_DEVICE 419NULL_DEVICE
422ORDINARY_LINK 420ORDINARY_LINK
423O_RDONLY
424O_RDWR
425PAGESIZE 421PAGESIZE
426PREFER_VSUSP 422PREFER_VSUSP
427PTY_ITERATION 423PTY_ITERATION
diff --git a/admin/ChangeLog b/admin/ChangeLog
index fd28bf1228f..3d76f9dd2ba 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,14 @@
12012-11-17 Paul Eggert <eggert@cs.ucla.edu>
2
3 Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
4 * CPP-DEFINES (O_RDONLY, O_RDWR, HAVE_FCNTL_H): Remove.
5 * merge-gnulib (GNULIB_MODULES): Add fcntl-h.
6
72012-11-16 Paul Eggert <eggert@cs.ucla.edu>
8
9 Remove no-longer-used pty_max_bytes variable.
10 * CPP-DEFINES (HAVE_FPATHCONF): Remove.
11
12012-11-14 Paul Eggert <eggert@cs.ucla.edu> 122012-11-14 Paul Eggert <eggert@cs.ucla.edu>
2 13
3 Use faccessat, not access, when checking file permissions (Bug#12632). 14 Use faccessat, not access, when checking file permissions (Bug#12632).
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index f7a675e5101..792818b2efe 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -29,7 +29,7 @@ GNULIB_MODULES='
29 alloca-opt c-ctype c-strcase 29 alloca-opt c-ctype c-strcase
30 careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 30 careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
31 dtoastr dtotimespec dup2 environ execinfo faccessat 31 dtoastr dtotimespec dup2 environ execinfo faccessat
32 filemode getloadavg getopt-gnu gettime gettimeofday 32 fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday
33 ignore-value intprops largefile lstat 33 ignore-value intprops largefile lstat
34 manywarnings mktime pselect pthread_sigmask readlink 34 manywarnings mktime pselect pthread_sigmask readlink
35 socklen stat-time stdalign stdarg stdbool stdio 35 socklen stat-time stdalign stdarg stdbool stdio
diff --git a/autogen/Makefile.in b/autogen/Makefile.in
index cea3da9a81d..4599f20df45 100644
--- a/autogen/Makefile.in
+++ b/autogen/Makefile.in
@@ -36,7 +36,7 @@
36# the same distribution terms as the rest of that program. 36# the same distribution terms as the rest of that program.
37# 37#
38# Generated by gnulib-tool. 38# Generated by gnulib-tool.
39# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings 39# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings
40 40
41VPATH = @srcdir@ 41VPATH = @srcdir@
42pkgdatadir = $(datadir)/@PACKAGE@ 42pkgdatadir = $(datadir)/@PACKAGE@
diff --git a/autogen/config.in b/autogen/config.in
index 5388b8dc046..9f664063761 100644
--- a/autogen/config.in
+++ b/autogen/config.in
@@ -369,15 +369,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
369/* Define to 1 if you have the `faccessat' function. */ 369/* Define to 1 if you have the `faccessat' function. */
370#undef HAVE_FACCESSAT 370#undef HAVE_FACCESSAT
371 371
372/* Define to 1 if you have the <fcntl.h> header file. */
373#undef HAVE_FCNTL_H
374
375/* Define to 1 if you have the `fork' function. */ 372/* Define to 1 if you have the `fork' function. */
376#undef HAVE_FORK 373#undef HAVE_FORK
377 374
378/* Define to 1 if you have the `fpathconf' function. */
379#undef HAVE_FPATHCONF
380
381/* Define to 1 if you have the `freeifaddrs' function. */ 375/* Define to 1 if you have the `freeifaddrs' function. */
382#undef HAVE_FREEIFADDRS 376#undef HAVE_FREEIFADDRS
383 377
diff --git a/autogen/configure b/autogen/configure
index e44b44a0a00..afcf9a73fa6 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -3206,7 +3206,6 @@ fi
3206 3206
3207as_fn_append ac_header_list " linux/version.h" 3207as_fn_append ac_header_list " linux/version.h"
3208as_fn_append ac_header_list " sys/systeminfo.h" 3208as_fn_append ac_header_list " sys/systeminfo.h"
3209as_fn_append ac_header_list " fcntl.h"
3210as_fn_append ac_header_list " coff.h" 3209as_fn_append ac_header_list " coff.h"
3211as_fn_append ac_header_list " pty.h" 3210as_fn_append ac_header_list " pty.h"
3212as_fn_append ac_header_list " sys/vlimit.h" 3211as_fn_append ac_header_list " sys/vlimit.h"
@@ -8782,8 +8781,6 @@ done
8782 8781
8783 8782
8784 8783
8785
8786
8787{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if personality LINUX32 can be set" >&5 8784{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if personality LINUX32 can be set" >&5
8788$as_echo_n "checking if personality LINUX32 can be set... " >&6; } 8785$as_echo_n "checking if personality LINUX32 can be set... " >&6; }
8789cat confdefs.h - <<_ACEOF >conftest.$ac_ext 8786cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -13449,7 +13446,7 @@ esac
13449for ac_func in gethostname \ 13446for ac_func in gethostname \
13450closedir getrusage get_current_dir_name \ 13447closedir getrusage get_current_dir_name \
13451lrand48 \ 13448lrand48 \
13452fpathconf select getpagesize setlocale \ 13449select getpagesize setlocale \
13453utimes getrlimit setrlimit getcwd shutdown getaddrinfo \ 13450utimes getrlimit setrlimit getcwd shutdown getaddrinfo \
13454strsignal setitimer \ 13451strsignal setitimer \
13455sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \ 13452sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
diff --git a/configure.ac b/configure.ac
index b0c81a23f8a..1884cc7ccf7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1268,7 +1268,7 @@ fi
1268dnl checks for header files 1268dnl checks for header files
1269AC_CHECK_HEADERS_ONCE( 1269AC_CHECK_HEADERS_ONCE(
1270 linux/version.h sys/systeminfo.h 1270 linux/version.h sys/systeminfo.h
1271 fcntl.h coff.h pty.h 1271 coff.h pty.h
1272 sys/vlimit.h sys/resource.h 1272 sys/vlimit.h sys/resource.h
1273 sys/utsname.h pwd.h utmp.h dirent.h util.h) 1273 sys/utsname.h pwd.h utmp.h dirent.h util.h)
1274 1274
@@ -2874,7 +2874,7 @@ AC_SUBST(BLESSMAIL_TARGET)
2874AC_CHECK_FUNCS(gethostname \ 2874AC_CHECK_FUNCS(gethostname \
2875closedir getrusage get_current_dir_name \ 2875closedir getrusage get_current_dir_name \
2876lrand48 \ 2876lrand48 \
2877fpathconf select getpagesize setlocale \ 2877select getpagesize setlocale \
2878utimes getrlimit setrlimit getcwd shutdown getaddrinfo \ 2878utimes getrlimit setrlimit getcwd shutdown getaddrinfo \
2879strsignal setitimer \ 2879strsignal setitimer \
2880sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \ 2880sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index fbdb6363b34..dc5fa539cd1 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,12 @@
12012-11-18 Dani Moncayo <dmoncayo@gmail.com>
2
3 * mark.texi (Disabled Transient Mark): Doc fixes (Bug#12746).
4
52012-11-16 Eli Zaretskii <eliz@gnu.org>
6
7 * trouble.texi (Crashing): Add information about MS-Windows and
8 the emacs_backtrace.txt file. (Bug#12908)
9
12012-11-13 Chong Yidong <cyd@gnu.org> 102012-11-13 Chong Yidong <cyd@gnu.org>
2 11
3 * building.texi (Multithreaded Debugging): gdb-stopped-hooks is 12 * building.texi (Multithreaded Debugging): gdb-stopped-hooks is
diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi
index 83d519a4cd2..db191eb175c 100644
--- a/doc/emacs/mark.texi
+++ b/doc/emacs/mark.texi
@@ -430,10 +430,6 @@ mark is by using @kbd{C-x C-x}, which exchanges the positions of the
430point and the mark (@pxref{Setting Mark}). 430point and the mark (@pxref{Setting Mark}).
431 431
432@item 432@item
433Many commands that move point long distances, like @kbd{M-<} and
434@kbd{C-s}, first set the mark where point was.
435
436@item
437Some commands, which ordinarily act on the region when the mark is 433Some commands, which ordinarily act on the region when the mark is
438active, no longer do so. For example, normally @kbd{M-%} 434active, no longer do so. For example, normally @kbd{M-%}
439(@code{query-replace}) performs replacements within the region, if the 435(@code{query-replace}) performs replacements within the region, if the
@@ -455,9 +451,10 @@ command twice.)
455 451
456@item C-u C-x C-x 452@item C-u C-x C-x
457@kindex C-u C-x C-x 453@kindex C-u C-x C-x
458Activate the mark and enable Transient Mark mode temporarily, until 454Exchange point and mark, activate the mark and enable Transient Mark
459the mark is next deactivated. (This is the @kbd{C-x C-x} command, 455mode temporarily, until the mark is next deactivated. (This is the
460@code{exchange-point-and-mark}, with a prefix argument.) 456@kbd{C-x C-x} command, @code{exchange-point-and-mark}, with a prefix
457argument.)
461@end table 458@end table
462 459
463 These commands set or activate the mark, and enable Transient Mark 460 These commands set or activate the mark, and enable Transient Mark
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index 1a891a62b33..705cd5a4bbe 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -282,18 +282,23 @@ itself, and the reserve supply may not be enough.
282@subsection When Emacs Crashes 282@subsection When Emacs Crashes
283 283
284@cindex crash report 284@cindex crash report
285@cindex backtrace
286@cindex @file{emacs_backtrace.txt} file, MS-Windows
285 Emacs is not supposed to crash, but if it does, it produces a 287 Emacs is not supposed to crash, but if it does, it produces a
286@dfn{crash report} prior to exiting. The crash report is printed to 288@dfn{crash report} prior to exiting. The crash report is printed to
287the standard error stream. If Emacs was started from a graphical 289the standard error stream. If Emacs was started from a graphical
288desktop, the standard error stream is commonly redirected to a file 290desktop on a GNU or Unix system, the standard error stream is commonly
289such as @file{~/.xsession-errors}, so you can look for the crash 291redirected to a file such as @file{~/.xsession-errors}, so you can
290report there. 292look for the crash report there. On MS-Windows, the crash report is
293written to a file named @file{emacs_backtrace.txt} in the current
294directory of the Emacs process, in addition to the standard error
295stream.
291 296
292 The format of the crash report depends on the platform. On some 297 The format of the crash report depends on the platform. On some
293platforms, such as those using the GNU C Library, the crash report 298platforms, such as those using the GNU C Library, the crash report
294includes a @dfn{backtrace} describing the execution state prior to 299includes a @dfn{backtrace} describing the execution state prior to
295crashing, which can be used to help debug the crash. Here is an 300crashing, which can be used to help debug the crash. Here is an
296example: 301example for a GNU system:
297 302
298@example 303@example
299Fatal error 11: Segmentation fault 304Fatal error 11: Segmentation fault
@@ -320,22 +325,24 @@ backtrace with source-code line numbers:
320 325
321@example 326@example
322sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} | 327sed -n 's/.*\[\(.*\)]$/\1/p' @var{backtrace} |
323 addr2line -Cfip -e @var{bindir}/emacs 328 addr2line -Cfip -e @var{bindir}/@var{emacs-binary}
324@end example 329@end example
325 330
326@noindent 331@noindent
327Here, @var{backtrace} is the name of a text file containing a copy of 332Here, @var{backtrace} is the name of a text file containing a copy of
328the backtrace, and @var{bindir} is the name of the directory that 333the backtrace, @var{bindir} is the name of the directory that
329contains the Emacs executable. 334contains the Emacs executable, and @var{emacs-binary} is the name of
335the Emacs executable file, normally @file{emacs} on GNU and Unix
336systems and @file{emacs.exe} on MS-Windows and MS-DOS.
330 337
331@cindex core dump 338@cindex core dump
332 Optionally, Emacs can generate a @dfn{core dump} when it crashes. A 339 Optionally, Emacs can generate a @dfn{core dump} when it crashes, on
333core dump is a file containing voluminous data about the state of the 340systems that support core files. A core dump is a file containing
334program prior to the crash, usually examined by loading it into a 341voluminous data about the state of the program prior to the crash,
335debugger such as GDB. On many platforms, core dumps are disabled by 342usually examined by loading it into a debugger such as GDB. On many
336default, and you must explicitly enable them by running the shell 343platforms, core dumps are disabled by default, and you must explicitly
337command @samp{ulimit -c unlimited} (e.g.@: in your shell startup 344enable them by running the shell command @samp{ulimit -c unlimited}
338script). 345(e.g.@: in your shell startup script).
339 346
340@node After a Crash 347@node After a Crash
341@subsection Recovery After a Crash 348@subsection Recovery After a Crash
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 6d6ddf4da9a..a5295adc368 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,56 @@
12012-11-18 Glenn Morris <rgm@gnu.org>
2
3 * loading.texi (How Programs Do Loading): Add eager macro expansion.
4 * macros.texi (Expansion): Mention eager macro expansion.
5
6 * minibuf.texi (Basic Completion): Mention misc completion-table funcs.
7
82012-11-18 Leo Liu <sdl.web@gmail.com>
9
10 * minibuf.texi (Programmed Completion): Doc fix for metadata
11 request (Bug#12850).
12
132012-11-18 Glenn Morris <rgm@gnu.org>
14
15 * display.texi (Temporary Displays): Document with-temp-buffer-window.
16
17 * frames.texi (Size and Position): Add fit-frame-to-buffer command.
18 * windows.texi (Resizing Windows): Add fit-frame-to-buffer option.
19 (Window Sizes): Add vindex for window-min-height, window-min-width.
20 (Display Action Functions): Mention pop-up-frame-parameters.
21
222012-11-16 Martin Rudalics <rudalics@gmx.at>
23
24 * windows.texi (Choosing Window): Rewrite description of
25 display-buffer-alist (Bug#12167).
26 (Display Action Functions): Mention inhibit-switch-frame. Fix
27 description of display-buffer-below-selected. Reorder actions.
28 Add example (Bug#12848).
29
302012-11-16 Glenn Morris <rgm@gnu.org>
31
32 * display.texi (Face Attributes): Fix :underline COLOR description.
33 (Attribute Functions): Update for set-face-underline rename.
34 Tweak descriptions of face-underline-p, face-inverse-video-p.
35
36 * keymaps.texi (Searching Keymaps, Tool Bar): Untabify examples,
37 so they align better in info.
38 (Active Keymaps, Searching Keymaps, Controlling Active Maps):
39 Document set-temporary-overlay-map.
40
412012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
42
43 * keymaps.texi (Translation Keymaps): Add a subsection "Interaction
44 with normal keymaps".
45
462012-11-15 Dmitry Antipov <dmantipov@yandex.ru>
47
48 * internals.texi (Garbage Collection): Update descriptions
49 of vectorlike_header, garbage-collect and gc-cons-threshold.
50 (Object Internals): Explain Lisp_Object layout and the basics
51 of an internal type system.
52 (Buffer Internals): Update description of struct buffer.
53
12012-11-13 Glenn Morris <rgm@gnu.org> 542012-11-13 Glenn Morris <rgm@gnu.org>
2 55
3 * variables.texi (Adding Generalized Variables): 56 * variables.texi (Adding Generalized Variables):
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 68701a47126..475a9550f99 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1078,7 +1078,8 @@ editing. Many help commands use this feature.
1078This function executes @var{forms} while arranging to insert any output 1078This function executes @var{forms} while arranging to insert any output
1079they print into the buffer named @var{buffer-name}, which is first 1079they print into the buffer named @var{buffer-name}, which is first
1080created if necessary, and put into Help mode. Finally, the buffer is 1080created if necessary, and put into Help mode. Finally, the buffer is
1081displayed in some window, but not selected. 1081displayed in some window, but not selected. (See the similar
1082form @code{with-temp-buffer-window} below.)
1082 1083
1083If the @var{forms} do not change the major mode in the output buffer, 1084If the @var{forms} do not change the major mode in the output buffer,
1084so that it is still Help mode at the end of their execution, then 1085so that it is still Help mode at the end of their execution, then
@@ -1152,6 +1153,37 @@ displaying the temporary buffer. When the hook runs, the temporary buffer
1152is current, and the window it was displayed in is selected. 1153is current, and the window it was displayed in is selected.
1153@end defvar 1154@end defvar
1154 1155
1156@defmac with-temp-buffer-window buffer-or-name action quit-function forms@dots{}
1157This macro is similar to @code{with-output-to-temp-buffer}.
1158Like that construct, it executes @var{forms} while arranging to insert
1159any output they print into the buffer named @var{buffer-or-name}.
1160Finally, the buffer is displayed in some window, but not selected.
1161Unlike @code{with-output-to-temp-buffer}, this does not switch to Help
1162mode.
1163
1164The argument @var{buffer-or-name} specifies the temporary buffer.
1165It can be either a buffer, which must already exist, or a string,
1166in which case a buffer of that name is created if necessary.
1167The buffer is marked as unmodified and read-only when
1168@code{with-temp-buffer-window} exits.
1169
1170This macro does not call @code{temp-buffer-show-function}. Rather, it
1171passes the @var{action} argument to @code{display-buffer} in order to
1172display the buffer.
1173
1174The value of the last form in @var{forms} is returned, unless the
1175argument @var{quit-function} is specified. In that case,
1176it is called with two arguments: the window showing the buffer
1177and the result of @var{forms}. The final return value is then
1178whatever @var{quit-function} returns.
1179
1180@vindex temp-buffer-window-setup-hook
1181@vindex temp-buffer-window-show-hook
1182This macro uses the normal hooks @code{temp-buffer-window-setup-hook}
1183and @code{temp-buffer-window-show-hook} in place of the analogous hooks
1184run by @code{with-output-to-temp-buffer}.
1185@end defmac
1186
1155@defun momentary-string-display string position &optional char message 1187@defun momentary-string-display string position &optional char message
1156This function momentarily displays @var{string} in the current buffer at 1188This function momentarily displays @var{string} in the current buffer at
1157@var{position}. It has no effect on the undo list or on the buffer's 1189@var{position}. It has no effect on the undo list or on the buffer's
@@ -2009,12 +2041,11 @@ Don't underline.
2009Underline with the foreground color of the face. 2041Underline with the foreground color of the face.
2010 2042
2011@item @var{color} 2043@item @var{color}
2012Underline in color @var{color}; which should be either a string 2044Underline in color @var{color}, a string specifying a color.
2013specifying a color, or the symbol @code{foreground-color}, meaning the
2014foreground color of the face.
2015 2045
2016@item @code{(:color @var{color} :style @var{style})} 2046@item @code{(:color @var{color} :style @var{style})}
2017@var{color} is as described above. Omitting the attribute 2047@var{color} is either a string, or the symbol @code{foreground-color},
2048meaning the foreground color of the face. Omitting the attribute
2018@code{:color} means to use the foreground color of the face. 2049@code{:color} means to use the foreground color of the face.
2019@var{style} should be a symbol @code{line} or @code{wave}, meaning to 2050@var{style} should be a symbol @code{line} or @code{wave}, meaning to
2020use a straight or wavy line. Omitting the attribute @code{:style} 2051use a straight or wavy line. Omitting the attribute @code{:style}
@@ -2404,7 +2435,7 @@ This sets the @code{:slant} attribute of @var{face} to @var{normal} if
2404@var{italic-p} is @code{nil}, and to @var{italic} otherwise. 2435@var{italic-p} is @code{nil}, and to @var{italic} otherwise.
2405@end defun 2436@end defun
2406 2437
2407@defun set-face-underline-p face underline &optional frame 2438@defun set-face-underline face underline &optional frame
2408This sets the @code{:underline} attribute of @var{face} to 2439This sets the @code{:underline} attribute of @var{face} to
2409@var{underline}. 2440@var{underline}.
2410@end defun 2441@end defun
@@ -2467,12 +2498,16 @@ attribute of @var{face} is @code{italic} or @code{oblique}, and
2467@code{nil} otherwise. 2498@code{nil} otherwise.
2468@end defun 2499@end defun
2469 2500
2501@c Note the weasel words. A face that inherits from an underlined
2502@c face but does not specify :underline will return nil.
2470@defun face-underline-p face &optional frame 2503@defun face-underline-p face &optional frame
2471This function returns the @code{:underline} attribute of face @var{face}. 2504This function returns non-@code{nil} if face @var{face} specifies
2505a non-@code{nil} @code{:underline} attribute.
2472@end defun 2506@end defun
2473 2507
2474@defun face-inverse-video-p face &optional frame 2508@defun face-inverse-video-p face &optional frame
2475This function returns the @code{:inverse-video} attribute of face @var{face}. 2509This function returns non-@code{nil} if face @var{face} specifies
2510a non-@code{nil} @code{:inverse-video} attribute.
2476@end defun 2511@end defun
2477 2512
2478@node Displaying Faces 2513@node Displaying Faces
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 27d55c4fdb9..846dfbaf17c 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1113,6 +1113,21 @@ The argument @var{pretend} has the same meaning as in
1113@code{set-frame-height}. 1113@code{set-frame-height}.
1114@end defun 1114@end defun
1115 1115
1116@c FIXME? Belongs more in Emacs manual than here?
1117@c But eg fit-window-to-buffer is in this manual.
1118@deffn Command fit-frame-to-buffer &optional frame max-height min-height
1119This command adjusts the height of @var{frame} (the default is the
1120selected frame) to fit its contents. The optional arguments
1121@var{max-height} and @var{min-height} specify the maximum and minimum
1122new frame heights, respectively.
1123
1124@vindex fit-frame-to-buffer-bottom-margin
1125The default minimum height corresponds to @code{window-min-height}.
1126The default maximum height is the screen height below the current top
1127position of the frame, minus any margin specified by the option
1128@code{fit-frame-to-buffer-bottom-margin}.
1129@end deffn
1130
1116@node Geometry 1131@node Geometry
1117@subsection Geometry 1132@subsection Geometry
1118 1133
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 1459f52d979..2a2846921c5 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -226,12 +226,11 @@ of 8k bytes, and small vectors are packed into blocks of 4k bytes).
226 Beyond the basic vector, a lot of objects like window, buffer, and 226 Beyond the basic vector, a lot of objects like window, buffer, and
227frame are managed as if they were vectors. The corresponding C data 227frame are managed as if they were vectors. The corresponding C data
228structures include the @code{struct vectorlike_header} field whose 228structures include the @code{struct vectorlike_header} field whose
229@code{next} field points to the next object in the chain: 229@code{size} member contains the subtype enumerated by @code{enum pvec_type}
230@code{header.next.buffer} points to the next buffer (which could be 230and an information about how many @code{Lisp_Object} fields this structure
231a killed buffer), and @code{header.next.vector} points to the next 231contains and what the size of the rest data is. This information is
232vector in a free list. If a vector is small (smaller than or equal to 232needed to calculate the memory footprint of an object, and used
233@code{VBLOCK_BYTES_MAX} bytes, see @file{alloc.c}), then 233by the vector allocation code while iterating over the vector blocks.
234@code{header.next.nbytes} contains the vector size in bytes.
235 234
236@cindex garbage collection 235@cindex garbage collection
237 It is quite common to use some storage for a while, then release it 236 It is quite common to use some storage for a while, then release it
@@ -284,88 +283,147 @@ the amount of space in use. (Garbage collection can also occur
284spontaneously if you use more than @code{gc-cons-threshold} bytes of 283spontaneously if you use more than @code{gc-cons-threshold} bytes of
285Lisp data since the previous garbage collection.) 284Lisp data since the previous garbage collection.)
286 285
287@code{garbage-collect} returns a list containing the following 286@code{garbage-collect} returns a list with information on amount of space in
288information: 287use, where each entry has the form @samp{(@var{name} @var{size} @var{used})}
288or @samp{(@var{name} @var{size} @var{used} @var{free})}. In the entry,
289@var{name} is a symbol describing the kind of objects this entry represents,
290@var{size} is the number of bytes used by each one, @var{used} is the number
291of those objects that were found live in the heap, and optional @var{free} is
292the number of those objects that are not live but that Emacs keeps around for
293future allocations. So an overall result is:
289 294
290@example 295@example
291@group 296((@code{conses} @var{cons-size} @var{used-conse} @var{free-conses})
292((@var{used-conses} . @var{free-conses}) 297 (@code{symbols} @var{symbol-size} @var{used-symbols} @var{free-symbols})
293 (@var{used-syms} . @var{free-syms}) 298 (@code{miscs} @var{misc-size} @var{used-miscs} @var{free-miscs})
294@end group 299 (@code{strings} @var{string-size} @var{used-strings} @var{free-strings})
295 (@var{used-miscs} . @var{free-miscs}) 300 (@code{string-bytes} @var{byte-size} @var{used-bytes})
296 @var{used-string-chars} 301 (@code{vectors} @var{vector-size} @var{used-vectors})
297 @var{used-vector-slots} 302 (@code{vector-slots} @var{slot-size} @var{used-slots} @var{free-slots})
298 (@var{used-floats} . @var{free-floats}) 303 (@code{floats} @var{float-size} @var{used-floats} @var{free-floats})
299 (@var{used-intervals} . @var{free-intervals}) 304 (@code{intervals} @var{interval-size} @var{used-intervals} @var{free-intervals})
300 (@var{used-strings} . @var{free-strings})) 305 (@code{buffers} @var{buffer-size} @var{used-buffers})
306 (@code{heap} @var{unit-size} @var{total-size} @var{free-size}))
301@end example 307@end example
302 308
303Here is an example: 309Here is an example:
304 310
305@example 311@example
306@group
307(garbage-collect) 312(garbage-collect)
308 @result{} ((106886 . 13184) (9769 . 0) 313 @result{} ((conses 16 49126 8058) (symbols 48 14607 0)
309 (7731 . 4651) 347543 121628 314 (miscs 40 34 56) (strings 32 2942 2607)
310 (31 . 94) (1273 . 168) 315 (string-bytes 1 78607) (vectors 16 7247)
311 (25474 . 3569)) 316 (vector-slots 8 341609 29474) (floats 8 71 102)
312@end group 317 (intervals 56 27 26) (buffers 944 8)
318 (heap 1024 11715 2678))
313@end example 319@end example
314 320
315Here is a table explaining each element: 321Below is a table explaining each element. Note that last @code{heap} entry
322is optional and present only if an underlying @code{malloc} implementation
323provides @code{mallinfo} function.
316 324
317@table @var 325@table @var
326@item cons-size
327Internal size of a cons cell, i.e.@: @code{sizeof (struct Lisp_Cons)}.
328
318@item used-conses 329@item used-conses
319The number of cons cells in use. 330The number of cons cells in use.
320 331
321@item free-conses 332@item free-conses
322The number of cons cells for which space has been obtained from the 333The number of cons cells for which space has been obtained from
323operating system, but that are not currently being used. 334the operating system, but that are not currently being used.
324 335
325@item used-syms 336@item symbol-size
337Internal size of a symbol, i.e.@: @code{sizeof (struct Lisp_Symbol)}.
338
339@item used-symbols
326The number of symbols in use. 340The number of symbols in use.
327 341
328@item free-syms 342@item free-symbols
329The number of symbols for which space has been obtained from the 343The number of symbols for which space has been obtained from
330operating system, but that are not currently being used. 344the operating system, but that are not currently being used.
345
346@item misc-size
347Internal size of a miscellaneous entity, i.e.@:
348@code{sizeof (union Lisp_Misc)}, which is a size of the
349largest type enumerated in @code{enum Lisp_Misc_Type}.
331 350
332@item used-miscs 351@item used-miscs
333The number of miscellaneous objects in use. These include markers and 352The number of miscellaneous objects in use. These include markers
334overlays, plus certain objects not visible to users. 353and overlays, plus certain objects not visible to users.
335 354
336@item free-miscs 355@item free-miscs
337The number of miscellaneous objects for which space has been obtained 356The number of miscellaneous objects for which space has been obtained
338from the operating system, but that are not currently being used. 357from the operating system, but that are not currently being used.
339 358
340@item used-string-chars 359@item string-size
341The total size of all strings, in characters. 360Internal size of a string header, i.e.@: @code{sizeof (struct Lisp_String)}.
361
362@item used-strings
363The number of string headers in use.
364
365@item free-strings
366The number of string headers for which space has been obtained
367from the operating system, but that are not currently being used.
368
369@item byte-size
370This is used for convenience and equals to @code{sizeof (char)}.
371
372@item used-bytes
373The total size of all string data in bytes.
374
375@item vector-size
376Internal size of a vector header, i.e.@: @code{sizeof (struct Lisp_Vector)}.
342 377
343@item used-vector-slots 378@item used-vectors
344The total number of elements of existing vectors. 379The number of vector headers allocated from the vector blocks.
380
381@item slot-size
382Internal size of a vector slot, always equal to @code{sizeof (Lisp_Object)}.
383
384@item used-slots
385The number of slots in all used vectors.
386
387@item free-slots
388The number of free slots in all vector blocks.
389
390@item float-size
391Internal size of a float object, i.e.@: @code{sizeof (struct Lisp_Float)}.
392(Do not confuse it with the native platform @code{float} or @code{double}.)
345 393
346@item used-floats 394@item used-floats
347The number of floats in use. 395The number of floats in use.
348 396
349@item free-floats 397@item free-floats
350The number of floats for which space has been obtained from the 398The number of floats for which space has been obtained from
351operating system, but that are not currently being used. 399the operating system, but that are not currently being used.
400
401@item interval-size
402Internal size of an interval object, i.e.@: @code{sizeof (struct interval)}.
352 403
353@item used-intervals 404@item used-intervals
354The number of intervals in use. Intervals are an internal 405The number of intervals in use.
355data structure used for representing text properties.
356 406
357@item free-intervals 407@item free-intervals
358The number of intervals for which space has been obtained 408The number of intervals for which space has been obtained from
359from the operating system, but that are not currently being used. 409the operating system, but that are not currently being used.
360 410
361@item used-strings 411@item buffer-size
362The number of strings in use. 412Internal size of a buffer, i.e.@: @code{sizeof (struct buffer)}.
413(Do not confuse with the value returned by @code{buffer-size} function.)
363 414
364@item free-strings 415@item used-buffers
365The number of string headers for which the space was obtained from the 416The number of buffer objects in use. This includes killed buffers
366operating system, but which are currently not in use. (A string 417invisible to users, i.e.@: all buffers in @code{all_buffers} list.
367object consists of a header and the storage for the string text 418
368itself; the latter is only allocated when the string is created.) 419@item unit-size
420The unit of heap space measurement, always equal to 1024 bytes.
421
422@item total-size
423Total heap size, in @var{unit-size} units.
424
425@item free-size
426Heap space which is not currently used, in @var{unit-size} units.
369@end table 427@end table
370 428
371If there was overflow in pure space (@pxref{Pure Storage}), 429If there was overflow in pure space (@pxref{Pure Storage}),
@@ -388,23 +446,25 @@ careful writing them.
388@defopt gc-cons-threshold 446@defopt gc-cons-threshold
389The value of this variable is the number of bytes of storage that must 447The value of this variable is the number of bytes of storage that must
390be allocated for Lisp objects after one garbage collection in order to 448be allocated for Lisp objects after one garbage collection in order to
391trigger another garbage collection. A cons cell counts as eight bytes, 449trigger another garbage collection. You can use the result returned by
392a string as one byte per character plus a few bytes of overhead, and so 450@code{garbage-collect} to get an information about size of the particular
393on; space allocated to the contents of buffers does not count. Note 451object type; space allocated to the contents of buffers does not count.
394that the subsequent garbage collection does not happen immediately when 452Note that the subsequent garbage collection does not happen immediately
395the threshold is exhausted, but only the next time the Lisp evaluator is 453when the threshold is exhausted, but only the next time the Lisp interpreter
396called. 454is called.
397 455
398The initial threshold value is 800,000. If you specify a larger 456The initial threshold value is @code{GC_DEFAULT_THRESHOLD}, defined in
399value, garbage collection will happen less often. This reduces the 457@file{alloc.c}. Since it's defined in @code{word_size} units, the value
400amount of time spent garbage collecting, but increases total memory use. 458is 400,000 for the default 32-bit configuration and 800,000 for the 64-bit
401You may want to do this when running a program that creates lots of 459one. If you specify a larger value, garbage collection will happen less
402Lisp data. 460often. This reduces the amount of time spent garbage collecting, but
403 461increases total memory use. You may want to do this when running a program
404You can make collections more frequent by specifying a smaller value, 462that creates lots of Lisp data.
405down to 10,000. A value less than 10,000 will remain in effect only 463
406until the subsequent garbage collection, at which time 464You can make collections more frequent by specifying a smaller value, down
407@code{garbage-collect} will set the threshold back to 10,000. 465to 1/10th of @code{GC_DEFAULT_THRESHOLD}. A value less than this minimum
466will remain in effect only until the subsequent garbage collection, at which
467time @code{garbage-collect} will set the threshold back to the minimum.
408@end defopt 468@end defopt
409 469
410@defopt gc-cons-percentage 470@defopt gc-cons-percentage
@@ -639,7 +699,12 @@ in the file @file{lisp.h}.) If the primitive has no upper limit on
639the number of Lisp arguments, it must have exactly two C arguments: 699the number of Lisp arguments, it must have exactly two C arguments:
640the first is the number of Lisp arguments, and the second is the 700the first is the number of Lisp arguments, and the second is the
641address of a block containing their values. These have types 701address of a block containing their values. These have types
642@code{int} and @w{@code{Lisp_Object *}} respectively. 702@code{int} and @w{@code{Lisp_Object *}} respectively. Since
703@code{Lisp_Object} can hold any Lisp object of any data type, you
704can determine the actual data type only at run time; so if you want
705a primitive to accept only a certain type of argument, you must check
706the type explicitly using a suitable predicate (@pxref{Type Predicates}).
707@cindex type checking internals
643 708
644@cindex @code{GCPRO} and @code{UNGCPRO} 709@cindex @code{GCPRO} and @code{UNGCPRO}
645@cindex protect C variables from garbage collection 710@cindex protect C variables from garbage collection
@@ -820,23 +885,70 @@ knows about it.
820@section Object Internals 885@section Object Internals
821@cindex object internals 886@cindex object internals
822 887
823@c FIXME Is this still true? Does --with-wide-int affect anything? 888 Emacs Lisp provides a rich set of the data types. Some of them, like cons
824 GNU Emacs Lisp manipulates many different types of data. The actual 889cells, integers and stirngs, are common to nearly all Lisp dialects. Some
825data are stored in a heap and the only access that programs have to it 890others, like markers and buffers, are quite special and needed to provide
826is through pointers. Each pointer is 32 bits wide on 32-bit machines, 891the basic support to write editor commands in Lisp. To implement such
827and 64 bits wide on 64-bit machines; three of these bits are used for 892a variety of object types and provide an efficient way to pass objects between
828the tag that identifies the object's type, and the remainder are used 893the subsystems of an interpreter, there is a set of C data structures and
829to address the object. 894a special type to represent the pointers to all of them, which is known as
830 895@dfn{tagged pointer}.
831 Because Lisp objects are represented as tagged pointers, it is always 896
832possible to determine the Lisp data type of any object. The C data type 897 In C, the tagged pointer is an object of type @code{Lisp_Object}. Any
833@code{Lisp_Object} can hold any Lisp object of any data type. Ordinary 898initialized variable of such a type always holds the value of one of the
834variables have type @code{Lisp_Object}, which means they can hold any 899following basic data types: integer, symbol, string, cons cell, float,
835type of Lisp value; you can determine the actual data type only at run 900vectorlike or miscellaneous object. Each of these data types has the
836time. The same is true for function arguments; if you want a function 901corresponding tag value. All tags are enumerated by @code{enum Lisp_Type}
837to accept only a certain type of argument, you must check the type 902and placed into a 3-bit bitfield of the @code{Lisp_Object}. The rest of the
838explicitly using a suitable predicate (@pxref{Type Predicates}). 903bits is the value itself. Integer values are immediate, i.e.@: directly
839@cindex type checking internals 904represented by those @dfn{value bits}, and all other objects are represented
905by the C pointers to a corresponding object allocated from the heap. Width
906of the @code{Lisp_Object} is platform- and configuration-dependent: usually
907it's equal to the width of an underlying platform pointer (i.e.@: 32-bit on
908a 32-bit machine and 64-bit on a 64-bit one), but also there is a special
909configuration where @code{Lisp_Object} is 64-bit but all pointers are 32-bit.
910The latter trick was designed to overcome the limited range of values for
911Lisp integers on a 32-bit system by using 64-bit @code{long long} type for
912@code{Lisp_Object}.
913
914 The following C data structures are defined in @file{lisp.h} to represent
915the basic data types beyond integers:
916
917@table @code
918@item struct Lisp_Cons
919Cons cell, an object used to construct lists.
920
921@item struct Lisp_String
922String, the basic object to represent a sequence of characters.
923
924@item struct Lisp_Vector
925Array, a fixed-size set of Lisp objects which may be accessed by an index.
926
927@item struct Lisp_Symbol
928Symbol, the unique-named entity commonly used as an identifier.
929
930@item struct Lisp_Float
931Floating point value.
932
933@item union Lisp_Misc
934Miscellaneous kinds of objects which don't fit into any of the above.
935@end table
936
937 These types are the first-class citizens of an internal type system.
938Since the tag space is limited, all other types are the subtypes of either
939@code{Lisp_Vectorlike} or @code{Lisp_Misc}. Vector subtypes are enumerated
940by @code{enum pvec_type}, and nearly all complex objects like windows, buffers,
941frames, and processes fall into this category. The rest of special types,
942including markers and overlays, are enumerated by @code{enum Lisp_Misc_Type}
943and form the set of subtypes of @code{Lisp_Misc}.
944
945 Below there is a description of a few subtypes of @code{Lisp_Vectorlike}.
946Buffer object represents the text to display and edit. Window is the part
947of display structure which shows the buffer or used as a container to
948recursively place other windows on the same frame. (Do not confuse Emacs Lisp
949window object with the window as an entity managed by the user interface
950system like X; in Emacs terminology, the latter is called frame.) Finally,
951process object is used to manage the subprocesses.
840 952
841@menu 953@menu
842* Buffer Internals:: Components of a buffer structure. 954* Buffer Internals:: Components of a buffer structure.
@@ -912,12 +1024,8 @@ Some of the fields of @code{struct buffer} are:
912 1024
913@table @code 1025@table @code
914@item header 1026@item header
915A @code{struct vectorlike_header} structure where @code{header.next} 1027A header of type @code{struct vectorlike_header} is common to all
916points to the next buffer, in the chain of all buffers (including 1028vectorlike objects.
917killed buffers). This chain is used only for garbage collection, in
918order to collect killed buffers properly. Note that vectors, and most
919kinds of objects allocated as vectors, are all on one chain, but
920buffers are on a separate chain of their own.
921 1029
922@item own_text 1030@item own_text
923A @code{struct buffer_text} structure that ordinarily holds the buffer 1031A @code{struct buffer_text} structure that ordinarily holds the buffer
@@ -928,6 +1036,11 @@ A pointer to the @code{buffer_text} structure for this buffer. In an
928ordinary buffer, this is the @code{own_text} field above. In an 1036ordinary buffer, this is the @code{own_text} field above. In an
929indirect buffer, this is the @code{own_text} field of the base buffer. 1037indirect buffer, this is the @code{own_text} field of the base buffer.
930 1038
1039@item next
1040A pointer to the next buffer, in the chain of all buffers, including
1041killed buffers. This chain is used only for allocation and garbage
1042collection, in order to collect killed buffers properly.
1043
931@item pt 1044@item pt
932@itemx pt_byte 1045@itemx pt_byte
933The character and byte positions of point in a buffer. 1046The character and byte positions of point in a buffer.
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index f658f7e66fb..d01ecba4bed 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -664,7 +664,9 @@ additional active keymaps through the variable
664 664
665 The highest precedence normal keymap comes from the @code{keymap} 665 The highest precedence normal keymap comes from the @code{keymap}
666text or overlay property. If that is non-@code{nil}, it is the first 666text or overlay property. If that is non-@code{nil}, it is the first
667keymap to be processed, in normal circumstances. 667keymap to be processed, in normal circumstances. Next comes
668any keymap added by the function @code{set-temporary-overlay-map}.
669@xref{Controlling Active Maps}.
668 670
669 However, there are also special ways for programs to substitute 671 However, there are also special ways for programs to substitute
670other keymaps for some of those. The variable 672other keymaps for some of those. The variable
@@ -753,12 +755,13 @@ them:
753 (overriding-local-map 755 (overriding-local-map
754 (@var{find-in} overriding-local-map)) 756 (@var{find-in} overriding-local-map))
755 ((or (@var{find-in} (get-char-property (point) 'keymap)) 757 ((or (@var{find-in} (get-char-property (point) 'keymap))
756 (@var{find-in-any} emulation-mode-map-alists) 758 (@var{find-in} @var{temp-map})
757 (@var{find-in-any} minor-mode-overriding-map-alist) 759 (@var{find-in-any} emulation-mode-map-alists)
758 (@var{find-in-any} minor-mode-map-alist) 760 (@var{find-in-any} minor-mode-overriding-map-alist)
759 (if (get-text-property (point) 'local-map) 761 (@var{find-in-any} minor-mode-map-alist)
760 (@var{find-in} (get-char-property (point) 'local-map)) 762 (if (get-text-property (point) 'local-map)
761 (@var{find-in} (current-local-map)))))) 763 (@var{find-in} (get-char-property (point) 'local-map))
764 (@var{find-in} (current-local-map))))))
762 (@var{find-in} (current-global-map))) 765 (@var{find-in} (current-global-map)))
763@end lisp 766@end lisp
764 767
@@ -770,7 +773,8 @@ Lookup}.) If the key sequence starts with a mouse event, or a
770symbolic prefix event followed by a mouse event, that event's position 773symbolic prefix event followed by a mouse event, that event's position
771is used instead of point and the current buffer. Mouse events on an 774is used instead of point and the current buffer. Mouse events on an
772embedded string use non-@code{nil} text properties from that string 775embedded string use non-@code{nil} text properties from that string
773instead of the buffer. 776instead of the buffer. @var{temp-map} is a pseudo variable that
777represents the effect of a @code{set-temporary-overlay-map} call.
774 778
775 When a match is found (@pxref{Key Lookup}), if the binding in the 779 When a match is found (@pxref{Key Lookup}), if the binding in the
776keymap is a function, the search is over. However if the keymap entry 780keymap is a function, the search is over. However if the keymap entry
@@ -950,6 +954,21 @@ are used before @code{minor-mode-map-alist} and
950@code{minor-mode-overriding-map-alist}. 954@code{minor-mode-overriding-map-alist}.
951@end defvar 955@end defvar
952 956
957@defun set-temporary-overlay-map keymap &optional keep
958This function adds @var{keymap} as a temporary keymap that takes
959precedence over most other keymaps. It does not take precedence over
960the ``overriding'' maps (see above); and unlike them, if no match for
961a key is found in @var{keymap}, the search continues.
962
963Normally, @var{keymap} is used only once. If the optional argument
964@var{pred} is @code{t}, the map stays active if a key from @var{keymap}
965is used. @var{pred} can also be a function of no arguments: if it returns
966non-@code{nil} then @var{keymap} stays active.
967
968For a pseudo-Lisp description of exactly how and when this keymap applies,
969@pxref{Searching Keymaps}.
970@end defun
971
953@node Key Lookup 972@node Key Lookup
954@section Key Lookup 973@section Key Lookup
955@cindex key lookup 974@cindex key lookup
@@ -1540,14 +1559,11 @@ sequence, to translate certain event sequences into others.
1540being read, as it is read, against @code{input-decode-map}, then 1559being read, as it is read, against @code{input-decode-map}, then
1541@code{local-function-key-map}, and then against @code{key-translation-map}. 1560@code{local-function-key-map}, and then against @code{key-translation-map}.
1542 1561
1543@defvar input-decode-map 1562These keymaps have the same structure as other keymaps, but they are used
1544This variable holds a keymap that describes the character sequences sent 1563differently: they specify translations to make while reading key sequences,
1545by function keys on an ordinary character terminal. This keymap has the 1564rather than bindings for key sequences.
1546same structure as other keymaps, but is used differently: it specifies
1547translations to make while reading key sequences, rather than bindings
1548for key sequences.
1549 1565
1550If @code{input-decode-map} ``binds'' a key sequence @var{k} to a vector 1566If one of these keymaps ``binds'' a key sequence @var{k} to a vector
1551@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a 1567@var{v}, then when @var{k} appears as a subsequence @emph{anywhere} in a
1552key sequence, it is replaced with the events in @var{v}. 1568key sequence, it is replaced with the events in @var{v}.
1553 1569
@@ -1562,6 +1578,10 @@ Thus, typing @kbd{C-c @key{PF1}} sends the character sequence @kbd{C-c
1562this back into @kbd{C-c @key{PF1}}, which it returns as the vector 1578this back into @kbd{C-c @key{PF1}}, which it returns as the vector
1563@code{[?\C-c pf1]}. 1579@code{[?\C-c pf1]}.
1564 1580
1581@defvar input-decode-map
1582This variable holds a keymap that describes the character sequences sent
1583by function keys on an ordinary character terminal.
1584
1565The value of @code{input-decode-map} is usually set up automatically 1585The value of @code{input-decode-map} is usually set up automatically
1566according to the terminal's Terminfo or Termcap entry, but sometimes 1586according to the terminal's Terminfo or Termcap entry, but sometimes
1567those need help from terminal-specific Lisp files. Emacs comes with 1587those need help from terminal-specific Lisp files. Emacs comes with
@@ -1636,8 +1656,6 @@ to turn the character that follows into a Hyper character:
1636 (let ((symbol (if (symbolp e) e (car e)))) 1656 (let ((symbol (if (symbolp e) e (car e))))
1637 (setq symbol (intern (concat string 1657 (setq symbol (intern (concat string
1638 (symbol-name symbol)))) 1658 (symbol-name symbol))))
1639@end group
1640@group
1641 (if (symbolp e) 1659 (if (symbolp e)
1642 symbol 1660 symbol
1643 (cons symbol (cdr e))))) 1661 (cons symbol (cdr e)))))
@@ -1647,10 +1665,30 @@ to turn the character that follows into a Hyper character:
1647@end example 1665@end example
1648 1666
1649 If you have enabled keyboard character set decoding using 1667 If you have enabled keyboard character set decoding using
1650@code{set-keyboard-coding-system}, decoding is done after the 1668@code{set-keyboard-coding-system}, decoding is done before the
1651translations listed above. @xref{Terminal I/O Encoding}. However, in 1669translations listed above. @xref{Terminal I/O Encoding}.
1652future Emacs versions, character set decoding may be done at an 1670
1653earlier stage. 1671@subsection Interaction with normal keymaps
1672
1673The end of a key sequence is detected when that key sequence either is bound
1674to a command, or when Emacs determines that no additional event can lead
1675to a sequence that is bound to a command.
1676
1677This means that, while @code{input-decode-map} and @code{key-translation-map}
1678apply regardless of whether the original key sequence would have a binding, the
1679presence of such a binding can still prevent translation from taking place.
1680For example, let us return to our VT100 example above and add a binding for
1681@kbd{C-c @key{ESC}} to the global map; now when the user hits @kbd{C-c
1682@key{PF1}} Emacs will fail to decode @kbd{C-c @key{ESC} O P} into @kbd{C-c
1683@key{PF1}} because it will stop reading keys right after @kbd{C-x @key{ESC}},
1684leaving @kbd{O P} for later. This is in case the user really hit @kbd{C-c
1685@key{ESC}}, in which case Emacs should not sit there waiting for the next key
1686to decide whether the user really pressed @kbd{@key{ESC}} or @kbd{@key{PF1}}.
1687
1688For that reason, it is better to avoid binding commands to key sequences where
1689the end of the key sequence is a prefix of a key translation. The main such
1690problematic suffixes/prefixes are @kbd{@key{ESC}}, @kbd{M-O} (which is really
1691@kbd{@key{ESC} O}) and @kbd{M-[} (which is really @kbd{@key{ESC} [}).
1654 1692
1655@node Key Binding Commands 1693@node Key Binding Commands
1656@section Commands for Binding Keys 1694@section Commands for Binding Keys
@@ -2629,8 +2667,8 @@ By default, the global map binds @code{[tool-bar]} as follows:
2629 2667
2630@example 2668@example
2631(global-set-key [tool-bar] 2669(global-set-key [tool-bar]
2632 `(menu-item ,(purecopy "tool bar") ignore 2670 `(menu-item ,(purecopy "tool bar") ignore
2633 :filter tool-bar-make-keymap)) 2671 :filter tool-bar-make-keymap))
2634@end example 2672@end example
2635 2673
2636@noindent 2674@noindent
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 3a511d34829..54acd0b4d4c 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -113,6 +113,25 @@ When loading a source file (not compiled), @code{load} performs
113character set translation just as Emacs would do when visiting the file. 113character set translation just as Emacs would do when visiting the file.
114@xref{Coding Systems}. 114@xref{Coding Systems}.
115 115
116@c This is referred to from the Macros chapter.
117@c Not sure if it should be the other way round.
118@cindex eager macro expansion
119When loading an uncompiled file, Emacs tries to expand any macros
120that the file contains (@pxref{Macros}). We refer to this as
121@dfn{eager macro expansion}. Doing this (rather than deferring
122the expansion until the relevant code runs) can significantly speed
123up the execution of uncompiled code. Sometimes, this macro expansion
124cannot be done, owing to a cyclic dependency. In the simplest
125example of this, the file you are loading refers to a macro defined
126in another file, and that file in turn requires the file you are
127loading. This is generally harmless. Emacs prints a warning
128(@samp{Eager macro-expansion skipped due to cycle@dots{}})
129giving details of the problem, but it still loads the file, just
130leaving the macro unexpanded for now. You may wish to restructure
131your code so that this does not happen. Loading a compiled file does
132not cause macroexpansion, because this should already have happened
133during compilation. @xref{Compiling Macros}.
134
116Messages like @samp{Loading foo...} and @samp{Loading foo...done} appear 135Messages like @samp{Loading foo...} and @samp{Loading foo...done} appear
117in the echo area during loading unless @var{nomessage} is 136in the echo area during loading unless @var{nomessage} is
118non-@code{nil}. 137non-@code{nil}.
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi
index 8be6a3fbcde..b0dee1bf215 100644
--- a/doc/lispref/macros.texi
+++ b/doc/lispref/macros.texi
@@ -86,6 +86,10 @@ macro.
86calls to other macros. It may even be a call to the same macro, though 86calls to other macros. It may even be a call to the same macro, though
87this is unusual. 87this is unusual.
88 88
89 Note that Emacs tries to expand macros when loading an uncompiled
90Lisp file. This is not always possible, but if it is, it speeds up
91subsequent execution. @xref{How Programs Do Loading}.
92
89 You can see the expansion of a given macro call by calling 93 You can see the expansion of a given macro call by calling
90@code{macroexpand}. 94@code{macroexpand}.
91 95
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 7243f46b882..033c10fbf7d 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -886,6 +886,26 @@ Here is an example:
886@end smallexample 886@end smallexample
887@end defmac 887@end defmac
888 888
889@c FIXME? completion-table-with-context?
890@findex completion-table-case-fold
891@findex completion-table-in-turn
892@findex completion-table-subvert
893@findex completion-table-with-quoting
894@findex completion-table-with-predicate
895@findex completion-table-with-terminator
896@cindex completion table, modifying
897@cindex completion tables, combining
898There are several functions that take an existing completion table and
899return a modified version. @code{completion-table-case-fold} returns
900a case-insensitive table. @code{completion-table-in-turn} combines
901multiple input tables. @code{completion-table-subvert} alters a table
902to use a different initial prefix. @code{completion-table-with-quoting}
903returns a table suitable for operating on quoted text.
904@code{completion-table-with-predicate} filters a table with a
905predicate function. @code{completion-table-with-terminator} adds a
906terminating string.
907
908
889@node Minibuffer Completion 909@node Minibuffer Completion
890@subsection Completion and the Minibuffer 910@subsection Completion and the Minibuffer
891@cindex minibuffer completion 911@cindex minibuffer completion
@@ -1710,8 +1730,9 @@ string, and @var{end} is the position of the end boundary in
1710 1730
1711@item metadata 1731@item metadata
1712This specifies a request for information about the state of the 1732This specifies a request for information about the state of the
1713current completion. The function should return an alist, as described 1733current completion. The return value should have the form
1714below. The alist may contain any number of elements. 1734@code{(metadata . @var{alist})}, where @var{alist} is an alist whose
1735elements are described below.
1715@end table 1736@end table
1716 1737
1717@noindent 1738@noindent
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index a284fc09045..b8581b1cc62 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -490,6 +490,8 @@ partially-visible line at the bottom of the text area is not counted.
490aliases are considered obsolete and will be removed in the future. 490aliases are considered obsolete and will be removed in the future.
491 491
492@cindex fixed-size window 492@cindex fixed-size window
493@vindex window-min-height
494@vindex window-min-width
493 Commands that change the size of windows (@pxref{Resizing Windows}), 495 Commands that change the size of windows (@pxref{Resizing Windows}),
494or split them (@pxref{Splitting Windows}), obey the variables 496or split them (@pxref{Splitting Windows}), obey the variables
495@code{window-min-height} and @code{window-min-width}, which specify 497@code{window-min-height} and @code{window-min-width}, which specify
@@ -633,6 +635,10 @@ variable @code{window-min-height}.
633If the optional argument @var{override} is non-@code{nil}, this 635If the optional argument @var{override} is non-@code{nil}, this
634function ignores any size restrictions imposed by 636function ignores any size restrictions imposed by
635@code{window-min-height} and @code{window-min-width}. 637@code{window-min-height} and @code{window-min-width}.
638
639@vindex fit-frame-to-buffer
640If the option @code{fit-frame-to-buffer} is non-@code{nil}, this
641command may resize the frame to fit its contents.
636@end deffn 642@end deffn
637 643
638@deffn Command shrink-window-if-larger-than-buffer &optional window 644@deffn Command shrink-window-if-larger-than-buffer &optional window
@@ -1766,6 +1772,7 @@ Like @code{switch-to-buffer}, this function updates the buffer list
1766unless @var{norecord} is non-@code{nil}. 1772unless @var{norecord} is non-@code{nil}.
1767@end deffn 1773@end deffn
1768 1774
1775
1769@node Choosing Window 1776@node Choosing Window
1770@section Choosing a Window for Display 1777@section Choosing a Window for Display
1771 1778
@@ -1851,10 +1858,14 @@ default value is empty, i.e. @code{(nil . nil)}.
1851@end defvar 1858@end defvar
1852 1859
1853@defopt display-buffer-alist 1860@defopt display-buffer-alist
1854The value of this option is an alist mapping regular expressions to 1861The value of this option is an alist mapping conditions to display
1855display actions. If the name of the buffer passed to 1862actions. Each condition may be either a regular expression matching a
1856@code{display-buffer} matches a regular expression in this alist, then 1863buffer name or a function that takes two arguments - a buffer name and
1857@code{display-buffer} uses the corresponding display action. 1864the @var{action} argument passed to @code{display-buffer}. If the name
1865of the buffer passed to @code{display-buffer} either matches a regular
1866expression in this alist or the function specified by a condition
1867returns non-@code{nil}, then @code{display-buffer} uses the
1868corresponding display action to display the buffer.
1858@end defopt 1869@end defopt
1859 1870
1860@defopt display-buffer-base-action 1871@defopt display-buffer-base-action
@@ -1868,6 +1879,7 @@ This display action specifies the fallback behavior for
1868@code{display-buffer} if no other display actions are given. 1879@code{display-buffer} if no other display actions are given.
1869@end defvr 1880@end defvr
1870 1881
1882
1871@node Display Action Functions 1883@node Display Action Functions
1872@section Action Functions for @code{display-buffer} 1884@section Action Functions for @code{display-buffer}
1873 1885
@@ -1911,15 +1923,18 @@ normally searches just the selected frame; however, if the variable
1911@code{pop-up-frames} is non-@code{nil}, it searches all frames on the 1923@code{pop-up-frames} is non-@code{nil}, it searches all frames on the
1912current terminal. @xref{Choosing Window Options}. 1924current terminal. @xref{Choosing Window Options}.
1913 1925
1914If this function chooses a window on another frame, it makes that 1926If this function chooses a window on another frame, it makes that frame
1915frame visible and raises it if necessary. 1927visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
1928entry (@pxref{Choosing Window Options}), raises that frame if necessary.
1916@end defun 1929@end defun
1917 1930
1918@defun display-buffer-pop-up-frame buffer alist 1931@defun display-buffer-pop-up-frame buffer alist
1919This function creates a new frame, and displays the buffer in that 1932This function creates a new frame, and displays the buffer in that
1920frame's window. It actually performs the frame creation by calling 1933frame's window. It actually performs the frame creation by calling
1921the function specified in @code{pop-up-frame-function} 1934the function specified in @code{pop-up-frame-function}
1922(@pxref{Choosing Window Options}). 1935(@pxref{Choosing Window Options}). If @var{alist} contains a
1936@code{pop-up-frame-parameters} entry, the associated value
1937is added to the newly created frame's parameters.
1923@end defun 1938@end defun
1924 1939
1925@defun display-buffer-pop-up-window buffer alist 1940@defun display-buffer-pop-up-window buffer alist
@@ -1976,16 +1991,12 @@ reason (e.g. if there is just one frame and it has an
1976@code{unsplittable} frame parameter; @pxref{Buffer Parameters}). 1991@code{unsplittable} frame parameter; @pxref{Buffer Parameters}).
1977@end defun 1992@end defun
1978 1993
1979@defun display-buffer-use-some-window buffer alist
1980This function tries to display @var{buffer} by choosing an existing
1981window and displaying the buffer in that window. It can fail if all
1982windows are dedicated to another buffer (@pxref{Dedicated Windows}).
1983@end defun
1984
1985@defun display-buffer-below-selected buffer alist 1994@defun display-buffer-below-selected buffer alist
1986This function tries to display @var{buffer} in a window below the 1995This function tries to display @var{buffer} in a window below the
1987selected window. This means to either split the selected window or 1996selected window. This means to either split the selected window or use
1988reuse the window below the selected one. 1997the window below the selected one. If it does create a new window, it
1998will also adjust its size provided @var{alist} contains a suitable
1999@code{window-height} or @code{window-width} entry, see above.
1989@end defun 2000@end defun
1990 2001
1991@defun display-buffer-in-previous-window buffer alist 2002@defun display-buffer-in-previous-window buffer alist
@@ -2001,6 +2012,83 @@ specified by that entry will override any other window found by the
2001methods above, even if that window never showed @var{buffer} before. 2012methods above, even if that window never showed @var{buffer} before.
2002@end defun 2013@end defun
2003 2014
2015@defun display-buffer-use-some-window buffer alist
2016This function tries to display @var{buffer} by choosing an existing
2017window and displaying the buffer in that window. It can fail if all
2018windows are dedicated to another buffer (@pxref{Dedicated Windows}).
2019@end defun
2020
2021To illustrate the use of action functions, consider the following
2022example.
2023
2024@example
2025@group
2026(display-buffer
2027 (get-buffer-create "*foo*")
2028 '((display-buffer-reuse-window
2029 display-buffer-pop-up-window
2030 display-buffer-pop-up-frame)
2031 (reusable-frames . 0)
2032 (window-height . 10) (window-width . 40)))
2033@end group
2034@end example
2035
2036@noindent
2037Evaluating the form above will cause @code{display-buffer} to proceed as
2038follows: If `*foo*' already appears on a visible or iconified frame, it
2039will reuse its window. Otherwise, it will try to pop up a new window
2040or, if that is impossible, a new frame. If all these steps fail, it
2041will try to use some existing window.
2042
2043 Furthermore, @code{display-buffer} will try to adjust a reused window
2044(provided `*foo*' was put by @code{display-buffer} there before) or a
2045popped-up window as follows: If the window is part of a vertical
2046combination, it will set its height to ten lines. Note that if, instead
2047of the number ``10'', we specified the function
2048@code{fit-window-to-buffer}, @code{display-buffer} would come up with a
2049one-line window to fit the empty buffer. If the window is part of a
2050horizontal combination, it sets its width to 40 columns. Whether a new
2051window is vertically or horizontally combined depends on the shape of
2052the window split and the values of
2053@code{split-window-preferred-function}, @code{split-height-threshold}
2054and @code{split-width-threshold} (@pxref{Choosing Window Options}).
2055
2056 Now suppose we combine this call with a preexisting setup for
2057`display-buffer-alist' as follows.
2058
2059@example
2060@group
2061(let ((display-buffer-alist
2062 (cons
2063 '("\\*foo\\*"
2064 (display-buffer-reuse-window display-buffer-below-selected)
2065 (reusable-frames)
2066 (window-height . 5))
2067 display-buffer-alist)))
2068 (display-buffer
2069 (get-buffer-create "*foo*")
2070 '((display-buffer-reuse-window
2071 display-buffer-pop-up-window
2072 display-buffer-pop-up-frame)
2073 (reusable-frames . 0)
2074 (window-height . 10) (window-width . 40))))
2075@end group
2076@end example
2077
2078@noindent
2079Evaluating this form will cause @code{display-buffer} to first try
2080reusing a window showing @code{*foo*} on the selected frame.
2081If no such window exists, it will try to split the selected window or,
2082if that is impossible, use the window below the selected window.
2083
2084 If there's no window below the selected one, or the window below the
2085selected one is dedicated to its buffer, @code{display-buffer} will
2086proceed as described in the previous example. Note, however, that when
2087it tries to adjust the height of any reused or popped-up window, it will
2088in any case try to set its number of lines to ``5'' since that value
2089overrides the corresponding specification in the @var{action} argument
2090of @code{display-buffer}.
2091
2004 2092
2005@node Choosing Window Options 2093@node Choosing Window Options
2006@section Additional Options for Displaying Buffers 2094@section Additional Options for Displaying Buffers
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog
index 7322613e0db..39931f3a779 100644
--- a/doc/misc/ChangeLog
+++ b/doc/misc/ChangeLog
@@ -1,3 +1,20 @@
12012-11-17 Paul Eggert <eggert@cs.ucla.edu>
2
3 Calc now uses the Gregorian calendar for all dates,
4 and uses January 1, 1 AD as its day number 1.
5 * calc.texi (Date Forms): Document this.
6
72012-11-16 Glenn Morris <rgm@gnu.org>
8
9 * cl.texi (Function Bindings): Clarify that cl-flet is lexical.
10 (Obsolete Macros): Move example here from Function Bindings.
11
12 * erc.texi: Use @code{nil} rather than just "nil".
13 (Modules): Undocument obsolete "hecomplete".
14 Add "notifications".
15 (Connecting): Add brief section on passwords.
16 (Options): Make a start by adding erc-hide-list, erc-lurker-hide-list.
17
12012-11-13 Glenn Morris <rgm@gnu.org> 182012-11-13 Glenn Morris <rgm@gnu.org>
2 19
3 * flymake.texi (Customizable variables) 20 * flymake.texi (Customizable variables)
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 2b198575bcb..6daceb4d41a 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -11010,35 +11010,41 @@ You can use the @kbd{v p} (@code{calc-pack}) and @kbd{v u}
11010of a date form. @xref{Packing and Unpacking}. 11010of a date form. @xref{Packing and Unpacking}.
11011 11011
11012Date forms can go arbitrarily far into the future or past. Negative 11012Date forms can go arbitrarily far into the future or past. Negative
11013year numbers represent years BC. Calc uses a combination of the 11013year numbers represent years BC. There is no ``year 0''; the day
11014Gregorian and Julian calendars, following the history of Great 11014before @samp{<Mon Jan 1, +1>} is @samp{<Sun Dec 31, -1>}. These are
11015Britain and the British colonies. This is the same calendar that 11015days 1 and 0 respectively in Calc's internal numbering scheme. The
11016is used by the @code{cal} program in most Unix implementations. 11016Gregorian calendar is used for all dates, including dates before the
11017Gregorian calendar was invented. Thus Calc's use of the day number
11018@mathit{-10000} to represent August 15, 28 BC should be taken with a
11019grain of salt.
11017 11020
11018@cindex Julian calendar 11021@cindex Julian calendar
11019@cindex Gregorian calendar 11022@cindex Gregorian calendar
11020Some historical background: The Julian calendar was created by 11023Some historical background: The Julian calendar was created by
11021Julius Caesar in the year 46 BC as an attempt to fix the gradual 11024Julius Caesar in the year 46 BC as an attempt to fix the confusion
11022drift caused by the lack of leap years in the calendar used 11025caused by the irregular Roman calendar that was used before that time.
11023until that time. The Julian calendar introduced an extra day in 11026The Julian calendar introduced an extra day in
11024all years divisible by four. After some initial confusion, the 11027all years divisible by four. After some initial confusion, the
11025calendar was adopted around the year we call 8 AD. Some centuries 11028calendar was adopted around the year we call 8 AD, although the years were
11029numbered differently and did not necessarily begin on January 1. Some centuries
11026later it became apparent that the Julian year of 365.25 days was 11030later it became apparent that the Julian year of 365.25 days was
11027itself not quite right. In 1582 Pope Gregory XIII introduced the 11031itself not quite right. In 1582 Pope Gregory XIII introduced the
11028Gregorian calendar, which added the new rule that years divisible 11032Gregorian calendar, which added the new rule that years divisible
11029by 100, but not by 400, were not to be considered leap years 11033by 100, but not by 400, were not to be considered leap years
11030despite being divisible by four. Many countries delayed adoption 11034despite being divisible by four. Many countries delayed adoption
11031of the Gregorian calendar because of religious differences; 11035of the Gregorian calendar because of religious differences, and
11032in Britain it was put off until the year 1752, by which time 11036used differing year numbers and start-of-year for other reasons;
11033the Julian calendar had fallen eleven days behind the true 11037for example, in early 1752 England changed the start of its year from
11034seasons. So the switch to the Gregorian calendar in early 11038March 25 to January 1, and in September it switched to the Gregorian
11035September 1752 introduced a discontinuity: The day after 11039calendar: in England, the day after December 31, 1750 was January 1,
11036Sep 2, 1752 is Sep 14, 1752. Calc follows this convention. 110401750 and the day after March 24, 1750 was March 25, 1751, but the day
11037To take another example, Russia waited until 1918 before 11041after December 31, 1751 was January 1, 1752 and the day after
11038adopting the new calendar, and thus needed to remove thirteen 11042September 2, 1752 was September 14, 1752. To take another example,
11039days (between Feb 1, 1918 and Feb 14, 1918). This means that 11043Russia switched both year numbering and start-of-year in 1700, but did
11040Calc's reckoning will be inconsistent with Russian history between 11044not adopt the Gregorian calendar until 1918. Calc's reckoning
110411752 and 1918, and similarly for various other countries. 11045therefore matches English practice starting in 1752 and Russian
11046practice starting in 1918, but disagrees with earlier dates in both
11047countries.
11042 11048
11043Today's timekeepers introduce an occasional ``leap second'' as 11049Today's timekeepers introduce an occasional ``leap second'' as
11044well, but Calc does not take these minor effects into account. 11050well, but Calc does not take these minor effects into account.
@@ -11046,15 +11052,6 @@ well, but Calc does not take these minor effects into account.
11046between, say, @samp{<12:00am Mon Jan 1, 1900>} and 11052between, say, @samp{<12:00am Mon Jan 1, 1900>} and
11047@samp{<12:00am Sat Jan 1, 2000>}.) 11053@samp{<12:00am Sat Jan 1, 2000>}.)
11048 11054
11049Calc uses the Julian calendar for all dates before the year 1752,
11050including dates BC when the Julian calendar technically had not
11051yet been invented. Thus the claim that day number @mathit{-10000} is
11052called ``August 16, 28 BC'' should be taken with a grain of salt.
11053
11054Please note that there is no ``year 0''; the day before
11055@samp{<Sat Jan 1, +1>} is @samp{<Fri Dec 31, -1>}. These are
11056days 0 and @mathit{-1} respectively in Calc's internal numbering scheme.
11057
11058@cindex Julian day counting 11055@cindex Julian day counting
11059Another day counting system in common use is, confusingly, also called 11056Another day counting system in common use is, confusingly, also called
11060``Julian.'' The Julian day number is the numbers of days since 11057``Julian.'' The Julian day number is the numbers of days since
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index a50be1027f3..beefa3e9c40 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -1292,28 +1292,14 @@ it were a @code{cl-defun} form. The function @var{name} is defined
1292accordingly for the duration of the body of the @code{cl-flet}; then 1292accordingly for the duration of the body of the @code{cl-flet}; then
1293the old function definition, or lack thereof, is restored. 1293the old function definition, or lack thereof, is restored.
1294 1294
1295You can use @code{cl-flet} to disable or modify the behavior of a 1295You can use @code{cl-flet} to disable or modify the behavior of
1296function in a temporary fashion. (Compare this with the idea 1296functions (including Emacs primitives) in a temporary, localized fashion.
1297of advising functions. 1297(Compare this with the idea of advising functions.
1298@xref{Advising Functions,,,elisp,GNU Emacs Lisp Reference Manual}.) 1298@xref{Advising Functions,,,elisp,GNU Emacs Lisp Reference Manual}.)
1299This will even work on Emacs primitives, although note that some calls
1300to primitive functions internal to Emacs are made without going
1301through the symbol's function cell, and so will not be affected by
1302@code{cl-flet}. For example,
1303
1304@example
1305(cl-flet ((message (&rest args) (push args saved-msgs)))
1306 (do-something))
1307@end example
1308 1299
1309This code attempts to replace the built-in function @code{message} 1300The bindings are lexical in scope. This means that all references to
1310with a function that simply saves the messages in a list rather 1301the named functions must appear physically within the body of the
1311than displaying them. The original definition of @code{message} 1302@code{cl-flet} form.
1312will be restored after @code{do-something} exits. This code will
1313work fine on messages generated by other Lisp code, but messages
1314generated directly inside Emacs will not be caught since they make
1315direct C-language calls to the message routines rather than going
1316through the Lisp @code{message} function.
1317 1303
1318Functions defined by @code{cl-flet} may use the full Common Lisp 1304Functions defined by @code{cl-flet} may use the full Common Lisp
1319argument notation supported by @code{cl-defun}; also, the function 1305argument notation supported by @code{cl-defun}; also, the function
@@ -1321,7 +1307,8 @@ body is enclosed in an implicit block as if by @code{cl-defun}.
1321@xref{Program Structure}. 1307@xref{Program Structure}.
1322 1308
1323Note that the @file{cl.el} version of this macro behaves slightly 1309Note that the @file{cl.el} version of this macro behaves slightly
1324differently. @xref{Obsolete Macros}. 1310differently. In particular, its binding is dynamic rather than
1311lexical. @xref{Obsolete Macros}.
1325@end defmac 1312@end defmac
1326 1313
1327@defmac cl-labels (bindings@dots{}) forms@dots{} 1314@defmac cl-labels (bindings@dots{}) forms@dots{}
@@ -4863,6 +4850,25 @@ time before Emacs had lexical binding). The result is
4863that @code{flet} affects indirect calls to a function as well as calls 4850that @code{flet} affects indirect calls to a function as well as calls
4864directly inside the @code{flet} form itself. 4851directly inside the @code{flet} form itself.
4865 4852
4853This will even work on Emacs primitives, although note that some calls
4854to primitive functions internal to Emacs are made without going
4855through the symbol's function cell, and so will not be affected by
4856@code{flet}. For example,
4857
4858@example
4859(flet ((message (&rest args) (push args saved-msgs)))
4860 (do-something))
4861@end example
4862
4863This code attempts to replace the built-in function @code{message}
4864with a function that simply saves the messages in a list rather
4865than displaying them. The original definition of @code{message}
4866will be restored after @code{do-something} exits. This code will
4867work fine on messages generated by other Lisp code, but messages
4868generated directly inside Emacs will not be caught since they make
4869direct C-language calls to the message routines rather than going
4870through the Lisp @code{message} function.
4871
4866@c Bug#411. 4872@c Bug#411.
4867Note that many primitives (e.g.@: @code{+}) have special byte-compile 4873Note that many primitives (e.g.@: @code{+}) have special byte-compile
4868handling. Attempts to redefine such functions using @code{flet} will 4874handling. Attempts to redefine such functions using @code{flet} will
diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi
index 378180bef31..834d2ea844d 100644
--- a/doc/misc/erc.texi
+++ b/doc/misc/erc.texi
@@ -390,11 +390,6 @@ Complete nicknames and commands (programmable)
390@item fill 390@item fill
391Wrap long lines 391Wrap long lines
392 392
393@cindex modules, hecomplete
394@item hecomplete
395Complete nicknames and commands (old). This is the old module---you
396might prefer the ``completion'' module instead.
397
398@cindex modules, identd 393@cindex modules, identd
399@item identd 394@item identd
400Launch an identd server on port 8113 395Launch an identd server on port 8113
@@ -427,6 +422,11 @@ Don't display non-IRC commands after evaluation
427@item notify 422@item notify
428Notify when the online status of certain users changes 423Notify when the online status of certain users changes
429 424
425@cindex modules, notifications
426@item notifications
427Send you a notification when you get a private message,
428or your nickname is mentioned
429
430@cindex modules, page 430@cindex modules, page
431@item page 431@item page
432Process CTCP PAGE requests from IRC 432Process CTCP PAGE requests from IRC
@@ -530,7 +530,7 @@ parameters.
530@defun erc-compute-server &optional server 530@defun erc-compute-server &optional server
531Return an IRC server name. 531Return an IRC server name.
532 532
533This tries a number of increasingly more default methods until a non-nil 533This tries a number of increasingly more default methods until a non-@code{nil}
534value is found. 534value is found.
535 535
536@itemize @bullet 536@itemize @bullet
@@ -542,7 +542,7 @@ value is found.
542 542
543@end defun 543@end defun
544 544
545@defopt erc-server nil 545@defopt erc-server
546IRC server to use if one is not provided. 546IRC server to use if one is not provided.
547@end defopt 547@end defopt
548 548
@@ -551,7 +551,7 @@ IRC server to use if one is not provided.
551@defun erc-compute-port &optional port 551@defun erc-compute-port &optional port
552Return a port for an IRC server. 552Return a port for an IRC server.
553 553
554This tries a number of increasingly more default methods until a non-nil 554This tries a number of increasingly more default methods until a non-@code{nil}
555value is found. 555value is found.
556 556
557@itemize @bullet 557@itemize @bullet
@@ -574,7 +574,7 @@ This can be either a string or a number.
574Return user's IRC nick. 574Return user's IRC nick.
575 575
576This tries a number of increasingly more default methods until a 576This tries a number of increasingly more default methods until a
577non-nil value is found. 577non-@code{nil} value is found.
578 578
579@itemize 579@itemize
580@item @var{nick} (the argument passed to this function) 580@item @var{nick} (the argument passed to this function)
@@ -598,19 +598,43 @@ The string to append to the nick if it is already in use.
598@end defopt 598@end defopt
599 599
600@defopt erc-try-new-nick-p 600@defopt erc-try-new-nick-p
601If the nickname you chose isn't available, and this option is non-nil, 601If the nickname you chose isn't available, and this option is non-@code{nil},
602ERC should automatically attempt to connect with another nickname. 602ERC should automatically attempt to connect with another nickname.
603 603
604You can manually set another nickname with the /NICK command. 604You can manually set another nickname with the /NICK command.
605@end defopt 605@end defopt
606 606
607@subheading Password
608@cindex password
609
610@defopt erc-prompt-for-password
611If non-@code{nil} (the default), @kbd{M-x erc} prompts for a password.
612@end defopt
613
614If you prefer, you can set this option to @code{nil} and use the
615@code{auth-source} mechanism to store your password. For instance, if
616you use @file{~/.authinfo} as your auth-source backend, then put
617something like the following in that file:
618
619@example
620machine irc.example.net login "#fsf" password sEcReT
621@end example
622
623@noindent
624ERC also consults @code{auth-source} to find any channel keys required
625for the channels that you wish to autojoin, as specified by the
626variable @code{erc-autojoin-channels-alist}.
627
628For more details, @pxref{Top,,auth-source, auth, Emacs auth-source Library}.
629
630
607@subheading Full name 631@subheading Full name
608 632
609@defun erc-compute-full-name &optional full-name 633@defun erc-compute-full-name &optional full-name
610Return user's full name. 634Return user's full name.
611 635
612This tries a number of increasingly more default methods until a 636This tries a number of increasingly more default methods until a
613non-nil value is found. 637non-@code{nil} value is found.
614 638
615@itemize @bullet 639@itemize @bullet
616@item @var{full-name} (the argument passed to this function) 640@item @var{full-name} (the argument passed to this function)
@@ -713,10 +737,24 @@ stuff, to the current ERC buffer."
713@c PRE5_4: (Node) Document every ERC option (module options go in 737@c PRE5_4: (Node) Document every ERC option (module options go in
714@c previous chapter) 738@c previous chapter)
715 739
716This section has not yet been written. For now, the easiest way to 740This section is extremely incomplete. For now, the easiest way to
717check out the available options for ERC is to do 741check out all the available options for ERC is to do
718@kbd{M-x customize-group erc RET}. 742@kbd{M-x customize-group erc RET}.
719 743
744@defopt erc-hide-list
745If non, @code{nil}, this is a list of IRC message types to hide, e.g.
746
747@example
748(setq erc-hide-list '("JOIN" "PART" "QUIT"))
749@end example
750@end defopt
751
752@defopt erc-lurker-hide-list
753Like @code{erc-hide-list}, but only applies to messages sent by
754lurkers. The function @code{erc-lurker-p} determines whether a given
755nickname is considerd a lurker.
756@end defopt
757
720 758
721@node Getting Help and Reporting Bugs 759@node Getting Help and Reporting Bugs
722@chapter Getting Help and Reporting Bugs 760@chapter Getting Help and Reporting Bugs
diff --git a/etc/NEWS b/etc/NEWS
index 58acf81897c..57e40982af6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -61,6 +61,11 @@ and redirect them to your own function instead of `fset'.
61 61
62* Changes in Emacs 24.4 on non-free operating systems 62* Changes in Emacs 24.4 on non-free operating systems
63 63
64+++
65** The "generate a backtrace on fatal error" feature now works on MS Windows.
66The backtrace is written to the 'emacs_backtrace.txt' file in the
67directory where Emacs was running.
68
64 69
65* Installation Changes in Emacs 24.3 70* Installation Changes in Emacs 24.3
66 71
@@ -361,6 +366,8 @@ provide the old non-prefixed names. Some exceptions are listed below.
361+++ 366+++
362*** `cl-flet' is not like `flet' (which is deprecated). 367*** `cl-flet' is not like `flet' (which is deprecated).
363Instead it obeys the behavior of Common-Lisp's `flet'. 368Instead it obeys the behavior of Common-Lisp's `flet'.
369In particular, in cl-flet function definitions are lexically scoped,
370whereas in flet the scoping is dynamic.
364 371
365+++ 372+++
366*** `cl-labels' is slightly different from `labels'. 373*** `cl-labels' is slightly different from `labels'.
@@ -475,13 +482,19 @@ The global binding for `M-=', `count-words-region' is in effect.
475 482
476** ERC 483** ERC
477 484
478*** New package `erc-desktop-notifications.el', which can send a notification 485+++
479when you receive a private message or your nickname is mentioned. 486*** New module "notifications", which can send a notification when you
487receive a private message or your nickname is mentioned.
480 488
489+++
481*** ERC will look up server/channel names via auth-source and use any 490*** ERC will look up server/channel names via auth-source and use any
482channel keys found. 491channel keys found.
483 492
484+++ 493+++
494*** New option `erc-lurker-hide-list', similar to `erc-hide-list', but
495only applies to messages sent by lurkers.
496
497+++
485** Flymake uses fringe bitmaps to indicate errors and warnings. 498** Flymake uses fringe bitmaps to indicate errors and warnings.
486See `flymake-fringe-indicator-position', `flymake-error-bitmap' and 499See `flymake-fringe-indicator-position', `flymake-error-bitmap' and
487`flymake-warning-bitmap'. 500`flymake-warning-bitmap'.
@@ -668,8 +681,7 @@ enabled, applies to all applicable major modes.
668** winner-mode-hook now runs when the mode is disabled, as well as when it is 681** winner-mode-hook now runs when the mode is disabled, as well as when it is
669enabled. 682enabled.
670 683
671** FIXME something happened to ses.el, 2012-04-17. 684+++
672
673** Hooks renamed to avoid obsolete "-hooks" suffix: 685** Hooks renamed to avoid obsolete "-hooks" suffix:
674*** semantic-lex-reset-hooks -> semantic-lex-reset-functions 686*** semantic-lex-reset-hooks -> semantic-lex-reset-functions
675*** semantic-change-hooks -> semantic-change-functions 687*** semantic-change-hooks -> semantic-change-functions
@@ -846,6 +858,7 @@ More commands use `read-regexp' now to read their regexp arguments.
846*** New function `completion-table-with-quoting' to handle completion 858*** New function `completion-table-with-quoting' to handle completion
847in the presence of quoting, such as file completion in shell buffers. 859in the presence of quoting, such as file completion in shell buffers.
848 860
861+++
849*** New function `completion-table-subvert' to use an existing completion 862*** New function `completion-table-subvert' to use an existing completion
850table, but with a different prefix. 863table, but with a different prefix.
851 864
@@ -874,24 +887,33 @@ now accept a third argument to avoid choosing the selected window.
874+++ 887+++
875*** Additional values recognized for option `window-combination-limit'. 888*** Additional values recognized for option `window-combination-limit'.
876 889
877*** New macro `with-temp-buffer-window'. 890+++
891*** New macro `with-temp-buffer-window', similar to
892`with-output-to-temp-buffer'.
878 893
894---
879*** `temp-buffer-resize-mode' no longer resizes windows that have been 895*** `temp-buffer-resize-mode' no longer resizes windows that have been
880reused. 896reused.
881 897
882*** New function `fit-frame-to-buffer' and new options 898+++
883`fit-frame-to-buffer' and `fit-frame-to-buffer-bottom-margin'. 899*** New command `fit-frame-to-buffer' adjusts the frame height to
900fit the contents.
901
902+++
903*** The command `fit-window-to-buffer' can adjust the frame height
904if the new option `fit-frame-to-buffer' is non-nil.
905
884+++ 906+++
885*** New option switch-to-buffer-preserve-window-point to restore a 907*** New option switch-to-buffer-preserve-window-point to restore a
886window's point when switching buffers. 908window's point when switching buffers.
887+++ 909+++
888*** New display action functions `display-buffer-below-selected', 910*** New display action functions `display-buffer-below-selected',
889and `display-buffer-in-previous-window'. 911and `display-buffer-in-previous-window'.
890 912+++
891*** New display action alist entry `inhibit-switch-frame', if non-nil, 913*** New display action alist entry `inhibit-switch-frame', if non-nil,
892tells display action functions to avoid changing which frame is 914tells display action functions to avoid changing which frame is
893selected. 915selected.
894 916+++
895*** New display action alist entry `pop-up-frame-parameters', if 917*** New display action alist entry `pop-up-frame-parameters', if
896non-nil, specifies frame parameters to give any newly-created frame. 918non-nil, specifies frame parameters to give any newly-created frame.
897+++ 919+++
@@ -947,13 +969,14 @@ Previously, they returned NaNs on some platforms but signaled errors
947on others. The affected functions are acos, asin, tan, exp, expt, 969on others. The affected functions are acos, asin, tan, exp, expt,
948log, log10, sqrt, and mod. 970log, log10, sqrt, and mod.
949 971
950** Interpreted files are eagerly macro-expanded during load. 972+++
973** Emacs tries to macroexpand interpreted (non-compiled) files during load.
951This can significantly speed up execution of non-byte-compiled code, 974This can significantly speed up execution of non-byte-compiled code,
952but can also bump into harmless and previously unnoticed cyclic 975but can also bump into previously unnoticed cyclic dependencies.
953dependencies. These should not be fatal: they will simply cause the 976These are generally harmless: they will simply cause the macro calls
954macro-calls to be left for later expansion (as before), but will also 977to be left for later expansion (as before), but will result in a
955result in a warning ("Eager macro-expansion skipped due to cycle") 978warning ("Eager macro-expansion skipped due to cycle") describing the cycle.
956describing the cycle. 979You may wish to restructure your code so this does not happen.
957 980
958** Miscellaneous new functions: 981** Miscellaneous new functions:
959+++ 982+++
@@ -968,7 +991,9 @@ describing the cycle.
968*** `function-get' fetches a function property, following aliases. 991*** `function-get' fetches a function property, following aliases.
969+++ 992+++
970*** `posnp' tests if an object is a `posn'. 993*** `posnp' tests if an object is a `posn'.
971*** `set-temporary-overlay-map' sets up a temporary overlay map. 994+++
995*** `set-temporary-overlay-map' sets up a temporary keymap that
996takes precedence over most other maps for a short while (normally one key).
972+++ 997+++
973*** `system-users' returns the user names on the system. 998*** `system-users' returns the user names on the system.
974+++ 999+++
@@ -982,8 +1007,8 @@ describing the cycle.
982+++ 1007+++
983** New fringe bitmap `exclamation-mark'. 1008** New fringe bitmap `exclamation-mark'.
984 1009
1010+++
985** Face underlining can now use a wave. 1011** Face underlining can now use a wave.
986See the "Face Attributes" section of the Elisp manual.
987 1012
988** The following functions and variables are obsolete: 1013** The following functions and variables are obsolete:
989--- 1014---
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 03cddc6a035..926297b6dd3 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,13 @@
12012-11-17 Juanma Barranquero <lekktu@gmail.com>
2
3 * makefile.w32-in (SYSWAIT_H): New macro.
4 ($(BLD)/movemail.$(O)): Update dependencies.
5
62012-11-17 Paul Eggert <eggert@cs.ucla.edu>
7
8 Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
9 * movemail.c, update-game-score.c: Assume <fcntl.h> exists.
10
12012-10-26 Glenn Morris <rgm@gnu.org> 112012-10-26 Glenn Morris <rgm@gnu.org>
2 12
3 * Makefile.in (uninstall): No INSTALLABLES live in archlibdir. 13 * Makefile.in (uninstall): No INSTALLABLES live in archlibdir.
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index f3ab4421fd3..cbd29f32cfe 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -374,6 +374,8 @@ NTLIB_H = $(LIB_SRC)/ntlib.h \
374SYSTIME_H = $(SRC)/systime.h \ 374SYSTIME_H = $(SRC)/systime.h \
375 $(NT_INC)/sys/time.h \ 375 $(NT_INC)/sys/time.h \
376 $(GNU_LIB)/timespec.h 376 $(GNU_LIB)/timespec.h
377SYSWAIT_H = $(SRC)/syswait.h \
378 $(NT_INC)/sys/wait.h
377 379
378$(BLD)/ctags.$(O) : \ 380$(BLD)/ctags.$(O) : \
379 $(LIB_SRC)/ctags.c \ 381 $(LIB_SRC)/ctags.c \
@@ -419,14 +421,14 @@ $(BLD)/make-docfile.$(O) : \
419$(BLD)/movemail.$(O) : \ 421$(BLD)/movemail.$(O) : \
420 $(LIB_SRC)/movemail.c \ 422 $(LIB_SRC)/movemail.c \
421 $(LIB_SRC)/pop.h \ 423 $(LIB_SRC)/pop.h \
422 $(SRC)/syswait.h \
423 $(NT_INC)/pwd.h \ 424 $(NT_INC)/pwd.h \
424 $(NT_INC)/sys/file.h \ 425 $(NT_INC)/sys/file.h \
425 $(NT_INC)/sys/stat.h \ 426 $(NT_INC)/sys/stat.h \
426 $(NT_INC)/unistd.h \ 427 $(NT_INC)/unistd.h \
427 $(GNU_LIB)/getopt.h \ 428 $(GNU_LIB)/getopt.h \
428 $(CONFIG_H) \ 429 $(CONFIG_H) \
429 $(NTLIB_H) 430 $(NTLIB_H) \
431 $(SYSWAIT_H)
430 432
431$(BLD)/ntlib.$(O) : \ 433$(BLD)/ntlib.$(O) : \
432 $(LIB_SRC)/ntlib.c \ 434 $(LIB_SRC)/ntlib.c \
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 32d32e69abf..cd329a110a8 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -65,9 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
65 65
66#include <getopt.h> 66#include <getopt.h>
67#include <unistd.h> 67#include <unistd.h>
68#ifdef HAVE_FCNTL_H
69#include <fcntl.h> 68#include <fcntl.h>
70#endif
71#include <string.h> 69#include <string.h>
72#include "syswait.h" 70#include "syswait.h"
73#ifdef MAIL_USE_POP 71#ifdef MAIL_USE_POP
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 40397536fad..59cab61aa29 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -42,9 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42#include <time.h> 42#include <time.h>
43#include <pwd.h> 43#include <pwd.h>
44#include <ctype.h> 44#include <ctype.h>
45#ifdef HAVE_FCNTL_H
46#include <fcntl.h> 45#include <fcntl.h>
47#endif
48#include <sys/stat.h> 46#include <sys/stat.h>
49#include <getopt.h> 47#include <getopt.h>
50 48
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index f74c46ae9c8..834f63169e2 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -21,7 +21,7 @@
21# the same distribution terms as the rest of that program. 21# the same distribution terms as the rest of that program.
22# 22#
23# Generated by gnulib-tool. 23# Generated by gnulib-tool.
24# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings 24# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=at-internal --avoid=errno --avoid=fchdir --avoid=fcntl --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=openat-die --avoid=openat-h --avoid=raise --avoid=save-cwd --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat close-stream crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl-h filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timer-time timespec-add timespec-sub utimens warnings
25 25
26 26
27MOSTLYCLEANFILES += core *.stackdump 27MOSTLYCLEANFILES += core *.stackdump
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 99bfabb8115..ca65e431964 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,233 @@
12012-11-18 Chong Yidong <cyd@gnu.org>
2
3 * filecache.el (file-cache--read-list): New function.
4 (file-cache-add-directory-list, file-cache-add-file-list)
5 (file-cache-delete-file-list, file-cache-delete-directory-list):
6 Use it to read a list of files or directories (Bug#12846).
7 (file-cache-add-file, file-cache-add-directory)
8 (file-cache-delete-file-list, file-cache-delete-file-regexp)
9 (file-cache-delete-directory): Print an message.
10
112012-11-18 Jay Belanger <jay.p.belanger@gmail.com>
12
13 * calc/calc-forms.el (math-date-to-dt): Use integer date when
14 calling `math-date-to-julian-dt' and 'math-date-to-gregorian-dt'.
15
162012-11-18 Glenn Morris <rgm@gnu.org>
17
18 * image.el (insert-image, insert-sliced-image): Doc fix.
19
202012-11-18 Chong Yidong <cyd@gnu.org>
21
22 * emacs-lisp/syntax.el (syntax-propertize-function): Doc fix
23 (Bug#12810).
24
252012-11-18 OKAZAKI Tetsurou <okazaki.tetsurou@gmail.com> (tiny change)
26
27 * vc/vc-svn.el (vc-svn-merge-news): Properly parse the merge
28 response when the target file is in a subdirectory (Bug#12757).
29
302012-11-18 Chong Yidong <cyd@gnu.org>
31
32 * filecache.el (file-cache-add-file-list): Doc fix (Bug#12694).
33
342012-11-18 Glenn Morris <rgm@gnu.org>
35
36 * emacs-lisp/cl-lib.el (face-underline-p):
37 Use set-face-underline rather than the alias set-face-underline-p.
38
39 * window.el (with-temp-buffer-window): Doc fix.
40 * subr.el (with-output-to-temp-buffer):
41 Add doc xref to with-temp-buffer-window.
42
432012-11-18 Juanma Barranquero <lekktu@gmail.com>
44
45 * woman.el (woman-non-underline-faces): Use `set-face-underline'.
46 * calc/calc.el (math-format-date-cache): Declare.
47
482012-11-17 Paul Eggert <eggert@cs.ucla.edu>
49
50 * calc/calc-forms.el (math-julian-date-beginning)
51 (math-julian-date-beginning-int): Implement [new date numbering].
52
532012-11-17 Juanma Barranquero <lekktu@gmail.com>
54
55 * descr-text.el (quail-find-key):
56 * dired.el (desktop-file-name):
57 * dirtrack.el (shell-prefixed-directory-name, shell-process-cd):
58 * generic-x.el (comint-mode, comint-exec):
59 * image-dired.el (widget-forward):
60 * info.el (speedbar-add-expansion-list, speedbar-center-buffer-smartly)
61 (speedbar-change-expand-button-char)
62 (speedbar-change-initial-expansion-list, speedbar-delete-subblock)
63 (speedbar-make-specialized-keymap, speedbar-make-tag-line):
64 * printing.el (easy-menu-add-item, easy-menu-remove-item)
65 (widget-field-action, widget-value-set):
66 * speedbar.el (imenu--make-index-alist):
67 * term.el (ring-empty-p, ring-ref, ring-insert-at-beginning)
68 (ring-length, ring-insert):
69 * vcursor.el (compare-windows-skip-whitespace):
70 * woman.el (dired-get-filename):
71 Declare functions.
72
73 * term/w32-win.el (cygwin-convert-path-from-windows): Fix declaration.
74
752012-11-17 Jay Belanger <jay.p.belanger@gmail.com>
76
77 * calc/calc.el (calc-gregorian-switch): New variable.
78
79 * calc/calc-forms.el (math-day-in-year, math-dt-before-p)
80 (math-absolute-from-gregorian-dt, math-absolute-from-julian-dt)
81 (math-date-to-julian-dt, math-date-to-gregorian-dt): New functions.
82 (math-leap-year-p): Add option to distinguish between Julian
83 and Gregorian calendars.
84 (math-day-number): Use `math-day-in-year' to do the computations.
85 (math-absolute-from-dt): Rename from `math-absolute-from-date'.
86 Use `math-absolute-from-gregorian' and `math-absolute-from-julian'
87 to do the computations.
88 (math-date-to-dt): Use `math-date-to-julian-dt' and
89 `math-date-to-gregorian-dt' to do the computations.
90 (calcFunc-weekday, math-format-date-part): Use the new version of
91 the DATE to determine the weekday.
92 (calcFunc-newmonth, calcFunc-newyear): Use `calc-gregorian-switch'
93 when necessary.
94
952012-11-17 Eli Zaretskii <eliz@gnu.org>
96
97 * term/w32-win.el (w32-handle-dropped-file): Use 'file://' only on
98 Cygwin; otherwise use 'file:'. (Bug#12914)
99 (cygwin-convert-path-from-windows): Declare, to avoid
100 byte-compiler warnings.
101
1022012-11-17 Andreas Politz <politza@fh-trier.de>
103
104 * ibuffer.el (ibuffer-mark-forward, ibuffer-unmark-forward)
105 (ibuffer-unmark-backward, ibuffer-mark-interactive): Support plain
106 prefix and negative numeric prefix args (Bug#12795).
107
1082012-11-17 Stephen Berman <stephen.berman@gmx.net>
109
110 * play/gamegrid.el (gamegrid-add-score-with-update-game-score-1):
111 Don't signal an error with a score that is too low to add to the
112 list of top scores. (Bug#12779)
113
1142012-11-17 Chong Yidong <cyd@gnu.org>
115
116 * help-mode.el (help-xref-interned): End on point-min (Bug#12737).
117
118 * filecache.el (file-cache-add-file): Handle relative file name in
119 the argument (Bug#12694).
120
1212012-11-16 Jürgen Hötzel <juergen@archlinux.org> (tiny change)
122
123 * eshell/em-unix.el (eshell/mkdir): Handle "--parents" (bug#12897).
124
1252012-11-16 Stefan Monnier <monnier@iro.umontreal.ca>
126
127 * emacs-lisp/advice.el (ad-make-advised-definition): Improve last fix.
128
129 * emacs-lisp/cl-lib.el: Set more meaningful version number.
130
1312012-11-16 Martin Rudalics <rudalics@gmx.at>
132
133 * window.el (enlarge-window, shrink-window): Don't mention return
134 value in doc-string (Bug#12896).
135 (window--display-buffer): Don't resize frames - it won't work
136 with all window managers and defeat pop-up-frame-alist.
137 (display-buffer-alist): In doc-string explain that CONDITION can
138 be a function and which arguments are passed to it (Bug#12854).
139 (display-buffer-assq-regexp): New argument ACTION. Handle lambda
140 expressions (Bug#12854).
141 (display-buffer): Pass ACTION argument to
142 display-buffer-assq-regexp.
143
1442012-11-16 Glenn Morris <rgm@gnu.org>
145
146 * window.el (fit-frame-to-buffer-bottom-margin)
147 (fit-frame-to-buffer, fit-window-to-buffer): Doc fixes.
148
149 * faces.el (face-underline-p): Use face-attribute-specified-or.
150
1512012-11-16 Juanma Barranquero <lekktu@gmail.com>
152
153 * emacs-lisp/cl-macs.el (cl-loop, cl-do, cl-do*): Doc fixes.
154
1552012-11-16 Stefan Monnier <monnier@iro.umontreal.ca>
156
157 * emacs-lisp/cl-macs.el (cl-flet, cl-flet*): Fix docstring (bug#12895).
158
1592012-11-16 Glenn Morris <rgm@gnu.org>
160
161 * eshell/em-cmpl.el (eshell-pcomplete): New command. (Bug#12838)
162 (eshell-cmpl-initialize): Bind eshell-pcomplete to TAB, C-i.
163
164 * faces.el (face-underline-p): Doc fix. Handle :underline being
165 things other than `t' (a string, a list).
166 (face-inverse-video-p): Doc fix.
167 (set-face-underline): Rename it back from set-face-underline-p.
168 Doc fix. Allow interactive input of values other than t.
169 (read-face-attribute): Apply formatting to :underline,
170 since like :box and :stipple it can take list values.
171
172 * term.el (ansi-term): Don't let C-x escape-char binding
173 clobber the more standard C-c binding. (Bug#12842)
174
175 * subr.el (set-temporary-overlay-map): Doc fix.
176
1772012-11-16 Martin Rudalics <rudalics@gmx.at>
178
179 * window.el (record-window-buffer)
180 (display-buffer-record-window): When copying the markers to
181 window-point preserve window-point-insertion-type. (Bug#12588)
182
1832012-11-16 Glenn Morris <rgm@gnu.org>
184
185 * emacs-lisp/eieio-datadebug.el (eieio-debug-methodinvoke):
186 * net/tramp-gvfs.el (tramp-gvfs-dbus-event-error):
187 Use new names for hooks rather than obsolete aliases.
188
1892012-11-15 Daniel Colascione <dancol@dancol.org>
190
191 * term/w32-win.el (w32-handle-dropped-file): Use a "file://"
192 prefix instead of "file:" so that when FILE-NAME begins with "//",
193 as it does when the target file is on a network share, url-handler
194 isn't confused.
195
1962012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
197
198 * emacs-lisp/advice.el (ad-definition-type): Make sure we don't use
199 a preactivated advice from an old advice.el; they're not compatible!
200
2012012-11-15 Katsumi Yamaoka <yamaoka@jpl.org>
202
203 * emacs-lisp/nadvice.el (advice--make-interactive-form):
204 Fix string-spec case.
205
206 * emacs-lisp/advice.el (ad-make-advised-definition): Fix undefined case.
207
2082012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
209
210 * emacs-lisp/nadvice.el: Add buffer-local support to add-function.
211 (advice--buffer-local-function-sample): New var.
212 (advice--set-buffer-local, advice--buffer-local): New functions.
213 (add-function, remove-function): Use them.
214
2152012-11-15 Drew Adams <drew.adams@oracle.com>
216
217 * imenu.el (imenu--split-submenus): Use imenu--subalist-p (bug#12717).
218
2192012-11-15 Stefan Monnier <monnier@iro.umontreal.ca>
220
221 * emacs-lisp/cl-macs.el (cl--transform-lambda): Defend against
222 potential binding of print-gensym to t, and prettify (back)quotes in
223 case they appear in args's default values (bug#12884).
224
2252012-11-14 Stefan Monnier <monnier@iro.umontreal.ca>
226
227 * emacs-lisp/nadvice.el: Add around advice for interactive specs.
228 (advice-eval-interactive-spec): New function.
229 (advice--make-interactive-form): Support around advice (bug#12844).
230
12012-11-14 Dmitry Gutov <dgutov@yandex.ru> 2312012-11-14 Dmitry Gutov <dgutov@yandex.ru>
2 232
3 * progmodes/ruby-mode.el (ruby-expr-beg): Make heredoc detection 233 * progmodes/ruby-mode.el (ruby-expr-beg): Make heredoc detection
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index cebd4302d0c..9fc91a242d2 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -96,7 +96,7 @@
96;; 96;;
97;; archive-mode-hook 97;; archive-mode-hook
98;; archive-foo-mode-hook 98;; archive-foo-mode-hook
99;; archive-extract-hooks 99;; archive-extract-hook
100 100
101;;; Code: 101;;; Code:
102 102
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index bd748158d66..709250f9ba9 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -369,17 +369,67 @@
369 369
370;;; Some of these functions are adapted from Edward Reingold's "calendar.el". 370;;; Some of these functions are adapted from Edward Reingold's "calendar.el".
371;;; These versions are rewritten to use arbitrary-size integers. 371;;; These versions are rewritten to use arbitrary-size integers.
372;;; The Julian calendar is used up to 9/2/1752, after which the Gregorian
373;;; calendar is used; the first day after 9/2/1752 is 9/14/1752.
374 372
375;;; A numerical date is the number of days since midnight on 373;;; A numerical date is the number of days since midnight on
376;;; the morning of January 1, 1 A.D. If the date is a non-integer, 374;;; the morning of December 31, 1 B.C. Emacs's calendar refers to such
377;;; it represents a specific date and time. 375;;; a date as an absolute date, some function names also use that
376;;; terminology. If the date is a non-integer, it represents a specific date and time.
378;;; A "dt" is a list of the form, (year month day), corresponding to 377;;; A "dt" is a list of the form, (year month day), corresponding to
379;;; an integer code, or (year month day hour minute second), corresponding 378;;; an integer code, or (year month day hour minute second), corresponding
380;;; to a non-integer code. 379;;; to a non-integer code.
381 380
381(defun math-date-to-gregorian-dt (date)
382 "Return the day (YEAR MONTH DAY) in the Gregorian calendar.
383DATE is the number of days since December 31, -1 in the Gregorian calendar."
384 (let* ((month 1)
385 day
386 (year (math-quotient (math-add date (if (Math-lessp date 711859)
387 365 ; for speed, we take
388 -108)) ; >1950 as a special case
389 (if (math-negp date) 366 365)))
390 ; this result may be an overestimate
391 temp)
392 (while (Math-lessp date (setq temp (math-absolute-from-gregorian-dt year 1 1)))
393 (setq year (math-add year -1)))
394 (if (eq year 0) (setq year -1))
395 (setq date (1+ (math-sub date temp)))
396 (setq temp
397 (if (math-leap-year-p year)
398 [1 32 61 92 122 153 183 214 245 275 306 336 999]
399 [1 32 60 91 121 152 182 213 244 274 305 335 999]))
400 (while (>= date (aref temp month))
401 (setq month (1+ month)))
402 (setq day (1+ (- date (aref temp (1- month)))))
403 (list year month day)))
404
405(defun math-date-to-julian-dt (date)
406 "Return the day (YEAR MONTH DAY) in the Julian calendar.
407DATE is the number of days since December 31, -1 in the Gregorian calendar."
408 (let* ((month 1)
409 day
410 (year (math-quotient (math-add date (if (Math-lessp date 711859)
411 365 ; for speed, we take
412 -108)) ; >1950 as a special case
413 (if (math-negp date) 366 365)))
414 ; this result may be an overestimate
415 temp)
416 (while (Math-lessp date (setq temp (math-absolute-from-julian-dt year 1 1)))
417 (setq year (math-add year -1)))
418 (if (eq year 0) (setq year -1))
419 (setq date (1+ (math-sub date temp)))
420 (setq temp
421 (if (math-leap-year-p year t)
422 [1 32 61 92 122 153 183 214 245 275 306 336 999]
423 [1 32 60 91 121 152 182 213 244 274 305 335 999]))
424 (while (>= date (aref temp month))
425 (setq month (1+ month)))
426 (setq day (1+ (- date (aref temp (1- month)))))
427 (list year month day)))
428
382(defun math-date-to-dt (value) 429(defun math-date-to-dt (value)
430 "Return the day and time of VALUE.
431The integer part of VALUE is the number of days since Dec 31, -1
432in the Gregorian calendar and the remaining part determines the time."
383 (if (eq (car-safe value) 'date) 433 (if (eq (car-safe value) 'date)
384 (setq value (nth 1 value))) 434 (setq value (nth 1 value)))
385 (or (math-realp value) 435 (or (math-realp value)
@@ -387,32 +437,21 @@
387 (let* ((parts (math-date-parts value)) 437 (let* ((parts (math-date-parts value))
388 (date (car parts)) 438 (date (car parts))
389 (time (nth 1 parts)) 439 (time (nth 1 parts))
390 (month 1) 440 (dt (if (and calc-gregorian-switch
391 day 441 (Math-lessp value
392 (year (math-quotient (math-add date (if (Math-lessp date 711859) 442 (or
393 365 ; for speed, we take 443 (nth 3 calc-gregorian-switch)
394 -108)) ; >1950 as a special case 444 (apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))
395 (if (math-negp value) 366 365))) 445))
396 ; this result may be an overestimate 446 (math-date-to-julian-dt date)
397 temp) 447 (math-date-to-gregorian-dt date))))
398 (while (Math-lessp date (setq temp (math-absolute-from-date year 1 1)))
399 (setq year (math-add year -1)))
400 (if (eq year 0) (setq year -1))
401 (setq date (1+ (math-sub date temp)))
402 (and (eq year 1752) (>= date 247)
403 (setq date (+ date 11)))
404 (setq temp (if (math-leap-year-p year)
405 [1 32 61 92 122 153 183 214 245 275 306 336 999]
406 [1 32 60 91 121 152 182 213 244 274 305 335 999]))
407 (while (>= date (aref temp month))
408 (setq month (1+ month)))
409 (setq day (1+ (- date (aref temp (1- month)))))
410 (if (math-integerp value) 448 (if (math-integerp value)
411 (list year month day) 449 dt
412 (list year month day 450 (append dt
413 (/ time 3600) 451 (list
414 (% (/ time 60) 60) 452 (/ time 3600)
415 (math-add (% time 60) (nth 2 parts)))))) 453 (% (/ time 60) 60)
454 (math-add (% time 60) (nth 2 parts)))))))
416 455
417(defun math-dt-to-date (dt) 456(defun math-dt-to-date (dt)
418 (or (integerp (nth 1 dt)) 457 (or (integerp (nth 1 dt))
@@ -423,7 +462,7 @@
423 (math-reject-arg (nth 2 dt) 'fixnump)) 462 (math-reject-arg (nth 2 dt) 'fixnump))
424 (if (or (< (nth 2 dt) 1) (> (nth 2 dt) 31)) 463 (if (or (< (nth 2 dt) 1) (> (nth 2 dt) 31))
425 (math-reject-arg (nth 2 dt) "Day value is out of range")) 464 (math-reject-arg (nth 2 dt) "Day value is out of range"))
426 (let ((date (math-absolute-from-date (car dt) (nth 1 dt) (nth 2 dt)))) 465 (let ((date (math-absolute-from-dt (car dt) (nth 1 dt) (nth 2 dt))))
427 (if (nth 3 dt) 466 (if (nth 3 dt)
428 (math-add (math-float date) 467 (math-add (math-float date)
429 (math-div (math-add (+ (* (nth 3 dt) 3600) 468 (math-div (math-add (+ (* (nth 3 dt) 3600)
@@ -446,8 +485,12 @@
446(defun math-this-year () 485(defun math-this-year ()
447 (nth 5 (decode-time))) 486 (nth 5 (decode-time)))
448 487
449(defun math-leap-year-p (year) 488(defun math-leap-year-p (year &optional julian)
450 (if (Math-lessp year 1752) 489 "Non-nil if YEAR is a leap year.
490If JULIAN is non-nil, then use the criterion for leap years
491in the Julian calendar, otherwise use the criterion in the
492Gregorian calendar."
493 (if julian
451 (if (math-negp year) 494 (if (math-negp year)
452 (= (math-imod (math-neg year) 4) 1) 495 (= (math-imod (math-neg year) 4) 1)
453 (= (math-imod year 4) 0)) 496 (= (math-imod year 4) 0))
@@ -460,39 +503,104 @@
460 29 503 29
461 (aref [31 28 31 30 31 30 31 31 30 31 30 31] (1- month)))) 504 (aref [31 28 31 30 31 30 31 31 30 31 30 31] (1- month))))
462 505
463(defun math-day-number (year month day) 506(defun math-day-in-year (year month day &optional julian)
507 "Return the number of days of the year up to YEAR MONTH DAY.
508The count includes the given date.
509If JULIAN is non-nil, use the Julian calendar, otherwise
510use the Gregorian calendar."
464 (let ((day-of-year (+ day (* 31 (1- month))))) 511 (let ((day-of-year (+ day (* 31 (1- month)))))
465 (if (> month 2) 512 (if (> month 2)
466 (progn 513 (progn
467 (setq day-of-year (- day-of-year (/ (+ 23 (* 4 month)) 10))) 514 (setq day-of-year (- day-of-year (/ (+ 23 (* 4 month)) 10)))
468 (if (math-leap-year-p year) 515 (if (math-leap-year-p year julian)
469 (setq day-of-year (1+ day-of-year))))) 516 (setq day-of-year (1+ day-of-year)))))
470 (and (eq year 1752)
471 (or (> month 9)
472 (and (= month 9) (>= day 14)))
473 (setq day-of-year (- day-of-year 11)))
474 day-of-year)) 517 day-of-year))
475 518
476(defun math-absolute-from-date (year month day) 519(defun math-day-number (year month day)
520 "Return the number of days of the year up to YEAR MONTH DAY.
521The count includes the given date."
522 (if calc-gregorian-switch
523 (cond ((eq year (nth 0 calc-gregorian-switch))
524 (1+
525 (- (math-absolute-from-dt year month day)
526 (math-absolute-from-dt year 1 1))))
527 ((Math-lessp year (nth 0 calc-gregorian-switch))
528 (math-day-in-year year month day t))
529 (t
530 (math-day-in-year year month day)))
531 (math-day-in-year year month day)))
532
533(defun math-dt-before-p (dt1 dt2)
534 "Non-nil if DT1 occurs before DT2.
535A DT is a list of the form (YEAR MONTH DAY)."
536 (or (Math-lessp (nth 0 dt1) (nth 0 dt2))
537 (and (equal (nth 0 dt1) (nth 0 dt2))
538 (or (< (nth 1 dt1) (nth 1 dt2))
539 (and (= (nth 1 dt1) (nth 1 dt2))
540 (< (nth 2 dt1) (nth 2 dt2)))))))
541
542(defun math-absolute-from-gregorian-dt (year month day)
543 "Return the DATE of the day given by the Gregorian day YEAR MONTH DAY.
544Recall that DATE is the number of days since December 31, -1
545in the Gregorian calendar."
477 (if (eq year 0) (setq year -1)) 546 (if (eq year 0) (setq year -1))
478 (let ((yearm1 (math-sub year 1))) 547 (let ((yearm1 (math-sub year 1)))
479 (math-sub (math-add (math-day-number year month day) 548 (math-sub
480 (math-add (math-mul 365 yearm1) 549 ;; Add the number of days of the year and the numbers of days
481 (if (math-posp year) 550 ;; in the previous years (leap year days to be added separately)
482 (math-quotient yearm1 4) 551 (math-add (math-day-in-year year month day)
483 (math-sub 365 552 (math-add (math-mul 365 yearm1)
484 (math-quotient (math-sub 3 year) 553 ;; Add the number of Julian leap years
485 4))))) 554 (if (math-posp year)
486 (if (or (Math-lessp year 1753) 555 (math-quotient yearm1 4)
487 (and (eq year 1752) (<= month 9))) 556 (math-sub 365
488 1 557 (math-quotient (math-sub 3 year)
489 (let ((correction (math-mul (math-quotient yearm1 100) 3))) 558 4)))))
490 (let ((res (math-idivmod correction 4))) 559 ;; Subtract the number of Julian leap years which are not
491 (math-add (if (= (cdr res) 0) 560 ;; Gregorian leap years. In C=4N+r centuries, there will
492 -1 561 ;; be 3N+r of these days. The following will compute
493 0) 562 ;; 3N+r.
494 (car res)))))))) 563 (let* ((correction (math-mul (math-quotient yearm1 100) 3))
495 564 (res (math-idivmod correction 4)))
565 (math-add (if (= (cdr res) 0)
566 0
567 1)
568 (car res))))))
569
570(defun math-absolute-from-julian-dt (year month day)
571 "Return the DATE of the day given by the Julian day YEAR MONTH DAY.
572Recall that DATE is the number of days since December 31, -1
573in the Gregorian calendar."
574 (if (eq year 0) (setq year -1))
575 (let ((yearm1 (math-sub year 1)))
576 (math-sub
577 ;; Add the number of days of the year and the numbers of days
578 ;; in the previous years (leap year days to be added separately)
579 (math-add (math-day-in-year year month day)
580 (math-add (math-mul 365 yearm1)
581 ;; Add the number of Julian leap years
582 (if (math-posp year)
583 (math-quotient yearm1 4)
584 (math-sub 365
585 (math-quotient (math-sub 3 year)
586 4)))))
587 ;; Adjustment, since January 1, 1 (Julian) is absolute day -1
588 2)))
589
590;; calc-gregorian-switch is a customizable variable defined in calc.el
591(defvar calc-gregorian-switch)
592
593
594(defun math-absolute-from-dt (year month day)
595 "Return the DATE of the day given by the day YEAR MONTH DAY.
596Recall that DATE is the number of days since December 31, -1
597in the Gregorian calendar."
598 (if (and calc-gregorian-switch
599 ;; The next few lines determine if the given date
600 ;; occurs before the switch to the Gregorian calendar.
601 (math-dt-before-p (list year month day) calc-gregorian-switch))
602 (math-absolute-from-julian-dt year month day)
603 (math-absolute-from-gregorian-dt year month day)))
496 604
497;;; It is safe to redefine these in your init file to use a different 605;;; It is safe to redefine these in your init file to use a different
498;;; language. 606;;; language.
@@ -548,13 +656,13 @@
548 (setcdr math-fd-dt nil)) 656 (setcdr math-fd-dt nil))
549 fmt)))) 657 fmt))))
550 658
551(defconst math-julian-date-beginning '(float 17214235 -1) 659(defconst math-julian-date-beginning '(float 17214225 -1)
552 "The beginning of the Julian calendar, 660 "The beginning of the Julian date calendar,
553as measured in the number of days before January 1 of the year 1AD.") 661as measured in the number of days before December 31, 1 BC (Gregorian).")
554 662
555(defconst math-julian-date-beginning-int 1721424 663(defconst math-julian-date-beginning-int 1721423
556 "The beginning of the Julian calendar, 664 "The beginning of the Julian date calendar,
557as measured in the integer number of days before January 1 of the year 1AD.") 665as measured in the integer number of days before December 31, 1 BC (Gregorian).")
558 666
559(defun math-format-date-part (x) 667(defun math-format-date-part (x)
560 (cond ((stringp x) 668 (cond ((stringp x)
@@ -585,8 +693,7 @@ as measured in the integer number of days before January 1 of the year 1AD.")
585 math-fd-year (car math-fd-dt) 693 math-fd-year (car math-fd-dt)
586 math-fd-month (nth 1 math-fd-dt) 694 math-fd-month (nth 1 math-fd-dt)
587 math-fd-day (nth 2 math-fd-dt) 695 math-fd-day (nth 2 math-fd-dt)
588 math-fd-weekday (math-mod 696 math-fd-weekday (math-mod (math-floor math-fd-date) 7)
589 (math-add (math-floor math-fd-date) 6) 7)
590 math-fd-hour (nth 3 math-fd-dt) 697 math-fd-hour (nth 3 math-fd-dt)
591 math-fd-minute (nth 4 math-fd-dt) 698 math-fd-minute (nth 4 math-fd-dt)
592 math-fd-second (nth 5 math-fd-dt)) 699 math-fd-second (nth 5 math-fd-dt))
@@ -1098,7 +1205,7 @@ as measured in the integer number of days before January 1 of the year 1AD.")
1098 (setq date (nth 1 date))) 1205 (setq date (nth 1 date)))
1099 (or (math-realp date) 1206 (or (math-realp date)
1100 (math-reject-arg date 'datep)) 1207 (math-reject-arg date 'datep))
1101 (math-mod (math-add (math-floor date) 6) 7)) 1208 (math-mod (math-floor date) 7))
1102 1209
1103(defun calcFunc-yearday (date) 1210(defun calcFunc-yearday (date)
1104 (let ((dt (math-date-to-dt date))) 1211 (let ((dt (math-date-to-dt date)))
@@ -1298,7 +1405,7 @@ second, the number of seconds offset for daylight savings."
1298 0))) 1405 0)))
1299 (rounded-abs-date 1406 (rounded-abs-date
1300 (+ 1407 (+
1301 (calendar-absolute-from-gregorian 1408 (calendar-absolute-from-gregorian
1302 (list (nth 1 dt) (nth 2 dt) (nth 0 dt))) 1409 (list (nth 1 dt) (nth 2 dt) (nth 0 dt)))
1303 (/ (round (* 60 time)) 60.0 24.0)))) 1410 (/ (round (* 60 time)) 60.0 24.0))))
1304 (if (dst-in-effect rounded-abs-date) 1411 (if (dst-in-effect rounded-abs-date)
@@ -1434,28 +1541,100 @@ and ends on the last Sunday of October at 2 a.m."
1434 (and (math-messy-integerp day) (setq day (math-trunc day))) 1541 (and (math-messy-integerp day) (setq day (math-trunc day)))
1435 (or (integerp day) (math-reject-arg day 'fixnump)) 1542 (or (integerp day) (math-reject-arg day 'fixnump))
1436 (and (or (< day 0) (> day 31)) (math-reject-arg day 'range)) 1543 (and (or (< day 0) (> day 31)) (math-reject-arg day 'range))
1437 (let ((dt (math-date-to-dt date))) 1544 (let* ((dt (math-date-to-dt date))
1438 (if (or (= day 0) (> day (math-days-in-month (car dt) (nth 1 dt)))) 1545 (dim (math-days-in-month (car dt) (nth 1 dt)))
1439 (setq day (math-days-in-month (car dt) (nth 1 dt)))) 1546 (julian (if calc-gregorian-switch
1440 (and (eq (car dt) 1752) (= (nth 1 dt) 9) 1547 (math-date-to-dt (math-sub
1441 (if (>= day 14) (setq day (- day 11)))) 1548 (or (nth 3 calc-gregorian-switch)
1442 (list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) 1549 (apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))
1443 (1- day))))) 1550 1)))))
1551 (if (or (= day 0) (> day dim))
1552 (setq day (1- dim))
1553 (setq day (1- day)))
1554 ;; Adjust if this occurs near the switch to the Gregorian calendar
1555 (if calc-gregorian-switch
1556 (cond
1557 ((and (math-dt-before-p (list (car dt) (nth 1 dt) 1) calc-gregorian-switch)
1558 (math-dt-before-p julian (list (car dt) (nth 1 dt) 1)))
1559 ;; In this case, CALC-GREGORIAN-SWITCH is the first day of the month
1560 (list 'date
1561 (math-dt-to-date (list (car calc-gregorian-switch)
1562 (nth 1 calc-gregorian-switch)
1563 (if (> (+ (nth 2 calc-gregorian-switch) day) dim)
1564 dim
1565 (+ (nth 2 calc-gregorian-switch) day))))))
1566 ((and (eq (car dt) (car calc-gregorian-switch))
1567 (= (nth 1 dt) (nth 1 calc-gregorian-switch)))
1568 ;; In this case, the switch to the Gregorian calendar occurs in the given month
1569 (if (< (+ (nth 2 julian) day) (nth 2 calc-gregorian-switch))
1570 ;; If the DAYth day occurs before the switch, use it
1571 (list 'date (math-dt-to-date (list (car dt) (nth 1 dt) (1+ day))))
1572 ;; Otherwise do some computations
1573 (let ((tm (+ day (- (nth 2 calc-gregorian-switch) (nth 2 julian)))))
1574 (list 'date (math-dt-to-date
1575 (list (car dt)
1576 (nth 1 dt)
1577 ;;
1578 (if (> tm dim) dim tm)))))))
1579 ((and (eq (car dt) (car julian))
1580 (= (nth 1 dt) (nth 1 julian)))
1581 ;; In this case, the current month is truncated because of the switch
1582 ;; to the Gregorian calendar
1583 (list 'date (math-dt-to-date
1584 (list (car dt)
1585 (nth 1 dt)
1586 (if (>= day (nth 2 julian))
1587 (nth 2 julian)
1588 (1+ day))))))
1589 (t
1590 ;; The default
1591 (list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) day))))
1592 (list 'date (math-add (math-dt-to-date (list (car dt) (nth 1 dt) 1)) day)))))
1444 1593
1445(defun calcFunc-newyear (date &optional day) 1594(defun calcFunc-newyear (date &optional day)
1595 (if (eq (car-safe date) 'date) (setq date (nth 1 date)))
1446 (or day (setq day 1)) 1596 (or day (setq day 1))
1447 (and (math-messy-integerp day) (setq day (math-trunc day))) 1597 (and (math-messy-integerp day) (setq day (math-trunc day)))
1448 (or (integerp day) (math-reject-arg day 'fixnump)) 1598 (or (integerp day) (math-reject-arg day 'fixnump))
1449 (let ((dt (math-date-to-dt date))) 1599 (let* ((dt (math-date-to-dt date))
1600 (gregbeg (if calc-gregorian-switch
1601 (or (nth 3 calc-gregorian-switch)
1602 (apply 'math-absolute-from-gregorian-dt calc-gregorian-switch))))
1603 (julianend (if calc-gregorian-switch (math-sub gregbeg 1)))
1604 (julian (if calc-gregorian-switch
1605 (math-date-to-dt julianend))))
1450 (if (and (>= day 0) (<= day 366)) 1606 (if (and (>= day 0) (<= day 366))
1451 (let ((max (if (eq (car dt) 1752) 355 1607 (let ((max (if (math-leap-year-p (car dt)) 366 365)))
1452 (if (math-leap-year-p (car dt)) 366 365))))
1453 (if (or (= day 0) (> day max)) (setq day max)) 1608 (if (or (= day 0) (> day max)) (setq day max))
1454 (list 'date (math-add (math-dt-to-date (list (car dt) 1 1)) 1609 (if calc-gregorian-switch
1455 (1- day)))) 1610 ;; Now to break this down into cases
1611 (cond
1612 ((and (math-dt-before-p (list (car dt) 1 1) calc-gregorian-switch)
1613 (math-dt-before-p julian (list (car dt) 1 1)))
1614 ;; In this case, CALC-GREGORIAN-SWITCH is the first day of the year
1615 (list 'date (math-min (math-add gregbeg (1- day))
1616 (math-dt-to-date (list (car calc-gregorian-switch) 12 31)))))
1617 ((eq (car dt) (car julian))
1618 ;; In this case, the switch to the Gregorian calendar occurs in the given year
1619 (if (Math-lessp (car julian) (car calc-gregorian-switch))
1620 ;; Here, the last Julian day is the last day of the year.
1621 (list 'date (math-min (math-add (math-dt-to-date (list (car dt) 1 1)) (1- day))
1622 julianend))
1623 ;; Otherwise, just make sure the date doesn't go past the end of the year
1624 (list 'date (math-min (math-add (math-dt-to-date (list (car dt) 1 1)) (1- day))
1625 (math-dt-to-date (list (car dt) 12 31))))))
1626 (t
1627 (list 'date (math-add (math-dt-to-date (list (car dt) 1 1))
1628 (1- day)))))
1629 (list 'date (math-add (math-dt-to-date (list (car dt) 1 1))
1630 (1- day)))))
1456 (if (and (>= day -12) (<= day -1)) 1631 (if (and (>= day -12) (<= day -1))
1457 (list 'date (math-dt-to-date (list (car dt) (- day) 1))) 1632 (if (and calc-gregorian-switch
1458 (math-reject-arg day 'range))))) 1633 (math-dt-before-p (list (car dt) (- day) 1) calc-gregorian-switch)
1634 (math-dt-before-p julian (list (car dt) (- day) 1)))
1635 (list 'date gregbeg)
1636 (list 'date (math-dt-to-date (list (car dt) (- day) 1))))
1637 (math-reject-arg day 'range)))))
1459 1638
1460(defun calcFunc-incmonth (date &optional step) 1639(defun calcFunc-incmonth (date &optional step)
1461 (or step (setq step 1)) 1640 (or step (setq step 1))
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index f1643b10a76..aeca45ebf26 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -464,6 +464,52 @@ to be identified as that note."
464 :type 'string 464 :type 'string
465 :group 'calc) 465 :group 'calc)
466 466
467(defvar math-format-date-cache) ; calc-forms.el
468
469;; Dates that are built-in options for `calc-gregorian-switch' should be
470;; (YEAR MONTH DAY math-date-from-gregorian-dt(YEAR MONTH DAY)) for speed.
471(defcustom calc-gregorian-switch nil
472 "The first day the Gregorian calendar is used by Calc's date forms.
473This is `nil' (the default) if the Gregorian calendar is the only one used.
474Otherwise, it should be a list `(YEAR MONTH DAY)' when Calc begins to use
475the Gregorian calendar; Calc will use the Julian calendar for earlier dates.
476The dates in which different regions of the world began to use the
477Gregorian calendar vary quite a bit, even within a single country.
478If you want Calc's date forms to switch between the Julian and
479Gregorian calendar, you can specify the date or choose from several
480common choices. Some of these choices should be taken with a grain
481of salt; for example different parts of France changed calendars at
482different times, and Sweden's change to the Gregorian calendar was
483complicated. Also, the boundaries of the countries were different at
484the times of the calendar changes than they are now.
485The Vatican decided that the Gregorian calendar should take effect
486on 15 October 1582 (Gregorian), and many Catholic countries made
487the change then. Great Britian and its colonies had the Gregorian
488calendar take effect on 14 September 1752 (Gregorian); this includes
489the United States."
490 :group 'calc
491 :version "24.4"
492 :type '(choice (const :tag "Always use the Gregorian calendar" nil)
493 (const :tag "Great Britian and the US (1752 9 14)" (1752 9 14 639797))
494 (const :tag "Vatican (1582 10 15)" (1582 10 15 577736))
495 (const :tag "Czechoslovakia (1584 1 17)" (1584 1 17 578195))
496 (const :tag "Denmark (1700 3 1)" (1700 3 1 620607))
497 (const :tag "France (1582 12 20)" (1582 12 20 577802))
498 (const :tag "Hungary (1587 11 1)" (1587 11 1 579579))
499 (const :tag "Luxemburg (1582 12 25)" (1582 12 25 577807))
500 (const :tag "Romania (1919 4 14)" (1919 4 14 700638))
501 (const :tag "Russia (1918 2 14)" (1918 2 14 700214))
502 (const :tag "Sweden (1753 3 1)" (1753 3 1 639965))
503 (const :tag "Switzerland (Catholic) (1584 1 22)" (1584 1 22 578200))
504 (const :tag "Switzerland (Protestant) (1701 1 12)" (1701 1 12 620924))
505 (list :tag "(YEAR MONTH DAY)"
506 (integer :tag "Year")
507 (integer :tag "Month (integer)")
508 (integer :tag "Day")))
509 :set (lambda (symbol value)
510 (set-default symbol value)
511 (setq math-format-date-cache nil)))
512
467(defface calc-nonselected-face 513(defface calc-nonselected-face
468 '((t :inherit shadow 514 '((t :inherit shadow
469 :slant italic)) 515 :slant italic))
diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog
index 755f4c8159b..a01ce4c30a3 100644
--- a/lisp/cedet/ChangeLog
+++ b/lisp/cedet/ChangeLog
@@ -1,3 +1,24 @@
12012-11-16 David Engster <deng@randomsample.de>
2
3 * semantic/symref/list.el (semantic-symref-symbol): Use
4 `semantic-complete-read-tag-project' instead of
5 `semantic-complete-read-tag-buffer-deep', since the latter is not
6 working correctly.
7
8 * semantic/symref.el (semantic-symref-result-get-tags): Use
9 `find-buffer-visiting' to follow symbolic links.
10
11 * semantic/fw.el (semantic-find-file-noselect): Always set
12 `enable-local-variables' to `:safe' when loading files.
13
142012-11-16 Glenn Morris <rgm@gnu.org>
15
16 * semantic/lex-spp.el (semantic-lex-spp-lex-text-string):
17 * semantic/util.el (semantic-describe-buffer):
18 * semantic/bovine/c.el (semantic-c-parse-lexical-token)
19 (semantic-default-c-setup):
20 Use new names for hooks rather than obsolete aliases.
21
12012-11-13 Stefan Monnier <monnier@iro.umontreal.ca> 222012-11-13 Stefan Monnier <monnier@iro.umontreal.ca>
2 23
3 * semantic/mru-bookmark.el (semantic-mru-bookmark-mode): 24 * semantic/mru-bookmark.el (semantic-mru-bookmark-mode):
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index 02ad6e05d1a..a3d57108d1d 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -931,8 +931,8 @@ the regular parser."
931 (setq semantic-new-buffer-fcn-was-run t) 931 (setq semantic-new-buffer-fcn-was-run t)
932 (semantic-lex-init) 932 (semantic-lex-init)
933 (semantic-clear-toplevel-cache) 933 (semantic-clear-toplevel-cache)
934 (remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook 934 (remove-hook 'semantic-lex-reset-functions
935 t) 935 'semantic-lex-spp-reset-hook t)
936 ) 936 )
937 ;; Get the macro symbol table right. 937 ;; Get the macro symbol table right.
938 (setq semantic-lex-spp-dynamic-macro-symbol-obarray spp-syms) 938 (setq semantic-lex-spp-dynamic-macro-symbol-obarray spp-syms)
@@ -2073,7 +2073,7 @@ actually in their parent which is not accessible.")
2073 ) 2073 )
2074 2074
2075 (setq semantic-lex-analyzer #'semantic-c-lexer) 2075 (setq semantic-lex-analyzer #'semantic-c-lexer)
2076 (add-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook nil t) 2076 (add-hook 'semantic-lex-reset-functions 'semantic-lex-spp-reset-hook nil t)
2077 (when (eq major-mode 'c++-mode) 2077 (when (eq major-mode 'c++-mode)
2078 (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("__cplusplus" . ""))) 2078 (add-to-list 'semantic-lex-c-preprocessor-symbol-map '("__cplusplus" . "")))
2079 ) 2079 )
diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el
index 5a12047eb76..14ffc808c44 100644
--- a/lisp/cedet/semantic/fw.el
+++ b/lisp/cedet/semantic/fw.el
@@ -421,14 +421,7 @@ into `mode-local-init-hook'." file filename)
421 ;; Don't prompt to insert a template if we visit an empty file 421 ;; Don't prompt to insert a template if we visit an empty file
422 (auto-insert nil) 422 (auto-insert nil)
423 ;; We don't want emacs to query about unsafe local variables 423 ;; We don't want emacs to query about unsafe local variables
424 (enable-local-variables 424 (enable-local-variables :safe)
425 (if (featurep 'xemacs)
426 ;; XEmacs only has nil as an option?
427 nil
428 ;; Emacs 23 has the spiffy :safe option, nil otherwise.
429 (if (>= emacs-major-version 22)
430 nil
431 :safe)))
432 ;; ... or eval variables 425 ;; ... or eval variables
433 (enable-local-eval nil) 426 (enable-local-eval nil)
434 ) 427 )
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el
index 406f2900563..ad366c2b94f 100644
--- a/lisp/cedet/semantic/lex-spp.el
+++ b/lisp/cedet/semantic/lex-spp.el
@@ -30,7 +30,7 @@
30;; If you use SPP in your language, be sure to specify this in your 30;; If you use SPP in your language, be sure to specify this in your
31;; semantic language setup function: 31;; semantic language setup function:
32;; 32;;
33;; (add-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook nil t) 33;; (add-hook 'semantic-lex-reset-functions 'semantic-lex-spp-reset-hook nil t)
34;; 34;;
35;; 35;;
36;; Special Lexical Tokens: 36;; Special Lexical Tokens:
@@ -947,8 +947,8 @@ and variable state from the current buffer."
947 (setq semantic-new-buffer-fcn-was-run t) 947 (setq semantic-new-buffer-fcn-was-run t)
948 (semantic-lex-init) 948 (semantic-lex-init)
949 (semantic-clear-toplevel-cache) 949 (semantic-clear-toplevel-cache)
950 (remove-hook 'semantic-lex-reset-hooks 'semantic-lex-spp-reset-hook 950 (remove-hook 'semantic-lex-reset-functions
951 t) 951 'semantic-lex-spp-reset-hook t)
952 )) 952 ))
953 953
954 ;; Second Cheat: copy key variables regarding macro state from the 954 ;; Second Cheat: copy key variables regarding macro state from the
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index 540c766cc94..ad897680d7f 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -356,7 +356,7 @@ already."
356 (lambda (hit) 356 (lambda (hit)
357 (let* ((line (car hit)) 357 (let* ((line (car hit))
358 (file (cdr hit)) 358 (file (cdr hit))
359 (buff (get-file-buffer file)) 359 (buff (find-buffer-visiting file))
360 (tag nil) 360 (tag nil)
361 ) 361 )
362 (cond 362 (cond
diff --git a/lisp/cedet/semantic/symref/list.el b/lisp/cedet/semantic/symref/list.el
index 55ccf1c103f..729bd8e153c 100644
--- a/lisp/cedet/semantic/symref/list.el
+++ b/lisp/cedet/semantic/symref/list.el
@@ -69,7 +69,7 @@ current project to find references to the input SYM. The
69references are organized by file and the name of the function 69references are organized by file and the name of the function
70they are used in. 70they are used in.
71Display the references in `semantic-symref-results-mode'." 71Display the references in `semantic-symref-results-mode'."
72 (interactive (list (semantic-tag-name (semantic-complete-read-tag-buffer-deep 72 (interactive (list (semantic-tag-name (semantic-complete-read-tag-project
73 "Symrefs for: ")))) 73 "Symrefs for: "))))
74 (semantic-fetch-tags) 74 (semantic-fetch-tags)
75 (let ((res nil) 75 (let ((res nil)
diff --git a/lisp/cedet/semantic/util.el b/lisp/cedet/semantic/util.el
index 65201c4fd12..f3d30f6af5c 100644
--- a/lisp/cedet/semantic/util.el
+++ b/lisp/cedet/semantic/util.el
@@ -280,7 +280,7 @@ If TAG is not specified, use the tag at point."
280 semantic-parser-name 280 semantic-parser-name
281 semantic-parse-tree-state 281 semantic-parse-tree-state
282 semantic-lex-analyzer 282 semantic-lex-analyzer
283 semantic-lex-reset-hooks 283 semantic-lex-reset-functions
284 semantic-lex-syntax-modifications 284 semantic-lex-syntax-modifications
285 ))) 285 )))
286 (dolist (V vars) 286 (dolist (V vars)
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index 0c7f82d516e..c384b96df86 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -374,6 +374,8 @@ This function is semi-obsolete. Use `get-char-code-property'."
374 (format "%c:%s" x doc))) 374 (format "%c:%s" x doc)))
375 mnemonics ", "))))) 375 mnemonics ", ")))))
376 376
377(declare-function quail-find-key "quail" (char))
378
377;;;###autoload 379;;;###autoload
378(defun describe-char (pos &optional buffer) 380(defun describe-char (pos &optional buffer)
379 "Describe position POS (interactively, point) and the char after POS. 381 "Describe position POS (interactively, point) and the char after POS.
diff --git a/lisp/dired.el b/lisp/dired.el
index 5f7ee48a810..f6056e20d0a 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -3732,6 +3732,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
3732;;;; Desktop support 3732;;;; Desktop support
3733 3733
3734(eval-when-compile (require 'desktop)) 3734(eval-when-compile (require 'desktop))
3735(declare-function desktop-file-name "desktop" (filename dirname))
3735 3736
3736(defun dired-desktop-buffer-misc-data (dirname) 3737(defun dired-desktop-buffer-misc-data (dirname)
3737 "Auxiliary information to be saved in desktop file." 3738 "Auxiliary information to be saved in desktop file."
diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el
index 5e825032741..a66fc23dec1 100644
--- a/lisp/dirtrack.el
+++ b/lisp/dirtrack.el
@@ -220,6 +220,9 @@ the mode if ARG is omitted or nil."
220 (goto-char (point-max)) 220 (goto-char (point-max))
221 (insert msg1 msg2 "\n")))) 221 (insert msg1 msg2 "\n"))))
222 222
223(declare-function shell-prefixed-directory-name "shell" (dir))
224(declare-function shell-process-cd "shell" (arg))
225
223;;;###autoload 226;;;###autoload
224(defun dirtrack (input) 227(defun dirtrack (input)
225 "Determine the current directory from the process output for a prompt. 228 "Determine the current directory from the process output for a prompt.
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index f9b4491e6e0..c2ebb3bbdc6 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -2239,16 +2239,15 @@ definition (see the code for `documentation')."
2239 2239
2240(defun ad-definition-type (definition) 2240(defun ad-definition-type (definition)
2241 "Return symbol that describes the type of DEFINITION." 2241 "Return symbol that describes the type of DEFINITION."
2242 ;; These symbols are only ever used to check a cache entry's validity.
2243 ;; The suffix `2' reflects the fact that we're using version 2 of advice
2244 ;; representations, so cache entries preactivated with version
2245 ;; 1 can't be used.
2242 (cond 2246 (cond
2243 ((ad-macro-p definition) 'macro) 2247 ((ad-macro-p definition) 'macro2)
2244 ((ad-subr-p definition) 2248 ((ad-subr-p definition) 'subr2)
2245 (if (special-form-p definition) 2249 ((or (ad-lambda-p definition) (ad-compiled-p definition)) 'fun2)
2246 'special-form 2250 ((ad-advice-p definition) 'advice2))) ;; FIXME: Can this ever happen?
2247 'subr))
2248 ((or (ad-lambda-p definition)
2249 (ad-compiled-p definition))
2250 'function)
2251 ((ad-advice-p definition) 'advice)))
2252 2251
2253(defun ad-has-proper-definition (function) 2252(defun ad-has-proper-definition (function)
2254 "True if FUNCTION is a symbol with a proper definition. 2253 "True if FUNCTION is a symbol with a proper definition.
@@ -2597,7 +2596,9 @@ in any of these classes."
2597 (ad-has-redefining-advice function)) 2596 (ad-has-redefining-advice function))
2598 (let* ((origdef (ad-real-orig-definition function)) 2597 (let* ((origdef (ad-real-orig-definition function))
2599 ;; Construct the individual pieces that we need for assembly: 2598 ;; Construct the individual pieces that we need for assembly:
2600 (orig-arglist (ad-arglist origdef)) 2599 (orig-arglist (let ((args (ad-arglist origdef)))
2600 ;; The arglist may still be unknown.
2601 (if (listp args) args '(&rest args))))
2601 (advised-arglist (or (ad-advised-arglist function) 2602 (advised-arglist (or (ad-advised-arglist function)
2602 orig-arglist)) 2603 orig-arglist))
2603 (interactive-form (ad-advised-interactive-form function)) 2604 (interactive-form (ad-advised-interactive-form function))
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index ffa42e97221..1cbed17cbab 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -124,7 +124,7 @@
124;; Adding your own checks: 124;; Adding your own checks:
125;; 125;;
126;; You can experiment with adding your own checks by setting the 126;; You can experiment with adding your own checks by setting the
127;; hooks `checkdoc-style-functions' and `checkdoc-comment-style-hooks'. 127;; hooks `checkdoc-style-functions' and `checkdoc-comment-style-functions'.
128;; Return a string which is the error you wish to report. The cursor 128;; Return a string which is the error you wish to report. The cursor
129;; position should be preserved. 129;; position should be preserved.
130;; 130;;
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index a9be08b1383..d5e5f4bbfbc 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -3,7 +3,7 @@
3;; Copyright (C) 1993, 2001-2012 Free Software Foundation, Inc. 3;; Copyright (C) 1993, 2001-2012 Free Software Foundation, Inc.
4 4
5;; Author: Dave Gillespie <daveg@synaptics.com> 5;; Author: Dave Gillespie <daveg@synaptics.com>
6;; Version: 2.02 6;; Version: 1.0
7;; Keywords: extensions 7;; Keywords: extensions
8 8
9;; This file is part of GNU Emacs. 9;; This file is part of GNU Emacs.
@@ -661,7 +661,7 @@ If ALIST is non-nil, the new pairs are prepended to it."
661(gv-define-setter face-foreground (x f &optional s) 661(gv-define-setter face-foreground (x f &optional s)
662 `(set-face-foreground ,f ,x ,s)) 662 `(set-face-foreground ,f ,x ,s))
663(gv-define-setter face-underline-p (x f &optional s) 663(gv-define-setter face-underline-p (x f &optional s)
664 `(set-face-underline-p ,f ,x ,s)) 664 `(set-face-underline ,f ,x ,s))
665(gv-define-simple-setter file-modes set-file-modes t) 665(gv-define-simple-setter file-modes set-file-modes t)
666(gv-define-simple-setter frame-height set-screen-height t) 666(gv-define-simple-setter frame-height set-screen-height t)
667(gv-define-simple-setter frame-parameters modify-frame-parameters t) 667(gv-define-simple-setter frame-parameters modify-frame-parameters t)
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el
index eb58d17c02e..69882e36f22 100644
--- a/lisp/emacs-lisp/cl-loaddefs.el
+++ b/lisp/emacs-lisp/cl-loaddefs.el
@@ -267,7 +267,7 @@ including `cl-block' and `cl-eval-when'.
267;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when 267;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when
268;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp 268;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp
269;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*) 269;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*)
270;;;;;; "cl-macs" "cl-macs.el" "c7ad09a74a1d2969406e7e2aaf3812fc") 270;;;;;; "cl-macs" "cl-macs.el" "a7d9b56ea588b869813de8ed7ec1fbcd")
271;;; Generated autoloads from cl-macs.el 271;;; Generated autoloads from cl-macs.el
272 272
273(autoload 'cl--compiler-macro-list* "cl-macs" "\ 273(autoload 'cl--compiler-macro-list* "cl-macs" "\
@@ -416,7 +416,7 @@ This is compatible with Common Lisp, but note that `defun' and
416(put 'cl-return-from 'lisp-indent-function '1) 416(put 'cl-return-from 'lisp-indent-function '1)
417 417
418(autoload 'cl-loop "cl-macs" "\ 418(autoload 'cl-loop "cl-macs" "\
419The Common Lisp `cl-loop' macro. 419The Common Lisp `loop' macro.
420Valid clauses are: 420Valid clauses are:
421 for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM, 421 for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM,
422 for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR, 422 for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR,
@@ -432,14 +432,14 @@ Valid clauses are:
432\(fn CLAUSE...)" nil t) 432\(fn CLAUSE...)" nil t)
433 433
434(autoload 'cl-do "cl-macs" "\ 434(autoload 'cl-do "cl-macs" "\
435The Common Lisp `cl-do' loop. 435The Common Lisp `do' loop.
436 436
437\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil t) 437\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil t)
438 438
439(put 'cl-do 'lisp-indent-function '2) 439(put 'cl-do 'lisp-indent-function '2)
440 440
441(autoload 'cl-do* "cl-macs" "\ 441(autoload 'cl-do* "cl-macs" "\
442The Common Lisp `cl-do*' loop. 442The Common Lisp `do*' loop.
443 443
444\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil t) 444\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil t)
445 445
@@ -501,7 +501,7 @@ a `let' form, except that the list of symbols can be computed at run-time.
501(put 'cl-progv 'lisp-indent-function '2) 501(put 'cl-progv 'lisp-indent-function '2)
502 502
503(autoload 'cl-flet "cl-macs" "\ 503(autoload 'cl-flet "cl-macs" "\
504Make temporary function definitions. 504Make local function definitions.
505Like `cl-labels' but the definitions are not recursive. 505Like `cl-labels' but the definitions are not recursive.
506 506
507\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t) 507\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t)
@@ -509,7 +509,7 @@ Like `cl-labels' but the definitions are not recursive.
509(put 'cl-flet 'lisp-indent-function '1) 509(put 'cl-flet 'lisp-indent-function '1)
510 510
511(autoload 'cl-flet* "cl-macs" "\ 511(autoload 'cl-flet* "cl-macs" "\
512Make temporary function definitions. 512Make local function definitions.
513Like `cl-flet' but the definitions can refer to previous ones. 513Like `cl-flet' but the definitions can refer to previous ones.
514 514
515\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t) 515\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t)
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 3c46c40242d..918e992512c 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -260,9 +260,11 @@ The name is made by appending a number to PREFIX, default \"G\"."
260 (require 'help-fns) 260 (require 'help-fns)
261 (cons (help-add-fundoc-usage 261 (cons (help-add-fundoc-usage
262 (if (stringp (car hdr)) (pop hdr)) 262 (if (stringp (car hdr)) (pop hdr))
263 (format "%S" 263 ;; Be careful with make-symbol and (back)quote,
264 (cons 'fn 264 ;; see bug#12884.
265 (cl--make-usage-args orig-args)))) 265 (let ((print-gensym nil) (print-quoted t))
266 (format "%S" (cons 'fn (cl--make-usage-args
267 orig-args)))))
266 hdr))) 268 hdr)))
267 (list `(let* ,cl--bind-lets 269 (list `(let* ,cl--bind-lets
268 ,@(nreverse cl--bind-forms) 270 ,@(nreverse cl--bind-forms)
@@ -756,7 +758,7 @@ This is compatible with Common Lisp, but note that `defun' and
756 758
757;;;###autoload 759;;;###autoload
758(defmacro cl-loop (&rest loop-args) 760(defmacro cl-loop (&rest loop-args)
759 "The Common Lisp `cl-loop' macro. 761 "The Common Lisp `loop' macro.
760Valid clauses are: 762Valid clauses are:
761 for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM, 763 for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM,
762 for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR, 764 for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR,
@@ -1501,7 +1503,7 @@ such that COMBO is equivalent to (and . CLAUSES)."
1501 1503
1502;;;###autoload 1504;;;###autoload
1503(defmacro cl-do (steps endtest &rest body) 1505(defmacro cl-do (steps endtest &rest body)
1504 "The Common Lisp `cl-do' loop. 1506 "The Common Lisp `do' loop.
1505 1507
1506\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" 1508\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
1507 (declare (indent 2) 1509 (declare (indent 2)
@@ -1513,7 +1515,7 @@ such that COMBO is equivalent to (and . CLAUSES)."
1513 1515
1514;;;###autoload 1516;;;###autoload
1515(defmacro cl-do* (steps endtest &rest body) 1517(defmacro cl-do* (steps endtest &rest body)
1516 "The Common Lisp `cl-do*' loop. 1518 "The Common Lisp `do*' loop.
1517 1519
1518\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" 1520\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
1519 (declare (indent 2) (debug cl-do)) 1521 (declare (indent 2) (debug cl-do))
@@ -1648,7 +1650,7 @@ a `let' form, except that the list of symbols can be computed at run-time."
1648 1650
1649;;;###autoload 1651;;;###autoload
1650(defmacro cl-flet (bindings &rest body) 1652(defmacro cl-flet (bindings &rest body)
1651 "Make temporary function definitions. 1653 "Make local function definitions.
1652Like `cl-labels' but the definitions are not recursive. 1654Like `cl-labels' but the definitions are not recursive.
1653 1655
1654\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" 1656\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
@@ -1672,7 +1674,7 @@ Like `cl-labels' but the definitions are not recursive.
1672 1674
1673;;;###autoload 1675;;;###autoload
1674(defmacro cl-flet* (bindings &rest body) 1676(defmacro cl-flet* (bindings &rest body)
1675 "Make temporary function definitions. 1677 "Make local function definitions.
1676Like `cl-flet' but the definitions can refer to previous ones. 1678Like `cl-flet' but the definitions can refer to previous ones.
1677 1679
1678\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" 1680\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
diff --git a/lisp/emacs-lisp/eieio-datadebug.el b/lisp/emacs-lisp/eieio-datadebug.el
index ec470d21bf3..a1db1972b83 100644
--- a/lisp/emacs-lisp/eieio-datadebug.el
+++ b/lisp/emacs-lisp/eieio-datadebug.el
@@ -131,7 +131,7 @@ PREBUTTONTEXT is some text between PREFIX and the object button."
131(defun eieio-debug-methodinvoke (method class) 131(defun eieio-debug-methodinvoke (method class)
132 "Show the method invocation order for METHOD with CLASS object." 132 "Show the method invocation order for METHOD with CLASS object."
133 (interactive "aMethod: \nXClass Expression: ") 133 (interactive "aMethod: \nXClass Expression: ")
134 (let* ((eieio-pre-method-execution-hooks 134 (let* ((eieio-pre-method-execution-functions
135 (lambda (l) (throw 'moose l) )) 135 (lambda (l) (throw 'moose l) ))
136 (data 136 (data
137 (catch 'moose (eieio-generic-call 137 (catch 'moose (eieio-generic-call
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index ff30d9e7fa4..540e0166ec2 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -109,18 +109,33 @@ Each element has the form (WHERE BYTECODE STACK) where:
109 (propertize "Advised function" 109 (propertize "Advised function"
110 'dynamic-docstring-function #'advice--make-docstring)) ;; ) 110 'dynamic-docstring-function #'advice--make-docstring)) ;; )
111 111
112(defun advice-eval-interactive-spec (spec)
113 "Evaluate the interactive spec SPEC."
114 (cond
115 ((stringp spec)
116 ;; There's no direct access to the C code (in call-interactively) that
117 ;; processes those specs, but that shouldn't stop us, should it?
118 ;; FIXME: Despite appearances, this is not faithful: SPEC and
119 ;; (advice-eval-interactive-spec SPEC) will behave subtly differently w.r.t
120 ;; command-history (and maybe a few other details).
121 (call-interactively `(lambda (&rest args) (interactive ,spec) args)))
122 ;; ((functionp spec) (funcall spec))
123 (t (eval spec))))
124
112(defun advice--make-interactive-form (function main) 125(defun advice--make-interactive-form (function main)
113 ;; TODO: Make it possible to do around-like advising on the
114 ;; interactive forms (bug#12844).
115 ;; TODO: make it so that interactive spec can be a constant which 126 ;; TODO: make it so that interactive spec can be a constant which
116 ;; dynamically checks the advice--car/cdr to do its job. 127 ;; dynamically checks the advice--car/cdr to do its job.
117 ;; TODO: Implement interactive-read-args: 128 ;; For that, advice-eval-interactive-spec needs to be more faithful.
118 ;;(when (or (commandp function) (commandp main)) 129 ;; FIXME: The calls to interactive-form below load autoloaded functions
119 ;; `(interactive-read-args 130 ;; too eagerly.
120 ;; (cadr (or (interactive-form function) (interactive-form main))))) 131 (let ((fspec (cadr (interactive-form function))))
121 ;; FIXME: This loads autoloaded functions too eagerly. 132 (when (eq 'function (car-safe fspec)) ;; Macroexpanded lambda?
133 (setq fspec (nth 1 fspec)))
134 (if (functionp fspec)
135 `(funcall ',fspec
136 ',(cadr (interactive-form main)))
122 (cadr (or (interactive-form function) 137 (cadr (or (interactive-form function)
123 (interactive-form main)))) 138 (interactive-form main))))))
124 139
125(defsubst advice--make-1 (byte-code stack-depth function main props) 140(defsubst advice--make-1 (byte-code stack-depth function main props)
126 "Build a function value that adds FUNCTION to MAIN." 141 "Build a function value that adds FUNCTION to MAIN."
@@ -167,17 +182,31 @@ WHERE is a symbol to select an entry in `advice--where-alist'."
167 (advice--make-1 (aref flist 1) (aref flist 3) 182 (advice--make-1 (aref flist 1) (aref flist 3)
168 first nrest props))))))) 183 first nrest props)))))))
169 184
185(defvar advice--buffer-local-function-sample nil)
186
187(defun advice--set-buffer-local (var val)
188 (if (function-equal val advice--buffer-local-function-sample)
189 (kill-local-variable var)
190 (set (make-local-variable var) val)))
191
192;;;###autoload
193(defun advice--buffer-local (var)
194 "Buffer-local value of VAR, presumed to contain a function."
195 (declare (gv-setter advice--set-buffer-local))
196 (if (local-variable-p var) (symbol-value var)
197 (setq advice--buffer-local-function-sample
198 (lambda (&rest args) (apply (default-value var) args)))))
199
170;;;###autoload 200;;;###autoload
171(defmacro add-function (where place function &optional props) 201(defmacro add-function (where place function &optional props)
172 ;; TODO: 202 ;; TODO:
173 ;; - provide something like `around' for interactive forms.
174 ;; - provide some kind of buffer-local functionality at least when `place'
175 ;; is a variable.
176 ;; - obsolete with-wrapper-hook (mostly requires buffer-local support). 203 ;; - obsolete with-wrapper-hook (mostly requires buffer-local support).
177 ;; - provide some kind of control over ordering. E.g. debug-on-entry, ELP 204 ;; - provide some kind of control over ordering. E.g. debug-on-entry, ELP
178 ;; and tracing want to stay first. 205 ;; and tracing want to stay first.
179 ;; - maybe also let `where' specify some kind of predicate and use it 206 ;; - maybe let `where' specify some kind of predicate and use it
180 ;; to implement things like mode-local or eieio-defmethod. 207 ;; to implement things like mode-local or eieio-defmethod.
208 ;; Of course, that only makes sense if the predicates of all advices can
209 ;; be combined and made more efficient.
181 ;; :before is like a normal add-hook on a normal hook. 210 ;; :before is like a normal add-hook on a normal hook.
182 ;; :before-while is like add-hook on run-hook-with-args-until-failure. 211 ;; :before-while is like add-hook on run-hook-with-args-until-failure.
183 ;; :before-until is like add-hook on run-hook-with-args-until-success. 212 ;; :before-until is like add-hook on run-hook-with-args-until-success.
@@ -197,8 +226,24 @@ call OLDFUN here:
197If FUNCTION was already added, do nothing. 226If FUNCTION was already added, do nothing.
198PROPS is an alist of additional properties, among which the following have 227PROPS is an alist of additional properties, among which the following have
199a special meaning: 228a special meaning:
200- `name': a string or symbol. It can be used to refer to this piece of advice." 229- `name': a string or symbol. It can be used to refer to this piece of advice.
230
231PLACE cannot be a simple variable. Instead it should either be
232\(default-value 'VAR) or (local 'VAR) depending on whether FUNCTION
233should be applied to VAR buffer-locally or globally.
234
235If one of FUNCTION or OLDFUN is interactive, then the resulting function
236is also interactive. There are 3 cases:
237- FUNCTION is not interactive: the interactive spec of OLDFUN is used.
238- The interactive spec of FUNCTION is itself a function: it should take one
239 argument (the interactive spec of OLDFUN, which it can pass to
240 `advice-eval-interactive-spec') and return the list of arguments to use.
241- Else, use the interactive spec of FUNCTION and ignore the one of OLDFUN."
201 (declare (debug t)) ;;(indent 2) 242 (declare (debug t)) ;;(indent 2)
243 (cond ((eq 'local (car-safe place))
244 (setq place `(advice--buffer-local ,@(cdr place))))
245 ((symbolp place)
246 (error "Use (default-value '%S) or (local '%S)" place place)))
202 `(advice--add-function ,where (gv-ref ,place) ,function ,props)) 247 `(advice--add-function ,where (gv-ref ,place) ,function ,props))
203 248
204;;;###autoload 249;;;###autoload
@@ -213,6 +258,10 @@ If FUNCTION was not added to PLACE, do nothing.
213Instead of FUNCTION being the actual function, it can also be the `name' 258Instead of FUNCTION being the actual function, it can also be the `name'
214of the piece of advice." 259of the piece of advice."
215 (declare (debug t)) 260 (declare (debug t))
261 (cond ((eq 'local (car-safe place))
262 (setq place `(advice--buffer-local ,@(cdr place))))
263 ((symbolp place)
264 (error "Use (default-value '%S) or (local '%S)" place place)))
216 (gv-letplace (getter setter) place 265 (gv-letplace (getter setter) place
217 (macroexp-let2 nil new `(advice--remove-function ,getter ,function) 266 (macroexp-let2 nil new `(advice--remove-function ,getter ,function)
218 `(unless (eq ,new ,getter) ,(funcall setter new))))) 267 `(unless (eq ,new ,getter) ,(funcall setter new)))))
@@ -285,28 +334,21 @@ is defined as a macro, alias, command, ..."
285 ;; - change all defadvice in lisp/**/*.el. 334 ;; - change all defadvice in lisp/**/*.el.
286 ;; - rewrite advice.el on top of this. 335 ;; - rewrite advice.el on top of this.
287 ;; - obsolete advice.el. 336 ;; - obsolete advice.el.
288 ;; To make advice.el and nadvice.el interoperate properly I see 2 different
289 ;; ways:
290 ;; - keep them separate: complete the defalias-fset-function setter with
291 ;; a matching accessor which both nadvice.el and advice.el will have to use
292 ;; in place of symbol-function. This can probably be made to work, but
293 ;; they have to agree on a "protocol".
294 ;; - layer advice.el on top of nadvice.el. I prefer this approach. the
295 ;; simplest way is to make advice.el build one ad-Advice-foo function for
296 ;; each advised function which is advice-added/removed whenever ad-activate
297 ;; ad-deactivate is called.
298 (let* ((f (and (fboundp symbol) (symbol-function symbol))) 337 (let* ((f (and (fboundp symbol) (symbol-function symbol)))
299 (nf (advice--normalize symbol f))) 338 (nf (advice--normalize symbol f)))
300 (unless (eq f nf) ;; Most importantly, if nf == nil! 339 (unless (eq f nf) ;; Most importantly, if nf == nil!
301 (fset symbol nf)) 340 (fset symbol nf))
302 (add-function where (cond 341 (add-function where (cond
303 ((eq (car-safe nf) 'macro) (cdr nf)) 342 ((eq (car-safe nf) 'macro) (cdr nf))
304 ;; If the function is not yet defined, we can't yet 343 ;; Reasons to delay installation of the advice:
305 ;; install the advice. 344 ;; - If the function is not yet defined, installing
306 ;; FIXME: If it's an autoloaded command, we also 345 ;; the advice would affect `fboundp'ness.
307 ;; have a problem because we need to load the 346 ;; - If it's an autoloaded command,
308 ;; command to build the interactive-form. 347 ;; advice--make-interactive-form would end up
309 ((or (not nf) (and (autoloadp nf))) ;; (commandp nf) 348 ;; loading the command eagerly.
349 ;; - `autoload' does nothing if the function is
350 ;; not an autoload or undefined.
351 ((or (not nf) (autoloadp nf))
310 (get symbol 'advice--pending)) 352 (get symbol 'advice--pending))
311 (t (symbol-function symbol))) 353 (t (symbol-function symbol)))
312 function props) 354 function props)
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index c3d78b3444b..592cb1b0174 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -55,12 +55,18 @@
55 ;; have to flush that cache between each function, and we couldn't use 55 ;; have to flush that cache between each function, and we couldn't use
56 ;; syntax-ppss-flush-cache since that would not only flush the cache but also 56 ;; syntax-ppss-flush-cache since that would not only flush the cache but also
57 ;; reset syntax-propertize--done which should not be done in this case). 57 ;; reset syntax-propertize--done which should not be done in this case).
58 "Mode-specific function to apply the syntax-table properties. 58 "Mode-specific function to apply `syntax-table' text properties.
59Called with two arguments: START and END. 59The value of this variable is a function to be called by Font
60This function can call `syntax-ppss' on any position before END, but it 60Lock mode, prior to performing syntactic fontification on a
61should not call `syntax-ppss-flush-cache', which means that it should not 61stretch of text. It is given two arguments, START and END: the
62call `syntax-ppss' on some position and later modify the buffer on some 62start and end of the text to be fontified. Major modes can
63earlier position.") 63specify a custom function to apply `syntax-table' properties to
64override the default syntax table in special cases.
65
66The specified function may call `syntax-ppss' on any position
67before END, but it should not call `syntax-ppss-flush-cache',
68which means that it should not call `syntax-ppss' on some
69position and later modify the buffer on some earlier position.")
64 70
65(defvar syntax-propertize-chunk-size 500) 71(defvar syntax-propertize-chunk-size 500)
66 72
@@ -118,7 +124,7 @@ The arg RULES can be of the same form as in `syntax-propertize-rules'.
118The return value is an object that can be passed as a rule to 124The return value is an object that can be passed as a rule to
119`syntax-propertize-rules'. 125`syntax-propertize-rules'.
120I.e. this is useful only when you want to share rules among several 126I.e. this is useful only when you want to share rules among several
121syntax-propertize-functions." 127`syntax-propertize-function's."
122 (declare (debug syntax-propertize-rules)) 128 (declare (debug syntax-propertize-rules))
123 ;; Precompile? Yeah, right! 129 ;; Precompile? Yeah, right!
124 ;; Seriously, tho, this is a macro for 2 reasons: 130 ;; Seriously, tho, this is a macro for 2 reasons:
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 13dbba769a4..e0a88461dc9 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,7 @@
12012-11-16 Glenn Morris <rgm@gnu.org>
2
3 * erc.el (erc-modules): Add "notifications". Tweak "hecomplete" doc.
4
12012-10-28 Stefan Monnier <monnier@iro.umontreal.ca> 52012-10-28 Stefan Monnier <monnier@iro.umontreal.ca>
2 6
3 * erc-backend.el: Only require `erc' during compilation (bug#12740). 7 * erc-backend.el: Only require `erc' during compilation (bug#12740).
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 2e97131b603..7cb6fbb595b 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1843,7 +1843,7 @@ removed from the list will be disabled."
1843 capab-identify) 1843 capab-identify)
1844 (const :tag "completion: Complete nicknames and commands (programmable)" 1844 (const :tag "completion: Complete nicknames and commands (programmable)"
1845 completion) 1845 completion)
1846 (const :tag "hecomplete: Complete nicknames and commands (old)" hecomplete) 1846 (const :tag "hecomplete: Complete nicknames and commands (obsolete, use \"completion\")" hecomplete)
1847 (const :tag "dcc: Provide Direct Client-to-Client support" dcc) 1847 (const :tag "dcc: Provide Direct Client-to-Client support" dcc)
1848 (const :tag "fill: Wrap long lines" fill) 1848 (const :tag "fill: Wrap long lines" fill)
1849 (const :tag "identd: Launch an identd server on port 8113" identd) 1849 (const :tag "identd: Launch an identd server on port 8113" identd)
@@ -1863,6 +1863,8 @@ removed from the list will be disabled."
1863 (const :tag 1863 (const :tag
1864 "notify: Notify when the online status of certain users changes" 1864 "notify: Notify when the online status of certain users changes"
1865 notify) 1865 notify)
1866 (const :tag "notifications: Send notifications on PRIVMSG or nickname mentions"
1867 notifications)
1866 (const :tag "page: Process CTCP PAGE requests from IRC" page) 1868 (const :tag "page: Process CTCP PAGE requests from IRC" page)
1867 (const :tag "readonly: Make displayed lines read-only" readonly) 1869 (const :tag "readonly: Make displayed lines read-only" readonly)
1868 (const :tag "replace: Replace text in messages" replace) 1870 (const :tag "replace: Replace text in messages" replace)
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index a67861e83a9..aa8aae2d245 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -295,8 +295,8 @@ to writing a completion function."
295 'pcomplete-expand-and-complete) 295 'pcomplete-expand-and-complete)
296 (define-key eshell-command-map [space] 'pcomplete-expand) 296 (define-key eshell-command-map [space] 'pcomplete-expand)
297 (define-key eshell-command-map [? ] 'pcomplete-expand) 297 (define-key eshell-command-map [? ] 'pcomplete-expand)
298 (define-key eshell-mode-map [tab] 'pcomplete) 298 (define-key eshell-mode-map [tab] 'eshell-pcomplete)
299 (define-key eshell-mode-map [(control ?i)] 'pcomplete) 299 (define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete)
300 ;; jww (1999-10-19): Will this work on anything but X? 300 ;; jww (1999-10-19): Will this work on anything but X?
301 (if (featurep 'xemacs) 301 (if (featurep 'xemacs)
302 (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse) 302 (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse)
@@ -449,6 +449,13 @@ to writing a completion function."
449 (all-completions filename obarray 'functionp)) 449 (all-completions filename obarray 'functionp))
450 completions))))))) 450 completions)))))))
451 451
452(defun eshell-pcomplete ()
453 "Eshell wrapper for `pcomplete'."
454 (interactive)
455 (if eshell-cmpl-ignore-case
456 (pcomplete-expand-and-complete) ; hack workaround for bug#12838
457 (pcomplete)))
458
452(provide 'em-cmpl) 459(provide 'em-cmpl)
453 460
454;; Local Variables: 461;; Local Variables:
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index d3ddab8af1b..32744c702a6 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -306,12 +306,13 @@ Remove (unlink) the FILE(s).")
306 (eshell-eval-using-options 306 (eshell-eval-using-options
307 "mkdir" args 307 "mkdir" args
308 '((?h "help" nil nil "show this usage screen") 308 '((?h "help" nil nil "show this usage screen")
309 (?p "parents" nil em-parents "make parent directories as needed")
309 :external "mkdir" 310 :external "mkdir"
310 :show-usage 311 :show-usage
311 :usage "[OPTION] DIRECTORY... 312 :usage "[OPTION] DIRECTORY...
312Create the DIRECTORY(ies), if they do not already exist.") 313Create the DIRECTORY(ies), if they do not already exist.")
313 (while args 314 (while args
314 (eshell-funcalln 'make-directory (car args)) 315 (eshell-funcalln 'make-directory (car args) em-parents)
315 (setq args (cdr args))) 316 (setq args (cdr args)))
316 nil)) 317 nil))
317 318
diff --git a/lisp/faces.el b/lisp/faces.el
index f5ef88d08b0..9e0ca962499 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -487,16 +487,21 @@ with the `default' face (which is always completely specified)."
487(defalias 'face-background-pixmap 'face-stipple) 487(defalias 'face-background-pixmap 'face-stipple)
488 488
489 489
490;; FIXME all of these -p functions ignore inheritance (cf face-stipple).
491;; Ie, a face that inherits from an underlined face but does not
492;; specify :underline will return nil.
493;; So these functions don't actually tell you anything about how the
494;; face will _appear_. So not very useful IMO.
490(defun face-underline-p (face &optional frame) 495(defun face-underline-p (face &optional frame)
491 "Return non-nil if FACE is underlined. 496 "Return non-nil if FACE specifies a non-nil underlining.
492If the optional argument FRAME is given, report on face FACE in that frame. 497If the optional argument FRAME is given, report on face FACE in that frame.
493If FRAME is t, report on the defaults for face FACE (for new frames). 498If FRAME is t, report on the defaults for face FACE (for new frames).
494If FRAME is omitted or nil, use the selected frame." 499If FRAME is omitted or nil, use the selected frame."
495 (eq (face-attribute face :underline frame) t)) 500 (face-attribute-specified-or (face-attribute face :underline frame) nil))
496 501
497 502
498(defun face-inverse-video-p (face &optional frame) 503(defun face-inverse-video-p (face &optional frame)
499 "Return non-nil if FACE is in inverse video on FRAME. 504 "Return non-nil if FACE specifies a non-nil inverse-video.
500If the optional argument FRAME is given, report on face FACE in that frame. 505If the optional argument FRAME is given, report on face FACE in that frame.
501If FRAME is t, report on the defaults for face FACE (for new frames). 506If FRAME is t, report on the defaults for face FACE (for new frames).
502If FRAME is omitted or nil, use the selected frame." 507If FRAME is omitted or nil, use the selected frame."
@@ -837,21 +842,24 @@ and DATA is a string, containing the raw bits of the bitmap."
837 (set-face-attribute face frame :stipple (or stipple 'unspecified))) 842 (set-face-attribute face frame :stipple (or stipple 'unspecified)))
838 843
839 844
840(defun set-face-underline-p (face underline &optional frame) 845(defun set-face-underline (face underline &optional frame)
841 "Specify whether face FACE is underlined. 846 "Specify whether face FACE is underlined.
842UNDERLINE nil means FACE explicitly doesn't underline. 847UNDERLINE nil means FACE explicitly doesn't underline.
843UNDERLINE non-nil means FACE explicitly does underlining 848UNDERLINE t means FACE underlines with its foreground color.
844with the same of the foreground color. 849If UNDERLINE is a string, underline with that color.
845If UNDERLINE is a string, underline with the color named UNDERLINE. 850
851UNDERLINE may also be a list of the form (:color COLOR :style STYLE),
852where COLOR is a string or `foreground-color', and STYLE is either
853`line' or `wave'. :color may be omitted, which means to use the
854foreground color. :style may be omitted, which means to use a line.
855
846FRAME nil or not specified means change face on all frames. 856FRAME nil or not specified means change face on all frames.
847Use `set-face-attribute' to ``unspecify'' underlining." 857Use `set-face-attribute' to ``unspecify'' underlining."
848 (interactive 858 (interactive (read-face-and-attribute :underline))
849 (let ((list (read-face-and-attribute :underline)))
850 (list (car list) (eq (car (cdr list)) t))))
851 (set-face-attribute face frame :underline underline)) 859 (set-face-attribute face frame :underline underline))
852 860
853(define-obsolete-function-alias 'set-face-underline 861(define-obsolete-function-alias 'set-face-underline-p
854 'set-face-underline-p "22.1") 862 'set-face-underline "24.3")
855 863
856 864
857(defun set-face-inverse-video-p (face inverse-video-p &optional frame) 865(defun set-face-inverse-video-p (face inverse-video-p &optional frame)
@@ -866,6 +874,9 @@ Use `set-face-attribute' to ``unspecify'' the inverse video attribute."
866 (set-face-attribute face frame :inverse-video inverse-video-p)) 874 (set-face-attribute face frame :inverse-video inverse-video-p))
867 875
868 876
877;; The -p suffix is a hostage to fortune. What if we want to extend
878;; this to allow more than boolean options? Exactly this happened
879;; to set-face-underline-p.
869(defun set-face-bold-p (face bold-p &optional frame) 880(defun set-face-bold-p (face bold-p &optional frame)
870 "Specify whether face FACE is bold. 881 "Specify whether face FACE is bold.
871BOLD-P non-nil means FACE should explicitly display bold. 882BOLD-P non-nil means FACE should explicitly display bold.
@@ -1114,6 +1125,9 @@ name of the attribute for prompting. Value is the new attribute value."
1114 (string-to-number new-value))))) 1125 (string-to-number new-value)))))
1115 1126
1116 1127
1128;; FIXME this does allow you to enter the list forms of :box,
1129;; :stipple, or :underline, because face-valid-attribute-values does
1130;; not return those forms.
1117(defun read-face-attribute (face attribute &optional frame) 1131(defun read-face-attribute (face attribute &optional frame)
1118 "Interactively read a new value for FACE's ATTRIBUTE. 1132 "Interactively read a new value for FACE's ATTRIBUTE.
1119Optional argument FRAME nil or unspecified means read an attribute value 1133Optional argument FRAME nil or unspecified means read an attribute value
@@ -1125,12 +1139,11 @@ of a global face. Value is the new attribute value."
1125 ;; Represent complex attribute values as strings by printing them 1139 ;; Represent complex attribute values as strings by printing them
1126 ;; out. Stipple can be a vector; (WIDTH HEIGHT DATA). Box can be 1140 ;; out. Stipple can be a vector; (WIDTH HEIGHT DATA). Box can be
1127 ;; a list `(:width WIDTH :color COLOR)' or `(:width WIDTH :shadow 1141 ;; a list `(:width WIDTH :color COLOR)' or `(:width WIDTH :shadow
1128 ;; SHADOW)'. 1142 ;; SHADOW)'. Underline can be `(:color COLOR :style STYLE)'.
1129 (when (and (or (eq attribute :stipple) 1143 (and (memq attribute '(:box :stipple :underline))
1130 (eq attribute :box)) 1144 (or (consp old-value)
1131 (or (consp old-value) 1145 (vectorp old-value))
1132 (vectorp old-value))) 1146 (setq old-value (prin1-to-string old-value)))
1133 (setq old-value (prin1-to-string old-value)))
1134 (cond ((listp valid) 1147 (cond ((listp valid)
1135 (let ((default 1148 (let ((default
1136 (or (car (rassoc old-value valid)) 1149 (or (car (rassoc old-value valid))
@@ -1160,11 +1173,10 @@ of a global face. Value is the new attribute value."
1160 ;; Convert stipple and box value text we read back to a list or 1173 ;; Convert stipple and box value text we read back to a list or
1161 ;; vector if it looks like one. This makes the assumption that a 1174 ;; vector if it looks like one. This makes the assumption that a
1162 ;; pixmap file name won't start with an open-paren. 1175 ;; pixmap file name won't start with an open-paren.
1163 (when (and (or (eq attribute :stipple) 1176 (and (memq attribute '(:stipple :box :underline))
1164 (eq attribute :box)) 1177 (stringp new-value)
1165 (stringp new-value) 1178 (string-match "^[[(]" new-value)
1166 (string-match "^[[(]" new-value)) 1179 (setq new-value (read new-value)))
1167 (setq new-value (read new-value)))
1168 new-value)) 1180 new-value))
1169 1181
1170(declare-function fontset-list "fontset.c" ()) 1182(declare-function fontset-list "fontset.c" ())
diff --git a/lisp/filecache.el b/lisp/filecache.el
index 2dd7c2673bf..bc77c24fe63 100644
--- a/lisp/filecache.el
+++ b/lisp/filecache.el
@@ -267,42 +267,63 @@ files of names DIRNAME1/FILENAME, DIRNAME2/FILENAME, ...")
267;; Functions to add files to the cache 267;; Functions to add files to the cache
268;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 268;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
269 269
270(defun file-cache--read-list (file op-prompt)
271 (let* ((fun (if file 'read-file-name 'read-directory-name))
272 (type (if file "file" "directory"))
273 (prompt-1 (concat op-prompt " " type ": "))
274 (prompt-2 (concat op-prompt " another " type "?"))
275 (continue t)
276 result)
277 (while continue
278 (push (funcall fun prompt-1 nil nil t) result)
279 (setq continue (y-or-n-p prompt-2)))
280 (nreverse result)))
281
270;;;###autoload 282;;;###autoload
271(defun file-cache-add-directory (directory &optional regexp) 283(defun file-cache-add-directory (directory &optional regexp)
272 "Add DIRECTORY to the file cache. 284 "Add all files in DIRECTORY to the file cache.
273If the optional REGEXP argument is non-nil, only files which match it will 285If called from Lisp with a non-nil REGEXP argument is non-nil,
274be added to the cache." 286only add files whose names match REGEXP."
275 (interactive "DAdd files from directory: ") 287 (interactive (list (read-directory-name "Add files from directory: "
288 nil nil t)
289 nil))
276 ;; Not an error, because otherwise we can't use load-paths that 290 ;; Not an error, because otherwise we can't use load-paths that
277 ;; contain non-existent directories. 291 ;; contain non-existent directories.
278 (if (not (file-accessible-directory-p directory)) 292 (when (file-accessible-directory-p directory)
279 (message "Directory %s does not exist" directory)
280 (let* ((dir (expand-file-name directory)) 293 (let* ((dir (expand-file-name directory))
281 (dir-files (directory-files dir t regexp))) 294 (dir-files (directory-files dir t regexp)))
282 ;; Filter out files we don't want to see 295 ;; Filter out files we don't want to see
283 (dolist (file dir-files) 296 (dolist (file dir-files)
284 (if (file-directory-p file) 297 (if (file-directory-p file)
285 (setq dir-files (delq file dir-files)) 298 (setq dir-files (delq file dir-files))
286 (dolist (regexp file-cache-filter-regexps) 299 (dolist (regexp file-cache-filter-regexps)
287 (if (string-match regexp file) 300 (if (string-match regexp file)
288 (setq dir-files (delq file dir-files)))))) 301 (setq dir-files (delq file dir-files))))))
289 (file-cache-add-file-list dir-files)))) 302 (file-cache-add-file-list dir-files))))
290 303
291;;;###autoload 304;;;###autoload
292(defun file-cache-add-directory-list (directory-list &optional regexp) 305(defun file-cache-add-directory-list (directories &optional regexp)
293 "Add DIRECTORY-LIST (a list of directory names) to the file cache. 306 "Add DIRECTORIES (a list of directory names) to the file cache.
307If called interactively, read the directory names one by one.
294If the optional REGEXP argument is non-nil, only files which match it 308If the optional REGEXP argument is non-nil, only files which match it
295will be added to the cache. Note that the REGEXP is applied to the 309will be added to the cache. Note that the REGEXP is applied to the
296files in each directory, not to the directory list itself." 310files in each directory, not to the directory list itself."
297 (interactive "XAdd files from directory list: ") 311 (interactive (list (file-cache--read-list nil "Add")))
298 (mapcar 312 (dolist (dir directories)
299 (lambda (dir) (file-cache-add-directory dir regexp)) 313 (file-cache-add-directory dir regexp))
300 directory-list)) 314 (let ((n (length directories)))
301 315 (message "Filecache: cached file names from %d director%s."
302(defun file-cache-add-file-list (file-list) 316 n (if (= n 1) "y" "ies"))))
303 "Add FILE-LIST (a list of files names) to the file cache." 317
304 (interactive "XFile List: ") 318(defun file-cache-add-file-list (files)
305 (mapcar 'file-cache-add-file file-list)) 319 "Add FILES (a list of file names) to the file cache.
320If called interactively, read the file names one by one."
321 (interactive (list (file-cache--read-list t "Add")))
322 (dolist (f files)
323 (file-cache-add-file f))
324 (let ((n (length files)))
325 (message "Filecache: cached %d file name%s."
326 n (if (= n 1) "" "s"))))
306 327
307;; Workhorse function 328;; Workhorse function
308 329
@@ -310,23 +331,25 @@ files in each directory, not to the directory list itself."
310(defun file-cache-add-file (file) 331(defun file-cache-add-file (file)
311 "Add FILE to the file cache." 332 "Add FILE to the file cache."
312 (interactive "fAdd File: ") 333 (interactive "fAdd File: ")
313 (if (not (file-exists-p file)) 334 (setq file (file-truename file))
314 (message "Filecache: file %s does not exist" file) 335 (unless (file-exists-p file)
315 (let* ((file-name (file-name-nondirectory file)) 336 (error "Filecache: file %s does not exist" file))
316 (dir-name (file-name-directory file)) 337 (let* ((file-name (file-name-nondirectory file))
317 (the-entry (assoc-string 338 (dir-name (file-name-directory file))
318 file-name file-cache-alist 339 (the-entry (assoc-string file-name file-cache-alist
319 file-cache-ignore-case))) 340 file-cache-ignore-case)))
320 ;; Does the entry exist already? 341 (cond ((null the-entry)
321 (if the-entry 342 ;; If the entry wasn't in the cache, add it.
322 (if (or (and (stringp (cdr the-entry)) 343 (push (list file-name dir-name) file-cache-alist)
323 (string= dir-name (cdr the-entry))) 344 (if (called-interactively-p 'interactive)
324 (and (listp (cdr the-entry)) 345 (message "Filecache: cached file name %s." file)))
325 (member dir-name (cdr the-entry)))) 346 ((not (member dir-name (cdr the-entry)))
326 nil 347 (setcdr the-entry (cons dir-name (cdr the-entry)))
327 (setcdr the-entry (cons dir-name (cdr the-entry)))) 348 (if (called-interactively-p 'interactive)
328 ;; If not, add it to the cache 349 (message "Filecache: cached file name %s." file)))
329 (push (list file-name dir-name) file-cache-alist))))) 350 (t
351 (if (called-interactively-p 'interactive)
352 (message "Filecache: %s is already cached." file))))))
330 353
331;;;###autoload 354;;;###autoload
332(defun file-cache-add-directory-using-find (directory) 355(defun file-cache-add-directory-using-find (directory)
@@ -412,17 +435,26 @@ or the optional REGEXP argument."
412 435
413;; This clears *all* files with the given name 436;; This clears *all* files with the given name
414(defun file-cache-delete-file (file) 437(defun file-cache-delete-file (file)
415 "Delete FILE from the file cache." 438 "Delete FILE (a relative file name) from the file cache.
439Return nil if FILE was not in the file cache, non-nil otherwise."
416 (interactive 440 (interactive
417 (list (completing-read "Delete file from cache: " file-cache-alist))) 441 (list (completing-read "Delete file from cache: " file-cache-alist)))
418 (setq file-cache-alist 442 (let ((elt (assoc-string file file-cache-alist file-cache-ignore-case)))
419 (delq (assoc-string file file-cache-alist file-cache-ignore-case) 443 (setq file-cache-alist (delq elt file-cache-alist))
420 file-cache-alist))) 444 elt))
421 445
422(defun file-cache-delete-file-list (file-list) 446(defun file-cache-delete-file-list (files &optional message)
423 "Delete FILE-LIST (a list of files) from the file cache." 447 "Delete FILES (a list of files) from the file cache.
424 (interactive "XFile List: ") 448If called interactively, read the file names one by one.
425 (mapcar 'file-cache-delete-file file-list)) 449If MESSAGE is non-nil, or if called interactively, print a
450message reporting the number of file names deleted."
451 (interactive (list (file-cache--read-list t "Uncache") t))
452 (let ((n 0))
453 (dolist (f files)
454 (if (file-cache-delete-file f)
455 (setq n (1+ n))))
456 (message "Filecache: uncached %d file name%s."
457 n (if (= n 1) "" "s"))))
426 458
427(defun file-cache-delete-file-regexp (regexp) 459(defun file-cache-delete-file-regexp (regexp)
428 "Delete files matching REGEXP from the file cache." 460 "Delete files matching REGEXP from the file cache."
@@ -431,21 +463,18 @@ or the optional REGEXP argument."
431 (dolist (elt file-cache-alist) 463 (dolist (elt file-cache-alist)
432 (and (string-match regexp (car elt)) 464 (and (string-match regexp (car elt))
433 (push (car elt) delete-list))) 465 (push (car elt) delete-list)))
434 (file-cache-delete-file-list delete-list) 466 (file-cache-delete-file-list delete-list)))
435 (message "Filecache: deleted %d files from file cache"
436 (length delete-list))))
437 467
438(defun file-cache-delete-directory (directory) 468(defun file-cache-delete-directory (directory)
439 "Delete DIRECTORY from the file cache." 469 "Delete DIRECTORY from the file cache."
440 (interactive "DDelete directory from file cache: ") 470 (interactive "DDelete directory from file cache: ")
441 (let ((dir (expand-file-name directory)) 471 (let ((dir (expand-file-name directory))
442 (result 0)) 472 (n 0))
443 (dolist (entry file-cache-alist) 473 (dolist (entry file-cache-alist)
444 (if (file-cache-do-delete-directory dir entry) 474 (if (file-cache-do-delete-directory dir entry)
445 (setq result (1+ result)))) 475 (setq n (1+ n))))
446 (if (zerop result) 476 (message "Filecache: uncached %d file name%s."
447 (error "Filecache: no entries containing %s found in cache" directory) 477 n (if (= n 1) "" "s"))))
448 (message "Filecache: deleted %d entries" result))))
449 478
450(defun file-cache-do-delete-directory (dir entry) 479(defun file-cache-do-delete-directory (dir entry)
451 (let ((directory-list (cdr entry)) 480 (let ((directory-list (cdr entry))
@@ -456,10 +485,12 @@ or the optional REGEXP argument."
456 (delq entry file-cache-alist)) 485 (delq entry file-cache-alist))
457 (setcdr entry (delete directory directory-list)))))) 486 (setcdr entry (delete directory directory-list))))))
458 487
459(defun file-cache-delete-directory-list (directory-list) 488(defun file-cache-delete-directory-list (directories)
460 "Delete DIRECTORY-LIST (a list of directories) from the file cache." 489 "Delete DIRECTORIES (a list of directory names) from the file cache.
461 (interactive "XDirectory List: ") 490If called interactively, read the directory names one by one."
462 (mapcar 'file-cache-delete-directory directory-list)) 491 (interactive (list (file-cache--read-list nil "Uncache")))
492 (dolist (d directories)
493 (file-cache-delete-directory d)))
463 494
464;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 495;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
465;; Utility functions 496;; Utility functions
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index 878021ec5c5..e2533c1f12b 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -549,6 +549,9 @@ like an INI file. You can add this hook to `find-file-hook'."
549 (concat (w32-shell-name) " -c " (buffer-file-name))))) 549 (concat (w32-shell-name) " -c " (buffer-file-name)))))
550 550
551(eval-when-compile (require 'comint)) 551(eval-when-compile (require 'comint))
552(declare-function comint-mode "comint" ())
553(declare-function comint-exec "comint" (buffer name command startfile switches))
554
552(defun bat-generic-mode-run-as-comint () 555(defun bat-generic-mode-run-as-comint ()
553 "Run the current BAT file in a comint buffer." 556 "Run the current BAT file in a comint buffer."
554 (interactive) 557 (interactive)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 5f635e59cdf..dd493d383a3 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,17 @@
12012-11-16 Jan Tatarik <jan.tatarik@gmail.com>
2
3 * gnus-score.el (gnus-score-body):
4 * gnus-logic.el (gnus-advanced-body): Don't score by headers when
5 scoring by body.
6
72012-11-16 Glenn Morris <rgm@gnu.org>
8
9 * gnus-diary.el (nndiary-request-create-group-functions)
10 (nndiary-request-update-info-functions)
11 (gnus-subscribe-newsgroup-functions)
12 (nndiary-request-accept-article-functions):
13 Use new names for hooks rather than obsolete aliases.
14
12012-11-08 Katsumi Yamaoka <yamaoka@jpl.org> 152012-11-08 Katsumi Yamaoka <yamaoka@jpl.org>
2 16
3 * gnus-art.el (gnus-article-browse-html-parts): Always replace charset 17 * gnus-art.el (gnus-article-browse-html-parts): Always replace charset
diff --git a/lisp/gnus/gnus-diary.el b/lisp/gnus/gnus-diary.el
index 854af2f5d76..bca307b19b6 100644
--- a/lisp/gnus/gnus-diary.el
+++ b/lisp/gnus/gnus-diary.el
@@ -277,18 +277,18 @@ Optional prefix (or REVERSE argument) means sort in reverse order."
277 277
278;; Called when a group is subscribed. This is needed because groups created 278;; Called when a group is subscribed. This is needed because groups created
279;; because of mail splitting are *not* created with the back end function. 279;; because of mail splitting are *not* created with the back end function.
280;; Thus, `nndiary-request-create-group-hooks' is inoperative. 280;; Thus, `nndiary-request-create-group-functions' is inoperative.
281(defun gnus-diary-maybe-update-group-parameters (group) 281(defun gnus-diary-maybe-update-group-parameters (group)
282 (when (eq (car (gnus-find-method-for-group group)) 'nndiary) 282 (when (eq (car (gnus-find-method-for-group group)) 'nndiary)
283 (gnus-diary-update-group-parameters group))) 283 (gnus-diary-update-group-parameters group)))
284 284
285(add-hook 'nndiary-request-create-group-hooks 285(add-hook 'nndiary-request-create-group-functions
286 'gnus-diary-update-group-parameters) 286 'gnus-diary-update-group-parameters)
287;; Now that we have `gnus-subscribe-newsgroup-hooks', this is not needed 287;; Now that we have `gnus-subscribe-newsgroup-functions', this is not needed
288;; anymore. Maybe I should remove this completely. 288;; anymore. Maybe I should remove this completely.
289(add-hook 'nndiary-request-update-info-hooks 289(add-hook 'nndiary-request-update-info-functions
290 'gnus-diary-update-group-parameters) 290 'gnus-diary-update-group-parameters)
291(add-hook 'gnus-subscribe-newsgroup-hooks 291(add-hook 'gnus-subscribe-newsgroup-functions
292 'gnus-diary-maybe-update-group-parameters) 292 'gnus-diary-maybe-update-group-parameters)
293 293
294 294
@@ -384,7 +384,7 @@ If ARG (or prefix) is non-nil, force prompting for all fields."
384 nndiary-headers) 384 nndiary-headers)
385 )) 385 ))
386 386
387(add-hook 'nndiary-request-accept-article-hooks 387(add-hook 'nndiary-request-accept-article-functions
388 (lambda () (gnus-diary-check-message nil))) 388 (lambda () (gnus-diary-check-message nil)))
389 389
390(define-key message-mode-map "\C-c\C-fd" 'gnus-diary-check-message) 390(define-key message-mode-map "\C-c\C-fd" 'gnus-diary-check-message)
diff --git a/lisp/gnus/gnus-logic.el b/lisp/gnus/gnus-logic.el
index a440b779930..60d7b31713b 100644
--- a/lisp/gnus/gnus-logic.el
+++ b/lisp/gnus/gnus-logic.el
@@ -181,17 +181,18 @@
181 (with-current-buffer nntp-server-buffer 181 (with-current-buffer nntp-server-buffer
182 (let* ((request-func (cond ((string= "head" header) 182 (let* ((request-func (cond ((string= "head" header)
183 'gnus-request-head) 183 'gnus-request-head)
184 ;; We need to peek at the headers to detect the
185 ;; content encoding
186 ((string= "body" header) 184 ((string= "body" header)
187 'gnus-request-article) 185 'gnus-request-body)
188 (t 'gnus-request-article))) 186 (t 'gnus-request-article)))
189 ofunc article handles) 187 ofunc article handles)
190 ;; Not all backends support partial fetching. In that case, we 188 ;; Not all backends support partial fetching. In that case, we
191 ;; just fetch the entire article. 189 ;; just fetch the entire article.
192 (unless (gnus-check-backend-function 190 ;; When scoring by body, we need to peek at the headers to detect the
193 (intern (concat "request-" header)) 191 ;; content encoding
194 gnus-newsgroup-name) 192 (unless (or (gnus-check-backend-function
193 (intern (concat "request-" header))
194 gnus-newsgroup-name)
195 (string= "body" header))
195 (setq ofunc request-func) 196 (setq ofunc request-func)
196 (setq request-func 'gnus-request-article)) 197 (setq request-func 'gnus-request-article))
197 (setq article (mail-header-number gnus-advanced-headers)) 198 (setq article (mail-header-number gnus-advanced-headers))
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index f215b845514..b7061960839 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -1762,21 +1762,22 @@ score in `gnus-newsgroup-scored' by SCORE."
1762 (all-scores scores) 1762 (all-scores scores)
1763 (request-func (cond ((string= "head" header) 1763 (request-func (cond ((string= "head" header)
1764 'gnus-request-head) 1764 'gnus-request-head)
1765 ;; We need to peek at the headers to detect
1766 ;; the content encoding
1767 ((string= "body" header) 1765 ((string= "body" header)
1768 'gnus-request-article) 1766 'gnus-request-body)
1769 (t 'gnus-request-article))) 1767 (t 'gnus-request-article)))
1770 entries alist ofunc article last) 1768 entries alist ofunc article last)
1771 (when articles 1769 (when articles
1772 (setq last (mail-header-number (caar (last articles)))) 1770 (setq last (mail-header-number (caar (last articles))))
1773 ;; Not all backends support partial fetching. In that case, 1771 ;; Not all backends support partial fetching. In that case,
1774 ;; we just fetch the entire article. 1772 ;; we just fetch the entire article.
1775 (unless (gnus-check-backend-function 1773 ;; When scoring by body, we need to peek at the headers to detect
1776 (and (string-match "^gnus-" (symbol-name request-func)) 1774 ;; the content encoding
1777 (intern (substring (symbol-name request-func) 1775 (unless (or (gnus-check-backend-function
1778 (match-end 0)))) 1776 (and (string-match "^gnus-" (symbol-name request-func))
1779 gnus-newsgroup-name) 1777 (intern (substring (symbol-name request-func)
1778 (match-end 0))))
1779 gnus-newsgroup-name)
1780 (string= "body" header))
1780 (setq ofunc request-func) 1781 (setq ofunc request-func)
1781 (setq request-func 'gnus-request-article)) 1782 (setq request-func 'gnus-request-article))
1782 (while articles 1783 (while articles
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index c1ce5a521be..48c5849d301 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -677,7 +677,8 @@ help buffer."
677 " is also a " "face." "\n\n" facedoc)) 677 " is also a " "face." "\n\n" facedoc))
678 ;; Don't record the `describe-function' item in the stack. 678 ;; Don't record the `describe-function' item in the stack.
679 (setq help-xref-stack-item nil) 679 (setq help-xref-stack-item nil)
680 (help-setup-xref (list #'help-xref-interned symbol) nil))))))) 680 (help-setup-xref (list #'help-xref-interned symbol) nil))))
681 (goto-char (point-min)))))
681 682
682 683
683;; Navigation/hyperlinking with xrefs 684;; Navigation/hyperlinking with xrefs
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 72ca189e9d5..4e0ac1a4856 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1362,24 +1362,27 @@ group."
1362(defun ibuffer-mark-forward (arg) 1362(defun ibuffer-mark-forward (arg)
1363 "Mark the buffer on this line, and move forward ARG lines. 1363 "Mark the buffer on this line, and move forward ARG lines.
1364If point is on a group name, this function operates on that group." 1364If point is on a group name, this function operates on that group."
1365 (interactive "P") 1365 (interactive "p")
1366 (ibuffer-mark-interactive arg ibuffer-marked-char 1)) 1366 (ibuffer-mark-interactive arg ibuffer-marked-char))
1367 1367
1368(defun ibuffer-unmark-forward (arg) 1368(defun ibuffer-unmark-forward (arg)
1369 "Unmark the buffer on this line, and move forward ARG lines. 1369 "Unmark the buffer on this line, and move forward ARG lines.
1370If point is on a group name, this function operates on that group." 1370If point is on a group name, this function operates on that group."
1371 (interactive "P") 1371 (interactive "p")
1372 (ibuffer-mark-interactive arg ?\s 1)) 1372 (ibuffer-mark-interactive arg ?\s))
1373 1373
1374(defun ibuffer-unmark-backward (arg) 1374(defun ibuffer-unmark-backward (arg)
1375 "Unmark the buffer on this line, and move backward ARG lines. 1375 "Unmark the buffer on this line, and move backward ARG lines.
1376If point is on a group name, this function operates on that group." 1376If point is on a group name, this function operates on that group."
1377 (interactive "P") 1377 (interactive "p")
1378 (ibuffer-mark-interactive arg ?\s -1)) 1378 (ibuffer-unmark-forward (- arg)))
1379 1379
1380(defun ibuffer-mark-interactive (arg mark movement) 1380(defun ibuffer-mark-interactive (arg mark &optional movement)
1381 (ibuffer-assert-ibuffer-mode) 1381 (ibuffer-assert-ibuffer-mode)
1382 (or arg (setq arg 1)) 1382 (or arg (setq arg 1))
1383 ;; deprecated movement argument
1384 (when (and movement (< movement 0))
1385 (setq arg (- arg)))
1383 (ibuffer-forward-line 0) 1386 (ibuffer-forward-line 0)
1384 (ibuffer-aif (get-text-property (point) 'ibuffer-filter-group-name) 1387 (ibuffer-aif (get-text-property (point) 'ibuffer-filter-group-name)
1385 (progn 1388 (progn
@@ -1389,8 +1392,12 @@ If point is on a group name, this function operates on that group."
1389 (let ((inhibit-read-only t)) 1392 (let ((inhibit-read-only t))
1390 (while (> arg 0) 1393 (while (> arg 0)
1391 (ibuffer-set-mark mark) 1394 (ibuffer-set-mark mark)
1392 (ibuffer-forward-line movement t) 1395 (ibuffer-forward-line 1 t)
1393 (setq arg (1- arg)))))) 1396 (setq arg (1- arg)))
1397 (while (< arg 0)
1398 (ibuffer-forward-line -1 t)
1399 (ibuffer-set-mark mark)
1400 (setq arg (1+ arg))))))
1394 1401
1395(defun ibuffer-set-mark (mark) 1402(defun ibuffer-set-mark (mark)
1396 (ibuffer-assert-ibuffer-mode) 1403 (ibuffer-assert-ibuffer-mode)
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 3659894f08d..77c968b21ae 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -2454,6 +2454,8 @@ when using per-directory thumbnail file storage"))
2454(defvar image-dired-widget-list nil 2454(defvar image-dired-widget-list nil
2455 "List to keep track of meta data in edit buffer.") 2455 "List to keep track of meta data in edit buffer.")
2456 2456
2457(declare-function widget-forward "wid-edit" (arg))
2458
2457;;;###autoload 2459;;;###autoload
2458(defun image-dired-dired-edit-comment-and-tags () 2460(defun image-dired-dired-edit-comment-and-tags ()
2459 "Edit comment and tags of current or marked image files. 2461 "Edit comment and tags of current or marked image files.
diff --git a/lisp/image.el b/lisp/image.el
index bd2f5c3a3ca..27bbc2c08d6 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -429,7 +429,7 @@ means display it in the right marginal area."
429 "Insert IMAGE into current buffer at point. 429 "Insert IMAGE into current buffer at point.
430IMAGE is displayed by inserting STRING into the current buffer 430IMAGE is displayed by inserting STRING into the current buffer
431with a `display' property whose value is the image. STRING 431with a `display' property whose value is the image. STRING
432defaults to the empty string if you omit it. 432defaults to a single space if you omit it.
433AREA is where to display the image. AREA nil or omitted means 433AREA is where to display the image. AREA nil or omitted means
434display it in the text area, a value of `left-margin' means 434display it in the text area, a value of `left-margin' means
435display it in the left marginal area, a value of `right-margin' 435display it in the left marginal area, a value of `right-margin'
@@ -467,8 +467,8 @@ height of the image; integer values are taken as pixel values."
467(defun insert-sliced-image (image &optional string area rows cols) 467(defun insert-sliced-image (image &optional string area rows cols)
468 "Insert IMAGE into current buffer at point. 468 "Insert IMAGE into current buffer at point.
469IMAGE is displayed by inserting STRING into the current buffer 469IMAGE is displayed by inserting STRING into the current buffer
470with a `display' property whose value is the image. STRING is 470with a `display' property whose value is the image. The default
471defaulted if you omit it. 471STRING is a single space.
472AREA is where to display the image. AREA nil or omitted means 472AREA is where to display the image. AREA nil or omitted means
473display it in the text area, a value of `left-margin' means 473display it in the text area, a value of `left-margin' means
474display it in the left marginal area, a value of `right-margin' 474display it in the left marginal area, a value of `right-margin'
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 4686d1cf538..1d3da2db15b 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -546,9 +546,7 @@ The returned alist DOES NOT share structure with MENULIST."
546Return a split and sorted copy of ALIST. The returned alist DOES 546Return a split and sorted copy of ALIST. The returned alist DOES
547NOT share structure with ALIST." 547NOT share structure with ALIST."
548 (mapcar (lambda (elt) 548 (mapcar (lambda (elt)
549 (if (and (consp elt) 549 (if (imenu--subalist-p elt)
550 (stringp (car elt))
551 (listp (cdr elt)))
552 (imenu--split-menu (cdr elt) (car elt)) 550 (imenu--split-menu (cdr elt) (car elt))
553 elt)) 551 elt))
554 alist)) 552 alist))
diff --git a/lisp/info.el b/lisp/info.el
index 36ffa806f04..b0ef5c6bc4d 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -4836,6 +4836,17 @@ first line or header line, and for breadcrumb links.")
4836;; current Info node. 4836;; current Info node.
4837(eval-when-compile (require 'speedbar)) 4837(eval-when-compile (require 'speedbar))
4838 4838
4839(declare-function speedbar-add-expansion-list "speedbar" (new-list))
4840(declare-function speedbar-center-buffer-smartly "speedbar" ())
4841(declare-function speedbar-change-expand-button-char "speedbar" (char))
4842(declare-function speedbar-change-initial-expansion-list "speedbar" (new-default))
4843(declare-function speedbar-delete-subblock "speedbar" (indent))
4844(declare-function speedbar-make-specialized-keymap "speedbar" ())
4845(declare-function speedbar-make-tag-line "speedbar"
4846 (exp-button-type exp-button-char exp-button-function
4847 exp-button-data tag-button tag-button-function
4848 tag-button-data tag-button-face depth))
4849
4839(defvar Info-speedbar-key-map nil 4850(defvar Info-speedbar-key-map nil
4840 "Keymap used when in the Info display mode.") 4851 "Keymap used when in the Info display mode.")
4841 4852
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 60b39606d86..0aa1b8957ac 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -521,12 +521,12 @@ It is needed when D-Bus signals or errors arrive, because there
521is no information where to trace the message.") 521is no information where to trace the message.")
522 522
523(defun tramp-gvfs-dbus-event-error (event err) 523(defun tramp-gvfs-dbus-event-error (event err)
524 "Called when a D-Bus error message arrives, see `dbus-event-error-hooks'." 524 "Called when a D-Bus error message arrives, see `dbus-event-error-functions'."
525 (when tramp-gvfs-dbus-event-vector 525 (when tramp-gvfs-dbus-event-vector
526 (tramp-message tramp-gvfs-dbus-event-vector 10 "%S" event) 526 (tramp-message tramp-gvfs-dbus-event-vector 10 "%S" event)
527 (tramp-error tramp-gvfs-dbus-event-vector 'file-error "%s" (cadr err)))) 527 (tramp-error tramp-gvfs-dbus-event-vector 'file-error "%s" (cadr err))))
528 528
529(add-hook 'dbus-event-error-hooks 'tramp-gvfs-dbus-event-error) 529(add-hook 'dbus-event-error-functions 'tramp-gvfs-dbus-event-error)
530 530
531 531
532;; File name primitives. 532;; File name primitives.
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el
index f3e277e338c..a3ea4af4651 100644
--- a/lisp/play/gamegrid.el
+++ b/lisp/play/gamegrid.el
@@ -560,7 +560,7 @@ FILE is created there."
560 (goto-char (point-min)) 560 (goto-char (point-min))
561 (search-forward (concat (int-to-string score) 561 (search-forward (concat (int-to-string score)
562 " " (user-login-name) " " 562 " " (user-login-name) " "
563 marker-string)) 563 marker-string) nil t)
564 (beginning-of-line))))) 564 (beginning-of-line)))))
565 565
566(defun gamegrid-add-score-insecure (file score &optional directory) 566(defun gamegrid-add-score-insecure (file score &optional directory)
diff --git a/lisp/printing.el b/lisp/printing.el
index 02b2fb0139c..26a7648f68e 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -1383,6 +1383,10 @@ Used by `pr-menu-bind' and `pr-update-menus'.")
1383 (eval-when-compile 1383 (eval-when-compile
1384 (require 'easymenu)) ; to avoid compilation gripes 1384 (require 'easymenu)) ; to avoid compilation gripes
1385 1385
1386 (declare-function easy-menu-add-item "easymenu"
1387 (map path item &optional before))
1388 (declare-function easy-menu-remove-item "easymenu" (map path name))
1389
1386 (eval-and-compile 1390 (eval-and-compile
1387 (defun pr-global-menubar (pr-menu-spec) 1391 (defun pr-global-menubar (pr-menu-spec)
1388 (require 'easymenu) 1392 (require 'easymenu)
@@ -6079,6 +6083,8 @@ COMMAND.exe, COMMAND.bat and COMMAND.com in this order."
6079 (and pr-i-region ; let region activated 6083 (and pr-i-region ; let region activated
6080 (pr-keep-region-active))) 6084 (pr-keep-region-active)))
6081 6085
6086(declare-function widget-field-action "wid-edit" (widget &optional _event))
6087(declare-function widget-value-set "wid-edit" (widget value))
6082 6088
6083(defun pr-insert-section-1 () 6089(defun pr-insert-section-1 ()
6084 ;; 1. Print: 6090 ;; 1. Print:
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 25a6fbfd998..dd104d436b5 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -3608,6 +3608,7 @@ functions to do caching and flushing if appropriate."
3608 nil 3608 nil
3609 3609
3610(eval-when-compile (condition-case nil (require 'imenu) (error nil))) 3610(eval-when-compile (condition-case nil (require 'imenu) (error nil)))
3611(declare-function imenu--make-index-alist "imenu" (&optional no-error))
3611 3612
3612(defun speedbar-fetch-dynamic-imenu (file) 3613(defun speedbar-fetch-dynamic-imenu (file)
3613 "Load FILE into a buffer, and generate tags using Imenu. 3614 "Load FILE into a buffer, and generate tags using Imenu.
diff --git a/lisp/subr.el b/lisp/subr.el
index b0ac2dd2106..8410897fd6f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3189,6 +3189,7 @@ in which case `save-window-excursion' cannot help."
3189 ;; Return nil. 3189 ;; Return nil.
3190 nil) 3190 nil)
3191 3191
3192;; Doc is very similar to with-temp-buffer-window.
3192(defmacro with-output-to-temp-buffer (bufname &rest body) 3193(defmacro with-output-to-temp-buffer (bufname &rest body)
3193 "Bind `standard-output' to buffer BUFNAME, eval BODY, then show that buffer. 3194 "Bind `standard-output' to buffer BUFNAME, eval BODY, then show that buffer.
3194 3195
@@ -3214,7 +3215,9 @@ with the buffer BUFNAME temporarily current. It runs the hook
3214`temp-buffer-show-hook' after displaying buffer BUFNAME, with that 3215`temp-buffer-show-hook' after displaying buffer BUFNAME, with that
3215buffer temporarily current, and the window that was used to display it 3216buffer temporarily current, and the window that was used to display it
3216temporarily selected. But it doesn't run `temp-buffer-show-hook' 3217temporarily selected. But it doesn't run `temp-buffer-show-hook'
3217if it uses `temp-buffer-show-function'." 3218if it uses `temp-buffer-show-function'.
3219
3220See the related form `with-temp-buffer-window'."
3218 (declare (debug t)) 3221 (declare (debug t))
3219 (let ((old-dir (make-symbol "old-dir")) 3222 (let ((old-dir (make-symbol "old-dir"))
3220 (buf (make-symbol "buf"))) 3223 (buf (make-symbol "buf")))
@@ -3961,11 +3964,16 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
3961 (put symbol 'hookvar (or hookvar 'mail-send-hook))) 3964 (put symbol 'hookvar (or hookvar 'mail-send-hook)))
3962 3965
3963(defun set-temporary-overlay-map (map &optional keep-pred) 3966(defun set-temporary-overlay-map (map &optional keep-pred)
3964 "Set MAP as a temporary overlay map. 3967 "Set MAP as a temporary keymap taking precedence over most other keymaps.
3965When KEEP-PRED is `t', using a key from the temporary keymap 3968Note that this does NOT take precedence over the \"overriding\" maps
3966leaves this keymap activated. KEEP-PRED can also be a function, 3969`overriding-terminal-local-map' and `overriding-local-map' (or the
3967which will have the same effect when it returns `t'. 3970`keymap' text property). Unlike those maps, if no match for a key is
3968When KEEP-PRED is nil, the temporary keymap is used only once." 3971found in MAP, the normal key lookup sequence then continues.
3972
3973Normally, MAP is used only once. If the optional argument
3974KEEP-PRED is t, MAP stays active if a key from MAP is used.
3975KEEP-PRED can also be a function of no arguments: if it returns
3976non-nil then MAP stays active."
3969 (let* ((clearfunsym (make-symbol "clear-temporary-overlay-map")) 3977 (let* ((clearfunsym (make-symbol "clear-temporary-overlay-map"))
3970 (overlaysym (make-symbol "t")) 3978 (overlaysym (make-symbol "t"))
3971 (alist (list (cons overlaysym map))) 3979 (alist (list (cons overlaysym map)))
diff --git a/lisp/term.el b/lisp/term.el
index e6466b8fa95..a7c50d65562 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -397,6 +397,12 @@
397(require 'ring) 397(require 'ring)
398(require 'ehelp) 398(require 'ehelp)
399 399
400(declare-function ring-empty-p "ring" (ring))
401(declare-function ring-ref "ring" (ring index))
402(declare-function ring-insert-at-beginning "ring" (ring item))
403(declare-function ring-length "ring" (ring))
404(declare-function ring-insert "ring" (ring item))
405
400(defgroup term nil 406(defgroup term nil
401 "General command interpreter in a window." 407 "General command interpreter in a window."
402 :group 'processes) 408 :group 'processes)
@@ -4178,11 +4184,16 @@ the process. Any more args are arguments to PROGRAM."
4178 (term-mode) 4184 (term-mode)
4179 (term-char-mode) 4185 (term-char-mode)
4180 4186
4181 ;; I wanna have find-file on C-x C-f -mm 4187 ;; Historical baggage. A call to term-set-escape-char used to not
4182 ;; your mileage may definitely vary, maybe it's better to put this in your 4188 ;; undo any previous call to t-s-e-c. Because of this, ansi-term
4183 ;; .emacs ... 4189 ;; ended up with both C-x and C-c as escape chars. Who knows what
4184 4190 ;; the original intention was, but people could have become used to
4185 (term-set-escape-char ?\C-x) 4191 ;; either. (Bug#12842)
4192 (let (term-escape-char)
4193 ;; I wanna have find-file on C-x C-f -mm
4194 ;; your mileage may definitely vary, maybe it's better to put this in your
4195 ;; .emacs ...
4196 (term-set-escape-char ?\C-x))
4186 4197
4187 (switch-to-buffer term-ansi-buffer-name)) 4198 (switch-to-buffer term-ansi-buffer-name))
4188 4199
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index ad6e1125027..42e09b65750 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -91,6 +91,9 @@
91(declare-function w32-send-sys-command "w32fns.c") 91(declare-function w32-send-sys-command "w32fns.c")
92(declare-function set-message-beep "w32fns.c") 92(declare-function set-message-beep "w32fns.c")
93 93
94(declare-function cygwin-convert-path-from-windows "cygw32.c"
95 (path &optional absolute_p))
96
94;; Conditional on new-fontset so bootstrapping works on non-GUI compiles 97;; Conditional on new-fontset so bootstrapping works on non-GUI compiles
95(if (fboundp 'new-fontset) 98(if (fboundp 'new-fontset)
96 (require 'fontset)) 99 (require 'fontset))
@@ -116,7 +119,11 @@
116 "/") 119 "/")
117 "/"))) 120 "/")))
118 (dnd-handle-one-url window 'private 121 (dnd-handle-one-url window 'private
119 (concat "file:" file-name))) 122 (concat
123 (if (eq system-type 'cygwin)
124 "file://"
125 "file:")
126 file-name)))
120 127
121(defun w32-drag-n-drop (event &optional new-frame) 128(defun w32-drag-n-drop (event &optional new-frame)
122 "Edit the files listed in the drag-n-drop EVENT. 129 "Edit the files listed in the drag-n-drop EVENT.
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el
index cb61a021251..2efabed5cd8 100644
--- a/lisp/url/url-parse.el
+++ b/lisp/url/url-parse.el
@@ -48,7 +48,7 @@
48 48
49(defun url-path-and-query (urlobj) 49(defun url-path-and-query (urlobj)
50 "Return the path and query components of URLOBJ. 50 "Return the path and query components of URLOBJ.
51These two components are store together in the FILENAME slot of 51These two components are stored together in the FILENAME slot of
52the object. The return value of this function is (PATH . QUERY), 52the object. The return value of this function is (PATH . QUERY),
53where each of PATH and QUERY are strings or nil." 53where each of PATH and QUERY are strings or nil."
54 (let ((name (url-filename urlobj)) 54 (let ((name (url-filename urlobj))
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 3becd8950f1..370cd0a9dca 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -414,7 +414,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
414 ;; We also used to match the filename in column 0 without any 414 ;; We also used to match the filename in column 0 without any
415 ;; meta-info before it, but I believe this can never happen. 415 ;; meta-info before it, but I believe this can never happen.
416 (concat "^\\(\\([ACGDU]\\)\\(.[B ]\\)? \\)" 416 (concat "^\\(\\([ACGDU]\\)\\(.[B ]\\)? \\)"
417 (regexp-quote (file-name-nondirectory file))) 417 (regexp-quote (file-relative-name file)))
418 nil t) 418 nil t)
419 (cond 419 (cond
420 ;; Merge successful, we are in sync with repository now 420 ;; Merge successful, we are in sync with repository now
diff --git a/lisp/vcursor.el b/lisp/vcursor.el
index 19cb7a9df8d..a277abcad9b 100644
--- a/lisp/vcursor.el
+++ b/lisp/vcursor.el
@@ -881,6 +881,8 @@ ALL-FRAMES is also used to decide whether to split the window."
881 (vcursor-disable -1)))) 881 (vcursor-disable -1))))
882 ) 882 )
883 883
884(declare-function compare-windows-skip-whitespace "compare-w" (start))
885
884;; vcursor-compare-windows is copied from compare-w.el with only 886;; vcursor-compare-windows is copied from compare-w.el with only
885;; minor modifications; these are too bound up with the function 887;; minor modifications; these are too bound up with the function
886;; to make it really useful to call compare-windows itself. 888;; to make it really useful to call compare-windows itself.
diff --git a/lisp/window.el b/lisp/window.el
index 30ee622cfe6..d378ea5ff14 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -142,41 +142,46 @@ to `display-buffer'."
142 ;; Return the window. 142 ;; Return the window.
143 window)))) 143 window))))
144 144
145;; Doc is very similar to with-output-to-temp-buffer.
145(defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body) 146(defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body)
146 "Evaluate BODY and display the buffer specified by BUFFER-OR-NAME. 147 "Bind `standard-output' to BUFFER-OR-NAME, eval BODY, show the buffer.
147BUFFER-OR-NAME must specify either a live buffer, or the name of a 148BUFFER-OR-NAME must specify either a live buffer, or the name of a
148buffer (if it does not exist, this macro creates it). 149buffer (if it does not exist, this macro creates it).
149 150
150Make sure the specified buffer is empty before evaluating BODY. 151This construct makes buffer BUFFER-OR-NAME empty before running BODY.
151Do not make that buffer current for BODY. Instead, bind 152It does not make the buffer current for BODY.
152`standard-output' to that buffer, so that output generated with 153Instead it binds `standard-output' to that buffer, so that output
153`prin1' and similar functions in BODY goes into that buffer. 154generated with `prin1' and similar functions in BODY goes into
155the buffer.
154 156
155After evaluating BODY, this marks the specified buffer unmodified and 157At the end of BODY, this marks the specified buffer unmodified and
156read-only, and displays it in a window via `display-buffer', passing 158read-only, and displays it in a window (but does not select it, or make
157ACTION as the action argument to `display-buffer'. It automatically 159the buffer current). The display happens by calling `display-buffer'
158shrinks the relevant window if `temp-buffer-resize-mode' is enabled. 160with the ACTION argument. If `temp-buffer-resize-mode' is enabled,
161the relevant window shrinks automatically.
159 162
160Returns the value returned by BODY, unless QUIT-FUNCTION specifies 163This returns the value returned by BODY, unless QUIT-FUNCTION specifies
161a function. In that case, runs the function with two arguments - 164a function. In that case, it runs the function with two arguments -
162the window showing the specified buffer and the value returned by 165the window showing the specified buffer and the value returned by
163BODY - and returns the value returned by that function. 166BODY - and returns the value returned by that function.
164 167
165If the buffer is displayed on a new frame, the window manager may 168If the buffer is displayed on a new frame, the window manager may
166decide to select that frame. In that case, it's usually a good 169decide to select that frame. In that case, it's usually a good
167strategy if the function specified by QUIT-FUNCTION selects the 170strategy if QUIT-FUNCTION selects the window showing the buffer
168window showing the buffer before reading a value from the 171before reading any value from the minibuffer; for example, when
169minibuffer; for example, when asking a `yes-or-no-p' question. 172asking a `yes-or-no-p' question.
170 173
171This construct is similar to `with-output-to-temp-buffer', but does 174This runs the hook `temp-buffer-window-setup-hook' before BODY,
172not put the buffer in help mode, or call `temp-buffer-show-function'. 175with the specified buffer temporarily current. It runs the
173It also runs different hooks, namely `temp-buffer-window-setup-hook' 176hook `temp-buffer-window-show-hook' after displaying the buffer,
174\(with the specified buffer current) and `temp-buffer-window-show-hook' 177with that buffer temporarily current, and the window that was used to
175\(with the specified buffer current and the window showing it selected). 178display it temporarily selected.
176 179
177Since this macro calls `display-buffer', the window displaying 180This construct is similar to `with-output-to-temp-buffer', but
178the buffer is usually not selected and the specified buffer 181runs different hooks. In particular, it does not run
179usually not made current. QUIT-FUNCTION can override that." 182`temp-buffer-setup-hook', which usually puts the buffer in Help mode.
183Also, it does not call `temp-buffer-show-function' (the ACTION
184argument replaces this)."
180 (declare (debug t)) 185 (declare (debug t))
181 (let ((buffer (make-symbol "buffer")) 186 (let ((buffer (make-symbol "buffer"))
182 (window (make-symbol "window")) 187 (window (make-symbol "window"))
@@ -2571,8 +2576,7 @@ move it as far as possible in the desired direction."
2571Interactively, if no argument is given, make the selected window 2576Interactively, if no argument is given, make the selected window
2572one line taller. If optional argument HORIZONTAL is non-nil, 2577one line taller. If optional argument HORIZONTAL is non-nil,
2573make selected window wider by DELTA columns. If DELTA is 2578make selected window wider by DELTA columns. If DELTA is
2574negative, shrink selected window by -DELTA lines or columns. 2579negative, shrink selected window by -DELTA lines or columns."
2575Return nil."
2576 (interactive "p") 2580 (interactive "p")
2577 (let ((minibuffer-window (minibuffer-window))) 2581 (let ((minibuffer-window (minibuffer-window)))
2578 (cond 2582 (cond
@@ -2605,8 +2609,7 @@ Interactively, if no argument is given, make the selected window
2605one line smaller. If optional argument HORIZONTAL is non-nil, 2609one line smaller. If optional argument HORIZONTAL is non-nil,
2606make selected window narrower by DELTA columns. If DELTA is 2610make selected window narrower by DELTA columns. If DELTA is
2607negative, enlarge selected window by -DELTA lines or columns. 2611negative, enlarge selected window by -DELTA lines or columns.
2608Also see the `window-min-height' variable. 2612Also see the `window-min-height' variable."
2609Return nil."
2610 (interactive "p") 2613 (interactive "p")
2611 (let ((minibuffer-window (minibuffer-window))) 2614 (let ((minibuffer-window (minibuffer-window)))
2612 (cond 2615 (cond
@@ -3049,8 +3052,10 @@ WINDOW must be a live window and defaults to the selected one."
3049 (set-marker (nth 2 entry) point)) 3052 (set-marker (nth 2 entry) point))
3050 ;; Make new markers. 3053 ;; Make new markers.
3051 (list (copy-marker start) 3054 (list (copy-marker start)
3052 (copy-marker point))))) 3055 (copy-marker
3053 3056 ;; Preserve window-point-insertion-type
3057 ;; (Bug#12588).
3058 point window-point-insertion-type)))))
3054 (set-window-prev-buffers 3059 (set-window-prev-buffers
3055 window (cons entry (window-prev-buffers window)))))))) 3060 window (cons entry (window-prev-buffers window))))))))
3056 3061
@@ -4555,13 +4560,17 @@ element is BUFFER."
4555 ;; If WINDOW has a quit-restore parameter, reset its car. 4560 ;; If WINDOW has a quit-restore parameter, reset its car.
4556 (setcar (window-parameter window 'quit-restore) 'same)) 4561 (setcar (window-parameter window 'quit-restore) 'same))
4557 ;; WINDOW shows another buffer. 4562 ;; WINDOW shows another buffer.
4558 (set-window-parameter 4563 (with-current-buffer (window-buffer window)
4559 window 'quit-restore 4564 (set-window-parameter
4560 (list 'other 4565 window 'quit-restore
4561 ;; A quadruple of WINDOW's buffer, start, point and height. 4566 (list 'other
4562 (list (window-buffer window) (window-start window) 4567 ;; A quadruple of WINDOW's buffer, start, point and height.
4563 (window-point window) (window-total-size window)) 4568 (list (current-buffer) (window-start window)
4564 (selected-window) buffer)))) 4569 ;; Preserve window-point-insertion-type (Bug#12588).
4570 (copy-marker
4571 (window-point window) window-point-insertion-type)
4572 (window-total-size window))
4573 (selected-window) buffer)))))
4565 ((eq type 'window) 4574 ((eq type 'window)
4566 ;; WINDOW has been created on an existing frame. 4575 ;; WINDOW has been created on an existing frame.
4567 (set-window-parameter 4576 (set-window-parameter
@@ -5170,11 +5179,12 @@ is higher than WINDOW."
5170 (error nil)))) 5179 (error nil))))
5171 5180
5172(defun window--display-buffer (buffer window type &optional alist dedicated) 5181(defun window--display-buffer (buffer window type &optional alist dedicated)
5173 "Display BUFFER in WINDOW and make its frame visible. 5182 "Display BUFFER in WINDOW.
5174TYPE must be one of the symbols `reuse', `window' or `frame' and 5183TYPE must be one of the symbols `reuse', `window' or `frame' and
5175is passed unaltered to `display-buffer-record-window'. Set 5184is passed unaltered to `display-buffer-record-window'. ALIST is
5176`window-dedicated-p' to DEDICATED if non-nil. Return WINDOW if 5185the alist argument of `display-buffer'. Set `window-dedicated-p'
5177BUFFER and WINDOW are live." 5186to DEDICATED if non-nil. Return WINDOW if BUFFER and WINDOW are
5187live."
5178 (when (and (buffer-live-p buffer) (window-live-p window)) 5188 (when (and (buffer-live-p buffer) (window-live-p window))
5179 (display-buffer-record-window type window buffer) 5189 (display-buffer-record-window type window buffer)
5180 (unless (eq buffer (window-buffer window)) 5190 (unless (eq buffer (window-buffer window))
@@ -5187,10 +5197,10 @@ BUFFER and WINDOW are live."
5187 (let ((parameter (window-parameter window 'quit-restore)) 5197 (let ((parameter (window-parameter window 'quit-restore))
5188 (height (cdr (assq 'window-height alist))) 5198 (height (cdr (assq 'window-height alist)))
5189 (width (cdr (assq 'window-width alist)))) 5199 (width (cdr (assq 'window-width alist))))
5190 (when (or (memq type '(window frame)) 5200 (when (or (eq type 'window)
5191 (and (eq (car parameter) 'same) 5201 (and (eq (car parameter) 'same)
5192 (memq (nth 1 parameter) '(window frame)))) 5202 (eq (nth 1 parameter) 'window)))
5193 ;; Adjust height of new window or frame. 5203 ;; Adjust height of window if asked for.
5194 (cond 5204 (cond
5195 ((not height)) 5205 ((not height))
5196 ((numberp height) 5206 ((numberp height)
@@ -5201,19 +5211,12 @@ BUFFER and WINDOW are live."
5201 (* (window-total-size (frame-root-window window)) 5211 (* (window-total-size (frame-root-window window))
5202 height)))) 5212 height))))
5203 (delta (- new-height (window-total-size window)))) 5213 (delta (- new-height (window-total-size window))))
5204 (cond 5214 (when (and (window--resizable-p window delta nil 'safe)
5205 ((and (window--resizable-p window delta nil 'safe) 5215 (window-combined-p window))
5206 (window-combined-p window)) 5216 (window-resize window delta nil 'safe))))
5207 (window-resize window delta nil 'safe))
5208 ((or (eq type 'frame)
5209 (and (eq (car parameter) 'same)
5210 (eq (nth 1 parameter) 'frame)))
5211 (set-frame-height
5212 (window-frame window)
5213 (+ (frame-height (window-frame window)) delta))))))
5214 ((functionp height) 5217 ((functionp height)
5215 (ignore-errors (funcall height window)))) 5218 (ignore-errors (funcall height window))))
5216 ;; Adjust width of a window or frame. 5219 ;; Adjust width of window if asked for.
5217 (cond 5220 (cond
5218 ((not width)) 5221 ((not width))
5219 ((numberp width) 5222 ((numberp width)
@@ -5224,18 +5227,12 @@ BUFFER and WINDOW are live."
5224 (* (window-total-size (frame-root-window window) t) 5227 (* (window-total-size (frame-root-window window) t)
5225 width)))) 5228 width))))
5226 (delta (- new-width (window-total-size window t)))) 5229 (delta (- new-width (window-total-size window t))))
5227 (cond 5230 (when (and (window--resizable-p window delta t 'safe)
5228 ((and (window--resizable-p window delta t 'safe) 5231 (window-combined-p window t))
5229 (window-combined-p window t)) 5232 (window-resize window delta t 'safe))))
5230 (window-resize window delta t 'safe))
5231 ((or (eq type 'frame)
5232 (and (eq (car parameter) 'same)
5233 (eq (nth 1 parameter) 'frame)))
5234 (set-frame-width
5235 (window-frame window)
5236 (+ (frame-width (window-frame window)) delta))))))
5237 ((functionp width) 5233 ((functionp width)
5238 (ignore-errors (funcall width window)))))) 5234 (ignore-errors (funcall width window))))))
5235
5239 window)) 5236 window))
5240 5237
5241(defun window--maybe-raise-frame (frame) 5238(defun window--maybe-raise-frame (frame)
@@ -5295,13 +5292,19 @@ See `display-buffer' for details.")
5295 "Alist of conditional actions for `display-buffer'. 5292 "Alist of conditional actions for `display-buffer'.
5296This is a list of elements (CONDITION . ACTION), where: 5293This is a list of elements (CONDITION . ACTION), where:
5297 5294
5298 CONDITION is either a regexp matching buffer names, or a function 5295 CONDITION is either a regexp matching buffer names, or a
5299 that takes a buffer and returns a boolean. 5296 function that takes two arguments - a buffer name and the
5297 ACTION argument of `display-buffer' - and returns a boolean.
5300 5298
5301 ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a 5299 ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a
5302 function or a list of functions. Each such function should 5300 function or a list of functions. Each such function should
5303 accept two arguments: a buffer to display and an alist of the 5301 accept two arguments: a buffer to display and an alist of the
5304 same form as ALIST. See `display-buffer' for details." 5302 same form as ALIST. See `display-buffer' for details.
5303
5304`display-buffer' scans this alist until it either finds a
5305matching regular expression or the function specified by a
5306condition returns non-nil. In any of these cases, it adds the
5307associated action to the list of actions it will try."
5305 :type `(alist :key-type 5308 :type `(alist :key-type
5306 (choice :tag "Condition" 5309 (choice :tag "Condition"
5307 regexp 5310 regexp
@@ -5335,15 +5338,16 @@ specified, e.g. by the user options `display-buffer-alist' or
5335`display-buffer-base-action'. See `display-buffer'.") 5338`display-buffer-base-action'. See `display-buffer'.")
5336(put 'display-buffer-fallback-action 'risky-local-variable t) 5339(put 'display-buffer-fallback-action 'risky-local-variable t)
5337 5340
5338(defun display-buffer-assq-regexp (buffer-name alist) 5341(defun display-buffer-assq-regexp (buffer-name alist action)
5339 "Retrieve ALIST entry corresponding to BUFFER-NAME." 5342 "Retrieve ALIST entry corresponding to BUFFER-NAME.
5343ACTION is the action argument passed to `display-buffer'."
5340 (catch 'match 5344 (catch 'match
5341 (dolist (entry alist) 5345 (dolist (entry alist)
5342 (let ((key (car entry))) 5346 (let ((key (car entry)))
5343 (when (or (and (stringp key) 5347 (when (or (and (stringp key)
5344 (string-match-p key buffer-name)) 5348 (string-match-p key buffer-name))
5345 (and (symbolp key) (functionp key) 5349 (and (functionp key)
5346 (funcall key buffer-name alist))) 5350 (funcall key buffer-name action)))
5347 (throw 'match (cdr entry))))))) 5351 (throw 'match (cdr entry)))))))
5348 5352
5349(defvar display-buffer--same-window-action 5353(defvar display-buffer--same-window-action
@@ -5453,8 +5457,8 @@ argument, ACTION is t."
5453 (funcall display-buffer-function buffer inhibit-same-window) 5457 (funcall display-buffer-function buffer inhibit-same-window)
5454 ;; Otherwise, use the defined actions. 5458 ;; Otherwise, use the defined actions.
5455 (let* ((user-action 5459 (let* ((user-action
5456 (display-buffer-assq-regexp (buffer-name buffer) 5460 (display-buffer-assq-regexp
5457 display-buffer-alist)) 5461 (buffer-name buffer) display-buffer-alist action))
5458 (special-action (display-buffer--special-action buffer)) 5462 (special-action (display-buffer--special-action buffer))
5459 ;; Extra actions from the arguments to this function: 5463 ;; Extra actions from the arguments to this function:
5460 (extra-action 5464 (extra-action
@@ -6068,22 +6072,26 @@ of `fit-frame-to-buffer-max-height' and `window-min-height'."
6068 :group 'help) 6072 :group 'help)
6069 6073
6070(defcustom fit-frame-to-buffer-bottom-margin 4 6074(defcustom fit-frame-to-buffer-bottom-margin 4
6071 "Bottom margin for `fit-frame-to-buffer'. 6075 "Bottom margin for the command `fit-frame-to-buffer'.
6072This is the number of lines `fit-frame-to-buffer' leaves free at the 6076This is the number of lines that function leaves free at the bottom of
6073bottom of the display in order to not obscure the system task bar." 6077the display, in order to not obscure any system task bar or panel.
6078If you do not have one (or if it is vertical) you might want to
6079reduce this. If it is thicker, you might want to increase this."
6080 ;; If you set this too small, fit-frame-to-buffer can shift the
6081 ;; frame up to avoid the panel.
6074 :type 'integer 6082 :type 'integer
6075 :version "24.3" 6083 :version "24.3"
6076 :group 'windows) 6084 :group 'windows)
6077 6085
6078(defun fit-frame-to-buffer (&optional frame max-height min-height) 6086(defun fit-frame-to-buffer (&optional frame max-height min-height)
6079 "Adjust height of FRAME to display its buffer's contents exactly. 6087 "Adjust height of FRAME to display its buffer contents exactly.
6080FRAME can be any live frame and defaults to the selected one. 6088FRAME can be any live frame and defaults to the selected one.
6081 6089
6082Optional argument MAX-HEIGHT specifies the maximum height of 6090Optional argument MAX-HEIGHT specifies the maximum height of FRAME.
6083FRAME and defaults to the height of the display below the current 6091It defaults to the height of the display below the current
6084top line of FRAME minus FIT-FRAME-TO-BUFFER-BOTTOM-MARGIN. 6092top line of FRAME, minus `fit-frame-to-buffer-bottom-margin'.
6085Optional argument MIN-HEIGHT specifies the minimum height of 6093Optional argument MIN-HEIGHT specifies the minimum height of FRAME.
6086FRAME." 6094The default corresponds to `window-min-height'."
6087 (interactive) 6095 (interactive)
6088 (setq frame (window-normalize-frame frame)) 6096 (setq frame (window-normalize-frame frame))
6089 (let* ((root (frame-root-window frame)) 6097 (let* ((root (frame-root-window frame))
@@ -6160,6 +6168,10 @@ defaults to `window-min-height'. Both MAX-HEIGHT and MIN-HEIGHT
6160are specified in lines and include the mode line and header line, 6168are specified in lines and include the mode line and header line,
6161if any. 6169if any.
6162 6170
6171If WINDOW is a full height window, then if the option
6172`fit-frame-to-buffer' is non-nil, this calls the function
6173`fit-frame-to-buffer' to adjust the frame height.
6174
6163Return the number of lines by which WINDOW was enlarged or 6175Return the number of lines by which WINDOW was enlarged or
6164shrunk. If an error occurs during resizing, return nil but don't 6176shrunk. If an error occurs during resizing, return nil but don't
6165signal an error. 6177signal an error.
diff --git a/lisp/woman.el b/lisp/woman.el
index 46b6b680440..1410a8971ad 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1550,11 +1550,13 @@ Also make each path-info component into a list.
1550 (woman-dired-define-keys) 1550 (woman-dired-define-keys)
1551 (add-hook 'dired-mode-hook 'woman-dired-define-keys)) 1551 (add-hook 'dired-mode-hook 'woman-dired-define-keys))
1552 1552
1553(declare-function dired-get-filename "dired"
1554 (&optional localp no-error-if-not-filep))
1555
1553;;;###autoload 1556;;;###autoload
1554(defun woman-dired-find-file () 1557(defun woman-dired-find-file ()
1555 "In dired, run the WoMan man-page browser on this file." 1558 "In dired, run the WoMan man-page browser on this file."
1556 (interactive) 1559 (interactive)
1557 ;; dired-get-filename is defined in dired.el
1558 (woman-find-file (dired-get-filename))) 1560 (woman-find-file (dired-get-filename)))
1559 1561
1560 1562
@@ -1947,6 +1949,9 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
1947 (message "Woman fill column set to %s." 1949 (message "Woman fill column set to %s."
1948 (if woman-fill-frame "frame width" woman-fill-column))) 1950 (if woman-fill-frame "frame width" woman-fill-column)))
1949 1951
1952(declare-function apropos-print "apropos"
1953 (do-keys spacing &optional text nosubst))
1954
1950(defun woman-mini-help () 1955(defun woman-mini-help ()
1951 "Display WoMan commands and user options in an `apropos' buffer." 1956 "Display WoMan commands and user options in an `apropos' buffer."
1952 ;; Based on apropos-command in apropos.el 1957 ;; Based on apropos-command in apropos.el
@@ -2191,7 +2196,7 @@ To be called on original buffer and any .so insertions."
2191 (face-underline-p face)) 2196 (face-underline-p face))
2192 (let ((face-no-ul (intern (concat face-name "-no-ul")))) 2197 (let ((face-no-ul (intern (concat face-name "-no-ul"))))
2193 (copy-face face face-no-ul) 2198 (copy-face face face-no-ul)
2194 (set-face-underline-p face-no-ul nil))))))) 2199 (set-face-underline face-no-ul nil)))))))
2195 2200
2196;; Preprocessors 2201;; Preprocessors
2197;; ============= 2202;; =============
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 320c9e6366e..95203b9d2fa 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,50 @@
12012-11-17 Juanma Barranquero <lekktu@gmail.com>
2
3 * config.nt: Sync with autogen/config.in.
4 (HAVE_FPATHCONF): Remove.
5
62012-11-17 Paul Eggert <eggert@cs.ucla.edu>
7
8 Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
9 * inc/sys/socket.h (O_NONBLOCK): Rename from O_NDELAY, since the
10 POSIX name for this flag is O_NONBLOCK. All uses changed.
11 * inc/unistd.h (O_RDWR, O_NOCTTY): New macros. Like AT_FDCWD etc.
12 these really should be moved to a replacement <fcntl.h> if and
13 when that gets implemented. In the meantime, include <fcntl.h>
14 to make sure we don't override its definitions.
15
162012-11-17 Eli Zaretskii <eliz@gnu.org>
17
18 * inc/sys/wait.h: New file, with prototype of waitpid and
19 definitions of macros it needs.
20
21 * inc/ms-w32.h (wait): Don't define, 'wait' is not used anymore.
22 (sys_wait): Remove prototype.
23
24 * config.nt (HAVE_SYS_WAIT_H): Define to 1.
25
262012-11-17 Dani Moncayo <dmoncayo@gmail.com>
27
28 * zipdist.bat (ZIP_CHECK): Remove unused label. When invoking 7z
29 to check if it's installed, redirect standard output and standard
30 error to the null device.
31 (ZIP_DIST): Don't build the "barebin" distribution.
32
332012-11-15 Juanma Barranquero <lekktu@gmail.com>
34
35 * config.nt: Sync with autogen/config.in.
36 (GETGROUPS_T, GETGROUPS_ZERO_BUG, GNULIB_FACCESSAT, HAVE_ACCESS)
37 (HAVE_EACCESS, HAVE_FACCESSAT, HAVE_GETGROUPS, HAVE_LIBGEN_H):
38 New macros.
39
402012-11-14 Eli Zaretskii <eliz@gnu.org>
41
42 * inc/unistd.h (faccessat): Add prototype.
43 (AT_FDCWD, AT_EACCESS, AT_SYMLINK_NOFOLLOW): New macros; the first
44 2 moved from ms-w32.h.
45
46 * inc/ms-w32.h (AT_FDCWD, AT_EACCESS, faccessat): Remove macros.
47
12012-11-14 Paul Eggert <eggert@cs.ucla.edu> 482012-11-14 Paul Eggert <eggert@cs.ucla.edu>
2 49
3 Use faccessat, not access, when checking file permissions (Bug#12632). 50 Use faccessat, not access, when checking file permissions (Bug#12632).
diff --git a/nt/config.nt b/nt/config.nt
index 443a1025761..57c18ad2789 100644
--- a/nt/config.nt
+++ b/nt/config.nt
@@ -180,6 +180,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
180 setjmp does work. */ 180 setjmp does work. */
181#define GC_SETJMP_WORKS 1 181#define GC_SETJMP_WORKS 1
182 182
183/* Define to the type of elements in the array set by `getgroups'. Usually
184 this is either `int' or `gid_t'. */
185#undef GETGROUPS_T
186
187/* Define this to 1 if getgroups(0,NULL) does not return the number of groups.
188 */
189#undef GETGROUPS_ZERO_BUG
190
183/* Define if gettimeofday clobbers the localtime buffer. */ 191/* Define if gettimeofday clobbers the localtime buffer. */
184#undef GETTIMEOFDAY_CLOBBERS_LOCALTIME 192#undef GETTIMEOFDAY_CLOBBERS_LOCALTIME
185 193
@@ -195,6 +203,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
195#undef GNULIB_CLOSE_STREAM 203#undef GNULIB_CLOSE_STREAM
196 204
197/* Define to a C preprocessor expression that evaluates to 1 or 0, depending 205/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
206 whether the gnulib module faccessat shall be considered present. */
207#undef GNULIB_FACCESSAT
208
209/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
198 whether the gnulib module fscanf shall be considered present. */ 210 whether the gnulib module fscanf shall be considered present. */
199#undef GNULIB_FSCANF 211#undef GNULIB_FSCANF
200 212
@@ -215,6 +227,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
215 startup, if using GTK. */ 227 startup, if using GTK. */
216#undef G_SLICE_ALWAYS_MALLOC 228#undef G_SLICE_ALWAYS_MALLOC
217 229
230/* Define to 1 if you have the `access' function. */
231#undef HAVE_ACCESS
232
218/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */ 233/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */
219#undef HAVE_AIX_SMT_EXP 234#undef HAVE_AIX_SMT_EXP
220 235
@@ -339,6 +354,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
339/* Define to 1 if you have the 'dup2' function. */ 354/* Define to 1 if you have the 'dup2' function. */
340#define HAVE_DUP2 1 355#define HAVE_DUP2 1
341 356
357/* Define to 1 if you have the `eaccess' function. */
358#undef HAVE_EACCESS
359
342/* Define to 1 if you have the `endgrent' function. */ 360/* Define to 1 if you have the `endgrent' function. */
343#undef HAVE_ENDGRENT 361#undef HAVE_ENDGRENT
344 362
@@ -354,15 +372,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
354/* Define to 1 if you have the <execinfo.h> header file. */ 372/* Define to 1 if you have the <execinfo.h> header file. */
355#define HAVE_EXECINFO_H 1 373#define HAVE_EXECINFO_H 1
356 374
375/* Define to 1 if you have the `faccessat' function. */
376#undef HAVE_FACCESSAT
377
357/* Define to 1 if you have the <fcntl.h> header file. */ 378/* Define to 1 if you have the <fcntl.h> header file. */
358#undef HAVE_FCNTL_H 379#undef HAVE_FCNTL_H
359 380
360/* Define to 1 if you have the `fork' function. */ 381/* Define to 1 if you have the `fork' function. */
361#undef HAVE_FORK 382#undef HAVE_FORK
362 383
363/* Define to 1 if you have the `fpathconf' function. */
364#undef HAVE_FPATHCONF
365
366/* Define to 1 if you have the `freeifaddrs' function. */ 384/* Define to 1 if you have the `freeifaddrs' function. */
367#undef HAVE_FREEIFADDRS 385#undef HAVE_FREEIFADDRS
368 386
@@ -405,6 +423,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
405/* Define to 1 if you have the `getgrent' function. */ 423/* Define to 1 if you have the `getgrent' function. */
406#undef HAVE_GETGRENT 424#undef HAVE_GETGRENT
407 425
426/* Define to 1 if your system has a working `getgroups' function. */
427#undef HAVE_GETGROUPS
428
408/* Define to 1 if you have the `gethostname' function. */ 429/* Define to 1 if you have the `gethostname' function. */
409#define HAVE_GETHOSTNAME 1 430#define HAVE_GETHOSTNAME 1
410 431
@@ -571,6 +592,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
571/* Define to 1 if you have the `dnet' library (-ldnet). */ 592/* Define to 1 if you have the `dnet' library (-ldnet). */
572#undef HAVE_LIBDNET 593#undef HAVE_LIBDNET
573 594
595/* Define to 1 if you have the <libgen.h> header file. */
596#undef HAVE_LIBGEN_H
597
574/* Define to 1 if you have the hesiod library (-lhesiod). */ 598/* Define to 1 if you have the hesiod library (-lhesiod). */
575#undef HAVE_LIBHESIOD 599#undef HAVE_LIBHESIOD
576 600
@@ -959,7 +983,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
959#undef HAVE_SYS_VLIMIT_H 983#undef HAVE_SYS_VLIMIT_H
960 984
961/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */ 985/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
962#undef HAVE_SYS_WAIT_H 986#define HAVE_SYS_WAIT_H 1
963 987
964/* Define to 1 if you have the <term.h> header file. */ 988/* Define to 1 if you have the <term.h> header file. */
965#undef HAVE_TERM_H 989#undef HAVE_TERM_H
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 0f6b51d3915..7b16ccab069 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -124,10 +124,6 @@ extern char *getenv ();
124#define MAXPATHLEN _MAX_PATH 124#define MAXPATHLEN _MAX_PATH
125#endif 125#endif
126 126
127/* Use values compatible with gnulib, as there's no reason to differ. */
128#define AT_FDCWD (-3041965)
129#define AT_EACCESS 4
130
131#ifdef HAVE_NTGUI 127#ifdef HAVE_NTGUI
132#define HAVE_WINDOW_SYSTEM 1 128#define HAVE_WINDOW_SYSTEM 1
133#define HAVE_MENUS 1 129#define HAVE_MENUS 1
@@ -163,7 +159,6 @@ extern char *getenv ();
163#define dup sys_dup 159#define dup sys_dup
164#undef dup2 160#undef dup2
165#define dup2 sys_dup2 161#define dup2 sys_dup2
166#define faccessat sys_faccessat
167#define fopen sys_fopen 162#define fopen sys_fopen
168#define link sys_link 163#define link sys_link
169#define localtime sys_localtime 164#define localtime sys_localtime
@@ -188,15 +183,12 @@ extern char *getenv ();
188 183
189/* Subprocess calls that are emulated. */ 184/* Subprocess calls that are emulated. */
190#define spawnve sys_spawnve 185#define spawnve sys_spawnve
191#define wait sys_wait
192#define kill sys_kill 186#define kill sys_kill
193#define signal sys_signal 187#define signal sys_signal
194 188
195/* Internal signals. */ 189/* Internal signals. */
196#define emacs_raise(sig) emacs_abort() 190#define emacs_raise(sig) emacs_abort()
197 191
198extern int sys_wait (int *);
199
200/* termcap.c calls that are emulated. */ 192/* termcap.c calls that are emulated. */
201#define tputs sys_tputs 193#define tputs sys_tputs
202#define tgetstr sys_tgetstr 194#define tgetstr sys_tgetstr
diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h
index 70225a9c82f..95fee4c4659 100644
--- a/nt/inc/sys/socket.h
+++ b/nt/inc/sys/socket.h
@@ -119,7 +119,7 @@ int sys_sendto (int s, const char * buf, int len, int flags,
119 an fcntl function, for setting sockets to non-blocking mode. */ 119 an fcntl function, for setting sockets to non-blocking mode. */
120int fcntl (int s, int cmd, int options); 120int fcntl (int s, int cmd, int options);
121#define F_SETFL 4 121#define F_SETFL 4
122#define O_NDELAY 04000 122#define O_NONBLOCK 04000
123 123
124/* we are providing a real h_errno variable */ 124/* we are providing a real h_errno variable */
125#undef h_errno 125#undef h_errno
diff --git a/nt/inc/sys/wait.h b/nt/inc/sys/wait.h
new file mode 100644
index 00000000000..8d890c9e175
--- /dev/null
+++ b/nt/inc/sys/wait.h
@@ -0,0 +1,33 @@
1/* A limited emulation of sys/wait.h on Posix systems.
2
3Copyright (C) 2012 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation, either version 3 of the License, or
10(at your option) any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19
20#ifndef INC_SYS_WAIT_H_
21#define INC_SYS_WAIT_H_
22
23#define WNOHANG 1
24#define WUNTRACED 2
25#define WSTOPPED 2 /* same as WUNTRACED */
26#define WEXITED 4
27#define WCONTINUED 8
28
29/* The various WIF* macros are defined in src/syswait.h. */
30
31extern pid_t waitpid (pid_t, int *, int);
32
33#endif /* INC_SYS_WAIT_H_ */
diff --git a/nt/inc/unistd.h b/nt/inc/unistd.h
index 4c5f7d4c124..0173fdbb943 100644
--- a/nt/inc/unistd.h
+++ b/nt/inc/unistd.h
@@ -18,4 +18,25 @@ extern pid_t getpgrp (void);
18extern pid_t setsid (void); 18extern pid_t setsid (void);
19extern pid_t tcgetpgrp (int); 19extern pid_t tcgetpgrp (int);
20 20
21extern int faccessat (int, char const *, int, int);
22
23/* These are normally on fcntl.h, but we don't override that header. */
24/* Use values compatible with gnulib, as there's no reason to differ. */
25#define AT_FDCWD (-3041965)
26#define AT_EACCESS 4
27#define AT_SYMLINK_NOFOLLOW 4096
28
29/* Here are some more fcntl.h macros that default to gnulib-compatible
30 values. Include <fcntl.h> first, to make sure we don't override
31 its values if any. FIXME: If we know <fcntl.h> does not define
32 O_NOCTTY and O_RDWR, this can be replaced with a simple "#define
33 O_NOCTTY 0" and "#define O_RDWR 2". */
34#include <fcntl.h>
35#ifndef O_NOCTTY
36#define O_NOCTTY 0
37#endif
38#ifndef O_RDWR
39#define O_RDWR 2
40#endif
41
21#endif /* _UNISTD_H */ 42#endif /* _UNISTD_H */
diff --git a/nt/zipdist.bat b/nt/zipdist.bat
index 806415054fd..e196299b6d6 100644
--- a/nt/zipdist.bat
+++ b/nt/zipdist.bat
@@ -25,9 +25,8 @@ set EMACS_VER=%1
25set TMP_DIST_DIR=emacs-%EMACS_VER% 25set TMP_DIST_DIR=emacs-%EMACS_VER%
26 26
27rem Check, if 7zip is installed and available on path 27rem Check, if 7zip is installed and available on path
28:ZIP_CHECK 287z 1>NUL 2>NUL
297z 29if %ERRORLEVEL% NEQ 0 goto ZIP_ERROR
30if %ERRORLEVEL% NEQ 0 goto :ZIP_ERROR
31goto ZIP_DIST 30goto ZIP_DIST
32 31
33:ZIP_ERROR 32:ZIP_ERROR
@@ -35,14 +34,10 @@ echo.
35echo ERROR: Make sure 7zip is installed and available on the Windows Path! 34echo ERROR: Make sure 7zip is installed and available on the Windows Path!
36goto EXIT 35goto EXIT
37 36
38rem Build distributions 37rem Build and verify the binary distribution
39:ZIP_DIST 38:ZIP_DIST
40rem Build and verify full distribution
417z a -bd -tZIP -mx=9 -x!.bzrignore -x!.gitignore -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory emacs-%EMACS_VER%-bin-i386.zip %TMP_DIST_DIR% 397z a -bd -tZIP -mx=9 -x!.bzrignore -x!.gitignore -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory emacs-%EMACS_VER%-bin-i386.zip %TMP_DIST_DIR%
427z t emacs-%EMACS_VER%-bin-i386.zip 407z t emacs-%EMACS_VER%-bin-i386.zip
43rem Build and verify binary only distribution
447z a -bd -tZIP -mx=9 -x!.bzrignore -x!.gitignore -xr!emacs.mdp -xr!*.pdb -xr!*.opt -xr!*~ -xr!CVS -xr!.arch-inventory emacs-%EMACS_VER%-barebin-i386.zip %TMP_DIST_DIR%/README.W32 %TMP_DIST_DIR%/bin %TMP_DIST_DIR%/etc/DOC-X %TMP_DIST_DIR%/COPYING
457z t emacs-%EMACS_VER%-barebin-i386.zip
46goto EXIT 41goto EXIT
47 42
48:EXIT 43:EXIT
diff --git a/src/ChangeLog b/src/ChangeLog
index d7699def9a5..6dcddea2e63 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -8,6 +8,154 @@
8 * font.c (font_unparse_xlfd): Exclude special characters from the 8 * font.c (font_unparse_xlfd): Exclude special characters from the
9 generating XLFD name. 9 generating XLFD name.
10 10
112012-11-18 Paul Eggert <eggert@cs.ucla.edu>
12
13 * nsterm.m (ns_select): Send SIGIO only to self, not to process group.
14
152012-11-18 Eli Zaretskii <eliz@gnu.org>
16
17 * w32select.c: Include w32common.h before w32term.h, so that
18 windows.h gets included before w32term.h uses some of its
19 features, see below.
20
21 * w32term.h (LOCALE_ENUMPROCA, LOCALE_ENUMPROCW) [_MSC_VER]: New
22 typedefs.
23 (EnumSystemLocalesA, EnumSystemLocalesW) [_MSC_VER]: New
24 prototypes.
25 (EnumSystemLocales) [_MSC_VER]: Define if undefined. (Bug#12878)
26
272012-11-18 Jan Djärv <jan.h.d@swipnet.se>
28
29 * nsterm.m (hold_event): Set send_appdefined to YES (Bug#12834).
30 (ns_select): Return at once if events are held (Bug#12834).
31
322012-11-18 enami tsugutomo <tsugutomo.enami@jp.sony.com>
33
34 * unexelf.c (ELFSIZE) [__NetBSD__ && _LP64]: Set to 64.
35 Needed following 2012-10-20 change. (Bug#12902)
36
372012-11-18 Juanma Barranquero <lekktu@gmail.com>
38
39 * w32proc.c (waitpid): Remove unused label get_result.
40
412012-11-17 Juanma Barranquero <lekktu@gmail.com>
42
43 * makefile.w32-in (SYSWAIT_H): New macro.
44 ($(BLD)/callproc.$(O), $(BLD)/w32proc.$(O), $(BLD)/process.$(O))
45 ($(BLD)/sysdep.$(O)): Update dependencies.
46
472012-11-17 Paul Eggert <eggert@cs.ucla.edu>
48
49 Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
50 * callproc.c (relocate_fd): Assume F_DUPFD.
51 * emacs.c, term.c (O_RDWR): Remove.
52 * keyboard.c (tty_read_avail_input): Use O_NONBLOCK rather than
53 O_NDELAY, since O_NONBLOCK is the standard name for this flag.
54 * nsterm.m: Assume <fcntl.h> exists.
55 * process.c (NON_BLOCKING_CONNECT, allocate_pty, create_process)
56 (create_pty, Fmake_network_process, server_accept_connection)
57 (wait_reading_process_output, init_process_emacs):
58 Assume O_NONBLOCK.
59 (wait_reading_process_output): Put in a special case for WINDOWSNT
60 to mimick the older behavior where it had O_NDELAY but not O_NONBLOCK.
61 It's not clear this is needed, but it's a more-conservative change.
62 (create_process): Assume FD_CLOEXEC.
63 (create_process, create_pty): Assume O_NOCTTY.
64 * sysdep.c (init_sys_modes, reset_sys_modes): Assume F_SETFL.
65 (reset_sys_modes): Use O_NONBLOCK rather than O_NDELAY.
66 Omit if not DOS_NT, since F_GETFL is not defined there.
67 (serial_open): Assume O_NONBLOCK and O_NOCTTY.
68 * term.c: Include <fcntl.h>, for flags like O_NOCTTY.
69 (O_NOCTTY): Remove.
70 (init_tty): Assume O_IGNORE_CTTY is defined to 0 on platforms that
71 lack it, since gnulib guarantees this.
72 * w32.c (fcntl): Test for O_NONBLOCK rather than O_NDELAY.
73
742012-11-17 Eli Zaretskii <eliz@gnu.org>
75
76 * w32.c (faccessat): Pretend that directories have the execute bit
77 set. Emacs expects that, e.g., in files.el:cd-absolute.
78
79 * w32proc.c (create_child): Don't clip the PID of the child
80 process to fit into an Emacs integer, as this is no longer a
81 restriction.
82 (waitpid): Rename from sys_wait. Emulate a Posix 'waitpid' by
83 reaping only the process specified by PID argument, if that is
84 positive. Use PID instead of dead_child to know which process to
85 reap. Wait for the child to die only if WNOHANG is not in
86 OPTIONS.
87 (sys_select): Don't set dead_child.
88
89 * sysdep.c (wait_for_termination_1): Remove the WINDOWSNT portion,
90 as it is no longer needed.
91
92 * process.c (waitpid, WUNTRACED) [!WNOHANG]: Remove definitions,
93 no longer needed.
94 (record_child_status_change): Remove the setting of
95 record_at_most_one_child for the !WNOHANG case.
96
972012-11-17 Paul Eggert <eggert@cs.ucla.edu>
98
99 Fix problems in ns port found by static checking.
100 * nsterm.m: Include <pthread.h>, for pthread_mutex_lock etc.
101 (hold_event, setPosition:portion:whole:): Send SIGIO only to self,
102 not to process group.
103 (ns_select): Use emacs_write, not write, as that's more robust
104 in the presence of signals.
105 (fd_handler:): Check for read errors.
106
1072012-11-16 Glenn Morris <rgm@gnu.org>
108
109 * editfns.c (Fmessage): Mention message-log-max. (Bug#12849)
110
1112012-11-16 Stefan Monnier <monnier@iro.umontreal.ca>
112
113 * eval.c (Finteractive_p): Revert lexbind-merge mishap.
114
1152012-11-16 Eli Zaretskii <eliz@gnu.org>
116
117 * w32proc.c (timer_loop): Make sure SuspendThread and ResumeThread
118 use the same value of thread handle.
119 (start_timer_thread): If the timer thread exited (due to error),
120 clean up by closing the two handles it used. Duplicate the caller
121 thread's handle here, so it gets duplicated only once, when
122 launching the timer thread. Set priority of the timer thread, not
123 the caller thread.
124 (getitimer): Don't duplicate the caller thread's handle here.
125 (Bug#12832)
126
1272012-11-16 Jan Djärv <jan.h.d@swipnet.se>
128
129 * nsterm.m (hold_event): Send SIGIO to make sure ns_read_socket is
130 called (Bug#12834).
131
1322012-11-16 Paul Eggert <eggert@cs.ucla.edu>
133
134 Remove no-longer-used pty_max_bytes variable.
135 * process.c (pty_max_bytes): Remove; unused.
136 (send_process): Do not set it.
137
1382012-11-15 Juanma Barranquero <lekktu@gmail.com>
139
140 * makefile.w32-in ($(BLD)/dispnew.$(O), $(BLD)/emacs.$(O)):
141 Update dependencies.
142
1432012-11-15 Paul Eggert <eggert@cs.ucla.edu>
144
145 * eval.c (mark_backtrace) [BYTE_MARK_STACK]: Remove stray '*'.
146 This follows up on the 2012-09-29 patch that removed indirection
147 for the 'function' field. Reported by Sergey Vinokurov in
148 <http://lists.gnu.org/archive/html/emacs-devel/2012-11/msg00263.html>.
149
1502012-11-14 Eli Zaretskii <eliz@gnu.org>
151
152 * w32.c (faccessat): Rename from sys_faccessat. (No need to use a
153 different name, as the MS runtime does not have such a function,
154 and probably never will.) All callers changed. Ignore DIRFD
155 value if PATH is an absolute file name, to match Posix spec
156 better. If AT_SYMLINK_NOFOLLOW is set in FLAGS, don't resolve
157 symlinks.
158
112012-11-14 Dmitry Antipov <dmantipov@yandex.ru> 1592012-11-14 Dmitry Antipov <dmantipov@yandex.ru>
12 160
13 * xdisp.c (echo_area_display, redisplay_internal): 161 * xdisp.c (echo_area_display, redisplay_internal):
diff --git a/src/callproc.c b/src/callproc.c
index 8ecaba2b408..c9a504746b3 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1317,16 +1317,7 @@ relocate_fd (int fd, int minfd)
1317 return fd; 1317 return fd;
1318 else 1318 else
1319 { 1319 {
1320 int new; 1320 int new = fcntl (fd, F_DUPFD, minfd);
1321#ifdef F_DUPFD
1322 new = fcntl (fd, F_DUPFD, minfd);
1323#else
1324 new = dup (fd);
1325 if (new != -1)
1326 /* Note that we hold the original FD open while we recurse,
1327 to guarantee we'll get a new FD if we need it. */
1328 new = relocate_fd (new, minfd);
1329#endif
1330 if (new == -1) 1321 if (new == -1)
1331 { 1322 {
1332 const char *message_1 = "Error while setting up child: "; 1323 const char *message_1 = "Error while setting up child: ";
diff --git a/src/editfns.c b/src/editfns.c
index c5d4ed295ab..8122ffdd0d4 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3434,8 +3434,8 @@ static ptrdiff_t message_length;
3434 3434
3435DEFUN ("message", Fmessage, Smessage, 1, MANY, 0, 3435DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,
3436 doc: /* Display a message at the bottom of the screen. 3436 doc: /* Display a message at the bottom of the screen.
3437The message also goes into the `*Messages*' buffer. 3437The message also goes into the `*Messages*' buffer, if `message-log-max'
3438\(In keyboard macros, that's all it does.) 3438is non-nil. (In keyboard macros, that's all it does.)
3439Return the message. 3439Return the message.
3440 3440
3441The first argument is a format control string, and the rest are data 3441The first argument is a format control string, and the rest are data
diff --git a/src/emacs.c b/src/emacs.c
index fee9c332c55..d69dbfda7bf 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -95,10 +95,6 @@ extern void moncontrol (int mode);
95#include <sys/personality.h> 95#include <sys/personality.h>
96#endif 96#endif
97 97
98#ifndef O_RDWR
99#define O_RDWR 2
100#endif
101
102static const char emacs_version[] = VERSION; 98static const char emacs_version[] = VERSION;
103static const char emacs_copyright[] = COPYRIGHT; 99static const char emacs_copyright[] = COPYRIGHT;
104 100
diff --git a/src/eval.c b/src/eval.c
index dcd48cb7250..f8a76646352 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -508,7 +508,7 @@ spec that specifies non-nil unconditionally (such as \"p\"); or (ii)
508use `called-interactively-p'. */) 508use `called-interactively-p'. */)
509 (void) 509 (void)
510{ 510{
511 return interactive_p () ? Qt : Qnil; 511 return (INTERACTIVE && interactive_p ()) ? Qt : Qnil;
512} 512}
513 513
514 514
@@ -3369,7 +3369,7 @@ mark_backtrace (void)
3369 3369
3370 for (backlist = backtrace_list; backlist; backlist = backlist->next) 3370 for (backlist = backtrace_list; backlist; backlist = backlist->next)
3371 { 3371 {
3372 mark_object (*backlist->function); 3372 mark_object (backlist->function);
3373 3373
3374 if (backlist->nargs == UNEVALLED 3374 if (backlist->nargs == UNEVALLED
3375 || backlist->nargs == MANY) /* FIXME: Can this happen? */ 3375 || backlist->nargs == MANY) /* FIXME: Can this happen? */
diff --git a/src/keyboard.c b/src/keyboard.c
index 8f3a206139d..951d4ad79dc 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6948,7 +6948,7 @@ tty_read_avail_input (struct terminal *terminal,
6948#elif defined USG || defined CYGWIN 6948#elif defined USG || defined CYGWIN
6949 /* Read some input if available, but don't wait. */ 6949 /* Read some input if available, but don't wait. */
6950 n_to_read = sizeof cbuf; 6950 n_to_read = sizeof cbuf;
6951 fcntl (fileno (tty->input), F_SETFL, O_NDELAY); 6951 fcntl (fileno (tty->input), F_SETFL, O_NONBLOCK);
6952#else 6952#else
6953# error "Cannot read without possibly delaying" 6953# error "Cannot read without possibly delaying"
6954#endif 6954#endif
@@ -6982,7 +6982,7 @@ tty_read_avail_input (struct terminal *terminal,
6982 } 6982 }
6983 while ( 6983 while (
6984 /* We used to retry the read if it was interrupted. 6984 /* We used to retry the read if it was interrupted.
6985 But this does the wrong thing when O_NDELAY causes 6985 But this does the wrong thing when O_NONBLOCK causes
6986 an EAGAIN error. Does anybody know of a situation 6986 an EAGAIN error. Does anybody know of a situation
6987 where a retry is actually needed? */ 6987 where a retry is actually needed? */
6988#if 0 6988#if 0
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index f5cab34d7dc..9778e955677 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -472,6 +472,8 @@ SYSSIGNAL_H = $(SRC)/syssignal.h \
472SYSTTY_H = $(SRC)/systty.h \ 472SYSTTY_H = $(SRC)/systty.h \
473 $(NT_INC)/sys/ioctl.h \ 473 $(NT_INC)/sys/ioctl.h \
474 $(NT_INC)/unistd.h 474 $(NT_INC)/unistd.h
475SYSWAIT_H = $(SRC)/syswait.h \
476 $(NT_INC)/sys/wait.h
475TERMHOOKS_H = $(SRC)/termhooks.h \ 477TERMHOOKS_H = $(SRC)/termhooks.h \
476 $(SYSTIME_H) 478 $(SYSTIME_H)
477W32FONT_H = $(SRC)/w32font.h \ 479W32FONT_H = $(SRC)/w32font.h \
@@ -566,7 +568,6 @@ $(BLD)/callproc.$(O) : \
566 $(SRC)/commands.h \ 568 $(SRC)/commands.h \
567 $(SRC)/composite.h \ 569 $(SRC)/composite.h \
568 $(SRC)/epaths.h \ 570 $(SRC)/epaths.h \
569 $(SRC)/syswait.h \
570 $(SRC)/w32.h \ 571 $(SRC)/w32.h \
571 $(NT_INC)/sys/file.h \ 572 $(NT_INC)/sys/file.h \
572 $(NT_INC)/unistd.h \ 573 $(NT_INC)/unistd.h \
@@ -580,6 +581,7 @@ $(BLD)/callproc.$(O) : \
580 $(PROCESS_H) \ 581 $(PROCESS_H) \
581 $(SYSSIGNAL_H) \ 582 $(SYSSIGNAL_H) \
582 $(SYSTTY_H) \ 583 $(SYSTTY_H) \
584 $(SYSWAIT_H) \
583 $(TERMHOOKS_H) 585 $(TERMHOOKS_H)
584 586
585$(BLD)/casefiddle.$(O) : \ 587$(BLD)/casefiddle.$(O) : \
@@ -737,6 +739,7 @@ $(BLD)/dispnew.$(O) : \
737 $(SRC)/termchar.h \ 739 $(SRC)/termchar.h \
738 $(SRC)/w32.h \ 740 $(SRC)/w32.h \
739 $(NT_INC)/unistd.h \ 741 $(NT_INC)/unistd.h \
742 $(GNU_LIB)/fpending.h \
740 $(BUFFER_H) \ 743 $(BUFFER_H) \
741 $(CHARACTER_H) \ 744 $(CHARACTER_H) \
742 $(CONFIG_H) \ 745 $(CONFIG_H) \
@@ -802,6 +805,7 @@ $(BLD)/emacs.$(O) : \
802 $(SRC)/w32select.h \ 805 $(SRC)/w32select.h \
803 $(NT_INC)/sys/file.h \ 806 $(NT_INC)/sys/file.h \
804 $(NT_INC)/unistd.h \ 807 $(NT_INC)/unistd.h \
808 $(GNU_LIB)/close-stream.h \
805 $(GNU_LIB)/ignore-value.h \ 809 $(GNU_LIB)/ignore-value.h \
806 $(ATIMER_H) \ 810 $(ATIMER_H) \
807 $(BUFFER_H) \ 811 $(BUFFER_H) \
@@ -1214,7 +1218,6 @@ $(BLD)/w32inevt.$(O) : \
1214 1218
1215$(BLD)/w32proc.$(O) : \ 1219$(BLD)/w32proc.$(O) : \
1216 $(SRC)/w32proc.c \ 1220 $(SRC)/w32proc.c \
1217 $(SRC)/syswait.h \
1218 $(SRC)/w32.h \ 1221 $(SRC)/w32.h \
1219 $(SRC)/w32common.h \ 1222 $(SRC)/w32common.h \
1220 $(SRC)/w32heap.h \ 1223 $(SRC)/w32heap.h \
@@ -1228,6 +1231,7 @@ $(BLD)/w32proc.$(O) : \
1228 $(PROCESS_H) \ 1231 $(PROCESS_H) \
1229 $(SYSSIGNAL_H) \ 1232 $(SYSSIGNAL_H) \
1230 $(SYSTIME_H) \ 1233 $(SYSTIME_H) \
1234 $(SYSWAIT_H) \
1231 $(W32TERM_H) 1235 $(W32TERM_H)
1232 1236
1233$(BLD)/w32console.$(O) : \ 1237$(BLD)/w32console.$(O) : \
@@ -1272,7 +1276,6 @@ $(BLD)/process.$(O) : \
1272 $(SRC)/composite.h \ 1276 $(SRC)/composite.h \
1273 $(SRC)/gnutls.h \ 1277 $(SRC)/gnutls.h \
1274 $(SRC)/sysselect.h \ 1278 $(SRC)/sysselect.h \
1275 $(SRC)/syswait.h \
1276 $(SRC)/termopts.h \ 1279 $(SRC)/termopts.h \
1277 $(NT_INC)/arpa/inet.h \ 1280 $(NT_INC)/arpa/inet.h \
1278 $(NT_INC)/netdb.h \ 1281 $(NT_INC)/netdb.h \
@@ -1295,6 +1298,7 @@ $(BLD)/process.$(O) : \
1295 $(SYSSIGNAL_H) \ 1298 $(SYSSIGNAL_H) \
1296 $(SYSTIME_H) \ 1299 $(SYSTIME_H) \
1297 $(SYSTTY_H) \ 1300 $(SYSTTY_H) \
1301 $(SYSWAIT_H) \
1298 $(TERMHOOKS_H) \ 1302 $(TERMHOOKS_H) \
1299 $(W32TERM_H) \ 1303 $(W32TERM_H) \
1300 $(WINDOW_H) 1304 $(WINDOW_H)
@@ -1378,7 +1382,6 @@ $(BLD)/sysdep.$(O) : \
1378 $(SRC)/blockinput.h \ 1382 $(SRC)/blockinput.h \
1379 $(SRC)/cm.h \ 1383 $(SRC)/cm.h \
1380 $(SRC)/sysselect.h \ 1384 $(SRC)/sysselect.h \
1381 $(SRC)/syswait.h \
1382 $(SRC)/termchar.h \ 1385 $(SRC)/termchar.h \
1383 $(SRC)/termopts.h \ 1386 $(SRC)/termopts.h \
1384 $(NT_INC)/netdb.h \ 1387 $(NT_INC)/netdb.h \
@@ -1403,6 +1406,7 @@ $(BLD)/sysdep.$(O) : \
1403 $(SYSSIGNAL_H) \ 1406 $(SYSSIGNAL_H) \
1404 $(SYSTIME_H) \ 1407 $(SYSTIME_H) \
1405 $(SYSTTY_H) \ 1408 $(SYSTTY_H) \
1409 $(SYSWAIT_H) \
1406 $(TERMHOOKS_H) \ 1410 $(TERMHOOKS_H) \
1407 $(WINDOW_H) 1411 $(WINDOW_H)
1408 1412
diff --git a/src/nsterm.m b/src/nsterm.m
index 804ab825dee..57d32ee0528 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -30,7 +30,9 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
30 interpretation of even the system includes. */ 30 interpretation of even the system includes. */
31#include <config.h> 31#include <config.h>
32 32
33#include <fcntl.h>
33#include <math.h> 34#include <math.h>
35#include <pthread.h>
34#include <sys/types.h> 36#include <sys/types.h>
35#include <time.h> 37#include <time.h>
36#include <signal.h> 38#include <signal.h>
@@ -40,10 +42,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
40#include <c-strcase.h> 42#include <c-strcase.h>
41#include <ftoastr.h> 43#include <ftoastr.h>
42 44
43#ifdef HAVE_FCNTL_H
44#include <fcntl.h>
45#endif
46
47#include "lisp.h" 45#include "lisp.h"
48#include "blockinput.h" 46#include "blockinput.h"
49#include "sysselect.h" 47#include "sysselect.h"
@@ -330,6 +328,9 @@ hold_event (struct input_event *event)
330 } 328 }
331 329
332 hold_event_q.q[hold_event_q.nr++] = *event; 330 hold_event_q.q[hold_event_q.nr++] = *event;
331 /* Make sure ns_read_socket is called, i.e. we have input. */
332 raise (SIGIO);
333 send_appdefined = YES;
333} 334}
334 335
335static Lisp_Object 336static Lisp_Object
@@ -3387,7 +3388,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3387 if ([NSApp modalWindow] != nil) 3388 if ([NSApp modalWindow] != nil)
3388 return -1; 3389 return -1;
3389 3390
3390 if (hold_event_q.nr > 0) 3391 if (hold_event_q.nr > 0)
3391 { 3392 {
3392 int i; 3393 int i;
3393 for (i = 0; i < hold_event_q.nr; ++i) 3394 for (i = 0; i < hold_event_q.nr; ++i)
@@ -3461,6 +3462,14 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
3461 3462
3462/* NSTRACE (ns_select); */ 3463/* NSTRACE (ns_select); */
3463 3464
3465 if (hold_event_q.nr > 0)
3466 {
3467 /* We already have events pending. */
3468 raise (SIGIO);
3469 errno = EINTR;
3470 return -1;
3471 }
3472
3464 for (k = 0; k < nfds+1; k++) 3473 for (k = 0; k < nfds+1; k++)
3465 { 3474 {
3466 if (readfds && FD_ISSET(k, readfds)) ++nr; 3475 if (readfds && FD_ISSET(k, readfds)) ++nr;
@@ -3502,7 +3511,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
3502 3511
3503 /* Inform fd_handler that select should be called */ 3512 /* Inform fd_handler that select should be called */
3504 c = 'g'; 3513 c = 'g';
3505 write (selfds[1], &c, 1); 3514 emacs_write (selfds[1], &c, 1);
3506 } 3515 }
3507 else if (nr == 0 && timeout) 3516 else if (nr == 0 && timeout)
3508 { 3517 {
@@ -3535,7 +3544,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
3535 if (nr > 0 && readfds) 3544 if (nr > 0 && readfds)
3536 { 3545 {
3537 c = 's'; 3546 c = 's';
3538 write (selfds[1], &c, 1); 3547 emacs_write (selfds[1], &c, 1);
3539 } 3548 }
3540 unblock_input (); 3549 unblock_input ();
3541 3550
@@ -4574,11 +4583,8 @@ not_in_argv (NSString *arg)
4574 4583
4575 FD_SET (selfds[0], &fds); 4584 FD_SET (selfds[0], &fds);
4576 result = select (selfds[0]+1, &fds, NULL, NULL, NULL); 4585 result = select (selfds[0]+1, &fds, NULL, NULL, NULL);
4577 if (result > 0) 4586 if (result > 0 && read (selfds[0], &c, 1) == 1 && c == 'g')
4578 { 4587 waiting = 0;
4579 read (selfds[0], &c, 1);
4580 if (c == 'g') waiting = 0;
4581 }
4582 } 4588 }
4583 else 4589 else
4584 { 4590 {
@@ -4618,8 +4624,8 @@ not_in_argv (NSString *arg)
4618 { 4624 {
4619 if (FD_ISSET (selfds[0], &readfds)) 4625 if (FD_ISSET (selfds[0], &readfds))
4620 { 4626 {
4621 read (selfds[0], &c, 1); 4627 if (read (selfds[0], &c, 1) == 1 && c == 's')
4622 if (c == 's') waiting = 1; 4628 waiting = 1;
4623 } 4629 }
4624 else 4630 else
4625 { 4631 {
@@ -6694,7 +6700,7 @@ not_in_argv (NSString *arg)
6694 /* Events may come here even if the event loop is not running. 6700 /* Events may come here even if the event loop is not running.
6695 If we don't enter the event loop, the scroll bar will not update. 6701 If we don't enter the event loop, the scroll bar will not update.
6696 So send SIGIO to ourselves. */ 6702 So send SIGIO to ourselves. */
6697 if (apploopnr == 0) kill (0, SIGIO); 6703 if (apploopnr == 0) raise (SIGIO);
6698 6704
6699 return self; 6705 return self;
6700} 6706}
diff --git a/src/process.c b/src/process.c
index 728abebe758..0036ce595f5 100644
--- a/src/process.c
+++ b/src/process.c
@@ -130,18 +130,6 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
130 EMACS_TIME *, void *); 130 EMACS_TIME *, void *);
131#endif 131#endif
132 132
133/* This is for DOS_NT ports. FIXME: Remove this old portability cruft
134 by having DOS_NT ports implement waitpid instead of wait. Nowadays
135 POSIXish hosts all define waitpid, WNOHANG, and WUNTRACED, as these
136 have been standard since POSIX.1-1988. */
137#ifndef WNOHANG
138# undef waitpid
139# define waitpid(pid, status, options) wait (status)
140#endif
141#ifndef WUNTRACED
142# define WUNTRACED 0
143#endif
144
145/* Work around GCC 4.7.0 bug with strict overflow checking; see 133/* Work around GCC 4.7.0 bug with strict overflow checking; see
146 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>. 134 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
147 These lines can be removed once the GCC bug is fixed. */ 135 These lines can be removed once the GCC bug is fixed. */
@@ -208,11 +196,9 @@ static EMACS_INT update_tick;
208#ifndef NON_BLOCKING_CONNECT 196#ifndef NON_BLOCKING_CONNECT
209#ifdef HAVE_SELECT 197#ifdef HAVE_SELECT
210#if defined (HAVE_GETPEERNAME) || defined (GNU_LINUX) 198#if defined (HAVE_GETPEERNAME) || defined (GNU_LINUX)
211#if O_NONBLOCK || O_NDELAY
212#if defined (EWOULDBLOCK) || defined (EINPROGRESS) 199#if defined (EWOULDBLOCK) || defined (EINPROGRESS)
213#define NON_BLOCKING_CONNECT 200#define NON_BLOCKING_CONNECT
214#endif /* EWOULDBLOCK || EINPROGRESS */ 201#endif /* EWOULDBLOCK || EINPROGRESS */
215#endif /* O_NONBLOCK || O_NDELAY */
216#endif /* HAVE_GETPEERNAME || GNU_LINUX */ 202#endif /* HAVE_GETPEERNAME || GNU_LINUX */
217#endif /* HAVE_SELECT */ 203#endif /* HAVE_SELECT */
218#endif /* NON_BLOCKING_CONNECT */ 204#endif /* NON_BLOCKING_CONNECT */
@@ -340,9 +326,6 @@ static struct sockaddr_and_len {
340#define DATAGRAM_CONN_P(proc) (0) 326#define DATAGRAM_CONN_P(proc) (0)
341#endif 327#endif
342 328
343/* Maximum number of bytes to send to a pty without an eof. */
344static int pty_max_bytes;
345
346/* These setters are used only in this file, so they can be private. */ 329/* These setters are used only in this file, so they can be private. */
347static void 330static void
348pset_buffer (struct Lisp_Process *p, Lisp_Object val) 331pset_buffer (struct Lisp_Process *p, Lisp_Object val)
@@ -654,13 +637,7 @@ allocate_pty (void)
654#ifdef PTY_OPEN 637#ifdef PTY_OPEN
655 PTY_OPEN; 638 PTY_OPEN;
656#else /* no PTY_OPEN */ 639#else /* no PTY_OPEN */
657 { 640 fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0);
658# if O_NONBLOCK
659 fd = emacs_open (pty_name, O_RDWR | O_NONBLOCK, 0);
660# else
661 fd = emacs_open (pty_name, O_RDWR | O_NDELAY, 0);
662# endif
663 }
664#endif /* no PTY_OPEN */ 641#endif /* no PTY_OPEN */
665 642
666 if (fd >= 0) 643 if (fd >= 0)
@@ -1598,7 +1575,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1598 int inchannel, outchannel; 1575 int inchannel, outchannel;
1599 pid_t pid; 1576 pid_t pid;
1600 int sv[2]; 1577 int sv[2];
1601#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1578#ifndef WINDOWSNT
1602 int wait_child_setup[2]; 1579 int wait_child_setup[2];
1603#endif 1580#endif
1604#ifdef SIGCHLD 1581#ifdef SIGCHLD
@@ -1624,13 +1601,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1624#if ! defined (USG) || defined (USG_SUBTTY_WORKS) 1601#if ! defined (USG) || defined (USG_SUBTTY_WORKS)
1625 /* On most USG systems it does not work to open the pty's tty here, 1602 /* On most USG systems it does not work to open the pty's tty here,
1626 then close it and reopen it in the child. */ 1603 then close it and reopen it in the child. */
1627#if O_NOCTTY
1628 /* Don't let this terminal become our controlling terminal 1604 /* Don't let this terminal become our controlling terminal
1629 (in case we don't have one). */ 1605 (in case we don't have one). */
1630 forkout = forkin = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0); 1606 forkout = forkin = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0);
1631#else
1632 forkout = forkin = emacs_open (pty_name, O_RDWR, 0);
1633#endif
1634 if (forkin < 0) 1607 if (forkin < 0)
1635 report_file_error ("Opening pty", Qnil); 1608 report_file_error ("Opening pty", Qnil);
1636#else 1609#else
@@ -1659,7 +1632,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1659 forkin = sv[0]; 1632 forkin = sv[0];
1660 } 1633 }
1661 1634
1662#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1635#ifndef WINDOWSNT
1663 { 1636 {
1664 int tem; 1637 int tem;
1665 1638
@@ -1678,15 +1651,8 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1678 } 1651 }
1679#endif 1652#endif
1680 1653
1681#if O_NONBLOCK
1682 fcntl (inchannel, F_SETFL, O_NONBLOCK); 1654 fcntl (inchannel, F_SETFL, O_NONBLOCK);
1683 fcntl (outchannel, F_SETFL, O_NONBLOCK); 1655 fcntl (outchannel, F_SETFL, O_NONBLOCK);
1684#else
1685#if O_NDELAY
1686 fcntl (inchannel, F_SETFL, O_NDELAY);
1687 fcntl (outchannel, F_SETFL, O_NDELAY);
1688#endif
1689#endif
1690 1656
1691 /* Record this as an active process, with its channels. 1657 /* Record this as an active process, with its channels.
1692 As a result, child_setup will close Emacs's side of the pipes. */ 1658 As a result, child_setup will close Emacs's side of the pipes. */
@@ -1845,9 +1811,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1845 pid = child_setup (xforkin, xforkout, xforkout, 1811 pid = child_setup (xforkin, xforkout, xforkout,
1846 new_argv, 1, encoded_current_dir); 1812 new_argv, 1, encoded_current_dir);
1847#else /* not WINDOWSNT */ 1813#else /* not WINDOWSNT */
1848#ifdef FD_CLOEXEC
1849 emacs_close (wait_child_setup[0]); 1814 emacs_close (wait_child_setup[0]);
1850#endif
1851 child_setup (xforkin, xforkout, xforkout, 1815 child_setup (xforkin, xforkout, xforkout,
1852 new_argv, 1, encoded_current_dir); 1816 new_argv, 1, encoded_current_dir);
1853#endif /* not WINDOWSNT */ 1817#endif /* not WINDOWSNT */
@@ -1906,7 +1870,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1906 1870
1907 pset_tty_name (XPROCESS (process), lisp_pty_name); 1871 pset_tty_name (XPROCESS (process), lisp_pty_name);
1908 1872
1909#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1873#ifndef WINDOWSNT
1910 /* Wait for child_setup to complete in case that vfork is 1874 /* Wait for child_setup to complete in case that vfork is
1911 actually defined as fork. The descriptor wait_child_setup[1] 1875 actually defined as fork. The descriptor wait_child_setup[1]
1912 of a pipe is closed at the child side either by close-on-exec 1876 of a pipe is closed at the child side either by close-on-exec
@@ -1943,13 +1907,9 @@ create_pty (Lisp_Object process)
1943#if ! defined (USG) || defined (USG_SUBTTY_WORKS) 1907#if ! defined (USG) || defined (USG_SUBTTY_WORKS)
1944 /* On most USG systems it does not work to open the pty's tty here, 1908 /* On most USG systems it does not work to open the pty's tty here,
1945 then close it and reopen it in the child. */ 1909 then close it and reopen it in the child. */
1946#if O_NOCTTY
1947 /* Don't let this terminal become our controlling terminal 1910 /* Don't let this terminal become our controlling terminal
1948 (in case we don't have one). */ 1911 (in case we don't have one). */
1949 int forkout = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0); 1912 int forkout = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0);
1950#else
1951 int forkout = emacs_open (pty_name, O_RDWR, 0);
1952#endif
1953 if (forkout < 0) 1913 if (forkout < 0)
1954 report_file_error ("Opening pty", Qnil); 1914 report_file_error ("Opening pty", Qnil);
1955#if defined (DONT_REOPEN_PTY) 1915#if defined (DONT_REOPEN_PTY)
@@ -1963,15 +1923,8 @@ create_pty (Lisp_Object process)
1963 } 1923 }
1964#endif /* HAVE_PTYS */ 1924#endif /* HAVE_PTYS */
1965 1925
1966#if O_NONBLOCK
1967 fcntl (inchannel, F_SETFL, O_NONBLOCK); 1926 fcntl (inchannel, F_SETFL, O_NONBLOCK);
1968 fcntl (outchannel, F_SETFL, O_NONBLOCK); 1927 fcntl (outchannel, F_SETFL, O_NONBLOCK);
1969#else
1970#if O_NDELAY
1971 fcntl (inchannel, F_SETFL, O_NDELAY);
1972 fcntl (outchannel, F_SETFL, O_NDELAY);
1973#endif
1974#endif
1975 1928
1976 /* Record this as an active process, with its channels. 1929 /* Record this as an active process, with its channels.
1977 As a result, child_setup will close Emacs's side of the pipes. */ 1930 As a result, child_setup will close Emacs's side of the pipes. */
@@ -2927,13 +2880,9 @@ usage: (make-network-process &rest ARGS) */)
2927 { 2880 {
2928 /* Don't support network sockets when non-blocking mode is 2881 /* Don't support network sockets when non-blocking mode is
2929 not available, since a blocked Emacs is not useful. */ 2882 not available, since a blocked Emacs is not useful. */
2930#if !O_NONBLOCK && !O_NDELAY
2931 error ("Network servers not supported");
2932#else
2933 is_server = 1; 2883 is_server = 1;
2934 if (TYPE_RANGED_INTEGERP (int, tem)) 2884 if (TYPE_RANGED_INTEGERP (int, tem))
2935 backlog = XINT (tem); 2885 backlog = XINT (tem);
2936#endif
2937 } 2886 }
2938 2887
2939 /* Make QCaddress an alias for :local (server) or :remote (client). */ 2888 /* Make QCaddress an alias for :local (server) or :remote (client). */
@@ -3193,11 +3142,7 @@ usage: (make-network-process &rest ARGS) */)
3193#ifdef NON_BLOCKING_CONNECT 3142#ifdef NON_BLOCKING_CONNECT
3194 if (is_non_blocking_client) 3143 if (is_non_blocking_client)
3195 { 3144 {
3196#if O_NONBLOCK
3197 ret = fcntl (s, F_SETFL, O_NONBLOCK); 3145 ret = fcntl (s, F_SETFL, O_NONBLOCK);
3198#else
3199 ret = fcntl (s, F_SETFL, O_NDELAY);
3200#endif
3201 if (ret < 0) 3146 if (ret < 0)
3202 { 3147 {
3203 xerrno = errno; 3148 xerrno = errno;
@@ -3410,13 +3355,7 @@ usage: (make-network-process &rest ARGS) */)
3410 3355
3411 chan_process[inch] = proc; 3356 chan_process[inch] = proc;
3412 3357
3413#if O_NONBLOCK
3414 fcntl (inch, F_SETFL, O_NONBLOCK); 3358 fcntl (inch, F_SETFL, O_NONBLOCK);
3415#else
3416#if O_NDELAY
3417 fcntl (inch, F_SETFL, O_NDELAY);
3418#endif
3419#endif
3420 3359
3421 p = XPROCESS (proc); 3360 p = XPROCESS (proc);
3422 3361
@@ -4145,13 +4084,7 @@ server_accept_connection (Lisp_Object server, int channel)
4145 4084
4146 chan_process[s] = proc; 4085 chan_process[s] = proc;
4147 4086
4148#if O_NONBLOCK
4149 fcntl (s, F_SETFL, O_NONBLOCK); 4087 fcntl (s, F_SETFL, O_NONBLOCK);
4150#else
4151#if O_NDELAY
4152 fcntl (s, F_SETFL, O_NDELAY);
4153#endif
4154#endif
4155 4088
4156 p = XPROCESS (proc); 4089 p = XPROCESS (proc);
4157 4090
@@ -4847,23 +4780,17 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4847 else if (nread == -1 && errno == EWOULDBLOCK) 4780 else if (nread == -1 && errno == EWOULDBLOCK)
4848 ; 4781 ;
4849#endif 4782#endif
4850 /* ISC 4.1 defines both EWOULDBLOCK and O_NONBLOCK,
4851 and Emacs uses O_NONBLOCK, so what we get is EAGAIN. */
4852#if O_NONBLOCK
4853 else if (nread == -1 && errno == EAGAIN)
4854 ;
4855#else
4856#if O_NDELAY
4857 else if (nread == -1 && errno == EAGAIN) 4783 else if (nread == -1 && errno == EAGAIN)
4858 ; 4784 ;
4785#ifdef WINDOWSNT
4786 /* FIXME: Is this special case still needed? */
4859 /* Note that we cannot distinguish between no input 4787 /* Note that we cannot distinguish between no input
4860 available now and a closed pipe. 4788 available now and a closed pipe.
4861 With luck, a closed pipe will be accompanied by 4789 With luck, a closed pipe will be accompanied by
4862 subprocess termination and SIGCHLD. */ 4790 subprocess termination and SIGCHLD. */
4863 else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc)) 4791 else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc))
4864 ; 4792 ;
4865#endif /* O_NDELAY */ 4793#endif
4866#endif /* O_NONBLOCK */
4867#ifdef HAVE_PTYS 4794#ifdef HAVE_PTYS
4868 /* On some OSs with ptys, when the process on one end of 4795 /* On some OSs with ptys, when the process on one end of
4869 a pty exits, the other end gets an error reading with 4796 a pty exits, the other end gets an error reading with
@@ -5532,19 +5459,6 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
5532 buf = SSDATA (object); 5459 buf = SSDATA (object);
5533 } 5460 }
5534 5461
5535 if (pty_max_bytes == 0)
5536 {
5537#if defined (HAVE_FPATHCONF) && defined (_PC_MAX_CANON)
5538 pty_max_bytes = fpathconf (p->outfd, _PC_MAX_CANON);
5539 if (pty_max_bytes < 0)
5540 pty_max_bytes = 250;
5541#else
5542 pty_max_bytes = 250;
5543#endif
5544 /* Deduct one, to leave space for the eof. */
5545 pty_max_bytes--;
5546 }
5547
5548 /* If there is already data in the write_queue, put the new data 5462 /* If there is already data in the write_queue, put the new data
5549 in the back of queue. Otherwise, ignore it. */ 5463 in the back of queue. Otherwise, ignore it. */
5550 if (!NILP (p->write_queue)) 5464 if (!NILP (p->write_queue))
@@ -6311,17 +6225,9 @@ record_child_status_change (pid_t pid, int w)
6311{ 6225{
6312#ifdef SIGCHLD 6226#ifdef SIGCHLD
6313 6227
6314# ifdef WNOHANG 6228 /* Record at most one child only if we already know one child that
6315 /* On POSIXish hosts, record at most one child only if we already 6229 has exited. */
6316 know one child that has exited. */
6317 bool record_at_most_one_child = 0 <= pid; 6230 bool record_at_most_one_child = 0 <= pid;
6318# else
6319 /* On DOS_NT (the only porting target that lacks WNOHANG),
6320 record the status of at most one child process, since the SIGCHLD
6321 handler must return right away. If any more processes want to
6322 signal us, we will get another signal. */
6323 bool record_at_most_one_child = 1;
6324# endif
6325 6231
6326 Lisp_Object tail; 6232 Lisp_Object tail;
6327 6233
@@ -7348,9 +7254,7 @@ init_process_emacs (void)
7348#ifdef HAVE_GETSOCKNAME 7254#ifdef HAVE_GETSOCKNAME
7349 ADD_SUBFEATURE (QCservice, Qt); 7255 ADD_SUBFEATURE (QCservice, Qt);
7350#endif 7256#endif
7351#if O_NONBLOCK || O_NDELAY
7352 ADD_SUBFEATURE (QCserver, Qt); 7257 ADD_SUBFEATURE (QCserver, Qt);
7353#endif
7354 7258
7355 for (sopt = socket_options; sopt->name; sopt++) 7259 for (sopt = socket_options; sopt->name; sopt++)
7356 subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures); 7260 subfeatures = pure_cons (intern_c_string (sopt->name), subfeatures);
diff --git a/src/sysdep.c b/src/sysdep.c
index a7f3de2f1b1..7c5c144fa8c 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -289,10 +289,6 @@ wait_for_termination_1 (pid_t pid, int interruptible)
289{ 289{
290 while (1) 290 while (1)
291 { 291 {
292#ifdef WINDOWSNT
293 wait (0);
294 break;
295#else /* not WINDOWSNT */
296 int status; 292 int status;
297 int wait_result = waitpid (pid, &status, 0); 293 int wait_result = waitpid (pid, &status, 0);
298 if (wait_result < 0) 294 if (wait_result < 0)
@@ -306,7 +302,8 @@ wait_for_termination_1 (pid_t pid, int interruptible)
306 break; 302 break;
307 } 303 }
308 304
309#endif /* not WINDOWSNT */ 305 /* Note: the MS-Windows emulation of waitpid calls QUIT
306 internally. */
310 if (interruptible) 307 if (interruptible)
311 QUIT; 308 QUIT;
312 } 309 }
@@ -1039,8 +1036,7 @@ init_sys_modes (struct tty_display_info *tty_out)
1039#endif 1036#endif
1040#endif 1037#endif
1041 1038
1042#ifdef F_SETFL 1039#ifdef F_GETOWN
1043#ifdef F_GETOWN /* F_SETFL does not imply existence of F_GETOWN */
1044 if (interrupt_input) 1040 if (interrupt_input)
1045 { 1041 {
1046 old_fcntl_owner[fileno (tty_out->input)] = 1042 old_fcntl_owner[fileno (tty_out->input)] =
@@ -1058,7 +1054,6 @@ init_sys_modes (struct tty_display_info *tty_out)
1058#endif /* HAVE_GPM */ 1054#endif /* HAVE_GPM */
1059 } 1055 }
1060#endif /* F_GETOWN */ 1056#endif /* F_GETOWN */
1061#endif /* F_SETFL */
1062 1057
1063#ifdef _IOFBF 1058#ifdef _IOFBF
1064 /* This symbol is defined on recent USG systems. 1059 /* This symbol is defined on recent USG systems.
@@ -1278,8 +1273,8 @@ reset_sys_modes (struct tty_display_info *tty_out)
1278 fsync (fileno (tty_out->output)); 1273 fsync (fileno (tty_out->output));
1279#endif 1274#endif
1280 1275
1281#ifdef F_SETFL 1276#ifndef DOS_NT
1282#ifdef F_SETOWN /* F_SETFL does not imply existence of F_SETOWN */ 1277#ifdef F_SETOWN
1283 if (interrupt_input) 1278 if (interrupt_input)
1284 { 1279 {
1285 reset_sigio (fileno (tty_out->input)); 1280 reset_sigio (fileno (tty_out->input));
@@ -1287,11 +1282,9 @@ reset_sys_modes (struct tty_display_info *tty_out)
1287 old_fcntl_owner[fileno (tty_out->input)]); 1282 old_fcntl_owner[fileno (tty_out->input)]);
1288 } 1283 }
1289#endif /* F_SETOWN */ 1284#endif /* F_SETOWN */
1290#if O_NDELAY
1291 fcntl (fileno (tty_out->input), F_SETFL, 1285 fcntl (fileno (tty_out->input), F_SETFL,
1292 fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NDELAY); 1286 fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NONBLOCK);
1293#endif 1287#endif
1294#endif /* F_SETFL */
1295 1288
1296 if (tty_out->old_tty) 1289 if (tty_out->old_tty)
1297 while (emacs_set_tty (fileno (tty_out->input), 1290 while (emacs_set_tty (fileno (tty_out->input),
@@ -2380,19 +2373,7 @@ safe_strsignal (int code)
2380int 2373int
2381serial_open (char *port) 2374serial_open (char *port)
2382{ 2375{
2383 int fd = -1; 2376 int fd = emacs_open (port, O_RDWR | O_NOCTTY | O_NONBLOCK, 0);
2384
2385 fd = emacs_open ((char*) port,
2386 O_RDWR
2387#if O_NONBLOCK
2388 | O_NONBLOCK
2389#else
2390 | O_NDELAY
2391#endif
2392#if O_NOCTTY
2393 | O_NOCTTY
2394#endif
2395 , 0);
2396 if (fd < 0) 2377 if (fd < 0)
2397 { 2378 {
2398 error ("Could not open %s: %s", 2379 error ("Could not open %s: %s",
diff --git a/src/term.c b/src/term.c
index 96549290da5..481a3423989 100644
--- a/src/term.c
+++ b/src/term.c
@@ -20,8 +20,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20/* New redisplay, TTY faces by Gerd Moellmann <gerd@gnu.org>. */ 20/* New redisplay, TTY faces by Gerd Moellmann <gerd@gnu.org>. */
21 21
22#include <config.h> 22#include <config.h>
23#include <stdio.h>
24#include <errno.h> 23#include <errno.h>
24#include <fcntl.h>
25#include <stdio.h>
25#include <sys/file.h> 26#include <sys/file.h>
26#include <sys/time.h> 27#include <sys/time.h>
27#include <unistd.h> 28#include <unistd.h>
@@ -55,14 +56,6 @@ static int been_here = -1;
55#include "xterm.h" 56#include "xterm.h"
56#endif 57#endif
57 58
58#ifndef O_RDWR
59#define O_RDWR 2
60#endif
61
62#ifndef O_NOCTTY
63#define O_NOCTTY 0
64#endif
65
66/* The name of the default console device. */ 59/* The name of the default console device. */
67#ifdef WINDOWSNT 60#ifdef WINDOWSNT
68#define DEV_TTY "CONOUT$" 61#define DEV_TTY "CONOUT$"
@@ -2989,22 +2982,18 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
2989 set_tty_hooks (terminal); 2982 set_tty_hooks (terminal);
2990 2983
2991 { 2984 {
2992 int fd; 2985 /* Open the terminal device. */
2993 FILE *file; 2986 FILE *file;
2994 2987
2995#if O_IGNORE_CTTY 2988 /* If !ctty, don't recognize it as our controlling terminal, and
2996 if (!ctty) 2989 don't make it the controlling tty if we don't have one now.
2997 /* Open the terminal device. Don't recognize it as our 2990
2998 controlling terminal, and don't make it the controlling tty 2991 Alas, O_IGNORE_CTTY is a GNU extension that seems to be only
2999 if we don't have one at the moment. */ 2992 defined on Hurd. On other systems, we need to explicitly
3000 fd = emacs_open (name, O_RDWR | O_IGNORE_CTTY | O_NOCTTY, 0); 2993 dissociate ourselves from the controlling tty when we want to
3001 else 2994 open a frame on the same terminal. */
3002#endif /* O_IGNORE_CTTY */ 2995 int flags = O_RDWR | O_NOCTTY | (ctty ? 0 : O_IGNORE_CTTY);
3003 /* Alas, O_IGNORE_CTTY is a GNU extension that seems to be only 2996 int fd = emacs_open (name, flags, 0);
3004 defined on Hurd. On other systems, we need to explicitly
3005 dissociate ourselves from the controlling tty when we want to
3006 open a frame on the same terminal. */
3007 fd = emacs_open (name, O_RDWR | O_NOCTTY, 0);
3008 2997
3009 tty->name = xstrdup (name); 2998 tty->name = xstrdup (name);
3010 terminal->name = xstrdup (name); 2999 terminal->name = xstrdup (name);
@@ -3023,10 +3012,8 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
3023 name); 3012 name);
3024 } 3013 }
3025 3014
3026#if !O_IGNORE_CTTY 3015 if (!O_IGNORE_CTTY && !ctty)
3027 if (!ctty)
3028 dissociate_if_controlling_tty (fd); 3016 dissociate_if_controlling_tty (fd);
3029#endif
3030 3017
3031 file = fdopen (fd, "w+"); 3018 file = fdopen (fd, "w+");
3032 tty->input = file; 3019 tty->input = file;
diff --git a/src/unexelf.c b/src/unexelf.c
index 121e6042fc9..b9f8e05e959 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -461,7 +461,7 @@ typedef struct {
461/* 461/*
462 * NetBSD does not have normal-looking user-land ELF support. 462 * NetBSD does not have normal-looking user-land ELF support.
463 */ 463 */
464# if defined __alpha__ || defined __sparc_v9__ 464# if defined __alpha__ || defined __sparc_v9__ || defined _LP64
465# define ELFSIZE 64 465# define ELFSIZE 64
466# else 466# else
467# define ELFSIZE 32 467# define ELFSIZE 32
diff --git a/src/w32.c b/src/w32.c
index 0e7da449b81..94cf472a4ae 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1597,7 +1597,7 @@ init_environment (char ** argv)
1597 see if it succeeds. But I think that's too much to ask. */ 1597 see if it succeeds. But I think that's too much to ask. */
1598 1598
1599 /* MSVCRT's _access crashes with D_OK. */ 1599 /* MSVCRT's _access crashes with D_OK. */
1600 if (tmp && sys_faccessat (AT_FDCWD, tmp, D_OK, AT_EACCESS) == 0) 1600 if (tmp && faccessat (AT_FDCWD, tmp, D_OK, AT_EACCESS) == 0)
1601 { 1601 {
1602 char * var = alloca (strlen (tmp) + 8); 1602 char * var = alloca (strlen (tmp) + 8);
1603 sprintf (var, "TMPDIR=%s", tmp); 1603 sprintf (var, "TMPDIR=%s", tmp);
@@ -2708,17 +2708,15 @@ logon_network_drive (const char *path)
2708 WNetAddConnection2 (&resource, NULL, NULL, CONNECT_INTERACTIVE); 2708 WNetAddConnection2 (&resource, NULL, NULL, CONNECT_INTERACTIVE);
2709} 2709}
2710 2710
2711/* Shadow some MSVC runtime functions to map requests for long filenames 2711/* Emulate faccessat(2). */
2712 to reasonable short names if necessary. This was originally added to
2713 permit running Emacs on NT 3.1 on a FAT partition, which doesn't support
2714 long file names. */
2715
2716int 2712int
2717sys_faccessat (int dirfd, const char * path, int mode, int flags) 2713faccessat (int dirfd, const char * path, int mode, int flags)
2718{ 2714{
2719 DWORD attributes; 2715 DWORD attributes;
2720 2716
2721 if (dirfd != AT_FDCWD) 2717 if (dirfd != AT_FDCWD
2718 && !(IS_DIRECTORY_SEP (path[0])
2719 || IS_DEVICE_SEP (path[1])))
2722 { 2720 {
2723 errno = EBADF; 2721 errno = EBADF;
2724 return -1; 2722 return -1;
@@ -2731,7 +2729,8 @@ sys_faccessat (int dirfd, const char * path, int mode, int flags)
2731 to get the attributes of its target file. Note: any symlinks in 2729 to get the attributes of its target file. Note: any symlinks in
2732 PATH elements other than the last one are transparently resolved 2730 PATH elements other than the last one are transparently resolved
2733 by GetFileAttributes below. */ 2731 by GetFileAttributes below. */
2734 if ((volume_info.flags & FILE_SUPPORTS_REPARSE_POINTS) != 0) 2732 if ((volume_info.flags & FILE_SUPPORTS_REPARSE_POINTS) != 0
2733 && (flags & AT_SYMLINK_NOFOLLOW) == 0)
2735 path = chase_symlinks (path); 2734 path = chase_symlinks (path);
2736 2735
2737 if ((attributes = GetFileAttributes (path)) == -1) 2736 if ((attributes = GetFileAttributes (path)) == -1)
@@ -2763,7 +2762,8 @@ sys_faccessat (int dirfd, const char * path, int mode, int flags)
2763 } 2762 }
2764 return -1; 2763 return -1;
2765 } 2764 }
2766 if ((mode & X_OK) != 0 && !is_exec (path)) 2765 if ((mode & X_OK) != 0
2766 && !(is_exec (path) || (attributes & FILE_ATTRIBUTE_DIRECTORY) != 0))
2767 { 2767 {
2768 errno = EACCES; 2768 errno = EACCES;
2769 return -1; 2769 return -1;
@@ -2781,6 +2781,11 @@ sys_faccessat (int dirfd, const char * path, int mode, int flags)
2781 return 0; 2781 return 0;
2782} 2782}
2783 2783
2784/* Shadow some MSVC runtime functions to map requests for long filenames
2785 to reasonable short names if necessary. This was originally added to
2786 permit running Emacs on NT 3.1 on a FAT partition, which doesn't support
2787 long file names. */
2788
2784int 2789int
2785sys_chdir (const char * path) 2790sys_chdir (const char * path)
2786{ 2791{
@@ -2966,7 +2971,7 @@ sys_mktemp (char * template)
2966 { 2971 {
2967 int save_errno = errno; 2972 int save_errno = errno;
2968 p[0] = first_char[i]; 2973 p[0] = first_char[i];
2969 if (sys_faccessat (AT_FDCWD, template, F_OK, AT_EACCESS) < 0) 2974 if (faccessat (AT_FDCWD, template, F_OK, AT_EACCESS) < 0)
2970 { 2975 {
2971 errno = save_errno; 2976 errno = save_errno;
2972 return template; 2977 return template;
@@ -4017,7 +4022,7 @@ symlink (char const *filename, char const *linkname)
4017 { 4022 {
4018 /* Non-absolute FILENAME is understood as being relative to 4023 /* Non-absolute FILENAME is understood as being relative to
4019 LINKNAME's directory. We need to prepend that directory to 4024 LINKNAME's directory. We need to prepend that directory to
4020 FILENAME to get correct results from sys_faccessat below, since 4025 FILENAME to get correct results from faccessat below, since
4021 otherwise it will interpret FILENAME relative to the 4026 otherwise it will interpret FILENAME relative to the
4022 directory where the Emacs process runs. Note that 4027 directory where the Emacs process runs. Note that
4023 make-symbolic-link always makes sure LINKNAME is a fully 4028 make-symbolic-link always makes sure LINKNAME is a fully
@@ -4031,10 +4036,10 @@ symlink (char const *filename, char const *linkname)
4031 strncpy (tem, linkfn, p - linkfn); 4036 strncpy (tem, linkfn, p - linkfn);
4032 tem[p - linkfn] = '\0'; 4037 tem[p - linkfn] = '\0';
4033 strcat (tem, filename); 4038 strcat (tem, filename);
4034 dir_access = sys_faccessat (AT_FDCWD, tem, D_OK, AT_EACCESS); 4039 dir_access = faccessat (AT_FDCWD, tem, D_OK, AT_EACCESS);
4035 } 4040 }
4036 else 4041 else
4037 dir_access = sys_faccessat (AT_FDCWD, filename, D_OK, AT_EACCESS); 4042 dir_access = faccessat (AT_FDCWD, filename, D_OK, AT_EACCESS);
4038 4043
4039 /* Since Windows distinguishes between symlinks to directories and 4044 /* Since Windows distinguishes between symlinks to directories and
4040 to files, we provide a kludgy feature: if FILENAME doesn't 4045 to files, we provide a kludgy feature: if FILENAME doesn't
@@ -5849,7 +5854,7 @@ fcntl (int s, int cmd, int options)
5849 check_errno (); 5854 check_errno ();
5850 if (fd_info[s].flags & FILE_SOCKET) 5855 if (fd_info[s].flags & FILE_SOCKET)
5851 { 5856 {
5852 if (cmd == F_SETFL && options == O_NDELAY) 5857 if (cmd == F_SETFL && options == O_NONBLOCK)
5853 { 5858 {
5854 unsigned long nblock = 1; 5859 unsigned long nblock = 1;
5855 int rc = pfn_ioctlsocket (SOCK_HANDLE (s), FIONBIO, &nblock); 5860 int rc = pfn_ioctlsocket (SOCK_HANDLE (s), FIONBIO, &nblock);
diff --git a/src/w32proc.c b/src/w32proc.c
index f35a2da537c..9b111b40e36 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -431,13 +431,14 @@ timer_loop (LPVOID arg)
431 /* Simulate a signal delivered to the thread which installed 431 /* Simulate a signal delivered to the thread which installed
432 the timer, by suspending that thread while the handler 432 the timer, by suspending that thread while the handler
433 runs. */ 433 runs. */
434 DWORD result = SuspendThread (itimer->caller_thread); 434 HANDLE th = itimer->caller_thread;
435 DWORD result = SuspendThread (th);
435 436
436 if (result == (DWORD)-1) 437 if (result == (DWORD)-1)
437 return 2; 438 return 2;
438 439
439 handler (sig); 440 handler (sig);
440 ResumeThread (itimer->caller_thread); 441 ResumeThread (th);
441 } 442 }
442 443
443 /* Update expiration time and loop. */ 444 /* Update expiration time and loop. */
@@ -562,6 +563,7 @@ static int
562start_timer_thread (int which) 563start_timer_thread (int which)
563{ 564{
564 DWORD exit_code; 565 DWORD exit_code;
566 HANDLE th;
565 struct itimer_data *itimer = 567 struct itimer_data *itimer =
566 (which == ITIMER_REAL) ? &real_itimer : &prof_itimer; 568 (which == ITIMER_REAL) ? &real_itimer : &prof_itimer;
567 569
@@ -570,9 +572,29 @@ start_timer_thread (int which)
570 && exit_code == STILL_ACTIVE) 572 && exit_code == STILL_ACTIVE)
571 return 0; 573 return 0;
572 574
575 /* Clean up after possibly exited thread. */
576 if (itimer->timer_thread)
577 {
578 CloseHandle (itimer->timer_thread);
579 itimer->timer_thread = NULL;
580 }
581 if (itimer->caller_thread)
582 {
583 CloseHandle (itimer->caller_thread);
584 itimer->caller_thread = NULL;
585 }
586
573 /* Start a new thread. */ 587 /* Start a new thread. */
588 if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
589 GetCurrentProcess (), &th, 0, FALSE,
590 DUPLICATE_SAME_ACCESS))
591 {
592 errno = ESRCH;
593 return -1;
594 }
574 itimer->terminate = 0; 595 itimer->terminate = 0;
575 itimer->type = which; 596 itimer->type = which;
597 itimer->caller_thread = th;
576 /* Request that no more than 64KB of stack be reserved for this 598 /* Request that no more than 64KB of stack be reserved for this
577 thread, to avoid reserving too much memory, which would get in 599 thread, to avoid reserving too much memory, which would get in
578 the way of threads we start to wait for subprocesses. See also 600 the way of threads we start to wait for subprocesses. See also
@@ -591,7 +613,7 @@ start_timer_thread (int which)
591 /* This is needed to make sure that the timer thread running for 613 /* This is needed to make sure that the timer thread running for
592 profiling gets CPU as soon as the Sleep call terminates. */ 614 profiling gets CPU as soon as the Sleep call terminates. */
593 if (which == ITIMER_PROF) 615 if (which == ITIMER_PROF)
594 SetThreadPriority (itimer->caller_thread, THREAD_PRIORITY_TIME_CRITICAL); 616 SetThreadPriority (itimer->timer_thread, THREAD_PRIORITY_TIME_CRITICAL);
595 617
596 return 0; 618 return 0;
597} 619}
@@ -626,17 +648,9 @@ getitimer (int which, struct itimerval *value)
626 648
627 itimer = (which == ITIMER_REAL) ? &real_itimer : &prof_itimer; 649 itimer = (which == ITIMER_REAL) ? &real_itimer : &prof_itimer;
628 650
629 if (!DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
630 GetCurrentProcess (), &itimer->caller_thread, 0,
631 FALSE, DUPLICATE_SAME_ACCESS))
632 {
633 errno = ESRCH;
634 return -1;
635 }
636
637 ticks_now = w32_get_timer_time ((which == ITIMER_REAL) 651 ticks_now = w32_get_timer_time ((which == ITIMER_REAL)
638 ? NULL 652 ? NULL
639 : itimer->caller_thread); 653 : GetCurrentThread ());
640 654
641 t_expire = &itimer->expire; 655 t_expire = &itimer->expire;
642 t_reload = &itimer->reload; 656 t_reload = &itimer->reload;
@@ -775,7 +789,6 @@ alarm (int seconds)
775/* Child process management list. */ 789/* Child process management list. */
776int child_proc_count = 0; 790int child_proc_count = 0;
777child_process child_procs[ MAX_CHILDREN ]; 791child_process child_procs[ MAX_CHILDREN ];
778child_process *dead_child = NULL;
779 792
780static DWORD WINAPI reader_thread (void *arg); 793static DWORD WINAPI reader_thread (void *arg);
781 794
@@ -1028,9 +1041,6 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app,
1028 if (cp->pid < 0) 1041 if (cp->pid < 0)
1029 cp->pid = -cp->pid; 1042 cp->pid = -cp->pid;
1030 1043
1031 /* pid must fit in a Lisp_Int */
1032 cp->pid = cp->pid & INTMASK;
1033
1034 *pPid = cp->pid; 1044 *pPid = cp->pid;
1035 1045
1036 return TRUE; 1046 return TRUE;
@@ -1106,55 +1116,110 @@ reap_subprocess (child_process *cp)
1106 delete_child (cp); 1116 delete_child (cp);
1107} 1117}
1108 1118
1109/* Wait for any of our existing child processes to die 1119/* Wait for a child process specified by PID, or for any of our
1110 When it does, close its handle 1120 existing child processes (if PID is nonpositive) to die. When it
1111 Return the pid and fill in the status if non-NULL. */ 1121 does, close its handle. Return the pid of the process that died
1122 and fill in STATUS if non-NULL. */
1112 1123
1113int 1124pid_t
1114sys_wait (int *status) 1125waitpid (pid_t pid, int *status, int options)
1115{ 1126{
1116 DWORD active, retval; 1127 DWORD active, retval;
1117 int nh; 1128 int nh;
1118 int pid;
1119 child_process *cp, *cps[MAX_CHILDREN]; 1129 child_process *cp, *cps[MAX_CHILDREN];
1120 HANDLE wait_hnd[MAX_CHILDREN]; 1130 HANDLE wait_hnd[MAX_CHILDREN];
1131 DWORD timeout_ms;
1132 int dont_wait = (options & WNOHANG) != 0;
1121 1133
1122 nh = 0; 1134 nh = 0;
1123 if (dead_child != NULL) 1135 /* According to Posix:
1136
1137 PID = -1 means status is requested for any child process.
1138
1139 PID > 0 means status is requested for a single child process
1140 whose pid is PID.
1141
1142 PID = 0 means status is requested for any child process whose
1143 process group ID is equal to that of the calling process. But
1144 since Windows has only a limited support for process groups (only
1145 for console processes and only for the purposes of passing
1146 Ctrl-BREAK signal to them), and since we have no documented way
1147 of determining whether a given process belongs to our group, we
1148 treat 0 as -1.
1149
1150 PID < -1 means status is requested for any child process whose
1151 process group ID is equal to the absolute value of PID. Again,
1152 since we don't support process groups, we treat that as -1. */
1153 if (pid > 0)
1124 { 1154 {
1125 /* We want to wait for a specific child */ 1155 int our_child = 0;
1126 wait_hnd[nh] = dead_child->procinfo.hProcess; 1156
1127 cps[nh] = dead_child; 1157 /* We are requested to wait for a specific child. */
1128 if (!wait_hnd[nh]) emacs_abort (); 1158 for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
1129 nh++; 1159 {
1130 active = 0; 1160 /* Some child_procs might be sockets; ignore them. Also
1131 goto get_result; 1161 ignore subprocesses whose output is not yet completely
1162 read. */
1163 if (CHILD_ACTIVE (cp)
1164 && cp->procinfo.hProcess
1165 && cp->pid == pid)
1166 {
1167 our_child = 1;
1168 break;
1169 }
1170 }
1171 if (our_child)
1172 {
1173 if (cp->fd < 0 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0)
1174 {
1175 wait_hnd[nh] = cp->procinfo.hProcess;
1176 cps[nh] = cp;
1177 nh++;
1178 }
1179 else if (dont_wait)
1180 {
1181 /* PID specifies our subprocess, but its status is not
1182 yet available. */
1183 return 0;
1184 }
1185 }
1186 if (nh == 0)
1187 {
1188 /* No such child process, or nothing to wait for, so fail. */
1189 errno = ECHILD;
1190 return -1;
1191 }
1132 } 1192 }
1133 else 1193 else
1134 { 1194 {
1135 for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--) 1195 for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
1136 /* some child_procs might be sockets; ignore them */ 1196 {
1137 if (CHILD_ACTIVE (cp) && cp->procinfo.hProcess 1197 if (CHILD_ACTIVE (cp)
1138 && (cp->fd < 0 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0)) 1198 && cp->procinfo.hProcess
1139 { 1199 && (cp->fd < 0 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0))
1140 wait_hnd[nh] = cp->procinfo.hProcess; 1200 {
1141 cps[nh] = cp; 1201 wait_hnd[nh] = cp->procinfo.hProcess;
1142 nh++; 1202 cps[nh] = cp;
1143 } 1203 nh++;
1204 }
1205 }
1206 if (nh == 0)
1207 {
1208 /* Nothing to wait on, so fail. */
1209 errno = ECHILD;
1210 return -1;
1211 }
1144 } 1212 }
1145 1213
1146 if (nh == 0) 1214 if (dont_wait)
1147 { 1215 timeout_ms = 0;
1148 /* Nothing to wait on, so fail */ 1216 else
1149 errno = ECHILD; 1217 timeout_ms = 1000; /* check for quit about once a second. */
1150 return -1;
1151 }
1152 1218
1153 do 1219 do
1154 { 1220 {
1155 /* Check for quit about once a second. */
1156 QUIT; 1221 QUIT;
1157 active = WaitForMultipleObjects (nh, wait_hnd, FALSE, 1000); 1222 active = WaitForMultipleObjects (nh, wait_hnd, FALSE, timeout_ms);
1158 } while (active == WAIT_TIMEOUT); 1223 } while (active == WAIT_TIMEOUT);
1159 1224
1160 if (active == WAIT_FAILED) 1225 if (active == WAIT_FAILED)
@@ -1175,7 +1240,6 @@ sys_wait (int *status)
1175 else 1240 else
1176 emacs_abort (); 1241 emacs_abort ();
1177 1242
1178get_result:
1179 if (!GetExitCodeProcess (wait_hnd[active], &retval)) 1243 if (!GetExitCodeProcess (wait_hnd[active], &retval))
1180 { 1244 {
1181 DebPrint (("Wait.GetExitCodeProcess failed with %lu\n", 1245 DebPrint (("Wait.GetExitCodeProcess failed with %lu\n",
@@ -1184,8 +1248,10 @@ get_result:
1184 } 1248 }
1185 if (retval == STILL_ACTIVE) 1249 if (retval == STILL_ACTIVE)
1186 { 1250 {
1187 /* Should never happen */ 1251 /* Should never happen. */
1188 DebPrint (("Wait.WaitForMultipleObjects returned an active process\n")); 1252 DebPrint (("Wait.WaitForMultipleObjects returned an active process\n"));
1253 if (pid > 0 && dont_wait)
1254 return 0;
1189 errno = EINVAL; 1255 errno = EINVAL;
1190 return -1; 1256 return -1;
1191 } 1257 }
@@ -1199,6 +1265,8 @@ get_result:
1199 else 1265 else
1200 retval <<= 8; 1266 retval <<= 8;
1201 1267
1268 if (pid > 0 && active != 0)
1269 emacs_abort ();
1202 cp = cps[active]; 1270 cp = cps[active];
1203 pid = cp->pid; 1271 pid = cp->pid;
1204#ifdef FULL_DEBUG 1272#ifdef FULL_DEBUG
@@ -1987,9 +2055,7 @@ count_children:
1987 DebPrint (("select calling SIGCHLD handler for pid %d\n", 2055 DebPrint (("select calling SIGCHLD handler for pid %d\n",
1988 cp->pid)); 2056 cp->pid));
1989#endif 2057#endif
1990 dead_child = cp;
1991 sig_handlers[SIGCHLD] (SIGCHLD); 2058 sig_handlers[SIGCHLD] (SIGCHLD);
1992 dead_child = NULL;
1993 } 2059 }
1994 } 2060 }
1995 else if (fdindex[active] == -1) 2061 else if (fdindex[active] == -1)
diff --git a/src/w32select.c b/src/w32select.c
index 1b10c74cfe9..6a2a840f914 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -74,8 +74,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
74 74
75#include <config.h> 75#include <config.h>
76#include "lisp.h" 76#include "lisp.h"
77#include "w32term.h" /* for all of the w32 includes */
78#include "w32common.h" /* os_subtype */ 77#include "w32common.h" /* os_subtype */
78#include "w32term.h" /* for all of the w32 includes */
79#include "keyboard.h" 79#include "keyboard.h"
80#include "blockinput.h" 80#include "blockinput.h"
81#include "charset.h" 81#include "charset.h"
diff --git a/src/w32term.h b/src/w32term.h
index 72fb8a76e35..83535b8faa3 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -745,6 +745,21 @@ extern int w32_system_caret_height;
745extern int w32_system_caret_x; 745extern int w32_system_caret_x;
746extern int w32_system_caret_y; 746extern int w32_system_caret_y;
747 747
748#ifdef _MSC_VER
749#ifndef EnumSystemLocales
750/* MSVC headers define these only for _WIN32_WINNT >= 0x0500. */
751typedef BOOL (CALLBACK *LOCALE_ENUMPROCA)(LPSTR);
752typedef BOOL (CALLBACK *LOCALE_ENUMPROCW)(LPWSTR);
753BOOL WINAPI EnumSystemLocalesA(LOCALE_ENUMPROCA,DWORD);
754BOOL WINAPI EnumSystemLocalesW(LOCALE_ENUMPROCW,DWORD)
755#ifdef UNICODE
756#define EnumSystemLocales EnumSystemLocalesW
757#else
758#define EnumSystemLocales EnumSystemLocalesA
759#endif
760#endif
761#endif
762
748#if EMACSDEBUG 763#if EMACSDEBUG
749extern const char* 764extern const char*
750w32_name_of_message (UINT msg); 765w32_name_of_message (UINT msg);
diff --git a/src/xfaces.c b/src/xfaces.c
index daf329791c1..1e27d5cc043 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -2870,6 +2870,12 @@ FRAME 0 means change the face on all frames, and change the default
2870 Lisp_Object key, val, list; 2870 Lisp_Object key, val, list;
2871 2871
2872 list = value; 2872 list = value;
2873 /* FIXME? This errs on the side of acceptance. Eg it accepts:
2874 (defface foo '((t :underline 'foo) "doc")
2875 Maybe this is intentional, maybe it isn't.
2876 Non-nil symbols other than t are not documented as being valid.
2877 Eg compare with inverse-video, which explicitly rejects them.
2878 */
2873 valid_p = 1; 2879 valid_p = 1;
2874 2880
2875 while (!NILP (CAR_SAFE(list))) 2881 while (!NILP (CAR_SAFE(list)))
@@ -5660,6 +5666,8 @@ realize_x_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE])
5660 face->underline_defaulted_p = 1; 5666 face->underline_defaulted_p = 1;
5661 face->underline_type = FACE_UNDER_LINE; 5667 face->underline_type = FACE_UNDER_LINE;
5662 5668
5669 /* FIXME? This is also not robust about checking the precise form.
5670 See comments in Finternal_set_lisp_face_attribute. */
5663 while (CONSP (underline)) 5671 while (CONSP (underline))
5664 { 5672 {
5665 Lisp_Object keyword, value; 5673 Lisp_Object keyword, value;
diff --git a/test/automated/advice-tests.el b/test/automated/advice-tests.el
index 8f9bf54114c..80321f8f3f9 100644
--- a/test/automated/advice-tests.el
+++ b/test/automated/advice-tests.el
@@ -80,6 +80,13 @@
80 (sm-test5 6) 100.1) 80 (sm-test5 6) 100.1)
81 ((advice-remove 'sm-test5 (lambda (f y) (* (funcall f y) 5))) 81 ((advice-remove 'sm-test5 (lambda (f y) (* (funcall f y) 5)))
82 (sm-test5 6) 20.1) 82 (sm-test5 6) 20.1)
83
84 ;; This used to signal an error (bug#12858).
85 ((autoload 'sm-test6 "foo")
86 (defadvice sm-test6 (around test activate)
87 ad-do-it)
88 t t)
89
83 )) 90 ))
84 91
85(ert-deftest advice-tests () 92(ert-deftest advice-tests ()