aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa2012-09-30 23:39:46 +0900
committerKenichi Handa2012-09-30 23:39:46 +0900
commitc194970e15b6d6efa07697679a25dfab3aa76442 (patch)
tree49aec8be9d2dcc74ad3c81f562e48308d8e27b75
parent95402d5faa114a311cabfb8c64cf22a93787a066 (diff)
parentdd946752ab8810149a66a3eff469eb128709972d (diff)
downloademacs-c194970e15b6d6efa07697679a25dfab3aa76442.tar.gz
emacs-c194970e15b6d6efa07697679a25dfab3aa76442.zip
merge trunk
-rw-r--r--ChangeLog19
-rw-r--r--Makefile.in6
-rw-r--r--admin/ChangeLog14
-rw-r--r--admin/admin.el4
-rwxr-xr-xadmin/merge-gnulib2
-rw-r--r--admin/notes/bugtracker2
-rw-r--r--admin/unidata/BidiMirroring.txt21
-rw-r--r--admin/unidata/UnicodeData.txt9
-rw-r--r--autogen/Makefile.in13
-rw-r--r--autogen/aclocal.m41
-rw-r--r--autogen/config.in9
-rwxr-xr-xautogen/configure160
-rw-r--r--configure.ac3
-rw-r--r--doc/emacs/ChangeLog39
-rw-r--r--doc/emacs/ack.texi29
-rw-r--r--doc/emacs/basic.texi24
-rw-r--r--doc/emacs/buffers.texi6
-rw-r--r--doc/emacs/building.texi10
-rw-r--r--doc/emacs/cal-xtra.texi8
-rw-r--r--doc/emacs/display.texi14
-rw-r--r--doc/emacs/emacs.texi3
-rw-r--r--doc/emacs/entering.texi5
-rw-r--r--doc/emacs/files.texi2
-rw-r--r--doc/emacs/help.texi2
-rw-r--r--doc/emacs/killing.texi9
-rw-r--r--doc/emacs/mini.texi51
-rw-r--r--doc/emacs/misc.texi76
-rw-r--r--doc/emacs/search.texi38
-rw-r--r--doc/lispref/ChangeLog56
-rw-r--r--doc/lispref/backups.texi14
-rw-r--r--doc/lispref/buffers.texi40
-rw-r--r--doc/lispref/commands.texi142
-rw-r--r--doc/lispref/elisp.texi1
-rw-r--r--doc/lispref/errors.texi160
-rw-r--r--doc/lispref/files.texi2
-rw-r--r--doc/lispref/frames.texi24
-rw-r--r--doc/lispref/functions.texi109
-rw-r--r--doc/lispref/help.texi16
-rw-r--r--doc/lispref/keymaps.texi8
-rw-r--r--doc/lispref/loading.texi8
-rw-r--r--doc/lispref/macros.texi39
-rw-r--r--doc/lispref/numbers.texi176
-rw-r--r--doc/lispref/os.texi110
-rw-r--r--doc/lispref/strings.texi45
-rw-r--r--etc/ChangeLog4
-rw-r--r--etc/NEWS137
-rw-r--r--lib-src/ChangeLog6
-rw-r--r--lib-src/makefile.w32-in2
-rw-r--r--lib/gnulib.mk2
-rw-r--r--lisp/ChangeLog495
-rw-r--r--lisp/ChangeLog.82
-rw-r--r--lisp/ChangeLog.94
-rw-r--r--lisp/allout.el13
-rw-r--r--lisp/ansi-color.el4
-rw-r--r--lisp/arc-mode.el83
-rw-r--r--lisp/bindings.el3
-rw-r--r--lisp/bookmark.el3
-rw-r--r--lisp/bs.el2
-rw-r--r--lisp/buff-menu.el6
-rw-r--r--lisp/calendar/cal-tex.el2
-rw-r--r--lisp/calendar/cal-x.el12
-rw-r--r--lisp/calendar/calendar.el21
-rw-r--r--lisp/calendar/diary-lib.el8
-rw-r--r--lisp/calendar/icalendar.el8
-rw-r--r--lisp/comint.el8
-rw-r--r--lisp/cus-edit.el9
-rw-r--r--lisp/cus-start.el1
-rw-r--r--lisp/custom.el3
-rw-r--r--lisp/desktop.el3
-rw-r--r--lisp/dired-x.el17
-rw-r--r--lisp/dired.el7
-rw-r--r--lisp/doc-view.el129
-rw-r--r--lisp/emacs-lisp/byte-run.el4
-rw-r--r--lisp/emacs-lisp/bytecomp.el2
-rw-r--r--lisp/emacs-lisp/cl-extra.el1
-rw-r--r--lisp/emacs-lisp/cl-lib.el1
-rw-r--r--lisp/emacs-lisp/cl-loaddefs.el6
-rw-r--r--lisp/emacs-lisp/cl-macs.el1
-rw-r--r--lisp/emacs-lisp/cl-seq.el1
-rw-r--r--lisp/emacs-lisp/cl.el2
-rw-r--r--lisp/emacs-lisp/derived.el2
-rw-r--r--lisp/emacs-lisp/ert-x.el22
-rw-r--r--lisp/emacs-lisp/ert.el22
-rw-r--r--lisp/emacs-lisp/gv.el13
-rw-r--r--lisp/emacs-lisp/package-x.el10
-rw-r--r--lisp/emacs-lisp/package.el10
-rw-r--r--lisp/emacs-lisp/pcase.el14
-rw-r--r--lisp/emacs-lisp/tabulated-list.el6
-rw-r--r--lisp/emacs-lisp/testcover.el24
-rw-r--r--lisp/emacs-lisp/timer.el5
-rw-r--r--lisp/emacs-lock.el2
-rw-r--r--lisp/epa.el2
-rw-r--r--lisp/epg.el8
-rw-r--r--lisp/erc/ChangeLog4
-rw-r--r--lisp/erc/erc.el4
-rw-r--r--lisp/eshell/em-term.el5
-rw-r--r--lisp/eshell/esh-cmd.el7
-rw-r--r--lisp/eshell/esh-util.el4
-rw-r--r--lisp/eshell/eshell.el6
-rw-r--r--lisp/faces.el1
-rw-r--r--lisp/files.el2
-rw-r--r--lisp/font-lock.el4
-rw-r--r--lisp/generic-x.el6
-rw-r--r--lisp/gnus/ChangeLog5
-rw-r--r--lisp/gnus/ChangeLog.22
-rw-r--r--lisp/gnus/gnus-art.el11
-rw-r--r--lisp/help-fns.el15
-rw-r--r--lisp/help-macro.el1
-rw-r--r--lisp/help.el70
-rw-r--r--lisp/hippie-exp.el10
-rw-r--r--lisp/htmlfontify.el2
-rw-r--r--lisp/ibuf-ext.el14
-rw-r--r--lisp/ibuffer.el4
-rw-r--r--lisp/ido.el10
-rw-r--r--lisp/image-mode.el18
-rw-r--r--lisp/image.el2
-rw-r--r--lisp/imenu.el9
-rw-r--r--lisp/international/latin1-disp.el4
-rw-r--r--lisp/international/mule-cmds.el2
-rw-r--r--lisp/international/mule-diag.el2
-rw-r--r--lisp/international/mule-util.el36
-rw-r--r--lisp/international/mule.el16
-rw-r--r--lisp/international/uni-bidi.el2
-rw-r--r--lisp/international/uni-category.el2
-rw-r--r--lisp/international/uni-name.elbin162303 -> 162318 bytes
-rw-r--r--lisp/international/uni-numeric.elbin4592 -> 4609 bytes
-rw-r--r--lisp/iswitchb.el54
-rw-r--r--lisp/json.el8
-rw-r--r--lisp/linum.el5
-rw-r--r--lisp/mail/emacsbug.el7
-rw-r--r--lisp/mail/mailalias.el2
-rw-r--r--lisp/mail/sendmail.el4
-rw-r--r--lisp/mail/supercite.el22
-rw-r--r--lisp/mh-e/ChangeLog.12
-rw-r--r--lisp/minibuf-eldef.el55
-rw-r--r--lisp/minibuffer.el2
-rw-r--r--lisp/mouse.el6
-rw-r--r--lisp/net/newst-backend.el2
-rw-r--r--lisp/net/newst-treeview.el2
-rw-r--r--lisp/net/snmp-mode.el4
-rw-r--r--lisp/org/ob-fortran.el18
-rw-r--r--lisp/password-cache.el3
-rw-r--r--lisp/pcomplete.el5
-rw-r--r--lisp/proced.el296
-rw-r--r--lisp/profiler.el665
-rw-r--r--lisp/progmodes/ada-mode.el4
-rw-r--r--lisp/progmodes/compile.el24
-rw-r--r--lisp/progmodes/cwarn.el8
-rw-r--r--lisp/progmodes/idlwave.el10
-rw-r--r--lisp/progmodes/inf-lisp.el13
-rw-r--r--lisp/progmodes/prolog.el2
-rw-r--r--lisp/progmodes/ps-mode.el4
-rw-r--r--lisp/progmodes/python.el156
-rw-r--r--lisp/progmodes/ruby-mode.el4
-rw-r--r--lisp/progmodes/sh-script.el3
-rw-r--r--lisp/progmodes/tcl.el4
-rw-r--r--lisp/progmodes/vera-mode.el6
-rw-r--r--lisp/progmodes/verilog-mode.el704
-rw-r--r--lisp/progmodes/vhdl-mode.el1
-rw-r--r--lisp/progmodes/which-func.el4
-rw-r--r--lisp/replace.el46
-rw-r--r--lisp/savehist.el2
-rw-r--r--lisp/server.el25
-rw-r--r--lisp/simple.el5
-rw-r--r--lisp/startup.el5
-rw-r--r--lisp/subr.el29
-rw-r--r--lisp/term.el8
-rw-r--r--lisp/textmodes/bibtex.el32
-rw-r--r--lisp/textmodes/reftex-cite.el5
-rw-r--r--lisp/textmodes/reftex-index.el4
-rw-r--r--lisp/textmodes/reftex-sel.el8
-rw-r--r--lisp/textmodes/reftex.el4
-rw-r--r--lisp/textmodes/rst.el7
-rw-r--r--lisp/textmodes/sgml-mode.el5
-rw-r--r--lisp/textmodes/tex-mode.el4
-rw-r--r--lisp/textmodes/text-mode.el23
-rw-r--r--lisp/tutorial.el15
-rw-r--r--lisp/type-break.el147
-rw-r--r--lisp/url/ChangeLog19
-rw-r--r--lisp/url/url-handlers.el31
-rw-r--r--lisp/url/url-parse.el2
-rw-r--r--lisp/url/url-util.el8
-rw-r--r--lisp/vc/ediff-init.el4
-rw-r--r--lisp/vc/ediff-util.el4
-rw-r--r--lisp/vc/ediff-wind.el4
-rw-r--r--lisp/vc/emerge.el12
-rw-r--r--lisp/vc/log-edit.el28
-rw-r--r--lisp/vc/pcvs-defs.el14
-rw-r--r--lisp/vc/pcvs-info.el4
-rw-r--r--lisp/vc/pcvs.el25
-rw-r--r--lisp/vc/vc-bzr.el14
-rw-r--r--lisp/vc/vc-hooks.el23
-rw-r--r--lisp/vc/vc-rcs.el3
-rw-r--r--lisp/vc/vc-sccs.el12
-rw-r--r--lisp/vc/vc.el54
-rw-r--r--lisp/view.el2
-rw-r--r--lisp/window.el396
-rw-r--r--lisp/winner.el82
-rw-r--r--m4/extern-inline.m46
-rw-r--r--m4/gnulib-comp.m43
-rw-r--r--m4/timer_time.m439
-rw-r--r--msdos/ChangeLog5
-rw-r--r--msdos/sed1v2.inp1
-rw-r--r--msdos/sed3v2.inp1
-rw-r--r--nt/ChangeLog18
-rw-r--r--nt/config.nt9
-rw-r--r--nt/inc/ms-w32.h3
-rw-r--r--src/.gdbinit4
-rw-r--r--src/ChangeLog575
-rw-r--r--src/ChangeLog.112
-rw-r--r--src/ChangeLog.22
-rw-r--r--src/ChangeLog.32
-rw-r--r--src/Makefile.in6
-rw-r--r--src/alloc.c77
-rw-r--r--src/atimer.c86
-rw-r--r--src/blockinput.h118
-rw-r--r--src/buffer.c24
-rw-r--r--src/bytecode.c2
-rw-r--r--src/callproc.c12
-rw-r--r--src/character.c4
-rw-r--r--src/character.h17
-rw-r--r--src/charset.c10
-rw-r--r--src/charset.h1
-rw-r--r--src/chartab.c10
-rw-r--r--src/coding.c63
-rw-r--r--src/data.c37
-rw-r--r--src/dired.c20
-rw-r--r--src/dispextern.h14
-rw-r--r--src/dispnew.c26
-rw-r--r--src/dosfns.c4
-rw-r--r--src/editfns.c48
-rw-r--r--src/emacs.c190
-rw-r--r--src/eval.c107
-rw-r--r--src/fileio.c24
-rw-r--r--src/floatfns.c9
-rw-r--r--src/fns.c12
-rw-r--r--src/fontset.c4
-rw-r--r--src/frame.c4
-rw-r--r--src/frame.h7
-rw-r--r--src/fringe.c2
-rw-r--r--src/ftxfont.c16
-rw-r--r--src/gnutls.c29
-rw-r--r--src/gtkutil.c245
-rw-r--r--src/gtkutil.h38
-rw-r--r--src/image.c553
-rw-r--r--src/indent.c65
-rw-r--r--src/indent.h6
-rw-r--r--src/keyboard.c274
-rw-r--r--src/keyboard.h2
-rw-r--r--src/keymap.c4
-rw-r--r--src/lisp.h47
-rw-r--r--src/lread.c45
-rw-r--r--src/makefile.w32-in115
-rw-r--r--src/menu.c12
-rw-r--r--src/msdos.c8
-rw-r--r--src/nsfns.m44
-rw-r--r--src/nsfont.m12
-rw-r--r--src/nsimage.m2
-rw-r--r--src/nsmenu.m40
-rw-r--r--src/nsterm.h28
-rw-r--r--src/nsterm.m437
-rw-r--r--src/print.c4
-rw-r--r--src/process.c574
-rw-r--r--src/profiler.c518
-rw-r--r--src/ralloc.c4
-rw-r--r--src/search.c2
-rw-r--r--src/sysdep.c415
-rw-r--r--src/syssignal.h14
-rw-r--r--src/syswait.h7
-rw-r--r--src/term.c12
-rw-r--r--src/termhooks.h3
-rw-r--r--src/w16select.c8
-rw-r--r--src/w32.c43
-rw-r--r--src/w32.h8
-rw-r--r--src/w32fns.c110
-rw-r--r--src/w32inevt.c15
-rw-r--r--src/w32menu.c16
-rw-r--r--src/w32proc.c47
-rw-r--r--src/w32reg.c4
-rw-r--r--src/w32select.c17
-rw-r--r--src/w32term.c130
-rw-r--r--src/widget.c4
-rw-r--r--src/window.c54
-rw-r--r--src/xdisp.c77
-rw-r--r--src/xfaces.c64
-rw-r--r--src/xfns.c197
-rw-r--r--src/xfont.c40
-rw-r--r--src/xftfont.c34
-rw-r--r--src/xmenu.c65
-rw-r--r--src/xml.c8
-rw-r--r--src/xselect.c100
-rw-r--r--src/xsettings.c4
-rw-r--r--src/xterm.c342
-rw-r--r--src/xterm.h10
294 files changed, 8071 insertions, 4694 deletions
diff --git a/ChangeLog b/ChangeLog
index 2b1b2f2915c..411ef633420 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
12012-09-30 Paul Eggert <eggert@cs.ucla.edu>
2
3 Merge from gnulib, incorporating:
4 2012-09-28 extern-inline: provide a -Wundef safe config.h
5
62012-09-27 Paul Eggert <eggert@cs.ucla.edu>
7
8 Check more robustly for timer_settime.
9 This should fix an OS X build problem reported by Ivan Andrus in
10 <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00671.html>.
11 * configure.ac (gl_THREADLIB): Define to empty, since Emacs
12 does threads its own way.
13 * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
14
152012-09-23 Paul Eggert <eggert@cs.ucla.edu>
16
17 * Makefile.in (bootstrap): Set MAKEFILE_NAME when building Makefile,
18 to avoid problems with recursion when using GNU make.
19
12012-09-22 Paul Eggert <eggert@cs.ucla.edu> 202012-09-22 Paul Eggert <eggert@cs.ucla.edu>
2 21
3 * Makefile.in (bootstrap): Simplify build procedure. 22 * Makefile.in (bootstrap): Simplify build procedure.
diff --git a/Makefile.in b/Makefile.in
index 542c30bbab7..571013e3244 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -355,6 +355,10 @@ blessmail: Makefile src FRC
355# config.status overrides MAKEFILE_NAME with a bogus name when creating 355# config.status overrides MAKEFILE_NAME with a bogus name when creating
356# src/epaths.h, so that 'make epaths-force' does not recursively invoke 356# src/epaths.h, so that 'make epaths-force' does not recursively invoke
357# config.status and overwrite config.status while executing it (Bug#11214). 357# config.status and overwrite config.status while executing it (Bug#11214).
358#
359# 'make bootstrap' overrides MAKEFILE_NAME to a nonexistent file but
360# then attempts to build that file. This forces 'Makefile', 'lib/Makefile',
361# etc. to be built without running into similar recursion problems.
358MAKEFILE_NAME = Makefile 362MAKEFILE_NAME = Makefile
359$(MAKEFILE_NAME): config.status $(srcdir)/src/config.in \ 363$(MAKEFILE_NAME): config.status $(srcdir)/src/config.in \
360 $(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN) 364 $(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN)
@@ -895,7 +899,7 @@ dvi:
895# * Do the actual build. 899# * Do the actual build.
896bootstrap: bootstrap-clean FRC 900bootstrap: bootstrap-clean FRC
897 cd $(srcdir) && { ./autogen.sh || autogen/copy_autogen; } 901 cd $(srcdir) && { ./autogen.sh || autogen/copy_autogen; }
898 $(MAKE) $(MFLAGS) Makefile 902 $(MAKE) $(MFLAGS) MAKEFILE_NAME=force-Makefile force-Makefile
899 $(MAKE) $(MFLAGS) info all 903 $(MAKE) $(MFLAGS) info all
900 904
901.PHONY: check-declare 905.PHONY: check-declare
diff --git a/admin/ChangeLog b/admin/ChangeLog
index 7f30fe8fc0f..b5b1b75c55c 100644
--- a/admin/ChangeLog
+++ b/admin/ChangeLog
@@ -1,3 +1,17 @@
12012-09-27 Glenn Morris <rgm@gnu.org>
2
3 * admin.el (set-version): Set msdos.c's Vwindow_system_version.
4
52012-09-27 Paul Eggert <eggert@cs.ucla.edu>
6
7 Check more robustly for timer_settime.
8 * merge-gnulib (GNULIB_MODULES): Add timer-time.
9
102012-09-26 Juanma Barranquero <lekktu@gmail.com>
11
12 * unidata/BidiMirroring.txt:
13 * unidata/UnicodeData.txt: Update to Unicode 6.2.
14
12012-09-17 Glenn Morris <rgm@gnu.org> 152012-09-17 Glenn Morris <rgm@gnu.org>
2 16
3 * admin.el (add-log-time-format): Declare. 17 * admin.el (add-log-time-format): Declare.
diff --git a/admin/admin.el b/admin/admin.el
index 862e5aed6c1..c71e6539413 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -129,8 +129,12 @@ Root must be the root of an Emacs source tree."
129 (rx (and "\"ProductVersion\"" (0+ space) ?, 129 (rx (and "\"ProductVersion\"" (0+ space) ?,
130 (0+ space) ?\" (submatch (1+ (in "0-9, "))) 130 (0+ space) ?\" (submatch (1+ (in "0-9, ")))
131 "\\0\""))) 131 "\\0\"")))
132 ;; Major version only.
132 (when (string-match "\\([0-9]\\{2,\\}\\)" version) 133 (when (string-match "\\([0-9]\\{2,\\}\\)" version)
133 (setq version (match-string 1 version)) 134 (setq version (match-string 1 version))
135 (set-version-in-file root "src/msdos.c" version
136 (rx (and "Vwindow_system_version" (1+ not-newline)
137 ?\( (submatch (1+ (in "0-9"))) ?\))))
134 (set-version-in-file root "etc/refcards/ru-refcard.tex" version 138 (set-version-in-file root "etc/refcards/ru-refcard.tex" version
135 "\\\\newcommand{\\\\versionemacs}\\[0\\]\ 139 "\\\\newcommand{\\\\versionemacs}\\[0\\]\
136{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs") 140{\\([0-9]\\{2,\\}\\)}.+%.+version of Emacs")
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index 775d43e68d3..7fc0b5f4844 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -34,7 +34,7 @@ GNULIB_MODULES='
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
36 strftime strtoimax strtoumax symlink sys_stat 36 strftime strtoimax strtoumax symlink sys_stat
37 sys_time time timespec-add timespec-sub utimens 37 sys_time time timer-time timespec-add timespec-sub utimens
38 warnings 38 warnings
39' 39'
40 40
diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker
index eed67f10dfd..1d1c196f073 100644
--- a/admin/notes/bugtracker
+++ b/admin/notes/bugtracker
@@ -610,7 +610,7 @@ An /etc/aliases entry redirects it to the real emacs-bug-tracker address.
610All discarded messages are stored in /var/lib/mailman/spam. 610All discarded messages are stored in /var/lib/mailman/spam.
611If a non-spam message accidentally gets discarded, just do: 611If a non-spam message accidentally gets discarded, just do:
612 612
613cat /var/lib/mailman/spam/not-really-spam.msg | /usr/lib/debbugs/receive 613/usr/lib/debbugs/receive < /var/lib/mailman/spam/not-really-spam.msg
614chown Debian-debbugs:Debian-debbugs /var/lib/debbugs/spool/incoming/* 614chown Debian-debbugs:Debian-debbugs /var/lib/debbugs/spool/incoming/*
615... check it works ... 615... check it works ...
616mv /var/lib/mailman/spam/not-really-spam.msg /var/lib/mailman/not-spam/ 616mv /var/lib/mailman/spam/not-really-spam.msg /var/lib/mailman/not-spam/
diff --git a/admin/unidata/BidiMirroring.txt b/admin/unidata/BidiMirroring.txt
index 2e719bc1e05..ec41b769375 100644
--- a/admin/unidata/BidiMirroring.txt
+++ b/admin/unidata/BidiMirroring.txt
@@ -1,19 +1,19 @@
1# BidiMirroring-6.1.0.txt 1# BidiMirroring-6.2.0.txt
2# Date: 2011-12-20, 19:31:00 GMT [KW, LI] 2# Date: 2012-05-15, 24:19:00 GMT [KW, LI]
3# 3#
4# Bidi_Mirroring_Glyph Property 4# Bidi_Mirroring_Glyph Property
5# 5#
6# This file is an informative contributory data file in the 6# This file is an informative contributory data file in the
7# Unicode Character Database. 7# Unicode Character Database.
8# 8#
9# Copyright (c) 1991-2011 Unicode, Inc. 9# Copyright (c) 1991-2012 Unicode, Inc.
10# For terms of use, see http://www.unicode.org/terms_of_use.html 10# For terms of use, see http://www.unicode.org/terms_of_use.html
11# 11#
12# This data file lists characters that have the Bidi_Mirrored=Yes property 12# This data file lists characters that have the Bidi_Mirrored=Yes property
13# value, for which there is another Unicode character that typically has a glyph 13# value, for which there is another Unicode character that typically has a glyph
14# that is the mirror image of the original character's glyph. 14# that is the mirror image of the original character's glyph.
15# 15#
16# The repertoire covered by the file is Unicode 6.1.0. 16# The repertoire covered by the file is Unicode 6.2.0.
17# 17#
18# The file contains a list of lines with mappings from one code point 18# The file contains a list of lines with mappings from one code point
19# to another one for character-based mirroring. 19# to another one for character-based mirroring.
@@ -30,16 +30,8 @@
30# characters exist with mirrored glyphs, are 30# characters exist with mirrored glyphs, are
31# listed as comments at the end of the file. 31# listed as comments at the end of the file.
32# 32#
33# Note: (2011-12-19) There is an inconsistency between the
34# following statement about the default value
35# of the Bidi_Mirroring_Glyph property and the
36# value of the @missing line for Bidi_Mirroring_Glyph in
37# PropertyValueAliases.txt. This inconsistency was discovered too
38# late in the release process to be resolved by
39# the UTC. The inconsistency will be resolved in a future revision.
40#
41# Formally, the default value of the Bidi_Mirroring_Glyph property 33# Formally, the default value of the Bidi_Mirroring_Glyph property
42# for each code point is the code point itself, unless a mapping to 34# for each code point is <none>, unless a mapping to
43# some other character is specified in this data file. When a code 35# some other character is specified in this data file. When a code
44# point has the default value for the Bidi_Mirroring_Glyph property, 36# point has the default value for the Bidi_Mirroring_Glyph property,
45# that means that no other character exists whose glyph is suitable 37# that means that no other character exists whose glyph is suitable
@@ -50,12 +42,13 @@
50# 42#
51# This file was originally created by Markus Scherer. 43# This file was originally created by Markus Scherer.
52# Extended for Unicode 3.2, 4.0, 4.1, 5.0, 5.1, 5.2, and 6.0 by Ken Whistler, 44# Extended for Unicode 3.2, 4.0, 4.1, 5.0, 5.1, 5.2, and 6.0 by Ken Whistler,
53# and for Unicode 6.1 by Ken Whistler and Laurentiu Iancu. 45# and for Unicode 6.1 and 6.2 by Ken Whistler and Laurentiu Iancu.
54# 46#
55# ############################################################ 47# ############################################################
56# 48#
57# Property: Bidi_Mirroring_Glyph 49# Property: Bidi_Mirroring_Glyph
58# 50#
51# @missing: 0000..10FFFF; <none>
59 52
600028; 0029 # LEFT PARENTHESIS 530028; 0029 # LEFT PARENTHESIS
610029; 0028 # RIGHT PARENTHESIS 540029; 0028 # RIGHT PARENTHESIS
diff --git a/admin/unidata/UnicodeData.txt b/admin/unidata/UnicodeData.txt
index 9f204050c6b..086379eb4f3 100644
--- a/admin/unidata/UnicodeData.txt
+++ b/admin/unidata/UnicodeData.txt
@@ -7190,6 +7190,7 @@
719020B7;SPESMILO SIGN;Sc;0;ET;;;;;N;;;;; 719020B7;SPESMILO SIGN;Sc;0;ET;;;;;N;;;;;
719120B8;TENGE SIGN;Sc;0;ET;;;;;N;;;;; 719120B8;TENGE SIGN;Sc;0;ET;;;;;N;;;;;
719220B9;INDIAN RUPEE SIGN;Sc;0;ET;;;;;N;;;;; 719220B9;INDIAN RUPEE SIGN;Sc;0;ET;;;;;N;;;;;
719320BA;TURKISH LIRA SIGN;Sc;0;ET;;;;;N;;;;;
719320D0;COMBINING LEFT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT HARPOON ABOVE;;;; 719420D0;COMBINING LEFT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING LEFT HARPOON ABOVE;;;;
719420D1;COMBINING RIGHT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RIGHT HARPOON ABOVE;;;; 719520D1;COMBINING RIGHT HARPOON ABOVE;Mn;230;NSM;;;;;N;NON-SPACING RIGHT HARPOON ABOVE;;;;
719520D2;COMBINING LONG VERTICAL LINE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG VERTICAL BAR OVERLAY;;;; 719620D2;COMBINING LONG VERTICAL LINE OVERLAY;Mn;1;NSM;;;;;N;NON-SPACING LONG VERTICAL BAR OVERLAY;;;;
@@ -18703,8 +18704,8 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
187031242F;CUNEIFORM NUMERIC SIGN THREE SHARU VARIANT FORM;Nl;0;L;;;;3;N;;;;; 187041242F;CUNEIFORM NUMERIC SIGN THREE SHARU VARIANT FORM;Nl;0;L;;;;3;N;;;;;
1870412430;CUNEIFORM NUMERIC SIGN FOUR SHARU;Nl;0;L;;;;4;N;;;;; 1870512430;CUNEIFORM NUMERIC SIGN FOUR SHARU;Nl;0;L;;;;4;N;;;;;
1870512431;CUNEIFORM NUMERIC SIGN FIVE SHARU;Nl;0;L;;;;5;N;;;;; 1870612431;CUNEIFORM NUMERIC SIGN FIVE SHARU;Nl;0;L;;;;5;N;;;;;
1870612432;CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS DISH;Nl;0;L;;;;;N;;;;; 1870712432;CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS DISH;Nl;0;L;;;;216000;N;;;;;
1870712433;CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS MIN;Nl;0;L;;;;;N;;;;; 1870812433;CUNEIFORM NUMERIC SIGN SHAR2 TIMES GAL PLUS MIN;Nl;0;L;;;;432000;N;;;;;
1870812434;CUNEIFORM NUMERIC SIGN ONE BURU;Nl;0;L;;;;1;N;;;;; 1870912434;CUNEIFORM NUMERIC SIGN ONE BURU;Nl;0;L;;;;1;N;;;;;
1870912435;CUNEIFORM NUMERIC SIGN TWO BURU;Nl;0;L;;;;2;N;;;;; 1871012435;CUNEIFORM NUMERIC SIGN TWO BURU;Nl;0;L;;;;2;N;;;;;
1871012436;CUNEIFORM NUMERIC SIGN THREE BURU;Nl;0;L;;;;3;N;;;;; 1871112436;CUNEIFORM NUMERIC SIGN THREE BURU;Nl;0;L;;;;3;N;;;;;
@@ -18739,8 +18740,8 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
1873912453;CUNEIFORM NUMERIC SIGN FOUR BAN2 VARIANT FORM;Nl;0;L;;;;4;N;;;;; 1874012453;CUNEIFORM NUMERIC SIGN FOUR BAN2 VARIANT FORM;Nl;0;L;;;;4;N;;;;;
1874012454;CUNEIFORM NUMERIC SIGN FIVE BAN2;Nl;0;L;;;;5;N;;;;; 1874112454;CUNEIFORM NUMERIC SIGN FIVE BAN2;Nl;0;L;;;;5;N;;;;;
1874112455;CUNEIFORM NUMERIC SIGN FIVE BAN2 VARIANT FORM;Nl;0;L;;;;5;N;;;;; 1874212455;CUNEIFORM NUMERIC SIGN FIVE BAN2 VARIANT FORM;Nl;0;L;;;;5;N;;;;;
1874212456;CUNEIFORM NUMERIC SIGN NIGIDAMIN;Nl;0;L;;;;;N;;;;; 1874312456;CUNEIFORM NUMERIC SIGN NIGIDAMIN;Nl;0;L;;;;-1;N;;;;;
1874312457;CUNEIFORM NUMERIC SIGN NIGIDAESH;Nl;0;L;;;;;N;;;;; 1874412457;CUNEIFORM NUMERIC SIGN NIGIDAESH;Nl;0;L;;;;-1;N;;;;;
1874412458;CUNEIFORM NUMERIC SIGN ONE ESHE3;Nl;0;L;;;;1;N;;;;; 1874512458;CUNEIFORM NUMERIC SIGN ONE ESHE3;Nl;0;L;;;;1;N;;;;;
1874512459;CUNEIFORM NUMERIC SIGN TWO ESHE3;Nl;0;L;;;;2;N;;;;; 1874612459;CUNEIFORM NUMERIC SIGN TWO ESHE3;Nl;0;L;;;;2;N;;;;;
187461245A;CUNEIFORM NUMERIC SIGN ONE THIRD DISH;Nl;0;L;;;;1/3;N;;;;; 187471245A;CUNEIFORM NUMERIC SIGN ONE THIRD DISH;Nl;0;L;;;;1/3;N;;;;;
diff --git a/autogen/Makefile.in b/autogen/Makefile.in
index 103a2e94ef3..e3264ff0c3f 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=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --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 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo 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 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=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --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 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo 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@
@@ -95,11 +95,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
95 $(top_srcdir)/m4/sys_socket_h.m4 \ 95 $(top_srcdir)/m4/sys_socket_h.m4 \
96 $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \ 96 $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
97 $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ 97 $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
98 $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \ 98 $(top_srcdir)/m4/timer_time.m4 $(top_srcdir)/m4/timespec.m4 \
99 $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/utimbuf.m4 \ 99 $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \
100 $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \ 100 $(top_srcdir)/m4/utimbuf.m4 $(top_srcdir)/m4/utimens.m4 \
101 $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_t.m4 \ 101 $(top_srcdir)/m4/utimes.m4 $(top_srcdir)/m4/warnings.m4 \
102 $(top_srcdir)/configure.ac 102 $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.ac
103am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 103am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
104 $(ACLOCAL_M4) 104 $(ACLOCAL_M4)
105mkinstalldirs = $(install_sh) -d 105mkinstalldirs = $(install_sh) -d
@@ -566,6 +566,7 @@ LIB_MATH = @LIB_MATH@
566LIB_PTHREAD = @LIB_PTHREAD@ 566LIB_PTHREAD = @LIB_PTHREAD@
567LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ 567LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@
568LIB_STANDARD = @LIB_STANDARD@ 568LIB_STANDARD = @LIB_STANDARD@
569LIB_TIMER_TIME = @LIB_TIMER_TIME@
569LN_S = @LN_S@ 570LN_S = @LN_S@
570LTLIBINTL = @LTLIBINTL@ 571LTLIBINTL = @LTLIBINTL@
571LTLIBOBJS = @LTLIBOBJS@ 572LTLIBOBJS = @LTLIBOBJS@
diff --git a/autogen/aclocal.m4 b/autogen/aclocal.m4
index 38f7863ba9d..0bc91e263c2 100644
--- a/autogen/aclocal.m4
+++ b/autogen/aclocal.m4
@@ -1043,6 +1043,7 @@ m4_include([m4/sys_stat_h.m4])
1043m4_include([m4/sys_time_h.m4]) 1043m4_include([m4/sys_time_h.m4])
1044m4_include([m4/time_h.m4]) 1044m4_include([m4/time_h.m4])
1045m4_include([m4/time_r.m4]) 1045m4_include([m4/time_r.m4])
1046m4_include([m4/timer_time.m4])
1046m4_include([m4/timespec.m4]) 1047m4_include([m4/timespec.m4])
1047m4_include([m4/tm_gmtoff.m4]) 1048m4_include([m4/tm_gmtoff.m4])
1048m4_include([m4/unistd_h.m4]) 1049m4_include([m4/unistd_h.m4])
diff --git a/autogen/config.in b/autogen/config.in
index 2f2555c75c9..8a8799db1cf 100644
--- a/autogen/config.in
+++ b/autogen/config.in
@@ -958,6 +958,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
958/* Define to 1 if you have the tiff library (-ltiff). */ 958/* Define to 1 if you have the tiff library (-ltiff). */
959#undef HAVE_TIFF 959#undef HAVE_TIFF
960 960
961/* Define to 1 if you have the `timer_settime' function. */
962#undef HAVE_TIMER_SETTIME
963
961/* Define if struct tm has the tm_gmtoff member. */ 964/* Define if struct tm has the tm_gmtoff member. */
962#undef HAVE_TM_GMTOFF 965#undef HAVE_TM_GMTOFF
963 966
@@ -1519,7 +1522,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1519 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. 1522 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
1520 _GL_INLINE_HEADER_END contains useful stuff to put 1523 _GL_INLINE_HEADER_END contains useful stuff to put
1521 in the same include file, after uses of _GL_INLINE. */ 1524 in the same include file, after uses of _GL_INLINE. */
1522#if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__ 1525#if (__GNUC__ \
1526 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
1527 : 199901L <= __STDC_VERSION__)
1523# define _GL_INLINE inline 1528# define _GL_INLINE inline
1524# define _GL_EXTERN_INLINE extern inline 1529# define _GL_EXTERN_INLINE extern inline
1525#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) 1530#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
@@ -1536,7 +1541,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1536#endif 1541#endif
1537 1542
1538#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) 1543#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
1539# if __GNUC_STDC_INLINE__ 1544# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
1540# define _GL_INLINE_HEADER_CONST_PRAGMA 1545# define _GL_INLINE_HEADER_CONST_PRAGMA
1541# else 1546# else
1542# define _GL_INLINE_HEADER_CONST_PRAGMA \ 1547# define _GL_INLINE_HEADER_CONST_PRAGMA \
diff --git a/autogen/configure b/autogen/configure
index e771c7fd0f7..11e046c551b 100755
--- a/autogen/configure
+++ b/autogen/configure
@@ -631,6 +631,7 @@ WINDOWS_64_BIT_OFF_T
631HAVE_UNISTD_H 631HAVE_UNISTD_H
632NEXT_AS_FIRST_DIRECTIVE_UNISTD_H 632NEXT_AS_FIRST_DIRECTIVE_UNISTD_H
633NEXT_UNISTD_H 633NEXT_UNISTD_H
634LIB_TIMER_TIME
634PTHREAD_H_DEFINES_STRUCT_TIMESPEC 635PTHREAD_H_DEFINES_STRUCT_TIMESPEC
635SYS_TIME_H_DEFINES_STRUCT_TIMESPEC 636SYS_TIME_H_DEFINES_STRUCT_TIMESPEC
636TIME_H_DEFINES_STRUCT_TIMESPEC 637TIME_H_DEFINES_STRUCT_TIMESPEC
@@ -5723,6 +5724,9 @@ else
5723 test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS" 5724 test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
5724fi 5725fi
5725 5726
5727# Avoid gnulib's threadlib module, as we do threads our own way.
5728
5729
5726# Initialize gnulib right after choosing the compiler. 5730# Initialize gnulib right after choosing the compiler.
5727 5731
5728ac_ext=c 5732ac_ext=c
@@ -7006,6 +7010,7 @@ esac
7006 # Code from module sys_time: 7010 # Code from module sys_time:
7007 # Code from module time: 7011 # Code from module time:
7008 # Code from module time_r: 7012 # Code from module time_r:
7013 # Code from module timer-time:
7009 # Code from module timespec: 7014 # Code from module timespec:
7010 # Code from module timespec-add: 7015 # Code from module timespec-add:
7011 # Code from module timespec-sub: 7016 # Code from module timespec-sub:
@@ -19229,6 +19234,7 @@ done
19229 19234
19230 19235
19231 19236
19237
19232 ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" " 19238 ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" "
19233 #include <signal.h> 19239 #include <signal.h>
19234 /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */ 19240 /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>. */
@@ -21655,11 +21661,61 @@ $as_echo "$gl_cv_sig_pselect" >&6; }
21655 LIB_PTHREAD_SIGMASK= 21661 LIB_PTHREAD_SIGMASK=
21656 21662
21657 21663
21658 if test $ac_cv_func_pthread_sigmask = yes; then 21664
21659 : 21665
21666 if test "$gl_threads_api" = posix; then
21667 if test $ac_cv_func_pthread_sigmask = yes; then
21668 :
21669 else
21670 if test -n "$LIBMULTITHREAD"; then
21671 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_sigmask in $LIBMULTITHREAD" >&5
21672$as_echo_n "checking for pthread_sigmask in $LIBMULTITHREAD... " >&6; }
21673if test "${gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD+set}" = set; then :
21674 $as_echo_n "(cached) " >&6
21675else
21676 gl_save_LIBS="$LIBS"
21677 LIBS="$LIBS $LIBMULTITHREAD"
21678 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
21679/* end confdefs.h. */
21680#include <pthread.h>
21681 #include <signal.h>
21682
21683int
21684main ()
21685{
21686return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *) 0);
21687 ;
21688 return 0;
21689}
21690
21691_ACEOF
21692if ac_fn_c_try_link "$LINENO"; then :
21693 gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=yes
21694else
21695 gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
21696fi
21697rm -f core conftest.err conftest.$ac_objext \
21698 conftest$ac_exeext conftest.$ac_ext
21699 LIBS="$gl_save_LIBS"
21700
21701fi
21702{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&5
21703$as_echo "$gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD" >&6; }
21704 if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
21705 LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
21706 else
21707 HAVE_PTHREAD_SIGMASK=0
21708 fi
21709 else
21710 HAVE_PTHREAD_SIGMASK=0
21711 fi
21712 fi
21660 else 21713 else
21661 HAVE_PTHREAD_SIGMASK=0 21714 if test $ac_cv_func_pthread_sigmask = yes; then
21662 REPLACE_PTHREAD_SIGMASK=1 21715 REPLACE_PTHREAD_SIGMASK=1
21716 else
21717 HAVE_PTHREAD_SIGMASK=0
21718 fi
21663 fi 21719 fi
21664 21720
21665 21721
@@ -23576,6 +23632,102 @@ $as_echo "$gl_cv_time_r_posix" >&6; }
23576 23632
23577 23633
23578 23634
23635
23636
23637
23638
23639
23640 LIB_TIMER_TIME=
23641
23642 gl_saved_libs=$LIBS
23643 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing timer_settime" >&5
23644$as_echo_n "checking for library containing timer_settime... " >&6; }
23645if test "${ac_cv_search_timer_settime+set}" = set; then :
23646 $as_echo_n "(cached) " >&6
23647else
23648 ac_func_search_save_LIBS=$LIBS
23649cat confdefs.h - <<_ACEOF >conftest.$ac_ext
23650/* end confdefs.h. */
23651
23652/* Override any GCC internal prototype to avoid an error.
23653 Use char because int might match the return type of a GCC
23654 builtin and then its argument prototype would still apply. */
23655#ifdef __cplusplus
23656extern "C"
23657#endif
23658char timer_settime ();
23659int
23660main ()
23661{
23662return timer_settime ();
23663 ;
23664 return 0;
23665}
23666_ACEOF
23667for ac_lib in '' rt posix4; do
23668 if test -z "$ac_lib"; then
23669 ac_res="none required"
23670 else
23671 ac_res=-l$ac_lib
23672 LIBS="-l$ac_lib $ac_func_search_save_LIBS"
23673 fi
23674 if ac_fn_c_try_link "$LINENO"; then :
23675 ac_cv_search_timer_settime=$ac_res
23676fi
23677rm -f core conftest.err conftest.$ac_objext \
23678 conftest$ac_exeext
23679 if test "${ac_cv_search_timer_settime+set}" = set; then :
23680 break
23681fi
23682done
23683if test "${ac_cv_search_timer_settime+set}" = set; then :
23684
23685else
23686 ac_cv_search_timer_settime=no
23687fi
23688rm conftest.$ac_ext
23689LIBS=$ac_func_search_save_LIBS
23690fi
23691{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_timer_settime" >&5
23692$as_echo "$ac_cv_search_timer_settime" >&6; }
23693ac_res=$ac_cv_search_timer_settime
23694if test "$ac_res" != no; then :
23695 test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
23696 test "$ac_cv_search_timer_settime" = "none required" ||
23697 LIB_TIMER_TIME=$ac_cv_search_timer_settime
23698fi
23699
23700 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
23701/* end confdefs.h. */
23702
23703#include <features.h>
23704#ifdef __GNU_LIBRARY__
23705 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
23706 && !defined __UCLIBC__
23707 Thread emulation available
23708 #endif
23709#endif
23710
23711_ACEOF
23712if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
23713 $EGREP "Thread" >/dev/null 2>&1; then :
23714 LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"
23715fi
23716rm -f conftest*
23717
23718 for ac_func in timer_settime
23719do :
23720 ac_fn_c_check_func "$LINENO" "timer_settime" "ac_cv_func_timer_settime"
23721if test "x$ac_cv_func_timer_settime" = x""yes; then :
23722 cat >>confdefs.h <<_ACEOF
23723#define HAVE_TIMER_SETTIME 1
23724_ACEOF
23725
23726fi
23727done
23728
23729 LIBS=$gl_saved_libs
23730
23579 : 23731 :
23580 23732
23581 23733
diff --git a/configure.ac b/configure.ac
index a6462f7959a..5a3aea763c0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -571,6 +571,9 @@ else
571 test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS" 571 test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
572fi 572fi
573 573
574# Avoid gnulib's threadlib module, as we do threads our own way.
575AC_DEFUN([gl_THREADLIB])
576
574# Initialize gnulib right after choosing the compiler. 577# Initialize gnulib right after choosing the compiler.
575gl_EARLY 578gl_EARLY
576 579
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 28d6d2865a8..c1894fb900b 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,42 @@
12012-09-30 Chong Yidong <cyd@gnu.org>
2
3 * killing.texi (Rectangles): Document copy-rectangle-as-kill.
4
5 * search.texi (Special Isearch): Document the lax space search
6 feature and M-s SPC.
7 (Regexp Search): Move main search-whitespace-regexp description to
8 Special Isearch.
9 (Replace): Document replace-lax-whitespace.
10
11 * basic.texi (Position Info): Document C-u M-=.
12 (Moving Point): Document move-to-column.
13
14 * display.texi (Useless Whitespace): Add delete-trailing-lines.
15
16 * misc.texi (emacsclient Options): Document the effect of
17 initial-buffer-choice on client frames. Document server-auth-dir.
18 Do not document server-host, which is bad security practice.
19
20 * building.texi (Lisp Libraries): Docstring lookups can trigger
21 autoloading. Document help-enable-auto-load.
22
23 * mini.texi (Yes or No Prompts): New node.
24
25 * ack.texi (Acknowledgments): Remove obsolete packages.
26
272012-09-27 Glenn Morris <rgm@gnu.org>
28
29 * cal-xtra.texi (Advanced Calendar/Diary Usage):
30 Rename the section to be more general.
31 * emacs.texi: Update menu.
32
332012-09-23 Chong Yidong <cyd@gnu.org>
34
35 * buffers.texi (Misc Buffer): Replace toggle-read-only with
36 read-only-mode.
37
38 * files.texi (Visiting): Likewise.
39
12012-09-22 Paul Eggert <eggert@cs.ucla.edu> 402012-09-22 Paul Eggert <eggert@cs.ucla.edu>
2 41
3 * trouble.texi (Crashing): Document ulimit -c. 42 * trouble.texi (Crashing): Document ulimit -c.
diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi
index 487e3c19c16..8d1e4221a6c 100644
--- a/doc/emacs/ack.texi
+++ b/doc/emacs/ack.texi
@@ -644,10 +644,9 @@ statically scoped Emacs lisp.
644@item 644@item
645Daniel LaLiberte wrote @file{edebug.el}, a source-level debugger for 645Daniel LaLiberte wrote @file{edebug.el}, a source-level debugger for
646Emacs Lisp; @file{cl-specs.el}, specifications to help @code{edebug} 646Emacs Lisp; @file{cl-specs.el}, specifications to help @code{edebug}
647debug code written using David Gillespie's Common Lisp support; 647debug code written using David Gillespie's Common Lisp support; and
648@file{cust-print.el}, a customizable package for printing lisp 648@file{isearch.el}, Emacs's incremental search minor mode. He also
649objects; and @file{isearch.el}, Emacs's incremental search minor mode. 649co-wrote @file{hideif.el} (q.v.@:).
650He also co-wrote @file{hideif.el} (q.v.@:).
651 650
652@item 651@item
653Karl Landstrom and Daniel Colascione wrote @file{js.el}, a mode for 652Karl Landstrom and Daniel Colascione wrote @file{js.el}, a mode for
@@ -1301,15 +1300,14 @@ providing electric accent keys.
1301Colin Walters wrote Ibuffer, an enhanced buffer menu. 1300Colin Walters wrote Ibuffer, an enhanced buffer menu.
1302 1301
1303@item 1302@item
1304Barry Warsaw wrote @file{assoc.el}, a set of utility functions for 1303Barry Warsaw wrote @file{cc-mode.el}, a mode for editing C, C@t{++},
1305working with association lists; @file{cc-mode.el}, a mode for editing 1304and Java code, based on earlier work by Dave Detlefs, Stewart Clamen,
1306C, C@t{++}, and Java code, based on earlier work by Dave Detlefs, 1305and Richard Stallman; @file{elp.el}, a profiler for Emacs Lisp
1307Stewart Clamen, and Richard Stallman; @file{elp.el}, a profiler for 1306programs; @file{man.el}, a mode for reading Unix manual pages;
1308Emacs Lisp programs; @file{man.el}, a mode for reading Unix manual 1307@file{regi.el}, providing an AWK-like functionality for use in lisp
1309pages; @file{regi.el}, providing an AWK-like functionality for use in 1308programs; @file{reporter.el}, providing customizable bug reporting for
1310lisp programs; @file{reporter.el}, providing customizable bug 1309lisp packages; and @file{supercite.el}, a minor mode for quoting
1311reporting for lisp packages; and @file{supercite.el}, a minor mode for 1310sections of mail messages and news articles.
1312quoting sections of mail messages and news articles.
1313 1311
1314@item 1312@item
1315Christoph Wedler wrote @file{antlr-mode.el}, a major mode for ANTLR 1313Christoph Wedler wrote @file{antlr-mode.el}, a major mode for ANTLR
@@ -1351,9 +1349,8 @@ Directory Client; and @code{eshell}, a command shell implemented
1351entirely in Emacs Lisp. He also contributed to Org mode (q.v.@:). 1349entirely in Emacs Lisp. He also contributed to Org mode (q.v.@:).
1352 1350
1353@item 1351@item
1354Mike Williams wrote @file{mouse-sel.el}, providing enhanced mouse 1352Mike Williams wrote @file{thingatpt.el}, a library of functions for
1355selection; and @file{thingatpt.el}, a library of functions for finding 1353finding the ``thing'' (word, line, s-expression) at point.
1356the ``thing'' (word, line, s-expression) containing point.
1357 1354
1358@item 1355@item
1359Roland Winkler wrote @file{proced.el}, a system process editor. 1356Roland Winkler wrote @file{proced.el}, a system process editor.
diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi
index 16ccdba0866..42bd2a4fde2 100644
--- a/doc/emacs/basic.texi
+++ b/doc/emacs/basic.texi
@@ -267,7 +267,8 @@ necessary (@code{scroll-up-command}). @xref{Scrolling}.
267Scroll one screen backward, and move point onscreen if necessary 267Scroll one screen backward, and move point onscreen if necessary
268(@code{scroll-down-command}). @xref{Scrolling}. 268(@code{scroll-down-command}). @xref{Scrolling}.
269 269
270@item M-x goto-char 270@item M-g c
271@kindex M-g c
271@findex goto-char 272@findex goto-char
272Read a number @var{n} and move point to buffer position @var{n}. 273Read a number @var{n} and move point to buffer position @var{n}.
273Position 1 is the beginning of the buffer. 274Position 1 is the beginning of the buffer.
@@ -285,6 +286,13 @@ also specify @var{n} by giving @kbd{M-g M-g} a numeric prefix argument.
285@xref{Select Buffer}, for the behavior of @kbd{M-g M-g} when you give it 286@xref{Select Buffer}, for the behavior of @kbd{M-g M-g} when you give it
286a plain prefix argument. 287a plain prefix argument.
287 288
289@item M-g @key{TAB}
290@kindex M-g TAB
291@findex move-to-column
292Read a number @var{n} and move to column @var{n} in the current line.
293Column 0 is the leftmost column. If called with a prefix argument,
294move to the column number specified by the argument's numeric value.
295
288@item C-x C-n 296@item C-x C-n
289@kindex C-x C-n 297@kindex C-x C-n
290@findex set-goal-column 298@findex set-goal-column
@@ -619,12 +627,16 @@ narrowed region and the line number relative to the whole buffer.
619 627
620@kindex M-= 628@kindex M-=
621@findex count-words-region 629@findex count-words-region
622@findex count-words
623 @kbd{M-=} (@code{count-words-region}) displays a message reporting 630 @kbd{M-=} (@code{count-words-region}) displays a message reporting
624the number of lines, words, and characters in the region. @kbd{M-x 631the number of lines, words, and characters in the region
625count-words} displays a similar message for the entire buffer, or for 632(@pxref{Mark}, for an explanation of the region). With a prefix
626the region if the region is @dfn{active}. @xref{Mark}, for an 633argument, @kbd{C-u M-=}, the command displays a count for the entire
627explanation of the region. 634buffer.
635
636@findex count-words
637 The command @kbd{M-x count-words} does the same job, but with a
638different calling convention. It displays a count for the region if
639the region is active, and for the buffer otherwise.
628 640
629@kindex C-x = 641@kindex C-x =
630@findex what-cursor-position 642@findex what-cursor-position
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index 24bb0e83778..dfd8f792300 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -212,7 +212,7 @@ unless they visit files: such buffers are used internally by Emacs.
212 212
213@table @kbd 213@table @kbd
214@item C-x C-q 214@item C-x C-q
215Toggle read-only status of buffer (@code{toggle-read-only}). 215Toggle read-only status of buffer (@code{read-only-mode}).
216@item M-x rename-buffer @key{RET} @var{name} @key{RET} 216@item M-x rename-buffer @key{RET} @var{name} @key{RET}
217Change the name of the current buffer. 217Change the name of the current buffer.
218@item M-x rename-uniquely 218@item M-x rename-uniquely
@@ -231,9 +231,9 @@ buffers are usually made by subsystems such as Dired and Rmail that
231have special commands to operate on the text; also by visiting a file 231have special commands to operate on the text; also by visiting a file
232whose access control says you cannot write it. 232whose access control says you cannot write it.
233 233
234@findex toggle-read-only 234@findex read-only-mode
235@vindex view-read-only 235@vindex view-read-only
236 The command @kbd{C-x C-q} (@code{toggle-read-only}) makes a read-only 236 The command @kbd{C-x C-q} (@code{read-only-mode}) makes a read-only
237buffer writable, and makes a writable buffer read-only. This works by 237buffer writable, and makes a writable buffer read-only. This works by
238setting the variable @code{buffer-read-only}, which has a local value 238setting the variable @code{buffer-read-only}, which has a local value
239in each buffer and makes the buffer read-only if its value is 239in each buffer and makes the buffer read-only if its value is
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 21948f181fb..eaee16ac8d5 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -1393,13 +1393,21 @@ putting a line like this in your init file (@pxref{Init File}):
1393@end example 1393@end example
1394 1394
1395@cindex autoload 1395@cindex autoload
1396 Some commands are @dfn{autoloaded}: when you run them, Emacs 1396 Some commands are @dfn{autoloaded}; when you run them, Emacs
1397automatically loads the associated library first. For instance, the 1397automatically loads the associated library first. For instance, the
1398@kbd{M-x compile} command (@pxref{Compilation}) is autoloaded; if you 1398@kbd{M-x compile} command (@pxref{Compilation}) is autoloaded; if you
1399call it, Emacs automatically loads the @code{compile} library first. 1399call it, Emacs automatically loads the @code{compile} library first.
1400In contrast, the command @kbd{M-x recompile} is not autoloaded, so it 1400In contrast, the command @kbd{M-x recompile} is not autoloaded, so it
1401is unavailable until you load the @code{compile} library. 1401is unavailable until you load the @code{compile} library.
1402 1402
1403@vindex help-enable-auto-load
1404 Automatic loading can also occur when you look up the documentation
1405of an autoloaded command (@pxref{Name Help}), if the documentation
1406refers to other functions and variables in its library (loading the
1407library lets Emacs properly set up the hyperlinks in the @file{*Help*}
1408buffer). To disable this feature, change the variable
1409@code{help-enable-auto-load} to @code{nil}.
1410
1403@vindex load-dangerous-libraries 1411@vindex load-dangerous-libraries
1404@cindex Lisp files byte-compiled by XEmacs 1412@cindex Lisp files byte-compiled by XEmacs
1405 By default, Emacs refuses to load compiled Lisp files which were 1413 By default, Emacs refuses to load compiled Lisp files which were
diff --git a/doc/emacs/cal-xtra.texi b/doc/emacs/cal-xtra.texi
index 45760afd7a6..b29a8526625 100644
--- a/doc/emacs/cal-xtra.texi
+++ b/doc/emacs/cal-xtra.texi
@@ -7,10 +7,12 @@
7 7
8@c Moved here from the Emacs Lisp Reference Manual, 2005-03-26. 8@c Moved here from the Emacs Lisp Reference Manual, 2005-03-26.
9@node Advanced Calendar/Diary Usage 9@node Advanced Calendar/Diary Usage
10@section Customizing the Calendar and Diary 10@section More advanced features of the Calendar and Diary
11 11
12 There are many ways in which you can customize the calendar and 12 This section describes some of the more advanced/specialized
13diary to suit your personal tastes. 13features of the calendar and diary. It starts with some of the
14many ways in which you can customize the calendar and diary to suit
15your personal tastes.
14 16
15@menu 17@menu
16* Calendar Customizing:: Calendar layout and hooks. 18* Calendar Customizing:: Calendar layout and hooks.
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index 2238570eaa9..2313d117a90 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1044,9 +1044,9 @@ the left fringe, but no arrow bitmaps, use @code{((top . left)
1044@cindex whitespace, trailing 1044@cindex whitespace, trailing
1045@vindex show-trailing-whitespace 1045@vindex show-trailing-whitespace
1046 It is easy to leave unnecessary spaces at the end of a line, or 1046 It is easy to leave unnecessary spaces at the end of a line, or
1047empty lines at the end of a file, without realizing it. In most 1047empty lines at the end of a buffer, without realizing it. In most
1048cases, this @dfn{trailing whitespace} has no effect, but there are 1048cases, this @dfn{trailing whitespace} has no effect, but sometimes it
1049special circumstances where it matters, and it can be a nuisance. 1049can be a nuisance.
1050 1050
1051 You can make trailing whitespace at the end of a line visible by 1051 You can make trailing whitespace at the end of a line visible by
1052setting the buffer-local variable @code{show-trailing-whitespace} to 1052setting the buffer-local variable @code{show-trailing-whitespace} to
@@ -1061,9 +1061,13 @@ the location of point is enough to show you that the spaces are
1061present. 1061present.
1062 1062
1063@findex delete-trailing-whitespace 1063@findex delete-trailing-whitespace
1064@vindex delete-trailing-lines
1064 Type @kbd{M-x delete-trailing-whitespace} to delete all trailing 1065 Type @kbd{M-x delete-trailing-whitespace} to delete all trailing
1065whitespace within the buffer. If the region is active, it deletes all 1066whitespace. This command deletes all extra spaces at the end of each
1066trailing whitespace in the region instead. 1067line in the buffer, and all empty lines at the end of the buffer; to
1068ignore the latter, change the varaible @code{delete-trailing-lines} to
1069@code{nil}. If the region is active, the command instead deletes
1070extra spaces at the end of each line in the region.
1067 1071
1068@vindex indicate-empty-lines 1072@vindex indicate-empty-lines
1069@cindex unused lines 1073@cindex unused lines
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 192a9a2bb28..a2eaaf673e5 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -267,6 +267,7 @@ The Minibuffer
267* Minibuffer History:: Reusing recent minibuffer arguments. 267* Minibuffer History:: Reusing recent minibuffer arguments.
268* Repetition:: Re-executing commands that used the minibuffer. 268* Repetition:: Re-executing commands that used the minibuffer.
269* Passwords:: Entering passwords in the echo area. 269* Passwords:: Entering passwords in the echo area.
270* Yes or No Prompts:: Replying yes or no in the echo area.
270 271
271Completion 272Completion
272 273
@@ -953,7 +954,7 @@ The Diary
953* Special Diary Entries:: Anniversaries, blocks of dates, cyclic entries, etc. 954* Special Diary Entries:: Anniversaries, blocks of dates, cyclic entries, etc.
954 955
955@ifnottex 956@ifnottex
956Customizing the Calendar and Diary 957More advanced features of the Calendar and Diary
957 958
958* Calendar Customizing:: Calendar layout and hooks. 959* Calendar Customizing:: Calendar layout and hooks.
959* Holiday Customizing:: Defining your own holidays. 960* Holiday Customizing:: Defining your own holidays.
diff --git a/doc/emacs/entering.texi b/doc/emacs/entering.texi
index de143516ce8..224ab356d08 100644
--- a/doc/emacs/entering.texi
+++ b/doc/emacs/entering.texi
@@ -79,11 +79,6 @@ non-@code{nil} value. (In that case, even if you specify one or more
79files on the command line, Emacs opens but does not display them.) 79files on the command line, Emacs opens but does not display them.)
80The value of @code{initial-buffer-choice} should be the name of 80The value of @code{initial-buffer-choice} should be the name of
81the desired file or directory. 81the desired file or directory.
82@ignore
83@c I do not think this should be mentioned. AFAICS it is just a dodge
84@c around inhibit-startup-screen not being settable on a site-wide basis.
85or @code{t}, which means to display the @file{*scratch*} buffer.
86@end ignore
87 82
88@node Exiting 83@node Exiting
89@section Exiting Emacs 84@section Exiting Emacs
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 422100e27b9..c1cebc424ca 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -246,7 +246,7 @@ Archives}, for more about these features.
246or that is marked read-only, Emacs makes the buffer read-only too, so 246or that is marked read-only, Emacs makes the buffer read-only too, so
247that you won't go ahead and make changes that you'll have trouble 247that you won't go ahead and make changes that you'll have trouble
248saving afterward. You can make the buffer writable with @kbd{C-x C-q} 248saving afterward. You can make the buffer writable with @kbd{C-x C-q}
249(@code{toggle-read-only}). @xref{Misc Buffer}. 249(@code{read-only-mode}). @xref{Misc Buffer}.
250 250
251@kindex C-x C-r 251@kindex C-x C-r
252@findex find-file-read-only 252@findex find-file-read-only
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index d09885c5edd..050ecd150ab 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -243,7 +243,7 @@ by the innermost Lisp expression in the buffer around point,
243(That name appears as the default while you enter the argument.) For 243(That name appears as the default while you enter the argument.) For
244example, if point is located following the text @samp{(make-vector 244example, if point is located following the text @samp{(make-vector
245(car x)}, the innermost list containing point is the one that starts 245(car x)}, the innermost list containing point is the one that starts
246with @samp{(make-vector}, so @kbd{C-h f @key{RET}} will describe the 246with @samp{(make-vector}, so @kbd{C-h f @key{RET}} describes the
247function @code{make-vector}. 247function @code{make-vector}.
248 248
249 @kbd{C-h f} is also useful just to verify that you spelled a 249 @kbd{C-h f} is also useful just to verify that you spelled a
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 1eb53d0d2ec..5510816b067 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -709,6 +709,9 @@ rectangle, depending on the command that uses them.
709@item C-x r k 709@item C-x r k
710Kill the text of the region-rectangle, saving its contents as the 710Kill the text of the region-rectangle, saving its contents as the
711``last killed rectangle'' (@code{kill-rectangle}). 711``last killed rectangle'' (@code{kill-rectangle}).
712@item C-x r M-w
713Save the text of the region-rectangle as the ``last killed rectangle''
714(@code{copy-rectangle-as-kill}).
712@item C-x r d 715@item C-x r d
713Delete the text of the region-rectangle (@code{delete-rectangle}). 716Delete the text of the region-rectangle (@code{delete-rectangle}).
714@item C-x r y 717@item C-x r y
@@ -757,6 +760,12 @@ yanking a rectangle is so different from yanking linear text that
757different yank commands have to be used. Yank-popping is not defined 760different yank commands have to be used. Yank-popping is not defined
758for rectangles. 761for rectangles.
759 762
763@kindex C-x r M-w
764@findex copy-rectangle-as-kill
765 @kbd{C-x r M-w} (@code{copy-rectangle-as-kill}) is the equivalent of
766@kbd{M-w} for rectangles: it records the rectangle as the ``last
767killed rectangle'', without deleting the text from the buffer.
768
760@kindex C-x r y 769@kindex C-x r y
761@findex yank-rectangle 770@findex yank-rectangle
762 To yank the last killed rectangle, type @kbd{C-x r y} 771 To yank the last killed rectangle, type @kbd{C-x r y}
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 2856db7a4fa..5d2fc804498 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -45,6 +45,7 @@ do not echo.
45* Minibuffer History:: Reusing recent minibuffer arguments. 45* Minibuffer History:: Reusing recent minibuffer arguments.
46* Repetition:: Re-executing commands that used the minibuffer. 46* Repetition:: Re-executing commands that used the minibuffer.
47* Passwords:: Entering passwords in the echo area. 47* Passwords:: Entering passwords in the echo area.
48* Yes or No Prompts:: Replying yes or no in the echo area.
48@end menu 49@end menu
49 50
50@node Minibuffer File 51@node Minibuffer File
@@ -733,3 +734,53 @@ password (@pxref{Killing}). You may type either @key{RET} or
733@key{ESC} to submit the password. Any other self-inserting character 734@key{ESC} to submit the password. Any other self-inserting character
734key inserts the associated character into the password, and all other 735key inserts the associated character into the password, and all other
735input is ignored. 736input is ignored.
737
738@node Yes or No Prompts
739@section Yes or No Prompts
740
741 An Emacs command may require you to answer a ``yes or no'' question
742during the course of its execution. Such queries come in two main
743varieties.
744
745@cindex y or n prompt
746 For the first type of ``yes or no'' query, the prompt ends with
747@samp{(y or n)}. Such a query does not actually use the minibuffer;
748the prompt appears in the echo area, and you answer by typing either
749@samp{y} or @samp{n}, which immediately delivers the response. For
750example, if you type @kbd{C-x C-w} (@kbd{write-file}) to save a
751buffer, and enter the name of an existing file, Emacs issues a prompt
752like this:
753
754@smallexample
755File `foo.el' exists; overwrite? (y or n)
756@end smallexample
757
758@noindent
759Because this query does not actually use the minibuffer, the usual
760minibuffer editing commands cannot be used. However, you can perform
761some window scrolling operations while the query is active: @kbd{C-l}
762recenters the selected window; @kbd{M-v} (or @key{PageDown} or
763@key{next}) scrolls forward; @kbd{C-v} (or @key{PageUp}, or
764@key{prior}) scrolls backward; @kbd{C-M-v} scrolls forward in the next
765window; and @kbd{C-M-S-v} scrolls backward in the next window. Typing
766@kbd{C-g} dismisses the query, and quits the command that issued it
767(@pxref{Quitting}).
768
769@cindex yes or no prompt
770 The second type of ``yes or no'' query is typically employed if
771giving the wrong answer would have serious consequences; it uses the
772minibuffer, and features a prompt ending with @samp{(yes or no)}. For
773example, if you invoke @kbd{C-x k} (@code{kill-buffer}) on a
774file-visiting buffer with unsaved changes, Emacs activates the
775minibuffer with a prompt like this:
776
777@smallexample
778Buffer foo.el modified; kill anyway? (yes or no)
779@end smallexample
780
781@noindent
782To answer, you must type @samp{yes} or @samp{no} into the minibuffer,
783followed by @key{RET}. The minibuffer behaves as described in the
784previous sections; you can switch to another window with @kbd{C-x o},
785use the history commands @kbd{M-p} and @kbd{M-f}, etc. Type @kbd{C-g}
786to quit the minibuffer and the querying command.
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 5d7a51a01f5..4f0a1009e30 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1509,15 +1509,11 @@ precedence.
1509@cindex client frame 1509@cindex client frame
1510@item -c 1510@item -c
1511Create a new graphical @dfn{client frame}, instead of using an 1511Create a new graphical @dfn{client frame}, instead of using an
1512existing Emacs frame. If you omit a filename argument while supplying 1512existing Emacs frame. See below for the special behavior of @kbd{C-x
1513the @samp{-c} option, the new frame displays the @file{*scratch*} 1513C-c} in a client frame. If Emacs cannot create a new graphical frame
1514buffer (@pxref{Buffers}). See below for the special behavior of 1514(e.g.@: if it cannot connect to the X server), it tries to create a
1515@kbd{C-x C-c} in a client frame. 1515text terminal client frame, as though you had supplied the @samp{-t}
1516 1516option instead.
1517If Emacs is unable to create a new graphical frame (e.g.@: if it is
1518unable to connect to the X server), it tries to create a text terminal
1519client frame, as though you had supplied the @samp{-t} option instead
1520(see below).
1521 1517
1522On MS-Windows, a single Emacs session cannot display frames on both 1518On MS-Windows, a single Emacs session cannot display frames on both
1523graphical and text terminals, nor on multiple text terminals. Thus, 1519graphical and text terminals, nor on multiple text terminals. Thus,
@@ -1525,6 +1521,11 @@ if the Emacs server is running on a text terminal, the @samp{-c}
1525option, like the @samp{-t} option, creates a new frame in the server's 1521option, like the @samp{-t} option, creates a new frame in the server's
1526current text terminal. @xref{Windows Startup}. 1522current text terminal. @xref{Windows Startup}.
1527 1523
1524If you omit a filename argument while supplying the @samp{-c} option,
1525the new frame displays the @file{*scratch*} buffer by default. If
1526@code{initial-buffer-choice} is a string (@pxref{Entering Emacs}), the
1527new frame displays that file or directory instead.
1528
1528@item -F @var{alist} 1529@item -F @var{alist}
1529@itemx --frame-parameters=@var{alist} 1530@itemx --frame-parameters=@var{alist}
1530Set the parameters for a newly-created graphical frame 1531Set the parameters for a newly-created graphical frame
@@ -1545,38 +1546,24 @@ evaluate, @emph{not} as a list of files to visit.
1545@item -f @var{server-file} 1546@item -f @var{server-file}
1546@itemx --server-file=@var{server-file} 1547@itemx --server-file=@var{server-file}
1547@cindex @env{EMACS_SERVER_FILE} environment variable 1548@cindex @env{EMACS_SERVER_FILE} environment variable
1548@cindex server file
1549@vindex server-use-tcp
1550@vindex server-host
1551Specify a @dfn{server file} for connecting to an Emacs server via TCP. 1549Specify a @dfn{server file} for connecting to an Emacs server via TCP.
1552 1550
1553An Emacs server usually uses an operating system feature called a 1551An Emacs server usually uses an operating system feature called a
1554``local socket'' to listen for connections. Some operating systems, 1552``local socket'' to listen for connections. Some operating systems,
1555such as Microsoft Windows, do not support local sockets; in that case, 1553such as Microsoft Windows, do not support local sockets; in that case,
1556Emacs uses TCP instead. When you start the Emacs server, Emacs 1554the server communicates with @command{emacsclient} via TCP.
1557creates a server file containing some TCP information that
1558@command{emacsclient} needs for making the connection. By default,
1559the server file is in @file{~/.emacs.d/server/}. On Microsoft
1560Windows, if @command{emacsclient} does not find the server file there,
1561it looks in the @file{.emacs.d/server/} subdirectory of the directory
1562pointed to by the @env{APPDATA} environment variable. You can tell
1563@command{emacsclient} to use a specific server file with the @samp{-f}
1564or @samp{--server-file} option, or by setting the
1565@env{EMACS_SERVER_FILE} environment variable.
1566
1567Even if local sockets are available, you can tell Emacs to use TCP by
1568setting the variable @code{server-use-tcp} to @code{t}. One advantage
1569of TCP is that the server can accept connections from remote machines.
1570For this to work, you must (i) set the variable @code{server-host} to
1571the hostname or IP address of the machine on which the Emacs server
1572runs, and (ii) provide @command{emacsclient} with the server file.
1573(One convenient way to do the latter is to put the server file on a
1574networked file system such as NFS.)
1575 1555
1556@vindex server-auth-dir
1557@cindex server file
1576@vindex server-port 1558@vindex server-port
1577 When the Emacs server is using TCP, the variable @code{server-port} 1559When you start a TCP Emacs server, Emacs creates a @dfn{server file}
1578determines the port number to listen on; the default value, 1560containing the TCP information to be used by @command{emacsclient} to
1579@code{nil}, means to choose a random port when the server starts. 1561connect to the server. The variable @code{server-auth-dir} specifies
1562the directory containing the server file; by default, this is
1563@file{~/.emacs.d/server/}. To tell @command{emacsclient} to connect
1564to the server over TCP with a specific server file, use the @samp{-f}
1565or @samp{--server-file} option, or set the @env{EMACS_SERVER_FILE}
1566environment variable.
1580 1567
1581@item -n 1568@item -n
1582@itemx --no-wait 1569@itemx --no-wait
@@ -1606,19 +1593,14 @@ server it finds. (This option is not supported on MS-Windows.)
1606@itemx --tty 1593@itemx --tty
1607@itemx -nw 1594@itemx -nw
1608Create a new client frame on the current text terminal, instead of 1595Create a new client frame on the current text terminal, instead of
1609using an existing Emacs frame. This is similar to the @samp{-c} 1596using an existing Emacs frame. This behaves just like the @samp{-c}
1610option, above, except that it creates a text terminal frame 1597option, described above, except that it creates a text terminal frame
1611(@pxref{Non-Window Terminals}). If you omit a filename argument while 1598(@pxref{Non-Window Terminals}).
1612supplying this option, the new frame displays the @file{*scratch*} 1599
1613buffer (@pxref{Buffers}). See below for the special behavior of 1600On MS-Windows, @samp{-t} behaves just like @samp{-c} if the Emacs
1614@kbd{C-x C-c} in a client frame. 1601server is using the graphical display, but if the Emacs server is
1615 1602running on a text terminal, it creates a new frame in the current text
1616On MS-Windows, a single Emacs session cannot display frames on both 1603terminal.
1617graphical and text terminals, nor on multiple text terminals. Thus,
1618if the Emacs server is using the graphical display, @samp{-t} behaves
1619like @samp{-c} (see above); whereas if the Emacs server is running on
1620a text terminal, it creates a new frame in its current text terminal.
1621@xref{Windows Startup}.
1622@end table 1604@end table
1623 1605
1624 The new graphical or text terminal frames created by the @samp{-c} 1606 The new graphical or text terminal frames created by the @samp{-c}
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index d5c9783b772..21db02c8ab8 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -17,7 +17,6 @@ thing, but search for patterns instead of fixed strings.
17(@pxref{Operating on Files}), or ask the @code{grep} program to do it 17(@pxref{Operating on Files}), or ask the @code{grep} program to do it
18(@pxref{Grep Searching}). 18(@pxref{Grep Searching}).
19 19
20
21@menu 20@menu
22* Incremental Search:: Search happens as you type the string. 21* Incremental Search:: Search happens as you type the string.
23* Nonincremental Search:: Specify entire string and then search. 22* Nonincremental Search:: Specify entire string and then search.
@@ -218,6 +217,24 @@ search.
218 Some of the characters you type during incremental search have 217 Some of the characters you type during incremental search have
219special effects. 218special effects.
220 219
220@cindex lax space matching
221@kindex M-s SPC @r{(Incremental search)}
222@kindex SPC @r{(Incremental search)}
223@findex isearch-toggle-lax-whitespace
224@vindex search-whitespace-regexp
225 By default, incremental search performs @dfn{lax space matching}:
226each space, or sequence of spaces, matches any sequence of one or more
227spaces in the text. Hence, @samp{foo bar} matches @samp{foo bar},
228@samp{foo bar}, @samp{foo bar}, and so on (but not @samp{foobar}).
229More precisely, Emacs matches each sequence of space characters in the
230search string to a regular expression specified by the variable
231@code{search-whitespace-regexp}. For example, set it to
232@samp{"[[:space:]\n]+"} to make spaces match sequences of newlines as
233well as spaces. To toggle lax space matching, type @kbd{M-s SPC}
234(@code{isearch-toggle-lax-whitespace}). To disable this feature
235entirely, change @code{search-whitespace-regexp} to @code{nil}; then
236each space in the search string matches exactly one space
237
221 If the search string you entered contains only lower-case letters, 238 If the search string you entered contains only lower-case letters,
222the search is case-insensitive; as long as an upper-case letter exists 239the search is case-insensitive; as long as an upper-case letter exists
223in the search string, the search becomes case-sensitive. If you 240in the search string, the search becomes case-sensitive. If you
@@ -492,12 +509,12 @@ Incremental regexp and non-regexp searches have independent defaults.
492They also have separate search rings, which you can access with 509They also have separate search rings, which you can access with
493@kbd{M-p} and @kbd{M-n}. 510@kbd{M-p} and @kbd{M-n}.
494 511
495@vindex search-whitespace-regexp 512 Just as in ordinary incremental search, any @key{SPC} typed in
496 If you type @key{SPC} in incremental regexp search, it matches any 513incremental regexp search matches any sequence of one or more
497sequence of whitespace characters, including newlines. If you want to 514whitespace characters. The variable @code{search-whitespace-regexp}
498match just a space, type @kbd{C-q @key{SPC}}. You can control what a 515specifies the regexp for the lax space matching, and @kbd{M-s SPC}
499bare space matches by setting the variable 516(@code{isearch-toggle-lax-whitespace}) toggles the feature.
500@code{search-whitespace-regexp} to the desired regexp. 517@xref{Special Isearch}.
501 518
502 In some cases, adding characters to the regexp in an incremental 519 In some cases, adding characters to the regexp in an incremental
503regexp search can make the cursor move back and start again. For 520regexp search can make the cursor move back and start again. For
@@ -974,6 +991,13 @@ instead (@pxref{Mark}). The basic replace commands replace one
974is possible to perform several replacements in parallel, using the 991is possible to perform several replacements in parallel, using the
975command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}). 992command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}).
976 993
994@vindex replace-lax-whitespace
995 Unlike incremental search, the replacement commands do not use lax
996space matching (@pxref{Special Isearch}) by default. To enable lax
997space matching for replacement, change the variable
998@code{replace-lax-whitespace} to @code{t}. (This only affects how
999Emacs finds the text to replace, not the replacement text.)
1000
977@menu 1001@menu
978* Unconditional Replace:: Replacing all matches for a string. 1002* Unconditional Replace:: Replacing all matches for a string.
979* Regexp Replace:: Replacing all matches for a regexp. 1003* Regexp Replace:: Replacing all matches for a regexp.
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index b813ac6bb1c..b5c847b4b72 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,59 @@
12012-09-30 Chong Yidong <cyd@gnu.org>
2
3 * commands.texi (Click Events): Define "mouse position list".
4 Remove mention of unimplemented horizontal scroll bars.
5 (Drag Events, Motion Events): Refer to "mouse position list".
6 (Accessing Mouse): Document posnp.
7
8 * errors.texi (Standard Errors): Tweak arith-error description.
9 Tweak markup. Remove domain-error and friends, which seem to be
10 unused after the floating-point code revamp.
11
12 * functions.texi (Obsolete Functions): Obsolescence also affects
13 documentation commands. Various clarifications.
14 (Declare Form): New node.
15
16 * strings.texi (String Basics): Copyedits.
17
18 * os.texi (Idle Timers): Minor clarifications.
19 (User Identification): Add system-users and system-groups.
20
21 * macros.texi (Defining Macros): Move description of `declare' to
22 Declare Form node.
23
24 * loading.texi (Autoload):
25 * help.texi (Documentation Basics): The special sequences can
26 trigger autoloading.
27
28 * numbers.texi (Integer Basics): Copyedits.
29 (Float Basics): Consider IEEE floating point always available.
30 (Random Numbers): Document actual limits.
31 (Arithmetic Operations): Clarify division by zero. Don't mention
32 the machine-independence of negative division since it does not
33 happen in practice.
34
352012-09-28 Chong Yidong <cyd@gnu.org>
36
37 * os.texi (Startup Summary): Document leim-list.el change.
38
392012-09-25 Chong Yidong <cyd@gnu.org>
40
41 * functions.texi (Defining Functions): defun is now a macro.
42
432012-09-28 Leo Liu <sdl.web@gmail.com>
44
45 * files.texi (Files): Fix typo.
46
472012-09-23 Chong Yidong <cyd@gnu.org>
48
49 * buffers.texi (Read Only Buffers): Document read-only-mode.
50
51 * keymaps.texi (Alias Menu Items): Replace toggle-read-only with
52 read-only-mode.
53
54 * backups.texi (Auto-Saving): Refer to Minor Mode Conventions for
55 calling conventions.
56
12012-09-22 Chong Yidong <cyd@gnu.org> 572012-09-22 Chong Yidong <cyd@gnu.org>
2 58
3 * searching.texi (Replacing Match): Minor clarification. 59 * searching.texi (Replacing Match): Minor clarification.
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi
index 04aa28e9f04..935a49116cd 100644
--- a/doc/lispref/backups.texi
+++ b/doc/lispref/backups.texi
@@ -441,12 +441,14 @@ buffer-auto-save-file-name
441@end defvar 441@end defvar
442 442
443@deffn Command auto-save-mode arg 443@deffn Command auto-save-mode arg
444When used interactively without an argument, this command is a toggle 444This is the mode command for Auto Save mode, a buffer-local minor
445switch: it turns on auto-saving of the current buffer if it is off, 445mode. When Auto Save mode is enabled, auto-saving is enabled in the
446and vice versa. When called from Lisp with no argument, it turns 446buffer. The calling convention is the same as for other minor mode
447auto-saving on. With an argument @var{arg}, it turns auto-saving on 447commands (@pxref{Minor Mode Conventions}).
448if the value of @var{arg} is @code{t}, a nonempty list, or a positive 448
449integer; otherwise, it turns auto-saving off. 449Unlike most minor modes, there is no @code{auto-save-mode} variable.
450Auto Save mode is enabled if @code{buffer-auto-save-file-name} is
451non-@code{nil} and @code{buffer-saved-size} (see below) is non-zero.
450@end deffn 452@end deffn
451 453
452@defun auto-save-file-name-p filename 454@defun auto-save-file-name-p filename
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 6ad329f3a30..b9666a79f5b 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -740,31 +740,25 @@ properties have no effect. If @code{inhibit-read-only} is a list, then
740of the list (comparison is done with @code{eq}). 740of the list (comparison is done with @code{eq}).
741@end defvar 741@end defvar
742 742
743@deffn Command toggle-read-only &optional arg message 743@deffn Command read-only-mode &optional arg
744This command toggles whether the current buffer is read-only, by 744This is the mode command for Read Only minor mode, a buffer-local
745setting the variable @code{buffer-read-only}. If @var{arg} is 745minor mode. When the mode is enabled, @code{buffer-read-only} is
746non-@code{nil}, it should be a raw prefix argument; the command then 746non-@code{nil} in the buffer; when disabled, @code{buffer-read-only}
747makes the buffer read-only if the numeric value of that prefix 747is @code{nil} in the buffer. The calling convention is the same as
748argument is positive, and makes the buffer writable otherwise. 748for other minor mode commands (@pxref{Minor Mode Conventions}).
749@xref{Prefix Command Arguments}. 749
750 750This minor mode mainly serves as a wrapper for
751If called interactively, or if called from Lisp with @var{message} is 751@code{buffer-read-only}; unlike most minor modes, there is no separate
752non-@code{nil}, the command prints a message reporting the buffer's 752@code{read-only-mode} variable. Even when Read Only mode is disabled,
753new read-only status. 753characters with non-@code{nil} @code{read-only} text properties remain
754 754read-only. To temporarily ignore all read-only states, bind
755When making the buffer read-only, this command also enables View mode 755@code{inhibit-read-only}, as described above.
756
757When enabling Read Only mode, this mode command also enables View mode
756if the option @code{view-read-only} is non-@code{nil}. @xref{Misc 758if the option @code{view-read-only} is non-@code{nil}. @xref{Misc
757Buffer,,Miscellaneous Buffer Operations, emacs, The GNU Emacs Manual}. 759Buffer,,Miscellaneous Buffer Operations, emacs, The GNU Emacs Manual}.
758When making the buffer writable, it disables View mode if View mode 760When disabling Read Only mode, it disables View mode if View mode was
759was enabled. 761enabled.
760
761Lisp programs should only call @code{toggle-read-only} if they really
762intend to do the same thing as the user command, including possibly
763enabling or disabling View mode. Note also that this command works by
764setting @code{buffer-read-only}, so even if you make the buffer
765writable, characters with non-@code{nil} @code{read-only} text
766properties will remain read-only. To temporarily ignore all read-only
767states, bind @code{inhibit-read-only}, as described above.
768@end deffn 762@end deffn
769 763
770@defun barf-if-buffer-read-only 764@defun barf-if-buffer-read-only
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index dc0fa4c639d..93dba237013 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1275,12 +1275,21 @@ describe events by their types; thus, if there is a key binding for
1275@var{event-type} is @code{mouse-1}. 1275@var{event-type} is @code{mouse-1}.
1276 1276
1277@item @var{position} 1277@item @var{position}
1278This is the position where the mouse click occurred. The actual 1278@cindex mouse position list
1279format of @var{position} depends on what part of a window was clicked 1279This is a @dfn{mouse position list} specifying where the mouse click
1280on. 1280occurred; see below for details.
1281 1281
1282For mouse click events in the text area, mode line, header line, or in 1282@item @var{click-count}
1283the marginal areas, @var{position} has this form: 1283This is the number of rapid repeated presses so far of the same mouse
1284button. @xref{Repeat Events}.
1285@end table
1286
1287 To access the contents of a mouse position list in the
1288@var{position} slot of a click event, you should typically use the
1289functions documented in @ref{Accessing Mouse}. The explicit format of
1290the list depends on where the click occurred. For clicks in the text
1291area, mode line, header line, or in the fringe or marginal areas, the
1292mouse position list has the form
1284 1293
1285@example 1294@example
1286(@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp} 1295(@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp}
@@ -1289,18 +1298,16 @@ the marginal areas, @var{position} has this form:
1289@end example 1298@end example
1290 1299
1291@noindent 1300@noindent
1292The meanings of these list elements are documented below. 1301The meanings of these list elements are as follows:
1293@xref{Accessing Mouse}, for functions that let you easily access these
1294elements.
1295 1302
1296@table @asis 1303@table @asis
1297@item @var{window} 1304@item @var{window}
1298This is the window in which the click occurred. 1305The window in which the click occurred.
1299 1306
1300@item @var{pos-or-area} 1307@item @var{pos-or-area}
1301This is the buffer position of the character clicked on in the text 1308The buffer position of the character clicked on in the text area; or,
1302area, or if clicked outside the text area, it is the window area in 1309if the click was outside the text area, the window area where it
1303which the click occurred. It is one of the symbols @code{mode-line}, 1310occurred. It is one of the symbols @code{mode-line},
1304@code{header-line}, @code{vertical-line}, @code{left-margin}, 1311@code{header-line}, @code{vertical-line}, @code{left-margin},
1305@code{right-margin}, @code{left-fringe}, or @code{right-fringe}. 1312@code{right-margin}, @code{left-fringe}, or @code{right-fringe}.
1306 1313
@@ -1310,22 +1317,23 @@ happens after the imaginary prefix keys for the event are registered
1310by Emacs. @xref{Key Sequence Input}. 1317by Emacs. @xref{Key Sequence Input}.
1311 1318
1312@item @var{x}, @var{y} 1319@item @var{x}, @var{y}
1313These are the relative pixel coordinates of the click. For clicks in 1320The relative pixel coordinates of the click. For clicks in the text
1314the text area of a window, the coordinate origin @code{(0 . 0)} is 1321area of a window, the coordinate origin @code{(0 . 0)} is taken to be
1315taken to be the top left corner of the text area. @xref{Window 1322the top left corner of the text area. @xref{Window Sizes}. For
1316Sizes}. For clicks in a mode line or header line, the coordinate 1323clicks in a mode line or header line, the coordinate origin is the top
1317origin is the top left corner of the window itself. For fringes, 1324left corner of the window itself. For fringes, margins, and the
1318margins, and the vertical border, @var{x} does not have meaningful 1325vertical border, @var{x} does not have meaningful data. For fringes
1319data. For fringes and margins, @var{y} is relative to the bottom edge 1326and margins, @var{y} is relative to the bottom edge of the header
1320of the header line. In all cases, the @var{x} and @var{y} coordinates 1327line. In all cases, the @var{x} and @var{y} coordinates increase
1321increase rightward and downward respectively. 1328rightward and downward respectively.
1322 1329
1323@item @var{timestamp} 1330@item @var{timestamp}
1324This is the time at which the event occurred, in milliseconds. 1331The time at which the event occurred, as an integer number of
1332milliseconds since a system-dependent initial time.
1325 1333
1326@item @var{object} 1334@item @var{object}
1327This is either @code{nil} if there is no string-type text property at 1335Either @code{nil} if there is no string-type text property at the
1328the click position, or a cons cell of the form (@var{string} 1336click position, or a cons cell of the form (@var{string}
1329. @var{string-pos}) if there is one: 1337. @var{string-pos}) if there is one:
1330 1338
1331@table @asis 1339@table @asis
@@ -1371,8 +1379,7 @@ These are the pixel width and height of @var{object} or, if this is
1371@code{nil}, those of the character glyph clicked on. 1379@code{nil}, those of the character glyph clicked on.
1372@end table 1380@end table
1373 1381
1374@sp 1 1382For clicks on a scroll bar, @var{position} has this form:
1375For mouse clicks on a scroll-bar, @var{position} has this form:
1376 1383
1377@example 1384@example
1378(@var{window} @var{area} (@var{portion} . @var{whole}) @var{timestamp} @var{part}) 1385(@var{window} @var{area} (@var{portion} . @var{whole}) @var{timestamp} @var{part})
@@ -1380,32 +1387,35 @@ For mouse clicks on a scroll-bar, @var{position} has this form:
1380 1387
1381@table @asis 1388@table @asis
1382@item @var{window} 1389@item @var{window}
1383This is the window whose scroll-bar was clicked on. 1390The window whose scroll bar was clicked on.
1384 1391
1385@item @var{area} 1392@item @var{area}
1386This is the scroll bar where the click occurred. It is one of the 1393This is the symbol @code{vertical-scroll-bar}.
1387symbols @code{vertical-scroll-bar} or @code{horizontal-scroll-bar}.
1388 1394
1389@item @var{portion} 1395@item @var{portion}
1390This is the distance of the click from the top or left end of 1396The number of pixels from the top of the scroll bar to the click
1391the scroll bar. 1397position. On some toolkits, including GTK+, Emacs cannot extract this
1398data, so the value is always @code{0}.
1392 1399
1393@item @var{whole} 1400@item @var{whole}
1394This is the length of the entire scroll bar. 1401The total length, in pixels, of the scroll bar. On some toolkits,
1402including GTK+, Emacs cannot extract this data, so the value is always
1403@code{0}.
1395 1404
1396@item @var{timestamp} 1405@item @var{timestamp}
1397This is the time at which the event occurred, in milliseconds. 1406The time at which the event occurred, in milliseconds. On some
1407toolkits, including GTK+, Emacs cannot extract this data, so the value
1408is always @code{0}.
1398 1409
1399@item @var{part} 1410@item @var{part}
1400This is the part of the scroll-bar which was clicked on. It is one 1411The part of the scroll bar on which the click occurred. It is one of
1401of the symbols @code{above-handle}, @code{handle}, @code{below-handle}, 1412the symbols @code{handle} (the scroll bar handle), @code{above-handle}
1402@code{up}, @code{down}, @code{top}, @code{bottom}, and @code{end-scroll}. 1413(the area above the handle), @code{below-handle} (the area below the
1414handle), @code{up} (the up arrow at one end of the scroll bar), or
1415@code{down} (the down arrow at one end of the scroll bar).
1416@c The `top', `bottom', and `end-scroll' codes don't seem to be used.
1403@end table 1417@end table
1404 1418
1405@item @var{click-count}
1406This is the number of rapid repeated presses so far of the same mouse
1407button. @xref{Repeat Events}.
1408@end table
1409 1419
1410@node Drag Events 1420@node Drag Events
1411@subsection Drag Events 1421@subsection Drag Events
@@ -1429,10 +1439,9 @@ For a drag event, the name of the symbol @var{event-type} contains the
1429prefix @samp{drag-}. For example, dragging the mouse with button 2 1439prefix @samp{drag-}. For example, dragging the mouse with button 2
1430held down generates a @code{drag-mouse-2} event. The second and third 1440held down generates a @code{drag-mouse-2} event. The second and third
1431elements of the event give the starting and ending position of the 1441elements of the event give the starting and ending position of the
1432drag. They have the same form as @var{position} in a click event 1442drag, as mouse position lists (@pxref{Click Events}). You can access
1433(@pxref{Click Events}) that is not on the scroll bar part of the 1443the second element of any mouse event in the same way, with no need to
1434window. You can access the second element of any mouse event in the 1444distinguish drag events from others.
1435same way, with no need to distinguish drag events from others.
1436 1445
1437The @samp{drag-} prefix follows the modifier key prefixes such as 1446The @samp{drag-} prefix follows the modifier key prefixes such as
1438@samp{C-} and @samp{M-}. 1447@samp{C-} and @samp{M-}.
@@ -1575,13 +1584,14 @@ represented by lists that look like this:
1575(mouse-movement POSITION) 1584(mouse-movement POSITION)
1576@end example 1585@end example
1577 1586
1578The second element of the list describes the current position of the 1587@noindent
1579mouse, just as in a click event (@pxref{Click Events}). 1588@var{position} is a mouse position list (@pxref{Click Events}),
1589specifying the current position of the mouse cursor.
1580 1590
1581The special form @code{track-mouse} enables generation of motion events 1591The special form @code{track-mouse} enables generation of motion
1582within its body. Outside of @code{track-mouse} forms, Emacs does not 1592events within its body. Outside of @code{track-mouse} forms, Emacs
1583generate events for mere motion of the mouse, and these events do not 1593does not generate events for mere motion of the mouse, and these
1584appear. @xref{Mouse Tracking}. 1594events do not appear. @xref{Mouse Tracking}.
1585 1595
1586@node Focus Events 1596@node Focus Events
1587@subsection Focus Events 1597@subsection Focus Events
@@ -1648,13 +1658,11 @@ frame has already been made visible, Emacs has no work to do.
1648@cindex @code{wheel-up} event 1658@cindex @code{wheel-up} event
1649@cindex @code{wheel-down} event 1659@cindex @code{wheel-down} event
1650@item (wheel-up @var{position}) 1660@item (wheel-up @var{position})
1651@item (wheel-down @var{position}) 1661@itemx (wheel-down @var{position})
1652These kinds of event are generated by moving a mouse wheel. Their 1662These kinds of event are generated by moving a mouse wheel. The
1653usual meaning is a kind of scroll or zoom. 1663@var{position} element is a mouse position list (@pxref{Click
1654 1664Events}), specifying the position of the mouse cursor when the event
1655The element @var{position} is a list describing the position of the 1665occurred.
1656event, in the same format as used in a mouse-click event (@pxref{Click
1657Events}).
1658 1666
1659@vindex mouse-wheel-up-event 1667@vindex mouse-wheel-up-event
1660@vindex mouse-wheel-down-event 1668@vindex mouse-wheel-down-event
@@ -1922,14 +1930,8 @@ must be the last element of the list. For example,
1922 This section describes convenient functions for accessing the data in 1930 This section describes convenient functions for accessing the data in
1923a mouse button or motion event. 1931a mouse button or motion event.
1924 1932
1925 These two functions return the starting or ending position of a 1933 The following two functions return a mouse position list
1926mouse-button event, as a list of this form (@pxref{Click Events}): 1934(@pxref{Click Events}), specifying the position of a mouse event.
1927
1928@example
1929(@var{window} @var{pos-or-area} (@var{x} . @var{y}) @var{timestamp}
1930 @var{object} @var{text-pos} (@var{col} . @var{row})
1931 @var{image} (@var{dx} . @var{dy}) (@var{width} . @var{height}))
1932@end example
1933 1935
1934@defun event-start event 1936@defun event-start event
1935This returns the starting position of @var{event}. 1937This returns the starting position of @var{event}.
@@ -1948,9 +1950,15 @@ event, the value is actually the starting position, which is the only
1948position such events have. 1950position such events have.
1949@end defun 1951@end defun
1950 1952
1953@defun posnp object
1954This function returns non-@code{nil} if @var{object} is a mouse
1955oposition list, in either of the formats documented in @ref{Click
1956Events}); and @code{nil} otherwise.
1957@end defun
1958
1951@cindex mouse position list, accessing 1959@cindex mouse position list, accessing
1952 These functions take a position list as described above, and 1960 These functions take a mouse position list as argument, and return
1953return various parts of it. 1961various parts of it:
1954 1962
1955@defun posn-window position 1963@defun posn-window position
1956Return the window that @var{position} is in. 1964Return the window that @var{position} is in.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index db770616820..d46cb071bf7 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -516,6 +516,7 @@ Functions
516* Obsolete Functions:: Declaring functions obsolete. 516* Obsolete Functions:: Declaring functions obsolete.
517* Inline Functions:: Defining functions that the compiler 517* Inline Functions:: Defining functions that the compiler
518 will expand inline. 518 will expand inline.
519* Declare Form:: Adding additional information about a function.
519* Declaring Functions:: Telling the compiler that a function is defined. 520* Declaring Functions:: Telling the compiler that a function is defined.
520* Function Safety:: Determining whether a function is safe to call. 521* Function Safety:: Determining whether a function is safe to call.
521* Related Topics:: Cross-references to specific Lisp primitives 522* Related Topics:: Cross-references to specific Lisp primitives
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index a822a2d9608..b7b26c8708c 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -37,78 +37,69 @@ handled.
37 37
38@table @code 38@table @code
39@item error 39@item error
40@code{"error"}@* 40The message is @samp{error}. @xref{Errors}.
41@xref{Errors}.
42 41
43@item quit 42@item quit
44@code{"Quit"}@* 43The message is @samp{Quit}. @xref{Quitting}.
45@xref{Quitting}.
46 44
47@item args-out-of-range 45@item args-out-of-range
48@code{"Args out of range"}@* 46The message is @samp{Args out of range}. This happens when trying to
49This happens when trying to access an element beyond the range of a 47access an element beyond the range of a sequence, buffer, or other
50sequence or buffer.@* 48container-like object. @xref{Sequences Arrays Vectors}, and
51@xref{Sequences Arrays Vectors}, @xref{Text}. 49@xref{Text}.
52 50
53@item arith-error 51@item arith-error
54@code{"Arithmetic error"}@* 52The message is @samp{Arithmetic error}. This occurs when trying to
53perform integer division by zero. @xref{Numeric Conversions}, and
55@xref{Arithmetic Operations}. 54@xref{Arithmetic Operations}.
56 55
57@item beginning-of-buffer 56@item beginning-of-buffer
58@code{"Beginning of buffer"}@* 57The message is @samp{Beginning of buffer}. @xref{Character Motion}.
59@xref{Character Motion}.
60 58
61@item buffer-read-only 59@item buffer-read-only
62@code{"Buffer is read-only"}@* 60The message is @samp{Buffer is read-only}. @xref{Read Only Buffers}.
63@xref{Read Only Buffers}.
64 61
65@item circular-list 62@item circular-list
66@code{"List contains a loop"}@* 63The message is @samp{List contains a loop}. This happens when a
67This happens when some operations (e.g. resolving face names) 64circular structure is encountered. @xref{Circular Objects}.
68encounter circular structures.@*
69@xref{Circular Objects}.
70 65
71@item cl-assertion-failed 66@item cl-assertion-failed
72@code{"Assertion failed"}@* 67The message is @samp{Assertion failed}. This happens when the
73This happens when the @code{assert} macro fails a test.@* 68@code{assert} macro fails a test. @xref{Assertions,,, cl, Common Lisp
74@xref{Assertions,,, cl, Common Lisp Extensions}. 69Extensions}.
75 70
76@item coding-system-error 71@item coding-system-error
77@code{"Invalid coding system"}@* 72The message is @samp{Invalid coding system}. @xref{Lisp and Coding
78@xref{Lisp and Coding Systems}. 73Systems}.
79 74
80@item cyclic-function-indirection 75@item cyclic-function-indirection
81@code{"Symbol's chain of function indirections contains a loop"}@* 76The message is @samp{Symbol's chain of function indirections contains
82@xref{Function Indirection}. 77a loop}. @xref{Function Indirection}.
83 78
84@item cyclic-variable-indirection 79@item cyclic-variable-indirection
85@code{"Symbol's chain of variable indirections contains a loop"}@* 80The message is @samp{Symbol's chain of variable indirections contains
86@xref{Variable Aliases}. 81a loop}. @xref{Variable Aliases}.
87 82
88@item dbus-error 83@item dbus-error
89@code{"D-Bus error"}@* 84The message is @samp{D-Bus error}. This is only defined if Emacs was
90This is only defined if Emacs was compiled with D-Bus support.@* 85compiled with D-Bus support. @xref{Errors and Events,,, dbus, D-Bus
91@xref{Errors and Events,,, dbus, D-Bus integration in Emacs}. 86integration in Emacs}.
92 87
93@item end-of-buffer 88@item end-of-buffer
94@code{"End of buffer"}@* 89The message is @samp{End of buffer}. @xref{Character Motion}.
95@xref{Character Motion}.
96 90
97@item end-of-file 91@item end-of-file
98@code{"End of file during parsing"}@* 92The message is @samp{End of file during parsing}. Note that this is
99Note that this is not a subcategory of @code{file-error}, 93not a subcategory of @code{file-error}, because it pertains to the
100because it pertains to the Lisp reader, not to file I/O.@* 94Lisp reader, not to file I/O. @xref{Input Functions}.
101@xref{Input Functions}.
102 95
103@item file-already-exists 96@item file-already-exists
104This is a subcategory of @code{file-error}.@* 97This is a subcategory of @code{file-error}. @xref{Writing to Files}.
105@xref{Writing to Files}.
106 98
107@item file-date-error 99@item file-date-error
108This is a subcategory of @code{file-error}. It occurs when 100This is a subcategory of @code{file-error}. It occurs when
109@code{copy-file} tries and fails to set the last-modification time of 101@code{copy-file} tries and fails to set the last-modification time of
110the output file.@* 102the output file. @xref{Changing Files}.
111@xref{Changing Files}.
112 103
113@item file-error 104@item file-error
114We do not list the error-strings of this error and its subcategories, 105We do not list the error-strings of this error and its subcategories,
@@ -116,122 +107,109 @@ because the error message is normally constructed from the data items
116alone when the error condition @code{file-error} is present. Thus, 107alone when the error condition @code{file-error} is present. Thus,
117the error-strings are not very relevant. However, these error symbols 108the error-strings are not very relevant. However, these error symbols
118do have @code{error-message} properties, and if no data is provided, 109do have @code{error-message} properties, and if no data is provided,
119the @code{error-message} property @emph{is} used.@* 110the @code{error-message} property @emph{is} used. @xref{Files}.
120@xref{Files}.
121 111
122@c jka-compr.el 112@c jka-compr.el
123@item compression-error 113@item compression-error
124This is a subcategory of @code{file-error}, which results from 114This is a subcategory of @code{file-error}, which results from
125problems handling a compressed file.@* 115problems handling a compressed file. @xref{How Programs Do Loading}.
126@xref{How Programs Do Loading}.
127 116
128@c userlock.el 117@c userlock.el
129@item file-locked 118@item file-locked
130This is a subcategory of @code{file-error}.@* 119This is a subcategory of @code{file-error}. @xref{File Locks}.
131@xref{File Locks}.
132 120
133@c userlock.el 121@c userlock.el
134@item file-supersession 122@item file-supersession
135This is a subcategory of @code{file-error}.@* 123This is a subcategory of @code{file-error}. @xref{Modification Time}.
136@xref{Modification Time}.
137 124
138@c net/ange-ftp.el 125@c net/ange-ftp.el
139@item ftp-error 126@item ftp-error
140This is a subcategory of @code{file-error}, which results from problems 127This is a subcategory of @code{file-error}, which results from
141in accessing a remote file using ftp.@* 128problems in accessing a remote file using ftp. @xref{Remote Files,,,
142@xref{Remote Files,,, emacs, The GNU Emacs Manual}. 129emacs, The GNU Emacs Manual}.
143 130
144@item invalid-function 131@item invalid-function
145@code{"Invalid function"}@* 132The message is @samp{Invalid function}. @xref{Function Indirection}.
146@xref{Function Indirection}.
147 133
148@item invalid-read-syntax 134@item invalid-read-syntax
149@code{"Invalid read syntax"}@* 135The message is @samp{Invalid read syntax}. @xref{Printed
150@xref{Printed Representation}. 136Representation}.
151 137
152@item invalid-regexp 138@item invalid-regexp
153@code{"Invalid regexp"}@* 139The message is @samp{Invalid regexp}. @xref{Regular Expressions}.
154@xref{Regular Expressions}.
155 140
156@c simple.el 141@c simple.el
157@item mark-inactive 142@item mark-inactive
158@code{"The mark is not active now"}@* 143The message is @samp{The mark is not active now}. @xref{The Mark}.
159@xref{The Mark}.
160 144
161@item no-catch 145@item no-catch
162@code{"No catch for tag"}@* 146The message is @samp{No catch for tag}. @xref{Catch and Throw}.
163@xref{Catch and Throw}.
164 147
165@ignore 148@ignore
166@c Not actually used for anything? Probably definition should be removed. 149@c Not actually used for anything? Probably definition should be removed.
167@item protected-field 150@item protected-field
168@code{"Attempt to modify a protected field"} 151The message is @samp{Attempt to modify a protected fiel.
169@end ignore 152@end ignore
170 153
171@item scan-error 154@item scan-error
172@code{"Scan error"}@* 155The message is @samp{Scan error}. This happens when certain
173This happens when certain syntax-parsing functions 156syntax-parsing functions find invalid syntax or mismatched
174find invalid syntax or mismatched parentheses.@* 157parentheses. @xref{List Motion}, and @xref{Parsing Expressions}.
175@xref{List Motion}, and @ref{Parsing Expressions}.
176 158
177@item search-failed 159@item search-failed
178@code{"Search failed"}@* 160The message is @samp{Search failed}. @xref{Searching and Matching}.
179@xref{Searching and Matching}.
180 161
181@item setting-constant 162@item setting-constant
182@code{"Attempt to set a constant symbol"}@* 163The message is @samp{Attempt to set a constant symbol}. This happens
183The values of the symbols @code{nil} and @code{t}, 164when attempting to assign values to @code{nil}, @code{t}, and keyword
184and any symbols that start with @samp{:}, 165symbols. @xref{Constant Variables}.
185may not be changed.@*
186@xref{Constant Variables, , Variables that Never Change}.
187 166
188@c simple.el 167@c simple.el
189@item text-read-only 168@item text-read-only
190@code{"Text is read-only"}@* 169The message is @samp{Text is read-only}. This is a subcategory of
191This is a subcategory of @code{buffer-read-only}.@* 170@code{buffer-read-only}. @xref{Special Properties}.
192@xref{Special Properties}.
193 171
194@item undefined-color 172@item undefined-color
195@code{"Undefined color"}@* 173The message is @samp{Undefined color}. @xref{Color Names}.
196@xref{Color Names}.
197 174
198@item void-function 175@item void-function
199@code{"Symbol's function definition is void"}@* 176The message is @samp{Symbol's function definition is void}.
200@xref{Function Cells}. 177@xref{Function Cells}.
201 178
202@item void-variable 179@item void-variable
203@code{"Symbol's value as variable is void"}@* 180The message is @samp{Symbol's value as variable is void}.
204@xref{Accessing Variables}. 181@xref{Accessing Variables}.
205 182
206@item wrong-number-of-arguments 183@item wrong-number-of-arguments
207@code{"Wrong number of arguments"}@* 184The message is @samp{Wrong number of arguments}. @xref{Classifying
208@xref{Classifying Lists}. 185Lists}.
209 186
210@item wrong-type-argument 187@item wrong-type-argument
211@code{"Wrong type argument"}@* 188The message is @samp{Wrong type argument}. @xref{Type Predicates}.
212@xref{Type Predicates}.
213@end table 189@end table
214 190
191@ignore The following seem to be unused now.
215 The following kinds of error, which are classified as special cases of 192 The following kinds of error, which are classified as special cases of
216@code{arith-error}, can occur on certain systems for invalid use of 193@code{arith-error}, can occur on certain systems for invalid use of
217mathematical functions. @xref{Math Functions}. 194mathematical functions. @xref{Math Functions}.
218 195
219@table @code 196@table @code
220@item domain-error 197@item domain-error
221@code{"Arithmetic domain error"} 198The message is @samp{Arithmetic domain error}.
222 199
223@item overflow-error 200@item overflow-error
224@code{"Arithmetic overflow error"}@* 201The message is @samp{Arithmetic overflow error}. This is a subcategory
225This is a subcategory of @code{domain-error}. 202of @code{domain-error}.
226 203
227@item range-error 204@item range-error
228@code{"Arithmetic range error"} 205The message is @code{Arithmetic range error}.
229 206
230@item singularity-error 207@item singularity-error
231@code{"Arithmetic singularity error"}@* 208The mssage is @samp{Arithmetic singularity error}. This is a
232This is a subcategory of @code{domain-error}. 209subcategory of @code{domain-error}.
233 210
234@item underflow-error 211@item underflow-error
235@code{"Arithmetic underflow error"}@* 212The message is @samp{Arithmetic underflow error}. This is a
236This is a subcategory of @code{domain-error}. 213subcategory of @code{domain-error}.
237@end table 214@end table
215@end ignore
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 56971bf0ff0..9424a661236 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -29,7 +29,7 @@ arguments, except where noted. @xref{Magic File Names}, for details.
29 When file I/O functions signal Lisp errors, they usually use the 29 When file I/O functions signal Lisp errors, they usually use the
30condition @code{file-error} (@pxref{Handling Errors}). The error 30condition @code{file-error} (@pxref{Handling Errors}). The error
31message is in most cases obtained from the operating system, according 31message is in most cases obtained from the operating system, according
32to locale @code{system-message-locale}, and decoded using coding system 32to locale @code{system-messages-locale}, and decoded using coding system
33@code{locale-coding-system} (@pxref{Locales}). 33@code{locale-coding-system} (@pxref{Locales}).
34 34
35@menu 35@menu
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 356a891fbcd..af6f4b4c079 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1529,24 +1529,14 @@ track of such changes. @xref{Misc Events}.
1529@node Raising and Lowering 1529@node Raising and Lowering
1530@section Raising and Lowering Frames 1530@section Raising and Lowering Frames
1531 1531
1532 Most window systems use a desktop metaphor. Part of this metaphor is 1532@cindex raising a frame
1533the idea that windows are stacked in a notional third dimension
1534perpendicular to the screen surface, and thus ordered from ``highest''
1535to ``lowest''. Where two windows overlap, the one higher up covers
1536the one underneath. Even a window at the bottom of the stack can be
1537seen if no other window overlaps it.
1538
1539@c @cindex raising a frame redundant with raise-frame
1540@cindex lowering a frame 1533@cindex lowering a frame
1541 A window's place in this ordering is not fixed; in fact, users tend 1534 Most window systems use a desktop metaphor. Part of this metaphor
1542to change the order frequently. @dfn{Raising} a window means moving 1535is the idea that system-level windows (e.g.@: Emacs frames) are
1543it ``up'', to the top of the stack. @dfn{Lowering} a window means 1536stacked in a notional third dimension perpendicular to the screen
1544moving it to the bottom of the stack. This motion is in the notional 1537surface. Where two overlap, the one higher up covers the one
1545third dimension only, and does not change the position of the window 1538underneath. You can @dfn{raise} or @dfn{lower} a frame using the
1546on the screen. 1539functions @code{raise-frame} and @code{lower-frame}.
1547
1548 With Emacs, frames constitute the windows in the metaphor sketched
1549above. You can raise and lower frames using these functions:
1550 1540
1551@deffn Command raise-frame &optional frame 1541@deffn Command raise-frame &optional frame
1552This function raises frame @var{frame} (default, the selected frame). 1542This function raises frame @var{frame} (default, the selected frame).
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 9e1d3f9c6ae..cab6d12a3d8 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -23,6 +23,7 @@ define them.
23* Closures:: Functions that enclose a lexical environment. 23* Closures:: Functions that enclose a lexical environment.
24* Obsolete Functions:: Declaring functions obsolete. 24* Obsolete Functions:: Declaring functions obsolete.
25* Inline Functions:: Functions that the compiler will expand inline. 25* Inline Functions:: Functions that the compiler will expand inline.
26* Declare Form:: Adding additional information about a function.
26* Declaring Functions:: Telling the compiler that a function is defined. 27* Declaring Functions:: Telling the compiler that a function is defined.
27* Function Safety:: Determining whether a function is safe to call. 28* Function Safety:: Determining whether a function is safe to call.
28* Related Topics:: Cross-references to specific Lisp primitives 29* Related Topics:: Cross-references to specific Lisp primitives
@@ -521,7 +522,7 @@ Scheme.)
521is called @dfn{defining a function}, and it is done with the 522is called @dfn{defining a function}, and it is done with the
522@code{defun} special form. 523@code{defun} special form.
523 524
524@defspec defun name argument-list body-forms... 525@defmac defun name argument-list body-forms...
525@code{defun} is the usual way to define new Lisp functions. It 526@code{defun} is the usual way to define new Lisp functions. It
526defines the symbol @var{name} as a function that looks like this: 527defines the symbol @var{name} as a function that looks like this:
527 528
@@ -578,7 +579,7 @@ without any hesitation or notification. Emacs does not prevent you
578from doing this, because redefining a function is sometimes done 579from doing this, because redefining a function is sometimes done
579deliberately, and there is no way to distinguish deliberate 580deliberately, and there is no way to distinguish deliberate
580redefinition from unintentional redefinition. 581redefinition from unintentional redefinition.
581@end defspec 582@end defmac
582 583
583@cindex function aliases 584@cindex function aliases
584@defun defalias name definition &optional docstring 585@defun defalias name definition &optional docstring
@@ -1132,29 +1133,46 @@ examining or altering the structure of closure objects.
1132@node Obsolete Functions 1133@node Obsolete Functions
1133@section Declaring Functions Obsolete 1134@section Declaring Functions Obsolete
1134 1135
1135You can use @code{make-obsolete} to declare a function obsolete. This 1136 You can mark a named function as @dfn{obsolete}, meaning that it may
1136indicates that the function may be removed at some stage in the future. 1137be removed at some point in the future. This causes Emacs to warn
1138that the function is obsolete whenever it byte-compiles code
1139containing that function, and whenever it displays the documentation
1140for that function. In all other respects, an obsolete function
1141behaves like any other function.
1142
1143 The easiest way to mark a function as obsolete is to put a
1144@code{(declare (obsolete @dots{}))} form in the function's
1145@code{defun} definition. @xref{Declare Form}. Alternatively, you can
1146use the @code{make-obsolete} function, described below.
1147
1148 A macro (@pxref{Macros}) can also be marked obsolete with
1149@code{make-obsolete}; this has the same effects as for a function. An
1150alias for a function or macro can also be marked as obsolete; this
1151makes the alias itself obsolete, not the function or macro which it
1152resolves to.
1137 1153
1138@defun make-obsolete obsolete-name current-name &optional when 1154@defun make-obsolete obsolete-name current-name &optional when
1139This function makes the byte compiler warn that the function 1155This function marks @var{obsolete-name} as obsolete.
1140@var{obsolete-name} is obsolete. If @var{current-name} is a symbol, the 1156@var{obsolete-name} should be a symbol naming a function or macro, or
1141warning message says to use @var{current-name} instead of 1157an alias for a function or macro.
1142@var{obsolete-name}. @var{current-name} does not need to be an alias for 1158
1143@var{obsolete-name}; it can be a different function with similar 1159If @var{current-name} is a symbol, the warning message says to use
1144functionality. If @var{current-name} is a string, it is the warning 1160@var{current-name} instead of @var{obsolete-name}. @var{current-name}
1145message. 1161does not need to be an alias for @var{obsolete-name}; it can be a
1162different function with similar functionality. @var{current-name} can
1163also be a string, which serves as the warning message. The message
1164should begin in lower case, and end with a period. It can also be
1165@code{nil}, in which case the warning message provides no additional
1166details.
1146 1167
1147If provided, @var{when} should be a string indicating when the function 1168If provided, @var{when} should be a string indicating when the function
1148was first made obsolete---for example, a date or a release number. 1169was first made obsolete---for example, a date or a release number.
1149@end defun 1170@end defun
1150 1171
1151You can define a function as an alias and declare it obsolete at the
1152same time using the macro @code{define-obsolete-function-alias}:
1153
1154@defmac define-obsolete-function-alias obsolete-name current-name &optional when docstring 1172@defmac define-obsolete-function-alias obsolete-name current-name &optional when docstring
1155This macro marks the function @var{obsolete-name} obsolete and also 1173This convenience macro marks the function @var{obsolete-name} obsolete
1156defines it as an alias for the function @var{current-name}. It is 1174and also defines it as an alias for the function @var{current-name}.
1157equivalent to the following: 1175It is equivalent to the following:
1158 1176
1159@example 1177@example
1160(defalias @var{obsolete-name} @var{current-name} @var{docstring}) 1178(defalias @var{obsolete-name} @var{current-name} @var{docstring})
@@ -1236,6 +1254,63 @@ body uses the arguments, as you do for macros.
1236 After an inline function is defined, its inline expansion can be 1254 After an inline function is defined, its inline expansion can be
1237performed later on in the same file, just like macros. 1255performed later on in the same file, just like macros.
1238 1256
1257@node Declare Form
1258@section The @code{declare} Form
1259@findex declare
1260
1261 @code{declare} is a special macro which can be used to add ``meta''
1262properties to a function or macro: for example, marking it as
1263obsolete, or giving its forms a special @key{TAB} indentation
1264convention in Emacs Lisp mode.
1265
1266@anchor{Definition of declare}
1267@defmac declare @var{specs}@dots{}
1268This macro ignores its arguments and evaluates to @code{nil}; it has
1269no run-time effect. However, when a @code{declare} form occurs as the
1270@emph{very first form} in the body of a @code{defun} function
1271definition or a @code{defmacro} macro definition (@pxref{Defining
1272Macros}, for a description of @code{defmacro}), it appends the
1273properties specified by @var{specs} to the function or macro. This
1274work is specially performed by the @code{defun} and @code{defmacro}
1275macros.
1276
1277Note that if you put a @code{declare} form in an interactive function,
1278it should go before the @code{interactive} form.
1279
1280Each element in @var{specs} should have the form @code{(@var{property}
1281@var{args}@dots{})}, which should not be quoted. These have the
1282following effects:
1283
1284@table @code
1285@item (advertised-calling-convention @var{signature} @var{when})
1286This acts like a call to @code{set-advertised-calling-convention}
1287(@pxref{Obsolete Functions}); @var{signature} specifies the correct
1288argument list for calling the function or macro, and @var{when} should
1289be a string indicating when the variable was first made obsolete.
1290
1291@item (debug @var{edebug-form-spec})
1292This is valid for macros only. When stepping through the macro with
1293Edebug, use @var{edebug-form-spec}. @xref{Instrumenting Macro Calls}.
1294
1295@item (doc-string @var{n})
1296Use element number @var{n}, if any, as the documentation string.
1297
1298@item (indent @var{indent-spec})
1299Indent calls to this function or macro according to @var{indent-spec}.
1300This is typically used for macros, though it works for functions too.
1301@xref{Indenting Macros}.
1302
1303@item (obsolete @var{current-name} @var{when})
1304Mark the function or macro as obsolete, similar to a call to
1305@code{make-obsolete} (@pxref{Obsolete Functions}). @var{current-name}
1306should be a symbol (in which case the warning message says to use that
1307instead), a string (specifying the warning message), or @code{nil} (in
1308which case the warning message gives no extra details). @var{when}
1309should be a string indicating when the function or macro was first
1310made obsolete.
1311@end table
1312@end defmac
1313
1239@node Declaring Functions 1314@node Declaring Functions
1240@section Telling the Compiler that a Function is Defined 1315@section Telling the Compiler that a Function is Defined
1241@cindex function declaration 1316@cindex function declaration
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 5dd8f3c11f5..1375a057a5a 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -58,11 +58,17 @@ use @kbd{C-h f} (@code{describe-function}) or @kbd{C-h v}
58are many other conventions for documentation strings; see 58are many other conventions for documentation strings; see
59@ref{Documentation Tips}. 59@ref{Documentation Tips}.
60 60
61 Documentation strings can contain several special substrings, which 61 Documentation strings can contain several special text sequences,
62stand for key bindings to be looked up in the current keymaps when the 62referring to key bindings which are looked up in the current keymaps
63documentation is displayed. This allows documentation strings to refer 63when the user views the documentation. This allows the help commands
64to the keys for related commands and be accurate even when a user 64to display the correct keys even if a user rearranges the default key
65rearranges the key bindings. (@xref{Keys in Documentation}.) 65bindings. @xref{Keys in Documentation}.
66
67 In the documentation string of an autoloaded command
68(@pxref{Autoload}), these special text sequences have an additional
69special effect: they cause @kbd{C-h f} (@code{describe-function}) on
70the command to trigger autoloading. (This is needed for correctly
71setting up the hyperlinks in the @file{*Help*} buffer).
66 72
67@vindex emacs-lisp-docstring-fill-column 73@vindex emacs-lisp-docstring-fill-column
68 Emacs Lisp mode fills documentation strings to the width 74 Emacs Lisp mode fills documentation strings to the width
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index f6ec0ae5e55..40dfcaea043 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -2288,12 +2288,12 @@ command but with different enable conditions. The best way to do this
2288in Emacs now is with extended menu items; before that feature existed, 2288in Emacs now is with extended menu items; before that feature existed,
2289it could be done by defining alias commands and using them in menu 2289it could be done by defining alias commands and using them in menu
2290items. Here's an example that makes two aliases for 2290items. Here's an example that makes two aliases for
2291@code{toggle-read-only} and gives them different enable conditions: 2291@code{read-only-mode} and gives them different enable conditions:
2292 2292
2293@example 2293@example
2294(defalias 'make-read-only 'toggle-read-only) 2294(defalias 'make-read-only 'read-only-mode)
2295(put 'make-read-only 'menu-enable '(not buffer-read-only)) 2295(put 'make-read-only 'menu-enable '(not buffer-read-only))
2296(defalias 'make-writable 'toggle-read-only) 2296(defalias 'make-writable 'read-only-mode)
2297(put 'make-writable 'menu-enable 'buffer-read-only) 2297(put 'make-writable 'menu-enable 'buffer-read-only)
2298@end example 2298@end example
2299 2299
@@ -2310,7 +2310,7 @@ itself). To request this, give the alias symbol a non-@code{nil}
2310 2310
2311@noindent 2311@noindent
2312causes menu items for @code{make-read-only} and @code{make-writable} to 2312causes menu items for @code{make-read-only} and @code{make-writable} to
2313show the keyboard bindings for @code{toggle-read-only}. 2313show the keyboard bindings for @code{read-only-mode}.
2314 2314
2315@node Toolkit Differences 2315@node Toolkit Differences
2316@subsubsection Toolkit Differences 2316@subsubsection Toolkit Differences
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 3c9bee96639..aa243185359 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -384,11 +384,13 @@ non-@acronym{ASCII} characters written as @code{?v@var{literal}}.
384@section Autoload 384@section Autoload
385@cindex autoload 385@cindex autoload
386 386
387 The @dfn{autoload} facility allows you to register the existence of 387 The @dfn{autoload} facility lets you register the existence of a
388a function or macro, but put off loading the file that defines it. 388function or macro, but put off loading the file that defines it. The
389The first call to the function automatically reads the proper file, in 389first call to the function automatically loads the proper library, in
390order to install the real definition and other associated code, then 390order to install the real definition and other associated code, then
391runs the real definition as if it had been loaded all along. 391runs the real definition as if it had been loaded all along.
392Autoloading can also be triggered by looking up the documentation of
393the function or macro (@pxref{Documentation Basics}).
392 394
393 There are two ways to set up an autoloaded function: by calling 395 There are two ways to set up an autoloaded function: by calling
394@code{autoload}, and by writing a special ``magic'' comment in the 396@code{autoload}, and by writing a special ``magic'' comment in the
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi
index efe298bf647..0a5152a43a1 100644
--- a/doc/lispref/macros.texi
+++ b/doc/lispref/macros.texi
@@ -235,43 +235,8 @@ of constants and nonconstant parts. To make this easier, use the
235@end example 235@end example
236 236
237 The body of a macro definition can include a @code{declare} form, 237 The body of a macro definition can include a @code{declare} form,
238which can specify how @key{TAB} should indent macro calls, and how to 238which specifies additional properties about the macro. @xref{Declare
239step through them for Edebug. 239Form}.
240
241@defmac declare @var{specs}@dots{}
242@anchor{Definition of declare}
243A @code{declare} form is used in a macro definition to specify various
244additional information about it. The following specifications are
245currently supported:
246
247@table @code
248@item (debug @var{edebug-form-spec})
249Specify how to step through macro calls for Edebug.
250@xref{Instrumenting Macro Calls}.
251
252@item (indent @var{indent-spec})
253Specify how to indent calls to this macro. @xref{Indenting Macros},
254for more details.
255
256@item (doc-string @var{number})
257Specify which element of the macro is the documentation string, if
258any.
259@end table
260
261A @code{declare} form only has its special effect in the body of a
262@code{defmacro} form if it immediately follows the documentation
263string, if present, or the argument list otherwise. (Strictly
264speaking, @emph{several} @code{declare} forms can follow the
265documentation string or argument list, but since a @code{declare} form
266can have several @var{specs}, they can always be combined into a
267single form.) When used at other places in a @code{defmacro} form, or
268outside a @code{defmacro} form, @code{declare} just returns @code{nil}
269without evaluating any @var{specs}.
270@end defmac
271
272 No macro absolutely needs a @code{declare} form, because that form
273has no effect on how the macro expands, on what the macro means in the
274program. It only affects the secondary features listed above.
275 240
276@node Problems with Macros 241@node Problems with Macros
277@section Common Problems Using Macros 242@section Common Problems Using Macros
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index 7c9672a38c0..a086f2b3af1 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -48,9 +48,8 @@ to
48@tex 48@tex
49@math{2^{29}-1}), 49@math{2^{29}-1}),
50@end tex 50@end tex
51but some machines provide a wider range. Many examples in this 51but many machines provide a wider range. Many examples in this
52chapter assume that an integer has 30 bits and that floating point 52chapter assume the minimum integer width of 30 bits.
53numbers are IEEE double precision.
54@cindex overflow 53@cindex overflow
55 54
56 The Lisp reader reads an integer as a sequence of digits with optional 55 The Lisp reader reads an integer as a sequence of digits with optional
@@ -160,8 +159,9 @@ The value of this variable is the smallest integer that Emacs Lisp can
160handle. It is negative. 159handle. It is negative.
161@end defvar 160@end defvar
162 161
163 @xref{Character Codes, max-char}, for the maximum value of a valid 162 In Emacs Lisp, text characters are represented by integers. Any
164character codepoint. 163integer between zero and the value of @code{max-char}, inclusive, is
164considered to be valid as a character. @xref{String Basics}.
165 165
166@node Float Basics 166@node Float Basics
167@section Floating Point Basics 167@section Floating Point Basics
@@ -171,8 +171,8 @@ character codepoint.
171not integral. The precise range of floating point numbers is 171not integral. The precise range of floating point numbers is
172machine-specific; it is the same as the range of the C data type 172machine-specific; it is the same as the range of the C data type
173@code{double} on the machine you are using. Emacs uses the 173@code{double} on the machine you are using. Emacs uses the
174@acronym{IEEE} floating point standard where possible (the standard is 174@acronym{IEEE} floating point standard, which is supported by all
175supported by most modern computers). 175modern computers.
176 176
177 The read syntax for floating point numbers requires either a decimal 177 The read syntax for floating point numbers requires either a decimal
178point (with at least one digit following), an exponent, or both. For 178point (with at least one digit following), an exponent, or both. For
@@ -316,17 +316,16 @@ compare them, then you test whether two values are the same
316@emph{object}. By contrast, @code{=} compares only the numeric values 316@emph{object}. By contrast, @code{=} compares only the numeric values
317of the objects. 317of the objects.
318 318
319 At present, each integer value has a unique Lisp object in Emacs Lisp. 319 In Emacs Lisp, each integer value is a unique Lisp object.
320Therefore, @code{eq} is equivalent to @code{=} where integers are 320Therefore, @code{eq} is equivalent to @code{=} where integers are
321concerned. It is sometimes convenient to use @code{eq} for comparing an 321concerned. It is sometimes convenient to use @code{eq} for comparing
322unknown value with an integer, because @code{eq} does not report an 322an unknown value with an integer, because @code{eq} does not report an
323error if the unknown value is not a number---it accepts arguments of any 323error if the unknown value is not a number---it accepts arguments of
324type. By contrast, @code{=} signals an error if the arguments are not 324any type. By contrast, @code{=} signals an error if the arguments are
325numbers or markers. However, it is a good idea to use @code{=} if you 325not numbers or markers. However, it is better programming practice to
326can, even for comparing integers, just in case we change the 326use @code{=} if you can, even for comparing integers.
327representation of integers in a future Emacs version. 327
328 328 Sometimes it is useful to compare numbers with @code{equal}, which
329 Sometimes it is useful to compare numbers with @code{equal}; it
330treats two numbers as equal if they have the same data type (both 329treats two numbers as equal if they have the same data type (both
331integers, or both floating point) and the same value. By contrast, 330integers, or both floating point) and the same value. By contrast,
332@code{=} can treat an integer and a floating point number as equal. 331@code{=} can treat an integer and a floating point number as equal.
@@ -439,15 +438,16 @@ If @var{number} is already a floating point number, @code{float} returns
439it unchanged. 438it unchanged.
440@end defun 439@end defun
441 440
442There are four functions to convert floating point numbers to integers; 441 There are four functions to convert floating point numbers to
443they differ in how they round. All accept an argument @var{number} 442integers; they differ in how they round. All accept an argument
444and an optional argument @var{divisor}. Both arguments may be 443@var{number} and an optional argument @var{divisor}. Both arguments
445integers or floating point numbers. @var{divisor} may also be 444may be integers or floating point numbers. @var{divisor} may also be
446@code{nil}. If @var{divisor} is @code{nil} or omitted, these 445@code{nil}. If @var{divisor} is @code{nil} or omitted, these
447functions convert @var{number} to an integer, or return it unchanged 446functions convert @var{number} to an integer, or return it unchanged
448if it already is an integer. If @var{divisor} is non-@code{nil}, they 447if it already is an integer. If @var{divisor} is non-@code{nil}, they
449divide @var{number} by @var{divisor} and convert the result to an 448divide @var{number} by @var{divisor} and convert the result to an
450integer. An @code{arith-error} results if @var{divisor} is 0. 449integer. integer. If @var{divisor} is zero (whether integer or
450floating-point), Emacs signals an @code{arith-error} error.
451 451
452@defun truncate number &optional divisor 452@defun truncate number &optional divisor
453This returns @var{number}, converted to an integer by rounding towards 453This returns @var{number}, converted to an integer by rounding towards
@@ -524,14 +524,12 @@ depending on your machine.
524@section Arithmetic Operations 524@section Arithmetic Operations
525@cindex arithmetic operations 525@cindex arithmetic operations
526 526
527 Emacs Lisp provides the traditional four arithmetic operations: 527 Emacs Lisp provides the traditional four arithmetic operations
528addition, subtraction, multiplication, and division. Remainder and modulus 528(addition, subtraction, multiplication, and division), as well as
529functions supplement the division functions. The functions to 529remainder and modulus functions, and functions to add or subtract 1.
530add or subtract 1 are provided because they are traditional in Lisp and 530Except for @code{%}, each of these functions accepts both integer and
531commonly used. 531floating point arguments, and returns a floating point number if any
532 532argument is a floating point number.
533 All of these functions except @code{%} return a floating point value
534if any argument is floating.
535 533
536 It is important to note that in Emacs Lisp, arithmetic functions 534 It is important to note that in Emacs Lisp, arithmetic functions
537do not check for overflow. Thus @code{(1+ 536870911)} may evaluate to 535do not check for overflow. Thus @code{(1+ 536870911)} may evaluate to
@@ -620,40 +618,49 @@ quotient. If there are additional arguments @var{divisors}, then it
620divides @var{dividend} by each divisor in turn. Each argument may be a 618divides @var{dividend} by each divisor in turn. Each argument may be a
621number or a marker. 619number or a marker.
622 620
623If all the arguments are integers, then the result is an integer too. 621If all the arguments are integers, the result is an integer, obtained
624This means the result has to be rounded. On most machines, the result 622by rounding the quotient towards zero after each division.
625is rounded towards zero after each division, but some machines may round 623(Hypothetically, some machines may have different rounding behavior
626differently with negative arguments. This is because the Lisp function 624for negative arguments, because @code{/} is implemented using the C
627@code{/} is implemented using the C division operator, which also 625division operator, which permits machine-dependent rounding; but this
628permits machine-dependent rounding. As a practical matter, all known 626does not happen in practice.)
629machines round in the standard fashion.
630
631@cindex @code{arith-error} in division
632If you divide an integer by 0, an @code{arith-error} error is signaled.
633(@xref{Errors}.) Floating point division by zero returns either
634infinity or a NaN if your machine supports @acronym{IEEE} floating point;
635otherwise, it signals an @code{arith-error} error.
636 627
637@example 628@example
638@group 629@group
639(/ 6 2) 630(/ 6 2)
640 @result{} 3 631 @result{} 3
641@end group 632@end group
633@group
642(/ 5 2) 634(/ 5 2)
643 @result{} 2 635 @result{} 2
636@end group
637@group
644(/ 5.0 2) 638(/ 5.0 2)
645 @result{} 2.5 639 @result{} 2.5
640@end group
641@group
646(/ 5 2.0) 642(/ 5 2.0)
647 @result{} 2.5 643 @result{} 2.5
644@end group
645@group
648(/ 5.0 2.0) 646(/ 5.0 2.0)
649 @result{} 2.5 647 @result{} 2.5
648@end group
649@group
650(/ 25 3 2) 650(/ 25 3 2)
651 @result{} 4 651 @result{} 4
652@end group
652@group 653@group
653(/ -17 6) 654(/ -17 6)
654 @result{} -2 @r{(could in theory be @minus{}3 on some machines)} 655 @result{} -2
655@end group 656@end group
656@end example 657@end example
658
659@cindex @code{arith-error} in division
660If you divide an integer by the integer 0, Emacs signals an
661@code{arith-error} error (@pxref{Errors}). If you divide a floating
662point number by 0, or divide by the floating point number 0.0, the
663result is either positive or negative infinity (@pxref{Float Basics}).
657@end defun 664@end defun
658 665
659@defun % dividend divisor 666@defun % dividend divisor
@@ -661,10 +668,18 @@ otherwise, it signals an @code{arith-error} error.
661This function returns the integer remainder after division of @var{dividend} 668This function returns the integer remainder after division of @var{dividend}
662by @var{divisor}. The arguments must be integers or markers. 669by @var{divisor}. The arguments must be integers or markers.
663 670
664For negative arguments, the remainder is in principle machine-dependent 671For any two integers @var{dividend} and @var{divisor},
665since the quotient is; but in practice, all known machines behave alike. 672
673@example
674@group
675(+ (% @var{dividend} @var{divisor})
676 (* (/ @var{dividend} @var{divisor}) @var{divisor}))
677@end group
678@end example
666 679
667An @code{arith-error} results if @var{divisor} is 0. 680@noindent
681always equals @var{dividend}. If @var{divisor} is zero, Emacs signals
682an @code{arith-error} error.
668 683
669@example 684@example
670(% 9 4) 685(% 9 4)
@@ -676,18 +691,6 @@ An @code{arith-error} results if @var{divisor} is 0.
676(% -9 -4) 691(% -9 -4)
677 @result{} -1 692 @result{} -1
678@end example 693@end example
679
680For any two integers @var{dividend} and @var{divisor},
681
682@example
683@group
684(+ (% @var{dividend} @var{divisor})
685 (* (/ @var{dividend} @var{divisor}) @var{divisor}))
686@end group
687@end example
688
689@noindent
690always equals @var{dividend}.
691@end defun 694@end defun
692 695
693@defun mod dividend divisor 696@defun mod dividend divisor
@@ -697,10 +700,9 @@ in other words, the remainder after division of @var{dividend}
697by @var{divisor}, but with the same sign as @var{divisor}. 700by @var{divisor}, but with the same sign as @var{divisor}.
698The arguments must be numbers or markers. 701The arguments must be numbers or markers.
699 702
700Unlike @code{%}, @code{mod} returns a well-defined result for negative 703Unlike @code{%}, @code{mod} permits floating point arguments; it
701arguments. It also permits floating point arguments; it rounds the 704rounds the quotient downward (towards minus infinity) to an integer,
702quotient downward (towards minus infinity) to an integer, and uses that 705and uses that quotient to compute the remainder.
703quotient to compute the remainder.
704 706
705If @var{divisor} is zero, @code{mod} signals an @code{arith-error} 707If @var{divisor} is zero, @code{mod} signals an @code{arith-error}
706error if both arguments are integers, and returns a NaN otherwise. 708error if both arguments are integers, and returns a NaN otherwise.
@@ -1086,8 +1088,8 @@ numbers as arguments.
1086@defun sin arg 1088@defun sin arg
1087@defunx cos arg 1089@defunx cos arg
1088@defunx tan arg 1090@defunx tan arg
1089These are the ordinary trigonometric functions, with argument measured 1091These are the basic trigonometric functions, with argument @var{arg}
1090in radians. 1092measured in radians.
1091@end defun 1093@end defun
1092 1094
1093@defun asin arg 1095@defun asin arg
@@ -1154,20 +1156,6 @@ This function returns the logarithm of @var{arg}, with base
1154returns a NaN. 1156returns a NaN.
1155@end defun 1157@end defun
1156 1158
1157@ignore
1158@defun expm1 arg
1159This function returns @code{(1- (exp @var{arg}))}, but it is more
1160accurate than that when @var{arg} is negative and @code{(exp @var{arg})}
1161is close to 1.
1162@end defun
1163
1164@defun log1p arg
1165This function returns @code{(log (1+ @var{arg}))}, but it is more
1166accurate than that when @var{arg} is so small that adding 1 to it would
1167lose accuracy.
1168@end defun
1169@end ignore
1170
1171@defun log10 arg 1159@defun log10 arg
1172This function returns the logarithm of @var{arg}, with base 10: 1160This function returns the logarithm of @var{arg}, with base 10:
1173@code{(log10 @var{x})} @equiv{} @code{(log @var{x} 10)}. 1161@code{(log10 @var{x})} @equiv{} @code{(log @var{x} 10)}.
@@ -1201,20 +1189,20 @@ The mathematical constant @math{pi} (3.14159@dots{}).
1201@section Random Numbers 1189@section Random Numbers
1202@cindex random numbers 1190@cindex random numbers
1203 1191
1204A deterministic computer program cannot generate true random numbers. 1192 A deterministic computer program cannot generate true random
1205For most purposes, @dfn{pseudo-random numbers} suffice. A series of 1193numbers. For most purposes, @dfn{pseudo-random numbers} suffice. A
1206pseudo-random numbers is generated in a deterministic fashion. The 1194series of pseudo-random numbers is generated in a deterministic
1207numbers are not truly random, but they have certain properties that 1195fashion. The numbers are not truly random, but they have certain
1208mimic a random series. For example, all possible values occur equally 1196properties that mimic a random series. For example, all possible
1209often in a pseudo-random series. 1197values occur equally often in a pseudo-random series.
1210 1198
1211In Emacs, pseudo-random numbers are generated from a ``seed''. 1199 Pseudo-random numbers are generated from a ``seed''. Starting from
1212Starting from any given seed, the @code{random} function always 1200any given seed, the @code{random} function always generates the same
1213generates the same sequence of numbers. Emacs typically starts with a 1201sequence of numbers. By default, Emacs initializes the random seed at
1214different seed each time, so the sequence of values of @code{random} 1202startup, in such a way that the sequence of values of @code{random}
1215typically differs in each Emacs run. 1203(with overwhelming likelihood) differs in each Emacs run.
1216 1204
1217Sometimes you want the random number sequence to be repeatable. For 1205 Sometimes you want the random number sequence to be repeatable. For
1218example, when debugging a program whose behavior depends on the random 1206example, when debugging a program whose behavior depends on the random
1219number sequence, it is helpful to get the same behavior in each 1207number sequence, it is helpful to get the same behavior in each
1220program run. To make the sequence repeat, execute @code{(random "")}. 1208program run. To make the sequence repeat, execute @code{(random "")}.
@@ -1227,8 +1215,10 @@ This function returns a pseudo-random integer. Repeated calls return a
1227series of pseudo-random integers. 1215series of pseudo-random integers.
1228 1216
1229If @var{limit} is a positive integer, the value is chosen to be 1217If @var{limit} is a positive integer, the value is chosen to be
1230nonnegative and less than @var{limit}. Otherwise, the value 1218nonnegative and less than @var{limit}. Otherwise, the value might be
1231might be any integer representable in Lisp. 1219any integer representable in Lisp, i.e.@: an integer between
1220@code{most-negative-fixnum} and @code{most-positive-fixnum}
1221(@pxref{Integer Basics}).
1232 1222
1233If @var{limit} is @code{t}, it means to choose a new seed based on the 1223If @var{limit} is @code{t}, it means to choose a new seed based on the
1234current time of day and on Emacs's process @acronym{ID} number. 1224current time of day and on Emacs's process @acronym{ID} number.
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 68e53c78972..54754f8e5e9 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -70,13 +70,11 @@ in their turn. The files @file{subdirs.el} are normally generated
70automatically when Emacs is installed. 70automatically when Emacs is installed.
71 71
72@item 72@item
73It registers input methods by loading any @file{leim-list.el} file 73If the library @file{leim-list.el} exists, Emacs loads it. This
74found in the @code{load-path}. 74optional library is intended for registering input methods; Emacs
75 75looks for it in @code{load-path} (@pxref{Library Search}), skipping
76@c It removes PWD from the environment if it is not accurate. 76those directories containing the standard Emacs libraries (since
77@c It abbreviates default-directory. 77@file{leim-list.el} should not exist in those directories).
78
79@c Now normal-top-level calls command-line.
80 78
81@vindex before-init-time 79@vindex before-init-time
82@item 80@item
@@ -1159,6 +1157,20 @@ This function returns the effective @acronym{UID} of the user.
1159The value may be a floating point number. 1157The value may be a floating point number.
1160@end defun 1158@end defun
1161 1159
1160@defun system-users
1161This function returns a list of strings, listing the user names on the
1162system. If Emacs cannot retrieve this information, the return value
1163is a list containing just the value of @code{user-real-login-name}.
1164@end defun
1165
1166@cindex user groups
1167@defun system-groups
1168This function returns a list of strings, listing the names of user
1169groups on the system. If Emacs cannot retrieve this information, the
1170return value is @code{nil}.
1171@end defun
1172
1173
1162@node Time of Day 1174@node Time of Day
1163@section Time of Day 1175@section Time of Day
1164 1176
@@ -1812,6 +1824,29 @@ minutes, and even if there have been garbage collections and autosaves.
1812input. Then it becomes idle again, and all the idle timers that are 1824input. Then it becomes idle again, and all the idle timers that are
1813set up to repeat will subsequently run another time, one by one. 1825set up to repeat will subsequently run another time, one by one.
1814 1826
1827 Do not write an idle timer function containing a loop which does a
1828certain amount of processing each time around, and exits when
1829@code{(input-pending-p)} is non-@code{nil}. This approach seems very
1830natural but has two problems:
1831
1832@itemize
1833@item
1834It blocks out all process output (since Emacs accepts process output
1835only while waiting).
1836
1837@item
1838It blocks out any idle timers that ought to run during that time.
1839@end itemize
1840
1841@noindent
1842Similarly, do not write an idle timer function that sets up another
1843idle timer (including the same idle timer) with @var{secs} argument
1844less than or equal to the current idleness time. Such a timer will
1845run almost immediately, and continue running again and again, instead
1846of waiting for the next time Emacs becomes idle. The correct approach
1847is to reschedule with an appropriate increment of the current value of
1848the idleness time, as described below.
1849
1815@defun current-idle-time 1850@defun current-idle-time
1816If Emacs is idle, this function returns the length of time Emacs has 1851If Emacs is idle, this function returns the length of time Emacs has
1817been idle, as a list of four integers: @code{(@var{sec-high} 1852been idle, as a list of four integers: @code{(@var{sec-high}
@@ -1820,60 +1855,34 @@ been idle, as a list of four integers: @code{(@var{sec-high}
1820 1855
1821When Emacs is not idle, @code{current-idle-time} returns @code{nil}. 1856When Emacs is not idle, @code{current-idle-time} returns @code{nil}.
1822This is a convenient way to test whether Emacs is idle. 1857This is a convenient way to test whether Emacs is idle.
1858@end defun
1823 1859
1824The main use of this function is when an idle timer function wants to 1860 The main use of @code{current-idle-time} is when an idle timer
1825``take a break'' for a while. It can set up another idle timer to 1861function wants to ``take a break'' for a while. It can set up another
1826call the same function again, after a few seconds more idleness. 1862idle timer to call the same function again, after a few seconds more
1827Here's an example: 1863idleness. Here's an example:
1828 1864
1829@smallexample 1865@example
1830(defvar resume-timer nil 1866(defvar my-resume-timer nil
1831 "Timer that `timer-function' used to reschedule itself, or nil.") 1867 "Timer for `my-timer-function' to reschedule itself, or nil.")
1832 1868
1833(defun timer-function () 1869(defun my-timer-function ()
1834 ;; @r{If the user types a command while @code{resume-timer}} 1870 ;; @r{If the user types a command while @code{my-resume-timer}}
1835 ;; @r{is active, the next time this function is called from} 1871 ;; @r{is active, the next time this function is called from}
1836 ;; @r{its main idle timer, deactivate @code{resume-timer}.} 1872 ;; @r{its main idle timer, deactivate @code{my-resume-timer}.}
1837 (when resume-timer 1873 (when my-resume-timer
1838 (cancel-timer resume-timer)) 1874 (cancel-timer my-resume-timer))
1839 ...@var{do the work for a while}... 1875 ...@var{do the work for a while}...
1840 (when @var{taking-a-break} 1876 (when @var{taking-a-break}
1841 (setq resume-timer 1877 (setq my-resume-timer
1842 (run-with-idle-timer 1878 (run-with-idle-timer
1843 ;; Compute an idle time @var{break-length} 1879 ;; Compute an idle time @var{break-length}
1844 ;; more than the current value. 1880 ;; more than the current value.
1845 (time-add (current-idle-time) 1881 (time-add (current-idle-time)
1846 (seconds-to-time @var{break-length})) 1882 (seconds-to-time @var{break-length}))
1847 nil 1883 nil
1848 'timer-function)))) 1884 'my-timer-function))))
1849@end smallexample 1885@end example
1850@end defun
1851
1852 Do not write an idle timer function containing a loop which does a
1853certain amount of processing each time around, and exits when
1854@code{(input-pending-p)} is non-@code{nil}. This approach seems very
1855natural but has two problems:
1856
1857@itemize
1858@item
1859It blocks out all process output (since Emacs accepts process output
1860only while waiting).
1861
1862@item
1863It blocks out any idle timers that ought to run during that time.
1864@end itemize
1865
1866@noindent
1867For similar reasons, do not write an idle timer function that sets
1868up another idle time (including the same idle timer) with the
1869@var{secs} argument less or equal to the current idleness time. Such
1870a timer will run almost immediately, and continue running again and
1871again, instead of waiting for the next time Emacs becomes idle.
1872
1873@noindent
1874The correct approach is for the idle timer to reschedule itself after
1875a brief pause, using the method in the @code{timer-function} example
1876above.
1877 1886
1878@node Terminal Input 1887@node Terminal Input
1879@section Terminal Input 1888@section Terminal Input
@@ -1907,7 +1916,6 @@ If @var{flow} is non-@code{nil}, then Emacs uses @sc{xon/xoff}
1907(@kbd{C-q}, @kbd{C-s}) flow control for output to the terminal. This 1916(@kbd{C-q}, @kbd{C-s}) flow control for output to the terminal. This
1908has no effect except in @sc{cbreak} mode. 1917has no effect except in @sc{cbreak} mode.
1909 1918
1910@c Emacs 19 feature
1911The argument @var{meta} controls support for input character codes 1919The argument @var{meta} controls support for input character codes
1912above 127. If @var{meta} is @code{t}, Emacs converts characters with 1920above 127. If @var{meta} is @code{t}, Emacs converts characters with
1913the 8th bit set into Meta characters. If @var{meta} is @code{nil}, 1921the 8th bit set into Meta characters. If @var{meta} is @code{nil},
@@ -1916,7 +1924,6 @@ it as a parity bit. If @var{meta} is neither @code{t} nor @code{nil},
1916Emacs uses all 8 bits of input unchanged. This is good for terminals 1924Emacs uses all 8 bits of input unchanged. This is good for terminals
1917that use 8-bit character sets. 1925that use 8-bit character sets.
1918 1926
1919@c Emacs 19 feature
1920If @var{quit-char} is non-@code{nil}, it specifies the character to 1927If @var{quit-char} is non-@code{nil}, it specifies the character to
1921use for quitting. Normally this character is @kbd{C-g}. 1928use for quitting. Normally this character is @kbd{C-g}.
1922@xref{Quitting}. 1929@xref{Quitting}.
@@ -1925,7 +1932,6 @@ use for quitting. Normally this character is @kbd{C-g}.
1925The @code{current-input-mode} function returns the input mode settings 1932The @code{current-input-mode} function returns the input mode settings
1926Emacs is currently using. 1933Emacs is currently using.
1927 1934
1928@c Emacs 19 feature
1929@defun current-input-mode 1935@defun current-input-mode
1930This function returns the current mode for reading keyboard input. It 1936This function returns the current mode for reading keyboard input. It
1931returns a list, corresponding to the arguments of @code{set-input-mode}, 1937returns a list, corresponding to the arguments of @code{set-input-mode},
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index b7097e057c0..865435c91b3 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -35,28 +35,31 @@ keyboard character events.
35@node String Basics 35@node String Basics
36@section String and Character Basics 36@section String and Character Basics
37 37
38 Characters are represented in Emacs Lisp as integers; 38 A character is a Lisp object which represents a single character of
39whether an integer is a character or not is determined only by how it is 39text. In Emacs Lisp, characters are simply integers; whether an
40used. Thus, strings really contain integers. @xref{Character Codes}, 40integer is a character or not is determined only by how it is used.
41for details about character representation in Emacs. 41@xref{Character Codes}, for details about character representation in
42 42Emacs.
43 The length of a string (like any array) is fixed, and cannot be 43
44altered once the string exists. Strings in Lisp are @emph{not} 44 A string is a fixed sequence of characters. It is a type of
45terminated by a distinguished character code. (By contrast, strings in 45sequence called a @dfn{array}, meaning that its length is fixed and
46C are terminated by a character with @acronym{ASCII} code 0.) 46cannot be altered once it is created (@pxref{Sequences Arrays
47Vectors}). Unlike in C, Emacs Lisp strings are @emph{not} terminated
48by a distinguished character code.
47 49
48 Since strings are arrays, and therefore sequences as well, you can 50 Since strings are arrays, and therefore sequences as well, you can
49operate on them with the general array and sequence functions. 51operate on them with the general array and sequence functions
50(@xref{Sequences Arrays Vectors}.) For example, you can access or 52documented in @ref{Sequences Arrays Vectors}. For example, you can
51change individual characters in a string using the functions @code{aref} 53access or change individual characters in a string using the functions
52and @code{aset} (@pxref{Array Functions}). However, note that 54@code{aref} and @code{aset} (@pxref{Array Functions}). However, note
53@code{length} should @emph{not} be used for computing the width of a 55that @code{length} should @emph{not} be used for computing the width
54string on display; use @code{string-width} (@pxref{Width}) instead. 56of a string on display; use @code{string-width} (@pxref{Width})
55 57instead.
56 There are two text representations for non-@acronym{ASCII} characters in 58
57Emacs strings (and in buffers): unibyte and multibyte (@pxref{Text 59 There are two text representations for non-@acronym{ASCII}
58Representations}). For most Lisp programming, you don't need to be 60characters in Emacs strings (and in buffers): unibyte and multibyte.
59concerned with these two representations. 61For most Lisp programming, you don't need to be concerned with these
62two representations. @xref{Text Representations}, for details.
60 63
61 Sometimes key sequences are represented as unibyte strings. When a 64 Sometimes key sequences are represented as unibyte strings. When a
62unibyte string is a key sequence, string elements in the range 128 to 65unibyte string is a key sequence, string elements in the range 128 to
@@ -88,7 +91,7 @@ for information about the syntax of characters and strings.
88representations and to encode and decode character codes. 91representations and to encode and decode character codes.
89 92
90@node Predicates for Strings 93@node Predicates for Strings
91@section The Predicates for Strings 94@section Predicates for Strings
92 95
93For more information about general sequence and array predicates, 96For more information about general sequence and array predicates,
94see @ref{Sequences Arrays Vectors}, and @ref{Arrays}. 97see @ref{Sequences Arrays Vectors}, and @ref{Arrays}.
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 6f2b178fcd7..2c1e3758ea0 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
12012-09-30 Jan Djärv <jan.h.d@swipnet.se>
2
3 * NEWS: The NS port supports fullscreen.
4
12012-09-17 Glenn Morris <rgm@gnu.org> 52012-09-17 Glenn Morris <rgm@gnu.org>
2 6
3 * refcards/emacsver.tex: New file. 7 * refcards/emacsver.tex: New file.
diff --git a/etc/NEWS b/etc/NEWS
index ebeab85e403..e6f09d83f43 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -76,6 +76,7 @@ You can explicitly require a specific version by passing
76 76
77* Startup Changes in Emacs 24.3 77* Startup Changes in Emacs 24.3
78 78
79+++
79** Emacs no longer searches for `leim-list.el' files beneath the standard 80** Emacs no longer searches for `leim-list.el' files beneath the standard
80lisp/ directory. There should not be any there anyway. If you have 81lisp/ directory. There should not be any there anyway. If you have
81been adding them there, put them somewhere else, eg site-lisp. 82been adding them there, put them somewhere else, eg site-lisp.
@@ -86,15 +87,20 @@ been adding them there, put them somewhere else, eg site-lisp.
86 87
87* Changes in Emacs 24.3 88* Changes in Emacs 24.3
88 89
90** minibuffer-electric-default-mode can rewrite (default ...) to [...].
91Just set minibuffer-eldef-shorten-default to t before enabling the mode.
92
93+++
89** Most y-or-n prompts now allow you to scroll the selected window. 94** Most y-or-n prompts now allow you to scroll the selected window.
90Typing C-v or M-v at a y-or-n prompt scrolls forward or backward 95Typing C-v or M-v at a y-or-n prompt scrolls forward or backward
91respectively, without exiting from the prompt. 96respectively, without exiting from the prompt.
92 97
98---
93** In minibuffer filename prompts, `C-M-f' and `C-M-b' now move to the 99** In minibuffer filename prompts, `C-M-f' and `C-M-b' now move to the
94next and previous path separator, respectively. 100next and previous path separator, respectively.
95 101
96** Mode line changes 102** Mode line changes
97 103---
98*** New option `mode-line-default-help-echo' specifies the help text 104*** New option `mode-line-default-help-echo' specifies the help text
99(shown in a tooltip or in the echo area) for any part of the mode line 105(shown in a tooltip or in the echo area) for any part of the mode line
100that does not have its own specialized help text. 106that does not have its own specialized help text.
@@ -104,12 +110,14 @@ invokes `set-buffer-file-coding-system'.
104 110
105** Help changes 111** Help changes
106 112
113+++
107*** `C-h f' (describe-function) can now perform autoloading. 114*** `C-h f' (describe-function) can now perform autoloading.
108When this command is called for an autoloaded function whose docstring 115When this command is called for an autoloaded function whose docstring
109contains a key substitution construct, that function's library is 116contains a key substitution construct, that function's library is
110automatically loaded, so that the documentation can be shown 117automatically loaded, so that the documentation can be shown
111correctly. To disable this, set `help-enable-auto-load' to nil. 118correctly. To disable this, set `help-enable-auto-load' to nil.
112 119
120---
113*** `C-h f' now reports previously-autoloaded functions as "autoloaded", 121*** `C-h f' now reports previously-autoloaded functions as "autoloaded",
114even after their associated libraries have been loaded (and the 122even after their associated libraries have been loaded (and the
115autoloads have been redefined as functions). 123autoloads have been redefined as functions).
@@ -133,16 +141,17 @@ treated as images.
133:background image spec property. 141:background image spec property.
134 142
135** Server and client changes 143** Server and client changes
136 144+++
137*** emacsclient now obeys string values for `initial-buffer-choice', 145*** emacsclient now obeys string values for `initial-buffer-choice',
138if it is told to open a new frame without specifying any file to visit 146if it is told to open a new frame without specifying any file to visit
139or expression to evaluate. 147or expression to evaluate.
140 148---
141*** New option `server-auth-key' specifies a shared server key. 149*** New option `server-auth-key' specifies a shared server key.
142 150
143** In the Package Menu, newly-available packages are listed as "new", 151** In the Package Menu, newly-available packages are listed as "new",
144and sorted above the other "available" packages by default. 152and sorted above the other "available" packages by default.
145 153
154+++
146** `C-x C-q' is now bound to the new minor mode `read-only-mode'. 155** `C-x C-q' is now bound to the new minor mode `read-only-mode'.
147This minor mode replaces `toggle-read-only', which is now obsolete. 156This minor mode replaces `toggle-read-only', which is now obsolete.
148 157
@@ -151,6 +160,7 @@ On encountering a fatal error, Emacs now outputs a textual description
151of the fatal signal, and a short backtrace on platforms like glibc 160of the fatal signal, and a short backtrace on platforms like glibc
152that support backtraces. 161that support backtraces.
153 162
163---
154** If your Emacs was built from a bzr checkout, the new variable 164** If your Emacs was built from a bzr checkout, the new variable
155`emacs-bzr-version' contains information about the bzr revision used. 165`emacs-bzr-version' contains information about the bzr revision used.
156 166
@@ -177,33 +187,31 @@ The PCL-CVS commands are still available via the keyboard.
177--- 187---
178*** New input method `vietnamese-vni'. 188*** New input method `vietnamese-vni'.
179 189
190** The NS port supports fullscreen.
191
180 192
181* Editing Changes in Emacs 24.3 193* Editing Changes in Emacs 24.3
182 194
195** Navigation command changes
183+++ 196+++
184** `C-x 8 RET' is now bound to `insert-char', which is now a command. 197*** New binding `M-g c' for `goto-char'.
185`ucs-insert' is now an obsolete alias for `insert-char'. 198+++
186 199*** New binding `M-g TAB' for `move-to-column'.
187--- 200+++
188** The `z' key no longer has a binding in most special modes. 201*** `M-g TAB' (`move-to-column') prompts for a column number if called
189It used to be bound to `kill-this-buffer', but `z' is too easy to 202interactively with no prefix arg. Previously, it moved to column 1.
190accidentally type.
191
192** New option `delete-trailing-lines' specifies whether
193M-x delete-trailing-whitespace should delete trailing lines at the end
194of the buffer. It defaults to t.
195 203
196** Search and Replace changes 204** Search and Replace changes
197 205+++
198*** Non-regexp Isearch now performs "lax" space matching. 206*** Non-regexp Isearch now performs "lax" space matching.
199Each sequence of spaces in the supplied search string may match any 207Each sequence of spaces in the supplied search string may match any
200sequence of one or more whitespace characters, as specified by the 208sequence of one or more whitespace characters, as specified by the
201variable `search-whitespace-regexp'. (This variable is also used by a 209variable `search-whitespace-regexp'. (This variable is also used by a
202similar existing feature for regexp Isearch). 210similar existing feature for regexp Isearch).
203 211+++
204*** New Isearch command `M-s SPC' toggles lax space matching. 212*** New Isearch command `M-s SPC' toggles lax space matching.
205This applies to both ordinary and regexp Isearch. 213This applies to both ordinary and regexp Isearch.
206 214+++
207*** New option `replace-lax-whitespace'. 215*** New option `replace-lax-whitespace'.
208If non-nil, `query-replace' uses flexible whitespace matching too. 216If non-nil, `query-replace' uses flexible whitespace matching too.
209The default is nil. 217The default is nil.
@@ -212,6 +220,20 @@ The default is nil.
212and `M-s _' in Isearch toggles symbol search mode. 220and `M-s _' in Isearch toggles symbol search mode.
213`M-s c' in Isearch toggles search case-sensitivity. 221`M-s c' in Isearch toggles search case-sensitivity.
214 222
223+++
224** `C-x 8 RET' is now bound to `insert-char', which is now a command.
225`ucs-insert' is now an obsolete alias for `insert-char'.
226
227---
228** The `z' key no longer has a binding in most special modes.
229It used to be bound to `kill-this-buffer', but `z' is too easy to
230accidentally type.
231
232+++
233** New option `delete-trailing-lines' specifies whether
234M-x delete-trailing-whitespace should delete trailing lines at the end
235of the buffer. It defaults to t.
236
215** Register changes 237** Register changes
216+++ 238+++
217*** `C-x r +' is now overloaded to invoke `append-to-register. 239*** `C-x r +' is now overloaded to invoke `append-to-register.
@@ -220,13 +242,10 @@ and `M-s _' in Isearch toggles symbol search mode.
220the text to put between collected texts for use with M-x 242the text to put between collected texts for use with M-x
221append-to-register and M-x prepend-to-register. 243append-to-register and M-x prepend-to-register.
222 244
245+++
223** `C-u M-=' now counts lines/words/characters in the entire buffer. 246** `C-u M-=' now counts lines/words/characters in the entire buffer.
224 247
225** New binding `M-g c' for `goto-char'. 248+++
226
227** M-x move-to-column, if called interactively with no prefix arg, now
228prompts for a column number.
229
230** New command `C-x r M-w' (copy-rectangle-as-kill). 249** New command `C-x r M-w' (copy-rectangle-as-kill).
231It copies the region-rectangle as the last rectangle kill. 250It copies the region-rectangle as the last rectangle kill.
232 251
@@ -238,17 +257,17 @@ just removing them, as done by `yank-excluded-properties'.
238* Changes in Specialized Modes and Packages in Emacs 24.3 257* Changes in Specialized Modes and Packages in Emacs 24.3
239 258
240** Apropos 259** Apropos
241 260---
242*** The faces used by Apropos are now directly customizable. 261*** The faces used by Apropos are now directly customizable.
243These faces are named `apropos-symbol', `apropos-keybinding', and so on; 262These faces are named `apropos-symbol', `apropos-keybinding', and so on;
244see the `apropos' Custom group for details. 263see the `apropos' Custom group for details.
245 264---
246**** The old options whose values specified faces to use were removed 265*** The old options whose values specified faces to use were removed
247(i.e. `apropos-symbol-face', `apropos-keybinding-face', etc.). 266(i.e. `apropos-symbol-face', `apropos-keybinding-face', etc.).
248 267
249** Buffer Menu 268** Buffer Menu
250This package has been rewritten to use Tabulated List mode. 269This package has been rewritten to use Tabulated List mode.
251 270---
252*** Option `Buffer-menu-buffer+size-width' is now obsolete. 271*** Option `Buffer-menu-buffer+size-width' is now obsolete.
253Use `Buffer-menu-name-width' and `Buffer-menu-size-width' instead. 272Use `Buffer-menu-name-width' and `Buffer-menu-size-width' instead.
254 273
@@ -410,6 +429,8 @@ server properties.
410** In Perl mode, new option `perl-indent-parens-as-block' causes non-block 429** In Perl mode, new option `perl-indent-parens-as-block' causes non-block
411closing brackets to be aligned with the line of the opening bracket. 430closing brackets to be aligned with the line of the opening bracket.
412 431
432** In Proced mode, new command `proced-renice' renices marked processes.
433
413** Python mode 434** Python mode
414 435
415A new version of python.el, which provides several new features, including: 436A new version of python.el, which provides several new features, including:
@@ -562,27 +583,30 @@ in case that is not properly encoded.
562 583
563** which-function-mode now applies to all applicable major modes by default. 584** which-function-mode now applies to all applicable major modes by default.
564 585
586---
587** winner-mode-hook now runs when the mode is disabled, as well as when it is
588enabled.
565 589
566** FIXME something happened to ses.el, 2012-04-17. 590** FIXME something happened to ses.el, 2012-04-17.
567 591
568 592
569** Obsolete packages: 593** Obsolete packages:
570 594+++
571*** assoc.el 595*** assoc.el
572In most cases, assoc+member+push+delq work just as well. 596In most cases, assoc+member+push+delq work just as well.
573And in any case it's just a terrible package: ugly semantics, terrible 597And in any case it's just a terrible package: ugly semantics, terrible
574inefficiency, and not namespace-clean. 598inefficiency, and not namespace-clean.
575 599---
576*** bruce.el 600*** bruce.el
577 601---
578*** ledit.el 602*** ledit.el
579 603---
580*** mailpost.el 604*** mailpost.el
581 605+++
582*** mouse-sel.el 606*** mouse-sel.el
583 607---
584*** patcomp.el 608*** patcomp.el
585 609+++
586*** cust-print.el 610*** cust-print.el
587 611
588 612
@@ -590,11 +614,13 @@ inefficiency, and not namespace-clean.
590 614
591* Incompatible Lisp Changes in Emacs 24.3 615* Incompatible Lisp Changes in Emacs 24.3
592 616
617+++
593** (random) by default now returns a different random sequence in 618** (random) by default now returns a different random sequence in
594every Emacs run. Use (random S), where S is a string, to set the 619every Emacs run. Use (random S), where S is a string, to set the
595random seed to a value based on S, in order to get a repeatable 620random seed to a value based on S, in order to get a repeatable
596sequence in later calls. 621sequence in later calls.
597 622
623---
598** The function `x-select-font' can return a font spec, instead of a 624** The function `x-select-font' can return a font spec, instead of a
599font name as a string. Whether it returns a font spec or a font name 625font name as a string. Whether it returns a font spec or a font name
600depends on the graphical library. 626depends on the graphical library.
@@ -615,6 +641,7 @@ and are now undefined. For backwards compatibility, defun and
615defmacro currently return the name of the newly defined function/macro 641defmacro currently return the name of the newly defined function/macro
616but this should not be relied upon. 642but this should not be relied upon.
617 643
644---
618** `face-spec-set' no longer sets frame-specific attributes when the 645** `face-spec-set' no longer sets frame-specific attributes when the
619third argument is a frame (that usage was obsolete since Emacs 22.2). 646third argument is a frame (that usage was obsolete since Emacs 22.2).
620 647
@@ -652,15 +679,34 @@ are deprecated and will be removed eventually.
652**** inactivate-current-input-method-function -> 679**** inactivate-current-input-method-function ->
653 deactivate-current-input-method-function 680 deactivate-current-input-method-function
654 681
655** Some obsolete variables and variable aliases were removed: 682** Some obsolete functions and variables were removed:
656 683
657*** `facemenu-unlisted-faces' 684*** `facemenu-unlisted-faces'
658*** `rmail-decode-mime-charset' 685*** `rmail-decode-mime-charset'
659*** `last-input-char', `last-command-char', `unread-command-char'. 686*** `last-input-char', `last-command-char', `unread-command-char'.
687*** `iswitchb-read-buffer'
688*** `sc-version', `sc-submit-bug-report'
689*** `set-char-table-default'
690*** `string-to-sequence' (use `string-to-list' or `string-to-vector').
691*** `compile-internal'
692*** `mode-line-inverse-video'
693*** `cvs-commit-buffer-require-final-newline'
694(use `'log-edit-require-final-newline'instead)
695*** `cvs-changelog-full-paragraphs'
696(use `log-edit-changelog-full-paragraphs' instead)
697*** `cvs-diff-ignore-marks', `cvs-diff-buffer-name'
698*** `vc-ignore-vc-files' (use `vc-handled-backends' instead)
699*** `vc-master-templates' (use `vc-handled-backends' instead)
700*** `vc-checkout-carefully'
660 701
661 702
662* Lisp changes in Emacs 24.3 703* Lisp changes in Emacs 24.3
663 704
705** New sampling-based Elisp profiler.
706Try M-x profiler-start ... M-x profiler-stop; and then M-x profiler-report.
707The sampling rate can be based on CPU time (only supported on some
708systems), or based on memory allocations.
709
664** CL-style generalized variables are now in core Elisp. 710** CL-style generalized variables are now in core Elisp.
665`setf' is autoloaded; `push' and `pop' accept generalized variables. 711`setf' is autoloaded; `push' and `pop' accept generalized variables.
666 712
@@ -706,14 +752,11 @@ now accept a third argument to avoid choosing the selected window.
706 752
707*** New macro `with-temp-buffer-window'. 753*** New macro `with-temp-buffer-window'.
708 754
709*** New options `temp-buffer-resize-frames' and
710`temp-buffer-resize-regexps'.
711
712*** `temp-buffer-resize-mode' no longer resizes windows that have been 755*** `temp-buffer-resize-mode' no longer resizes windows that have been
713reused. 756reused.
714 757
715*** New function `fit-frame-to-buffer' and new option 758*** New function `fit-frame-to-buffer' and new options
716`fit-frame-to-buffer-bottom-margin'. 759`fit-frame-to-buffer' and `fit-frame-to-buffer-bottom-margin'.
717 760
718*** New display action functions `display-buffer-below-selected', 761*** New display action functions `display-buffer-below-selected',
719`display-buffer-at-bottom' and `display-buffer-in-previous-window'. 762`display-buffer-at-bottom' and `display-buffer-in-previous-window'.
@@ -728,6 +771,9 @@ non-nil, specifies frame parameters to give any newly-created frame.
728*** New display action alist entry `previous-window', if non-nil, 771*** New display action alist entry `previous-window', if non-nil,
729specifies window to reuse in `display-buffer-in-previous-window'. 772specifies window to reuse in `display-buffer-in-previous-window'.
730 773
774*** New display action alist entries `window-height' and `window-width'
775to specify size of new window created by `display-buffer'.
776
731*** The following variables are obsolete, as they can be replaced by 777*** The following variables are obsolete, as they can be replaced by
732appropriate entries in the `display-buffer-alist' function introduced 778appropriate entries in the `display-buffer-alist' function introduced
733in Emacs 24.1: 779in Emacs 24.1:
@@ -740,23 +786,24 @@ in Emacs 24.1:
740**** `display-buffer-function' 786**** `display-buffer-function'
741 787
742** Time 788** Time
743 789---
744*** `current-time-string' no longer requires that its argument's year 790*** `current-time-string' no longer requires that its argument's year
745must be in the range 1000..9999. It now works with any year supported 791must be in the range 1000..9999. It now works with any year supported
746by the underlying C implementation. 792by the underlying C implementation.
747 793---
748*** `current-time' now returns extended-format time stamps 794*** `current-time' now returns extended-format time stamps
749(HIGH LOW USEC PSEC), where the new PSEC slot specifies picoseconds. 795(HIGH LOW USEC PSEC), where the new PSEC slot specifies picoseconds.
750PSEC is typically a multiple of 1000 on current machines. Other 796PSEC is typically a multiple of 1000 on current machines. Other
751functions that use this format, such as file-attributes and 797functions that use this format, such as file-attributes and
752format-time-string, have been changed accordingly. Old-format time 798format-time-string, have been changed accordingly. Old-format time
753stamps are still accepted. 799stamps are still accepted.
754 800---
755*** The format of timers in timer-list and timer-idle-list is now 801*** The format of timers in timer-list and timer-idle-list is now
756[TRIGGERED-P HI-SECS LO-SECS USECS REPEAT-DELAY FUNCTION ARGS IDLE-DELAY PSECS]. 802[TRIGGERED-P HI-SECS LO-SECS USECS REPEAT-DELAY FUNCTION ARGS IDLE-DELAY PSECS].
757The PSECS slot is new, and uses picosecond resolution. It can be 803The PSECS slot is new, and uses picosecond resolution. It can be
758accessed via the new timer--psecs accessor. 804accessed via the new timer--psecs accessor.
759 805
806+++
760** Floating point functions now always return special values like NaN, 807** Floating point functions now always return special values like NaN,
761instead of signaling errors, if given invalid args, e.g. (log -1.0). 808instead of signaling errors, if given invalid args, e.g. (log -1.0).
762Previously, they returned NaNs on some platforms but signaled errors 809Previously, they returned NaNs on some platforms but signaled errors
@@ -774,18 +821,22 @@ result in a warning describing the cycle.
774 821
775*** `autoloadp' 822*** `autoloadp'
776*** `autoload-do-load'. 823*** `autoload-do-load'.
824+++
777*** `buffer-narrowed-p' tests if the buffer is narrowed. 825*** `buffer-narrowed-p' tests if the buffer is narrowed.
778*** `file-name-base' returns a file name sans directory and extension. 826*** `file-name-base' returns a file name sans directory and extension.
779*** `function-get' fetches a function property, following aliases. 827*** `function-get' fetches a function property, following aliases.
828+++
780*** `posnp' tests if an object is a `posn'. 829*** `posnp' tests if an object is a `posn'.
781*** `set-temporary-overlay-map' sets up a temporary overlay map. 830*** `set-temporary-overlay-map' sets up a temporary overlay map.
831+++
782*** `system-users' returns the user names on the system. 832*** `system-users' returns the user names on the system.
833+++
783*** `system-groups' returns the group names on the system. 834*** `system-groups' returns the group names on the system.
784*** `tty-top-frame' returns the topmost frame of a text terminal. 835*** `tty-top-frame' returns the topmost frame of a text terminal.
785 836
786** New macros `setq-local' and `defvar-local'. 837** New macros `setq-local' and `defvar-local'.
787 838
788** New fringe bitmap exclamation-mark. 839** New fringe bitmap `exclamation-mark'.
789 840
790** Face underlining can now use a wave. 841** Face underlining can now use a wave.
791See the "Face Attributes" section of the Elisp manual. 842See the "Face Attributes" section of the Elisp manual.
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 3f1e287db34..4c25f54545d 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,7 @@
12012-09-26 Juanma Barranquero <lekktu@gmail.com>
2
3 * makefile.w32-in (obj): Add profiler.o.
4
12012-09-17 Glenn Morris <rgm@gnu.org> 52012-09-17 Glenn Morris <rgm@gnu.org>
2 6
3 * ebrowse.c (version): 7 * ebrowse.c (version):
@@ -1038,7 +1042,7 @@
1038 (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes) 1042 (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
1039 (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes) 1043 (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
1040 (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help) 1044 (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
1041 (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help) 1045 (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
1042 (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help) 1046 (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
1043 (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help) 1047 (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
1044 (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters) 1048 (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index 64974b88b6f..23ef71de10c 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -140,7 +140,7 @@ obj = dosfns.o msdos.o \
140 process.o callproc.o unexw32.o \ 140 process.o callproc.o unexw32.o \
141 region-cache.o sound.o atimer.o \ 141 region-cache.o sound.o atimer.o \
142 doprnt.o intervals.o textprop.o composite.o \ 142 doprnt.o intervals.o textprop.o composite.o \
143 gnutls.o xml.o 143 gnutls.o xml.o profiler.o
144 144
145# 145#
146# These are the lisp files that are loaded up in loadup.el 146# These are the lisp files that are loaded up in loadup.el
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index d49eb4fdf7a..e79fe35622c 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=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --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 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo 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 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=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --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 crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo 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 351b6ea6cb8..255b8924784 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,484 @@
12012-09-30 Juanma Barranquero <lekktu@gmail.com>
2
3 * ido.el (ido-max-directory-size): Default to nil; the current
4 default is small for POSIX systems, and impractical on Windows 7
5 now that lstat returns directory sizes for NTFS.
6
72012-09-30 Martin Rudalics <rudalics@gmx.at>
8
9 In buffer display functions handle window-height/window-width
10 alist entries. Suggested by Juri Linkov as fix for Bug#1806.
11 * window.el (window--display-buffer): New argument ALIST. Obey
12 window-height and window-width alist entries.
13 (window--try-to-split-window): New argument ALIST. Bind
14 window-combination-limit to t when the window's size shall be
15 changed and window-combination-limit equals `window-size'.
16 (display-buffer-in-atom-window)
17 (display-buffer-in-major-side-window)
18 (display-buffer-in-side-window, display-buffer-same-window)
19 (display-buffer-reuse-window, display-buffer-pop-up-frame)
20 (display-buffer-pop-up-window, display-buffer-below-selected)
21 (display-buffer-at-bottom, display-buffer-in-previous-window)
22 (display-buffer-use-some-window): Adjust all callers of
23 window--display-buffer and window--try-to-split-window.
24 (fit-frame-to-buffer): New option.
25 (fit-window-to-buffer): Can resize frames if fit-frame-to-buffer
26 is non-nil.
27 (display-buffer-in-major-side-window): Evaluate window-height /
28 window-width alist entries.
29
30 * help.el (temp-buffer-resize-frames)
31 (temp-buffer-resize-regexps): Remove options.
32 (temp-buffer-resize-mode): Adjust doc-string.
33 (resize-temp-buffer-window): Don't consult
34 temp-buffer-resize-regexps. Use fit-frame-to-buffer instead of
35 temp-buffer-resize-frames.
36
37 * dired.el (dired-mark-pop-up): Call
38 display-buffer-below-selected with a fit-window-to-buffer alist
39 entry.
40
412012-09-30 Chong Yidong <cyd@gnu.org>
42
43 * server.el (server-host): Document the security implications.
44 (server-auth-key): Doc fix.
45
46 * startup.el (initial-buffer-choice): Doc fix.
47
48 * minibuffer.el (minibuffer-local-filename-syntax): Doc fix.
49
50 * simple.el (delete-trailing-whitespace): Avoid an unnecessary
51 restriction change.
52
53 * bindings.el (goto-map): Bind M-g TAB to move-to-column.
54
55 * help-fns.el (help-fns--obsolete): Fix last change.
56
572012-09-30 Stefan Monnier <monnier@iro.umontreal.ca>
58
59 * winner.el (winner-mode-map): Obey winner-dont-bind-my-keys here.
60 (minor-mode-map-alist): Remove redundant code.
61
62 * vc/pcvs.el (cvs-cleanup-collection): Keep entries that are currently
63 visited in a buffer.
64 (cvs-insert-visited-file): New function.
65 (find-file-hook): Use it.
66
67 * vc/pcvs-info.el (cvs-fileinfo-pp): Don't use non-existent faces.
68
69 * vc/log-edit.el (log-edit-font-lock-keywords): Ignore case to
70 chose face.
71 (log-edit-empty-buffer-p): Don't require a space after a header.
72
73 * vc/ediff-util.el (ediff-diff-at-point): Don't assume point-min==1.
74
75 * tutorial.el (help-with-tutorial): Use minibuffer-with-setup-hook.
76
77 * textmodes/text-mode.el (paragraph-indent-minor-mode): Make it
78 a proper minor-mode.
79
80 * textmodes/tex-mode.el (tex-mode-map): Don't bind paren keys.
81
822012-09-29 Glenn Morris <rgm@gnu.org>
83
84 * winner.el (winner-mode): Remove variable (let define-minor-mode
85 handle it).
86 (winner-dont-bind-my-keys, winner-boring-buffers, winner-mode-hook):
87 Doc fixes.
88 (winner-mode-leave-hook): Rename to winner-mode-off-hook.
89 (winner-mode): Use define-minor-mode.
90
91 * vc/vc-sccs.el (vc-sccs-registered): Use the progn trick to get
92 the full definition in loaddefs, rather than duplicating it.
93
94 * help-macro.el (three-step-help): No need to autoload defcustom.
95
96 * progmodes/inf-lisp.el (inferior-lisp-filter-regexp)
97 (inferior-lisp-program, inferior-lisp-load-command)
98 (inferior-lisp-prompt, inferior-lisp-mode-hook):
99 No need to autoload defcustoms.
100
101 * hippie-exp.el (hippie-expand-try-functions-list)
102 (hippie-expand-verbose, hippie-expand-dabbrev-skip-space)
103 (hippie-expand-dabbrev-as-symbol, hippie-expand-no-restriction)
104 (hippie-expand-max-buffers, hippie-expand-ignore-buffers)
105 (hippie-expand-only-buffers): No need to autoload defcustoms.
106 * progmodes/vhdl-mode.el (vhdl-line-expand):
107 Explicitly load hippie-exp, so it does not get autoloaded
108 while hippie-expand-try-functions-list is let-bound.
109
1102012-09-28 Glenn Morris <rgm@gnu.org>
111
112 * emacs-lisp/cl.el (flet): Fix case of obsolescence message.
113
114 * emacs-lisp/bytecomp.el (byte-compile-cl-file-p):
115 Only "cl.el" counts as cl these days.
116
1172012-09-28 Juri Linkov <juri@jurta.org>
118
119 Display archive errors in the echo area instead of inserting
120 to the file buffer.
121
122 * arc-mode.el (archive-extract-by-stdout): Change arg STDERR-FILE
123 to STDERR-TEST that can be a regexp matching a successful output.
124 Create a temporary file and redirect stderr to it. Search for
125 STDERR-TEST in the stderr output and display it in the echo area
126 if no match is found.
127 (archive-extract-by-file): New function like
128 `archive-extract-by-stdout' but extracting archives to files
129 and looking for successful matches in stdout. Function body is
130 mostly copied from `archive-rar-extract'.
131 (archive-rar-extract): Use `archive-extract-by-file'.
132 (archive-7z-extract): Use `archive-extract-by-stdout'. (Bug#10347)
133
1342012-09-28 Leo Liu <sdl.web@gmail.com>
135
136 * pcomplete.el (pcomplete-show-completions): Use
137 minibuffer-message to make pcomplete usable in minibuffer.
138
139 * ido.el (ido-set-matches-1): Fix 2012-09-11 change.
140
1412012-09-28 Stefan Monnier <monnier@iro.umontreal.ca>
142
143 * type-break.el: Use lexical-binding.
144 (type-break-mode): Use define-minor-mode.
145
146 * emacs-lisp/pcase.el (pcase--mark-used): New.
147 (pcase--u1): Use it (bug#12512).
148
149 * custom.el (load-theme): Set buffer-file-name so the load is recorded
150 in load-history with the right file name.
151
1522012-09-28 Tassilo Horn <tsdh@gnu.org>
153
154 * doc-view.el (doc-view-current-cache-doc-pdf): New function.
155 (doc-view-doc->txt, doc-view-convert-current-doc): Use it.
156 (doc-view-get-bounding-box): Make bounding box slicing work for
157 ODF and DVI documents.
158
1592012-09-28 Glenn Morris <rgm@gnu.org>
160
161 * type-break.el (type-break-mode, type-break-interval)
162 (type-break-good-rest-interval, type-break-keystroke-threshold):
163 No need to autoload.
164 (type-break-good-rest-interval, type-break-keystroke-threshold):
165 Add :set-after.
166
1672012-09-28 Chong Yidong <cyd@gnu.org>
168
169 * progmodes/verilog-mode.el (verilog-auto-inst-interfaced-ports):
170 Add :version tag.
171
1722012-09-27 Stefan Monnier <monnier@iro.umontreal.ca>
173
174 * json.el (json-encode-char): Codes 127-160 aren't "ASCII printable".
175
1762012-09-27 Glenn Morris <rgm@gnu.org>
177
178 * faces.el (x-display-name): Declare (for without-x builds).
179
180 * linum.el (linum-format): Don't autoload it. Improve :type.
181
182 * progmodes/tcl.el: Don't require outline when compiling.
183 (outline-regexp, outline-level): Declare.
184 * textmodes/sgml-mode.el: Don't require outline when compiling.
185 (outline-regexp, outline-heading-end-regexp, outline-level): Declare.
186
187 * term.el (term-ansi-reset):
188 Try setting term-ansi-face-already-done to nil. (Bug#11785)
189
190 * vc/vc.el (vc-next-action): Only gripe about committing read-only
191 files for RCS and SCCS. (Bug#9781)
192
1932012-09-27 Chong Yidong <cyd@gnu.org>
194
195 * progmodes/verilog-mode.el (verilog-mode-release-emacs): Fix last
196 change; value should be t.
197
1982012-09-27 Stefan Monnier <monnier@iro.umontreal.ca>
199
200 * image-mode.el: Use lexical-binding.
201 (image-mode-winprops): Use t to stand for the window of
202 a buffer that's not displayed.
203 * doc-view.el (doc-view-new-window-function): Handle the new
204 t in winprops.
205 (doc-view-enlarge): Make it a real nop if the size is not changed.
206 (doc-view-display): Handle the case where the buffer is not (yet?)
207 displayed in any window.
208 (doc-view-saved-settings): New var.
209 (doc-view-mode): Use it.
210 (doc-view-fallback-mode): Set it.
211
212 * minibuf-eldef.el: Make it possible to replace (default ...) with [...].
213 Set lexical-binding.
214 (minibuffer-eldef-shorten-default): New var.
215 (minibuffer-default-in-prompt-regexps): Use it for new default.
216 (minibuf-eldef-setup-minibuffer): Add replacement functionality.
217
2182012-09-26 Juanma Barranquero <lekktu@gmail.com>
219
220 * international/uni-bidi.el:
221 * international/uni-category.el:
222 * international/uni-name.el:
223 * international/uni-numeric.el: Regenerate.
224
2252012-09-26 Tomohiro Matsuyama <tomo@cx4a.org>
226 Stefan Monnier <monnier@iro.umontreal.ca>
227
228 * profiler.el: New file.
229
2302012-09-26 Stefan Monnier <monnier@iro.umontreal.ca>
231
232 * emacs-lisp/testcover.el (testcover-after): Add gv-expander.
233 (testcover-reinstrument): Simplify with CSE.
234
2352012-09-26 Juanma Barranquero <lekktu@gmail.com>
236
237 * window.el (temp-buffer-window-setup): Fix typo in docstring.
238
2392012-09-25 Wilson Snyder <wsnyder@wsnyder.org>
240
241 * verilog-mode.el (verilog-auto-ascii-enum, verilog-auto-inout)
242 (verilog-auto-input, verilog-auto-insert-lisp)
243 (verilog-auto-output, verilog-auto-output-every, verilog-auto-reg)
244 (verilog-auto-reg-input, verilog-auto-tieoff, verilog-auto-undef)
245 (verilog-auto-unused, verilog-auto-wire)
246 (verilog-forward-or-insert-line): Fix AUTOs with no trailing
247 newline. Reported by Andrew Jones.
248 (verilog-auto-inst) Support expanding $clog2 in AUTOINST.
249 Reported by Brad Dobbie.
250 (verilog-batch-delete-trailing-whitespace):
251 Create verilog-batch-delete-trailing-whitespace.
252 Reported by Brad Dobbie.
253 (verilog-auto-inout-param): Support AUTOINOUTPARAM for copying
254 parameters from another module. Reported by Dan Katz.
255 (verilog-auto, verilog-auto-assign-modport)
256 (verilog-auto-inout-modport): Add AUTOASSIGNMODPORT and
257 AUTOINOUTMODPORT for UVM interface module shell generation.
258 Reported by Brad Dobbie.
259 (verilog-auto-inst-interfaced-ports): Make default nil, as more
260 standard behavior.
261 (verilog-auto): Fix AUTO parameters with parenthesis arguments.
262 Reported by Matt Martin.
263
2642012-09-25 Martin Rudalics <rudalics@gmx.at>
265
266 * window.el (window--resize-child-windows): When resizing child
267 windows proportionally, process them in reverse order to
268 preserve the "when splitting a window the new one gets the odd
269 line" behavior.
270 (window--resize-root-window-vertically): When resizing the
271 minibuffer window try to affect only windows at the bottom of the
272 frame. (Bug#12419)
273
2742012-09-25 Chong Yidong <cyd@gnu.org>
275
276 * subr.el (declare): Doc fix.
277
278 * help-fns.el (help-fns--obsolete): Handle macros properly.
279
2802012-09-25 Chong Yidong <cyd@gnu.org>
281
282 * bookmark.el (bookmark-jump-noselect): Use a declare form to mark
283 this function obsolete.
284
285 * calendar/cal-x.el (calendar-two-frame-setup)
286 (calendar-only-one-frame-setup, calendar-one-frame-setup):
287 * calendar/calendar.el (american-calendar, european-calendar)
288 (calendar-for-loop):
289 * comint.el (comint-dynamic-simple-complete)
290 (comint-dynamic-complete-as-filename, comint-unquote-filename):
291 * desktop.el (desktop-load-default):
292 * dired-x.el (dired-omit-here-always)
293 (dired-hack-local-variables, dired-default-directory):
294 * emacs-lisp/derived.el (derived-mode-class):
295 * emacs-lisp/timer.el (timer-set-time-with-usecs):
296 * emacs-lock.el (toggle-emacs-lock):
297 * epa.el (epa-display-verify-result):
298 * epg.el (epg-sign-keys, epg-start-sign-keys)
299 (epg-passphrase-callback-function):
300 * eshell/esh-util.el (eshell-for):
301 * eshell/eshell.el (eshell-remove-from-window-buffer-names)
302 (eshell-add-to-window-buffer-names):
303 * files.el (locate-file-completion):
304 * imenu.el (imenu-example--create-c-index)
305 (imenu-example--create-lisp-index)
306 (imenu-example--lisp-extract-index-name)
307 (imenu-example--name-and-position):
308 * international/mule-cmds.el (princ-list):
309 * international/mule-diag.el (decode-codepage-char):
310 * international/mule-util.el (detect-coding-with-priority):
311 * iswitchb.el (iswitchb-read-buffer):
312 * mail/mailalias.el (mail-complete):
313 * mail/sendmail.el (mail-sent-via):
314 * mouse.el (mouse-popup-menubar-stuff, mouse-popup-menubar)
315 (mouse-major-mode-menu):
316 * password-cache.el (password-read-and-add):
317 * pcomplete.el (pcomplete-parse-comint-arguments):
318 * progmodes/sh-script.el (sh-maybe-here-document):
319 * replace.el (query-replace-regexp-eval):
320 * savehist.el (savehist-load):
321 * simple.el (choose-completion-delete-max-match):
322 * term.el (term-dynamic-simple-complete):
323 * vc/ediff-init.el (ediff-check-version):
324 * vc/ediff-wind.el (ediff-choose-window-setup-function-automatically):
325 * vc/vc.el (vc-diff-switches-list):
326 * view.el (view-return-to-alist-update): Likewise.
327
328 * subr.el (eval-next-after-load, makehash, insert-string)
329 (assoc-ignore-representation, assoc-ignore-case): Use declare to
330 mark obsolete.
331 (mode-line-inverse-video): Variable deleted.
332
333 * international/mule-util.el (string-to-sequence): Remove.
334
335 * calendar/calendar.el (calendar-version):
336 * calendar/icalendar.el (icalendar-extract-ical-from-buffer)
337 (icalendar-convert-diary-to-ical):
338 * cus-edit.el (custom-mode):
339 * ansi-color.el (ansi-color-unfontify-region):
340 * international/latin1-disp.el (latin1-char-displayable-p):
341 * progmodes/cwarn.el (turn-on-cwarn-mode):
342 * progmodes/which-func.el (which-func-update-1):
343 Use define-obsolete-function-alias.
344
345 * net/newst-backend.el (newsticker-cache-filename):
346 * net/newst-treeview.el (newsticker-groups-filename):
347 Fix incorrect obsolescence declaration.
348
349 * allout.el (allout-passphrase-hint-string): Likewise.
350 (allout-init): Use a declare form to mark obsolete.
351
352 * emacs-lisp/byte-run.el (make-obsolete): Doc fix; emphasize that
353 this applies to functions.
354
355 * iswitchb.el (iswitchb-read-buffer): Move code of
356 iswitchb-define-mode-map here, and delete that obsolete function.
357
358 * net/snmp-mode.el (snmp-font-lock-keywords-3): Don't use obsolete
359 font-lock-reference-face.
360
3612012-09-25 Glenn Morris <rgm@gnu.org>
362
363 * buff-menu.el (Buffer-menu-name-width, Buffer-menu-size-width):
364 Doc fixes.
365
366 * eshell/em-term.el (eshell-term-name):
367 Default to term-term-name. (Bug#12485)
368
3692012-09-24 Fabián Ezequiel Gallina <fgallina@cuca>
370
371 * progmodes/python.el (python-shell-send-buffer): Better handling
372 of "if __name__ == '__main__':" conditionals when sending the buffer.
373
3742012-09-24 Glenn Morris <rgm@gnu.org>
375
376 * eshell/esh-cmd.el (eshell-find-alias-function):
377 Tighten up file-name regexp. (Bug#12499)
378
3792012-09-24 Fabián Ezequiel Gallina <fgallina@cuca>
380
381 Enhancements for triple-quote string syntax.
382 * progmodes/python.el (python-quote-syntax): Remove.
383 (python-syntax-propertize-function): New value.
384 (python-syntax-count-quotes, python-syntax-stringify):
385 New functions.
386
3872012-09-24 Chong Yidong <cyd@gnu.org>
388
389 * mail/supercite.el (sc-version): Remove obsolete function.
390 (sc-describe): Don't mark as obsolete, since it is bound.
391 (sc-submit-bug-report): Remove.
392
393 * vc/log-edit.el (cvs-changelog-full-paragraphs)
394 (cvs-commit-buffer-require-final-newline): Remove.
395 (log-edit-require-final-newline)
396 (log-edit-changelog-full-paragraphs): Default to t.
397
398 * vc/pcvs-defs.el (cvs-diff-buffer-name, cvs-diff-ignore-marks)
399 * vc/vc-hooks.el (vc-ignore-vc-files, vc-master-templates)
400 * vc/vc.el (vc-checkout-carefully): Likewise.
401
402 * vc/emerge.el (emerge-mode): Make it an obsolete alias.
403 (emerge-version): Remove.
404
405 * progmodes/compile.el (compile-internal): Remove.
406 (compilation-parse-errors-function): Fix typo.
407
408 * international/mule.el (set-char-table-default): Remove.
409 (set-coding-priority, make-coding-system, generic-char-p)
410 (charset-list, charset-bytes, charset-id): Use declare to mark
411 functions as obsolete.
412
413 * vc/pcvs-defs.el (cvs-buffer-name-alist)
414 (cvs-invert-ignore-marks): Remove references to obsolete vars.
415 * vc/vc-hooks.el (vc-default-registered): Don't use
416 vc-master-templates.
417
418 * font-lock.el (font-lock-reference-face):
419 Use define-obsolete-variable-alias.
420
421 * generic-x.el (rul-generic-mode): Use font-lock-constant-face.
422 * calendar/calendar.el (calendar-font-lock-keywords):
423 * calendar/diary-lib.el (diary-font-lock-keywords)
424 (diary-fancy-font-lock-keywords):
425 * textmodes/reftex-sel.el (reftex-insert-docstruct):
426 * textmodes/reftex-index.el (reftex-insert-index):
427 * textmodes/reftex-cite.el (reftex-format-bib-entry):
428 * progmodes/ruby-mode.el (ruby-font-lock-keywords):
429 * progmodes/ps-mode.el (ps-mode-font-lock-keywords-1):
430 * progmodes/prolog.el (prolog-font-lock-keywords):
431 * progmodes/idlwave.el (idlwave-idl-keywords):
432 * progmodes/ada-mode.el (ada-font-lock-keywords):
433 * net/snmp-mode.el (snmp-font-lock-keywords-3): Likewise.
434
4352012-09-24 Glenn Morris <rgm@gnu.org>
436
437 * mail/emacsbug.el (report-emacs-bug): Include `lsb_release -d'.
438
4392012-09-23 Fabián Ezequiel Gallina <fgallina@cuca>
440
441 * progmodes/python.el (python-indent-line): More consistent cursor
442 movement behavior.
443
4442012-09-23 Stefan Merten <smerten@oekonux.de>
445
446 * textmodes/rst.el: Fix compiler warning.
447
4482012-09-23 Roland Winkler <winkler@gnu.org>
449
450 * textmodes/bibtex.el (bibtex-autokey-transcriptions):
451 Transcribe also LaTeX hyphenation.
452 (bibtex-reformat): Bug fix. Do not quote twice the elements of
453 bibtex-reformat-previous-options.
454
4552012-09-23 Roland Winkler <winkler@gnu.org>
456
457 * proced.el (proced-renice-command): New variable.
458 (proced-marked-processes): New function.
459 (proced-with-processes-buffer): New macro.
460 (proced-send-signal): Use them.
461 (proced-renice): New command bound to r.
462
4632012-09-23 Roland Winkler <winkler@gnu.org>
464
465 * ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): If list
466 ibuffer-saved-filter-groups has one element, shortcut the call of
467 completing-read. (Bug#12331)
468
4692012-09-23 Chong Yidong <cyd@gnu.org>
470
471 * bindings.el (mode-line-toggle-read-only):
472 * bs.el (bs-toggle-readonly):
473 * buff-menu.el (Buffer-menu-toggle-read-only):
474 * dired.el (dired-toggle-read-only):
475 * ibuffer.el (ibuffer-do-toggle-read-only): Use read-only-mode.
476
4772012-09-23 Chong Yidong <cyd@gnu.org>
478
479 * image.el (image-type-available-p): Adapt to init-image-library
480 argument changes.
481
12012-09-22 Juri Linkov <juri@jurta.org> 4822012-09-22 Juri Linkov <juri@jurta.org>
2 483
3 * dired.el (dired-mode-map): Add [remap read-only-mode] for 484 * dired.el (dired-mode-map): Add [remap read-only-mode] for
@@ -45,7 +526,7 @@
45 526
462012-09-22 Stefan Merten <smerten@oekonux.de> 5272012-09-22 Stefan Merten <smerten@oekonux.de>
47 528
48 * rst.el: Revamp section title faces. 529 * textmodes/rst.el: Revamp section title faces.
49 (rst-official-version) 530 (rst-official-version)
50 (rst-package-emacs-version-alist): Sync with official version 531 (rst-package-emacs-version-alist): Sync with official version
51 V1.4.0. 532 V1.4.0.
@@ -120,15 +601,15 @@
120 601
1212012-09-20 Stefan Merten <smerten@oekonux.de> 6022012-09-20 Stefan Merten <smerten@oekonux.de>
122 603
123 * rst.el: Integrate support for `imenu' and `which-function'. 604 * textmodes/rst.el: Integrate support for `imenu' and `which-function'.
124 Fixes feature request bug#11711. 605 Fixes feature request bug#11711.
125 (rst-mode): Create `imenu-create-index-function'. 606 (rst-mode): Create `imenu-create-index-function'.
126 (rst-get-stripped-line): Delete after refactoring. 607 (rst-get-stripped-line): Delete after refactoring.
127 (rst-section-tree, rst-section-tree-rec) 608 (rst-section-tree, rst-section-tree-rec)
128 (rst-section-tree-point): Refactor and document properly. 609 (rst-section-tree-point): Refactor and document properly.
129 (rst-imenu-find-adornments-for-position) 610 (rst-imenu-find-adornments-for-position)
130 (rst-imenu-convert-cell, rst-imenu-create-index): New 611 (rst-imenu-convert-cell, rst-imenu-create-index):
131 function. 612 New function.
132 613
1332012-09-20 Stefan Monnier <monnier@iro.umontreal.ca> 6142012-09-20 Stefan Monnier <monnier@iro.umontreal.ca>
134 615
@@ -260,7 +741,7 @@
260 741
2612012-09-17 Stefan Merten <smerten@oekonux.de> 7422012-09-17 Stefan Merten <smerten@oekonux.de>
262 743
263 * rst.el: Add support for `testcover'. 744 * textmodes/rst.el: Add support for `testcover'.
264 (rst-defcustom-testcover, rst-testcover-add-compose) 745 (rst-defcustom-testcover, rst-testcover-add-compose)
265 (rst-testcover-add-1value): New functions. 746 (rst-testcover-add-1value): New functions.
266 (rst-portable-mark-active-p): Replace by `use-region-p'. 747 (rst-portable-mark-active-p): Replace by `use-region-p'.
@@ -2096,7 +2577,7 @@
2096 2577
20972012-07-30 Stefan Merten <smerten@oekonux.de> 25782012-07-30 Stefan Merten <smerten@oekonux.de>
2098 2579
2099 * rst.el: Silence `checkdoc-ispell'. 2580 * textmodes/rst.el: Silence `checkdoc-ispell'.
2100 (rst-cvs-header, rst-svn-rev, rst-svn-timestamp) 2581 (rst-cvs-header, rst-svn-rev, rst-svn-timestamp)
2101 (rst-official-version, rst-official-cvs-rev) 2582 (rst-official-version, rst-official-cvs-rev)
2102 (rst-package-emacs-version-alist): Update to upstream V1.3.1. 2583 (rst-package-emacs-version-alist): Update to upstream V1.3.1.
@@ -9488,7 +9969,7 @@
9488 Declare as obsolete. 9969 Declare as obsolete.
9489 (ns-get-pasteboard, ns-paste-secondary): 9970 (ns-get-pasteboard, ns-paste-secondary):
9490 Use ns-get-selection-internal. 9971 Use ns-get-selection-internal.
9491 (ns-set-pasteboard, ns-copy-including-secondary): 9972 (ns-set-pasteboard, ns-copy-including-secondary):
9492 Use ns-store-selection-internal. 9973 Use ns-store-selection-internal.
9493 9974
94942011-12-17 Chong Yidong <cyd@gnu.org> 99752011-12-17 Chong Yidong <cyd@gnu.org>
diff --git a/lisp/ChangeLog.8 b/lisp/ChangeLog.8
index 0380fb117db..db5c2f84511 100644
--- a/lisp/ChangeLog.8
+++ b/lisp/ChangeLog.8
@@ -2372,7 +2372,7 @@
2372 (sh-mode-map): Added new bindings. 2372 (sh-mode-map): Added new bindings.
2373 (sh-mode): Updated mode doc-string for new commands, added 2373 (sh-mode): Updated mode doc-string for new commands, added
2374 make-local-variable calls, initialize mode-specific variables. 2374 make-local-variable calls, initialize mode-specific variables.
2375 (sh-indent-line): Renamed to sh-basic-indent-line; sh-indent-line 2375 (sh-indent-line): Renamed to sh-basic-indent-line; sh-indent-line
2376 is now a different function. 2376 is now a different function.
2377 (sh-header-marker): Changed docstring. 2377 (sh-header-marker): Changed docstring.
2378 (sh-set-shell): Initialize mode-specific variables. 2378 (sh-set-shell): Initialize mode-specific variables.
diff --git a/lisp/ChangeLog.9 b/lisp/ChangeLog.9
index 5c01f872994..5c71fb860ec 100644
--- a/lisp/ChangeLog.9
+++ b/lisp/ChangeLog.9
@@ -569,7 +569,7 @@
569 Don't bind mouse events or tab/backtab. 569 Don't bind mouse events or tab/backtab.
570 (help-function, help-variable, help-face, help-coding-system) 570 (help-function, help-variable, help-face, help-coding-system)
571 (help-input-method, help-character-set, help-back, help-info) 571 (help-input-method, help-character-set, help-back, help-info)
572 (help-customize-variable, help-function-def, help-variable-def): 572 (help-customize-variable, help-function-def, help-variable-def):
573 New button types. 573 New button types.
574 (help-button-action): New function. 574 (help-button-action): New function.
575 (describe-function-1): Pass help button-types to 575 (describe-function-1): Pass help button-types to
@@ -20671,7 +20671,7 @@
20671 * term/tty-colors.el (tty-defined-color-alist): Renamed from 20671 * term/tty-colors.el (tty-defined-color-alist): Renamed from
20672 tty-color-alist. 20672 tty-color-alist.
20673 (tty-color-alist, tty-modify-color-alist): New functions. 20673 (tty-color-alist, tty-modify-color-alist): New functions.
20674 (tty-color-define, tty-color-clear, tty-color-approximate) 20674 (tty-color-define, tty-color-clear, tty-color-approximate)
20675 (tty-color-translate, tty-color-by-index, tty-color-desc): Accept an 20675 (tty-color-translate, tty-color-by-index, tty-color-desc): Accept an
20676 optional parameter FRAME. 20676 optional parameter FRAME.
20677 20677
diff --git a/lisp/allout.el b/lisp/allout.el
index acf0b7d75b6..04de853ebe0 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -1522,8 +1522,8 @@ The verifier string is retained as an Emacs file variable, as well as in
1522the Emacs buffer state, if file variable adjustments are enabled. See 1522the Emacs buffer state, if file variable adjustments are enabled. See
1523`allout-enable-file-variable-adjustment' for details about that.") 1523`allout-enable-file-variable-adjustment' for details about that.")
1524(make-variable-buffer-local 'allout-passphrase-verifier-string) 1524(make-variable-buffer-local 'allout-passphrase-verifier-string)
1525(make-obsolete 'allout-passphrase-verifier-string 1525(make-obsolete-variable 'allout-passphrase-verifier-string
1526 'allout-passphrase-verifier-string "23.3") 1526 'allout-passphrase-verifier-string "23.3")
1527;;;###autoload 1527;;;###autoload
1528(put 'allout-passphrase-verifier-string 'safe-local-variable 'stringp) 1528(put 'allout-passphrase-verifier-string 'safe-local-variable 'stringp)
1529;;;_ = allout-passphrase-hint-string 1529;;;_ = allout-passphrase-hint-string
@@ -1538,8 +1538,8 @@ state, if file variable adjustments are enabled. See
1538`allout-enable-file-variable-adjustment' for details about that.") 1538`allout-enable-file-variable-adjustment' for details about that.")
1539(make-variable-buffer-local 'allout-passphrase-hint-string) 1539(make-variable-buffer-local 'allout-passphrase-hint-string)
1540(setq-default allout-passphrase-hint-string "") 1540(setq-default allout-passphrase-hint-string "")
1541(make-obsolete 'allout-passphrase-hint-string 1541(make-obsolete-variable 'allout-passphrase-hint-string
1542 'allout-passphrase-hint-string "23.3") 1542 'allout-passphrase-hint-string "23.3")
1543;;;###autoload 1543;;;###autoload
1544(put 'allout-passphrase-hint-string 'safe-local-variable 'stringp) 1544(put 'allout-passphrase-hint-string 'safe-local-variable 'stringp)
1545;;;_ = allout-after-save-decrypt 1545;;;_ = allout-after-save-decrypt
@@ -1688,11 +1688,10 @@ from what it did before, for backwards compatibility.
1688 1688
1689MODE is the activation mode - see `allout-auto-activation' for 1689MODE is the activation mode - see `allout-auto-activation' for
1690valid values." 1690valid values."
1691 1691 (declare (obsolete allout-auto-activation "23.3"))
1692 (custom-set-variables (list 'allout-auto-activation (format "%s" mode))) 1692 (custom-set-variables (list 'allout-auto-activation (format "%s" mode)))
1693 (format "%s" mode)) 1693 (format "%s" mode))
1694(make-obsolete 'allout-init 1694
1695 "customize 'allout-auto-activation' instead." "23.3")
1696;;;_ > allout-setup-menubar () 1695;;;_ > allout-setup-menubar ()
1697(defun allout-setup-menubar () 1696(defun allout-setup-menubar ()
1698 "Populate the current buffer's menubar with `allout-mode' stuff." 1697 "Populate the current buffer's menubar with `allout-mode' stuff."
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el
index 8305aaf1199..047b4b944b9 100644
--- a/lisp/ansi-color.el
+++ b/lisp/ansi-color.el
@@ -230,8 +230,8 @@ This is a good function to put in `comint-output-filter-functions'."
230 (t 230 (t
231 (ansi-color-apply-on-region start-marker end-marker))))) 231 (ansi-color-apply-on-region start-marker end-marker)))))
232 232
233(defalias 'ansi-color-unfontify-region 'font-lock-default-unfontify-region) 233(define-obsolete-function-alias 'ansi-color-unfontify-region
234(make-obsolete 'ansi-color-unfontify-region "not needed any more" "24.1") 234 'font-lock-default-unfontify-region "24.1")
235 235
236;; Working with strings 236;; Working with strings
237(defvar ansi-color-context nil 237(defvar ansi-color-context nil
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index c776a3f8b5c..a97a052dc08 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1117,13 +1117,54 @@ using `make-temp-file', and the generated name is returned."
1117 (archive-delete-local tmpfile) 1117 (archive-delete-local tmpfile)
1118 success)) 1118 success))
1119 1119
1120(defun archive-extract-by-stdout (archive name command &optional stderr-file) 1120(defun archive-extract-by-stdout (archive name command &optional stderr-test)
1121 (apply 'call-process 1121 (let ((stderr-file (make-temp-file "arc-stderr")))
1122 (car command) 1122 (unwind-protect
1123 nil 1123 (prog1
1124 (if stderr-file (list t stderr-file) t) 1124 (apply 'call-process
1125 nil 1125 (car command)
1126 (append (cdr command) (list archive name)))) 1126 nil
1127 (if stderr-file (list t stderr-file) t)
1128 nil
1129 (append (cdr command) (list archive name)))
1130 (with-temp-buffer
1131 (insert-file-contents stderr-file)
1132 (goto-char (point-min))
1133 (when (if (stringp stderr-test)
1134 (not (re-search-forward stderr-test nil t))
1135 (> (buffer-size) 0))
1136 (message "%s" (buffer-string)))))
1137 (if (file-exists-p stderr-file)
1138 (delete-file stderr-file)))))
1139
1140(defun archive-extract-by-file (archive name command &optional stdout-test)
1141 (let ((dest (make-temp-file "arc-dir" 'dir))
1142 (stdout-file (make-temp-file "arc-stdout")))
1143 (unwind-protect
1144 (prog1
1145 (apply 'call-process
1146 (car command)
1147 nil
1148 `(:file ,stdout-file)
1149 nil
1150 (append (cdr command) (list archive name dest)))
1151 (with-temp-buffer
1152 (insert-file-contents stdout-file)
1153 (goto-char (point-min))
1154 (when (if (stringp stdout-test)
1155 (not (re-search-forward stdout-test nil t))
1156 (> (buffer-size) 0))
1157 (message "%s" (buffer-string))))
1158 (if (file-exists-p (expand-file-name name dest))
1159 (insert-file-contents-literally (expand-file-name name dest))))
1160 (if (file-exists-p stdout-file)
1161 (delete-file stdout-file))
1162 (if (file-exists-p (expand-file-name name dest))
1163 (delete-file (expand-file-name name dest)))
1164 (while (file-name-directory name)
1165 (setq name (directory-file-name (file-name-directory name)))
1166 (delete-directory (expand-file-name name dest)))
1167 (delete-directory dest))))
1127 1168
1128(defun archive-extract-other-window () 1169(defun archive-extract-other-window ()
1129 "In archive mode, find this member in another window." 1170 "In archive mode, find this member in another window."
@@ -2006,17 +2047,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
2006 ;; The code below assumes the name is relative and may do undesirable 2047 ;; The code below assumes the name is relative and may do undesirable
2007 ;; things otherwise. 2048 ;; things otherwise.
2008 (error "Can't extract files with non-relative names") 2049 (error "Can't extract files with non-relative names")
2009 (let ((dest (make-temp-file "arc-rar" 'dir))) 2050 (archive-extract-by-file archive name '("unrar-free" "--extract") "All OK")))
2010 (unwind-protect
2011 (progn
2012 (call-process "unrar-free" nil nil nil
2013 "--extract" archive name dest)
2014 (insert-file-contents-literally (expand-file-name name dest)))
2015 (delete-file (expand-file-name name dest))
2016 (while (file-name-directory name)
2017 (setq name (directory-file-name (file-name-directory name)))
2018 (delete-directory (expand-file-name name dest)))
2019 (delete-directory dest)))))
2020 2051
2021;;; Section: Rar self-extracting .exe archives. 2052;;; Section: Rar self-extracting .exe archives.
2022 2053
@@ -2099,17 +2130,11 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
2099 (apply 'vector files)))) 2130 (apply 'vector files))))
2100 2131
2101(defun archive-7z-extract (archive name) 2132(defun archive-7z-extract (archive name)
2102 (let ((tmpfile (make-temp-file "7z-stderr"))) 2133 ;; 7z doesn't provide a `quiet' option to suppress non-essential
2103 ;; 7z doesn't provide a `quiet' option to suppress non-essential 2134 ;; stderr messages. So redirect stderr to a temp file and display it
2104 ;; stderr messages. So redirect stderr to a temp file and display it 2135 ;; in the echo area when it contains no message indicating success.
2105 ;; in the echo area when it contains error messages. 2136 (archive-extract-by-stdout
2106 (prog1 (archive-extract-by-stdout 2137 archive name archive-7z-extract "Everything is Ok"))
2107 archive name archive-7z-extract tmpfile)
2108 (with-temp-buffer
2109 (insert-file-contents tmpfile)
2110 (unless (search-forward "Everything is Ok" nil t)
2111 (message "%s" (buffer-string)))
2112 (delete-file tmpfile)))))
2113 2138
2114(defun archive-7z-write-file-member (archive descr) 2139(defun archive-7z-write-file-member (archive descr)
2115 (archive-*-write-file-member 2140 (archive-*-write-file-member
diff --git a/lisp/bindings.el b/lisp/bindings.el
index c20a7f30eea..b4f9d29fe52 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -40,7 +40,7 @@ corresponding to the mode line clicked."
40 (interactive "e") 40 (interactive "e")
41 (save-selected-window 41 (save-selected-window
42 (select-window (posn-window (event-start event))) 42 (select-window (posn-window (event-start event)))
43 (call-interactively 'toggle-read-only))) 43 (read-only-mode 'toggle)))
44 44
45(defun mode-line-toggle-modified (event) 45(defun mode-line-toggle-modified (event)
46 "Toggle the buffer-modified flag from the mode-line." 46 "Toggle the buffer-modified flag from the mode-line."
@@ -898,6 +898,7 @@ if `inhibit-field-text-motion' is non-nil."
898(define-key goto-map "\M-n" 'next-error) 898(define-key goto-map "\M-n" 'next-error)
899(define-key goto-map "p" 'previous-error) 899(define-key goto-map "p" 'previous-error)
900(define-key goto-map "\M-p" 'previous-error) 900(define-key goto-map "\M-p" 'previous-error)
901(define-key goto-map "\t" 'move-to-column)
901 902
902(defvar search-map (make-sparse-keymap) 903(defvar search-map (make-sparse-keymap)
903 "Keymap for search related commands.") 904 "Keymap for search related commands.")
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 31bbc13acf9..26ba1dec00f 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1048,12 +1048,11 @@ The return value has the form (BUFFER . POINT).
1048 1048
1049Note: this function is deprecated and is present for Emacs 22 1049Note: this function is deprecated and is present for Emacs 22
1050compatibility only." 1050compatibility only."
1051 (declare (obsolete bookmark-handle-bookmark "23.1"))
1051 (save-excursion 1052 (save-excursion
1052 (bookmark-handle-bookmark bookmark) 1053 (bookmark-handle-bookmark bookmark)
1053 (cons (current-buffer) (point)))) 1054 (cons (current-buffer) (point))))
1054 1055
1055(make-obsolete 'bookmark-jump-noselect 'bookmark-handle-bookmark "23.1")
1056
1057(defun bookmark-handle-bookmark (bookmark-name-or-record) 1056(defun bookmark-handle-bookmark (bookmark-name-or-record)
1058 "Call BOOKMARK-NAME-OR-RECORD's handler or `bookmark-default-handler' 1057 "Call BOOKMARK-NAME-OR-RECORD's handler or `bookmark-default-handler'
1059if it has none. This changes current buffer and point and returns nil, 1058if it has none. This changes current buffer and point and returns nil,
diff --git a/lisp/bs.el b/lisp/bs.el
index 09aefee416e..a84c951acfe 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -962,7 +962,7 @@ Default is `bs--current-sort-function'."
962Uses function `toggle-read-only'." 962Uses function `toggle-read-only'."
963 (interactive) 963 (interactive)
964 (with-current-buffer (bs--current-buffer) 964 (with-current-buffer (bs--current-buffer)
965 (call-interactively 'toggle-read-only)) 965 (read-only-mode 'toggle))
966 (bs--update-current-line)) 966 (bs--update-current-line))
967 967
968(defun bs-clear-modified () 968(defun bs-clear-modified ()
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 589b6ebc47a..6ab6e548ab5 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -64,13 +64,13 @@ minus `Buffer-menu-size-width'. This use is deprecated."
64 "24.3") 64 "24.3")
65 65
66(defcustom Buffer-menu-name-width 19 66(defcustom Buffer-menu-name-width 19
67 "Width of buffer size column in the Buffer Menu." 67 "Width of buffer name column in the Buffer Menu."
68 :type 'number 68 :type 'number
69 :group 'Buffer-menu 69 :group 'Buffer-menu
70 :version "24.3") 70 :version "24.3")
71 71
72(defcustom Buffer-menu-size-width 7 72(defcustom Buffer-menu-size-width 7
73 "Width of buffer name column in the Buffer Menu." 73 "Width of buffer size column in the Buffer Menu."
74 :type 'number 74 :type 'number
75 :group 'Buffer-menu 75 :group 'Buffer-menu
76 :version "24.3") 76 :version "24.3")
@@ -520,7 +520,7 @@ This behaves like invoking \\[toggle-read-only] in that buffer."
520 (interactive) 520 (interactive)
521 (let ((read-only 521 (let ((read-only
522 (with-current-buffer (Buffer-menu-buffer t) 522 (with-current-buffer (Buffer-menu-buffer t)
523 (call-interactively 'toggle-read-only) 523 (read-only-mode 'toggle)
524 buffer-read-only))) 524 buffer-read-only)))
525 (tabulated-list-set-col 1 (if read-only "%" " ") t))) 525 (tabulated-list-set-col 1 (if read-only "%" " ") t)))
526 526
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index 9c01ab40c0c..325ac3e8146 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -1097,7 +1097,7 @@ shown are hard-coded to 8-12, 13-17."
1097 (cal-tex-longday "leftday" "2.75in")) 1097 (cal-tex-longday "leftday" "2.75in"))
1098 (cal-tex-b-document) 1098 (cal-tex-b-document)
1099 (cal-tex-cmd "\\pagestyle" "empty") 1099 (cal-tex-cmd "\\pagestyle" "empty")
1100 ;; Let's assume this is something to with twopage documents. 1100 ;; Let's assume this is something to do with twopage documents.
1101 ;; It has the downside that we start with a blank page. 1101 ;; It has the downside that we start with a blank page.
1102 ;; It doesn't make obvious sense when oddside and evenside margins 1102 ;; It doesn't make obvious sense when oddside and evenside margins
1103 ;; are the same (non-filofax), but consider the left and right 1103 ;; are the same (non-filofax), but consider the left and right
diff --git a/lisp/calendar/cal-x.el b/lisp/calendar/cal-x.el
index 0f2d43b2237..6fba7fb7423 100644
--- a/lisp/calendar/cal-x.el
+++ b/lisp/calendar/cal-x.el
@@ -155,29 +155,23 @@ If PROMPT is non-nil, prompt for the month and year to use."
155(defun calendar-one-frame-setup (&optional prompt) 155(defun calendar-one-frame-setup (&optional prompt)
156 "Display calendar and diary in a single dedicated frame. 156 "Display calendar and diary in a single dedicated frame.
157See `calendar-frame-setup' for more information." 157See `calendar-frame-setup' for more information."
158 (declare (obsolete calendar-frame-setup "23.1"))
158 (calendar-frame-setup 'one-frame prompt)) 159 (calendar-frame-setup 'one-frame prompt))
159 160
160(make-obsolete 'calendar-one-frame-setup 'calendar-frame-setup "23.1")
161
162
163;;;###cal-autoload 161;;;###cal-autoload
164(defun calendar-only-one-frame-setup (&optional prompt) 162(defun calendar-only-one-frame-setup (&optional prompt)
165 "Display calendar in a dedicated frame. 163 "Display calendar in a dedicated frame.
166See `calendar-frame-setup' for more information." 164See `calendar-frame-setup' for more information."
165 (declare (obsolete calendar-frame-setup "23.1"))
167 (calendar-frame-setup 'calendar-only prompt)) 166 (calendar-frame-setup 'calendar-only prompt))
168 167
169(make-obsolete 'calendar-only-one-frame-setup 'calendar-frame-setup "23.1")
170
171
172;;;###cal-autoload 168;;;###cal-autoload
173(defun calendar-two-frame-setup (&optional prompt) 169(defun calendar-two-frame-setup (&optional prompt)
174 "Display calendar and diary in separate, dedicated frames. 170 "Display calendar and diary in separate, dedicated frames.
175See `calendar-frame-setup' for more information." 171See `calendar-frame-setup' for more information."
172 (declare (obsolete calendar-frame-setup "23.1"))
176 (calendar-frame-setup 'two-frames prompt)) 173 (calendar-frame-setup 'two-frames prompt))
177 174
178(make-obsolete 'calendar-two-frame-setup 'calendar-frame-setup "23.1")
179
180
181;; Undocumented and probably useless. 175;; Undocumented and probably useless.
182(defvar cal-x-load-hook nil 176(defvar cal-x-load-hook nil
183 "Hook run on loading of the `cal-x' package.") 177 "Hook run on loading of the `cal-x' package.")
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 93ef440541e..6f8311f4c55 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1001,18 +1001,16 @@ The valid styles are described in the documentation of `calendar-date-style'."
1001 1001
1002(defun european-calendar () 1002(defun european-calendar ()
1003 "Set the interpretation and display of dates to the European style." 1003 "Set the interpretation and display of dates to the European style."
1004 (declare (obsolete calendar-set-date-style "23.1"))
1004 (interactive) 1005 (interactive)
1005 (calendar-set-date-style 'european)) 1006 (calendar-set-date-style 'european))
1006 1007
1007(make-obsolete 'european-calendar 'calendar-set-date-style "23.1")
1008
1009(defun american-calendar () 1008(defun american-calendar ()
1010 "Set the interpretation and display of dates to the American style." 1009 "Set the interpretation and display of dates to the American style."
1010 (declare (obsolete calendar-set-date-style "23.1"))
1011 (interactive) 1011 (interactive)
1012 (calendar-set-date-style 'american)) 1012 (calendar-set-date-style 'american))
1013 1013
1014(make-obsolete 'american-calendar 'calendar-set-date-style "23.1")
1015
1016(define-obsolete-variable-alias 'holidays-in-diary-buffer 1014(define-obsolete-variable-alias 'holidays-in-diary-buffer
1017 'diary-show-holidays-flag "23.1") 1015 'diary-show-holidays-flag "23.1")
1018 1016
@@ -1148,14 +1146,13 @@ MON defaults to `displayed-month'. YR defaults to `displayed-year'."
1148 "Execute a for loop. 1146 "Execute a for loop.
1149Evaluate BODY with VAR bound to successive integers from INIT to FINAL, 1147Evaluate BODY with VAR bound to successive integers from INIT to FINAL,
1150inclusive. The standard macro `dotimes' is preferable in most cases." 1148inclusive. The standard macro `dotimes' is preferable in most cases."
1151 (declare (debug (symbolp "from" form "to" form "do" body)) 1149 (declare (obsolete "use `dotimes' or `while' instead." "23.1")
1150 (debug (symbolp "from" form "to" form "do" body))
1152 (indent defun)) 1151 (indent defun))
1153 `(let ((,var (1- ,init))) 1152 `(let ((,var (1- ,init)))
1154 (while (>= ,final (setq ,var (1+ ,var))) 1153 (while (>= ,final (setq ,var (1+ ,var)))
1155 ,@body))) 1154 ,@body)))
1156 1155
1157(make-obsolete 'calendar-for-loop "use `dotimes' or `while' instead." "23.1")
1158
1159(defmacro calendar-sum (index initial condition expression) 1156(defmacro calendar-sum (index initial condition expression)
1160 "For INDEX = INITIAL, +1, ... (as long as CONDITION holds), sum EXPRESSION." 1157 "For INDEX = INITIAL, +1, ... (as long as CONDITION holds), sum EXPRESSION."
1161 (declare (debug (symbolp form form form))) 1158 (declare (debug (symbolp form form form)))
@@ -2298,7 +2295,7 @@ Negative years are interpreted as years BC; -1 being 1 BC, and so on."
2298 ;; First two chars of each day are used in the calendar. 2295 ;; First two chars of each day are used in the calendar.
2299 (,(regexp-opt (mapcar (lambda (x) (substring x 0 calendar-day-header-width)) 2296 (,(regexp-opt (mapcar (lambda (x) (substring x 0 calendar-day-header-width))
2300 calendar-day-name-array)) 2297 calendar-day-name-array))
2301 . font-lock-reference-face)) 2298 . font-lock-constant-face))
2302 "Default keywords to highlight in Calendar mode.") 2299 "Default keywords to highlight in Calendar mode.")
2303 2300
2304(defun calendar-day-name (date &optional abbrev absolute) 2301(defun calendar-day-name (date &optional abbrev absolute)
@@ -2655,13 +2652,7 @@ If called by a mouse-event, pops up a menu with the result."
2655 "---") 2652 "---")
2656 (calendar-string-spread (list str) ?- width))))) 2653 (calendar-string-spread (list str) ?- width)))))
2657 2654
2658(defun calendar-version () 2655(define-obsolete-function-alias 'calendar-version 'emacs-version "23.1")
2659 "Display the Calendar version."
2660 (interactive)
2661 (message "GNU Emacs %s" emacs-version))
2662
2663(make-obsolete 'calendar-version 'emacs-version "23.1")
2664
2665 2656
2666(run-hooks 'calendar-load-hook) 2657(run-hooks 'calendar-load-hook)
2667 2658
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 4bce8ec0927..27c6f76581c 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -2400,10 +2400,10 @@ return a font-lock pattern matching array of MONTHS and marking SYMBOL."
2400 (cons 2400 (cons
2401 (format "^%s?\\(%s\\)" (regexp-quote diary-nonmarking-symbol) 2401 (format "^%s?\\(%s\\)" (regexp-quote diary-nonmarking-symbol)
2402 (regexp-quote diary-sexp-entry-symbol)) 2402 (regexp-quote diary-sexp-entry-symbol))
2403 '(1 font-lock-reference-face)) 2403 '(1 font-lock-constant-face))
2404 (cons 2404 (cons
2405 (format "^%s" (regexp-quote diary-nonmarking-symbol)) 2405 (format "^%s" (regexp-quote diary-nonmarking-symbol))
2406 'font-lock-reference-face) 2406 'font-lock-constant-face)
2407 (cons 2407 (cons
2408 (format "^%s?%s" (regexp-quote diary-nonmarking-symbol) 2408 (format "^%s?%s" (regexp-quote diary-nonmarking-symbol)
2409 (regexp-opt (mapcar 'regexp-quote 2409 (regexp-opt (mapcar 'regexp-quote
@@ -2411,7 +2411,7 @@ return a font-lock pattern matching array of MONTHS and marking SYMBOL."
2411 diary-islamic-entry-symbol 2411 diary-islamic-entry-symbol
2412 diary-bahai-entry-symbol)) 2412 diary-bahai-entry-symbol))
2413 t)) 2413 t))
2414 '(1 font-lock-reference-face)) 2414 '(1 font-lock-constant-face))
2415 '(diary-font-lock-sexps . font-lock-keyword-face) 2415 '(diary-font-lock-sexps . font-lock-keyword-face)
2416 ;; Don't need to worry about space around "-" because the first 2416 ;; Don't need to worry about space around "-" because the first
2417 ;; match takes care of that. It does mean the "-" itself may or 2417 ;; match takes care of that. It does mean the "-" itself may or
@@ -2482,7 +2482,7 @@ This depends on the calendar date style."
2482(defvar diary-fancy-font-lock-keywords 2482(defvar diary-fancy-font-lock-keywords
2483 `((diary-fancy-date-matcher . diary-face) 2483 `((diary-fancy-date-matcher . diary-face)
2484 ("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary) 2484 ("^.*\\([aA]nniversary\\|[bB]irthday\\).*$" . 'diary-anniversary)
2485 ("^.*Yahrzeit.*$" . font-lock-reference-face) 2485 ("^.*Yahrzeit.*$" . font-lock-constant-face)
2486 ("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face) 2486 ("^\\(Erev \\)?Rosh Hodesh.*" . font-lock-function-name-face)
2487 ("^Day.*omer.*$" . font-lock-builtin-face) 2487 ("^Day.*omer.*$" . font-lock-builtin-face)
2488 ("^Parashat.*$" . font-lock-comment-face) 2488 ("^Parashat.*$" . font-lock-comment-face)
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index 7326aa530ad..39b83d4c831 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -931,8 +931,8 @@ Finto iCalendar file: ")
931 (set-buffer (find-file diary-filename)) 931 (set-buffer (find-file diary-filename))
932 (icalendar-export-region (point-min) (point-max) ical-filename))) 932 (icalendar-export-region (point-min) (point-max) ical-filename)))
933 933
934(defalias 'icalendar-convert-diary-to-ical 'icalendar-export-file) 934(define-obsolete-function-alias 'icalendar-convert-diary-to-ical
935(make-obsolete 'icalendar-convert-diary-to-ical 'icalendar-export-file "22.1") 935 'icalendar-export-file "22.1")
936 936
937(defvar icalendar--uid-count 0 937(defvar icalendar--uid-count 0
938 "Auxiliary counter for creating unique ids.") 938 "Auxiliary counter for creating unique ids.")
@@ -1881,8 +1881,8 @@ buffer `*icalendar-errors*'."
1881 ;; return nil, i.e. import did not work 1881 ;; return nil, i.e. import did not work
1882 nil))) 1882 nil)))
1883 1883
1884(defalias 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer) 1884(define-obsolete-function-alias 'icalendar-extract-ical-from-buffer
1885(make-obsolete 'icalendar-extract-ical-from-buffer 'icalendar-import-buffer "22.1") 1885 'icalendar-import-buffer "22.1")
1886 1886
1887(defun icalendar--format-ical-event (event) 1887(defun icalendar--format-ical-event (event)
1888 "Create a string representation of an iCalendar EVENT." 1888 "Create a string representation of an iCalendar EVENT."
diff --git a/lisp/comint.el b/lisp/comint.el
index 994d81a375a..fea9cecfa03 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3069,11 +3069,11 @@ Magic characters are those in `comint-file-name-quote-list'."
3069 3069
3070(defun comint-unquote-filename (filename) 3070(defun comint-unquote-filename (filename)
3071 "Return FILENAME with quoted characters unquoted." 3071 "Return FILENAME with quoted characters unquoted."
3072 (declare (obsolete nil "24.3"))
3072 (if (null comint-file-name-quote-list) 3073 (if (null comint-file-name-quote-list)
3073 filename 3074 filename
3074 (save-match-data 3075 (save-match-data
3075 (replace-regexp-in-string "\\\\\\(.\\)" "\\1" filename t)))) 3076 (replace-regexp-in-string "\\\\\\(.\\)" "\\1" filename t))))
3076(make-obsolete 'comint-unquote-filename nil "24.3")
3077 3077
3078(defun comint--requote-argument (upos qstr) 3078(defun comint--requote-argument (upos qstr)
3079 ;; See `completion-table-with-quoting'. 3079 ;; See `completion-table-with-quoting'.
@@ -3170,10 +3170,9 @@ See `completion-table-with-quoting' and `comint-unquote-function'.")
3170(defun comint-dynamic-complete-as-filename () 3170(defun comint-dynamic-complete-as-filename ()
3171 "Dynamically complete at point as a filename. 3171 "Dynamically complete at point as a filename.
3172See `comint-dynamic-complete-filename'. Returns t if successful." 3172See `comint-dynamic-complete-filename'. Returns t if successful."
3173 (declare (obsolete comint-filename-completion "24.1"))
3173 (let ((data (comint--complete-file-name-data))) 3174 (let ((data (comint--complete-file-name-data)))
3174 (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)))) 3175 (completion-in-region (nth 0 data) (nth 1 data) (nth 2 data))))
3175(make-obsolete 'comint-dynamic-complete-as-filename
3176 'comint-filename-completion "24.1")
3177 3176
3178(defun comint-replace-by-expanded-filename () 3177(defun comint-replace-by-expanded-filename ()
3179 "Dynamically expand and complete the filename at point. 3178 "Dynamically expand and complete the filename at point.
@@ -3204,6 +3203,7 @@ Return `partial' if completed as far as possible.
3204Return `listed' if a completion listing was shown. 3203Return `listed' if a completion listing was shown.
3205 3204
3206See also `comint-dynamic-complete-filename'." 3205See also `comint-dynamic-complete-filename'."
3206 (declare (obsolete completion-in-region "24.1"))
3207 (let* ((completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin))) 3207 (let* ((completion-ignore-case (memq system-type '(ms-dos windows-nt cygwin)))
3208 (minibuffer-p (window-minibuffer-p (selected-window))) 3208 (minibuffer-p (window-minibuffer-p (selected-window)))
3209 (suffix (cond ((not comint-completion-addsuffix) "") 3209 (suffix (cond ((not comint-completion-addsuffix) "")
@@ -3246,8 +3246,6 @@ See also `comint-dynamic-complete-filename'."
3246 (unless minibuffer-p 3246 (unless minibuffer-p
3247 (message "Partially completed")) 3247 (message "Partially completed"))
3248 'partial))))))) 3248 'partial)))))))
3249(make-obsolete 'comint-dynamic-simple-complete 'completion-in-region "24.1")
3250
3251 3249
3252(defun comint-dynamic-list-filename-completions () 3250(defun comint-dynamic-list-filename-completions ()
3253 "Display a list of possible completions for the filename at point." 3251 "Display a list of possible completions for the filename at point."
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 2e6f2b14625..8e06b16bd12 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2228,9 +2228,9 @@ and `face'."
2228 (setq widget nil))))) 2228 (setq widget nil)))))
2229 (widget-setup)) 2229 (widget-setup))
2230 2230
2231(make-obsolete 'custom-show "this widget type is no longer supported." "24.1")
2232(defun custom-show (widget value) 2231(defun custom-show (widget value)
2233 "Non-nil if WIDGET should be shown with VALUE by default." 2232 "Non-nil if WIDGET should be shown with VALUE by default."
2233 (declare (obsolete "this widget type is no longer supported." "24.1"))
2234 (let ((show (widget-get widget :custom-show))) 2234 (let ((show (widget-get widget :custom-show)))
2235 (if (functionp show) 2235 (if (functionp show)
2236 (funcall show widget value) 2236 (funcall show widget value)
@@ -4823,12 +4823,7 @@ if that value is non-nil."
4823 4823
4824(put 'Custom-mode 'mode-class 'special) 4824(put 'Custom-mode 'mode-class 'special)
4825 4825
4826;; backward-compatibility 4826(define-obsolete-function-alias 'custom-mode 'Custom-mode "23.1")
4827(defun custom-mode ()
4828 "Non-interactive variant of `Custom-mode'."
4829 (Custom-mode))
4830(make-obsolete 'custom-mode 'Custom-mode "23.1")
4831(put 'custom-mode 'mode-class 'special)
4832 4827
4833(add-to-list 'debug-ignored-errors "^Invalid face:? ") 4828(add-to-list 'debug-ignored-errors "^Invalid face:? ")
4834 4829
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index a91a479b054..28c1d3e3026 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -443,7 +443,6 @@ since it could result in memory overflow and make Emacs crash."
443 (hscroll-step windows number "22.1") 443 (hscroll-step windows number "22.1")
444 (truncate-partial-width-windows display boolean "23.1") 444 (truncate-partial-width-windows display boolean "23.1")
445 (make-cursor-line-fully-visible windows boolean) 445 (make-cursor-line-fully-visible windows boolean)
446 (mode-line-inverse-video mode-line boolean)
447 (mode-line-in-non-selected-windows mode-line boolean "22.1") 446 (mode-line-in-non-selected-windows mode-line boolean "22.1")
448 (line-number-display-limit display 447 (line-number-display-limit display
449 (choice integer 448 (choice integer
diff --git a/lisp/custom.el b/lisp/custom.el
index dfc8e631152..dc810e3c97d 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1193,7 +1193,8 @@ Return t if THEME was successfully loaded, nil otherwise."
1193 (expand-file-name "themes/" data-directory))) 1193 (expand-file-name "themes/" data-directory)))
1194 (member hash custom-safe-themes) 1194 (member hash custom-safe-themes)
1195 (custom-theme-load-confirm hash)) 1195 (custom-theme-load-confirm hash))
1196 (let ((custom--inhibit-theme-enable t)) 1196 (let ((custom--inhibit-theme-enable t)
1197 (buffer-file-name fn)) ;For load-history.
1197 (eval-buffer)) 1198 (eval-buffer))
1198 ;; Optimization: if the theme changes the `default' face, put that 1199 ;; Optimization: if the theme changes the `default' face, put that
1199 ;; entry first. This avoids some `frame-set-background-mode' rigmarole 1200 ;; entry first. This avoids some `frame-set-background-mode' rigmarole
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 75deb58b4d8..c8023bb43ed 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1045,11 +1045,10 @@ Using it may cause conflicts. Use it anyway? " owner)))))
1045(defun desktop-load-default () 1045(defun desktop-load-default ()
1046 "Load the `default' start-up library manually. 1046 "Load the `default' start-up library manually.
1047Also inhibit further loading of it." 1047Also inhibit further loading of it."
1048 (declare (obsolete desktop-save-mode "22.1"))
1048 (unless inhibit-default-init ; safety check 1049 (unless inhibit-default-init ; safety check
1049 (load "default" t t) 1050 (load "default" t t)
1050 (setq inhibit-default-init t))) 1051 (setq inhibit-default-init t)))
1051(make-obsolete 'desktop-load-default
1052 'desktop-save-mode "22.1")
1053 1052
1054;; ---------------------------------------------------------------------------- 1053;; ----------------------------------------------------------------------------
1055;;;###autoload 1054;;;###autoload
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index f176cf7dbe0..1237eef86cf 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -723,15 +723,13 @@ determine a default directory.")
723(defun dired-default-directory () 723(defun dired-default-directory ()
724 "Return the `dired-default-directory-alist' entry for the current major-mode. 724 "Return the `dired-default-directory-alist' entry for the current major-mode.
725If none, return `default-directory'." 725If none, return `default-directory'."
726 ;; It looks like this was intended to be something of a "general"
727 ;; feature, but it only ever seems to have been used in
728 ;; dired-smart-shell-command, and doesn't seem worth keeping around.
729 (declare (obsolete nil "24.1"))
726 (or (eval (cdr (assq major-mode dired-default-directory-alist))) 730 (or (eval (cdr (assq major-mode dired-default-directory-alist)))
727 default-directory)) 731 default-directory))
728 732
729;; It looks like this was intended to be something of a "general" feature,
730;; but it only ever seems to have been used in dired-smart-shell-command,
731;; and does not seem worth keeping around (?).
732(make-obsolete 'dired-default-directory
733 "this feature is due to be removed." "24.1")
734
735(defun dired-smart-shell-command (command &optional output-buffer error-buffer) 733(defun dired-smart-shell-command (command &optional output-buffer error-buffer)
736 "Like function `shell-command', but in the current Virtual Dired directory." 734 "Like function `shell-command', but in the current Virtual Dired directory."
737 (interactive 735 (interactive
@@ -782,6 +780,7 @@ See also `dired-enable-local-variables'."
782 780
783(defun dired-hack-local-variables () 781(defun dired-hack-local-variables ()
784 "Evaluate local variables in `dired-local-variables-file' for dired buffer." 782 "Evaluate local variables in `dired-local-variables-file' for dired buffer."
783 (declare (obsolete hack-dir-local-variables-non-file-buffer "24.1"))
785 (and (stringp dired-local-variables-file) 784 (and (stringp dired-local-variables-file)
786 (file-exists-p dired-local-variables-file) 785 (file-exists-p dired-local-variables-file)
787 (let ((opoint (point-max)) 786 (let ((opoint (point-max))
@@ -803,14 +802,12 @@ See also `dired-enable-local-variables'."
803 ;; Make sure that the mode line shows the proper information. 802 ;; Make sure that the mode line shows the proper information.
804 (dired-sort-set-mode-line)))) 803 (dired-sort-set-mode-line))))
805 804
806(make-obsolete 'dired-hack-local-variables
807 'hack-dir-local-variables-non-file-buffer "24.1")
808
809;; Does not seem worth a dedicated command. 805;; Does not seem worth a dedicated command.
810;; See the more general features in files-x.el. 806;; See the more general features in files-x.el.
811(defun dired-omit-here-always () 807(defun dired-omit-here-always ()
812 "Create `dir-locals-file' setting `dired-omit-mode' to t in `dired-mode'. 808 "Create `dir-locals-file' setting `dired-omit-mode' to t in `dired-mode'.
813If in a Dired buffer, reverts it." 809If in a Dired buffer, reverts it."
810 (declare (obsolete add-dir-local-variable "24.1"))
814 (interactive) 811 (interactive)
815 (if (file-exists-p dired-local-variables-file) 812 (if (file-exists-p dired-local-variables-file)
816 (error "Old-style dired-local-variables-file `./%s' found; 813 (error "Old-style dired-local-variables-file `./%s' found;
@@ -830,8 +827,6 @@ replace it with a dir-locals-file `./%s'"
830 (dired-extra-startup) 827 (dired-extra-startup)
831 (dired-revert)))) 828 (dired-revert))))
832 829
833(make-obsolete 'dired-omit-here-always 'add-dir-local-variable "24.1")
834
835 830
836;;; GUESS SHELL COMMAND. 831;;; GUESS SHELL COMMAND.
837 832
diff --git a/lisp/dired.el b/lisp/dired.el
index 6defd6c4877..8cb3902161a 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1964,7 +1964,7 @@ Otherwise, call `toggle-read-only'."
1964 (interactive) 1964 (interactive)
1965 (if (derived-mode-p 'dired-mode) 1965 (if (derived-mode-p 'dired-mode)
1966 (wdired-change-to-wdired-mode) 1966 (wdired-change-to-wdired-mode)
1967 (call-interactively 'toggle-read-only))) 1967 (read-only-mode 'toggle)))
1968 1968
1969(defun dired-next-line (arg) 1969(defun dired-next-line (arg)
1970 "Move down lines then position at filename. 1970 "Move down lines then position at filename.
@@ -2997,7 +2997,8 @@ argument or confirmation)."
2997 (let ((split-height-threshold 0)) 2997 (let ((split-height-threshold 0))
2998 (with-temp-buffer-window 2998 (with-temp-buffer-window
2999 buffer 2999 buffer
3000 (cons 'display-buffer-below-selected nil) 3000 (cons 'display-buffer-below-selected
3001 '((window-height . fit-window-to-buffer)))
3001 #'(lambda (window _value) 3002 #'(lambda (window _value)
3002 (with-selected-window window 3003 (with-selected-window window
3003 (unwind-protect 3004 (unwind-protect
@@ -4268,7 +4269,7 @@ instead.
4268;;;*** 4269;;;***
4269 4270
4270;;;### (autoloads (dired-do-relsymlink dired-jump-other-window dired-jump) 4271;;;### (autoloads (dired-do-relsymlink dired-jump-other-window dired-jump)
4271;;;;;; "dired-x" "dired-x.el" "d2461aa6efb8c1d7de8f245728ab448e") 4272;;;;;; "dired-x" "dired-x.el" "a4e6844421c2c5e6fde90e959fbcc26f")
4272;;; Generated autoloads from dired-x.el 4273;;; Generated autoloads from dired-x.el
4273 4274
4274(autoload 'dired-jump "dired-x" "\ 4275(autoload 'dired-jump "dired-x" "\
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 158d447a1d4..f8975a57b7b 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -255,20 +255,23 @@ of the page moves to the previous page."
255;;;; Internal Variables 255;;;; Internal Variables
256 256
257(defun doc-view-new-window-function (winprops) 257(defun doc-view-new-window-function (winprops)
258 ;; (message "New window %s for buf %s" (car winprops) (current-buffer))
259 (cl-assert (or (eq t (car winprops))
260 (eq (window-buffer (car winprops)) (current-buffer))))
258 (let ((ol (image-mode-window-get 'overlay winprops))) 261 (let ((ol (image-mode-window-get 'overlay winprops)))
259 (when (and ol (not (overlay-buffer ol)))
260 ;; I've seen `ol' be a dead overlay. I do not yet know how this
261 ;; happened, so maybe the bug is elsewhere, but in the mean time,
262 ;; this seems like a safe approach.
263 (setq ol nil))
264 (if ol 262 (if ol
265 (progn 263 (progn
266 (cl-assert (eq (overlay-buffer ol) (current-buffer))) 264 (setq ol (copy-overlay ol))
267 (setq ol (copy-overlay ol))) 265 ;; `ol' might actually be dead.
268 (cl-assert (not (get-char-property (point-min) 'display))) 266 (move-overlay ol (point-min) (point-max)))
269 (setq ol (make-overlay (point-min) (point-max) nil t)) 267 (setq ol (make-overlay (point-min) (point-max) nil t))
270 (overlay-put ol 'doc-view t)) 268 (overlay-put ol 'doc-view t))
271 (overlay-put ol 'window (car winprops)) 269 (overlay-put ol 'window (car winprops))
270 (unless (windowp (car winprops))
271 ;; It's a pseudo entry. Let's make sure it's not displayed (the
272 ;; `window' property is only effective if its value is a window).
273 (cl-assert (eq t (car winprops)))
274 (delete-overlay ol))
272 (image-mode-window-put 'overlay ol winprops))) 275 (image-mode-window-put 'overlay ol winprops)))
273 276
274(defvar doc-view-current-files nil 277(defvar doc-view-current-files nil
@@ -560,7 +563,8 @@ at the top edge of the page moves to the previous page."
560 "Kill the current converter process(es)." 563 "Kill the current converter process(es)."
561 (interactive) 564 (interactive)
562 (while (consp doc-view-current-converter-processes) 565 (while (consp doc-view-current-converter-processes)
563 (ignore-errors ;; Maybe it's dead already? 566 (ignore-errors ;; Some entries might not be processes, and maybe
567 ;; some are dead already?
564 (kill-process (pop doc-view-current-converter-processes)))) 568 (kill-process (pop doc-view-current-converter-processes))))
565 (when doc-view-current-timer 569 (when doc-view-current-timer
566 (cancel-timer doc-view-current-timer) 570 (cancel-timer doc-view-current-timer)
@@ -663,19 +667,21 @@ OpenDocument format)."
663(defvar doc-view-shrink-factor 1.125) 667(defvar doc-view-shrink-factor 1.125)
664 668
665(defun doc-view-enlarge (factor) 669(defun doc-view-enlarge (factor)
666 "Enlarge the document." 670 "Enlarge the document by FACTOR."
667 (interactive (list doc-view-shrink-factor)) 671 (interactive (list doc-view-shrink-factor))
668 (if (eq (plist-get (cdr (doc-view-current-image)) :type) 672 (if (eq (plist-get (cdr (doc-view-current-image)) :type)
669 'imagemagick) 673 'imagemagick)
670 ;; ImageMagick supports on-the-fly-rescaling 674 ;; ImageMagick supports on-the-fly-rescaling.
671 (progn 675 (let ((new (ceiling (* factor doc-view-image-width))))
672 (set (make-local-variable 'doc-view-image-width) 676 (unless (equal new doc-view-image-width)
673 (ceiling (* factor doc-view-image-width))) 677 (set (make-local-variable 'doc-view-image-width) new)
674 (doc-view-insert-image (plist-get (cdr (doc-view-current-image)) :file) 678 (doc-view-insert-image
675 :width doc-view-image-width)) 679 (plist-get (cdr (doc-view-current-image)) :file)
676 (set (make-local-variable 'doc-view-resolution) 680 :width doc-view-image-width)))
677 (ceiling (* factor doc-view-resolution))) 681 (let ((new (ceiling (* factor doc-view-resolution))))
678 (doc-view-reconvert-doc))) 682 (unless (equal new doc-view-resolution)
683 (set (make-local-variable 'doc-view-resolution) new)
684 (doc-view-reconvert-doc)))))
679 685
680(defun doc-view-shrink (factor) 686(defun doc-view-shrink (factor)
681 "Shrink the document." 687 "Shrink the document."
@@ -743,12 +749,14 @@ min {(window-width / image-width), (window-height / image-height)} times."
743 (img-height (cdr (image-display-size 749 (img-height (cdr (image-display-size
744 (image-get-display-property) t)))) 750 (image-get-display-property) t))))
745 (doc-view-enlarge (min (/ (float win-width) (float img-width)) 751 (doc-view-enlarge (min (/ (float win-width) (float img-width))
746 (/ (float (- win-height 1)) (float img-height))))) 752 (/ (float (- win-height 1))
753 (float img-height)))))
747 ;; If slice is set 754 ;; If slice is set
748 (let* ((slice-width (nth 2 slice)) 755 (let* ((slice-width (nth 2 slice))
749 (slice-height (nth 3 slice)) 756 (slice-height (nth 3 slice))
750 (scale-factor (min (/ (float win-width) (float slice-width)) 757 (scale-factor (min (/ (float win-width) (float slice-width))
751 (/ (float (- win-height 1)) (float slice-height)))) 758 (/ (float (- win-height 1))
759 (float slice-height))))
752 (new-slice (mapcar (lambda (x) (ceiling (* scale-factor x))) slice))) 760 (new-slice (mapcar (lambda (x) (ceiling (* scale-factor x))) slice)))
753 (doc-view-enlarge scale-factor) 761 (doc-view-enlarge scale-factor)
754 (setf (doc-view-current-slice) new-slice) 762 (setf (doc-view-current-slice) new-slice)
@@ -762,6 +770,7 @@ Should be invoked when the cached images aren't up-to-date."
762 ;; Clear the old cached files 770 ;; Clear the old cached files
763 (when (file-exists-p (doc-view-current-cache-dir)) 771 (when (file-exists-p (doc-view-current-cache-dir))
764 (delete-directory (doc-view-current-cache-dir) 'recursive)) 772 (delete-directory (doc-view-current-cache-dir) 'recursive))
773 (kill-local-variable 'doc-view-last-page-number)
765 (doc-view-initiate-display)) 774 (doc-view-initiate-display))
766 775
767(defun doc-view-sentinel (proc event) 776(defun doc-view-sentinel (proc event)
@@ -895,6 +904,11 @@ Start by converting PAGES, and then the rest."
895 (list "-raw" pdf txt) 904 (list "-raw" pdf txt)
896 callback)) 905 callback))
897 906
907(defun doc-view-current-cache-doc-pdf ()
908 "Return the name of the doc.pdf in the current cache dir.
909 This file exists only if the current document isn't a PDF or PS file already."
910 (expand-file-name "doc.pdf" (doc-view-current-cache-dir)))
911
898(defun doc-view-doc->txt (txt callback) 912(defun doc-view-doc->txt (txt callback)
899 "Convert the current document to text and call CALLBACK when done." 913 "Convert the current document to text and call CALLBACK when done."
900 (make-directory (doc-view-current-cache-dir) t) 914 (make-directory (doc-view-current-cache-dir) t)
@@ -905,22 +919,17 @@ Start by converting PAGES, and then the rest."
905 (`ps 919 (`ps
906 ;; Doc is a PS, so convert it to PDF (which will be converted to 920 ;; Doc is a PS, so convert it to PDF (which will be converted to
907 ;; TXT thereafter). 921 ;; TXT thereafter).
908 (let ((pdf (expand-file-name "doc.pdf" 922 (let ((pdf (doc-view-current-cache-doc-pdf)))
909 (doc-view-current-cache-dir))))
910 (doc-view-ps->pdf doc-view-buffer-file-name pdf 923 (doc-view-ps->pdf doc-view-buffer-file-name pdf
911 (lambda () (doc-view-pdf->txt pdf txt callback))))) 924 (lambda () (doc-view-pdf->txt pdf txt callback)))))
912 (`dvi 925 (`dvi
913 ;; Doc is a DVI. This means that a doc.pdf already exists in its 926 ;; Doc is a DVI. This means that a doc.pdf already exists in its
914 ;; cache subdirectory. 927 ;; cache subdirectory.
915 (doc-view-pdf->txt (expand-file-name "doc.pdf" 928 (doc-view-pdf->txt (doc-view-current-cache-doc-pdf) txt callback))
916 (doc-view-current-cache-dir))
917 txt callback))
918 (`odf 929 (`odf
919 ;; Doc is some ODF (or MS Office) doc. This means that a doc.pdf 930 ;; Doc is some ODF (or MS Office) doc. This means that a doc.pdf
920 ;; already exists in its cache subdirectory. 931 ;; already exists in its cache subdirectory.
921 (doc-view-pdf->txt (expand-file-name "doc.pdf" 932 (doc-view-pdf->txt (doc-view-current-cache-doc-pdf) txt callback))
922 (doc-view-current-cache-dir))
923 txt callback))
924 (_ (error "DocView doesn't know what to do")))) 933 (_ (error "DocView doesn't know what to do"))))
925 934
926(defun doc-view-ps->pdf (ps pdf callback) 935(defun doc-view-ps->pdf (ps pdf callback)
@@ -960,13 +969,13 @@ Those files are saved in the directory given by the function
960 (`dvi 969 (`dvi
961 ;; DVI files have to be converted to PDF before Ghostscript can process 970 ;; DVI files have to be converted to PDF before Ghostscript can process
962 ;; it. 971 ;; it.
963 (let ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir))) 972 (let ((pdf (doc-view-current-cache-doc-pdf)))
964 (doc-view-dvi->pdf doc-view-buffer-file-name pdf 973 (doc-view-dvi->pdf doc-view-buffer-file-name pdf
965 (lambda () (doc-view-pdf/ps->png pdf png-file))))) 974 (lambda () (doc-view-pdf/ps->png pdf png-file)))))
966 (`odf 975 (`odf
967 ;; ODF files have to be converted to PDF before Ghostscript can 976 ;; ODF files have to be converted to PDF before Ghostscript can
968 ;; process it. 977 ;; process it.
969 (let ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir)) 978 (let ((pdf (doc-view-current-cache-doc-pdf))
970 (opdf (expand-file-name (concat (file-name-base doc-view-buffer-file-name) 979 (opdf (expand-file-name (concat (file-name-base doc-view-buffer-file-name)
971 ".pdf") 980 ".pdf")
972 doc-view-current-cache-dir)) 981 doc-view-current-cache-dir))
@@ -1033,12 +1042,15 @@ dragging it to its bottom-right corner. See also
1033(defun doc-view-get-bounding-box () 1042(defun doc-view-get-bounding-box ()
1034 "Get the BoundingBox information of the current page." 1043 "Get the BoundingBox information of the current page."
1035 (let* ((page (doc-view-current-page)) 1044 (let* ((page (doc-view-current-page))
1045 (doc (let ((cache-doc (doc-view-current-cache-doc-pdf)))
1046 (if (file-exists-p cache-doc)
1047 cache-doc
1048 doc-view-buffer-file-name)))
1036 (o (shell-command-to-string 1049 (o (shell-command-to-string
1037 (concat doc-view-ghostscript-program 1050 (concat doc-view-ghostscript-program
1038 " -dSAFER -dBATCH -dNOPAUSE -q -sDEVICE=bbox " 1051 " -dSAFER -dBATCH -dNOPAUSE -q -sDEVICE=bbox "
1039 (format "-dFirstPage=%s -dLastPage=%s %s" 1052 (format "-dFirstPage=%s -dLastPage=%s %s"
1040 page page 1053 page page doc)))))
1041 doc-view-buffer-file-name)))))
1042 (save-match-data 1054 (save-match-data
1043 (when (string-match (concat "%%BoundingBox: " 1055 (when (string-match (concat "%%BoundingBox: "
1044 "\\([[:digit:]]+\\) \\([[:digit:]]+\\) " 1056 "\\([[:digit:]]+\\) \\([[:digit:]]+\\) "
@@ -1169,24 +1181,23 @@ Predicate for sorting `doc-view-current-files'."
1169If FORCE is non-nil, start viewing even if the document does not 1181If FORCE is non-nil, start viewing even if the document does not
1170have the page we want to view." 1182have the page we want to view."
1171 (with-current-buffer buffer 1183 (with-current-buffer buffer
1172 (let ((prev-pages doc-view-current-files) 1184 (let ((prev-pages doc-view-current-files))
1173 (windows (get-buffer-window-list buffer nil t)))
1174 (setq doc-view-current-files 1185 (setq doc-view-current-files
1175 (sort (directory-files (doc-view-current-cache-dir) t 1186 (sort (directory-files (doc-view-current-cache-dir) t
1176 "page-[0-9]+\\.png" t) 1187 "page-[0-9]+\\.png" t)
1177 'doc-view-sort)) 1188 'doc-view-sort))
1178 (unless windows 1189 (dolist (win (or (get-buffer-window-list buffer nil t)
1179 (switch-to-buffer buffer) 1190 (list t)))
1180 (setq windows (get-buffer-window-list buffer nil t)))
1181 (dolist (win windows)
1182 (let* ((page (doc-view-current-page win)) 1191 (let* ((page (doc-view-current-page win))
1183 (pagefile (expand-file-name (format "page-%d.png" page) 1192 (pagefile (expand-file-name (format "page-%d.png" page)
1184 (doc-view-current-cache-dir)))) 1193 (doc-view-current-cache-dir))))
1185 (when (or force 1194 (when (or force
1186 (and (not (member pagefile prev-pages)) 1195 (and (not (member pagefile prev-pages))
1187 (member pagefile doc-view-current-files))) 1196 (member pagefile doc-view-current-files)))
1188 (with-selected-window win 1197 (if (windowp win)
1189 (cl-assert (eq (current-buffer) buffer) t) 1198 (with-selected-window win
1199 (cl-assert (eq (current-buffer) buffer) t)
1200 (doc-view-goto-page page))
1190 (doc-view-goto-page page)))))))) 1201 (doc-view-goto-page page))))))))
1191 1202
1192(defun doc-view-buffer-message () 1203(defun doc-view-buffer-message ()
@@ -1231,6 +1242,10 @@ For now these keys are useful:
1231 1242
1232;;;;; Toggle between editing and viewing 1243;;;;; Toggle between editing and viewing
1233 1244
1245(defvar-local doc-view-saved-settings nil
1246 "Doc-view settings saved while in some other mode.")
1247(put 'doc-view-saved-settings 'permanent-local t)
1248
1234(defun doc-view-toggle-display () 1249(defun doc-view-toggle-display ()
1235 "Toggle between editing a document as text or viewing it." 1250 "Toggle between editing a document as text or viewing it."
1236 (interactive) 1251 (interactive)
@@ -1483,13 +1498,16 @@ toggle between displaying the document or editing it as text.
1483 ;; returns nil for tar members. 1498 ;; returns nil for tar members.
1484 (doc-view-fallback-mode) 1499 (doc-view-fallback-mode)
1485 1500
1486 (let* ((prev-major-mode (if (eq major-mode 'doc-view-mode) 1501 (let* ((prev-major-mode (if (derived-mode-p 'doc-view-mode)
1487 doc-view-previous-major-mode 1502 doc-view-previous-major-mode
1488 (when (not (memq major-mode 1503 (unless (eq major-mode 'fundamental-mode)
1489 '(doc-view-mode fundamental-mode)))
1490 major-mode)))) 1504 major-mode))))
1491 (kill-all-local-variables) 1505 (kill-all-local-variables)
1492 (set (make-local-variable 'doc-view-previous-major-mode) prev-major-mode)) 1506 (set (make-local-variable 'doc-view-previous-major-mode)
1507 prev-major-mode))
1508
1509 (dolist (var doc-view-saved-settings)
1510 (set (make-local-variable (car var)) (cdr var)))
1493 1511
1494 ;; Figure out the document type. 1512 ;; Figure out the document type.
1495 (unless doc-view-doc-type 1513 (unless doc-view-doc-type
@@ -1563,13 +1581,20 @@ toggle between displaying the document or editing it as text.
1563 1581
1564(defun doc-view-fallback-mode () 1582(defun doc-view-fallback-mode ()
1565 "Fallback to the previous or next best major mode." 1583 "Fallback to the previous or next best major mode."
1566 (if doc-view-previous-major-mode 1584 (let ((vars (if (derived-mode-p 'doc-view-mode)
1567 (funcall doc-view-previous-major-mode) 1585 (mapcar (lambda (var) (cons var (symbol-value var)))
1568 (let ((auto-mode-alist (rassq-delete-all 1586 '(doc-view-resolution
1569 'doc-view-mode-maybe 1587 image-mode-winprops-alist)))))
1570 (rassq-delete-all 'doc-view-mode 1588 (if doc-view-previous-major-mode
1571 (copy-alist auto-mode-alist))))) 1589 (funcall doc-view-previous-major-mode)
1572 (normal-mode)))) 1590 (let ((auto-mode-alist
1591 (rassq-delete-all
1592 'doc-view-mode-maybe
1593 (rassq-delete-all 'doc-view-mode
1594 (copy-alist auto-mode-alist)))))
1595 (normal-mode)))
1596 (when vars
1597 (setq-local doc-view-saved-settings vars))))
1573 1598
1574;;;###autoload 1599;;;###autoload
1575(defun doc-view-mode-maybe () 1600(defun doc-view-mode-maybe ()
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 93e890a20c9..d740574f1e4 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -253,7 +253,9 @@ convention was modified."
253 advertised-signature-table)) 253 advertised-signature-table))
254 254
255(defun make-obsolete (obsolete-name current-name &optional when) 255(defun make-obsolete (obsolete-name current-name &optional when)
256 "Make the byte-compiler warn that OBSOLETE-NAME is obsolete. 256 "Make the byte-compiler warn that function OBSOLETE-NAME is obsolete.
257OBSOLETE-NAME should be a function name or macro name (a symbol).
258
257The warning will say that CURRENT-NAME should be used instead. 259The warning will say that CURRENT-NAME should be used instead.
258If CURRENT-NAME is a string, that is the `use instead' message 260If CURRENT-NAME is a string, that is the `use instead' message
259\(it should end with a period, and not start with a capital). 261\(it should end with a period, and not start with a capital).
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 7a229750178..d49e56bd2ba 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -846,7 +846,7 @@ CONST2 may be evaluated multiple times."
846(defun byte-compile-cl-file-p (file) 846(defun byte-compile-cl-file-p (file)
847 "Return non-nil if FILE is one of the CL files." 847 "Return non-nil if FILE is one of the CL files."
848 (and (stringp file) 848 (and (stringp file)
849 (string-match "^cl\\>" (file-name-nondirectory file)))) 849 (string-match "^cl\\.el" (file-name-nondirectory file))))
850 850
851(defun byte-compile-eval (form) 851(defun byte-compile-eval (form)
852 "Eval FORM and mark the functions defined therein. 852 "Eval FORM and mark the functions defined therein.
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index ea5e1cf9beb..913ebf2015f 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -689,7 +689,6 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
689 689
690;; Local variables: 690;; Local variables:
691;; byte-compile-dynamic: t 691;; byte-compile-dynamic: t
692;; byte-compile-warnings: (not cl-functions)
693;; generated-autoload-file: "cl-loaddefs.el" 692;; generated-autoload-file: "cl-loaddefs.el"
694;; End: 693;; End:
695 694
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 5749ff91b40..2eda628e262 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -745,7 +745,6 @@ If ALIST is non-nil, the new pairs are prepended to it."
745 745
746;; Local variables: 746;; Local variables:
747;; byte-compile-dynamic: t 747;; byte-compile-dynamic: t
748;; byte-compile-warnings: (not cl-functions)
749;; End: 748;; End:
750 749
751;;; cl-lib.el ends here 750;;; cl-lib.el ends here
diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el
index c12e8ccacb1..922c9856208 100644
--- a/lisp/emacs-lisp/cl-loaddefs.el
+++ b/lisp/emacs-lisp/cl-loaddefs.el
@@ -11,7 +11,7 @@
11;;;;;; cl--map-overlays cl--map-intervals cl--map-keymap-recursively 11;;;;;; cl--map-overlays cl--map-intervals cl--map-keymap-recursively
12;;;;;; cl-notevery cl-notany cl-every cl-some cl-mapcon cl-mapcan 12;;;;;; cl-notevery cl-notany cl-every cl-some cl-mapcon cl-mapcan
13;;;;;; cl-mapl cl-maplist cl-map cl--mapcar-many cl-equalp cl-coerce) 13;;;;;; cl-mapl cl-maplist cl-map cl--mapcar-many cl-equalp cl-coerce)
14;;;;;; "cl-extra" "cl-extra.el" "535a24c1cff55a16e3d51219498a7858") 14;;;;;; "cl-extra" "cl-extra.el" "1572ae52fa4fbd9c4bf89b49a068a865")
15;;; Generated autoloads from cl-extra.el 15;;; Generated autoloads from cl-extra.el
16 16
17(autoload 'cl-coerce "cl-extra" "\ 17(autoload 'cl-coerce "cl-extra" "\
@@ -260,7 +260,7 @@ Remove from SYMBOL's plist the property PROPNAME and its value.
260;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when 260;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when
261;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp 261;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp
262;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*) 262;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*)
263;;;;;; "cl-macs" "cl-macs.el" "6d0676869af66e5b5a671f95ee069461") 263;;;;;; "cl-macs" "cl-macs.el" "da92f58f688ff6fb4d0098eb0f3acf0b")
264;;; Generated autoloads from cl-macs.el 264;;; Generated autoloads from cl-macs.el
265 265
266(autoload 'cl--compiler-macro-list* "cl-macs" "\ 266(autoload 'cl--compiler-macro-list* "cl-macs" "\
@@ -748,7 +748,7 @@ surrounded by (cl-block NAME ...).
748;;;;;; cl-nsubstitute-if cl-nsubstitute cl-substitute-if-not cl-substitute-if 748;;;;;; cl-nsubstitute-if cl-nsubstitute cl-substitute-if-not cl-substitute-if
749;;;;;; cl-substitute cl-delete-duplicates cl-remove-duplicates cl-delete-if-not 749;;;;;; cl-substitute cl-delete-duplicates cl-remove-duplicates cl-delete-if-not
750;;;;;; cl-delete-if cl-delete cl-remove-if-not cl-remove-if cl-remove 750;;;;;; cl-delete-if cl-delete cl-remove-if-not cl-remove-if cl-remove
751;;;;;; cl-replace cl-fill cl-reduce) "cl-seq" "cl-seq.el" "b444601641dcbd14a23ca5182bc80ffa") 751;;;;;; cl-replace cl-fill cl-reduce) "cl-seq" "cl-seq.el" "4c1e1191e82dc8d5449a5ec4d59efc10")
752;;; Generated autoloads from cl-seq.el 752;;; Generated autoloads from cl-seq.el
753 753
754(autoload 'cl-reduce "cl-seq" "\ 754(autoload 'cl-reduce "cl-seq" "\
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 16ac14f8fe9..56e698bec0a 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -2686,7 +2686,6 @@ surrounded by (cl-block NAME ...).
2686 2686
2687;; Local variables: 2687;; Local variables:
2688;; byte-compile-dynamic: t 2688;; byte-compile-dynamic: t
2689;; byte-compile-warnings: (not cl-functions)
2690;; generated-autoload-file: "cl-loaddefs.el" 2689;; generated-autoload-file: "cl-loaddefs.el"
2691;; End: 2690;; End:
2692 2691
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index b55f1df5ba5..1fa562e328a 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -1010,7 +1010,6 @@ Atoms are compared by `eql'; cons cells are compared recursively.
1010 1010
1011;; Local variables: 1011;; Local variables:
1012;; byte-compile-dynamic: t 1012;; byte-compile-dynamic: t
1013;; byte-compile-warnings: (not cl-functions)
1014;; generated-autoload-file: "cl-loaddefs.el" 1013;; generated-autoload-file: "cl-loaddefs.el"
1015;; End: 1014;; End:
1016 1015
diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
index ae0852d6c87..34beed0d9ef 100644
--- a/lisp/emacs-lisp/cl.el
+++ b/lisp/emacs-lisp/cl.el
@@ -452,7 +452,7 @@ definitions, or lack thereof).
452 452
453\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" 453\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
454 (declare (indent 1) (debug cl-flet) 454 (declare (indent 1) (debug cl-flet)
455 (obsolete "Use either `cl-flet' or `cl-letf'." "24.3")) 455 (obsolete "use either `cl-flet' or `cl-letf'." "24.3"))
456 `(letf ,(mapcar 456 `(letf ,(mapcar
457 (lambda (x) 457 (lambda (x)
458 (if (or (and (fboundp (car x)) 458 (if (or (and (fboundp (car x))
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index ea72e9492f0..8c8d37b2194 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -276,10 +276,10 @@ A mode's class is the first ancestor which is NOT a derived mode.
276Use the `derived-mode-parent' property of the symbol to trace backwards. 276Use the `derived-mode-parent' property of the symbol to trace backwards.
277Since major-modes might all derive from `fundamental-mode', this function 277Since major-modes might all derive from `fundamental-mode', this function
278is not very useful." 278is not very useful."
279 (declare (obsolete derived-mode-p "22.1"))
279 (while (get mode 'derived-mode-parent) 280 (while (get mode 'derived-mode-parent)
280 (setq mode (get mode 'derived-mode-parent))) 281 (setq mode (get mode 'derived-mode-parent)))
281 mode) 282 mode)
282(make-obsolete 'derived-mode-class 'derived-mode-p "22.1")
283 283
284 284
285;;; PRIVATE 285;;; PRIVATE
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index a7916354c91..c3b8e5e10d4 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -7,18 +7,18 @@
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
10;; This program is free software: you can redistribute it and/or 10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; modify it under the terms of the GNU General Public License as 11;; it under the terms of the GNU General Public License as published by
12;; published by the Free Software Foundation, either version 3 of the 12;; the Free Software Foundation, either version 3 of the License, or
13;; License, or (at your option) any later version. 13;; (at your option) any later version.
14;; 14
15;; This program is distributed in the hope that it will be useful, but 15;; GNU Emacs is distributed in the hope that it will be useful,
16;; WITHOUT ANY WARRANTY; without even the implied warranty of 16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; General Public License for more details. 18;; GNU General Public License for more details.
19;; 19
20;; You should have received a copy of the GNU General Public License 20;; You should have received a copy of the GNU General Public License
21;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 22
23;;; Commentary: 23;;; Commentary:
24 24
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index ad5e20cb8a4..ff00be7a237 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -7,18 +7,18 @@
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
10;; This program is free software: you can redistribute it and/or 10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; modify it under the terms of the GNU General Public License as 11;; it under the terms of the GNU General Public License as published by
12;; published by the Free Software Foundation, either version 3 of the 12;; the Free Software Foundation, either version 3 of the License, or
13;; License, or (at your option) any later version. 13;; (at your option) any later version.
14;; 14
15;; This program is distributed in the hope that it will be useful, but 15;; GNU Emacs is distributed in the hope that it will be useful,
16;; WITHOUT ANY WARRANTY; without even the implied warranty of 16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; General Public License for more details. 18;; GNU General Public License for more details.
19;; 19
20;; You should have received a copy of the GNU General Public License 20;; You should have received a copy of the GNU General Public License
21;; along with this program. If not, see `http://www.gnu.org/licenses/'. 21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 22
23;;; Commentary: 23;;; Commentary:
24 24
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 4caa0a73866..7858c183e4b 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -1,22 +1,25 @@
1;;; gv.el --- Generalized variables -*- lexical-binding: t -*- 1;;; gv.el --- generalized variables -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 2012 Free Software Foundation, Inc. 3;; Copyright (C) 2012 Free Software Foundation, Inc.
4 4
5;; Author: Stefan Monnier <monnier@iro.umontreal.ca> 5;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
6;; Keywords: extensions 6;; Keywords: extensions
7;; Package: emacs
7 8
8;; This program is free software; you can redistribute it and/or modify 9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software: you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by 12;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or 13;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version. 14;; (at your option) any later version.
12 15
13;; This program is distributed in the hope that it will be useful, 16;; GNU Emacs is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of 17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details. 19;; GNU General Public License for more details.
17 20
18;; You should have received a copy of the GNU General Public License 21;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <http://www.gnu.org/licenses/>. 22;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20 23
21;;; Commentary: 24;;; Commentary:
22 25
@@ -266,7 +269,7 @@ The return value is the last VAL in the list.
266;;;###autoload 269;;;###autoload
267(put 'gv-place 'edebug-form-spec 'edebug-match-form) 270(put 'gv-place 'edebug-form-spec 'edebug-match-form)
268;; CL did the equivalent of: 271;; CL did the equivalent of:
269;;(gv-define-expand edebug-after (lambda (before index place) place)) 272;;(gv-define-macroexpand edebug-after (lambda (before index place) place))
270 273
271(put 'edebug-after 'gv-expander 274(put 'edebug-after 'gv-expander
272 (lambda (do before index place) 275 (lambda (do before index place)
diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el
index 761d27a2e28..0b6fd277ae2 100644
--- a/lisp/emacs-lisp/package-x.el
+++ b/lisp/emacs-lisp/package-x.el
@@ -10,10 +10,10 @@
10 10
11;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
12 12
13;; GNU Emacs is free software; you can redistribute it and/or modify 13;; GNU Emacs is free software: you can redistribute it and/or modify
14;; it under the terms of the GNU General Public License as published by 14;; it under the terms of the GNU General Public License as published by
15;; the Free Software Foundation; either version 3, or (at your option) 15;; the Free Software Foundation, either version 3 of the License, or
16;; any later version. 16;; (at your option) any later version.
17 17
18;; GNU Emacs is distributed in the hope that it will be useful, 18;; GNU Emacs is distributed in the hope that it will be useful,
19;; but WITHOUT ANY WARRANTY; without even the implied warranty of 19;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -21,9 +21,7 @@
21;; GNU General Public License for more details. 21;; GNU General Public License for more details.
22 22
23;; You should have received a copy of the GNU General Public License 23;; You should have received a copy of the GNU General Public License
24;; along with GNU Emacs; see the file COPYING. If not, write to the 24;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26;; Boston, MA 02110-1301, USA.
27 25
28;;; Commentary: 26;;; Commentary:
29 27
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index b01cdbc7b8e..28d166271fb 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -9,10 +9,10 @@
9 9
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11 11
12;; GNU Emacs is free software; you can redistribute it and/or modify 12;; GNU Emacs is free software: you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by 13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 3, or (at your option) 14;; the Free Software Foundation, either version 3 of the License, or
15;; any later version. 15;; (at your option) any later version.
16 16
17;; GNU Emacs is distributed in the hope that it will be useful, 17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,9 +20,7 @@
20;; GNU General Public License for more details. 20;; GNU General Public License for more details.
21 21
22;; You should have received a copy of the GNU General Public License 22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING. If not, write to the 23;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25;; Boston, MA 02110-1301, USA.
26 24
27;;; Change Log: 25;;; Change Log:
28 26
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 09e47b69b91..1312fc3731d 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -517,6 +517,10 @@ MATCH is the pattern that needs to be matched, of the form:
517(defun pcase--self-quoting-p (upat) 517(defun pcase--self-quoting-p (upat)
518 (or (keywordp upat) (numberp upat) (stringp upat))) 518 (or (keywordp upat) (numberp upat) (stringp upat)))
519 519
520(defsubst pcase--mark-used (sym)
521 ;; Exceptionally, `sym' may be a constant expression rather than a symbol.
522 (if (symbolp sym) (put sym 'pcase-used t)))
523
520;; It's very tempting to use `pcase' below, tho obviously, it'd create 524;; It's very tempting to use `pcase' below, tho obviously, it'd create
521;; bootstrapping problems. 525;; bootstrapping problems.
522(defun pcase--u1 (matches code vars rest) 526(defun pcase--u1 (matches code vars rest)
@@ -581,7 +585,7 @@ Otherwise, it defers to REST which is a list of branches of the form
581 ((memq upat '(t _)) (pcase--u1 matches code vars rest)) 585 ((memq upat '(t _)) (pcase--u1 matches code vars rest))
582 ((eq upat 'pcase--dontcare) :pcase--dontcare) 586 ((eq upat 'pcase--dontcare) :pcase--dontcare)
583 ((memq (car-safe upat) '(guard pred)) 587 ((memq (car-safe upat) '(guard pred))
584 (if (eq (car upat) 'pred) (put sym 'pcase-used t)) 588 (if (eq (car upat) 'pred) (pcase--mark-used sym))
585 (let* ((splitrest 589 (let* ((splitrest
586 (pcase--split-rest 590 (pcase--split-rest
587 sym (lambda (pat) (pcase--split-pred upat pat)) rest)) 591 sym (lambda (pat) (pcase--split-pred upat pat)) rest))
@@ -614,10 +618,10 @@ Otherwise, it defers to REST which is a list of branches of the form
614 (pcase--u1 matches code vars then-rest) 618 (pcase--u1 matches code vars then-rest)
615 (pcase--u else-rest)))) 619 (pcase--u else-rest))))
616 ((pcase--self-quoting-p upat) 620 ((pcase--self-quoting-p upat)
617 (put sym 'pcase-used t) 621 (pcase--mark-used sym)
618 (pcase--q1 sym upat matches code vars rest)) 622 (pcase--q1 sym upat matches code vars rest))
619 ((symbolp upat) 623 ((symbolp upat)
620 (put sym 'pcase-used t) 624 (pcase--mark-used sym)
621 (if (not (assq upat vars)) 625 (if (not (assq upat vars))
622 (pcase--u1 matches code (cons (cons upat sym) vars) rest) 626 (pcase--u1 matches code (cons (cons upat sym) vars) rest)
623 ;; Non-linear pattern. Turn it into an `eq' test. 627 ;; Non-linear pattern. Turn it into an `eq' test.
@@ -640,7 +644,7 @@ Otherwise, it defers to REST which is a list of branches of the form
640 (pcase--u1 (cons `(match ,sym . ,(nth 1 upat)) matches) 644 (pcase--u1 (cons `(match ,sym . ,(nth 1 upat)) matches)
641 code vars rest))) 645 code vars rest)))
642 ((eq (car-safe upat) '\`) 646 ((eq (car-safe upat) '\`)
643 (put sym 'pcase-used t) 647 (pcase--mark-used sym)
644 (pcase--q1 sym (cadr upat) matches code vars rest)) 648 (pcase--q1 sym (cadr upat) matches code vars rest))
645 ((eq (car-safe upat) 'or) 649 ((eq (car-safe upat) 'or)
646 (let ((all (> (length (cdr upat)) 1)) 650 (let ((all (> (length (cdr upat)) 1))
@@ -662,7 +666,7 @@ Otherwise, it defers to REST which is a list of branches of the form
662 sym (lambda (pat) (pcase--split-member elems pat)) rest)) 666 sym (lambda (pat) (pcase--split-member elems pat)) rest))
663 (then-rest (car splitrest)) 667 (then-rest (car splitrest))
664 (else-rest (cdr splitrest))) 668 (else-rest (cdr splitrest)))
665 (put sym 'pcase-used t) 669 (pcase--mark-used sym)
666 (pcase--if `(,(if memq-fine #'memq #'member) ,sym ',elems) 670 (pcase--if `(,(if memq-fine #'memq #'member) ,sym ',elems)
667 (pcase--u1 matches code vars then-rest) 671 (pcase--u1 matches code vars then-rest)
668 (pcase--u else-rest))) 672 (pcase--u else-rest)))
diff --git a/lisp/emacs-lisp/tabulated-list.el b/lisp/emacs-lisp/tabulated-list.el
index a56a7619ea9..8aa722521eb 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -7,10 +7,10 @@
7 7
8;; This file is part of GNU Emacs. 8;; This file is part of GNU Emacs.
9 9
10;; GNU Emacs is free software; you can redistribute it and/or modify 10;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by 11;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 3, or (at your option) 12;; the Free Software Foundation, either version 3 of the License, or
13;; any later version. 13;; (at your option) any later version.
14 14
15;; GNU Emacs is distributed in the hope that it will be useful, 15;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16;; but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el
index 3999529f7ac..5fdc8c55a85 100644
--- a/lisp/emacs-lisp/testcover.el
+++ b/lisp/emacs-lisp/testcover.el
@@ -270,9 +270,9 @@ value, 'maybe if either is acceptable."
270 (setq id (nth 2 form)) 270 (setq id (nth 2 form))
271 (setcdr form (nthcdr 2 form)) 271 (setcdr form (nthcdr 2 form))
272 (setq val (testcover-reinstrument (nth 2 form))) 272 (setq val (testcover-reinstrument (nth 2 form)))
273 (if (eq val t) 273 (setcar form (if (eq val t)
274 (setcar form 'testcover-1value) 274 'testcover-1value
275 (setcar form 'testcover-after)) 275 'testcover-after))
276 (when val 276 (when val
277 ;;1-valued or potentially 1-valued 277 ;;1-valued or potentially 1-valued
278 (aset testcover-vector id '1value)) 278 (aset testcover-vector id '1value))
@@ -359,9 +359,9 @@ value, 'maybe if either is acceptable."
359 ,(nth 3 (cadr form)))) 359 ,(nth 3 (cadr form))))
360 t) 360 t)
361 (t 361 (t
362 (if (eq (car (cadr form)) 'edebug-after) 362 (setq id (car (if (eq (car (cadr form)) 'edebug-after)
363 (setq id (car (nth 3 (cadr form)))) 363 (nth 3 (cadr form))
364 (setq id (car (cadr form)))) 364 (cadr form))))
365 (let ((testcover-1value-functions 365 (let ((testcover-1value-functions
366 (cons id testcover-1value-functions))) 366 (cons id testcover-1value-functions)))
367 (testcover-reinstrument (cadr form)))))) 367 (testcover-reinstrument (cadr form))))))
@@ -379,9 +379,9 @@ value, 'maybe if either is acceptable."
379 ,(nth 3 (cadr form)))) 379 ,(nth 3 (cadr form))))
380 'maybe) 380 'maybe)
381 (t 381 (t
382 (if (eq (car (cadr form)) 'edebug-after) 382 (setq id (car (if (eq (car (cadr form)) 'edebug-after)
383 (setq id (car (nth 3 (cadr form)))) 383 (nth 3 (cadr form))
384 (setq id (car (cadr form)))) 384 (cadr form))))
385 (let ((testcover-noreturn-functions 385 (let ((testcover-noreturn-functions
386 (cons id testcover-noreturn-functions))) 386 (cons id testcover-noreturn-functions)))
387 (testcover-reinstrument (cadr form)))))) 387 (testcover-reinstrument (cadr form))))))
@@ -447,6 +447,12 @@ binding `testcover-vector' to the code-coverage vector for TESTCOVER-SYM
447(defun testcover-after (idx val) 447(defun testcover-after (idx val)
448 "Internal function for coverage testing. Returns VAL after installing it in 448 "Internal function for coverage testing. Returns VAL after installing it in
449`testcover-vector' at offset IDX." 449`testcover-vector' at offset IDX."
450 (declare (gv-expander (lambda (do)
451 (gv-letplace (getter setter) val
452 (funcall do getter
453 (lambda (store)
454 `(progn (testcover-after ,idx ,getter)
455 ,(funcall setter store))))))))
450 (cond 456 (cond
451 ((eq (aref testcover-vector idx) 'unknown) 457 ((eq (aref testcover-vector idx) 'unknown)
452 (aset testcover-vector idx val)) 458 (aset testcover-vector idx val))
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index bcd582a6f88..494d8a87e0e 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -146,14 +146,13 @@ TIME must be in the internal format returned by, e.g., `current-time'.
146The microsecond count from TIME is ignored, and USECS is used instead. 146The microsecond count from TIME is ignored, and USECS is used instead.
147If optional fourth argument DELTA is a positive number, make the timer 147If optional fourth argument DELTA is a positive number, make the timer
148fire repeatedly that many seconds apart." 148fire repeatedly that many seconds apart."
149 (declare (obsolete "use `timer-set-time' and `timer-inc-time' instead."
150 "22.1"))
149 (setf (timer--time timer) time) 151 (setf (timer--time timer) time)
150 (setf (timer--usecs timer) usecs) 152 (setf (timer--usecs timer) usecs)
151 (setf (timer--psecs timer) 0) 153 (setf (timer--psecs timer) 0)
152 (setf (timer--repeat-delay timer) (and (numberp delta) (> delta 0) delta)) 154 (setf (timer--repeat-delay timer) (and (numberp delta) (> delta 0) delta))
153 timer) 155 timer)
154(make-obsolete 'timer-set-time-with-usecs
155 "use `timer-set-time' and `timer-inc-time' instead."
156 "22.1")
157 156
158(defun timer-set-function (timer function &optional args) 157(defun timer-set-function (timer function &optional args)
159 "Make TIMER call FUNCTION with optional ARGS when triggering." 158 "Make TIMER call FUNCTION with optional ARGS when triggering."
diff --git a/lisp/emacs-lock.el b/lisp/emacs-lock.el
index 5343d499efb..b20ec13fa81 100644
--- a/lisp/emacs-lock.el
+++ b/lisp/emacs-lock.el
@@ -249,9 +249,9 @@ Other values are interpreted as usual."
249 249
250(defun toggle-emacs-lock () 250(defun toggle-emacs-lock ()
251 "Toggle `emacs-lock-from-exiting' for the current buffer." 251 "Toggle `emacs-lock-from-exiting' for the current buffer."
252 (declare (obsolete emacs-lock-mode "24.1"))
252 (interactive) 253 (interactive)
253 (call-interactively 'emacs-lock-mode)) 254 (call-interactively 'emacs-lock-mode))
254(make-obsolete 'toggle-emacs-lock 'emacs-lock-mode "24.1")
255 255
256(provide 'emacs-lock) 256(provide 'emacs-lock)
257 257
diff --git a/lisp/epa.el b/lisp/epa.el
index b796f5fa77c..ecc27c4d299 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -585,8 +585,8 @@ If SECRET is non-nil, list secret keys instead of public keys."
585 (message "%s" info))) 585 (message "%s" info)))
586 586
587(defun epa-display-verify-result (verify-result) 587(defun epa-display-verify-result (verify-result)
588 (declare (obsolete epa-display-info "23.1"))
588 (epa-display-info (epg-verify-result-to-string verify-result))) 589 (epa-display-info (epg-verify-result-to-string verify-result)))
589(make-obsolete 'epa-display-verify-result 'epa-display-info "23.1")
590 590
591(defun epa-passphrase-callback-function (context key-id handback) 591(defun epa-passphrase-callback-function (context key-id handback)
592 (if (eq key-id 'SYM) 592 (if (eq key-id 'SYM)
diff --git a/lisp/epg.el b/lisp/epg.el
index 6529afb2d3c..b0e01bc3721 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -1779,6 +1779,7 @@ This function is for internal use only."
1779 (epg-context-set-result-for context 'import-status nil))) 1779 (epg-context-set-result-for context 'import-status nil)))
1780 1780
1781(defun epg-passphrase-callback-function (context key-id _handback) 1781(defun epg-passphrase-callback-function (context key-id _handback)
1782 (declare (obsolete epa-passphrase-callback-function "23.1"))
1782 (if (eq key-id 'SYM) 1783 (if (eq key-id 'SYM)
1783 (read-passwd "Passphrase for symmetric encryption: " 1784 (read-passwd "Passphrase for symmetric encryption: "
1784 (eq (epg-context-operation context) 'encrypt)) 1785 (eq (epg-context-operation context) 'encrypt))
@@ -1790,9 +1791,6 @@ This function is for internal use only."
1790 (format "Passphrase for %s %s: " key-id (cdr entry)) 1791 (format "Passphrase for %s %s: " key-id (cdr entry))
1791 (format "Passphrase for %s: " key-id))))))) 1792 (format "Passphrase for %s: " key-id)))))))
1792 1793
1793(make-obsolete 'epg-passphrase-callback-function
1794 'epa-passphrase-callback-function "23.1")
1795
1796(defun epg--list-keys-1 (context name mode) 1794(defun epg--list-keys-1 (context name mode)
1797 (let ((args (append (if epg-gpg-home-directory 1795 (let ((args (append (if epg-gpg-home-directory
1798 (list "--homedir" epg-gpg-home-directory)) 1796 (list "--homedir" epg-gpg-home-directory))
@@ -2562,6 +2560,7 @@ If you use this function, you will need to wait for the completion of
2562`epg-reset' to clear a temporary output file. 2560`epg-reset' to clear a temporary output file.
2563If you are unsure, use synchronous version of this function 2561If you are unsure, use synchronous version of this function
2564`epg-sign-keys' instead." 2562`epg-sign-keys' instead."
2563 (declare (obsolete nil "23.1"))
2565 (epg-context-set-operation context 'sign-keys) 2564 (epg-context-set-operation context 'sign-keys)
2566 (epg-context-set-result context nil) 2565 (epg-context-set-result context nil)
2567 (epg--start context (cons (if local 2566 (epg--start context (cons (if local
@@ -2572,10 +2571,10 @@ If you are unsure, use synchronous version of this function
2572 (epg-sub-key-id 2571 (epg-sub-key-id
2573 (car (epg-key-sub-key-list key)))) 2572 (car (epg-key-sub-key-list key))))
2574 keys)))) 2573 keys))))
2575(make-obsolete 'epg-start-sign-keys "do not use." "23.1")
2576 2574
2577(defun epg-sign-keys (context keys &optional local) 2575(defun epg-sign-keys (context keys &optional local)
2578 "Sign KEYS from the key ring." 2576 "Sign KEYS from the key ring."
2577 (declare (obsolete nil "23.1"))
2579 (unwind-protect 2578 (unwind-protect
2580 (progn 2579 (progn
2581 (epg-start-sign-keys context keys local) 2580 (epg-start-sign-keys context keys local)
@@ -2586,7 +2585,6 @@ If you are unsure, use synchronous version of this function
2586 (list "Sign keys failed" 2585 (list "Sign keys failed"
2587 (epg-errors-to-string errors)))))) 2586 (epg-errors-to-string errors))))))
2588 (epg-reset context))) 2587 (epg-reset context)))
2589(make-obsolete 'epg-sign-keys "do not use." "23.1")
2590 2588
2591(defun epg-start-generate-key (context parameters) 2589(defun epg-start-generate-key (context parameters)
2592 "Initiate a key generation. 2590 "Initiate a key generation.
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 674a6c97eec..348765036ea 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,7 @@
12012-09-25 Chong Yidong <cyd@gnu.org>
2
3 * erc.el (erc-send-command): Use define-obsolete-function-alias.
4
12012-09-17 Chong Yidong <cyd@gnu.org> 52012-09-17 Chong Yidong <cyd@gnu.org>
2 6
3 * erc-page.el (erc-page-function): 7 * erc-page.el (erc-page-function):
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index feef75940f3..7feadc50aca 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -139,8 +139,8 @@
139 (message (concat "ERC: The function `defvaralias' is not bound. See the " 139 (message (concat "ERC: The function `defvaralias' is not bound. See the "
140 "NEWS file for variable name changes since ERC 5.0.4."))) 140 "NEWS file for variable name changes since ERC 5.0.4.")))
141 141
142(defalias 'erc-send-command 'erc-server-send) 142(define-obsolete-function-alias 'erc-send-command
143(erc-make-obsolete 'erc-send-command 'erc-server-send "ERC 5.1") 143 'erc-server-send "ERC 5.1")
144 144
145;; tunable connection and authentication parameters 145;; tunable connection and authentication parameters
146 146
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el
index 37fa939cc10..ef59f6d1d35 100644
--- a/lisp/eshell/em-term.el
+++ b/lisp/eshell/em-term.el
@@ -63,10 +63,13 @@ which commands are considered visual in nature."
63 :type '(repeat string) 63 :type '(repeat string)
64 :group 'eshell-term) 64 :group 'eshell-term)
65 65
66(defcustom eshell-term-name "eterm" 66;; If you change this from term-term-name, you need to ensure that the
67;; value you choose exists in the system's terminfo database. (Bug#12485)
68(defcustom eshell-term-name term-term-name
67 "Name to use for the TERM variable when running visual commands. 69 "Name to use for the TERM variable when running visual commands.
68See `term-term-name' in term.el for more information on how this is 70See `term-term-name' in term.el for more information on how this is
69used." 71used."
72 :version "24.3" ; eterm -> term-term-name = eterm-color
70 :type 'string 73 :type 'string
71 :group 'eshell-term) 74 :group 'eshell-term)
72 75
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 515a23f81d7..5a10721387b 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -1216,11 +1216,12 @@ COMMAND may result in an alias being executed, or a plain command."
1216 (let* ((sym (intern-soft (concat "eshell/" name))) 1216 (let* ((sym (intern-soft (concat "eshell/" name)))
1217 (file (symbol-file sym 'defun))) 1217 (file (symbol-file sym 'defun)))
1218 ;; If the function exists, but is defined in an eshell module 1218 ;; If the function exists, but is defined in an eshell module
1219 ;; that's not currently enabled, don't report it as found 1219 ;; that's not currently enabled, don't report it as found.
1220 (if (and file 1220 (if (and file
1221 (string-match "\\(em\\|esh\\)-\\(.*\\)\\(\\.el\\)?\\'" file)) 1221 (setq file (file-name-base file))
1222 (string-match "\\`\\(em\\|esh\\)-\\([[:alnum:]]+\\)\\'" file))
1222 (let ((module-sym 1223 (let ((module-sym
1223 (intern (file-name-base (concat "eshell-" (match-string 2 file)))))) 1224 (intern (concat "eshell-" (match-string 2 file)))))
1224 (if (and (functionp sym) 1225 (if (and (functionp sym)
1225 (or (null module-sym) 1226 (or (null module-sym)
1226 (eshell-using-module module-sym) 1227 (eshell-using-module module-sym)
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index fa0336232f9..01df5fced62 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -275,6 +275,7 @@ Prepend remote identification of `default-directory', if any."
275 275
276(defmacro eshell-for (for-var for-list &rest forms) 276(defmacro eshell-for (for-var for-list &rest forms)
277 "Iterate through a list." 277 "Iterate through a list."
278 (declare (obsolete dolist "24.1"))
278 (declare (indent 2)) 279 (declare (indent 2))
279 `(let ((list-iter ,for-list)) 280 `(let ((list-iter ,for-list))
280 (while list-iter 281 (while list-iter
@@ -282,9 +283,6 @@ Prepend remote identification of `default-directory', if any."
282 ,@forms) 283 ,@forms)
283 (setq list-iter (cdr list-iter))))) 284 (setq list-iter (cdr list-iter)))))
284 285
285
286(make-obsolete 'eshell-for 'dolist "24.1")
287
288(defun eshell-flatten-list (args) 286(defun eshell-flatten-list (args)
289 "Flatten any lists within ARGS, so that there are no sublists." 287 "Flatten any lists within ARGS, so that there are no sublists."
290 (let ((new-list (list t))) 288 (let ((new-list (list t)))
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index c663de3f40d..a9a854221a4 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -243,16 +243,14 @@ shells such as bash, zsh, rc, 4dos."
243 243
244(defun eshell-add-to-window-buffer-names () 244(defun eshell-add-to-window-buffer-names ()
245 "Add `eshell-buffer-name' to `same-window-buffer-names'." 245 "Add `eshell-buffer-name' to `same-window-buffer-names'."
246 (declare (obsolete nil "24.3"))
246 (add-to-list 'same-window-buffer-names eshell-buffer-name)) 247 (add-to-list 'same-window-buffer-names eshell-buffer-name))
247(make-obsolete 'eshell-add-to-window-buffer-names
248 "no longer needed." "24.3")
249 248
250(defun eshell-remove-from-window-buffer-names () 249(defun eshell-remove-from-window-buffer-names ()
251 "Remove `eshell-buffer-name' from `same-window-buffer-names'." 250 "Remove `eshell-buffer-name' from `same-window-buffer-names'."
251 (declare (obsolete nil "24.3"))
252 (setq same-window-buffer-names 252 (setq same-window-buffer-names
253 (delete eshell-buffer-name same-window-buffer-names))) 253 (delete eshell-buffer-name same-window-buffer-names)))
254(make-obsolete 'eshell-remove-from-window-buffer-names
255 "no longer needed." "24.3")
256 254
257(defcustom eshell-load-hook nil 255(defcustom eshell-load-hook nil
258 "A hook run once Eshell has been loaded." 256 "A hook run once Eshell has been loaded."
diff --git a/lisp/faces.el b/lisp/faces.el
index 6a477e172e1..3ee859305a5 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1867,6 +1867,7 @@ Return nil if it has no specified face."
1867;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1867;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1868 1868
1869(declare-function x-parse-geometry "frame.c" (string)) 1869(declare-function x-parse-geometry "frame.c" (string))
1870(defvar x-display-name)
1870 1871
1871(defun x-handle-named-frame-geometry (parameters) 1872(defun x-handle-named-frame-geometry (parameters)
1872 "Add geometry parameters for a named frame to parameter list PARAMETERS. 1873 "Add geometry parameters for a named frame to parameter list PARAMETERS.
diff --git a/lisp/files.el b/lisp/files.el
index 66c526266e6..76a13f6cefd 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -821,10 +821,10 @@ one or more of those symbols."
821(defun locate-file-completion (string path-and-suffixes action) 821(defun locate-file-completion (string path-and-suffixes action)
822 "Do completion for file names passed to `locate-file'. 822 "Do completion for file names passed to `locate-file'.
823PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)." 823PATH-AND-SUFFIXES is a pair of lists, (DIRECTORIES . SUFFIXES)."
824 (declare (obsolete locate-file-completion-table "23.1"))
824 (locate-file-completion-table (car path-and-suffixes) 825 (locate-file-completion-table (car path-and-suffixes)
825 (cdr path-and-suffixes) 826 (cdr path-and-suffixes)
826 string nil action)) 827 string nil action))
827(make-obsolete 'locate-file-completion 'locate-file-completion-table "23.1")
828 828
829(defvar locate-dominating-stop-dir-regexp 829(defvar locate-dominating-stop-dir-regexp
830 (purecopy "\\`\\(?:[\\/][\\/][^\\/]+[\\/]\\|/\\(?:net\\|afs\\|\\.\\.\\.\\)/\\)\\'") 830 (purecopy "\\`\\(?:[\\/][\\/][^\\/]+[\\/]\\|/\\(?:net\\|afs\\|\\.\\.\\.\\)/\\)\\'")
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 6404af7703a..78760c015ff 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -340,8 +340,8 @@ This can be an \"!\" or the \"n\" in \"ifndef\".")
340(defvar font-lock-preprocessor-face 'font-lock-preprocessor-face 340(defvar font-lock-preprocessor-face 'font-lock-preprocessor-face
341 "Face name to use for preprocessor directives.") 341 "Face name to use for preprocessor directives.")
342 342
343(defvar font-lock-reference-face 'font-lock-constant-face) 343(define-obsolete-variable-alias
344(make-obsolete-variable 'font-lock-reference-face 'font-lock-constant-face "20.3") 344 'font-lock-reference-face 'font-lock-constant-face "20.3")
345 345
346;; Fontification variables: 346;; Fontification variables:
347 347
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index a97c5649c95..ce1599b9010 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -1531,15 +1531,15 @@ like an INI file. You can add this hook to `find-file-hook'."
1531 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)" 1531 '("#[ \t]*include[ \t]+\\(<[^>\"\n]+>\\)"
1532 1 font-lock-string-face) 1532 1 font-lock-string-face)
1533 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?" 1533 '("#[ \t]*\\(\\sw+\\)\\>[ \t]*\\(\\sw+\\)?"
1534 (1 font-lock-reference-face) 1534 (1 font-lock-constant-face)
1535 (2 font-lock-variable-name-face nil t)) 1535 (2 font-lock-variable-name-face nil t))
1536 ;; indirect string constants 1536 ;; indirect string constants
1537 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face) 1537 '("\\(@[A-Za-z][A-Za-z0-9_]+\\)" 1 font-lock-builtin-face)
1538 ;; gotos 1538 ;; gotos
1539 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-reference-face) 1539 '("[ \t]*\\(\\sw+:\\)" 1 font-lock-constant-face)
1540 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?" 1540 '("\\<\\(goto\\)\\>[ \t]*\\(\\sw+\\)?"
1541 (1 font-lock-keyword-face) 1541 (1 font-lock-keyword-face)
1542 (2 font-lock-reference-face nil t)) 1542 (2 font-lock-constant-face nil t))
1543 ;; system variables 1543 ;; system variables
1544 (generic-make-keywords-list 1544 (generic-make-keywords-list
1545 installshield-system-variables-list 1545 installshield-system-variables-list
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 45f23a6d99c..983d09e2589 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,8 @@
12012-09-25 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus-art.el (gnus-article-browse-delete-temp-files): Never ask again
4 a user about whether to delete temp files if once a user answered as n.
5
12012-09-17 Richard Stallman <rms@gnu.org> 62012-09-17 Richard Stallman <rms@gnu.org>
2 7
3 * message.el (message-in-body-p): Don't set mark or modify buffer. 8 * message.el (message-in-body-p): Don't set mark or modify buffer.
diff --git a/lisp/gnus/ChangeLog.2 b/lisp/gnus/ChangeLog.2
index 5a3612c4d1c..e75506956bb 100644
--- a/lisp/gnus/ChangeLog.2
+++ b/lisp/gnus/ChangeLog.2
@@ -11974,7 +11974,7 @@
11974 11974
119752001-12-18 01:00:00 ShengHuo ZHU <zsh@cs.rochester.edu> 119752001-12-18 01:00:00 ShengHuo ZHU <zsh@cs.rochester.edu>
11976 11976
11977 * ChangeLog, ChangeLog.1, nnwfm.el, gnus-smiley.el: 11977 * ChangeLog, ChangeLog.1, nnwfm.el, gnus-smiley.el:
11978 * gnus-cite.el, gnus-delay.el, gnus-spec.el, message.el: 11978 * gnus-cite.el, gnus-delay.el, gnus-spec.el, message.el:
11979 * mml1991.el, nnultimate.el: Add `coding'. 11979 * mml1991.el, nnultimate.el: Add `coding'.
11980 11980
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 7dcbd61316f..6c827e070cb 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -2760,11 +2760,12 @@ summary buffer."
2760 (or how (setq how gnus-article-browse-delete-temp)) 2760 (or how (setq how gnus-article-browse-delete-temp))
2761 (if (eq how 'ask) 2761 (if (eq how 'ask)
2762 (let ((files (length gnus-article-browse-html-temp-list))) 2762 (let ((files (length gnus-article-browse-html-temp-list)))
2763 (gnus-y-or-n-p 2763 (or (gnus-y-or-n-p
2764 (if (= files 1) 2764 (if (= files 1)
2765 "Delete the temporary HTML file? " 2765 "Delete the temporary HTML file? "
2766 (format "Delete all %s temporary HTML files? " 2766 (format "Delete all %s temporary HTML files? "
2767 files)))) 2767 files)))
2768 (setq gnus-article-browse-html-temp-list nil)))
2768 how))) 2769 how)))
2769 (dolist (file gnus-article-browse-html-temp-list) 2770 (dolist (file gnus-article-browse-html-temp-list)
2770 (cond ((file-directory-p file) 2771 (cond ((file-directory-p file)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index fa0484ff4e5..ef482f8f0e9 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -488,13 +488,16 @@ suitable file is found, return nil."
488 (insert "'.\n")))) 488 (insert "'.\n"))))
489 489
490(defun help-fns--obsolete (function) 490(defun help-fns--obsolete (function)
491 (let* ((obsolete (and 491 ;; Ignore lambda constructs, keyboard macros, etc.
492 ;; `function' might be a lambda construct. 492 (let* ((obsolete (and (symbolp function)
493 (symbolp function) 493 (get function 'byte-obsolete-info)))
494 (get function 'byte-obsolete-info)))
495 (use (car obsolete))) 494 (use (car obsolete)))
496 (when obsolete 495 (when obsolete
497 (insert "\nThis function is obsolete") 496 (insert "\nThis "
497 (if (eq (car-safe (symbol-function function)) 'macro)
498 "macro"
499 "function")
500 " is obsolete")
498 (when (nth 2 obsolete) 501 (when (nth 2 obsolete)
499 (insert (format " since %s" (nth 2 obsolete)))) 502 (insert (format " since %s" (nth 2 obsolete))))
500 (insert (cond ((stringp use) (concat ";\n" use)) 503 (insert (cond ((stringp use) (concat ";\n" use))
@@ -611,7 +614,7 @@ FILE is the file where FUNCTION was probably defined."
611 (fill-region-as-paragraph (save-excursion (goto-char pt1) (forward-line 0) (point)) 614 (fill-region-as-paragraph (save-excursion (goto-char pt1) (forward-line 0) (point))
612 (point))) 615 (point)))
613 (terpri)(terpri) 616 (terpri)(terpri)
614 617
615 (let* ((doc-raw (condition-case err 618 (let* ((doc-raw (condition-case err
616 (documentation function t) 619 (documentation function t)
617 (error (format "No Doc! %S" err)))) 620 (error (format "No Doc! %S" err))))
diff --git a/lisp/help-macro.el b/lisp/help-macro.el
index 112c72778bc..0600484b6df 100644
--- a/lisp/help-macro.el
+++ b/lisp/help-macro.el
@@ -69,7 +69,6 @@
69 69
70(require 'backquote) 70(require 'backquote)
71 71
72;;;###autoload
73(defcustom three-step-help nil 72(defcustom three-step-help nil
74 "Non-nil means give more info about Help command in three steps. 73 "Non-nil means give more info about Help command in three steps.
75The three steps are simple prompt, prompt with all options, and 74The three steps are simple prompt, prompt with all options, and
diff --git a/lisp/help.el b/lisp/help.el
index 707c8e3c84f..0df9c607f69 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -981,26 +981,6 @@ function is called, the window to be resized is selected."
981 :group 'help 981 :group 'help
982 :version "24.2") 982 :version "24.2")
983 983
984(defcustom temp-buffer-resize-frames nil
985 "Non-nil means `temp-buffer-resize-mode' can resize frames.
986A frame can be resized if and only if its root window is a live
987window. The height of the root window is subject to the values of
988`temp-buffer-max-height' and `window-min-height'."
989 :type 'boolean
990 :version "24.2"
991 :group 'help)
992
993(defcustom temp-buffer-resize-regexps nil
994 "List of regexps that inhibit Temp Buffer Resize mode.
995Any window of a buffer whose name matches one of these regular
996expressions is left alone by Temp Buffer Resize mode."
997 :type '(repeat
998 :tag "Buffer"
999 :value ""
1000 (regexp :format "%v"))
1001 :version "24.3"
1002 :group 'help)
1003
1004(define-minor-mode temp-buffer-resize-mode 984(define-minor-mode temp-buffer-resize-mode
1005 "Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode). 985 "Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode).
1006With a prefix argument ARG, enable Temp Buffer Resize mode if ARG 986With a prefix argument ARG, enable Temp Buffer Resize mode if ARG
@@ -1014,9 +994,8 @@ fit the buffer's contents, but never more than
1014 994
1015A window is resized only if it has been specially created for the 995A window is resized only if it has been specially created for the
1016buffer. Windows that have shown another buffer before are not 996buffer. Windows that have shown another buffer before are not
1017resized. A window showing a buffer whose name matches any of the 997resized. A frame is resized only if `fit-frame-to-buffer' is
1018expressions in `temp-buffer-resize-regexps' is not resized. A 998non-nil.
1019frame is resized only if `temp-buffer-resize-frames' is non-nil.
1020 999
1021This mode is used by `help', `apropos' and `completion' buffers, 1000This mode is used by `help', `apropos' and `completion' buffers,
1022and some others." 1001and some others."
@@ -1034,33 +1013,28 @@ WINDOW can be any live window and defaults to the selected one.
1034Do not make WINDOW higher than `temp-buffer-max-height' nor 1013Do not make WINDOW higher than `temp-buffer-max-height' nor
1035smaller than `window-min-height'. Do nothing if WINDOW is not 1014smaller than `window-min-height'. Do nothing if WINDOW is not
1036vertically combined or some of its contents are scrolled out of 1015vertically combined or some of its contents are scrolled out of
1037view. Do nothing if the name of WINDOW's buffer matches an 1016view."
1038expression in `temp-buffer-resize-regexps'."
1039 (setq window (window-normalize-window window t)) 1017 (setq window (window-normalize-window window t))
1040 (let ((buffer-name (buffer-name (window-buffer window)))) 1018 (let ((buffer-name (buffer-name (window-buffer window))))
1041 (unless (catch 'found 1019 (let ((height (if (functionp temp-buffer-max-height)
1042 (dolist (regexp temp-buffer-resize-regexps) 1020 (with-selected-window window
1043 (when (string-match regexp buffer-name) 1021 (funcall temp-buffer-max-height (window-buffer)))
1044 (throw 'found t)))) 1022 temp-buffer-max-height))
1045 (let ((height (if (functionp temp-buffer-max-height) 1023 (quit-cadr (cadr (window-parameter window 'quit-restore))))
1046 (with-selected-window window 1024 (cond
1047 (funcall temp-buffer-max-height (window-buffer))) 1025 ;; Don't resize WINDOW if it showed another buffer before.
1048 temp-buffer-max-height)) 1026 ((and (eq quit-cadr 'window)
1049 (quit-cadr (cadr (window-parameter window 'quit-restore)))) 1027 (pos-visible-in-window-p (point-min) window)
1050 (cond 1028 (window-combined-p window))
1051 ;; Don't resize WINDOW if it showed another buffer before. 1029 (fit-window-to-buffer window height))
1052 ((and (eq quit-cadr 'window) 1030 ((and fit-frame-to-buffer
1053 (pos-visible-in-window-p (point-min) window) 1031 (eq quit-cadr 'frame)
1054 (window-combined-p window)) 1032 (eq window (frame-root-window window)))
1055 (fit-window-to-buffer window height)) 1033 (let ((frame (window-frame window)))
1056 ((and temp-buffer-resize-frames 1034 (fit-frame-to-buffer
1057 (eq quit-cadr 'frame) 1035 frame (+ (frame-height frame)
1058 (eq window (frame-root-window window))) 1036 (- (window-total-size window))
1059 (let ((frame (window-frame window))) 1037 height))))))))
1060 (fit-frame-to-buffer
1061 frame (+ (frame-height frame)
1062 (- (window-total-size window))
1063 height)))))))))
1064 1038
1065;;; Help windows. 1039;;; Help windows.
1066(defcustom help-window-select 'other 1040(defcustom help-window-select 'other
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el
index f787319fb0c..2f0a6e3af59 100644
--- a/lisp/hippie-exp.el
+++ b/lisp/hippie-exp.el
@@ -199,7 +199,6 @@
199 199
200(defvar he-search-window ()) 200(defvar he-search-window ())
201 201
202;;;###autoload
203(defcustom hippie-expand-try-functions-list 202(defcustom hippie-expand-try-functions-list
204 '(try-complete-file-name-partially 203 '(try-complete-file-name-partially
205 try-complete-file-name 204 try-complete-file-name
@@ -217,31 +216,26 @@ or insert functions in this list."
217 :type '(repeat function) 216 :type '(repeat function)
218 :group 'hippie-expand) 217 :group 'hippie-expand)
219 218
220;;;###autoload
221(defcustom hippie-expand-verbose t 219(defcustom hippie-expand-verbose t
222 "Non-nil makes `hippie-expand' output which function it is trying." 220 "Non-nil makes `hippie-expand' output which function it is trying."
223 :type 'boolean 221 :type 'boolean
224 :group 'hippie-expand) 222 :group 'hippie-expand)
225 223
226;;;###autoload
227(defcustom hippie-expand-dabbrev-skip-space nil 224(defcustom hippie-expand-dabbrev-skip-space nil
228 "Non-nil means tolerate trailing spaces in the abbreviation to expand." 225 "Non-nil means tolerate trailing spaces in the abbreviation to expand."
229 :group 'hippie-expand 226 :group 'hippie-expand
230 :type 'boolean) 227 :type 'boolean)
231 228
232;;;###autoload
233(defcustom hippie-expand-dabbrev-as-symbol t 229(defcustom hippie-expand-dabbrev-as-symbol t
234 "Non-nil means expand as symbols, i.e. syntax `_' is considered a letter." 230 "Non-nil means expand as symbols, i.e. syntax `_' is considered a letter."
235 :group 'hippie-expand 231 :group 'hippie-expand
236 :type 'boolean) 232 :type 'boolean)
237 233
238;;;###autoload
239(defcustom hippie-expand-no-restriction t 234(defcustom hippie-expand-no-restriction t
240 "Non-nil means that narrowed buffers are widened during search." 235 "Non-nil means that narrowed buffers are widened during search."
241 :group 'hippie-expand 236 :group 'hippie-expand
242 :type 'boolean) 237 :type 'boolean)
243 238
244;;;###autoload
245(defcustom hippie-expand-max-buffers () 239(defcustom hippie-expand-max-buffers ()
246 "The maximum number of buffers (apart from the current) searched. 240 "The maximum number of buffers (apart from the current) searched.
247If nil, all buffers are searched." 241If nil, all buffers are searched."
@@ -249,15 +243,13 @@ If nil, all buffers are searched."
249 integer) 243 integer)
250 :group 'hippie-expand) 244 :group 'hippie-expand)
251 245
252;;;###autoload 246(defcustom hippie-expand-ignore-buffers '("^ \\*.*\\*$" dired-mode)
253(defcustom hippie-expand-ignore-buffers (list (purecopy "^ \\*.*\\*$") 'dired-mode)
254 "A list specifying which buffers not to search (if not current). 247 "A list specifying which buffers not to search (if not current).
255Can contain both regexps matching buffer names (as strings) and major modes 248Can contain both regexps matching buffer names (as strings) and major modes
256\(as atoms)" 249\(as atoms)"
257 :type '(repeat (choice regexp (symbol :tag "Major Mode"))) 250 :type '(repeat (choice regexp (symbol :tag "Major Mode")))
258 :group 'hippie-expand) 251 :group 'hippie-expand)
259 252
260;;;###autoload
261(defcustom hippie-expand-only-buffers () 253(defcustom hippie-expand-only-buffers ()
262 "A list specifying the only buffers to search (in addition to current). 254 "A list specifying the only buffers to search (in addition to current).
263Can contain both regexps matching buffer names (as strings) and major modes 255Can contain both regexps matching buffer names (as strings) and major modes
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index fbf7a672ff6..b0bc5b6b3b3 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -1052,8 +1052,6 @@ haven't encountered them yet. Returns a `hfy-style-assoc'."
1052 (hfy-face-attr-for-class fn hfy-display-class)) 1052 (hfy-face-attr-for-class fn hfy-display-class))
1053 ((and (symbolp fn) 1053 ((and (symbolp fn)
1054 (facep (symbol-value fn))) 1054 (facep (symbol-value fn)))
1055 ;; Obsolete faces like `font-lock-reference-face' are defined as
1056 ;; aliases for another face.
1057 (hfy-face-attr-for-class (symbol-value fn) hfy-display-class)) 1055 (hfy-face-attr-for-class (symbol-value fn) hfy-display-class))
1058 (t nil))) 1056 (t nil)))
1059 1057
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 97df90a65af..ee5bd0f357a 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -755,10 +755,16 @@ They are removed from `ibuffer-saved-filter-groups'."
755The value from `ibuffer-saved-filter-groups' is used." 755The value from `ibuffer-saved-filter-groups' is used."
756 (interactive 756 (interactive
757 (list 757 (list
758 (if (null ibuffer-saved-filter-groups) 758 (cond ((null ibuffer-saved-filter-groups)
759 (error "No saved filters") 759 (error "No saved filters"))
760 (completing-read "Switch to saved filter group: " 760 ;; `ibuffer-saved-filter-groups' is a user variable that defaults
761 ibuffer-saved-filter-groups nil t)))) 761 ;; to nil. We assume that with one element in this list the user
762 ;; knows what she wants. See bug#12331.
763 ((null (cdr ibuffer-saved-filter-groups))
764 (caar ibuffer-saved-filter-groups))
765 (t
766 (completing-read "Switch to saved filter group: "
767 ibuffer-saved-filter-groups nil t)))))
762 (setq ibuffer-filter-groups (cdr (assoc name ibuffer-saved-filter-groups)) 768 (setq ibuffer-filter-groups (cdr (assoc name ibuffer-saved-filter-groups))
763 ibuffer-hidden-filter-groups nil) 769 ibuffer-hidden-filter-groups nil)
764 (ibuffer-update nil t)) 770 (ibuffer-update nil t))
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 77461469044..c9dcff41618 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1283,7 +1283,7 @@ With optional ARG, make read-only only if ARG is not negative."
1283 (:opstring "toggled read only status in" 1283 (:opstring "toggled read only status in"
1284 :interactive "P" 1284 :interactive "P"
1285 :modifier-p t) 1285 :modifier-p t)
1286 (call-interactively 'toggle-read-only)) 1286 (read-only-mode 'toggle))
1287 1287
1288(define-ibuffer-op ibuffer-do-delete () 1288(define-ibuffer-op ibuffer-do-delete ()
1289 "Kill marked buffers as with `kill-this-buffer'." 1289 "Kill marked buffers as with `kill-this-buffer'."
@@ -2641,7 +2641,7 @@ will be inserted before the group at point."
2641;;;;;; ibuffer-backward-filter-group ibuffer-forward-filter-group 2641;;;;;; ibuffer-backward-filter-group ibuffer-forward-filter-group
2642;;;;;; ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group 2642;;;;;; ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group
2643;;;;;; ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode 2643;;;;;; ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode
2644;;;;;; ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "c255d1ebe80ccabd8385f40bdd0b5451") 2644;;;;;; ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "f03bae226325c7320d41ddb78896665a")
2645;;; Generated autoloads from ibuf-ext.el 2645;;; Generated autoloads from ibuf-ext.el
2646 2646
2647(autoload 'ibuffer-auto-mode "ibuf-ext" "\ 2647(autoload 'ibuffer-auto-mode "ibuf-ext" "\
diff --git a/lisp/ido.el b/lisp/ido.el
index d48e7ba858b..94818fe57b0 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -714,7 +714,7 @@ See also `ido-dir-file-cache' and `ido-save-directory-list-file'."
714 :type 'integer 714 :type 'integer
715 :group 'ido) 715 :group 'ido)
716 716
717(defcustom ido-max-directory-size 30000 717(defcustom ido-max-directory-size nil
718 "Maximum size (in bytes) for directories to use ido completion. 718 "Maximum size (in bytes) for directories to use ido completion.
719If you enter a directory with a size larger than this size, ido will 719If you enter a directory with a size larger than this size, ido will
720not provide the normal completion. To show the completions, use C-a." 720not provide the normal completion. To show the completions, use C-a."
@@ -3701,14 +3701,14 @@ This is to make them appear as if they were \"virtual buffers\"."
3701 (rexq (concat rex0 (if slash ".*/" ""))) 3701 (rexq (concat rex0 (if slash ".*/" "")))
3702 (re (if ido-enable-prefix (concat "\\`" rexq) rexq)) 3702 (re (if ido-enable-prefix (concat "\\`" rexq) rexq))
3703 (full-re (and do-full 3703 (full-re (and do-full
3704 (and (eq ido-cur-item 'buffer) 3704 (not (and (eq ido-cur-item 'buffer)
3705 (not ido-buffer-disable-smart-matches)) 3705 ido-buffer-disable-smart-matches))
3706 (not ido-enable-regexp) 3706 (not ido-enable-regexp)
3707 (not (string-match "\$\\'" rex0)) 3707 (not (string-match "\$\\'" rex0))
3708 (concat "\\`" rex0 (if slash "/" "") "\\'"))) 3708 (concat "\\`" rex0 (if slash "/" "") "\\'")))
3709 (suffix-re (and do-full slash 3709 (suffix-re (and do-full slash
3710 (and (eq ido-cur-item 'buffer) 3710 (not (and (eq ido-cur-item 'buffer)
3711 (not ido-buffer-disable-smart-matches)) 3711 ido-buffer-disable-smart-matches))
3712 (not ido-enable-regexp) 3712 (not ido-enable-regexp)
3713 (not (string-match "\$\\'" rex0)) 3713 (not (string-match "\$\\'" rex0))
3714 (concat rex0 "/\\'"))) 3714 (concat rex0 "/\\'")))
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index fabc12c0219..4ac62fbb6fc 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -1,4 +1,4 @@
1;;; image-mode.el --- support for visiting image files 1;;; image-mode.el --- support for visiting image files -*- lexical-binding: t -*-
2;; 2;;
3;; Copyright (C) 2005-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2005-2012 Free Software Foundation, Inc.
4;; 4;;
@@ -31,6 +31,11 @@
31;; resulting buffer file is saved to another name it will correctly save 31;; resulting buffer file is saved to another name it will correctly save
32;; the image data to the new file. 32;; the image data to the new file.
33 33
34;; Todo:
35
36;; Consolidate with doc-view to make them work on directories of images or on
37;; image files containing various "pages".
38
34;;; Code: 39;;; Code:
35 40
36(require 'image) 41(require 'image)
@@ -38,8 +43,7 @@
38 43
39;;; Image mode window-info management. 44;;; Image mode window-info management.
40 45
41(defvar image-mode-winprops-alist t) 46(defvar-local image-mode-winprops-alist t)
42(make-variable-buffer-local 'image-mode-winprops-alist)
43 47
44(defvar image-mode-new-window-functions nil 48(defvar image-mode-new-window-functions nil
45 "Special hook run when image data is requested in a new window. 49 "Special hook run when image data is requested in a new window.
@@ -47,9 +51,13 @@ It is called with one argument, the initial WINPROPS.")
47 51
48(defun image-mode-winprops (&optional window cleanup) 52(defun image-mode-winprops (&optional window cleanup)
49 "Return winprops of WINDOW. 53 "Return winprops of WINDOW.
50A winprops object has the shape (WINDOW . ALIST)." 54A winprops object has the shape (WINDOW . ALIST).
55WINDOW defaults to `selected-window' if it displays the current buffer, and
56otherwise it defaults to t, used for times when the buffer is not displayed."
51 (cond ((null window) 57 (cond ((null window)
52 (setq window (selected-window))) 58 (setq window
59 (if (eq (current-buffer) (window-buffer)) (selected-window) t)))
60 ((eq window t))
53 ((not (windowp window)) 61 ((not (windowp window))
54 (error "Not a window: %s" window))) 62 (error "Not a window: %s" window)))
55 (when cleanup 63 (when cleanup
diff --git a/lisp/image.el b/lisp/image.el
index 99c0a74a512..72dc654757a 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -346,7 +346,7 @@ Optional DATA-P non-nil means SOURCE is a string containing image data."
346 "Return non-nil if image type TYPE is available. 346 "Return non-nil if image type TYPE is available.
347Image types are symbols like `xbm' or `jpeg'." 347Image types are symbols like `xbm' or `jpeg'."
348 (and (fboundp 'init-image-library) 348 (and (fboundp 'init-image-library)
349 (init-image-library type dynamic-library-alist))) 349 (init-image-library type)))
350 350
351 351
352;;;###autoload 352;;;###autoload
diff --git a/lisp/imenu.el b/lisp/imenu.el
index c2a80d69675..47a2f1e3b40 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -326,6 +326,7 @@ PREVPOS is the variable in which we store the last position displayed."
326(defun imenu-example--name-and-position () 326(defun imenu-example--name-and-position ()
327 "Return the current/previous sexp and its (beginning) location. 327 "Return the current/previous sexp and its (beginning) location.
328Don't move point." 328Don't move point."
329 (declare (obsolete "use your own function instead." "23.2"))
329 (save-excursion 330 (save-excursion
330 (forward-sexp -1) 331 (forward-sexp -1)
331 ;; [ydi] modified for imenu-use-markers 332 ;; [ydi] modified for imenu-use-markers
@@ -333,8 +334,6 @@ Don't move point."
333 (end (progn (forward-sexp) (point)))) 334 (end (progn (forward-sexp) (point))))
334 (cons (buffer-substring beg end) 335 (cons (buffer-substring beg end)
335 beg)))) 336 beg))))
336(make-obsolete 'imenu-example--name-and-position
337 "use your own function instead." "23.2")
338 337
339;;; 338;;;
340;;; Lisp 339;;; Lisp
@@ -343,6 +342,7 @@ Don't move point."
343(defun imenu-example--lisp-extract-index-name () 342(defun imenu-example--lisp-extract-index-name ()
344 ;; Example of a candidate for `imenu-extract-index-name-function'. 343 ;; Example of a candidate for `imenu-extract-index-name-function'.
345 ;; This will generate a flat index of definitions in a lisp file. 344 ;; This will generate a flat index of definitions in a lisp file.
345 (declare (obsolete nil "23.2"))
346 (save-match-data 346 (save-match-data
347 (and (looking-at "(def") 347 (and (looking-at "(def")
348 (condition-case nil 348 (condition-case nil
@@ -353,11 +353,11 @@ Don't move point."
353 (end (progn (forward-sexp -1) (point)))) 353 (end (progn (forward-sexp -1) (point))))
354 (buffer-substring beg end))) 354 (buffer-substring beg end)))
355 (error nil))))) 355 (error nil)))))
356(make-obsolete 'imenu-example--lisp-extract-index-name "your own" "23.2")
357 356
358(defun imenu-example--create-lisp-index () 357(defun imenu-example--create-lisp-index ()
359 ;; Example of a candidate for `imenu-create-index-function'. 358 ;; Example of a candidate for `imenu-create-index-function'.
360 ;; It will generate a nested index of definitions. 359 ;; It will generate a nested index of definitions.
360 (declare (obsolete nil "23.2"))
361 (let ((index-alist '()) 361 (let ((index-alist '())
362 (index-var-alist '()) 362 (index-var-alist '())
363 (index-type-alist '()) 363 (index-type-alist '())
@@ -401,7 +401,6 @@ Don't move point."
401 (push (cons "Syntax-unknown" index-unknown-alist) 401 (push (cons "Syntax-unknown" index-unknown-alist)
402 index-alist)) 402 index-alist))
403 index-alist)) 403 index-alist))
404(make-obsolete 'imenu-example--create-lisp-index "your own" "23.2")
405 404
406;; Regular expression to find C functions 405;; Regular expression to find C functions
407(defvar imenu-example--function-name-regexp-c 406(defvar imenu-example--function-name-regexp-c
@@ -414,6 +413,7 @@ Don't move point."
414 )) 413 ))
415 414
416(defun imenu-example--create-c-index (&optional regexp) 415(defun imenu-example--create-c-index (&optional regexp)
416 (declare (obsolete nil "23.2"))
417 (let ((index-alist '()) 417 (let ((index-alist '())
418 char) 418 char)
419 (goto-char (point-min)) 419 (goto-char (point-min))
@@ -430,7 +430,6 @@ Don't move point."
430 (if (not (eq char ?\;)) 430 (if (not (eq char ?\;))
431 (push (imenu-example--name-and-position) index-alist)))) 431 (push (imenu-example--name-and-position) index-alist))))
432 (nreverse index-alist))) 432 (nreverse index-alist)))
433(make-obsolete 'imenu-example--create-c-index "your own" "23.2")
434 433
435;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 434;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
436;;; 435;;;
diff --git a/lisp/international/latin1-disp.el b/lisp/international/latin1-disp.el
index 964f01c982c..5041f45ba97 100644
--- a/lisp/international/latin1-disp.el
+++ b/lisp/international/latin1-disp.el
@@ -202,8 +202,8 @@ character set: `latin-2', `hebrew' etc."
202 (and char (char-displayable-p char)))) 202 (and char (char-displayable-p char))))
203 203
204;; Backwards compatibility. 204;; Backwards compatibility.
205(defalias 'latin1-char-displayable-p 'char-displayable-p) 205(define-obsolete-function-alias 'latin1-char-displayable-p
206(make-obsolete 'latin1-char-displayable-p 'char-displayable-p "22.1") 206 'char-displayable-p "22.1")
207 207
208(defun latin1-display-setup (set &optional force) 208(defun latin1-display-setup (set &optional force)
209 "Set up Latin-1 display for characters in the given SET. 209 "Set up Latin-1 display for characters in the given SET.
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 2fc9759972e..a32c69a691e 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2058,9 +2058,9 @@ See `set-language-info-alist' for use in programs."
2058 2058
2059(defun princ-list (&rest args) 2059(defun princ-list (&rest args)
2060 "Print all arguments with `princ', then print \"\\n\"." 2060 "Print all arguments with `princ', then print \"\\n\"."
2061 (declare (obsolete "use mapc and princ instead." "23.3"))
2061 (mapc #'princ args) 2062 (mapc #'princ args)
2062 (princ "\n")) 2063 (princ "\n"))
2063(make-obsolete 'princ-list "use mapc and princ instead" "23.3")
2064 2064
2065(put 'describe-specified-language-support 'apropos-inhibit t) 2065(put 'describe-specified-language-support 'apropos-inhibit t)
2066 2066
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index bd7257bbc0f..43af785cc2f 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -208,8 +208,8 @@ Character sets for defining other charsets, or for backward compatibility
208 "Decode a character that has code CODE in CODEPAGE. 208 "Decode a character that has code CODE in CODEPAGE.
209Return a decoded character string. Each CODEPAGE corresponds to a 209Return a decoded character string. Each CODEPAGE corresponds to a
210coding system cpCODEPAGE." 210coding system cpCODEPAGE."
211 (declare (obsolete decode-char "23.1"))
211 (decode-char (intern (format "cp%d" codepage)) code)) 212 (decode-char (intern (format "cp%d" codepage)) code))
212(make-obsolete 'decode-codepage-char 'decode-char "23.1")
213 213
214;; A variable to hold charset input history. 214;; A variable to hold charset input history.
215(defvar charset-history nil) 215(defvar charset-history nil)
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index 7b152a47727..3dc0b54421a 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -34,39 +34,6 @@
34;;; characters. 34;;; characters.
35 35
36;;;###autoload 36;;;###autoload
37(defun string-to-sequence (string type)
38 "Convert STRING to a sequence of TYPE which contains characters in STRING.
39TYPE should be `list' or `vector'."
40;;; (let ((len (length string))
41;;; (i 0)
42;;; val)
43 (cond ((eq type 'list)
44 ;; Applicable post-Emacs 20.2 and asymptotically ~10 times
45 ;; faster than the code below:
46 (append string nil))
47;;; (setq val (make-list len 0))
48;;; (let ((l val))
49;;; (while (< i len)
50;;; (setcar l (aref string i))
51;;; (setq l (cdr l) i (1+ i))))))
52 ((eq type 'vector)
53 ;; As above.
54 (vconcat string))
55;;; (setq val (make-vector len 0))
56;;; (while (< i len)
57;;; (aset val i (aref string i))
58;;; (setq i (1+ i))))
59 (t
60 (error "Invalid type: %s" type)))
61;;; val)
62)
63
64;;;###autoload
65(make-obsolete 'string-to-sequence
66 "use `string-to-list' or `string-to-vector'."
67 "22.1")
68
69;;;###autoload
70(defsubst string-to-list (string) 37(defsubst string-to-list (string)
71 "Return a list of characters in STRING." 38 "Return a list of characters in STRING."
72 (append string nil)) 39 (append string nil))
@@ -330,10 +297,9 @@ operations such as `find-coding-systems-region'."
330 "Detect a coding system of the text between FROM and TO with PRIORITY-LIST. 297 "Detect a coding system of the text between FROM and TO with PRIORITY-LIST.
331PRIORITY-LIST is an alist of coding categories vs the corresponding 298PRIORITY-LIST is an alist of coding categories vs the corresponding
332coding systems ordered by priority." 299coding systems ordered by priority."
300 (declare (obsolete with-coding-priority "23.1"))
333 `(with-coding-priority (mapcar #'cdr ,priority-list) 301 `(with-coding-priority (mapcar #'cdr ,priority-list)
334 (detect-coding-region ,from ,to))) 302 (detect-coding-region ,from ,to)))
335(make-obsolete 'detect-coding-with-priority
336 "use `with-coding-priority' and `detect-coding-region'." "23.1")
337 303
338;;;###autoload 304;;;###autoload
339(defun detect-coding-with-language-environment (from to lang-env) 305(defun detect-coding-with-language-environment (from to lang-env)
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 4d567a6e9d8..e6e3f045a9e 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -409,13 +409,13 @@ PLIST (property list) may contain any type of information a user
409 409
410(defun charset-id (charset) 410(defun charset-id (charset)
411 "Always return 0. This is provided for backward compatibility." 411 "Always return 0. This is provided for backward compatibility."
412 (declare (obsolete nil "23.1"))
412 0) 413 0)
413(make-obsolete 'charset-id "do not use it." "23.1")
414 414
415(defmacro charset-bytes (charset) 415(defmacro charset-bytes (charset)
416 "Always return 0. This is provided for backward compatibility." 416 "Always return 0. This is provided for backward compatibility."
417 (declare (obsolete nil "23.1"))
417 0) 418 0)
418(make-obsolete 'charset-bytes "do not use it." "23.1")
419 419
420(defun get-charset-property (charset propname) 420(defun get-charset-property (charset propname)
421 "Return the value of CHARSET's PROPNAME property. 421 "Return the value of CHARSET's PROPNAME property.
@@ -464,8 +464,8 @@ Return -1 if charset isn't an ISO 2022 one."
464 464
465(defun charset-list () 465(defun charset-list ()
466 "Return list of all charsets ever defined." 466 "Return list of all charsets ever defined."
467 (declare (obsolete charset-list "23.1"))
467 charset-list) 468 charset-list)
468(make-obsolete 'charset-list "use variable `charset-list'." "23.1")
469 469
470 470
471;;; CHARACTER 471;;; CHARACTER
@@ -473,8 +473,8 @@ Return -1 if charset isn't an ISO 2022 one."
473 473
474(defun generic-char-p (char) 474(defun generic-char-p (char)
475 "Always return nil. This is provided for backward compatibility." 475 "Always return nil. This is provided for backward compatibility."
476 (declare (obsolete nil "23.1"))
476 nil) 477 nil)
477(make-obsolete 'generic-char-p "generic characters no longer exist." "23.1")
478 478
479(defun make-char-internal (charset-id &optional code1 code2) 479(defun make-char-internal (charset-id &optional code1 code2)
480 (let ((charset (aref emacs-mule-charset-table charset-id))) 480 (let ((charset (aref emacs-mule-charset-table charset-id)))
@@ -1012,6 +1012,7 @@ Value is a list of transformed arguments."
1012 eol-type) 1012 eol-type)
1013 "Define a new coding system CODING-SYSTEM (symbol). 1013 "Define a new coding system CODING-SYSTEM (symbol).
1014This function is provided for backward compatibility." 1014This function is provided for backward compatibility."
1015 (declare (obsolete define-coding-system "23.1"))
1015 ;; For compatibility with XEmacs, we check the type of TYPE. If it 1016 ;; For compatibility with XEmacs, we check the type of TYPE. If it
1016 ;; is a symbol, perhaps, this function is called with XEmacs-style 1017 ;; is a symbol, perhaps, this function is called with XEmacs-style
1017 ;; arguments. Here, try to transform that kind of arguments to 1018 ;; arguments. Here, try to transform that kind of arguments to
@@ -1104,8 +1105,6 @@ This function is provided for backward compatibility."
1104 1105
1105 (apply 'define-coding-system coding-system doc-string properties)) 1106 (apply 'define-coding-system coding-system doc-string properties))
1106 1107
1107(make-obsolete 'make-coding-system 'define-coding-system "23.1")
1108
1109(defun merge-coding-systems (first second) 1108(defun merge-coding-systems (first second)
1110 "Fill in any unspecified aspects of coding system FIRST from SECOND. 1109 "Fill in any unspecified aspects of coding system FIRST from SECOND.
1111Return the resulting coding system." 1110Return the resulting coding system."
@@ -1449,9 +1448,9 @@ This setting is effective for the next communication only."
1449ARG is a list of coding categories ordered by priority. 1448ARG is a list of coding categories ordered by priority.
1450 1449
1451This function is provided for backward compatibility." 1450This function is provided for backward compatibility."
1451 (declare (obsolete set-coding-system-priority "23.1"))
1452 (apply 'set-coding-system-priority 1452 (apply 'set-coding-system-priority
1453 (mapcar #'(lambda (x) (symbol-value x)) arg))) 1453 (mapcar #'(lambda (x) (symbol-value x)) arg)))
1454(make-obsolete 'set-coding-priority 'set-coding-system-priority "23.1")
1455 1454
1456;;; X selections 1455;;; X selections
1457 1456
@@ -2356,9 +2355,6 @@ Analogous to `define-translation-table', but updates
2356(setq ignore-relative-composition 2355(setq ignore-relative-composition
2357 (make-char-table 'ignore-relative-composition)) 2356 (make-char-table 'ignore-relative-composition))
2358 2357
2359(make-obsolete 'set-char-table-default
2360 "generic characters no longer exist." "23.1")
2361
2362;;; Built-in auto-coding-functions: 2358;;; Built-in auto-coding-functions:
2363 2359
2364(defun sgml-xml-auto-coding-function (size) 2360(defun sgml-xml-auto-coding-function (size)
diff --git a/lisp/international/uni-bidi.el b/lisp/international/uni-bidi.el
index 0dfabdd65da..ba1bd436b23 100644
--- a/lisp/international/uni-bidi.el
+++ b/lisp/international/uni-bidi.el
@@ -5,7 +5,7 @@
5(define-char-code-property 'bidi-class #^[1 nil char-code-property-table 5(define-char-code-property 'bidi-class #^[1 nil char-code-property-table
6#^^[3 0 5 5 5 5 5 5 5 5 5 17 6 17 18 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 17 18 19 19 14 14 14 19 19 19 19 19 13 15 13 15 15 3 3 3 3 3 3 3 3 3 3 15 19 19 19 19 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 19 19 19 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 19 19 19 5] #^^[1 0 #^^[2 0 6#^^[3 0 5 5 5 5 5 5 5 5 5 17 6 17 18 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 17 18 19 19 14 14 14 19 19 19 19 19 13 15 13 15 15 3 3 3 3 3 3 3 3 3 3 15 19 19 19 19 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 19 19 19 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 19 19 19 5] #^^[1 0 #^^[2 0
7#^^[3 0 5 5 5 5 5 5 5 5 5 17 6 17 18 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 17 18 19 19 14 14 14 19 19 19 19 19 13 15 13 15 15 3 3 3 3 3 3 3 3 3 3 15 19 19 19 19 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 19 19 19 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 19 19 19 5] "…š„„ƒ…—Ÿˆ" 1 1 1 "¹‡ŽŽ…‰‘" "ð„ˆ" "„î‰" 1 "ƒ‡ö" 1 "Š„­¸" "…‹°•Šƒ" "Ö‡†„І" "Žž›³" "¦‹Ž«‰„†" "–„‰ƒ…«ƒ¤" " ‹·›" "ƒ·„ˆ„ƒ‡Šœ" "º„„ˆ”އ„" "¹„„ƒƒžƒŠ" "¹„…„”Ž" "º„ˆˆ‹œ" "½Œ¥†…" "¾ƒ…ƒ„‡‹”‡" "¼”œ" "Á„ˆ”œ" "ʇƒ©" "±‡„‡ˆ±" "±†‹†²" "˜›„³Ž" "……‹¤‰¹"] #^^[2 4096 "­„†™„ƒ„‹" "†â" 1 1 1 1 "݃ " "Šæ" "ÿ" 1 1 1 1 "šã" "’ƒƒžŒ" "´‡ˆ‹‡’І" "‹ƒñ" "©Ö" " ƒ„‰†ƒ„ƒº" "Þ¢" "—½‡ˆ†Š" 1 "„°……¨‰Œ" " „ºƒƒŽ" "¬ˆÈ" "Ѓ‡„†‹" 1 "À§•„" 1 1 1 "½ƒ‹ƒƒƒ"] #^^[2 8192 "‹ƒ˜ 7#^^[3 0 5 5 5 5 5 5 5 5 5 17 6 17 18 6 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 17 18 19 19 14 14 14 19 19 19 19 19 13 15 13 15 15 3 3 3 3 3 3 3 3 3 3 15 19 19 19 19 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 19 19 19 19 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 19 19 19 5] "…š„„ƒ…—Ÿˆ" 1 1 1 "¹‡ŽŽ…‰‘" "ð„ˆ" "„î‰" 1 "ƒ‡ö" 1 "Š„­¸" "…‹°•Šƒ" "Ö‡†„І" "Žž›³" "¦‹Ž«‰„†" "–„‰ƒ…«ƒ¤" " ‹·›" "ƒ·„ˆ„ƒ‡Šœ" "º„„ˆ”އ„" "¹„„ƒƒžƒŠ" "¹„…„”Ž" "º„ˆˆ‹œ" "½Œ¥†…" "¾ƒ…ƒ„‡‹”‡" "¼”œ" "Á„ˆ”œ" "ʇƒ©" "±‡„‡ˆ±" "±†‹†²" "˜›„³Ž" "……‹¤‰¹"] #^^[2 4096 "­„†™„ƒ„‹" "†â" 1 1 1 1 "݃ " "Šæ" "ÿ" 1 1 1 1 "šã" "’ƒƒžŒ" "´‡ˆ‹‡’І" "‹ƒñ" "©Ö" " ƒ„‰†ƒ„ƒº" "Þ¢" "—½‡ˆ†Š" 1 "„°……¨‰Œ" " „ºƒƒŽ" "¬ˆÈ" "Ѓ‡„†‹" 1 "À§•„" 1 1 1 "½ƒ‹ƒƒƒ"] #^^[2 8192 "‹ƒ˜
8 …š……†ƒ† ƒ" "Š ƒ‘š–¡" "„Šƒ…†„‹„……„ " "‰†ð" "’ ì" 19 "¶Å…" "•ÞŒ" "§™‹• " "ˆ”Ζ" 19 19 19 "¬Ó" "ÿ" 19 1 1 19 19 19 19 "ÍƒŠ¦" 1 1 "冄ƒ‡‡" "ÿ" "à " "¼Ä" "šÙŒ" 19 "ÖšŒ„"] #^^[2 12288 "„ƒ™‰„……ƒÀ" "™ƒÚ„" 1 "À¤œ" "±œƒ" "±Œ„°" "÷„…" "ÞŸ" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 16384 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "ÀÀ" 1 1 1 1] 1 1 1 1 #^^[2 36864 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 …š……†ƒ† ƒ" "Š ƒ‘›•¡" "„Šƒ…†„‹„……„ " "‰†ð" "’ ì" 19 "¶Å…" "•ÞŒ" "§™‹• " "ˆ”Ζ" 19 19 19 "¬Ó" "ÿ" 19 1 1 19 19 19 19 "ÍƒŠ¦" 1 1 "冄ƒ‡‡" "ÿ" "à " "¼Ä" "šÙŒ" 19 "ÖšŒ„"] #^^[2 12288 "„ƒ™‰„……ƒÀ" "™ƒÚ„" 1 "À¤œ" "±œƒ" "±Œ„°" "÷„…" "ÞŸ" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 16384 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "ÀÀ" 1 1 1 1] 1 1 1 1 #^^[2 36864 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
9#^^[3 40832 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]] #^^[2 40960 1 1 1 1 1 1 1 1 1 "·¹" 1 1 "ƒß„Š" "ŸÐŽ" "¢Þ" "ˆ÷" "ƒ„™„Œº„ˆ" "Ä›’Ž" "¦ˆ™‹®" "ƒ°„Ã" "©†Œˆ³" "°ƒ…ªˆ‰" 1 "å„’" 1 1 1 1 1 1 1 1] 1 1 #^^[2 53248 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 #^^[2 61440 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "Š ¦°" 7 7 7 "¾À" "ý" "Š†‡‰ ‰ ƒ„" "ÿ" "ƒ…  Š†š†š‹š" "àƒ‡Š…"]] #^^[1 65536 #^^[2 65536 1 1 "¾À" "‹…Œá" 1 1 1 1 1 1 1 1 1 1 1 1 2 2 "Ÿà" 2 "ƒ…„¨ƒ„À" 2 "¹‡À" 2 2 2 2 2 "àŸ" 2 2 2] #^^[2 69632 "¶‹”š" "±„Å" "ƒ¤…ˆË" "´‰Á" 1 1 1 1 1 1 1 1 1 "«†È" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 73728 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 77824 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 1 #^^[2 90112 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "„í"] 1 1 1 1 #^^[2 110592 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 #^^[2 118784 1 1 "烉ˆ…" "ƒ‡ž„Ò" "ƒº" 1 "ש" 1 1 1 1 1 1 "Û¤" "•¹°" "‰¹Š²" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 122880 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 "„›Š„†„ƒ„‡„„" "Š‘…ƒ…‘´Ž" 2 2] #^^[2 126976 "¬„Ð" "”ŒŽ " "‹ß”" 1 1 1 "¡†Æƒ" "”Œ¥…•‘" "¿¾" "ø„ƒ" "¾„Œ˜˜" "û…" "Á„‹°" "ƺ" "ôŒ" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]] #^^[1 131072 1 1 1 1 1 1 1 1 1 1 #^^[2 172032 1 1 1 1 1 1 1 1 1 1 1 1 1 9#^^[3 40832 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]] #^^[2 40960 1 1 1 1 1 1 1 1 1 "·¹" 1 1 "ƒß„Š" "ŸÐŽ" "¢Þ" "ˆ÷" "ƒ„™„Œº„ˆ" "Ä›’Ž" "¦ˆ™‹®" "ƒ°„Ã" "©†Œˆ³" "°ƒ…ªˆ‰" 1 "å„’" 1 1 1 1 1 1 1 1] 1 1 #^^[2 53248 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 #^^[2 61440 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "Š ¦°" 7 7 7 "¾À" "ý" "Š†‡‰ ‰ ƒ„" "ÿ" "ƒ…  Š†š†š‹š" "àƒ‡Š…"]] #^^[1 65536 #^^[2 65536 1 1 "¾À" "‹…Œá" 1 1 1 1 1 1 1 1 1 1 1 1 2 2 "Ÿà" 2 "ƒ…„¨ƒ„À" 2 "¹‡À" 2 2 2 2 2 "àŸ" 2 2 2] #^^[2 69632 "¶‹”š" "±„Å" "ƒ¤…ˆË" "´‰Á" 1 1 1 1 1 1 1 1 1 "«†È" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 73728 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 77824 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 1 #^^[2 90112 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "„í"] 1 1 1 1 #^^[2 110592 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 #^^[2 118784 1 1 "烉ˆ…" "ƒ‡ž„Ò" "ƒº" 1 "ש" 1 1 1 1 1 1 "Û¤" "•¹°" "‰¹Š²" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 122880 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 "„›Š„†„ƒ„‡„„" "Š‘…ƒ…‘´Ž" 2 2] #^^[2 126976 "¬„Ð" "”ŒŽ " "‹ß”" 1 1 1 "¡†Æƒ" "”Œ¥…•‘" "¿¾" "ø„ƒ" "¾„Œ˜˜" "û…" "Á„‹°" "ƺ" "ôŒ" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]] #^^[1 131072 1 1 1 1 1 1 1 1 1 1 #^^[2 172032 1 1 1 1 1 1 1 1 1 1 1 1 1
10#^^[3 173696 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 176128 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10#^^[3 173696 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 176128 1 1 1 1 1 1 1 1 1 1 1 1 1 1
11#^^[3 177920 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 11#^^[3 177920 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1
diff --git a/lisp/international/uni-category.el b/lisp/international/uni-category.el
index f0ccde477cc..75ebc04c98f 100644
--- a/lisp/international/uni-category.el
+++ b/lisp/international/uni-category.el
@@ -5,7 +5,7 @@
5(define-char-code-property 'general-category #^[30 nil char-code-property-table 5(define-char-code-property 'general-category #^[30 nil char-code-property-table
6#^^[3 0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 23 18 18 18 20 18 18 18 14 15 18 19 18 13 18 18 9 9 9 9 9 9 9 9 9 9 18 18 19 19 19 18 18 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 18 15 21 12 21 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 14 19 15 19 26] #^^[1 0 #^^[2 0 6#^^[3 0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 23 18 18 18 20 18 18 18 14 15 18 19 18 13 18 18 9 9 9 9 9 9 9 9 9 9 18 18 19 19 19 18 18 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 18 15 21 12 21 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 14 19 15 19 26] #^^[1 0 #^^[2 0
7#^^[3 0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 23 18 18 18 20 18 18 18 14 15 18 19 18 13 18 18 9 9 9 9 9 9 9 9 9 9 18 18 19 19 19 18 18 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 18 15 21 12 21 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 14 19 15 19 26] " „   ƒ—‡˜ˆ" "" "ƒ„ƒƒƒƒ„ƒ" "‡„±" "”›’„ŒŽ…‡‘" "ðƒ" "„ƒ‘‰£ƒƒ…ƒ" "°°" "…" "‰¦†Ÿ" "ˆ „­ ˆ›…ƒ‹" "…ƒ‹ Š• Š„" "Ô‡†„ Šƒ" "Žž›³" "¦‹Ž Š¡‰ƒ…" "–„‰ƒ…™ƒ¡" " ‹·›" "ƒ¶ƒˆ„‡Š І‡" "ˆ–‡ƒ„ƒ„ˆ„ƒ Š †„" "†„–‡ƒ„ƒƒ‡„‡ ŠƒŠ" "‰ƒ–‡…ƒ… ŠŽ" "ˆ–‡…„ˆ„ƒ Š †ˆ" "†ƒƒ„ƒƒƒƒƒŒ„ƒƒƒ†Ž Š ƒ†…" "ƒˆƒ—Š…ƒƒ„ƒ„‡† Šˆ ‡" "ˆƒ—Š……‡‡ Š" "ˆƒ©ƒ„ƒƒˆˆ Š †ƒ†" "’ƒ˜‰‡ƒ„ƒƒˆ’‹" "°‡„†ˆ Ф" "†„‡ƒ„†…† Š„ " "ƒƒ† Š Šˆ¤„Ž" "……‹¤ˆ†…„¥"] #^^[2 4096 "«„† І†„ƒƒ‡ƒ„‹" "† Šƒ¦…«ƒ" 5 5 "É„‡„ " "‰„¡„‡„¨" "‘„É ”ƒ" "Š†Õ‹" " ÿ" 5 5 5 "í‘" "šƒËƒ 7#^^[3 0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 23 18 18 18 20 18 18 18 14 15 18 19 18 13 18 18 9 9 9 9 9 9 9 9 9 9 18 18 19 19 19 18 18 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 18 15 21 12 21 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 14 19 15 19 26] " „   ƒ—‡˜ˆ" "" "ƒ„ƒƒƒƒ„ƒ" "‡„±" "”›’„ŒŽ…‡‘" "ðƒ" "„ƒ‘‰£ƒƒ…ƒ" "°°" "…" "‰¦†Ÿ" "ˆ „­ ˆ›…ƒ‹" "…ƒ‹ Š• Š„" "Ô‡†„ Šƒ" "Žž›³" "¦‹Ž Š¡‰ƒ…" "–„‰ƒ…™ƒ¡" " ‹·›" "ƒ¶ƒˆ„‡Š І‡" "ˆ–‡ƒ„ƒ„ˆ„ƒ Š †„" "†„–‡ƒ„ƒƒ‡„‡ ŠƒŠ" "‰ƒ–‡…ƒ… ŠŽ" "ˆ–‡…„ˆ„ƒ Š †ˆ" "†ƒƒ„ƒƒƒƒƒŒ„ƒƒƒ†Ž Š ƒ†…" "ƒˆƒ—Š…ƒƒ„ƒ„‡† Šˆ ‡" "ˆƒ—Š……‡‡ Š" "ˆƒ©ƒ„ƒƒˆˆ Š †ƒ†" "’ƒ˜‰‡ƒ„ƒƒˆ’‹" "°‡„†ˆ Ф" "†„‡ƒ„†…† Š„ " "ƒƒ† Š Šˆ¤„Ž" "……‹¤ˆ†…„¥"] #^^[2 4096 "«„† І†„ƒƒ‡ƒ„‹" "† Šƒ¦…«ƒ" 5 5 "É„‡„ " "‰„¡„‡„¨" "‘„É ”ƒ" "Š†Õ‹" " ÿ" 5 5 5 "í‘" "šƒËƒ
8ƒ" "„ƒ‹’ƒ‰’ŒƒŒ" "´‡ˆ‹ƒƒ І І" "† „ƒ І£´ˆ" "©…ÆŠ" "ƒƒ„ƒ„†ƒ„ƒ Šž…‹" "¬„‘‡† Š ƒ¢" "—ƒµ‡ˆ†Š" " І І‡†Ò" "„¯……‡„ ЇЉ‰ƒ" "ž„ Ьƒƒˆ„" "¤ˆˆƒ… Šƒƒ Šž†" "Àˆˆƒ‡„„‰" "¬¿‡" "›¥§•„" "" "‰" "ˆˆ††ˆˆˆˆ††ˆˆˆŽ" "ˆˆˆˆˆˆ…„ƒƒ„ƒ„„ƒˆ…ƒƒ„"] #^^[2 8192 "‹… †ˆ…‰„ ƒ‹ Š……†  †ƒ" " Šƒƒš–„ƒŒ" "„ƒƒ…†„„„…„  8ƒ" "„ƒ‹’ƒ‰’ŒƒŒ" "´‡ˆ‹ƒƒ І І" "† „ƒ І£´ˆ" "©…ÆŠ" "ƒƒ„ƒ„†ƒ„ƒ Šž…‹" "¬„‘‡† Š ƒ¢" "—ƒµ‡ˆ†Š" " І І‡†Ò" "„¯……‡„ ЇЉ‰ƒ" "ž„ Ьƒƒˆ„" "¤ˆˆƒ… Šƒƒ Šž†" "Àˆˆƒ‡„„‰" "¬¿‡" "›¥§•„" "" "‰" "ˆˆ††ˆˆˆˆ††ˆˆˆŽ" "ˆˆˆˆˆˆ…„ƒƒ„ƒ„„ƒˆ…ƒƒ„"] #^^[2 8192 "‹… †ˆ…‰„ ƒ‹ Š……†  †ƒ" " Šƒƒ›•„ƒŒ" "„ƒƒ…†„„„…„ 
9 " " 9 " "
10ƒ 10ƒ
11„ †……„‡ŸŸŒ" 19 19 "ˆ„”‡Ñƒ" "›™¨†’Œ" "§™‹•  " " œÎ –" 22 "·‰¶ˆ" "ï" 22 "ç Š" " ”¬…Ÿ" 22 22 19 "ƒ¿ " 19 19 "°•†ƒŠ¦" 30 "¯¯ƒ„†" "†ƒ…„ " "¦…¸‡Ž" "—‰‡‡‡‡‡‡‡‡ " "ƒ‰  …Š Ä" "šÙŒ" 22 "ÖšŒ„"] #^^[2 12288 "ƒ 11„ †……„‡ŸŸŒ" 19 19 "ˆ„”‡Ñƒ" "›™¨†’Œ" "§™‹•  " " œÎ –" 22 "·‰¶ˆ" "ï" 22 "ç Š" " ”¬…Ÿ" 22 22 19 "ƒ¿ " 19 19 "°•†ƒŠ¦" 30 "¯¯ƒ„†" "†ƒ…„ " "¦…¸‡Ž" "—‰‡‡‡‡‡‡‡‡ " "ƒ‰  …Š Ä" "šÙŒ" 22 "ÖšŒ„"] #^^[2 12288 "ƒ
diff --git a/lisp/international/uni-name.el b/lisp/international/uni-name.el
index 458957ef366..cf37db39b48 100644
--- a/lisp/international/uni-name.el
+++ b/lisp/international/uni-name.el
Binary files differ
diff --git a/lisp/international/uni-numeric.el b/lisp/international/uni-numeric.el
index 9f0d3079259..7c0be5b438a 100644
--- a/lisp/international/uni-numeric.el
+++ b/lisp/international/uni-numeric.el
Binary files differ
diff --git a/lisp/iswitchb.el b/lisp/iswitchb.el
index 624c3500939..13ab41cf83a 100644
--- a/lisp/iswitchb.el
+++ b/lisp/iswitchb.el
@@ -527,33 +527,6 @@ selected.")
527 527
528;;; FUNCTIONS 528;;; FUNCTIONS
529 529
530;;; ISWITCHB KEYMAP
531(defun iswitchb-define-mode-map ()
532 "Set up the keymap for `iswitchb-buffer'."
533 (interactive)
534 (let (map)
535 ;; generated every time so that it can inherit new functions.
536 ;;(or iswitchb-mode-map
537
538 (setq map (copy-keymap minibuffer-local-map))
539 (define-key map "?" 'iswitchb-completion-help)
540 (define-key map "\C-s" 'iswitchb-next-match)
541 (define-key map "\C-r" 'iswitchb-prev-match)
542 (define-key map "\t" 'iswitchb-complete)
543 (define-key map "\C-j" 'iswitchb-select-buffer-text)
544 (define-key map "\C-t" 'iswitchb-toggle-regexp)
545 (define-key map "\C-x\C-f" 'iswitchb-find-file)
546 (define-key map "\C-n" 'iswitchb-toggle-ignore)
547 (define-key map "\C-c" 'iswitchb-toggle-case)
548 (define-key map "\C-k" 'iswitchb-kill-buffer)
549 (define-key map "\C-m" 'iswitchb-exit-minibuffer)
550 (setq iswitchb-mode-map map)
551 (run-hooks 'iswitchb-define-mode-map-hook)))
552
553(make-obsolete 'iswitchb-define-mode-map
554 "use M-x iswitchb-mode or customize the variable `iswitchb-mode'."
555 "21.1")
556
557;;; MAIN FUNCTION 530;;; MAIN FUNCTION
558(defun iswitchb () 531(defun iswitchb ()
559 "Switch to buffer matching a substring. 532 "Switch to buffer matching a substring.
@@ -619,14 +592,25 @@ If START is a string, the selection process is started with that
619string. 592string.
620If MATCHES-SET is non-nil, the buflist is not updated before 593If MATCHES-SET is non-nil, the buflist is not updated before
621the selection process begins. Used by isearchb.el." 594the selection process begins. Used by isearchb.el."
622 (let 595 ;; The map is generated every time so that it can inherit new
623 ( 596 ;; functions.
624 buf-sel 597 (let ((map (copy-keymap minibuffer-local-map))
625 iswitchb-final-text 598 buf-sel iswitchb-final-text map
626 (icomplete-mode nil) ;; prevent icomplete starting up 599 icomplete-mode) ; prevent icomplete starting up
627 ) 600 (define-key map "?" 'iswitchb-completion-help)
628 601 (define-key map "\C-s" 'iswitchb-next-match)
629 (iswitchb-define-mode-map) 602 (define-key map "\C-r" 'iswitchb-prev-match)
603 (define-key map "\t" 'iswitchb-complete)
604 (define-key map "\C-j" 'iswitchb-select-buffer-text)
605 (define-key map "\C-t" 'iswitchb-toggle-regexp)
606 (define-key map "\C-x\C-f" 'iswitchb-find-file)
607 (define-key map "\C-n" 'iswitchb-toggle-ignore)
608 (define-key map "\C-c" 'iswitchb-toggle-case)
609 (define-key map "\C-k" 'iswitchb-kill-buffer)
610 (define-key map "\C-m" 'iswitchb-exit-minibuffer)
611 (setq iswitchb-mode-map map)
612 (run-hooks 'iswitchb-define-mode-map-hook)
613
630 (setq iswitchb-exit nil) 614 (setq iswitchb-exit nil)
631 (setq iswitchb-default 615 (setq iswitchb-default
632 (if (bufferp default) 616 (if (bufferp default)
diff --git a/lisp/json.el b/lisp/json.el
index f1ee3a52032..8167bfe93f2 100644
--- a/lisp/json.el
+++ b/lisp/json.el
@@ -311,13 +311,13 @@ representation will be parsed correctly."
311 (setq char (json-encode-char0 char 'ucs)) 311 (setq char (json-encode-char0 char 'ucs))
312 (let ((control-char (car (rassoc char json-special-chars)))) 312 (let ((control-char (car (rassoc char json-special-chars))))
313 (cond 313 (cond
314 ;; Special JSON character (\n, \r, etc.) 314 ;; Special JSON character (\n, \r, etc.).
315 (control-char 315 (control-char
316 (format "\\%c" control-char)) 316 (format "\\%c" control-char))
317 ;; ASCIIish printable character 317 ;; ASCIIish printable character.
318 ((and (> char 31) (< char 161)) 318 ((and (> char 31) (< char 127))
319 (format "%c" char)) 319 (format "%c" char))
320 ;; Fallback: UCS code point in \uNNNN form 320 ;; Fallback: UCS code point in \uNNNN form.
321 (t 321 (t
322 (format "\\u%04x" char))))) 322 (format "\\u%04x" char)))))
323 323
diff --git a/lisp/linum.el b/lisp/linum.el
index 162dc19f437..3c278dbbf3b 100644
--- a/lisp/linum.el
+++ b/lisp/linum.el
@@ -44,7 +44,6 @@
44 "Show line numbers in the left margin." 44 "Show line numbers in the left margin."
45 :group 'convenience) 45 :group 'convenience)
46 46
47;;;###autoload
48(defcustom linum-format 'dynamic 47(defcustom linum-format 'dynamic
49 "Format used to display line numbers. 48 "Format used to display line numbers.
50Either a format string like \"%7d\", `dynamic' to adapt the width 49Either a format string like \"%7d\", `dynamic' to adapt the width
@@ -52,7 +51,9 @@ as needed, or a function that is called with a line number as its
52argument and should evaluate to a string to be shown on that line. 51argument and should evaluate to a string to be shown on that line.
53See also `linum-before-numbering-hook'." 52See also `linum-before-numbering-hook'."
54 :group 'linum 53 :group 'linum
55 :type 'sexp) 54 :type '(choice (string :tag "Format string")
55 (const :tag "Dynamic width" dynamic)
56 (function :tag "Function")))
56 57
57(defface linum 58(defface linum
58 '((t :inherit (shadow default))) 59 '((t :inherit (shadow default)))
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index ca9bc6b8676..0066847e995 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -248,6 +248,13 @@ usually do not have translators for other languages.\n\n")))
248 "', version " 248 "', version "
249 (mapconcat 'number-to-string (x-server-version) ".") "\n") 249 (mapconcat 'number-to-string (x-server-version) ".") "\n")
250 (error t))) 250 (error t)))
251 (let ((lsb (with-temp-buffer
252 (if (eq 0 (ignore-errors
253 (call-process "lsb_release" nil '(t nil)
254 nil "-d")))
255 (buffer-string)))))
256 (if (stringp lsb)
257 (insert "System " lsb "\n")))
251 (when (and system-configuration-options 258 (when (and system-configuration-options
252 (not (equal system-configuration-options ""))) 259 (not (equal system-configuration-options "")))
253 (insert "Configured using:\n `configure " 260 (insert "Configured using:\n `configure "
diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el
index 0b55fe42e42..c7943fe40c8 100644
--- a/lisp/mail/mailalias.el
+++ b/lisp/mail/mailalias.el
@@ -427,6 +427,7 @@ For use on `completion-at-point-functions'."
427 "Perform completion on header field or word preceding point. 427 "Perform completion on header field or word preceding point.
428Completable headers are according to `mail-complete-alist'. If none matches 428Completable headers are according to `mail-complete-alist'. If none matches
429current header, calls `mail-complete-function' and passes prefix ARG if any." 429current header, calls `mail-complete-function' and passes prefix ARG if any."
430 (declare (obsolete mail-completion-at-point-function "24.1"))
430 (interactive "P") 431 (interactive "P")
431 ;; Read the defaults first, if we have not done so. 432 ;; Read the defaults first, if we have not done so.
432 (sendmail-sync-aliases) 433 (sendmail-sync-aliases)
@@ -439,7 +440,6 @@ current header, calls `mail-complete-function' and passes prefix ARG if any."
439 (if data 440 (if data
440 (apply #'completion-in-region data) 441 (apply #'completion-in-region data)
441 (funcall mail-complete-function arg)))) 442 (funcall mail-complete-function arg))))
442(make-obsolete 'mail-complete 'mail-completion-at-point-function "24.1")
443 443
444(defun mail-completion-expand (table) 444(defun mail-completion-expand (table)
445 "Build new completion table that expands aliases. 445 "Build new completion table that expands aliases.
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index b75841489c9..331754fb1b5 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -1414,6 +1414,7 @@ just append to the file, in Babyl format if necessary."
1414 1414
1415(defun mail-sent-via () 1415(defun mail-sent-via ()
1416 "Make a Sent-via header line from each To or CC header line." 1416 "Make a Sent-via header line from each To or CC header line."
1417 (declare (obsolete "nobody can remember what it is for." "24.1"))
1417 (interactive) 1418 (interactive)
1418 (save-excursion 1419 (save-excursion
1419 ;; put a marker at the end of the header 1420 ;; put a marker at the end of the header
@@ -1433,9 +1434,6 @@ just append to the file, in Babyl format if necessary."
1433 (point))))) 1434 (point)))))
1434 ;; Insert a copy, with altered header field name. 1435 ;; Insert a copy, with altered header field name.
1435 (insert-before-markers "Sent-via:" to-line)))))) 1436 (insert-before-markers "Sent-via:" to-line))))))
1436
1437(make-obsolete 'mail-sent-via "nobody can remember what it is for." "24.1")
1438
1439 1437
1440(defun mail-to () 1438(defun mail-to ()
1441 "Move point to end of To field, creating it if necessary." 1439 "Move point to end of To field, creating it if necessary."
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el
index d10b073eb12..99e5df82bef 100644
--- a/lisp/mail/supercite.el
+++ b/lisp/mail/supercite.el
@@ -506,8 +506,6 @@ string."
506;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 506;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
507;; end user configuration variables 507;; end user configuration variables
508 508
509(define-obsolete-variable-alias 'sc-version 'emacs-version "23.1")
510
511(defvar sc-mail-info nil 509(defvar sc-mail-info nil
512 "Alist of mail header information gleaned from reply buffer.") 510 "Alist of mail header information gleaned from reply buffer.")
513(defvar sc-attributions nil 511(defvar sc-attributions nil
@@ -559,10 +557,8 @@ string."
559 (define-key map "r" 'sc-recite-region) 557 (define-key map "r" 'sc-recite-region)
560 (define-key map "\C-p" 'sc-raw-mode-toggle) 558 (define-key map "\C-p" 'sc-raw-mode-toggle)
561 (define-key map "u" 'sc-uncite-region) 559 (define-key map "u" 'sc-uncite-region)
562 (define-key map "v" 'sc-version)
563 (define-key map "w" 'sc-insert-reference) 560 (define-key map "w" 'sc-insert-reference)
564 (define-key map "\C-t" sc-T-keymap) 561 (define-key map "\C-t" sc-T-keymap)
565 (define-key map "\C-b" 'sc-submit-bug-report)
566 (define-key map "?" 'sc-describe) 562 (define-key map "?" 'sc-describe)
567 map) 563 map)
568 "Keymap for Supercite quasi-mode.") 564 "Keymap for Supercite quasi-mode.")
@@ -1969,29 +1965,11 @@ cited."
1969 (insert (sc-mail-field "sc-citation")) 1965 (insert (sc-mail-field "sc-citation"))
1970 (error "Line is already cited")))) 1966 (error "Line is already cited"))))
1971 1967
1972;; The argument logic here is crazy.
1973(defun sc-version (message)
1974 "Return the current Supercite version.
1975If MESSAGE is non-nil (interactively, with no prefix argument),
1976echoes the version in the minibuffer. Otherwise, inserts the
1977version at point."
1978 (interactive (list (not current-prefix-arg)))
1979 (let ((verstr (format "Using Supercite.el %s" emacs-version)))
1980 (if message
1981 (message verstr)
1982 (insert "`sc-version' says: " verstr))))
1983
1984(make-obsolete 'sc-version 'emacs-version "23.1")
1985
1986(defun sc-describe () 1968(defun sc-describe ()
1987 "Read the Supercite info node." 1969 "Read the Supercite info node."
1988 (interactive) 1970 (interactive)
1989 (info "(SC)top")) 1971 (info "(SC)top"))
1990 1972
1991(make-obsolete 'sc-describe "read the SC manual using `info'." "23.1")
1992
1993(define-obsolete-function-alias 'sc-submit-bug-report 'report-emacs-bug "23.1")
1994
1995 1973
1996;; useful stuff 1974;; useful stuff
1997(provide 'supercite) 1975(provide 'supercite)
diff --git a/lisp/mh-e/ChangeLog.1 b/lisp/mh-e/ChangeLog.1
index 15b7380b737..eb60392c32c 100644
--- a/lisp/mh-e/ChangeLog.1
+++ b/lisp/mh-e/ChangeLog.1
@@ -10930,7 +10930,7 @@
10930 10930
10931 * mh-utils.el (mh-prompt-for-folder): Exit with error if no folder 10931 * mh-utils.el (mh-prompt-for-folder): Exit with error if no folder
10932 specified, otherwise mh-refile-msg may try to create a folder with 10932 specified, otherwise mh-refile-msg may try to create a folder with
10933 empty name, and this creates problems; even mh-undo can't handle 10933 empty name, and this creates problems; even mh-undo can't handle
10934 it (Closes SF #476824). 10934 it (Closes SF #476824).
10935 10935
10936 * mh-comp.el (mh-letter-tool-bar-map): Info button needed to 10936 * mh-comp.el (mh-letter-tool-bar-map): Info button needed to
diff --git a/lisp/minibuf-eldef.el b/lisp/minibuf-eldef.el
index 4387fc625c6..92d5ec821b0 100644
--- a/lisp/minibuf-eldef.el
+++ b/lisp/minibuf-eldef.el
@@ -1,4 +1,4 @@
1;;; minibuf-eldef.el --- Only show defaults in prompts when applicable 1;;; minibuf-eldef.el --- Only show defaults in prompts when applicable -*- lexical-binding: t -*-
2;; 2;;
3;; Copyright (C) 2000-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
4;; 4;;
@@ -33,16 +33,22 @@
33 33
34;;; Code: 34;;; Code:
35 35
36(defvar minibuffer-eldef-shorten-default nil
37 "If non-nil, shorten \"(default ...)\" to \"[...]\" in minibuffer prompts.")
38
36(defvar minibuffer-default-in-prompt-regexps 39(defvar minibuffer-default-in-prompt-regexps
37 '(("\\( (default\\>.*)\\):? \\'" . 1) ("\\( \\[.*\\]\\):? *\\'" . 1)) 40 `(("\\( (default\\(?: is\\)? \\(.*\\))\\):? \\'"
41 1 ,(if minibuffer-eldef-shorten-default " [\\2]"))
42 ("\\( \\[.*\\]\\):? *\\'" 1))
38 "A list of regexps matching the parts of minibuffer prompts showing defaults. 43 "A list of regexps matching the parts of minibuffer prompts showing defaults.
39When `minibuffer-electric-default-mode' is active, these regexps are 44When `minibuffer-electric-default-mode' is active, these regexps are
40used to identify the portions of prompts to elide. 45used to identify the portions of prompts to elide.
41 46
42Each entry is either a string, which should be a regexp matching the 47Each entry is of the form (REGEXP MATCH-NUM &optional REWRITE),
43default portion of the prompt, or a cons cell, who's car is a regexp 48where REGEXP should match the default part of the prompt,
44matching the default part of the prompt, and who's cdr indicates the 49MATCH-NUM is the subgroup that matched the actual default indicator,
45regexp subexpression that matched.") 50and REWRITE, if present, is a string to pass to `replace-match' that
51should be displayed in its place.")
46 52
47 53
48;;; Internal variables 54;;; Internal variables
@@ -79,21 +85,42 @@ The prompt and initial input should already have been inserted."
79 (inhibit-point-motion-hooks t)) 85 (inhibit-point-motion-hooks t))
80 (save-excursion 86 (save-excursion
81 (save-restriction 87 (save-restriction
82 ;; Narrow to only the prompt 88 ;; Narrow to only the prompt.
83 (goto-char (point-min)) 89 (goto-char (point-min))
84 (narrow-to-region (point) (minibuffer-prompt-end)) 90 (narrow-to-region (point) (minibuffer-prompt-end))
85 ;; See the prompt contains a default input indicator 91 ;; See if the prompt contains a default input indicator.
86 (while regexps 92 (while regexps
87 (setq match (pop regexps)) 93 (setq match (pop regexps))
88 (if (re-search-forward (if (stringp match) match (car match)) nil t) 94 (cond
89 (setq regexps nil) 95 ((not (re-search-forward (if (stringp match) match (car match))
90 (setq match nil))))) 96 nil t))
97 ;; No match yet, try the next rule.
98 (setq match nil))
99 ((and (consp (cdr-safe match)) (nth 2 match))
100 ;; Matched a replacement rule.
101 (let* ((inhibit-read-only t)
102 (buffer-undo-list t)
103 (submatch (nth 1 match))
104 (replacement (nth 2 match))
105 (props (text-properties-at (match-beginning submatch))))
106 (replace-match replacement nil nil nil submatch)
107 (set-text-properties (match-beginning submatch)
108 (match-end submatch)
109 props)
110 ;; Replacement done, now keep trying with subsequent rules.
111 (setq match nil)
112 (goto-char (point-min))))
113 ;; Matched a non-replacement (i.e. electric hide) rule, no need to
114 ;; keep trying.
115 (t (setq regexps nil))))))
91 (if (not match) 116 (if (not match)
92 ;; Nope, so just make sure our post-command-hook isn't left around. 117 ;; No match for electric hiding, so just make sure our
118 ;; post-command-hook isn't left around.
93 (remove-hook 'post-command-hook #'minibuf-eldef-update-minibuffer t) 119 (remove-hook 'post-command-hook #'minibuf-eldef-update-minibuffer t)
94 ;; Yup; set things up so we can frob the prompt as the state of 120 ;; Yup; set things up so we can frob the prompt as the state of
95 ;; the input string changes. 121 ;; the input string changes.
96 (setq match (if (consp match) (cdr match) 0)) 122 (setq match (if (consp match) (cdr match) 0))
123 (setq match (if (consp match) (car match) match))
97 (setq minibuf-eldef-overlay 124 (setq minibuf-eldef-overlay
98 (make-overlay (match-beginning match) (match-end match))) 125 (make-overlay (match-beginning match) (match-end match)))
99 (setq minibuf-eldef-showing-default-in-prompt t) 126 (setq minibuf-eldef-showing-default-in-prompt t)
@@ -124,10 +151,6 @@ been set up by `minibuf-eldef-setup-minibuffer'."
124 (overlay-put minibuf-eldef-overlay 'intangible t))))) 151 (overlay-put minibuf-eldef-overlay 'intangible t)))))
125 152
126 153
127;;; Note this definition must be at the end of the file, because
128;;; `define-minor-mode' actually calls the mode-function if the
129;;; associated variable is non-nil, which requires that all needed
130;;; functions be already defined. [This is arguably a bug in d-m-m]
131;;;###autoload 154;;;###autoload
132(define-minor-mode minibuffer-electric-default-mode 155(define-minor-mode minibuffer-electric-default-mode
133 "Toggle Minibuffer Electric Default mode. 156 "Toggle Minibuffer Electric Default mode.
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 27c53744d54..cf990019abc 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2332,7 +2332,7 @@ and `read-file-name-function'."
2332 (modify-syntax-entry c "." table)) 2332 (modify-syntax-entry c "." table))
2333 '(?/ ?: ?\\)) 2333 '(?/ ?: ?\\))
2334 table) 2334 table)
2335 "Syntax table to be used in minibuffer for reading file name.") 2335 "Syntax table used when reading a file name in the minibuffer.")
2336 2336
2337;; minibuffer-completing-file-name is a variable used internally in minibuf.c 2337;; minibuffer-completing-file-name is a variable used internally in minibuf.c
2338;; to determine whether to use minibuffer-local-filename-completion-map or 2338;; to determine whether to use minibuffer-local-filename-completion-map or
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 4ea84288f69..74bb97b3086 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -284,23 +284,24 @@ not it is actually displayed."
284(defun mouse-major-mode-menu (event &optional prefix) 284(defun mouse-major-mode-menu (event &optional prefix)
285 "Pop up a mode-specific menu of mouse commands. 285 "Pop up a mode-specific menu of mouse commands.
286Default to the Edit menu if the major mode doesn't define a menu." 286Default to the Edit menu if the major mode doesn't define a menu."
287 (declare (obsolete mouse-menu-major-mode-map "23.1"))
287 (interactive "@e\nP") 288 (interactive "@e\nP")
288 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) 289 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
289 (popup-menu (mouse-menu-major-mode-map) event prefix)) 290 (popup-menu (mouse-menu-major-mode-map) event prefix))
290(make-obsolete 'mouse-major-mode-menu 'mouse-menu-major-mode-map "23.1")
291 291
292(defun mouse-popup-menubar (event prefix) 292(defun mouse-popup-menubar (event prefix)
293 "Pop up a menu equivalent to the menu bar for keyboard EVENT with PREFIX. 293 "Pop up a menu equivalent to the menu bar for keyboard EVENT with PREFIX.
294The contents are the items that would be in the menu bar whether or 294The contents are the items that would be in the menu bar whether or
295not it is actually displayed." 295not it is actually displayed."
296 (declare (obsolete mouse-menu-bar-map "23.1"))
296 (interactive "@e \nP") 297 (interactive "@e \nP")
297 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) 298 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
298 (popup-menu (mouse-menu-bar-map) (unless (integerp event) event) prefix)) 299 (popup-menu (mouse-menu-bar-map) (unless (integerp event) event) prefix))
299(make-obsolete 'mouse-popup-menubar 'mouse-menu-bar-map "23.1")
300 300
301(defun mouse-popup-menubar-stuff (event prefix) 301(defun mouse-popup-menubar-stuff (event prefix)
302 "Popup a menu like either `mouse-major-mode-menu' or `mouse-popup-menubar'. 302 "Popup a menu like either `mouse-major-mode-menu' or `mouse-popup-menubar'.
303Use the former if the menu bar is showing, otherwise the latter." 303Use the former if the menu bar is showing, otherwise the latter."
304 (declare (obsolete nil "23.1"))
304 (interactive "@e\nP") 305 (interactive "@e\nP")
305 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook) 306 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
306 (popup-menu 307 (popup-menu
@@ -308,7 +309,6 @@ Use the former if the menu bar is showing, otherwise the latter."
308 (mouse-menu-bar-map) 309 (mouse-menu-bar-map)
309 (mouse-menu-major-mode-map)) 310 (mouse-menu-major-mode-map))
310 event prefix)) 311 event prefix))
311(make-obsolete 'mouse-popup-menubar-stuff nil "23.1")
312 312
313;; Commands that operate on windows. 313;; Commands that operate on windows.
314 314
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index c78249ced0f..bc6fd38f713 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -421,7 +421,7 @@ headline after it has been retrieved for the first time."
421 "Name of the newsticker cache file." 421 "Name of the newsticker cache file."
422 :type 'string 422 :type 'string
423 :group 'newsticker-miscellaneous) 423 :group 'newsticker-miscellaneous)
424(make-obsolete 'newsticker-cache-filename 'newsticker-dir "23.1") 424(make-obsolete-variable 'newsticker-cache-filename 'newsticker-dir "23.1")
425 425
426(defcustom newsticker-dir 426(defcustom newsticker-dir
427 (locate-user-emacs-file "newsticker/" ".newsticker/") 427 (locate-user-emacs-file "newsticker/" ".newsticker/")
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index b44f1f9c86d..fc356a303e2 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -128,7 +128,7 @@ Example: (\"Topmost group\" \"feed1\" (\"subgroup1\" \"feed 2\")
128 "Name of the newsticker groups settings file." 128 "Name of the newsticker groups settings file."
129 :type 'string 129 :type 'string
130 :group 'newsticker-treeview) 130 :group 'newsticker-treeview)
131(make-obsolete 'newsticker-groups-filename 'newsticker-dir "23.1") 131(make-obsolete-variable 'newsticker-groups-filename 'newsticker-dir "23.1")
132 132
133;; ====================================================================== 133;; ======================================================================
134;;; internal variables 134;;; internal variables
diff --git a/lisp/net/snmp-mode.el b/lisp/net/snmp-mode.el
index c155d53b6d0..217f9dc8b30 100644
--- a/lisp/net/snmp-mode.el
+++ b/lisp/net/snmp-mode.el
@@ -175,9 +175,9 @@ This is used during Tempo template completion."
175(defvar snmp-font-lock-keywords-3 175(defvar snmp-font-lock-keywords-3
176 (append 176 (append
177 '(("\\([^\n]+\\)[ \t]+::=[ \t]+\\(SEQUENCE\\)[ \t]+{" 177 '(("\\([^\n]+\\)[ \t]+::=[ \t]+\\(SEQUENCE\\)[ \t]+{"
178 (1 font-lock-reference-face) (2 font-lock-keyword-face)) 178 (1 font-lock-constant-face) (2 font-lock-keyword-face))
179 ("::=[ \t]*{[ \t]*\\([a-z0-9].*[ \t]+\\)?\\([0-9]+\\)[ \t]*}" 179 ("::=[ \t]*{[ \t]*\\([a-z0-9].*[ \t]+\\)?\\([0-9]+\\)[ \t]*}"
180 (1 font-lock-reference-face nil t) (2 font-lock-variable-name-face))) 180 (1 font-lock-constant-face nil t) (2 font-lock-variable-name-face)))
181 snmp-font-lock-keywords-2) 181 snmp-font-lock-keywords-2)
182 "Gaudy SNMP MIB mode expression highlighting.") 182 "Gaudy SNMP MIB mode expression highlighting.")
183 183
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el
index 491dde3e070..fe38edbce1e 100644
--- a/lisp/org/ob-fortran.el
+++ b/lisp/org/ob-fortran.el
@@ -7,20 +7,20 @@
7;; Keywords: literate programming, reproducible research, fortran 7;; Keywords: literate programming, reproducible research, fortran
8;; Homepage: http://orgmode.org 8;; Homepage: http://orgmode.org
9 9
10;; This program is free software; you can redistribute it and/or modify 10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software: you can redistribute it and/or modify
11;; it under the terms of the GNU General Public License as published by 13;; it under the terms of the GNU General Public License as published by
12;; the Free Software Foundation; either version 3, or (at your option) 14;; the Free Software Foundation, either version 3 of the License, or
13;; any later version. 15;; (at your option) any later version.
14;; 16
15;; This program is distributed in the hope that it will be useful, 17;; GNU Emacs is distributed in the hope that it will be useful,
16;; but WITHOUT ANY WARRANTY; without even the implied warranty of 18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;; GNU General Public License for more details. 20;; GNU General Public License for more details.
19;; 21
20;; You should have received a copy of the GNU General Public License 22;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs; see the file COPYING. If not, write to the 23;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23;; Boston, MA 02110-1301, USA.
24 24
25;;; Commentary: 25;;; Commentary:
26 26
diff --git a/lisp/password-cache.el b/lisp/password-cache.el
index 9f5c18f3415..83815a6a270 100644
--- a/lisp/password-cache.el
+++ b/lisp/password-cache.el
@@ -102,13 +102,12 @@ Warning: the password is cached without checking that it is
102correct. It is better to check the password before caching. If 102correct. It is better to check the password before caching. If
103you must use this function, take care to check passwords and 103you must use this function, take care to check passwords and
104remove incorrect ones from the cache." 104remove incorrect ones from the cache."
105 (declare (obsolete password-read "23.1"))
105 (let ((password (password-read prompt key))) 106 (let ((password (password-read prompt key)))
106 (when (and password key) 107 (when (and password key)
107 (password-cache-add key password)) 108 (password-cache-add key password))
108 password)) 109 password))
109 110
110(make-obsolete 'password-read-and-add 'password-read "23.1")
111
112(defun password-cache-remove (key) 111(defun password-cache-remove (key)
113 "Remove password indexed by KEY from password cache. 112 "Remove password indexed by KEY from password cache.
114This is typically run by a timer setup from `password-cache-add', 113This is typically run by a timer setup from `password-cache-add',
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 3f120961486..9e55976a8bd 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -724,6 +724,7 @@ this is `comint-dynamic-complete-functions'."
724 724
725(defun pcomplete-parse-comint-arguments () 725(defun pcomplete-parse-comint-arguments ()
726 "Parse whitespace separated arguments in the current region." 726 "Parse whitespace separated arguments in the current region."
727 (declare (obsolete comint-parse-pcomplete-arguments "24.1"))
727 (let ((begin (save-excursion (comint-bol nil) (point))) 728 (let ((begin (save-excursion (comint-bol nil) (point)))
728 (end (point)) 729 (end (point))
729 begins args) 730 begins args)
@@ -743,8 +744,6 @@ this is `comint-dynamic-complete-functions'."
743 (push (buffer-substring-no-properties (car begins) (point)) 744 (push (buffer-substring-no-properties (car begins) (point))
744 args)) 745 args))
745 (cons (nreverse args) (nreverse begins))))) 746 (cons (nreverse args) (nreverse begins)))))
746(make-obsolete 'pcomplete-parse-comint-arguments
747 'comint-parse-pcomplete-arguments "24.1")
748 747
749(defun pcomplete-parse-arguments (&optional expand-p) 748(defun pcomplete-parse-arguments (&optional expand-p)
750 "Parse the command line arguments. Most completions need this info." 749 "Parse the command line arguments. Most completions need this info."
@@ -1090,7 +1089,7 @@ Typing SPC flushes the help buffer."
1090 (setq pcomplete-last-window-config (current-window-configuration))) 1089 (setq pcomplete-last-window-config (current-window-configuration)))
1091 (with-output-to-temp-buffer "*Completions*" 1090 (with-output-to-temp-buffer "*Completions*"
1092 (display-completion-list completions)) 1091 (display-completion-list completions))
1093 (message "Hit space to flush") 1092 (minibuffer-message "Hit space to flush")
1094 (let (event) 1093 (let (event)
1095 (prog1 1094 (prog1
1096 (catch 'done 1095 (catch 'done
diff --git a/lisp/proced.el b/lisp/proced.el
index d98bf7d2c5b..be6cae2ef08 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -28,8 +28,11 @@
28;; listed. See `proced-mode' for getting started. 28;; listed. See `proced-mode' for getting started.
29;; 29;;
30;; To do: 30;; To do:
31;; - interactive temporary customizability of flags in `proced-grammar-alist' 31;; - Interactive temporary customizability of flags in `proced-grammar-alist'
32;; - allow "sudo kill PID", "renice PID" 32;; - Allow "sudo kill PID", "sudo renice PID"
33;; `proced-send-signal' operates on multiple processes one by one.
34;; With "sudo" we want to execute one "kill" or "renice" command
35;; for all marked processes. Is there a `sudo-call-process'?
33;; 36;;
34;; Thoughts and Ideas 37;; Thoughts and Ideas
35;; - Currently, `process-attributes' returns the list of 38;; - Currently, `process-attributes' returns the list of
@@ -62,6 +65,11 @@ the external command (usually \"kill\")."
62 :type '(choice (function :tag "function") 65 :type '(choice (function :tag "function")
63 (string :tag "command"))) 66 (string :tag "command")))
64 67
68(defcustom proced-renice-command "renice"
69 "Name of renice command."
70 :group 'proced
71 :type '(string :tag "command"))
72
65(defcustom proced-signal-list 73(defcustom proced-signal-list
66 '( ;; signals supported on all POSIX compliant systems 74 '( ;; signals supported on all POSIX compliant systems
67 ("HUP" . " (1. Hangup)") 75 ("HUP" . " (1. Hangup)")
@@ -491,6 +499,7 @@ Important: the match ends just after the marker.")
491 (define-key km "o" 'proced-omit-processes) 499 (define-key km "o" 'proced-omit-processes)
492 (define-key km "x" 'proced-send-signal) ; Dired compatibility 500 (define-key km "x" 'proced-send-signal) ; Dired compatibility
493 (define-key km "k" 'proced-send-signal) ; kill processes 501 (define-key km "k" 'proced-send-signal) ; kill processes
502 (define-key km "r" 'proced-renice) ; renice processes
494 ;; misc 503 ;; misc
495 (define-key km "h" 'describe-mode) 504 (define-key km "h" 'describe-mode)
496 (define-key km "?" 'proced-help) 505 (define-key km "?" 'proced-help)
@@ -561,8 +570,11 @@ Important: the match ends just after the marker.")
561 :style toggle 570 :style toggle
562 :selected (eval proced-auto-update-flag) 571 :selected (eval proced-auto-update-flag)
563 :help "Auto Update of Proced Buffer"] 572 :help "Auto Update of Proced Buffer"]
573 "--"
564 ["Send signal" proced-send-signal 574 ["Send signal" proced-send-signal
565 :help "Send Signal to Marked Processes"])) 575 :help "Send Signal to Marked Processes"]
576 ["Renice" proced-renice
577 :help "Renice Marked Processes"]))
566 578
567;; helper functions 579;; helper functions
568(defun proced-marker-regexp () 580(defun proced-marker-regexp ()
@@ -1686,14 +1698,11 @@ After updating a displayed Proced buffer run the normal hook
1686Preserves point and marks." 1698Preserves point and marks."
1687 (proced-update t)) 1699 (proced-update t))
1688 1700
1689(defun proced-send-signal (&optional signal) 1701(defun proced-marked-processes ()
1690 "Send a SIGNAL to the marked processes. 1702 "Return marked processes as alist of PIDs.
1691If no process is marked, operate on current process. 1703If no process is marked return alist with the PID of the process point is on.
1692SIGNAL may be a string (HUP, INT, TERM, etc.) or a number. 1704The cdrs of the alist are the text strings displayed by Proced for these
1693If SIGNAL is nil display marked processes and query interactively for SIGNAL. 1705processes. They are used for error messages."
1694After sending the signal, this command runs the normal hook
1695`proced-after-send-signal-hook'."
1696 (interactive)
1697 (let ((regexp (proced-marker-regexp)) 1706 (let ((regexp (proced-marker-regexp))
1698 process-alist) 1707 process-alist)
1699 ;; collect marked processes 1708 ;; collect marked processes
@@ -1706,102 +1715,183 @@ After sending the signal, this command runs the normal hook
1706 (+ 2 (line-beginning-position)) 1715 (+ 2 (line-beginning-position))
1707 (line-end-position))) 1716 (line-end-position)))
1708 process-alist))) 1717 process-alist)))
1709 (setq process-alist 1718 (if process-alist
1710 (if process-alist 1719 (nreverse process-alist)
1711 (nreverse process-alist) 1720 ;; take current process
1712 ;; take current process 1721 (let ((pid (proced-pid-at-point)))
1713 (list (cons (proced-pid-at-point) 1722 (if pid
1723 (list (cons pid
1714 (buffer-substring-no-properties 1724 (buffer-substring-no-properties
1715 (+ 2 (line-beginning-position)) 1725 (+ 2 (line-beginning-position))
1716 (line-end-position)))))) 1726 (line-end-position)))))))))
1727
1728(defmacro proced-with-processes-buffer (process-alist &rest body)
1729 "Execute the forms in BODY in a temporary buffer displaying PROCESS-ALIST.
1730PROCESS-ALIST is an alist of process PIDs as in `proced-process-alist'.
1731The value returned is the value of the last form in BODY."
1732 (declare (indent 1) (debug t))
1733 ;; Use leading space in buffer name to make this buffer ephemeral
1734 `(let ((bufname " *Marked Processes*")
1735 (header-line (substring-no-properties proced-header-line)))
1736 (with-current-buffer (get-buffer-create bufname)
1737 (setq truncate-lines t
1738 proced-header-line header-line ; inherit header line
1739 header-line-format '(:eval (proced-header-line)))
1740 (add-hook 'post-command-hook 'force-mode-line-update nil t)
1741 (let ((inhibit-read-only t))
1742 (erase-buffer)
1743 (buffer-disable-undo)
1744 (setq buffer-read-only t)
1745 (dolist (process ,process-alist)
1746 (insert " " (cdr process) "\n"))
1747 (delete-char -1)
1748 (goto-char (point-min)))
1749 (save-window-excursion
1750 ;; Analogous to `dired-pop-to-buffer'
1751 ;; Don't split window horizontally. (Bug#1806)
1752 (let (split-width-threshold)
1753 (pop-to-buffer (current-buffer)))
1754 (fit-window-to-buffer (get-buffer-window) nil 1)
1755 ,@body))))
1756
1757(defun proced-send-signal (&optional signal process-alist)
1758 "Send a SIGNAL to processes in PROCESS-ALIST.
1759PROCESS-ALIST is an alist as returned by `proced-marked-processes'.
1760Interactively, PROCESS-ALIST contains the marked processes.
1761If no process is marked, it contains the process point is on,
1762SIGNAL may be a string (HUP, INT, TERM, etc.) or a number.
1763After sending SIGNAL to all processes in PROCESS-ALIST, this command
1764runs the normal hook `proced-after-send-signal-hook'.
1765
1766For backward compatibility SIGNAL and PROCESS-ALIST may be nil.
1767Then PROCESS-ALIST contains the marked processes or the process point is on
1768and SIGNAL is queried interactively. This noninteractive usage is still
1769supported but discouraged. It will be removed in a future version of Emacs."
1770 (interactive
1771 (let* ((process-alist (proced-marked-processes))
1772 (pnum (if (= 1 (length process-alist))
1773 "1 process"
1774 (format "%d processes" (length process-alist))))
1775 (completion-ignore-case t)
1776 (completion-extra-properties
1777 '(:annotation-function
1778 (lambda (s) (cdr (assoc s proced-signal-list))))))
1779 (proced-with-processes-buffer process-alist
1780 (list (completing-read (concat "Send signal [" pnum
1781 "] (default TERM): ")
1782 proced-signal-list
1783 nil nil nil nil "TERM")
1784 process-alist))))
1785
1786 (unless (and signal process-alist)
1787 ;; Discouraged usge (supported for backward compatibility):
1788 ;; The new calling sequence separates more cleanly between the parts
1789 ;; of the code required for interactive and noninteractive calls so that
1790 ;; the command can be used more flexibly in noninteractive ways, too.
1791 (unless (get 'proced-send-signal 'proced-outdated)
1792 (put 'proced-send-signal 'proced-outdated t)
1793 (message "Outdated usage of `proced-send-signal'")
1794 (sit-for 2))
1795 (setq process-alist (proced-marked-processes))
1717 (unless signal 1796 (unless signal
1718 ;; Display marked processes (code taken from `dired-mark-pop-up'). 1797 (let ((pnum (if (= 1 (length process-alist))
1719 (let ((bufname " *Marked Processes*") ; use leading space in buffer name 1798 "1 process"
1720 ; to make this buffer ephemeral 1799 (format "%d processes" (length process-alist))))
1721 (header-line (substring-no-properties proced-header-line))) 1800 (completion-ignore-case t)
1722 (with-current-buffer (get-buffer-create bufname) 1801 (completion-extra-properties
1723 (setq truncate-lines t 1802 '(:annotation-function
1724 proced-header-line header-line ; inherit header line 1803 (lambda (s) (cdr (assoc s proced-signal-list))))))
1725 header-line-format '(:eval (proced-header-line))) 1804 (proced-with-processes-buffer process-alist
1726 (add-hook 'post-command-hook 'force-mode-line-update nil t) 1805 (setq signal (completing-read (concat "Send signal [" pnum
1727 (let ((inhibit-read-only t)) 1806 "] (default TERM): ")
1728 (erase-buffer) 1807 proced-signal-list
1729 (buffer-disable-undo) 1808 nil nil nil nil "TERM"))))))
1730 (setq buffer-read-only t) 1809
1731 (dolist (process process-alist) 1810 (let (failures)
1732 (insert " " (cdr process) "\n")) 1811 ;; Why not always use `signal-process'? See
1733 (delete-char -1) 1812 ;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html
1734 (goto-char (point-min))) 1813 (if (functionp proced-signal-function)
1735 (save-window-excursion 1814 ;; use built-in `signal-process'
1736 ;; Analogous to `dired-pop-to-buffer' 1815 (let ((signal (if (stringp signal)
1737 ;; Don't split window horizontally. (Bug#1806) 1816 (if (string-match "\\`[0-9]+\\'" signal)
1738 (let (split-width-threshold) 1817 (string-to-number signal)
1739 (pop-to-buffer (current-buffer))) 1818 (make-symbol signal))
1740 (fit-window-to-buffer (get-buffer-window) nil 1) 1819 signal))) ; number
1741 (let* ((completion-ignore-case t)
1742 (pnum (if (= 1 (length process-alist))
1743 "1 process"
1744 (format "%d processes" (length process-alist))))
1745 (completion-extra-properties
1746 '(:annotation-function
1747 (lambda (s) (cdr (assoc s proced-signal-list))))))
1748 (setq signal
1749 (completing-read (concat "Send signal [" pnum
1750 "] (default TERM): ")
1751 proced-signal-list
1752 nil nil nil nil "TERM")))))))
1753 ;; send signal
1754 (let ((count 0)
1755 failures)
1756 ;; Why not always use `signal-process'? See
1757 ;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html
1758 (if (functionp proced-signal-function)
1759 ;; use built-in `signal-process'
1760 (let ((signal (if (stringp signal)
1761 (if (string-match "\\`[0-9]+\\'" signal)
1762 (string-to-number signal)
1763 (make-symbol signal))
1764 signal))) ; number
1765 (dolist (process process-alist)
1766 (condition-case err
1767 (if (zerop (funcall
1768 proced-signal-function (car process) signal))
1769 (setq count (1+ count))
1770 (proced-log "%s\n" (cdr process))
1771 (push (cdr process) failures))
1772 (error ; catch errors from failed signals
1773 (proced-log "%s\n" err)
1774 (proced-log "%s\n" (cdr process))
1775 (push (cdr process) failures)))))
1776 ;; use external system call
1777 (let ((signal (concat "-" (if (numberp signal)
1778 (number-to-string signal) signal))))
1779 (dolist (process process-alist) 1820 (dolist (process process-alist)
1780 (with-temp-buffer 1821 (condition-case err
1781 (condition-case nil 1822 (unless (zerop (funcall
1782 (if (zerop (call-process 1823 proced-signal-function (car process) signal))
1783 proced-signal-function nil t nil 1824 (proced-log "%s\n" (cdr process))
1784 signal (number-to-string (car process)))) 1825 (push (cdr process) failures))
1785 (setq count (1+ count)) 1826 (error ; catch errors from failed signals
1786 (proced-log (current-buffer)) 1827 (proced-log "%s\n" err)
1787 (proced-log "%s\n" (cdr process)) 1828 (proced-log "%s\n" (cdr process))
1788 (push (cdr process) failures)) 1829 (push (cdr process) failures)))))
1789 (error ; catch errors from failed signals 1830 ;; use external system call
1790 (proced-log (current-buffer)) 1831 (let ((signal (format "-%s" signal)))
1791 (proced-log "%s\n" (cdr process)) 1832 (dolist (process process-alist)
1792 (push (cdr process) failures))))))) 1833 (with-temp-buffer
1793 (if failures 1834 (condition-case nil
1794 ;; Proced error message are not always very precise. 1835 (unless (zerop (call-process
1795 ;; Can we issue a useful one-line summary in the 1836 proced-signal-function nil t nil
1796 ;; message area (using FAILURES) if only one signal failed? 1837 signal (number-to-string (car process))))
1797 (proced-log-summary 1838 (proced-log (current-buffer))
1798 signal 1839 (proced-log "%s\n" (cdr process))
1799 (format "%d of %d signal%s failed" 1840 (push (cdr process) failures))
1800 (length failures) (length process-alist) 1841 (error ; catch errors from failed signals
1801 (if (= 1 (length process-alist)) "" "s"))) 1842 (proced-log (current-buffer))
1802 (proced-success-message "Sent signal to" count))) 1843 (proced-log "%s\n" (cdr process))
1803 ;; final clean-up 1844 (push (cdr process) failures)))))))
1804 (run-hooks 'proced-after-send-signal-hook))) 1845 (if failures
1846 ;; Proced error message are not always very precise.
1847 ;; Can we issue a useful one-line summary in the
1848 ;; message area (using FAILURES) if only one signal failed?
1849 (proced-log-summary
1850 (format "Signal %s" signal)
1851 (format "%d of %d signal%s failed"
1852 (length failures) (length process-alist)
1853 (if (= 1 (length process-alist)) "" "s")))
1854 (proced-success-message "Sent signal to" (length process-alist))))
1855 ;; final clean-up
1856 (run-hooks 'proced-after-send-signal-hook))
1857
1858(defun proced-renice (priority process-alist)
1859 "Renice the processes in PROCESS-ALIST to PRIORITY.
1860PROCESS-ALIST is an alist as returned by `proced-marked-processes'.
1861Interactively, PROCESS-ALIST contains the marked processes.
1862If no process is marked, it contains the process point is on,
1863After renicing all processes in PROCESS-ALIST, this command runs
1864the normal hook `proced-after-send-signal-hook'."
1865 (interactive
1866 (let ((process-alist (proced-marked-processes)))
1867 (proced-with-processes-buffer process-alist
1868 (list (read-number "New priority: ")
1869 process-alist))))
1870 (if (numberp priority)
1871 (setq priority (number-to-string priority)))
1872 (let (failures)
1873 (dolist (process process-alist)
1874 (with-temp-buffer
1875 (condition-case nil
1876 (unless (zerop (call-process
1877 proced-renice-command nil t nil
1878 priority (number-to-string (car process))))
1879 (proced-log (current-buffer))
1880 (proced-log "%s\n" (cdr process))
1881 (push (cdr process) failures))
1882 (error ; catch errors from failed renice
1883 (proced-log (current-buffer))
1884 (proced-log "%s\n" (cdr process))
1885 (push (cdr process) failures)))))
1886 (if failures
1887 (proced-log-summary
1888 (format "Renice %s" priority)
1889 (format "%d of %d renice%s failed"
1890 (length failures) (length process-alist)
1891 (if (= 1 (length process-alist)) "" "s")))
1892 (proced-success-message "Reniced" (length process-alist))))
1893 ;; final clean-up
1894 (run-hooks 'proced-after-send-signal-hook))
1805 1895
1806;; similar to `dired-why' 1896;; similar to `dired-why'
1807(defun proced-why () 1897(defun proced-why ()
diff --git a/lisp/profiler.el b/lisp/profiler.el
new file mode 100644
index 00000000000..5fc74573262
--- /dev/null
+++ b/lisp/profiler.el
@@ -0,0 +1,665 @@
1;;; profiler.el --- UI and helper functions for Emacs's native profiler -*- lexical-binding: t -*-
2
3;; Copyright (C) 2012 Free Software Foundation, Inc.
4
5;; Author: Tomohiro Matsuyama <tomo@cx4a.org>
6;; Keywords: lisp
7
8;; This program is free software; you can redistribute it and/or modify
9;; it under the terms of the GNU General Public License as published by
10;; the Free Software Foundation, either version 3 of the License, or
11;; (at your option) any later version.
12
13;; This program is distributed in the hope that it will be useful,
14;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;; GNU General Public License for more details.
17
18;; You should have received a copy of the GNU General Public License
19;; along with this program. If not, see <http://www.gnu.org/licenses/>.
20
21;;; Commentary:
22
23;;
24
25;;; Code:
26
27(eval-when-compile
28 (require 'cl-lib))
29
30(defgroup profiler nil
31 "Emacs profiler."
32 :group 'lisp
33 :prefix "profiler-")
34
35(defcustom profiler-sample-interval 1
36 "Default sample interval in millisecond."
37 :type 'integer
38 :group 'profiler)
39
40;;; Utilities
41
42(defun profiler-ensure-string (object)
43 (cond ((stringp object)
44 object)
45 ((symbolp object)
46 (symbol-name object))
47 ((numberp object)
48 (number-to-string object))
49 (t
50 (format "%s" object))))
51
52(defun profiler-format (fmt &rest args)
53 (cl-loop for (width align subfmt) in fmt
54 for arg in args
55 for str = (cond
56 ((consp subfmt)
57 (apply 'profiler-format subfmt arg))
58 ((stringp subfmt)
59 (format subfmt arg))
60 ((and (symbolp subfmt)
61 (fboundp subfmt))
62 (funcall subfmt arg))
63 (t
64 (profiler-ensure-string arg)))
65 for len = (length str)
66 if (< width len)
67 collect (substring str 0 width) into frags
68 else
69 collect
70 (let ((padding (make-string (- width len) ?\s)))
71 (cl-ecase align
72 (left (concat str padding))
73 (right (concat padding str))))
74 into frags
75 finally return (apply #'concat frags)))
76
77(defun profiler-format-percent (number divisor)
78 (concat (number-to-string (/ (* number 100) divisor)) "%"))
79
80(defun profiler-format-nbytes (nbytes)
81 "Format NBYTES in humarn readable string."
82 (if (and (integerp nbytes) (> nbytes 0))
83 (cl-loop with i = (% (1+ (floor (log10 nbytes))) 3)
84 for c in (append (number-to-string nbytes) nil)
85 if (= i 0)
86 collect ?, into s
87 and do (setq i 3)
88 collect c into s
89 do (cl-decf i)
90 finally return
91 (apply 'string (if (eq (car s) ?,) (cdr s) s)))
92 (profiler-ensure-string nbytes)))
93
94
95;;; Entries
96
97(defun profiler-entry-format (entry)
98 "Format ENTRY in human readable string. ENTRY would be a
99function name of a function itself."
100 (cond ((memq (car-safe entry) '(closure lambda))
101 (format "#<lambda 0x%x>" (sxhash entry)))
102 ((byte-code-function-p entry)
103 (format "#<compiled 0x%x>" (sxhash entry)))
104 ((or (subrp entry) (symbolp entry) (stringp entry))
105 (format "%s" entry))
106 (t
107 (format "#<unknown 0x%x>" (sxhash entry)))))
108
109;;; Log data structure
110
111;; The C code returns the log in the form of a hash-table where the keys are
112;; vectors (of size profiler-max-stack-depth, holding truncated
113;; backtraces, where the first element is the top of the stack) and
114;; the values are integers (which count how many times this backtrace
115;; has been seen, multiplied by a "weight factor" which is either the
116;; sample-interval or the memory being allocated).
117;; We extend it by adding a few other entries to the hash-table, most notably:
118;; - Key `type' has a value indicating the kind of log (`memory' or `cpu').
119;; - Key `timestamp' has a value giving the time when the log was obtained.
120;; - Key `diff-p' indicates if this log represents a diff between two logs.
121
122(defun profiler-log-timestamp (log) (gethash 'timestamp log))
123(defun profiler-log-type (log) (gethash 'type log))
124(defun profiler-log-diff-p (log) (gethash 'diff-p log))
125
126(defun profiler-log-diff (log1 log2)
127 "Compare LOG1 with LOG2 and return a diff log. Both logs must
128be same type."
129 (unless (eq (profiler-log-type log1)
130 (profiler-log-type log2))
131 (error "Can't compare different type of logs"))
132 (let ((newlog (make-hash-table :test 'equal)))
133 ;; Make a copy of `log1' into `newlog'.
134 (maphash (lambda (backtrace count) (puthash backtrace count newlog))
135 log1)
136 (puthash 'diff-p t newlog)
137 (maphash (lambda (backtrace count)
138 (when (vectorp backtrace)
139 (puthash backtrace (- (gethash backtrace log1 0) count)
140 newlog)))
141 log2)
142 newlog))
143
144(defun profiler-log-fixup-entry (entry)
145 (if (symbolp entry)
146 entry
147 (profiler-entry-format entry)))
148
149(defun profiler-log-fixup-backtrace (backtrace)
150 (mapcar 'profiler-log-fixup-entry backtrace))
151
152(defun profiler-log-fixup (log)
153 "Fixup LOG so that the log could be serialized into file."
154 (let ((newlog (make-hash-table :test 'equal)))
155 (maphash (lambda (backtrace count)
156 (puthash (if (not (vectorp backtrace))
157 backtrace
158 (profiler-log-fixup-backtrace backtrace))
159 count newlog))
160 log)
161 newlog))
162
163(defun profiler-log-write-file (log filename &optional confirm)
164 "Write LOG into FILENAME."
165 (with-temp-buffer
166 (let (print-level print-length)
167 (print (profiler-log-fixup log) (current-buffer)))
168 (write-file filename confirm)))
169
170(defun profiler-log-read-file (filename)
171 "Read log from FILENAME."
172 (with-temp-buffer
173 (insert-file-contents filename)
174 (goto-char (point-min))
175 (read (current-buffer))))
176
177
178;;; Calltree data structure
179
180(cl-defstruct (profiler-calltree (:constructor profiler-make-calltree))
181 entry
182 (count 0) (count-percent "")
183 parent children)
184
185(defun profiler-calltree-leaf-p (tree)
186 (null (profiler-calltree-children tree)))
187
188(defun profiler-calltree-count< (a b)
189 (cond ((eq (profiler-calltree-entry a) t) t)
190 ((eq (profiler-calltree-entry b) t) nil)
191 (t (< (profiler-calltree-count a)
192 (profiler-calltree-count b)))))
193
194(defun profiler-calltree-count> (a b)
195 (not (profiler-calltree-count< a b)))
196
197(defun profiler-calltree-depth (tree)
198 (let ((parent (profiler-calltree-parent tree)))
199 (if (null parent)
200 0
201 (1+ (profiler-calltree-depth parent)))))
202
203(defun profiler-calltree-find (tree entry)
204 "Return a child tree of ENTRY under TREE."
205 ;; OPTIMIZED
206 (let (result (children (profiler-calltree-children tree)))
207 ;; FIXME: Use `assoc'.
208 (while (and children (null result))
209 (let ((child (car children)))
210 (when (equal (profiler-calltree-entry child) entry)
211 (setq result child))
212 (setq children (cdr children))))
213 result))
214
215(defun profiler-calltree-walk (calltree function)
216 (funcall function calltree)
217 (dolist (child (profiler-calltree-children calltree))
218 (profiler-calltree-walk child function)))
219
220(defun profiler-calltree-build-1 (tree log &optional reverse)
221 ;; FIXME: Do a better job of reconstructing a complete call-tree
222 ;; when the backtraces have been truncated. Ideally, we should be
223 ;; able to reduce profiler-max-stack-depth to 3 or 4 and still
224 ;; get a meaningful call-tree.
225 (maphash
226 (lambda (backtrace count)
227 (when (vectorp backtrace)
228 (let ((node tree)
229 (max (length backtrace)))
230 (dotimes (i max)
231 (let ((entry (aref backtrace (if reverse i (- max i 1)))))
232 (when entry
233 (let ((child (profiler-calltree-find node entry)))
234 (unless child
235 (setq child (profiler-make-calltree
236 :entry entry :parent node))
237 (push child (profiler-calltree-children node)))
238 (cl-incf (profiler-calltree-count child) count)
239 (setq node child))))))))
240 log))
241
242(defun profiler-calltree-compute-percentages (tree)
243 (let ((total-count 0))
244 ;; FIXME: the memory profiler's total wraps around all too easily!
245 (dolist (child (profiler-calltree-children tree))
246 (cl-incf total-count (profiler-calltree-count child)))
247 (unless (zerop total-count)
248 (profiler-calltree-walk
249 tree (lambda (node)
250 (setf (profiler-calltree-count-percent node)
251 (profiler-format-percent (profiler-calltree-count node)
252 total-count)))))))
253
254(cl-defun profiler-calltree-build (log &key reverse)
255 (let ((tree (profiler-make-calltree)))
256 (profiler-calltree-build-1 tree log reverse)
257 (profiler-calltree-compute-percentages tree)
258 tree))
259
260(defun profiler-calltree-sort (tree predicate)
261 (let ((children (profiler-calltree-children tree)))
262 (setf (profiler-calltree-children tree) (sort children predicate))
263 (dolist (child (profiler-calltree-children tree))
264 (profiler-calltree-sort child predicate))))
265
266
267;;; Report rendering
268
269(defcustom profiler-report-closed-mark "+"
270 "An indicator of closed calltrees."
271 :type 'string
272 :group 'profiler)
273
274(defcustom profiler-report-open-mark "-"
275 "An indicator of open calltrees."
276 :type 'string
277 :group 'profiler)
278
279(defcustom profiler-report-leaf-mark " "
280 "An indicator of calltree leaves."
281 :type 'string
282 :group 'profiler)
283
284(defvar profiler-report-sample-line-format
285 '((60 left)
286 (14 right ((9 right)
287 (5 right)))))
288
289(defvar profiler-report-memory-line-format
290 '((55 left)
291 (19 right ((14 right profiler-format-nbytes)
292 (5 right)))))
293
294(defvar-local profiler-report-log nil
295 "The current profiler log.")
296
297(defvar-local profiler-report-reversed nil
298 "True if calltree is rendered in bottom-up. Do not touch this
299variable directly.")
300
301(defvar-local profiler-report-order nil
302 "The value can be `ascending' or `descending'. Do not touch
303this variable directly.")
304
305(defun profiler-report-make-entry-part (entry)
306 (let ((string (cond
307 ((eq entry t)
308 "Others")
309 ((and (symbolp entry)
310 (fboundp entry))
311 (propertize (symbol-name entry)
312 'face 'link
313 'mouse-face 'highlight
314 'help-echo "mouse-2 or RET jumps to definition"))
315 (t
316 (profiler-entry-format entry)))))
317 (propertize string 'profiler-entry entry)))
318
319(defun profiler-report-make-name-part (tree)
320 (let* ((entry (profiler-calltree-entry tree))
321 (depth (profiler-calltree-depth tree))
322 (indent (make-string (* (1- depth) 2) ?\s))
323 (mark (if (profiler-calltree-leaf-p tree)
324 profiler-report-leaf-mark
325 profiler-report-closed-mark))
326 (entry (profiler-report-make-entry-part entry)))
327 (format "%s%s %s" indent mark entry)))
328
329(defun profiler-report-header-line-format (fmt &rest args)
330 (let* ((header (apply 'profiler-format fmt args))
331 (escaped (replace-regexp-in-string "%" "%%" header)))
332 (concat " " escaped)))
333
334(defun profiler-report-line-format (tree)
335 (let ((diff-p (profiler-log-diff-p profiler-report-log))
336 (name-part (profiler-report-make-name-part tree))
337 (count (profiler-calltree-count tree))
338 (count-percent (profiler-calltree-count-percent tree)))
339 (profiler-format (cl-ecase (profiler-log-type profiler-report-log)
340 (cpu profiler-report-sample-line-format)
341 (memory profiler-report-memory-line-format))
342 name-part
343 (if diff-p
344 (list (if (> count 0)
345 (format "+%s" count)
346 count)
347 "")
348 (list count count-percent)))))
349
350(defun profiler-report-insert-calltree (tree)
351 (let ((line (profiler-report-line-format tree)))
352 (insert (propertize (concat line "\n") 'calltree tree))))
353
354(defun profiler-report-insert-calltree-children (tree)
355 (mapc 'profiler-report-insert-calltree
356 (profiler-calltree-children tree)))
357
358
359;;; Report mode
360
361(defvar profiler-report-mode-map
362 (let ((map (make-sparse-keymap)))
363 ;; FIXME: Add menu.
364 (define-key map "n" 'profiler-report-next-entry)
365 (define-key map "p" 'profiler-report-previous-entry)
366 ;; I find it annoying more than helpful to not be able to navigate
367 ;; normally with the cursor keys. --Stef
368 ;; (define-key map [down] 'profiler-report-next-entry)
369 ;; (define-key map [up] 'profiler-report-previous-entry)
370 (define-key map "\r" 'profiler-report-toggle-entry)
371 (define-key map "\t" 'profiler-report-toggle-entry)
372 (define-key map "i" 'profiler-report-toggle-entry)
373 (define-key map "f" 'profiler-report-find-entry)
374 (define-key map "j" 'profiler-report-find-entry)
375 (define-key map [mouse-2] 'profiler-report-find-entry)
376 (define-key map "d" 'profiler-report-describe-entry)
377 (define-key map "C" 'profiler-report-render-calltree)
378 (define-key map "B" 'profiler-report-render-reversed-calltree)
379 (define-key map "A" 'profiler-report-ascending-sort)
380 (define-key map "D" 'profiler-report-descending-sort)
381 (define-key map "=" 'profiler-report-compare-log)
382 (define-key map (kbd "C-x C-w") 'profiler-report-write-log)
383 (define-key map "q" 'quit-window)
384 map))
385
386(defun profiler-report-make-buffer-name (log)
387 (format "*%s-Profiler-Report %s*"
388 (cl-ecase (profiler-log-type log) (cpu 'CPU) (memory 'Memory))
389 (format-time-string "%Y-%m-%d %T" (profiler-log-timestamp log))))
390
391(defun profiler-report-setup-buffer (log)
392 "Make a buffer for LOG and return it."
393 (let* ((buf-name (profiler-report-make-buffer-name log))
394 (buffer (get-buffer-create buf-name)))
395 (with-current-buffer buffer
396 (profiler-report-mode)
397 (setq profiler-report-log log
398 profiler-report-reversed nil
399 profiler-report-order 'descending))
400 buffer))
401
402(define-derived-mode profiler-report-mode special-mode "Profiler-Report"
403 "Profiler Report Mode."
404 (setq buffer-read-only t
405 buffer-undo-list t
406 truncate-lines t))
407
408
409;;; Report commands
410
411(defun profiler-report-calltree-at-point ()
412 (get-text-property (point) 'calltree))
413
414(defun profiler-report-move-to-entry ()
415 (let ((point (next-single-property-change (line-beginning-position)
416 'profiler-entry)))
417 (if point
418 (goto-char point)
419 (back-to-indentation))))
420
421(defun profiler-report-next-entry ()
422 "Move cursor to next entry."
423 (interactive)
424 (forward-line)
425 (profiler-report-move-to-entry))
426
427(defun profiler-report-previous-entry ()
428 "Move cursor to previous entry."
429 (interactive)
430 (forward-line -1)
431 (profiler-report-move-to-entry))
432
433(defun profiler-report-expand-entry ()
434 "Expand entry at point."
435 (interactive)
436 (save-excursion
437 (beginning-of-line)
438 (when (search-forward (concat profiler-report-closed-mark " ")
439 (line-end-position) t)
440 (let ((tree (profiler-report-calltree-at-point)))
441 (when tree
442 (let ((inhibit-read-only t))
443 (replace-match (concat profiler-report-open-mark " "))
444 (forward-line)
445 (profiler-report-insert-calltree-children tree)
446 t))))))
447
448(defun profiler-report-collapse-entry ()
449 "Collpase entry at point."
450 (interactive)
451 (save-excursion
452 (beginning-of-line)
453 (when (search-forward (concat profiler-report-open-mark " ")
454 (line-end-position) t)
455 (let* ((tree (profiler-report-calltree-at-point))
456 (depth (profiler-calltree-depth tree))
457 (start (line-beginning-position 2))
458 d)
459 (when tree
460 (let ((inhibit-read-only t))
461 (replace-match (concat profiler-report-closed-mark " "))
462 (while (and (eq (forward-line) 0)
463 (let ((child (get-text-property (point) 'calltree)))
464 (and child
465 (numberp (setq d (profiler-calltree-depth child)))))
466 (> d depth)))
467 (delete-region start (line-beginning-position)))))
468 t)))
469
470(defun profiler-report-toggle-entry ()
471 "Expand entry at point if the tree is collapsed,
472otherwise collapse."
473 (interactive)
474 (or (profiler-report-expand-entry)
475 (profiler-report-collapse-entry)))
476
477(defun profiler-report-find-entry (&optional event)
478 "Find entry at point."
479 (interactive (list last-nonmenu-event))
480 (if event (posn-set-point (event-end event)))
481 (let ((tree (profiler-report-calltree-at-point)))
482 (when tree
483 (let ((entry (profiler-calltree-entry tree)))
484 (find-function entry)))))
485
486(defun profiler-report-describe-entry ()
487 "Describe entry at point."
488 (interactive)
489 (let ((tree (profiler-report-calltree-at-point)))
490 (when tree
491 (let ((entry (profiler-calltree-entry tree)))
492 (require 'help-fns)
493 (describe-function entry)))))
494
495(cl-defun profiler-report-render-calltree-1
496 (log &key reverse (order 'descending))
497 (let ((calltree (profiler-calltree-build profiler-report-log
498 :reverse reverse)))
499 (setq header-line-format
500 (cl-ecase (profiler-log-type log)
501 (cpu
502 (profiler-report-header-line-format
503 profiler-report-sample-line-format
504 "Function" (list "Time (ms)" "%")))
505 (memory
506 (profiler-report-header-line-format
507 profiler-report-memory-line-format
508 "Function" (list "Bytes" "%")))))
509 (let ((predicate (cl-ecase order
510 (ascending #'profiler-calltree-count<)
511 (descending #'profiler-calltree-count>))))
512 (profiler-calltree-sort calltree predicate))
513 (let ((inhibit-read-only t))
514 (erase-buffer)
515 (profiler-report-insert-calltree-children calltree)
516 (goto-char (point-min))
517 (profiler-report-move-to-entry))))
518
519(defun profiler-report-rerender-calltree ()
520 (profiler-report-render-calltree-1 profiler-report-log
521 :reverse profiler-report-reversed
522 :order profiler-report-order))
523
524(defun profiler-report-render-calltree ()
525 "Render calltree view."
526 (interactive)
527 (setq profiler-report-reversed nil)
528 (profiler-report-rerender-calltree))
529
530(defun profiler-report-render-reversed-calltree ()
531 "Render reversed calltree view."
532 (interactive)
533 (setq profiler-report-reversed t)
534 (profiler-report-rerender-calltree))
535
536(defun profiler-report-ascending-sort ()
537 "Sort calltree view in ascending order."
538 (interactive)
539 (setq profiler-report-order 'ascending)
540 (profiler-report-rerender-calltree))
541
542(defun profiler-report-descending-sort ()
543 "Sort calltree view in descending order."
544 (interactive)
545 (setq profiler-report-order 'descending)
546 (profiler-report-rerender-calltree))
547
548(defun profiler-report-log (log)
549 (let ((buffer (profiler-report-setup-buffer log)))
550 (with-current-buffer buffer
551 (profiler-report-render-calltree))
552 (pop-to-buffer buffer)))
553
554(defun profiler-report-compare-log (buffer)
555 "Compare the current profiler log with another."
556 (interactive (list (read-buffer "Compare to: ")))
557 (let* ((log1 (with-current-buffer buffer profiler-report-log))
558 (log2 profiler-report-log)
559 (diff-log (profiler-log-diff log1 log2)))
560 (profiler-report-log diff-log)))
561
562(defun profiler-report-write-log (filename &optional confirm)
563 "Write the current profiler log into FILENAME."
564 (interactive
565 (list (read-file-name "Write log: " default-directory)
566 (not current-prefix-arg)))
567 (profiler-log-write-file profiler-report-log
568 filename
569 confirm))
570
571
572;;; Profiler commands
573
574;;;###autoload
575(defun profiler-start (mode)
576 "Start/restart profilers.
577MODE can be one of `cpu', `mem', or `cpu+mem'.
578If MODE is `cpu' or `cpu+mem', time-based profiler will be started.
579Also, if MODE is `mem' or `cpu+mem', then memory profiler will be started."
580 (interactive
581 (list (if (not (fboundp 'profiler-cpu-start)) 'mem
582 (intern (completing-read "Mode (default cpu): "
583 '("cpu" "mem" "cpu+mem")
584 nil t nil nil "cpu")))))
585 (cl-ecase mode
586 (cpu
587 (profiler-cpu-start profiler-sample-interval)
588 (message "CPU profiler started"))
589 (mem
590 (profiler-memory-start)
591 (message "Memory profiler started"))
592 (cpu+mem
593 (profiler-cpu-start profiler-sample-interval)
594 (profiler-memory-start)
595 (message "CPU and memory profiler started"))))
596
597(defun profiler-stop ()
598 "Stop started profilers. Profiler logs will be kept."
599 (interactive)
600 (let ((cpu (if (fboundp 'profiler-cpu-stop) (profiler-cpu-stop)))
601 (mem (profiler-memory-stop)))
602 (message "%s profiler stopped"
603 (cond ((and mem cpu) "CPU and memory")
604 (mem "Memory")
605 (cpu "CPU")
606 (t "No")))))
607
608(defun profiler-reset ()
609 "Reset profiler log."
610 (interactive)
611 (when (fboundp 'profiler-cpu-log)
612 (ignore (profiler-cpu-log)))
613 (ignore (profiler-memory-log))
614 t)
615
616(defun profiler--report-cpu ()
617 (let ((log (if (fboundp 'profiler-cpu-log) (profiler-cpu-log))))
618 (when log
619 (puthash 'type 'cpu log)
620 (puthash 'timestamp (current-time) log)
621 (profiler-report-log log))))
622
623(defun profiler--report-memory ()
624 (let ((log (profiler-memory-log)))
625 (when log
626 (puthash 'type 'memory log)
627 (puthash 'timestamp (current-time) log)
628 (profiler-report-log log))))
629
630(defun profiler-report ()
631 "Report profiling results."
632 (interactive)
633 (profiler--report-cpu)
634 (profiler--report-memory))
635
636;;;###autoload
637(defun profiler-find-log (filename)
638 "Read a profiler log from FILENAME and report it."
639 (interactive
640 (list (read-file-name "Find log: " default-directory)))
641 (profiler-report-log (profiler-log-read-file filename)))
642
643
644;;; Profiling helpers
645
646;; (cl-defmacro with-sample-profiling ((&key interval) &rest body)
647;; `(unwind-protect
648;; (progn
649;; (ignore (profiler-cpu-log))
650;; (profiler-cpu-start ,interval)
651;; ,@body)
652;; (profiler-cpu-stop)
653;; (profiler--report-cpu)))
654
655;; (defmacro with-memory-profiling (&rest body)
656;; `(unwind-protect
657;; (progn
658;; (ignore (profiler-memory-log))
659;; (profiler-memory-start)
660;; ,@body)
661;; (profiler-memory-stop)
662;; (profiler--report-memory)))
663
664(provide 'profiler)
665;;; profiler.el ends here
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index 1825098a55e..745320b6eb2 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -5218,11 +5218,11 @@ Return nil if no body was found."
5218 ;; correctly highlight a with_clause that spans multiple lines. 5218 ;; correctly highlight a with_clause that spans multiple lines.
5219 (list (concat "\\<\\(goto\\|raise\\|use\\|with\\)" 5219 (list (concat "\\<\\(goto\\|raise\\|use\\|with\\)"
5220 "[ \t]+\\([a-zA-Z0-9_., \t]+\\)\\W") 5220 "[ \t]+\\([a-zA-Z0-9_., \t]+\\)\\W")
5221 '(1 font-lock-keyword-face) '(2 font-lock-reference-face nil t)) 5221 '(1 font-lock-keyword-face) '(2 font-lock-constant-face nil t))
5222 5222
5223 ;; 5223 ;;
5224 ;; Goto tags. 5224 ;; Goto tags.
5225 '("<<\\(\\sw+\\)>>" 1 font-lock-reference-face) 5225 '("<<\\(\\sw+\\)>>" 1 font-lock-constant-face)
5226 5226
5227 ;; Highlight based-numbers (R. Reagan <robin-reply@reagans.org>) 5227 ;; Highlight based-numbers (R. Reagan <robin-reply@reagans.org>)
5228 (list "\\([0-9]+#[0-9a-fA-F_]+#\\)" '(1 font-lock-constant-face t)) 5228 (list "\\([0-9]+#[0-9a-fA-F_]+#\\)" '(1 font-lock-constant-face t))
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 95b8758ba80..09fba380f15 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -748,12 +748,10 @@ Faces `compilation-error-face', `compilation-warning-face',
748(defvar compilation-leave-directory-face 'font-lock-builtin-face 748(defvar compilation-leave-directory-face 'font-lock-builtin-face
749 "Face name to use for leaving directory messages.") 749 "Face name to use for leaving directory messages.")
750 750
751
752
753;; Used for compatibility with the old compile.el. 751;; Used for compatibility with the old compile.el.
754(defvar compilation-parse-errors-function nil) 752(defvar compilation-parse-errors-function nil)
755(make-obsolete 'compilation-parse-errors-function 753(make-obsolete-variable 'compilation-parse-errors-function
756 'compilation-error-regexp-alist "24.1") 754 'compilation-error-regexp-alist "24.1")
757 755
758(defcustom compilation-auto-jump-to-first-error nil 756(defcustom compilation-auto-jump-to-first-error nil
759 "If non-nil, automatically jump to the first error during compilation." 757 "If non-nil, automatically jump to the first error during compilation."
@@ -1499,24 +1497,6 @@ Otherwise, construct a buffer name from NAME-OF-MODE."
1499 (t 1497 (t
1500 (concat "*" (downcase name-of-mode) "*")))) 1498 (concat "*" (downcase name-of-mode) "*"))))
1501 1499
1502;; This is a rough emulation of the old hack, until the transition to new
1503;; compile is complete.
1504(defun compile-internal (command error-message
1505 &optional _name-of-mode parser
1506 error-regexp-alist name-function
1507 _enter-regexp-alist _leave-regexp-alist
1508 file-regexp-alist _nomessage-regexp-alist
1509 _no-async highlight-regexp _local-map)
1510 (if parser
1511 (error "Compile now works very differently, see `compilation-error-regexp-alist'"))
1512 (let ((compilation-error-regexp-alist
1513 (append file-regexp-alist (or error-regexp-alist
1514 compilation-error-regexp-alist)))
1515 (compilation-error (replace-regexp-in-string "^No more \\(.+\\)s\\.?"
1516 "\\1" error-message)))
1517 (compilation-start command nil name-function highlight-regexp)))
1518(make-obsolete 'compile-internal 'compilation-start "22.1")
1519
1520(defcustom compilation-always-kill nil 1500(defcustom compilation-always-kill nil
1521 "If t, always kill a running compilation process before starting a new one. 1501 "If t, always kill a running compilation process before starting a new one.
1522If nil, ask to kill it." 1502If nil, ask to kill it."
diff --git a/lisp/progmodes/cwarn.el b/lisp/progmodes/cwarn.el
index 9ea71ad36f5..becbcb7a3de 100644
--- a/lisp/progmodes/cwarn.el
+++ b/lisp/progmodes/cwarn.el
@@ -191,13 +191,7 @@ if ARG is omitted or nil."
191 (if font-lock-mode (font-lock-fontify-buffer))) 191 (if font-lock-mode (font-lock-fontify-buffer)))
192 192
193;;;###autoload 193;;;###autoload
194(defun turn-on-cwarn-mode () 194(define-obsolete-function-alias 'turn-on-cwarn-mode 'cwarn-mode "24.1")
195 "Turn on CWarn mode.
196
197This function is designed to be added to hooks, for example:
198 (add-hook 'c-mode-hook 'turn-on-cwarn-mode)"
199 (cwarn-mode 1))
200(make-obsolete 'turn-on-cwarn-mode 'cwarn-mode "24.1")
201 195
202;;}}} 196;;}}}
203;;{{{ Help functions 197;;{{{ Help functions
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 9b634328fa7..e58fb2b3eab 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -1151,7 +1151,7 @@ As a user, you should not set this to t.")
1151 (common-blocks 1151 (common-blocks
1152 '("\\<\\(common\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*,?" 1152 '("\\<\\(common\\)\\>[ \t]*\\(\\sw+\\)?[ \t]*,?"
1153 (1 font-lock-keyword-face) ; "common" 1153 (1 font-lock-keyword-face) ; "common"
1154 (2 font-lock-reference-face nil t) ; block name 1154 (2 font-lock-constant-face nil t) ; block name
1155 ("[ \t]*\\(\\sw+\\)[ ,]*" 1155 ("[ \t]*\\(\\sw+\\)[ ,]*"
1156 ;; Start with point after block name and comma 1156 ;; Start with point after block name and comma
1157 (goto-char (match-end 0)) ; needed for XEmacs, could be nil 1157 (goto-char (match-end 0)) ; needed for XEmacs, could be nil
@@ -1169,20 +1169,20 @@ As a user, you should not set this to t.")
1169 1169
1170 ;; Labels 1170 ;; Labels
1171 (label 1171 (label
1172 '("^[ \t]*\\([a-zA-Z]\\sw*:\\)" (1 font-lock-reference-face))) 1172 '("^[ \t]*\\([a-zA-Z]\\sw*:\\)" (1 font-lock-constant-face)))
1173 1173
1174 ;; The goto statement and its label 1174 ;; The goto statement and its label
1175 (goto 1175 (goto
1176 '("\\(goto\\)[ \t]*,[ \t]*\\([a-zA-Z]\\sw*\\)" 1176 '("\\(goto\\)[ \t]*,[ \t]*\\([a-zA-Z]\\sw*\\)"
1177 (1 font-lock-keyword-face) 1177 (1 font-lock-keyword-face)
1178 (2 font-lock-reference-face))) 1178 (2 font-lock-constant-face)))
1179 1179
1180 ;; Tags in structure definitions. Note that this definition 1180 ;; Tags in structure definitions. Note that this definition
1181 ;; actually collides with labels, so we have to use the same 1181 ;; actually collides with labels, so we have to use the same
1182 ;; face. It also matches named subscript ranges, 1182 ;; face. It also matches named subscript ranges,
1183 ;; e.g. vec{bottom:top]. No good way around this. 1183 ;; e.g. vec{bottom:top]. No good way around this.
1184 (structtag 1184 (structtag
1185 '("\\<\\([a-zA-Z][a-zA-Z0-9_]*:\\)[^:]" (1 font-lock-reference-face))) 1185 '("\\<\\([a-zA-Z][a-zA-Z0-9_]*:\\)[^:]" (1 font-lock-constant-face)))
1186 1186
1187 ;; Structure names 1187 ;; Structure names
1188 (structname 1188 (structname
@@ -1195,7 +1195,7 @@ As a user, you should not set this to t.")
1195 ;; fontification. Slow, use it only in fancy fontification. 1195 ;; fontification. Slow, use it only in fancy fontification.
1196 (keyword-parameters 1196 (keyword-parameters
1197 '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\n\\([ \t]*\\(;.*\\)?\n\\)*[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)" 1197 '("\\(,\\|[a-zA-Z0-9_](\\)[ \t]*\\(\\$[ \t]*\\(;.*\\)?\n\\([ \t]*\\(;.*\\)?\n\\)*[ \t]*\\)?\\(/[a-zA-Z_]\\sw*\\|[a-zA-Z_]\\sw*[ \t]*=\\)"
1198 (6 font-lock-reference-face))) 1198 (6 font-lock-constant-face)))
1199 1199
1200 ;; System variables start with a bang. 1200 ;; System variables start with a bang.
1201 (system-variables 1201 (system-variables
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 401970b2ce8..f2578c14066 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -69,9 +69,8 @@
69 :group 'lisp 69 :group 'lisp
70 :version "22.1") 70 :version "22.1")
71 71
72;;;###autoload
73(defcustom inferior-lisp-filter-regexp 72(defcustom inferior-lisp-filter-regexp
74 (purecopy "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'") 73 "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'"
75 "What not to save on inferior Lisp's input history. 74 "What not to save on inferior Lisp's input history.
76Input matching this regexp is not saved on the input history in Inferior Lisp 75Input matching this regexp is not saved on the input history in Inferior Lisp
77mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword 76mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
@@ -137,14 +136,12 @@ mode. Default is whitespace followed by 0 or 1 single-letter colon-keyword
137 (define-key inferior-lisp-mode-map "\C-cv" 136 (define-key inferior-lisp-mode-map "\C-cv"
138 'lisp-show-variable-documentation)) 137 'lisp-show-variable-documentation))
139 138
140;;;###autoload 139(defcustom inferior-lisp-program "lisp"
141(defcustom inferior-lisp-program (purecopy "lisp")
142 "Program name for invoking an inferior Lisp in Inferior Lisp mode." 140 "Program name for invoking an inferior Lisp in Inferior Lisp mode."
143 :type 'string 141 :type 'string
144 :group 'inferior-lisp) 142 :group 'inferior-lisp)
145 143
146;;;###autoload 144(defcustom inferior-lisp-load-command "(load \"%s\")\n"
147(defcustom inferior-lisp-load-command (purecopy "(load \"%s\")\n")
148 "Format-string for building a Lisp expression to load a file. 145 "Format-string for building a Lisp expression to load a file.
149This format string should use `%s' to substitute a file name 146This format string should use `%s' to substitute a file name
150and should result in a Lisp expression that will command the inferior Lisp 147and should result in a Lisp expression that will command the inferior Lisp
@@ -155,8 +152,7 @@ but it works only in Common Lisp."
155 :type 'string 152 :type 'string
156 :group 'inferior-lisp) 153 :group 'inferior-lisp)
157 154
158;;;###autoload 155(defcustom inferior-lisp-prompt "^[^> \n]*>+:? *"
159(defcustom inferior-lisp-prompt (purecopy "^[^> \n]*>+:? *")
160 "Regexp to recognize prompts in the Inferior Lisp mode. 156 "Regexp to recognize prompts in the Inferior Lisp mode.
161Defaults to \"^[^> \\n]*>+:? *\", which works pretty good for Lucid, kcl, 157Defaults to \"^[^> \\n]*>+:? *\", which works pretty good for Lucid, kcl,
162and franz. This variable is used to initialize `comint-prompt-regexp' in the 158and franz. This variable is used to initialize `comint-prompt-regexp' in the
@@ -207,7 +203,6 @@ one process, this does the right thing. If you run multiple
207processes, you can change `inferior-lisp-buffer' to another process 203processes, you can change `inferior-lisp-buffer' to another process
208buffer with \\[set-variable].") 204buffer with \\[set-variable].")
209 205
210;;;###autoload
211(defvar inferior-lisp-mode-hook '() 206(defvar inferior-lisp-mode-hook '()
212 "Hook for customizing Inferior Lisp mode.") 207 "Hook for customizing Inferior Lisp mode.")
213 208
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 33d43cb3d5a..99df94d3805 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -2110,7 +2110,7 @@ Argument BOUND is a buffer position limiting searching."
2110 (if (eq prolog-system 'mercury) 2110 (if (eq prolog-system 'mercury)
2111 (list 2111 (list
2112 (prolog-make-keywords-regexp prolog-mode-specificators-i t) 2112 (prolog-make-keywords-regexp prolog-mode-specificators-i t)
2113 0 'font-lock-reference-face))) 2113 0 'font-lock-constant-face)))
2114 (directives 2114 (directives
2115 (if (eq prolog-system 'mercury) 2115 (if (eq prolog-system 'mercury)
2116 (list 2116 (list
diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el
index bf52eff8f9a..a8fc11f71c0 100644
--- a/lisp/progmodes/ps-mode.el
+++ b/lisp/progmodes/ps-mode.el
@@ -213,9 +213,9 @@ If nil, use `temporary-file-directory'."
213;; - 8bit characters (warning face) 213;; - 8bit characters (warning face)
214;; Multiline strings are not supported. Strings with nested brackets are. 214;; Multiline strings are not supported. Strings with nested brackets are.
215(defconst ps-mode-font-lock-keywords-1 215(defconst ps-mode-font-lock-keywords-1
216 '(("\\`%!PS.*" . font-lock-reference-face) 216 '(("\\`%!PS.*" . font-lock-constant-face)
217 ("^%%BoundingBox:[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]*$" 217 ("^%%BoundingBox:[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]+-?[0-9]+[ \t]*$"
218 . font-lock-reference-face) 218 . font-lock-constant-face)
219 (ps-mode-match-string-or-comment 219 (ps-mode-match-string-or-comment
220 (1 font-lock-comment-face nil t) 220 (1 font-lock-comment-face nil t)
221 (2 font-lock-string-face nil t)) 221 (2 font-lock-string-face nil t))
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index ffc6c1ac885..e99e6bda4b8 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -497,52 +497,68 @@ The type returned can be `comment', `string' or `paren'."
497 (1 font-lock-variable-name-face nil nil)))) 497 (1 font-lock-variable-name-face nil nil))))
498 498
499(defconst python-syntax-propertize-function 499(defconst python-syntax-propertize-function
500 ;; Make outer chars of matching triple-quote sequences into generic
501 ;; string delimiters. Fixme: Is there a better way?
502 ;; First avoid a sequence preceded by an odd number of backslashes.
503 (syntax-propertize-rules 500 (syntax-propertize-rules
504 (;; ¡Backrefs don't work in syntax-propertize-rules! 501 ((rx
505 (concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix. 502 ;; Match even number of backslashes.
506 "\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)") 503 (or (not (any ?\\ ?\' ?\")) point) (* ?\\ ?\\)
507 (3 (ignore (python-quote-syntax)))))) 504 ;; Match single or triple quotes of any kind.
508 505 (group (or "\"" "\"\"\"" "'" "'''")))
509(defun python-quote-syntax () 506 (1 (ignore (python-syntax-stringify))))
510 "Put `syntax-table' property correctly on triple quote. 507 ((rx
511Used for syntactic keywords. N is the match number (1, 2 or 3)." 508 ;; Match odd number of backslashes.
512 ;; Given a triple quote, we have to check the context to know 509 (or (not (any ?\\)) point) ?\\ (* ?\\ ?\\)
513 ;; whether this is an opening or closing triple or whether it's 510 ;; Followed by even number of equal quotes.
514 ;; quoted anyhow, and should be ignored. (For that we need to do 511 (group (or "\"\"" "\"\"\"\"" "''" "''''")))
515 ;; the same job as `syntax-ppss' to be correct and it seems to be OK 512 (1 (ignore (python-syntax-stringify))))))
516 ;; to use it here despite initial worries.) We also have to sort 513
517 ;; out a possible prefix -- well, we don't _have_ to, but I think it 514(defsubst python-syntax-count-quotes (quote-char &optional point limit)
518 ;; should be treated as part of the string. 515 "Count number of quotes around point (max is 3).
519 516QUOTE-CHAR is the quote char to count. Optional argument POINT is
520 ;; Test cases: 517the point where scan starts (defaults to current point) and LIMIT
521 ;; ur"""ar""" x='"' # """ 518is used to limit the scan."
522 ;; x = ''' """ ' a 519 (let ((i 0))
523 ;; ''' 520 (while (and (< i 3)
524 ;; x '"""' x """ \"""" x 521 (or (not limit) (< (+ point i) limit))
525 (save-excursion 522 (eq (char-after (+ point i)) quote-char))
526 (goto-char (match-beginning 0)) 523 (incf i))
527 (let ((syntax (save-match-data (syntax-ppss)))) 524 i))
528 (cond 525
529 ((eq t (nth 3 syntax)) ; after unclosed fence 526(defun python-syntax-stringify ()
530 ;; Consider property for the last char if in a fenced string. 527 "Put `syntax-table' property correctly on single/triple quotes."
531 (goto-char (nth 8 syntax)) ; fence position 528 (let* ((num-quotes
532 (skip-chars-forward "uUrR") ; skip any prefix 529 (let ((n (length (match-string-no-properties 1))))
533 ;; Is it a matching sequence? 530 ;; This corrects the quote count when matching odd number
534 (if (eq (char-after) (char-after (match-beginning 2))) 531 ;; of backslashes followed by even number of quotes.
535 (put-text-property (match-beginning 3) (match-end 3) 532 (or (and (= 1 (logand n 1)) n) (1- n))))
536 'syntax-table (string-to-syntax "|")))) 533 (ppss (prog2
537 ((match-end 1) 534 (backward-char num-quotes)
538 ;; Consider property for initial char, accounting for prefixes. 535 (syntax-ppss)
539 (put-text-property (match-beginning 1) (match-end 1) 536 (forward-char num-quotes)))
540 'syntax-table (string-to-syntax "|"))) 537 (string-start (and (not (nth 4 ppss)) (nth 8 ppss)))
541 (t 538 (quote-starting-pos (- (point) num-quotes))
542 ;; Consider property for initial char, accounting for prefixes. 539 (quote-ending-pos (point))
543 (put-text-property (match-beginning 2) (match-end 2) 540 (num-closing-quotes
544 'syntax-table (string-to-syntax "|")))) 541 (and string-start
545 ))) 542 (python-syntax-count-quotes
543 (char-before) string-start quote-starting-pos))))
544 (cond ((and string-start (= num-closing-quotes 0))
545 ;; This set of quotes doesn't match the string starting
546 ;; kind. Do nothing.
547 nil)
548 ((not string-start)
549 ;; This set of quotes delimit the start of a string.
550 (put-text-property quote-starting-pos (1+ quote-starting-pos)
551 'syntax-table (string-to-syntax "|")))
552 ((= num-quotes num-closing-quotes)
553 ;; This set of quotes delimit the end of a string.
554 (put-text-property (1- quote-ending-pos) quote-ending-pos
555 'syntax-table (string-to-syntax "|")))
556 ((> num-quotes num-closing-quotes)
557 ;; This may only happen whenever a triple quote is closing
558 ;; a single quoted string. Add string delimiter syntax to
559 ;; all three quotes.
560 (put-text-property quote-starting-pos quote-ending-pos
561 'syntax-table (string-to-syntax "|"))))))
546 562
547(defvar python-mode-syntax-table 563(defvar python-mode-syntax-table
548 (let ((table (make-syntax-table))) 564 (let ((table (make-syntax-table)))
@@ -897,16 +913,27 @@ possible indentation levels and saves it in the variable
897`python-indent-levels'. Afterwards it sets the variable 913`python-indent-levels'. Afterwards it sets the variable
898`python-indent-current-level' correctly so offset is equal 914`python-indent-current-level' correctly so offset is equal
899to (`nth' `python-indent-current-level' `python-indent-levels')" 915to (`nth' `python-indent-current-level' `python-indent-levels')"
900 (if (or (and (eq this-command 'indent-for-tab-command) 916 (or
901 (eq last-command this-command)) 917 (and (or (and (eq this-command 'indent-for-tab-command)
902 force-toggle) 918 (eq last-command this-command))
903 (if (not (equal python-indent-levels '(0))) 919 force-toggle)
904 (python-indent-toggle-levels) 920 (not (equal python-indent-levels '(0)))
905 (python-indent-calculate-levels)) 921 (or (python-indent-toggle-levels) t))
906 (python-indent-calculate-levels)) 922 (python-indent-calculate-levels))
907 (beginning-of-line) 923 (let* ((starting-pos (point-marker))
908 (delete-horizontal-space) 924 (indent-ending-position
909 (indent-to (nth python-indent-current-level python-indent-levels)) 925 (+ (line-beginning-position) (current-indentation)))
926 (follow-indentation-p
927 (or (bolp)
928 (and (<= (line-beginning-position) starting-pos)
929 (>= indent-ending-position starting-pos))))
930 (next-indent (nth python-indent-current-level python-indent-levels)))
931 (unless (= next-indent (current-indentation))
932 (beginning-of-line)
933 (delete-horizontal-space)
934 (indent-to next-indent)
935 (goto-char starting-pos))
936 (and follow-indentation-p (back-to-indentation)))
910 (python-info-closing-block-message)) 937 (python-info-closing-block-message))
911 938
912(defun python-indent-line-function () 939(defun python-indent-line-function ()
@@ -1892,19 +1919,18 @@ Returns the output. See `python-shell-send-string-no-output'."
1892 1919
1893(defun python-shell-send-buffer (&optional arg) 1920(defun python-shell-send-buffer (&optional arg)
1894 "Send the entire buffer to inferior Python process. 1921 "Send the entire buffer to inferior Python process.
1895 1922With prefix ARG allow execution of code inside blocks delimited
1896With prefix ARG include lines surrounded by \"if __name__ == '__main__':\"" 1923by \"if __name__== '__main__':\""
1897 (interactive "P") 1924 (interactive "P")
1898 (save-restriction 1925 (save-restriction
1899 (widen) 1926 (widen)
1900 (python-shell-send-region 1927 (let ((str (buffer-substring (point-min) (point-max))))
1901 (point-min) 1928 (and
1902 (or (and 1929 (not arg)
1903 (not arg) 1930 (setq str (replace-regexp-in-string
1904 (save-excursion 1931 (python-rx if-name-main)
1905 (re-search-forward (python-rx if-name-main) nil t)) 1932 "if __name__ == '__main__ ':" str)))
1906 (match-beginning 0)) 1933 (python-shell-send-string str))))
1907 (point-max)))))
1908 1934
1909(defun python-shell-send-defun (arg) 1935(defun python-shell-send-defun (arg)
1910 "Send the current defun to inferior Python process. 1936 "Send the current defun to inferior Python process.
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 0f02e81cbad..84cf7308d75 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1567,7 +1567,7 @@ See `font-lock-syntax-table'.")
1567 2 font-lock-variable-name-face) 1567 2 font-lock-variable-name-face)
1568 ;; symbols 1568 ;; symbols
1569 '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)" 1569 '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
1570 2 font-lock-reference-face) 1570 2 font-lock-constant-face)
1571 ;; variables 1571 ;; variables
1572 '("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W" 1572 '("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W"
1573 1 font-lock-variable-name-face) 1573 1 font-lock-variable-name-face)
@@ -1576,7 +1576,7 @@ See `font-lock-syntax-table'.")
1576 ;; constants 1576 ;; constants
1577 '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)" 1577 '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
1578 2 font-lock-type-face) 1578 2 font-lock-type-face)
1579 '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-reference-face) 1579 '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-constant-face)
1580 ;; expression expansion 1580 ;; expression expansion
1581 '(ruby-match-expression-expansion 1581 '(ruby-match-expression-expansion
1582 0 font-lock-variable-name-face t) 1582 0 font-lock-variable-name-face t)
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index b4d550bcee0..e94919ee2a9 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -4079,11 +4079,10 @@ option followed by a colon `:' if the option accepts an argument."
4079(defun sh-maybe-here-document (arg) 4079(defun sh-maybe-here-document (arg)
4080 "Insert self. Without prefix, following unquoted `<' inserts here document. 4080 "Insert self. Without prefix, following unquoted `<' inserts here document.
4081The document is bounded by `sh-here-document-word'." 4081The document is bounded by `sh-here-document-word'."
4082 (declare (obsolete sh-electric-here-document-mode "24.3"))
4082 (interactive "*P") 4083 (interactive "*P")
4083 (self-insert-command (prefix-numeric-value arg)) 4084 (self-insert-command (prefix-numeric-value arg))
4084 (or arg (sh--maybe-here-document))) 4085 (or arg (sh--maybe-here-document)))
4085(make-obsolete 'sh--maybe-here-document
4086 'sh-electric-here-document-mode "24.3")
4087 4086
4088(defun sh--maybe-here-document () 4087(defun sh--maybe-here-document ()
4089 (or (not (looking-back "[^<]<<")) 4088 (or (not (looking-back "[^<]<<"))
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index f1ab01fd07f..c82566ca5b6 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -104,7 +104,6 @@
104 104
105(eval-when-compile 105(eval-when-compile
106 (require 'imenu) 106 (require 'imenu)
107 (require 'outline)
108 (require 'dabbrev) 107 (require 'dabbrev)
109 (require 'add-log)) 108 (require 'add-log))
110 109
@@ -544,6 +543,9 @@ Uses variables `tcl-proc-regexp' and `tcl-keyword-list'."
544;; The mode itself. 543;; The mode itself.
545;; 544;;
546 545
546(defvar outline-regexp)
547(defvar outline-level)
548
547;;;###autoload 549;;;###autoload
548(define-derived-mode tcl-mode prog-mode "Tcl" 550(define-derived-mode tcl-mode prog-mode "Tcl"
549 "Major mode for editing Tcl code. 551 "Major mode for editing Tcl code.
diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el
index 31f2fc1fe31..a2f71ff2ab8 100644
--- a/lisp/progmodes/vera-mode.el
+++ b/lisp/progmodes/vera-mode.el
@@ -587,12 +587,6 @@ Key bindings:
587;;; Font locking 587;;; Font locking
588;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 588;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
589 589
590;; XEmacs compatibility
591(when (featurep 'xemacs)
592 (require 'font-lock)
593 (copy-face 'font-lock-reference-face 'font-lock-constant-face)
594 (copy-face 'font-lock-preprocessor-face 'font-lock-builtin-face))
595
596(defun vera-font-lock-match-item (limit) 590(defun vera-font-lock-match-item (limit)
597 "Match, and move over, any declaration item after point. 591 "Match, and move over, any declaration item after point.
598Adapted from `font-lock-match-c-style-declaration-item-and-skip-to-next'." 592Adapted from `font-lock-match-c-style-declaration-item-and-skip-to-next'."
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 835d548c19f..86ffdf535a0 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -123,9 +123,9 @@
123;;; Code: 123;;; Code:
124 124
125;; This variable will always hold the version number of the mode 125;; This variable will always hold the version number of the mode
126(defconst verilog-mode-version "800" 126(defconst verilog-mode-version (substring "$$Revision: 820 $$" 12 -3)
127 "Version of this Verilog mode.") 127 "Version of this Verilog mode.")
128(defconst verilog-mode-release-date "2012-04-23-GNU" 128(defconst verilog-mode-release-date (substring "$$Date: 2012-09-17 20:43:10 -0400 (Mon, 17 Sep 2012) $$" 8 -3)
129 "Release date of this Verilog mode.") 129 "Release date of this Verilog mode.")
130(defconst verilog-mode-release-emacs t 130(defconst verilog-mode-release-emacs t
131 "If non-nil, this version of Verilog mode was released with Emacs itself.") 131 "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -1127,10 +1127,11 @@ won't merge conflict."
1127 :type 'integer) 1127 :type 'integer)
1128(put 'verilog-auto-inst-column 'safe-local-variable 'integerp) 1128(put 'verilog-auto-inst-column 'safe-local-variable 'integerp)
1129 1129
1130(defcustom verilog-auto-inst-interfaced-ports t 1130(defcustom verilog-auto-inst-interfaced-ports nil
1131 "Non-nil means include interfaced ports in AUTOINST expansions." 1131 "Non-nil means include interfaced ports in AUTOINST expansions."
1132 :group 'verilog-mode-auto 1132 :group 'verilog-mode-auto
1133 :type 'boolean) 1133 :type 'boolean
1134 :version "24.3")
1134(put 'verilog-auto-inst-interfaced-ports 'safe-local-variable 'verilog-booleanp) 1135(put 'verilog-auto-inst-interfaced-ports 'safe-local-variable 'verilog-booleanp)
1135 1136
1136(defcustom verilog-auto-input-ignore-regexp nil 1137(defcustom verilog-auto-input-ignore-regexp nil
@@ -1431,12 +1432,18 @@ If set will become buffer local.")
1431 :help "Help on AUTOARG - declaring module port list"] 1432 :help "Help on AUTOARG - declaring module port list"]
1432 ["AUTOASCIIENUM" (describe-function 'verilog-auto-ascii-enum) 1433 ["AUTOASCIIENUM" (describe-function 'verilog-auto-ascii-enum)
1433 :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"] 1434 :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"]
1435 ["AUTOASSIGNMODPORT" (describe-function 'verilog-auto-assign-modport)
1436 :help "Help on AUTOASSIGNMODPORT - creating assignments to/from modports"]
1434 ["AUTOINOUTCOMP" (describe-function 'verilog-auto-inout-comp) 1437 ["AUTOINOUTCOMP" (describe-function 'verilog-auto-inout-comp)
1435 :help "Help on AUTOINOUTCOMP - copying complemented i/o from another file"] 1438 :help "Help on AUTOINOUTCOMP - copying complemented i/o from another file"]
1436 ["AUTOINOUTIN" (describe-function 'verilog-auto-inout-in) 1439 ["AUTOINOUTIN" (describe-function 'verilog-auto-inout-in)
1437 :help "Help on AUTOINOUTCOMP - copying i/o from another file as all inputs"] 1440 :help "Help on AUTOINOUTIN - copying i/o from another file as all inputs"]
1441 ["AUTOINOUTMODPORT" (describe-function 'verilog-auto-inout-modport)
1442 :help "Help on AUTOINOUTMODPORT - copying i/o from an interface modport"]
1438 ["AUTOINOUTMODULE" (describe-function 'verilog-auto-inout-module) 1443 ["AUTOINOUTMODULE" (describe-function 'verilog-auto-inout-module)
1439 :help "Help on AUTOINOUTMODULE - copying i/o from another file"] 1444 :help "Help on AUTOINOUTMODULE - copying i/o from another file"]
1445 ["AUTOINOUTPARAM" (describe-function 'verilog-auto-inout-param)
1446 :help "Help on AUTOINOUTPARAM - copying parameters from another file"]
1440 ["AUTOINSERTLISP" (describe-function 'verilog-auto-insert-lisp) 1447 ["AUTOINSERTLISP" (describe-function 'verilog-auto-insert-lisp)
1441 :help "Help on AUTOINSERTLISP - insert text from a lisp function"] 1448 :help "Help on AUTOINSERTLISP - insert text from a lisp function"]
1442 ["AUTOINOUT" (describe-function 'verilog-auto-inout) 1449 ["AUTOINOUT" (describe-function 'verilog-auto-inout)
@@ -1706,12 +1713,19 @@ This speeds up complicated regexp matches."
1706;;(verilog-re-search-backward-substr "-end" "get-end-of" nil t) ;;-end (test bait) 1713;;(verilog-re-search-backward-substr "-end" "get-end-of" nil t) ;;-end (test bait)
1707 1714
1708(defun verilog-delete-trailing-whitespace () 1715(defun verilog-delete-trailing-whitespace ()
1709 "Delete trailing spaces or tabs, but not newlines nor linefeeds." 1716 "Delete trailing spaces or tabs, but not newlines nor linefeeds.
1717Also add missing final newline.
1718
1719To call this from the command line, see \\[verilog-batch-diff-auto].
1720
1721To call on \\[verilog-auto], set `verilog-auto-delete-trailing-whitespace'."
1710 ;; Similar to `delete-trailing-whitespace' but that's not present in XEmacs 1722 ;; Similar to `delete-trailing-whitespace' but that's not present in XEmacs
1711 (save-excursion 1723 (save-excursion
1712 (goto-char (point-min)) 1724 (goto-char (point-min))
1713 (while (re-search-forward "[ \t]+$" nil t) ;; Not syntactic WS as no formfeed 1725 (while (re-search-forward "[ \t]+$" nil t) ;; Not syntactic WS as no formfeed
1714 (replace-match "" nil nil)))) 1726 (replace-match "" nil nil))
1727 (goto-char (point-max))
1728 (unless (bolp) (insert "\n"))))
1715 1729
1716(defvar compile-command) 1730(defvar compile-command)
1717 1731
@@ -5128,6 +5142,15 @@ with \\[verilog-delete-auto] on all command-line files, and saves the buffers."
5128 (error "Use verilog-batch-delete-auto only with --batch")) ;; Otherwise we'd mess up buffer modes 5142 (error "Use verilog-batch-delete-auto only with --batch")) ;; Otherwise we'd mess up buffer modes
5129 (verilog-batch-execute-func `verilog-delete-auto)) 5143 (verilog-batch-execute-func `verilog-delete-auto))
5130 5144
5145(defun verilog-batch-delete-trailing-whitespace ()
5146 "For use with --batch, perform whitespace deletion as a stand-alone tool.
5147This sets up the appropriate Verilog mode environment, removes
5148whitespace with \\[verilog-delete-trailing-whitespace] on all
5149command-line files, and saves the buffers."
5150 (unless noninteractive
5151 (error "Use verilog-batch-delete-trailing-whitepace only with --batch")) ;; Otherwise we'd mess up buffer modes
5152 (verilog-batch-execute-func `verilog-delete-trailing-whitespace))
5153
5131(defun verilog-batch-diff-auto () 5154(defun verilog-batch-diff-auto ()
5132 "For use with --batch, perform automatic differences as a stand-alone tool. 5155 "For use with --batch, perform automatic differences as a stand-alone tool.
5133This sets up the appropriate Verilog mode environment, expand automatics 5156This sets up the appropriate Verilog mode environment, expand automatics
@@ -7479,6 +7502,19 @@ See also `verilog-sk-header' for an alternative format."
7479(defsubst verilog-alw-get-uses-delayed (sigs) 7502(defsubst verilog-alw-get-uses-delayed (sigs)
7480 (aref sigs 0)) 7503 (aref sigs 0))
7481 7504
7505(defsubst verilog-modport-new (name clockings decls)
7506 (list name clockings decls))
7507(defsubst verilog-modport-name (sig)
7508 (car sig))
7509(defsubst verilog-modport-clockings (sig)
7510 (nth 1 sig)) ;; Returns list of names
7511(defsubst verilog-modport-clockings-add (sig val)
7512 (setcar (nthcdr 1 sig) (cons val (nth 1 sig))))
7513(defsubst verilog-modport-decls (sig)
7514 (nth 2 sig)) ;; Returns verilog-decls-* structure
7515(defsubst verilog-modport-decls-set (sig val)
7516 (setcar (nthcdr 2 sig) val))
7517
7482(defsubst verilog-modi-new (name fob pt type) 7518(defsubst verilog-modi-new (name fob pt type)
7483 (vector name fob pt type)) 7519 (vector name fob pt type))
7484(defsubst verilog-modi-name (modi) 7520(defsubst verilog-modi-name (modi)
@@ -7496,8 +7532,15 @@ See also `verilog-sk-header' for an alternative format."
7496 7532
7497;; Signal reading for given module 7533;; Signal reading for given module
7498;; Note these all take modi's - as returned from verilog-modi-current 7534;; Note these all take modi's - as returned from verilog-modi-current
7499(defsubst verilog-decls-new (out inout in vars unuseds assigns consts gparams interfaces) 7535(defsubst verilog-decls-new (out inout in vars modports assigns consts gparams interfaces)
7500 (vector out inout in vars unuseds assigns consts gparams interfaces)) 7536 (vector out inout in vars modports assigns consts gparams interfaces))
7537(defsubst verilog-decls-append (a b)
7538 (cond ((not a) b) ((not b) a)
7539 (t (vector (append (aref a 0) (aref b 0)) (append (aref a 1) (aref b 1))
7540 (append (aref a 2) (aref b 2)) (append (aref a 3) (aref b 3))
7541 (append (aref a 4) (aref b 4)) (append (aref a 5) (aref b 5))
7542 (append (aref a 6) (aref b 6)) (append (aref a 7) (aref b 7))
7543 (append (aref a 8) (aref b 8))))))
7501(defsubst verilog-decls-get-outputs (decls) 7544(defsubst verilog-decls-get-outputs (decls)
7502 (aref decls 0)) 7545 (aref decls 0))
7503(defsubst verilog-decls-get-inouts (decls) 7546(defsubst verilog-decls-get-inouts (decls)
@@ -7506,8 +7549,8 @@ See also `verilog-sk-header' for an alternative format."
7506 (aref decls 2)) 7549 (aref decls 2))
7507(defsubst verilog-decls-get-vars (decls) 7550(defsubst verilog-decls-get-vars (decls)
7508 (aref decls 3)) 7551 (aref decls 3))
7509;;(defsubst verilog-decls-get-unused (decls) 7552(defsubst verilog-decls-get-modports (decls) ;; Also for clocking blocks; contains another verilog-decls struct
7510;; (aref decls 4)) 7553 (aref decls 4)) ;; Returns verilog-modport* structure
7511(defsubst verilog-decls-get-assigns (decls) 7554(defsubst verilog-decls-get-assigns (decls)
7512 (aref decls 5)) 7555 (aref decls 5))
7513(defsubst verilog-decls-get-consts (decls) 7556(defsubst verilog-decls-get-consts (decls)
@@ -7517,6 +7560,7 @@ See also `verilog-sk-header' for an alternative format."
7517(defsubst verilog-decls-get-interfaces (decls) 7560(defsubst verilog-decls-get-interfaces (decls)
7518 (aref decls 8)) 7561 (aref decls 8))
7519 7562
7563
7520(defsubst verilog-subdecls-new (out inout in intf intfd) 7564(defsubst verilog-subdecls-new (out inout in intf intfd)
7521 (vector out inout in intf intfd)) 7565 (vector out inout in intf intfd))
7522(defsubst verilog-subdecls-get-outputs (subdecls) 7566(defsubst verilog-subdecls-get-outputs (subdecls)
@@ -7535,6 +7579,36 @@ See also `verilog-sk-header' for an alternative format."
7535 (mapcar (lambda (name) (verilog-sig-new name nil nil nil nil nil nil nil nil)) 7579 (mapcar (lambda (name) (verilog-sig-new name nil nil nil nil nil nil nil nil))
7536 signame-list)) 7580 signame-list))
7537 7581
7582(defun verilog-signals-in (in-list not-list)
7583 "Return list of signals in IN-LIST that are also in NOT-LIST.
7584Also remove any duplicates in IN-LIST.
7585Signals must be in standard (base vector) form."
7586 ;; This function is hot, so implemented as O(1)
7587 (cond ((eval-when-compile (fboundp 'make-hash-table))
7588 (let ((ht (make-hash-table :test 'equal :rehash-size 4.0))
7589 (ht-not (make-hash-table :test 'equal :rehash-size 4.0))
7590 out-list)
7591 (while not-list
7592 (puthash (car (car not-list)) t ht-not)
7593 (setq not-list (cdr not-list)))
7594 (while in-list
7595 (when (and (gethash (verilog-sig-name (car in-list)) ht-not)
7596 (not (gethash (verilog-sig-name (car in-list)) ht)))
7597 (setq out-list (cons (car in-list) out-list))
7598 (puthash (verilog-sig-name (car in-list)) t ht))
7599 (setq in-list (cdr in-list)))
7600 (nreverse out-list)))
7601 ;; Slower Fallback if no hash tables (pre Emacs 21.1/XEmacs 21.4)
7602 (t
7603 (let (out-list)
7604 (while in-list
7605 (if (and (assoc (verilog-sig-name (car in-list)) not-list)
7606 (not (assoc (verilog-sig-name (car in-list)) out-list)))
7607 (setq out-list (cons (car in-list) out-list)))
7608 (setq in-list (cdr in-list)))
7609 (nreverse out-list)))))
7610;;(verilog-signals-in '(("A" "") ("B" "") ("DEL" "[2:3]")) '(("DEL" "") ("C" "")))
7611
7538(defun verilog-signals-not-in (in-list not-list) 7612(defun verilog-signals-not-in (in-list not-list)
7539 "Return list of signals in IN-LIST that aren't also in NOT-LIST. 7613 "Return list of signals in IN-LIST that aren't also in NOT-LIST.
7540Also remove any duplicates in IN-LIST. 7614Also remove any duplicates in IN-LIST.
@@ -7556,8 +7630,8 @@ Signals must be in standard (base vector) form."
7556 (t 7630 (t
7557 (let (out-list) 7631 (let (out-list)
7558 (while in-list 7632 (while in-list
7559 (if (not (or (assoc (verilog-sig-name (car in-list)) not-list) 7633 (if (and (not (assoc (verilog-sig-name (car in-list)) not-list))
7560 (assoc (verilog-sig-name (car in-list)) out-list))) 7634 (not (assoc (verilog-sig-name (car in-list)) out-list)))
7561 (setq out-list (cons (car in-list) out-list))) 7635 (setq out-list (cons (car in-list) out-list)))
7562 (setq in-list (cdr in-list))) 7636 (setq in-list (cdr in-list)))
7563 (nreverse out-list))))) 7637 (nreverse out-list)))))
@@ -7702,30 +7776,35 @@ Tieoff value uses `verilog-active-low-regexp' and
7702;; Dumping 7776;; Dumping
7703;; 7777;;
7704 7778
7705(defun verilog-decls-princ (decls) 7779(defun verilog-decls-princ (decls &optional header prefix)
7706 "For debug, dump the `verilog-read-decls' structure DECLS." 7780 "For debug, dump the `verilog-read-decls' structure DECLS."
7707 (verilog-signals-princ (verilog-decls-get-outputs decls) 7781 (when decls
7708 "Outputs:\n" " ") 7782 (if header (princ header))
7709 (verilog-signals-princ (verilog-decls-get-inouts decls) 7783 (setq prefix (or prefix ""))
7710 "Inout:\n" " ") 7784 (verilog-signals-princ (verilog-decls-get-outputs decls)
7711 (verilog-signals-princ (verilog-decls-get-inputs decls) 7785 (concat prefix "Outputs:\n") (concat prefix " "))
7712 "Inputs:\n" " ") 7786 (verilog-signals-princ (verilog-decls-get-inouts decls)
7713 (verilog-signals-princ (verilog-decls-get-vars decls) 7787 (concat prefix "Inout:\n") (concat prefix " "))
7714 "Vars:\n" " ") 7788 (verilog-signals-princ (verilog-decls-get-inputs decls)
7715 (verilog-signals-princ (verilog-decls-get-assigns decls) 7789 (concat prefix "Inputs:\n") (concat prefix " "))
7716 "Assigns:\n" " ") 7790 (verilog-signals-princ (verilog-decls-get-vars decls)
7717 (verilog-signals-princ (verilog-decls-get-consts decls) 7791 (concat prefix "Vars:\n") (concat prefix " "))
7718 "Consts:\n" " ") 7792 (verilog-signals-princ (verilog-decls-get-assigns decls)
7719 (verilog-signals-princ (verilog-decls-get-gparams decls) 7793 (concat prefix "Assigns:\n") (concat prefix " "))
7720 "Gparams:\n" " ") 7794 (verilog-signals-princ (verilog-decls-get-consts decls)
7721 (verilog-signals-princ (verilog-decls-get-interfaces decls) 7795 (concat prefix "Consts:\n") (concat prefix " "))
7722 "Interfaces:\n" " ") 7796 (verilog-signals-princ (verilog-decls-get-gparams decls)
7723 (princ "\n")) 7797 (concat prefix "Gparams:\n") (concat prefix " "))
7798 (verilog-signals-princ (verilog-decls-get-interfaces decls)
7799 (concat prefix "Interfaces:\n") (concat prefix " "))
7800 (verilog-modport-princ (verilog-decls-get-modports decls)
7801 (concat prefix "Modports:\n") (concat prefix " "))
7802 (princ "\n")))
7724 7803
7725(defun verilog-signals-princ (signals &optional header prefix) 7804(defun verilog-signals-princ (signals &optional header prefix)
7726 "For debug, dump internal SIGNALS structures, with HEADER and PREFIX." 7805 "For debug, dump internal SIGNALS structures, with HEADER and PREFIX."
7727 (when signals 7806 (when signals
7728 (princ header) 7807 (if header (princ header))
7729 (while signals 7808 (while signals
7730 (let ((sig (car signals))) 7809 (let ((sig (car signals)))
7731 (setq signals (cdr signals)) 7810 (setq signals (cdr signals))
@@ -7741,6 +7820,21 @@ Tieoff value uses `verilog-active-low-regexp' and
7741 (princ " modp=") (princ (verilog-sig-modport sig)) 7820 (princ " modp=") (princ (verilog-sig-modport sig))
7742 (princ "\n"))))) 7821 (princ "\n")))))
7743 7822
7823(defun verilog-modport-princ (modports &optional header prefix)
7824 "For debug, dump internal MODPORT structures, with HEADER and PREFIX."
7825 (when modports
7826 (if header (princ header))
7827 (while modports
7828 (let ((sig (car modports)))
7829 (setq modports (cdr modports))
7830 (princ prefix)
7831 (princ "\"") (princ (verilog-modport-name sig)) (princ "\"")
7832 (princ " clockings=") (princ (verilog-modport-clockings sig))
7833 (princ "\n")
7834 (verilog-decls-princ (verilog-modport-decls sig)
7835 (concat prefix " syms:\n")
7836 (concat prefix " "))))))
7837
7744;; 7838;;
7745;; Port/Wire/Etc Reading 7839;; Port/Wire/Etc Reading
7746;; 7840;;
@@ -7851,11 +7945,12 @@ Optional NUM-PARAM and MAX-PARAM check for a specific number of parameters."
7851Return an array of [outputs inouts inputs wire reg assign const]." 7945Return an array of [outputs inouts inputs wire reg assign const]."
7852 (let ((end-mod-point (or (verilog-get-end-of-defun t) (point-max))) 7946 (let ((end-mod-point (or (verilog-get-end-of-defun t) (point-max)))
7853 (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t) 7947 (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t)
7854 in-modport ptype ign-prop 7948 in-modport in-clocking ptype ign-prop
7855 sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const 7949 sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const
7856 sigs-gparam sigs-intf 7950 sigs-gparam sigs-intf sigs-modports
7857 vec expect-signal keywd newsig rvalue enum io signed typedefed multidim 7951 vec expect-signal keywd newsig rvalue enum io signed typedefed multidim
7858 modport) 7952 modport
7953 varstack tmp)
7859 (save-excursion 7954 (save-excursion
7860 (verilog-beg-of-defun-quick) 7955 (verilog-beg-of-defun-quick)
7861 (setq sigs-const (verilog-read-auto-constants (point) end-mod-point)) 7956 (setq sigs-const (verilog-read-auto-constants (point) end-mod-point))
@@ -7881,6 +7976,17 @@ Return an array of [outputs inouts inputs wire reg assign const]."
7881 (or (re-search-forward "[^\\]\"" nil t) ;; don't forward-char first, since we look for a non backslash first 7976 (or (re-search-forward "[^\\]\"" nil t) ;; don't forward-char first, since we look for a non backslash first
7882 (error "%s: Unmatched quotes, at char %d" (verilog-point-text) (point)))) 7977 (error "%s: Unmatched quotes, at char %d" (verilog-point-text) (point))))
7883 ((eq ?\; (following-char)) 7978 ((eq ?\; (following-char))
7979 (when (and in-modport (not (eq in-modport t))) ;; end of a modport declaration
7980 (verilog-modport-decls-set
7981 in-modport
7982 (verilog-decls-new sigs-out sigs-inout sigs-in
7983 nil nil nil nil nil nil))
7984 ;; Pop from varstack to restore state to pre-clocking
7985 (setq tmp (car varstack)
7986 varstack (cdr varstack)
7987 sigs-out (aref tmp 0)
7988 sigs-inout (aref tmp 1)
7989 sigs-in (aref tmp 2)))
7884 (setq vec nil io nil expect-signal nil newsig nil paren 0 rvalue nil 7990 (setq vec nil io nil expect-signal nil newsig nil paren 0 rvalue nil
7885 v2kargs-ok nil in-modport nil ign-prop nil) 7991 v2kargs-ok nil in-modport nil ign-prop nil)
7886 (forward-char 1)) 7992 (forward-char 1))
@@ -7974,15 +8080,17 @@ Return an array of [outputs inouts inputs wire reg assign const]."
7974 (setq signed keywd)) 8080 (setq signed keywd))
7975 ((member keywd '("assert" "assume" "cover" "expect" "restrict")) 8081 ((member keywd '("assert" "assume" "cover" "expect" "restrict"))
7976 (setq ign-prop t)) 8082 (setq ign-prop t))
7977 ((member keywd '("class" "clocking" "covergroup" "function" 8083 ((member keywd '("class" "covergroup" "function"
7978 "property" "randsequence" "sequence" "task")) 8084 "property" "randsequence" "sequence" "task"))
7979 (unless ign-prop 8085 (unless ign-prop
7980 (setq functask (1+ functask)))) 8086 (setq functask (1+ functask))))
7981 ((member keywd '("endclass" "endclocking" "endgroup" "endfunction" 8087 ((member keywd '("endclass" "endgroup" "endfunction"
7982 "endproperty" "endsequence" "endtask")) 8088 "endproperty" "endsequence" "endtask"))
7983 (setq functask (1- functask))) 8089 (setq functask (1- functask)))
7984 ((equal keywd "modport") 8090 ((equal keywd "modport")
7985 (setq in-modport t)) 8091 (setq in-modport t))
8092 ((equal keywd "clocking")
8093 (setq in-clocking t))
7986 ((equal keywd "type") 8094 ((equal keywd "type")
7987 (setq ptype t)) 8095 (setq ptype t))
7988 ;; Ifdef? Ignore name of define 8096 ;; Ifdef? Ignore name of define
@@ -8008,11 +8116,47 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8008 (goto-char (match-end 0)) 8116 (goto-char (match-end 0))
8009 (when (not rvalue) 8117 (when (not rvalue)
8010 (setq expect-signal nil))) 8118 (setq expect-signal nil)))
8119 ;; "modport <keywd>"
8120 ((and (eq in-modport t)
8121 (not (member keywd verilog-keywords)))
8122 (setq in-modport (verilog-modport-new keywd nil nil))
8123 (setq sigs-modports (cons in-modport sigs-modports))
8124 ;; Push old sig values to stack and point to new signal list
8125 (setq varstack (cons (vector sigs-out sigs-inout sigs-in)
8126 varstack))
8127 (setq sigs-in nil sigs-inout nil sigs-out nil))
8128 ;; "modport x (clocking <keywd>)"
8129 ((and in-modport in-clocking)
8130 (verilog-modport-clockings-add in-modport keywd)
8131 (setq in-clocking nil))
8132 ;; endclocking
8133 ((and in-clocking
8134 (equal keywd "endclocking"))
8135 (unless (eq in-clocking t)
8136 (verilog-modport-decls-set
8137 in-clocking
8138 (verilog-decls-new sigs-out sigs-inout sigs-in
8139 nil nil nil nil nil nil))
8140 ;; Pop from varstack to restore state to pre-clocking
8141 (setq tmp (car varstack)
8142 varstack (cdr varstack)
8143 sigs-out (aref tmp 0)
8144 sigs-inout (aref tmp 1)
8145 sigs-in (aref tmp 2)))
8146 (setq in-clocking nil))
8147 ;; "clocking <keywd>"
8148 ((and (eq in-clocking t)
8149 (not (member keywd verilog-keywords)))
8150 (setq in-clocking (verilog-modport-new keywd nil nil))
8151 (setq sigs-modports (cons in-clocking sigs-modports))
8152 ;; Push old sig values to stack and point to new signal list
8153 (setq varstack (cons (vector sigs-out sigs-inout sigs-in)
8154 varstack))
8155 (setq sigs-in nil sigs-inout nil sigs-out nil))
8011 ;; New signal, maybe? 8156 ;; New signal, maybe?
8012 ((and expect-signal 8157 ((and expect-signal
8013 (not rvalue) 8158 (not rvalue)
8014 (eq functask 0) 8159 (eq functask 0)
8015 (not in-modport)
8016 (not (member keywd verilog-keywords))) 8160 (not (member keywd verilog-keywords)))
8017 ;; Add new signal to expect-signal's variable 8161 ;; Add new signal to expect-signal's variable
8018 (setq newsig (verilog-sig-new keywd vec nil nil enum signed typedefed multidim modport)) 8162 (setq newsig (verilog-sig-new keywd vec nil nil enum signed typedefed multidim modport))
@@ -8022,15 +8166,17 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8022 (forward-char 1))) 8166 (forward-char 1)))
8023 (skip-syntax-forward " ")) 8167 (skip-syntax-forward " "))
8024 ;; Return arguments 8168 ;; Return arguments
8025 (verilog-decls-new (nreverse sigs-out) 8169 (setq tmp (verilog-decls-new (nreverse sigs-out)
8026 (nreverse sigs-inout) 8170 (nreverse sigs-inout)
8027 (nreverse sigs-in) 8171 (nreverse sigs-in)
8028 (nreverse sigs-var) 8172 (nreverse sigs-var)
8029 nil 8173 (nreverse sigs-modports)
8030 (nreverse sigs-assign) 8174 (nreverse sigs-assign)
8031 (nreverse sigs-const) 8175 (nreverse sigs-const)
8032 (nreverse sigs-gparam) 8176 (nreverse sigs-gparam)
8033 (nreverse sigs-intf))))) 8177 (nreverse sigs-intf)))
8178 ;;(if dbg (verilog-decls-princ tmp))
8179 tmp)))
8034 8180
8035(defvar verilog-read-sub-decls-in-interfaced nil 8181(defvar verilog-read-sub-decls-in-interfaced nil
8036 "For `verilog-read-sub-decls', process next signal as under interfaced block.") 8182 "For `verilog-read-sub-decls', process next signal as under interfaced block.")
@@ -9352,12 +9498,12 @@ Return modi if successful, else print message unless IGNORE-ERROR is true."
9352 ;;(message "verilog-modi-lookup: HIT %S" modi) 9498 ;;(message "verilog-modi-lookup: HIT %S" modi)
9353 modi) 9499 modi)
9354 ;; Miss 9500 ;; Miss
9355 (t (let* ((realmod (verilog-symbol-detick module t)) 9501 (t (let* ((realname (verilog-symbol-detick module t))
9356 (orig-filenames (verilog-module-filenames realmod current)) 9502 (orig-filenames (verilog-module-filenames realname current))
9357 (filenames orig-filenames) 9503 (filenames orig-filenames)
9358 mif) 9504 mif)
9359 (while (and filenames (not mif)) 9505 (while (and filenames (not mif))
9360 (if (not (setq mif (verilog-module-inside-filename-p realmod (car filenames)))) 9506 (if (not (setq mif (verilog-module-inside-filename-p realname (car filenames))))
9361 (setq filenames (cdr filenames)))) 9507 (setq filenames (cdr filenames))))
9362 ;; mif has correct form to become later elements of modi 9508 ;; mif has correct form to become later elements of modi
9363 (cond (mif (setq modi mif)) 9509 (cond (mif (setq modi mif))
@@ -9365,8 +9511,8 @@ Return modi if successful, else print message unless IGNORE-ERROR is true."
9365 (or ignore-error 9511 (or ignore-error
9366 (error (concat (verilog-point-text) 9512 (error (concat (verilog-point-text)
9367 ": Can't locate " module " module definition" 9513 ": Can't locate " module " module definition"
9368 (if (not (equal module realmod)) 9514 (if (not (equal module realname))
9369 (concat " (Expanded macro to " realmod ")") 9515 (concat " (Expanded macro to " realname ")")
9370 "") 9516 "")
9371 "\n Check the verilog-library-directories variable." 9517 "\n Check the verilog-library-directories variable."
9372 "\n I looked in (if not listed, doesn't exist):\n\t" 9518 "\n I looked in (if not listed, doesn't exist):\n\t"
@@ -9465,6 +9611,45 @@ and invalidating the cache."
9465 (progn ,@body))) 9611 (progn ,@body)))
9466 9612
9467 9613
9614(defun verilog-modi-modport-lookup-one (modi name &optional ignore-error)
9615 "Given a MODI, return the declarations related to the given modport NAME."
9616 ;; Recursive routine - see below
9617 (let* ((realname (verilog-symbol-detick name t))
9618 (modport (assoc name (verilog-decls-get-modports (verilog-modi-get-decls modi)))))
9619 (or modport ignore-error
9620 (error (concat (verilog-point-text)
9621 ": Can't locate " name " modport definition"
9622 (if (not (equal name realname))
9623 (concat " (Expanded macro to " realname ")")
9624 ""))))
9625 (let* ((decls (verilog-modport-decls modport))
9626 (clks (verilog-modport-clockings modport)))
9627 ;; Now expand any clocking's
9628 (while clks
9629 (setq decls (verilog-decls-append
9630 decls
9631 (verilog-modi-modport-lookup-one modi (car clks) ignore-error)))
9632 (setq clks (cdr clks)))
9633 decls)))
9634
9635(defun verilog-modi-modport-lookup (modi name-re &optional ignore-error)
9636 "Given a MODI, return the declarations related to the given modport NAME-RE.
9637If the modport points to any clocking blocks, expand the signals to include
9638those clocking block's signals."
9639 ;; Recursive routine - see below
9640 (let* ((mod-decls (verilog-modi-get-decls modi))
9641 (clks (verilog-decls-get-modports mod-decls))
9642 (name-re (concat "^" name-re "$"))
9643 (decls (verilog-decls-new nil nil nil nil nil nil nil nil nil)))
9644 ;; Pull in all modports
9645 (while clks
9646 (when (string-match name-re (verilog-modport-name (car clks)))
9647 (setq decls (verilog-decls-append
9648 decls
9649 (verilog-modi-modport-lookup-one modi (verilog-modport-name (car clks)) ignore-error))))
9650 (setq clks (cdr clks)))
9651 decls))
9652
9468(defun verilog-signals-matching-enum (in-list enum) 9653(defun verilog-signals-matching-enum (in-list enum)
9469 "Return all signals in IN-LIST matching the given ENUM." 9654 "Return all signals in IN-LIST matching the given ENUM."
9470 (let (out-list) 9655 (let (out-list)
@@ -9544,6 +9729,13 @@ if non-nil."
9544 (verilog-decls-get-inouts decls) 9729 (verilog-decls-get-inouts decls)
9545 (verilog-decls-get-inputs decls))) 9730 (verilog-decls-get-inputs decls)))
9546 9731
9732(defun verilog-decls-get-iovars (decls)
9733 (append
9734 (verilog-decls-get-vars decls)
9735 (verilog-decls-get-outputs decls)
9736 (verilog-decls-get-inouts decls)
9737 (verilog-decls-get-inputs decls)))
9738
9547(defsubst verilog-modi-cache-add-outputs (modi sig-list) 9739(defsubst verilog-modi-cache-add-outputs (modi sig-list)
9548 (verilog-modi-cache-add modi 'verilog-read-decls 0 sig-list)) 9740 (verilog-modi-cache-add modi 'verilog-read-decls 0 sig-list))
9549(defsubst verilog-modi-cache-add-inouts (modi sig-list) 9741(defsubst verilog-modi-cache-add-inouts (modi sig-list)
@@ -9552,6 +9744,8 @@ if non-nil."
9552 (verilog-modi-cache-add modi 'verilog-read-decls 2 sig-list)) 9744 (verilog-modi-cache-add modi 'verilog-read-decls 2 sig-list))
9553(defsubst verilog-modi-cache-add-vars (modi sig-list) 9745(defsubst verilog-modi-cache-add-vars (modi sig-list)
9554 (verilog-modi-cache-add modi 'verilog-read-decls 3 sig-list)) 9746 (verilog-modi-cache-add modi 'verilog-read-decls 3 sig-list))
9747(defsubst verilog-modi-cache-add-gparams (modi sig-list)
9748 (verilog-modi-cache-add modi 'verilog-read-decls 7 sig-list))
9555 9749
9556 9750
9557;; 9751;;
@@ -9608,6 +9802,8 @@ When MODI is non-null, also add to modi-cache, for tracking."
9608 (when verilog-auto-declare-nettype 9802 (when verilog-auto-declare-nettype
9609 (verilog-modi-cache-add-vars modi sigs))) 9803 (verilog-modi-cache-add-vars modi sigs)))
9610 ((equal direction "interface")) 9804 ((equal direction "interface"))
9805 ((equal direction "parameter")
9806 (verilog-modi-cache-add-gparams modi sigs))
9611 (t 9807 (t
9612 (error "Unsupported verilog-insert-definition direction: %s" direction)))) 9808 (error "Unsupported verilog-insert-definition direction: %s" direction))))
9613 (or dont-sort 9809 (or dont-sort
@@ -9654,6 +9850,11 @@ Presumes that any newlines end a list element."
9654 stuff (cdr stuff))))) 9850 stuff (cdr stuff)))))
9655;;(let ((indent-pt 10)) (verilog-insert-indent "hello\n" "addon" "there\n")) 9851;;(let ((indent-pt 10)) (verilog-insert-indent "hello\n" "addon" "there\n"))
9656 9852
9853(defun verilog-forward-or-insert-line ()
9854 "Move forward a line, unless at EOB, then insert a newline."
9855 (if (eobp) (insert "\n")
9856 (forward-line)))
9857
9657(defun verilog-repair-open-comma () 9858(defun verilog-repair-open-comma ()
9658 "Insert comma if previous argument is other than an open parenthesis or endif." 9859 "Insert comma if previous argument is other than an open parenthesis or endif."
9659 ;; We can't just search backward for ) as it might be inside another expression. 9860 ;; We can't just search backward for ) as it might be inside another expression.
@@ -9741,6 +9942,17 @@ This repairs those mis-inserted by an AUTOARG."
9741 "\\([])}:*+-]\\)") 9942 "\\([])}:*+-]\\)")
9742 out) 9943 out)
9743 (setq out (replace-match "\\1\\2\\3" nil nil out))) 9944 (setq out (replace-match "\\1\\2\\3" nil nil out)))
9945 (while (string-match
9946 (concat "\\([[({:*+-]\\)" ; - must be last
9947 "\\$clog2\\s *(\\<\\([0-9]+\\))"
9948 "\\([])}:*+-]\\)")
9949 out)
9950 (setq out (replace-match
9951 (concat
9952 (match-string 1 out)
9953 (int-to-string (verilog-clog2 (string-to-number (match-string 2 out))))
9954 (match-string 3 out))
9955 nil nil out)))
9744 ;; For precedence do * before +/- 9956 ;; For precedence do * before +/-
9745 (while (string-match 9957 (while (string-match
9746 (concat "\\([[({:*+-]\\)" 9958 (concat "\\([[({:*+-]\\)"
@@ -9777,6 +9989,7 @@ This repairs those mis-inserted by an AUTOARG."
9777 post) 9989 post)
9778 nil nil out)) ))) 9990 nil nil out)) )))
9779 out))) 9991 out)))
9992
9780;;(verilog-simplify-range-expression "[1:3]") ;; 1 9993;;(verilog-simplify-range-expression "[1:3]") ;; 1
9781;;(verilog-simplify-range-expression "[(1):3]") ;; 1 9994;;(verilog-simplify-range-expression "[(1):3]") ;; 1
9782;;(verilog-simplify-range-expression "[(((16)+1)+1+(1+1))]") ;;20 9995;;(verilog-simplify-range-expression "[(((16)+1)+1+(1+1))]") ;;20
@@ -9785,6 +9998,14 @@ This repairs those mis-inserted by an AUTOARG."
9785;;(verilog-simplify-range-expression "[(FOO*4+1-1)]") ;; FOO*4+0 9998;;(verilog-simplify-range-expression "[(FOO*4+1-1)]") ;; FOO*4+0
9786;;(verilog-simplify-range-expression "[(func(BAR))]") ;; func(BAR) 9999;;(verilog-simplify-range-expression "[(func(BAR))]") ;; func(BAR)
9787;;(verilog-simplify-range-expression "[FOO-1+1-1+1]") ;; FOO-0 10000;;(verilog-simplify-range-expression "[FOO-1+1-1+1]") ;; FOO-0
10001;;(verilog-simplify-range-expression "[$clog2(2)]") ;; 1
10002;;(verilog-simplify-range-expression "[$clog2(7)]") ;; 3
10003
10004(defun verilog-clog2 (value)
10005 "Compute $clog2 - ceiling log2 of VALUE."
10006 (if (< value 1)
10007 0
10008 (ceiling (/ (log value) (log 2)))))
9788 10009
9789(defun verilog-typedef-name-p (variable-name) 10010(defun verilog-typedef-name-p (variable-name)
9790 "Return true if the VARIABLE-NAME is a type definition." 10011 "Return true if the VARIABLE-NAME is a type definition."
@@ -10348,6 +10569,86 @@ Avoid declaring ports manually, as it makes code harder to maintain."
10348 (insert "\n")) 10569 (insert "\n"))
10349 (indent-to verilog-indent-level-declaration)))) 10570 (indent-to verilog-indent-level-declaration))))
10350 10571
10572(defun verilog-auto-assign-modport ()
10573 "Expand AUTOASSIGNMODPORT statements, as part of \\[verilog-auto].
10574Take input/output/inout statements from the specified interface
10575and modport and use to build assignments into the modport, for
10576making verification modules that connect to UVM interfaces.
10577
10578 The first parameter is the name of an interface.
10579
10580 The second parameter is a regexp of modports to read from in
10581 that interface.
10582
10583 The third parameter is the instance name to use to dot reference into.
10584
10585 The optional fourth parameter is a regular expression, and only
10586 signals matching the regular expression will be included.
10587
10588Limitations:
10589
10590 Interface names must be resolvable to filenames. See `verilog-auto-inst'.
10591
10592 Inouts are not supported, as assignments must be unidirectional.
10593
10594 If a signal is part of the interface header and in both a
10595 modport and the interface itself, it will not be listed. (As
10596 this would result in a syntax error when the connections are
10597 made.)
10598
10599See the example in `verilog-auto-inout-modport'."
10600 (save-excursion
10601 (let* ((params (verilog-read-auto-params 3 4))
10602 (submod (nth 0 params))
10603 (modport-re (nth 1 params))
10604 (inst-name (nth 2 params))
10605 (regexp (nth 3 params))
10606 direction-re submodi) ;; direction argument not supported until requested
10607 ;; Lookup position, etc of co-module
10608 ;; Note this may raise an error
10609 (when (setq submodi (verilog-modi-lookup submod t))
10610 (let* ((indent-pt (current-indentation))
10611 (modi (verilog-modi-current))
10612 (submoddecls (verilog-modi-get-decls submodi))
10613 (submodportdecls (verilog-modi-modport-lookup submodi modport-re))
10614 (sig-list-i (verilog-signals-in ;; Decls doesn't have data types, must resolve
10615 (verilog-decls-get-vars submoddecls)
10616 (verilog-signals-not-in
10617 (verilog-decls-get-inputs submodportdecls)
10618 (verilog-decls-get-ports submoddecls))))
10619 (sig-list-o (verilog-signals-in ;; Decls doesn't have data types, must resolve
10620 (verilog-decls-get-vars submoddecls)
10621 (verilog-signals-not-in
10622 (verilog-decls-get-outputs submodportdecls)
10623 (verilog-decls-get-ports submoddecls)))))
10624 (forward-line 1)
10625 (setq sig-list-i (verilog-signals-edit-wire-reg
10626 (verilog-signals-matching-dir-re
10627 (verilog-signals-matching-regexp sig-list-i regexp)
10628 "input" direction-re))
10629 sig-list-o (verilog-signals-edit-wire-reg
10630 (verilog-signals-matching-dir-re
10631 (verilog-signals-matching-regexp sig-list-o regexp)
10632 "output" direction-re)))
10633 (setq sig-list-i (sort (copy-alist sig-list-i) `verilog-signals-sort-compare))
10634 (setq sig-list-o (sort (copy-alist sig-list-o) `verilog-signals-sort-compare))
10635 (when (or sig-list-i sig-list-o)
10636 (verilog-insert-indent "// Beginning of automatic assignments from modport\n")
10637 ;; Don't sort them so an upper AUTOINST will match the main module
10638 (let ((sigs sig-list-o))
10639 (while sigs
10640 (verilog-insert-indent "assign " (verilog-sig-name (car sigs))
10641 " = " inst-name
10642 "." (verilog-sig-name (car sigs)) ";\n")
10643 (setq sigs (cdr sigs))))
10644 (let ((sigs sig-list-i))
10645 (while sigs
10646 (verilog-insert-indent "assign " inst-name
10647 "." (verilog-sig-name (car sigs))
10648 " = " (verilog-sig-name (car sigs)) ";\n")
10649 (setq sigs (cdr sigs))))
10650 (verilog-insert-indent "// End of automatics\n")))))))
10651
10351(defun verilog-auto-inst-port-map (port-st) 10652(defun verilog-auto-inst-port-map (port-st)
10352 nil) 10653 nil)
10353 10654
@@ -11067,8 +11368,8 @@ Typing \\[verilog-auto] will make this into:
11067 (verilog-subdecls-get-interfaced modsubdecls) 11368 (verilog-subdecls-get-interfaced modsubdecls)
11068 (verilog-subdecls-get-outputs modsubdecls) 11369 (verilog-subdecls-get-outputs modsubdecls)
11069 (verilog-subdecls-get-inouts modsubdecls))))) 11370 (verilog-subdecls-get-inouts modsubdecls)))))
11070 (forward-line 1)
11071 (when sig-list 11371 (when sig-list
11372 (verilog-forward-or-insert-line)
11072 (verilog-insert-indent "// Beginning of automatic regs (for this module's undeclared outputs)\n") 11373 (verilog-insert-indent "// Beginning of automatic regs (for this module's undeclared outputs)\n")
11073 (verilog-insert-definition modi sig-list "reg" indent-pt nil) 11374 (verilog-insert-definition modi sig-list "reg" indent-pt nil)
11074 (verilog-insert-indent "// End of automatics\n"))))) 11375 (verilog-insert-indent "// End of automatics\n")))))
@@ -11122,8 +11423,8 @@ Typing \\[verilog-auto] will make this into:
11122 (verilog-subdecls-get-inouts modsubdecls)) 11423 (verilog-subdecls-get-inouts modsubdecls))
11123 (append (verilog-decls-get-signals moddecls) 11424 (append (verilog-decls-get-signals moddecls)
11124 (verilog-decls-get-assigns moddecls)))))) 11425 (verilog-decls-get-assigns moddecls))))))
11125 (forward-line 1)
11126 (when sig-list 11426 (when sig-list
11427 (verilog-forward-or-insert-line)
11127 (verilog-insert-indent "// Beginning of automatic reg inputs (for undeclared instantiated-module inputs)\n") 11428 (verilog-insert-indent "// Beginning of automatic reg inputs (for undeclared instantiated-module inputs)\n")
11128 (verilog-insert-definition modi sig-list "reg" indent-pt nil) 11429 (verilog-insert-definition modi sig-list "reg" indent-pt nil)
11129 (verilog-insert-indent "// End of automatics\n"))))) 11430 (verilog-insert-indent "// End of automatics\n")))))
@@ -11210,8 +11511,8 @@ Typing \\[verilog-auto] will make this into:
11210 (append (verilog-subdecls-get-outputs modsubdecls) 11511 (append (verilog-subdecls-get-outputs modsubdecls)
11211 (verilog-subdecls-get-inouts modsubdecls)) 11512 (verilog-subdecls-get-inouts modsubdecls))
11212 (verilog-decls-get-signals moddecls))))) 11513 (verilog-decls-get-signals moddecls)))))
11213 (forward-line 1)
11214 (when sig-list 11514 (when sig-list
11515 (verilog-forward-or-insert-line)
11215 (verilog-insert-indent "// Beginning of automatic wires (for undeclared instantiated-module outputs)\n") 11516 (verilog-insert-indent "// Beginning of automatic wires (for undeclared instantiated-module outputs)\n")
11216 (verilog-insert-definition modi sig-list "wire" indent-pt nil) 11517 (verilog-insert-definition modi sig-list "wire" indent-pt nil)
11217 (verilog-insert-indent "// End of automatics\n") 11518 (verilog-insert-indent "// End of automatics\n")
@@ -11221,7 +11522,7 @@ Typing \\[verilog-auto] will make this into:
11221 ;; syntax-ppss which is broken when change hooks are disabled. 11522 ;; syntax-ppss which is broken when change hooks are disabled.
11222 )))) 11523 ))))
11223 11524
11224(defun verilog-auto-output (&optional with-params) 11525(defun verilog-auto-output ()
11225 "Expand AUTOOUTPUT statements, as part of \\[verilog-auto]. 11526 "Expand AUTOOUTPUT statements, as part of \\[verilog-auto].
11226Make output statements for any output signal from an /*AUTOINST*/ that 11527Make output statements for any output signal from an /*AUTOINST*/ that
11227isn't an input to another AUTOINST. This is useful for modules which 11528isn't an input to another AUTOINST. This is useful for modules which
@@ -11273,8 +11574,8 @@ same expansion will result from only extracting outputs starting with ov:
11273 (save-excursion 11574 (save-excursion
11274 ;; Point must be at insertion point. 11575 ;; Point must be at insertion point.
11275 (let* ((indent-pt (current-indentation)) 11576 (let* ((indent-pt (current-indentation))
11276 (regexp (and with-params 11577 (params (verilog-read-auto-params 0 1))
11277 (nth 0 (verilog-read-auto-params 1)))) 11578 (regexp (nth 0 params))
11278 (v2k (verilog-in-paren-quick)) 11579 (v2k (verilog-in-paren-quick))
11279 (modi (verilog-modi-current)) 11580 (modi (verilog-modi-current))
11280 (moddecls (verilog-modi-get-decls modi)) 11581 (moddecls (verilog-modi-get-decls modi))
@@ -11290,7 +11591,7 @@ same expansion will result from only extracting outputs starting with ov:
11290 sig-list regexp))) 11591 sig-list regexp)))
11291 (setq sig-list (verilog-signals-not-matching-regexp 11592 (setq sig-list (verilog-signals-not-matching-regexp
11292 sig-list verilog-auto-output-ignore-regexp)) 11593 sig-list verilog-auto-output-ignore-regexp))
11293 (forward-line 1) 11594 (verilog-forward-or-insert-line)
11294 (when v2k (verilog-repair-open-comma)) 11595 (when v2k (verilog-repair-open-comma))
11295 (when sig-list 11596 (when sig-list
11296 (verilog-insert-indent "// Beginning of automatic outputs (from unused autoinst outputs)\n") 11597 (verilog-insert-indent "// Beginning of automatic outputs (from unused autoinst outputs)\n")
@@ -11340,7 +11641,7 @@ Typing \\[verilog-auto] will make this into:
11340 (verilog-signals-not-in 11641 (verilog-signals-not-in
11341 (verilog-decls-get-signals moddecls) 11642 (verilog-decls-get-signals moddecls)
11342 (verilog-decls-get-ports moddecls))))) 11643 (verilog-decls-get-ports moddecls)))))
11343 (forward-line 1) 11644 (verilog-forward-or-insert-line)
11344 (when v2k (verilog-repair-open-comma)) 11645 (when v2k (verilog-repair-open-comma))
11345 (when sig-list 11646 (when sig-list
11346 (verilog-insert-indent "// Beginning of automatic outputs (every signal)\n") 11647 (verilog-insert-indent "// Beginning of automatic outputs (every signal)\n")
@@ -11348,7 +11649,7 @@ Typing \\[verilog-auto] will make this into:
11348 (verilog-insert-indent "// End of automatics\n")) 11649 (verilog-insert-indent "// End of automatics\n"))
11349 (when v2k (verilog-repair-close-comma))))) 11650 (when v2k (verilog-repair-close-comma)))))
11350 11651
11351(defun verilog-auto-input (&optional with-params) 11652(defun verilog-auto-input ()
11352 "Expand AUTOINPUT statements, as part of \\[verilog-auto]. 11653 "Expand AUTOINPUT statements, as part of \\[verilog-auto].
11353Make input statements for any input signal into an /*AUTOINST*/ that 11654Make input statements for any input signal into an /*AUTOINST*/ that
11354isn't declared elsewhere inside the module. This is useful for modules which 11655isn't declared elsewhere inside the module. This is useful for modules which
@@ -11399,8 +11700,8 @@ same expansion will result from only extracting inputs starting with i:
11399 /*AUTOINPUT(\"^i\")*/" 11700 /*AUTOINPUT(\"^i\")*/"
11400 (save-excursion 11701 (save-excursion
11401 (let* ((indent-pt (current-indentation)) 11702 (let* ((indent-pt (current-indentation))
11402 (regexp (and with-params 11703 (params (verilog-read-auto-params 0 1))
11403 (nth 0 (verilog-read-auto-params 1)))) 11704 (regexp (nth 0 params))
11404 (v2k (verilog-in-paren-quick)) 11705 (v2k (verilog-in-paren-quick))
11405 (modi (verilog-modi-current)) 11706 (modi (verilog-modi-current))
11406 (moddecls (verilog-modi-get-decls modi)) 11707 (moddecls (verilog-modi-get-decls modi))
@@ -11420,7 +11721,7 @@ same expansion will result from only extracting inputs starting with i:
11420 sig-list regexp))) 11721 sig-list regexp)))
11421 (setq sig-list (verilog-signals-not-matching-regexp 11722 (setq sig-list (verilog-signals-not-matching-regexp
11422 sig-list verilog-auto-input-ignore-regexp)) 11723 sig-list verilog-auto-input-ignore-regexp))
11423 (forward-line 1) 11724 (verilog-forward-or-insert-line)
11424 (when v2k (verilog-repair-open-comma)) 11725 (when v2k (verilog-repair-open-comma))
11425 (when sig-list 11726 (when sig-list
11426 (verilog-insert-indent "// Beginning of automatic inputs (from unused autoinst inputs)\n") 11727 (verilog-insert-indent "// Beginning of automatic inputs (from unused autoinst inputs)\n")
@@ -11428,7 +11729,7 @@ same expansion will result from only extracting inputs starting with i:
11428 (verilog-insert-indent "// End of automatics\n")) 11729 (verilog-insert-indent "// End of automatics\n"))
11429 (when v2k (verilog-repair-close-comma))))) 11730 (when v2k (verilog-repair-close-comma)))))
11430 11731
11431(defun verilog-auto-inout (&optional with-params) 11732(defun verilog-auto-inout ()
11432 "Expand AUTOINOUT statements, as part of \\[verilog-auto]. 11733 "Expand AUTOINOUT statements, as part of \\[verilog-auto].
11433Make inout statements for any inout signal in an /*AUTOINST*/ that 11734Make inout statements for any inout signal in an /*AUTOINST*/ that
11434isn't declared elsewhere inside the module. 11735isn't declared elsewhere inside the module.
@@ -11479,8 +11780,8 @@ same expansion will result from only extracting inouts starting with i:
11479 (save-excursion 11780 (save-excursion
11480 ;; Point must be at insertion point. 11781 ;; Point must be at insertion point.
11481 (let* ((indent-pt (current-indentation)) 11782 (let* ((indent-pt (current-indentation))
11482 (regexp (and with-params 11783 (params (verilog-read-auto-params 0 1))
11483 (nth 0 (verilog-read-auto-params 1)))) 11784 (regexp (nth 0 params))
11484 (v2k (verilog-in-paren-quick)) 11785 (v2k (verilog-in-paren-quick))
11485 (modi (verilog-modi-current)) 11786 (modi (verilog-modi-current))
11486 (moddecls (verilog-modi-get-decls modi)) 11787 (moddecls (verilog-modi-get-decls modi))
@@ -11497,7 +11798,7 @@ same expansion will result from only extracting inouts starting with i:
11497 sig-list regexp))) 11798 sig-list regexp)))
11498 (setq sig-list (verilog-signals-not-matching-regexp 11799 (setq sig-list (verilog-signals-not-matching-regexp
11499 sig-list verilog-auto-inout-ignore-regexp)) 11800 sig-list verilog-auto-inout-ignore-regexp))
11500 (forward-line 1) 11801 (verilog-forward-or-insert-line)
11501 (when v2k (verilog-repair-open-comma)) 11802 (when v2k (verilog-repair-open-comma))
11502 (when sig-list 11803 (when sig-list
11503 (verilog-insert-indent "// Beginning of automatic inouts (from unused autoinst inouts)\n") 11804 (verilog-insert-indent "// Beginning of automatic inouts (from unused autoinst inouts)\n")
@@ -11739,6 +12040,225 @@ same expansion will result from only extracting signals starting with i:
11739 /*AUTOINOUTCOMP(\"ExampMain\",\"^i\")*/" 12040 /*AUTOINOUTCOMP(\"ExampMain\",\"^i\")*/"
11740 (verilog-auto-inout-module nil t)) 12041 (verilog-auto-inout-module nil t))
11741 12042
12043(defun verilog-auto-inout-param ()
12044 "Expand AUTOINOUTPARAM statements, as part of \\[verilog-auto].
12045Take input/output/inout statements from the specified module and insert
12046into the current module. This is useful for making null templates and
12047shell modules which need to have identical I/O with another module.
12048Any I/O which are already defined in this module will not be redefined.
12049For the complement of this function, see `verilog-auto-inout-comp',
12050and to make monitors with all inputs, see `verilog-auto-inout-in'.
12051
12052Limitations:
12053 If placed inside the parenthesis of a module declaration, it creates
12054 Verilog 2001 style, else uses Verilog 1995 style.
12055
12056 Concatenation and outputting partial buses is not supported.
12057
12058 Module names must be resolvable to filenames. See `verilog-auto-inst'.
12059
12060 Signals are not inserted in the same order as in the original module,
12061 though they will appear to be in the same order to an AUTOINST
12062 instantiating either module.
12063
12064 Signals declared as \"output reg\" or \"output wire\" etc will
12065 lose the wire/reg declaration so that shell modules may
12066 generate those outputs differently. However, \"output logic\"
12067 is propagated.
12068
12069An example:
12070
12071 module ExampShell (/*AUTOARG*/);
12072 /*AUTOINOUTMODULE(\"ExampMain\")*/
12073 endmodule
12074
12075 module ExampMain (i,o,io);
12076 input i;
12077 output o;
12078 inout io;
12079 endmodule
12080
12081Typing \\[verilog-auto] will make this into:
12082
12083 module ExampShell (/*AUTOARG*/i,o,io);
12084 /*AUTOINOUTMODULE(\"ExampMain\")*/
12085 // Beginning of automatic in/out/inouts (from specific module)
12086 output o;
12087 inout io;
12088 input i;
12089 // End of automatics
12090 endmodule
12091
12092You may also provide an optional regular expression, in which case only
12093signals matching the regular expression will be included. For example the
12094same expansion will result from only extracting signals starting with i:
12095
12096 /*AUTOINOUTMODULE(\"ExampMain\",\"^i\")*/
12097
12098You may also provide an optional second regular expression, in
12099which case only signals which have that pin direction and data
12100type will be included. This matches against everything before
12101the signal name in the declaration, for example against
12102\"input\" (single bit), \"output logic\" (direction and type) or
12103\"output [1:0]\" (direction and implicit type). You also
12104probably want to skip spaces in your regexp.
12105
12106For example, the below will result in matching the output \"o\"
12107against the previous example's module:
12108
12109 /*AUTOINOUTMODULE(\"ExampMain\",\"\",\"^output.*\")*/
12110
12111You may also provide an optional third regular expression, in
12112which case any parameter names that match the given regexp will
12113be included. Including parameters is off by default. To include
12114all signals and parameters, use:
12115
12116 /*AUTOINOUTMODULE(\"ExampMain\",\".*\",\".*\",\".*\")*/"
12117 (save-excursion
12118 (let* ((params (verilog-read-auto-params 1 2))
12119 (submod (nth 0 params))
12120 (regexp (nth 1 params))
12121 submodi)
12122 ;; Lookup position, etc of co-module
12123 ;; Note this may raise an error
12124 (when (setq submodi (verilog-modi-lookup submod t))
12125 (let* ((indent-pt (current-indentation))
12126 (v2k (verilog-in-paren-quick))
12127 (modi (verilog-modi-current))
12128 (moddecls (verilog-modi-get-decls modi))
12129 (submoddecls (verilog-modi-get-decls submodi))
12130 (sig-list-p (verilog-signals-not-in
12131 (verilog-decls-get-gparams submoddecls)
12132 (append (verilog-decls-get-gparams moddecls)))))
12133 (forward-line 1)
12134 (setq sig-list-p (verilog-signals-matching-regexp sig-list-p regexp))
12135 (when v2k (verilog-repair-open-comma))
12136 (when sig-list-p
12137 (verilog-insert-indent "// Beginning of automatic parameters (from specific module)\n")
12138 ;; Don't sort them so an upper AUTOINST will match the main module
12139 (verilog-insert-definition modi sig-list-p "parameter" indent-pt v2k t)
12140 (verilog-insert-indent "// End of automatics\n"))
12141 (when v2k (verilog-repair-close-comma)))))))
12142
12143(defun verilog-auto-inout-modport ()
12144 "Expand AUTOINOUTMODPORT statements, as part of \\[verilog-auto].
12145Take input/output/inout statements from the specified interface
12146and modport and insert into the current module. This is useful
12147for making verification modules that connect to UVM interfaces.
12148
12149 The first parameter is the name of an interface.
12150
12151 The second parameter is a regexp of modports to read from in
12152 that interface.
12153
12154 The optional third parameter is a regular expression, and only
12155 signals matching the regular expression will be included.
12156
12157Limitations:
12158 If placed inside the parenthesis of a module declaration, it creates
12159 Verilog 2001 style, else uses Verilog 1995 style.
12160
12161 Interface names must be resolvable to filenames. See `verilog-auto-inst'.
12162
12163As with other autos, any inputs/outputs declared in the module
12164will suppress the AUTO from redeclarating an inputs/outputs by
12165the same name.
12166
12167An example:
12168
12169 interface ExampIf
12170 ( input logic clk );
12171 logic req_val;
12172 logic [7:0] req_dat;
12173 clocking mon_clkblk @(posedge clk);
12174 input req_val;
12175 input req_dat;
12176 endclocking
12177 modport mp(clocking mon_clkblk);
12178 endinterface
12179
12180 module ExampMain
12181 ( input clk,
12182 /*AUTOINOUTMODPORT(\"ExampIf\" \"mp\")*/
12183 // Beginning of automatic in/out/inouts (from modport)
12184 input [7:0] req_dat,
12185 input req_val
12186 // End of automatics
12187 );
12188 /*AUTOASSIGNMODPORT(\"ExampIf\" \"mp\")*/
12189 endmodule
12190
12191Typing \\[verilog-auto] will make this into:
12192
12193 ...
12194 module ExampMain
12195 ( input clk,
12196 /*AUTOINOUTMODPORT(\"ExampIf\" \"mp\")*/
12197 // Beginning of automatic in/out/inouts (from modport)
12198 input req_dat,
12199 input req_val
12200 // End of automatics
12201 );
12202
12203If the modport is part of a UVM monitor/driver class, this
12204creates a wrapper module that may be used to instantiate the
12205driver/monitor using AUTOINST in the testbench."
12206 (save-excursion
12207 (let* ((params (verilog-read-auto-params 2 3))
12208 (submod (nth 0 params))
12209 (modport-re (nth 1 params))
12210 (regexp (nth 2 params))
12211 direction-re submodi) ;; direction argument not supported until requested
12212 ;; Lookup position, etc of co-module
12213 ;; Note this may raise an error
12214 (when (setq submodi (verilog-modi-lookup submod t))
12215 (let* ((indent-pt (current-indentation))
12216 (v2k (verilog-in-paren-quick))
12217 (modi (verilog-modi-current))
12218 (moddecls (verilog-modi-get-decls modi))
12219 (submoddecls (verilog-modi-get-decls submodi))
12220 (submodportdecls (verilog-modi-modport-lookup submodi modport-re))
12221 (sig-list-i (verilog-signals-in ;; Decls doesn't have data types, must resolve
12222 (verilog-decls-get-vars submoddecls)
12223 (verilog-signals-not-in
12224 (verilog-decls-get-inputs submodportdecls)
12225 (append (verilog-decls-get-ports submoddecls)
12226 (verilog-decls-get-ports moddecls)))))
12227 (sig-list-o (verilog-signals-in ;; Decls doesn't have data types, must resolve
12228 (verilog-decls-get-vars submoddecls)
12229 (verilog-signals-not-in
12230 (verilog-decls-get-outputs submodportdecls)
12231 (append (verilog-decls-get-ports submoddecls)
12232 (verilog-decls-get-ports moddecls)))))
12233 (sig-list-io (verilog-signals-in ;; Decls doesn't have data types, must resolve
12234 (verilog-decls-get-vars submoddecls)
12235 (verilog-signals-not-in
12236 (verilog-decls-get-inouts submodportdecls)
12237 (append (verilog-decls-get-ports submoddecls)
12238 (verilog-decls-get-ports moddecls))))))
12239 (forward-line 1)
12240 (setq sig-list-i (verilog-signals-edit-wire-reg
12241 (verilog-signals-matching-dir-re
12242 (verilog-signals-matching-regexp sig-list-i regexp)
12243 "input" direction-re))
12244 sig-list-o (verilog-signals-edit-wire-reg
12245 (verilog-signals-matching-dir-re
12246 (verilog-signals-matching-regexp sig-list-o regexp)
12247 "output" direction-re))
12248 sig-list-io (verilog-signals-edit-wire-reg
12249 (verilog-signals-matching-dir-re
12250 (verilog-signals-matching-regexp sig-list-io regexp)
12251 "inout" direction-re)))
12252 (when v2k (verilog-repair-open-comma))
12253 (when (or sig-list-i sig-list-o sig-list-io)
12254 (verilog-insert-indent "// Beginning of automatic in/out/inouts (from modport)\n")
12255 ;; Don't sort them so an upper AUTOINST will match the main module
12256 (verilog-insert-definition modi sig-list-o "output" indent-pt v2k t)
12257 (verilog-insert-definition modi sig-list-io "inout" indent-pt v2k t)
12258 (verilog-insert-definition modi sig-list-i "input" indent-pt v2k t)
12259 (verilog-insert-indent "// End of automatics\n"))
12260 (when v2k (verilog-repair-close-comma)))))))
12261
11742(defun verilog-auto-insert-lisp () 12262(defun verilog-auto-insert-lisp ()
11743 "Expand AUTOINSERTLISP statements, as part of \\[verilog-auto]. 12263 "Expand AUTOINSERTLISP statements, as part of \\[verilog-auto].
11744The Lisp code provided is called, and the Lisp code calls 12264The Lisp code provided is called, and the Lisp code calls
@@ -11789,7 +12309,7 @@ text:
11789 (backward-sexp 1) ;; Inside comment 12309 (backward-sexp 1) ;; Inside comment
11790 (point))) ;; Beginning paren 12310 (point))) ;; Beginning paren
11791 (cmd (buffer-substring-no-properties cmd-beg-pt cmd-end-pt))) 12311 (cmd (buffer-substring-no-properties cmd-beg-pt cmd-end-pt)))
11792 (forward-line 1) 12312 (verilog-forward-or-insert-line)
11793 ;; Some commands don't move point (like insert-file) so we always 12313 ;; Some commands don't move point (like insert-file) so we always
11794 ;; add the begin/end comments, then delete it if not needed 12314 ;; add the begin/end comments, then delete it if not needed
11795 (verilog-insert-indent "// Beginning of automatic insert lisp\n") 12315 (verilog-insert-indent "// Beginning of automatic insert lisp\n")
@@ -12042,6 +12562,7 @@ value's width is generated.
12042An example of making a stub for another module: 12562An example of making a stub for another module:
12043 12563
12044 module ExampStub (/*AUTOINST*/); 12564 module ExampStub (/*AUTOINST*/);
12565 /*AUTOINOUTPARAM(\"Foo\")*/
12045 /*AUTOINOUTMODULE(\"Foo\")*/ 12566 /*AUTOINOUTMODULE(\"Foo\")*/
12046 /*AUTOTIEOFF*/ 12567 /*AUTOTIEOFF*/
12047 // verilator lint_off UNUSED 12568 // verilator lint_off UNUSED
@@ -12054,6 +12575,7 @@ An example of making a stub for another module:
12054Typing \\[verilog-auto] will make this into: 12575Typing \\[verilog-auto] will make this into:
12055 12576
12056 module ExampStub (/*AUTOINST*/...); 12577 module ExampStub (/*AUTOINST*/...);
12578 /*AUTOINOUTPARAM(\"Foo\")*/
12057 /*AUTOINOUTMODULE(\"Foo\")*/ 12579 /*AUTOINOUTMODULE(\"Foo\")*/
12058 // Beginning of autotieoff 12580 // Beginning of autotieoff
12059 output [2:0] foo; 12581 output [2:0] foo;
@@ -12084,7 +12606,7 @@ Typing \\[verilog-auto] will make this into:
12084 (setq sig-list (verilog-signals-not-matching-regexp 12606 (setq sig-list (verilog-signals-not-matching-regexp
12085 sig-list verilog-auto-tieoff-ignore-regexp)) 12607 sig-list verilog-auto-tieoff-ignore-regexp))
12086 (when sig-list 12608 (when sig-list
12087 (forward-line 1) 12609 (verilog-forward-or-insert-line)
12088 (verilog-insert-indent "// Beginning of automatic tieoffs (for this module's unterminated outputs)\n") 12610 (verilog-insert-indent "// Beginning of automatic tieoffs (for this module's unterminated outputs)\n")
12089 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare)) 12611 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare))
12090 (verilog-modi-cache-add-vars modi sig-list) ; Before we trash list 12612 (verilog-modi-cache-add-vars modi sig-list) ; Before we trash list
@@ -12161,7 +12683,7 @@ defines the regular expression will be undefed."
12161 ;; Insert 12683 ;; Insert
12162 (setq defs (sort defs 'string<)) 12684 (setq defs (sort defs 'string<))
12163 (when defs 12685 (when defs
12164 (forward-line 1) 12686 (verilog-forward-or-insert-line)
12165 (verilog-insert-indent "// Beginning of automatic undefs\n") 12687 (verilog-insert-indent "// Beginning of automatic undefs\n")
12166 (while defs 12688 (while defs
12167 (verilog-insert-indent "`undef " (car defs) "\n") 12689 (verilog-insert-indent "`undef " (car defs) "\n")
@@ -12198,6 +12720,7 @@ You can add signals you do not want included in AUTOUNUSED with
12198An example of making a stub for another module: 12720An example of making a stub for another module:
12199 12721
12200 module ExampStub (/*AUTOINST*/); 12722 module ExampStub (/*AUTOINST*/);
12723 /*AUTOINOUTPARAM(\"Examp\")*/
12201 /*AUTOINOUTMODULE(\"Examp\")*/ 12724 /*AUTOINOUTMODULE(\"Examp\")*/
12202 /*AUTOTIEOFF*/ 12725 /*AUTOTIEOFF*/
12203 // verilator lint_off UNUSED 12726 // verilator lint_off UNUSED
@@ -12236,7 +12759,7 @@ Typing \\[verilog-auto] will make this into:
12236 (setq sig-list (verilog-signals-not-matching-regexp 12759 (setq sig-list (verilog-signals-not-matching-regexp
12237 sig-list verilog-auto-unused-ignore-regexp)) 12760 sig-list verilog-auto-unused-ignore-regexp))
12238 (when sig-list 12761 (when sig-list
12239 (forward-line 1) 12762 (verilog-forward-or-insert-line)
12240 (verilog-insert-indent "// Beginning of automatic unused inputs\n") 12763 (verilog-insert-indent "// Beginning of automatic unused inputs\n")
12241 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare)) 12764 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare))
12242 (while sig-list 12765 (while sig-list
@@ -12335,10 +12858,7 @@ Typing \\[verilog-auto] will make this into:
12335 ;; 12858 ;;
12336 (sig-list-consts (append (verilog-decls-get-consts moddecls) 12859 (sig-list-consts (append (verilog-decls-get-consts moddecls)
12337 (verilog-decls-get-gparams moddecls))) 12860 (verilog-decls-get-gparams moddecls)))
12338 (sig-list-all (append (verilog-decls-get-vars moddecls) 12861 (sig-list-all (verilog-decls-get-iovars moddecls))
12339 (verilog-decls-get-outputs moddecls)
12340 (verilog-decls-get-inouts moddecls)
12341 (verilog-decls-get-inputs moddecls)))
12342 ;; 12862 ;;
12343 (undecode-sig (or (assoc undecode-name sig-list-all) 12863 (undecode-sig (or (assoc undecode-name sig-list-all)
12344 (error "%s: Signal %s not found in design" (verilog-point-text) undecode-name))) 12864 (error "%s: Signal %s not found in design" (verilog-point-text) undecode-name)))
@@ -12371,7 +12891,7 @@ Typing \\[verilog-auto] will make this into:
12371 elim-regexp))) 12891 elim-regexp)))
12372 tmp-sigs (cdr tmp-sigs)))) 12892 tmp-sigs (cdr tmp-sigs))))
12373 ;; 12893 ;;
12374 (forward-line 1) 12894 (verilog-forward-or-insert-line)
12375 (verilog-insert-indent "// Beginning of automatic ASCII enum decoding\n") 12895 (verilog-insert-indent "// Beginning of automatic ASCII enum decoding\n")
12376 (let ((decode-sig-list (list (list ascii-name (format "[%d:0]" (- (* ascii-chars 8) 1)) 12896 (let ((decode-sig-list (list (list ascii-name (format "[%d:0]" (- (* ascii-chars 8) 1))
12377 (concat "Decode of " undecode-name) nil nil)))) 12897 (concat "Decode of " undecode-name) nil nil))))
@@ -12506,9 +13026,12 @@ Or check if AUTOs have the same expansion
12506Using \\[describe-function], see also: 13026Using \\[describe-function], see also:
12507 `verilog-auto-arg' for AUTOARG module instantiations 13027 `verilog-auto-arg' for AUTOARG module instantiations
12508 `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding 13028 `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding
13029 `verilog-auto-assign-modport' for AUTOASSIGNMODPORT assignment to/from modport
12509 `verilog-auto-inout-comp' for AUTOINOUTCOMP copy complemented i/o 13030 `verilog-auto-inout-comp' for AUTOINOUTCOMP copy complemented i/o
12510 `verilog-auto-inout-in' for AUTOINOUTIN inputs for all i/o 13031 `verilog-auto-inout-in' for AUTOINOUTIN inputs for all i/o
13032 `verilog-auto-inout-modport' for AUTOINOUTMODPORT i/o from an interface modport
12511 `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere 13033 `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere
13034 `verilog-auto-inout-param' for AUTOINOUTPARAM copying params from elsewhere
12512 `verilog-auto-inout' for AUTOINOUT making hierarchy inouts 13035 `verilog-auto-inout' for AUTOINOUT making hierarchy inouts
12513 `verilog-auto-input' for AUTOINPUT making hierarchy inputs 13036 `verilog-auto-input' for AUTOINPUT making hierarchy inputs
12514 `verilog-auto-insert-lisp' for AUTOINSERTLISP insert code from lisp function 13037 `verilog-auto-insert-lisp' for AUTOINSERTLISP insert code from lisp function
@@ -12598,27 +13121,24 @@ Wilson Snyder (wsnyder@wsnyder.org)."
12598 (verilog-auto-re-search-do "/\\*\\(AUTOSENSE\\|AS\\)\\*/" 'verilog-auto-sense) 13121 (verilog-auto-re-search-do "/\\*\\(AUTOSENSE\\|AS\\)\\*/" 'verilog-auto-sense)
12599 (verilog-auto-re-search-do "/\\*AUTORESET\\*/" 'verilog-auto-reset) 13122 (verilog-auto-re-search-do "/\\*AUTORESET\\*/" 'verilog-auto-reset)
12600 ;; Must be done before autoin/out as creates a reg 13123 ;; Must be done before autoin/out as creates a reg
12601 (verilog-auto-re-search-do "/\\*AUTOASCIIENUM([^)]*)\\*/" 'verilog-auto-ascii-enum) 13124 (verilog-auto-re-search-do "/\\*AUTOASCIIENUM(.*?)\\*/" 'verilog-auto-ascii-enum)
12602 ;; 13125 ;;
12603 ;; first in/outs from other files 13126 ;; first in/outs from other files
12604 (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE([^)]*)\\*/" 'verilog-auto-inout-module) 13127 (verilog-auto-re-search-do "/\\*AUTOINOUTMODPORT(.*?)\\*/" 'verilog-auto-inout-modport)
12605 (verilog-auto-re-search-do "/\\*AUTOINOUTCOMP([^)]*)\\*/" 'verilog-auto-inout-comp) 13128 (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE(.*?)\\*/" 'verilog-auto-inout-module)
12606 (verilog-auto-re-search-do "/\\*AUTOINOUTIN([^)]*)\\*/" 'verilog-auto-inout-in) 13129 (verilog-auto-re-search-do "/\\*AUTOINOUTCOMP(.*?)\\*/" 'verilog-auto-inout-comp)
13130 (verilog-auto-re-search-do "/\\*AUTOINOUTIN(.*?)\\*/" 'verilog-auto-inout-in)
13131 (verilog-auto-re-search-do "/\\*AUTOINOUTPARAM(.*?)\\*/" 'verilog-auto-inout-param)
12607 ;; next in/outs which need previous sucked inputs first 13132 ;; next in/outs which need previous sucked inputs first
12608 (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((\"[^\"]*\")\\)\\*/" 13133 (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((.*?)\\)?\\*/" 'verilog-auto-output)
12609 (lambda () (verilog-auto-output t))) 13134 (verilog-auto-re-search-do "/\\*AUTOINPUT\\((.*?)\\)?\\*/" 'verilog-auto-input)
12610 (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\*/" 'verilog-auto-output) 13135 (verilog-auto-re-search-do "/\\*AUTOINOUT\\((.*?)\\)?\\*/" 'verilog-auto-inout)
12611 (verilog-auto-re-search-do "/\\*AUTOINPUT\\((\"[^\"]*\")\\)\\*/"
12612 (lambda () (verilog-auto-input t)))
12613 (verilog-auto-re-search-do "/\\*AUTOINPUT\\*/" 'verilog-auto-input)
12614 (verilog-auto-re-search-do "/\\*AUTOINOUT\\((\"[^\"]*\")\\)\\*/"
12615 (lambda () (verilog-auto-inout t)))
12616 (verilog-auto-re-search-do "/\\*AUTOINOUT\\*/" 'verilog-auto-inout)
12617 ;; Then tie off those in/outs 13136 ;; Then tie off those in/outs
12618 (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff) 13137 (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff)
12619 ;; These can be anywhere after AUTOINSERTLISP 13138 ;; These can be anywhere after AUTOINSERTLISP
12620 (verilog-auto-re-search-do "/\\*AUTOUNDEF\\((\"[^\"]*\")\\)?\\*/" 'verilog-auto-undef) 13139 (verilog-auto-re-search-do "/\\*AUTOUNDEF\\((.*?)\\)?\\*/" 'verilog-auto-undef)
12621 ;; Wires/regs must be after inputs/outputs 13140 ;; Wires/regs must be after inputs/outputs
13141 (verilog-auto-re-search-do "/\\*AUTOASSIGNMODPORT(.*?)\\*/" 'verilog-auto-assign-modport)
12622 (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic) 13142 (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic)
12623 (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire) 13143 (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire)
12624 (verilog-auto-re-search-do "/\\*AUTOREG\\*/" 'verilog-auto-reg) 13144 (verilog-auto-re-search-do "/\\*AUTOREG\\*/" 'verilog-auto-reg)
@@ -12696,7 +13216,7 @@ Wilson Snyder (wsnyder@wsnyder.org)."
12696;; 13216;;
12697;; Place the templates into Verilog Mode. They may be inserted under any key. 13217;; Place the templates into Verilog Mode. They may be inserted under any key.
12698;; C-c C-t will be the default. If you use templates a lot, you 13218;; C-c C-t will be the default. If you use templates a lot, you
12699;; may want to consider moving the binding to another key in your .emacs 13219;; may want to consider moving the binding to another key in your init
12700;; file. 13220;; file.
12701;; 13221;;
12702;; Note \C-c and letter are reserved for users 13222;; Note \C-c and letter are reserved for users
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index 0ca3439dd60..52757b9eede 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -12522,6 +12522,7 @@ options vhdl-upper-case-{keywords,types,attributes,enum-values}."
12522(defun vhdl-line-expand (&optional prefix-arg) 12522(defun vhdl-line-expand (&optional prefix-arg)
12523 "Hippie-expand current line." 12523 "Hippie-expand current line."
12524 (interactive "P") 12524 (interactive "P")
12525 (require 'hippie-exp)
12525 (let ((case-fold-search t) (case-replace nil) 12526 (let ((case-fold-search t) (case-replace nil)
12526 (hippie-expand-try-functions-list 12527 (hippie-expand-try-functions-list
12527 '(try-expand-line try-expand-line-all-buffers))) 12528 '(try-expand-line try-expand-line-all-buffers)))
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 02340425dfa..4819149bdf6 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -234,9 +234,7 @@ It creates the Imenu index for the buffer, if necessary."
234 (error "Error in which-func-update: %S" info)))))) 234 (error "Error in which-func-update: %S" info))))))
235 235
236;;;###autoload 236;;;###autoload
237(defun which-func-mode (&optional arg) 237(define-obsolete-function-alias 'which-func-mode 'which-function-mode "24.1")
238 (which-function-mode arg))
239(make-obsolete 'which-func-mode 'which-function-mode "24.1")
240 238
241(defvar which-func-update-timer nil) 239(defvar which-func-update-timer nil)
242 240
diff --git a/lisp/replace.el b/lisp/replace.el
index f192574a7e2..82edb0037fb 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -378,35 +378,33 @@ regexp in `search-whitespace-regexp'.
378Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace 378Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace
379only matches that are surrounded by word boundaries. 379only matches that are surrounded by word boundaries.
380Fourth and fifth arg START and END specify the region to operate on." 380Fourth and fifth arg START and END specify the region to operate on."
381 (declare (obsolete "use the `\\,' feature of `query-replace-regexp'
382for interactive calls, and `search-forward-regexp'/`replace-match'
383for Lisp calls." "22.1"))
381 (interactive 384 (interactive
382 (progn 385 (progn
383 (barf-if-buffer-read-only) 386 (barf-if-buffer-read-only)
384 (let* ((from 387 (let* ((from
385 ;; Let-bind the history var to disable the "foo -> bar" default. 388 ;; Let-bind the history var to disable the "foo -> bar"
386 ;; Maybe we shouldn't disable this default, but for now I'll 389 ;; default. Maybe we shouldn't disable this default, but
387 ;; leave it off. --Stef 390 ;; for now I'll leave it off. --Stef
388 (let ((query-replace-to-history-variable nil)) 391 (let ((query-replace-to-history-variable nil))
389 (query-replace-read-from "Query replace regexp" t))) 392 (query-replace-read-from "Query replace regexp" t)))
390 (to (list (read-from-minibuffer 393 (to (list (read-from-minibuffer
391 (format "Query replace regexp %s with eval: " 394 (format "Query replace regexp %s with eval: "
392 (query-replace-descr from)) 395 (query-replace-descr from))
393 nil nil t query-replace-to-history-variable from t)))) 396 nil nil t query-replace-to-history-variable from t))))
394 ;; We make TO a list because replace-match-string-symbols requires one, 397 ;; We make TO a list because replace-match-string-symbols requires one,
395 ;; and the user might enter a single token. 398 ;; and the user might enter a single token.
396 (replace-match-string-symbols to) 399 (replace-match-string-symbols to)
397 (list from (car to) current-prefix-arg 400 (list from (car to) current-prefix-arg
398 (if (and transient-mark-mode mark-active) 401 (if (and transient-mark-mode mark-active)
399 (region-beginning)) 402 (region-beginning))
400 (if (and transient-mark-mode mark-active) 403 (if (and transient-mark-mode mark-active)
401 (region-end)))))) 404 (region-end))))))
402 (perform-replace regexp (cons 'replace-eval-replacement to-expr) 405 (perform-replace regexp (cons 'replace-eval-replacement to-expr)
403 t 'literal delimited nil nil start end)) 406 t 'literal delimited nil nil start end))
404 407
405(make-obsolete 'query-replace-regexp-eval
406 "for interactive use, use the special `\\,' feature of
407`query-replace-regexp' instead. Non-interactively, a loop
408using `search-forward-regexp' and `replace-match' is preferred." "22.1")
409
410(defun map-query-replace-regexp (regexp to-strings &optional n start end) 408(defun map-query-replace-regexp (regexp to-strings &optional n start end)
411 "Replace some matches for REGEXP with various strings, in rotation. 409 "Replace some matches for REGEXP with various strings, in rotation.
412The second argument TO-STRINGS contains the replacement strings, separated 410The second argument TO-STRINGS contains the replacement strings, separated
diff --git a/lisp/savehist.el b/lisp/savehist.el
index 215314d7053..cca958ff0a1 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -209,6 +209,7 @@ histories, which is probably undesirable."
209If `savehist-file' is in the old format that doesn't record 209If `savehist-file' is in the old format that doesn't record
210the value of `savehist-minibuffer-history-variables', that 210the value of `savehist-minibuffer-history-variables', that
211value is deducted from the contents of the file." 211value is deducted from the contents of the file."
212 (declare (obsolete savehist-mode "22.1"))
212 (savehist-mode 1) 213 (savehist-mode 1)
213 ;; Old versions of savehist distributed with XEmacs didn't save 214 ;; Old versions of savehist distributed with XEmacs didn't save
214 ;; savehist-minibuffer-history-variables. If that variable is nil 215 ;; savehist-minibuffer-history-variables. If that variable is nil
@@ -225,7 +226,6 @@ value is deducted from the contents of the file."
225 ;; Collect VAR, i.e. (nth form 1). 226 ;; Collect VAR, i.e. (nth form 1).
226 (push (nth 1 form) vars)) 227 (push (nth 1 form) vars))
227 vars))))) 228 vars)))))
228(make-obsolete 'savehist-load 'savehist-mode "22.1")
229 229
230(defun savehist-install () 230(defun savehist-install ()
231 "Hook savehist into Emacs. 231 "Hook savehist into Emacs.
diff --git a/lisp/server.el b/lisp/server.el
index 4fd55bcf6d1..73c253a87a6 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -101,7 +101,12 @@
101 101
102(defcustom server-host nil 102(defcustom server-host nil
103 "The name or IP address to use as host address of the server process. 103 "The name or IP address to use as host address of the server process.
104If set, the server accepts remote connections; otherwise it is local." 104If set, the server accepts remote connections; otherwise it is local.
105
106DO NOT give this a non-nil value unless you know what you are
107doing! On unsecured networks, accepting remote connections is
108very dangerous, because server-client communication (including
109session authentication) is not encrypted."
105 :group 'server 110 :group 'server
106 :type '(choice 111 :type '(choice
107 (string :tag "Name or IP address") 112 (string :tag "Name or IP address")
@@ -140,12 +145,12 @@ directory residing in a NTFS partition instead."
140 145
141(defcustom server-auth-key nil 146(defcustom server-auth-key nil
142 "Server authentication key. 147 "Server authentication key.
148This is only used if `server-use-tcp' is non-nil.
143 149
144Normally, the authentication key is randomly generated when the 150Normally, the authentication key is randomly generated when the
145server starts, which guarantees some level of security. It is 151server starts. It is recommended to leave it that way. Using a
146recommended to leave it that way. Using a long-lived shared key 152long-lived shared key will decrease security (especially since
147will decrease security (especially since the key is transmitted as 153the key is transmitted as plain-text).
148plain text).
149 154
150In some situations however, it can be difficult to share randomly 155In some situations however, it can be difficult to share randomly
151generated passwords with remote hosts (eg. no shared directory), 156generated passwords with remote hosts (eg. no shared directory),
@@ -153,11 +158,13 @@ so you can set the key with this variable and then copy the
153server file to the remote host (with possible changes to IP 158server file to the remote host (with possible changes to IP
154address and/or port if that applies). 159address and/or port if that applies).
155 160
156The key must consist of 64 ASCII printable characters except for 161Note that the usual security risks of using the server over
157space (this means characters from ! to ~; or from code 33 to 126). 162remote TCP, arising from the fact that client-server
163communications are unencrypted, still apply.
158 164
159You can use \\[server-generate-key] to get a random authentication 165The key must consist of 64 ASCII printable characters except for
160key." 166space (this means characters from ! to ~; or from code 33 to
167126). You can use \\[server-generate-key] to get a random key."
161 :group 'server 168 :group 'server
162 :type '(choice 169 :type '(choice
163 (const :tag "Random" nil) 170 (const :tag "Random" nil)
diff --git a/lisp/simple.el b/lisp/simple.el
index e1b8f37e46c..616a4d7b1ea 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -606,7 +606,7 @@ buffer if the variable `delete-trailing-lines' is non-nil."
606 (when (and (not end) 606 (when (and (not end)
607 delete-trailing-lines 607 delete-trailing-lines
608 ;; Really the end of buffer. 608 ;; Really the end of buffer.
609 (save-restriction (widen) (eobp)) 609 (= (point-max) (1+ (buffer-size)))
610 (<= (skip-chars-backward "\n") -2)) 610 (<= (skip-chars-backward "\n") -2))
611 (delete-region (1+ (point)) end-marker)) 611 (delete-region (1+ (point)) end-marker))
612 (set-marker end-marker nil)))) 612 (set-marker end-marker nil))))
@@ -6380,9 +6380,8 @@ With prefix argument N, move N items (negative N means move backward)."
6380 (point)))) 6380 (point))))
6381 6381
6382(defun choose-completion-delete-max-match (string) 6382(defun choose-completion-delete-max-match (string)
6383 (declare (obsolete choose-completion-guess-base-position "23.2"))
6383 (delete-region (choose-completion-guess-base-position string) (point))) 6384 (delete-region (choose-completion-guess-base-position string) (point)))
6384(make-obsolete 'choose-completion-delete-max-match
6385 'choose-completion-guess-base-position "23.2")
6386 6385
6387(defvar choose-completion-string-functions nil 6386(defvar choose-completion-string-functions nil
6388 "Functions that may override the normal insertion of a completion choice. 6387 "Functions that may override the normal insertion of a completion choice.
diff --git a/lisp/startup.el b/lisp/startup.el
index 243c9621752..6658e16683b 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -43,7 +43,10 @@
43If the value is nil and `inhibit-startup-screen' is nil, show the 43If the value is nil and `inhibit-startup-screen' is nil, show the
44startup screen. If the value is a string, visit the specified file 44startup screen. If the value is a string, visit the specified file
45or directory using `find-file'. If t, open the `*scratch*' 45or directory using `find-file'. If t, open the `*scratch*'
46buffer." 46buffer.
47
48A string value also causes emacsclient to open the specified file
49or directory when no target file is specified."
47 :type '(choice 50 :type '(choice
48 (const :tag "Startup screen" nil) 51 (const :tag "Startup screen" nil)
49 (directory :tag "Directory" :value "~/") 52 (directory :tag "Directory" :value "~/")
diff --git a/lisp/subr.el b/lisp/subr.el
index b9b8e627672..8dfe78d8c75 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -271,9 +271,14 @@ the return value (nil if RESULT is omitted).
271 ,@(cdr (cdr spec)))))) 271 ,@(cdr (cdr spec))))))
272 272
273(defmacro declare (&rest _specs) 273(defmacro declare (&rest _specs)
274 "Do not evaluate any arguments and return nil. 274 "Do not evaluate any arguments, and return nil.
275Treated as a declaration when used at the right place in a 275If a `declare' form appears as the first form in the body of a
276`defmacro' form. \(See Info anchor `(elisp)Definition of declare'.)" 276`defun' or `defmacro' form, SPECS specifies various additional
277information about the function or macro; these go into effect
278during the evaluation of the `defun' or `defmacro' form.
279
280The possible values of SPECS are specified by
281`defun-declarations-alist' and `macro-declarations-alist'."
277 ;; FIXME: edebug spec should pay attention to defun-declarations-alist. 282 ;; FIXME: edebug spec should pay attention to defun-declarations-alist.
278 nil) 283 nil)
279)) 284))
@@ -461,18 +466,18 @@ If TEST is omitted or nil, `equal' is used."
461 (setq tail (cdr tail))) 466 (setq tail (cdr tail)))
462 value)) 467 value))
463 468
464(make-obsolete 'assoc-ignore-case 'assoc-string "22.1")
465(defun assoc-ignore-case (key alist) 469(defun assoc-ignore-case (key alist)
466 "Like `assoc', but ignores differences in case and text representation. 470 "Like `assoc', but ignores differences in case and text representation.
467KEY must be a string. Upper-case and lower-case letters are treated as equal. 471KEY must be a string. Upper-case and lower-case letters are treated as equal.
468Unibyte strings are converted to multibyte for comparison." 472Unibyte strings are converted to multibyte for comparison."
473 (declare (obsolete assoc-string "22.1"))
469 (assoc-string key alist t)) 474 (assoc-string key alist t))
470 475
471(make-obsolete 'assoc-ignore-representation 'assoc-string "22.1")
472(defun assoc-ignore-representation (key alist) 476(defun assoc-ignore-representation (key alist)
473 "Like `assoc', but ignores differences in text representation. 477 "Like `assoc', but ignores differences in text representation.
474KEY must be a string. 478KEY must be a string.
475Unibyte strings are converted to multibyte for comparison." 479Unibyte strings are converted to multibyte for comparison."
480 (declare (obsolete assoc-string "22.1"))
476 (assoc-string key alist nil)) 481 (assoc-string key alist nil))
477 482
478(defun member-ignore-case (elt list) 483(defun member-ignore-case (elt list)
@@ -1179,12 +1184,13 @@ be a list of the form returned by `event-start' and `event-end'."
1179 "Mocklisp-compatibility insert function. 1184 "Mocklisp-compatibility insert function.
1180Like the function `insert' except that any argument that is a number 1185Like the function `insert' except that any argument that is a number
1181is converted into a string by expressing it in decimal." 1186is converted into a string by expressing it in decimal."
1187 (declare (obsolete insert "22.1"))
1182 (dolist (el args) 1188 (dolist (el args)
1183 (insert (if (integerp el) (number-to-string el) el)))) 1189 (insert (if (integerp el) (number-to-string el) el))))
1184(make-obsolete 'insert-string 'insert "22.1")
1185 1190
1186(defun makehash (&optional test) (make-hash-table :test (or test 'eql))) 1191(defun makehash (&optional test)
1187(make-obsolete 'makehash 'make-hash-table "22.1") 1192 (declare (obsolete make-hash-table "22.1"))
1193 (make-hash-table :test (or test 'eql)))
1188 1194
1189;; These are used by VM and some old programs 1195;; These are used by VM and some old programs
1190(defalias 'focus-frame 'ignore "") 1196(defalias 'focus-frame 'ignore "")
@@ -1250,11 +1256,6 @@ is converted into a string by expressing it in decimal."
1250(make-obsolete 'process-filter-multibyte-p nil "23.1") 1256(make-obsolete 'process-filter-multibyte-p nil "23.1")
1251(make-obsolete 'set-process-filter-multibyte nil "23.1") 1257(make-obsolete 'set-process-filter-multibyte nil "23.1")
1252 1258
1253(make-obsolete-variable
1254 'mode-line-inverse-video
1255 "use the appropriate faces instead."
1256 "21.1")
1257
1258;; Lisp manual only updated in 22.1. 1259;; Lisp manual only updated in 22.1.
1259(define-obsolete-variable-alias 'executing-macro 'executing-kbd-macro 1260(define-obsolete-variable-alias 'executing-macro 'executing-kbd-macro
1260 "before 19.34") 1261 "before 19.34")
@@ -1911,8 +1912,8 @@ This function is called directly from the C code."
1911 "Read the following input sexp, and run it whenever FILE is loaded. 1912 "Read the following input sexp, and run it whenever FILE is loaded.
1912This makes or adds to an entry on `after-load-alist'. 1913This makes or adds to an entry on `after-load-alist'.
1913FILE should be the name of a library, with no directory name." 1914FILE should be the name of a library, with no directory name."
1915 (declare (obsolete eval-after-load "23.2"))
1914 (eval-after-load file (read))) 1916 (eval-after-load file (read)))
1915(make-obsolete 'eval-next-after-load `eval-after-load "23.2")
1916 1917
1917(defun display-delayed-warnings () 1918(defun display-delayed-warnings ()
1918 "Display delayed warnings from `delayed-warnings-list'. 1919 "Display delayed warnings from `delayed-warnings-list'.
diff --git a/lisp/term.el b/lisp/term.el
index d5f35006357..7567bd38f5a 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -994,7 +994,10 @@ is buffer-local."
994 (setq term-ansi-current-reverse nil) 994 (setq term-ansi-current-reverse nil)
995 (setq term-ansi-current-color 0) 995 (setq term-ansi-current-color 0)
996 (setq term-ansi-current-invisible nil) 996 (setq term-ansi-current-invisible nil)
997 (setq term-ansi-face-already-done t) 997 ;; Stefan thought this should be t, but could not remember why.
998 ;; Setting it to t seems to cause bug#11785. Setting it to nil
999 ;; again to see if there are other consequences...
1000 (setq term-ansi-face-already-done nil)
998 (setq term-ansi-current-bg-color 0)) 1001 (setq term-ansi-current-bg-color 0))
999 1002
1000(define-derived-mode term-mode fundamental-mode "Term" 1003(define-derived-mode term-mode fundamental-mode "Term"
@@ -4048,6 +4051,7 @@ Returns `partial' if completed as far as possible with the completion matches.
4048Returns `listed' if a completion listing was shown. 4051Returns `listed' if a completion listing was shown.
4049 4052
4050See also `term-dynamic-complete-filename'." 4053See also `term-dynamic-complete-filename'."
4054 (declare (obsolete completion-in-region "23.2"))
4051 (let* ((completion-ignore-case nil) 4055 (let* ((completion-ignore-case nil)
4052 (candidates (mapcar (function (lambda (x) (list x))) candidates)) 4056 (candidates (mapcar (function (lambda (x) (list x))) candidates))
4053 (completions (all-completions stub candidates))) 4057 (completions (all-completions stub candidates)))
@@ -4081,8 +4085,6 @@ See also `term-dynamic-complete-filename'."
4081 (t 4085 (t
4082 (message "Partially completed") 4086 (message "Partially completed")
4083 'partial))))))) 4087 'partial)))))))
4084(make-obsolete 'term-dynamic-simple-complete 'completion-in-region "23.2")
4085
4086 4088
4087(defun term-dynamic-list-filename-completions () 4089(defun term-dynamic-list-filename-completions ()
4088 "List in help buffer possible completions of the filename at point." 4090 "List in help buffer possible completions of the filename at point."
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 31656918fad..e0d93b68056 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1002,6 +1002,7 @@ See `bibtex-generate-autokey' for details."
1002 ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" . "") 1002 ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" . "")
1003 ;; braces, quotes, concatenation. 1003 ;; braces, quotes, concatenation.
1004 ("[`'\"{}#]" . "") 1004 ("[`'\"{}#]" . "")
1005 ("\\\\-" . "") ; \- ->
1005 ;; spaces 1006 ;; spaces
1006 ("\\\\?[ \t\n]+\\|~" . " ")) 1007 ("\\\\?[ \t\n]+\\|~" . " "))
1007 "Alist of (OLD-REGEXP . NEW-STRING) pairs. 1008 "Alist of (OLD-REGEXP . NEW-STRING) pairs.
@@ -4893,21 +4894,22 @@ If mark is active reformat entries in region, if not in whole buffer."
4893 (if use-previous-options 4894 (if use-previous-options
4894 bibtex-reformat-previous-options 4895 bibtex-reformat-previous-options
4895 (setq bibtex-reformat-previous-options 4896 (setq bibtex-reformat-previous-options
4896 (mapcar (lambda (option) 4897 (delq nil
4897 (if (y-or-n-p (car option)) (cdr option))) 4898 (mapcar (lambda (option)
4898 `(("Realign entries (recommended)? " . 'realign) 4899 (if (y-or-n-p (car option)) (cdr option)))
4899 ("Remove empty optional and alternative fields? " . 'opts-or-alts) 4900 `(("Realign entries (recommended)? " . realign)
4900 ("Remove delimiters around pure numerical fields? " . 'numerical-fields) 4901 ("Remove empty optional and alternative fields? " . opts-or-alts)
4901 (,(concat (if bibtex-comma-after-last-field "Insert" "Remove") 4902 ("Remove delimiters around pure numerical fields? " . numerical-fields)
4902 " comma at end of entry? ") . 'last-comma) 4903 (,(concat (if bibtex-comma-after-last-field "Insert" "Remove")
4903 ("Replace double page dashes by single ones? " . 'page-dashes) 4904 " comma at end of entry? ") . last-comma)
4904 ("Delete whitespace at the beginning and end of fields? " . 'whitespace) 4905 ("Replace double page dashes by single ones? " . page-dashes)
4905 ("Inherit booktitle? " . 'inherit-booktitle) 4906 ("Delete whitespace at the beginning and end of fields? " . whitespace)
4906 ("Force delimiters? " . 'delimiters) 4907 ("Inherit booktitle? " . inherit-booktitle)
4907 ("Unify case of entry types and field names? " . 'unify-case) 4908 ("Force delimiters? " . delimiters)
4908 ("Enclose parts of field entries by braces? " . 'braces) 4909 ("Unify case of entry types and field names? " . unify-case)
4909 ("Replace parts of field entries by string constants? " . 'strings) 4910 ("Enclose parts of field entries by braces? " . braces)
4910 ("Sort fields? " . 'sort-fields)))))) 4911 ("Replace parts of field entries by string constants? " . strings)
4912 ("Sort fields? " . sort-fields)))))))
4911 ;; Do not include required-fields because `bibtex-reformat' 4913 ;; Do not include required-fields because `bibtex-reformat'
4912 ;; cannot handle the error messages of `bibtex-format-entry'. 4914 ;; cannot handle the error messages of `bibtex-format-entry'.
4913 ;; Use `bibtex-validate' to check for required fields. 4915 ;; Use `bibtex-validate' to check for required fields.
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index 31001c78e54..229d12b2906 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -542,10 +542,7 @@
542 (t "")))) 542 (t ""))))
543 (setq authors (reftex-truncate authors 30 t t)) 543 (setq authors (reftex-truncate authors 30 t t))
544 (when (reftex-use-fonts) 544 (when (reftex-use-fonts)
545 (put-text-property 0 (length key) 'face 545 (put-text-property 0 (length key) 'face reftex-label-face
546 (reftex-verified-face reftex-label-face
547 'font-lock-constant-face
548 'font-lock-reference-face)
549 key) 546 key)
550 (put-text-property 0 (length authors) 'face reftex-bib-author-face 547 (put-text-property 0 (length authors) 'face reftex-bib-author-face
551 authors) 548 authors)
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 2d395fe3df2..1d15dfbed7e 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -585,9 +585,7 @@ SPC=view TAB=goto RET=goto+hide [e]dit [q]uit [r]escan [f]ollow [?]Help
585 (if (memq reftex-highlight-selection '(mouse both)) 585 (if (memq reftex-highlight-selection '(mouse both))
586 reftex-mouse-selected-face 586 reftex-mouse-selected-face
587 nil)) 587 nil))
588 (index-face (reftex-verified-face reftex-label-face 588 (index-face reftex-label-face)
589 'font-lock-constant-face
590 'font-lock-reference-face))
591 sublist cell from to first-char) 589 sublist cell from to first-char)
592 590
593 ;; Make the sublist and sort it 591 ;; Make the sublist and sort it
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index 627dfba0071..1a400436311 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -245,12 +245,8 @@ During a selection process, these are the local bindings.
245 (if (memq reftex-highlight-selection '(mouse both)) 245 (if (memq reftex-highlight-selection '(mouse both))
246 reftex-mouse-selected-face 246 reftex-mouse-selected-face
247 nil)) 247 nil))
248 (label-face (reftex-verified-face reftex-label-face 248 (label-face reftex-label-face)
249 'font-lock-constant-face 249 (index-face reftex-index-face)
250 'font-lock-reference-face))
251 (index-face (reftex-verified-face reftex-index-face
252 'font-lock-constant-face
253 'font-lock-reference-face))
254 all cell text label typekey note comment master-dir-re 250 all cell text label typekey note comment master-dir-re
255 prev-inserted offset from to index-tag docstruct-symbol) 251 prev-inserted offset from to index-tag docstruct-symbol)
256 252
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 8584c496a97..8318dc0d5f3 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -2311,9 +2311,7 @@ IGNORE-WORDS List of words which should be removed from the string."
2311 ;; Return the first valid face in FACES, or nil if none is valid. 2311 ;; Return the first valid face in FACES, or nil if none is valid.
2312 ;; Also, when finding a nil element in FACES, return nil. This 2312 ;; Also, when finding a nil element in FACES, return nil. This
2313 ;; function is just a safety net to catch name changes of builtin 2313 ;; function is just a safety net to catch name changes of builtin
2314 ;; fonts. Currently it is only used for reftex-label-face, which has 2314 ;; fonts. Currently it is only used for reftex-label-face.
2315 ;; as default font-lock-reference-face, which was recently renamed
2316 ;; to font-lock-constant-face.
2317 (let (face) 2315 (let (face)
2318 (catch 'exit 2316 (catch 'exit
2319 (while (setq face (pop faces)) 2317 (while (setq face (pop faces))
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index eeafe586c27..869da63064a 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -118,7 +118,8 @@
118;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 118;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
119;; Support for `testcover' 119;; Support for `testcover'
120 120
121(when (boundp 'testcover-1value-functions) 121(when (and (boundp 'testcover-1value-functions)
122 (boundp 'testcover-compose-functions))
122 ;; Below `lambda' is used in a loop with varying parameters and is thus not 123 ;; Below `lambda' is used in a loop with varying parameters and is thus not
123 ;; 1valued. 124 ;; 1valued.
124 (setq testcover-1value-functions 125 (setq testcover-1value-functions
@@ -217,7 +218,7 @@ and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no match."
217;; Use CVSHeader to really get information from CVS and not other version 218;; Use CVSHeader to really get information from CVS and not other version
218;; control systems. 219;; control systems.
219(defconst rst-cvs-header 220(defconst rst-cvs-header
220 "$CVSHeader: sm/rst_el/rst.el,v 1.327.2.1 2012-09-22 09:06:56 stefan Exp $") 221 "$CVSHeader: sm/rst_el/rst.el,v 1.327.2.2 2012-09-23 14:44:25 stefan Exp $")
221(defconst rst-cvs-rev 222(defconst rst-cvs-rev
222 (rst-extract-version "\\$" "CVSHeader: \\S + " "[0-9]+\\(?:\\.[0-9]+\\)+" 223 (rst-extract-version "\\$" "CVSHeader: \\S + " "[0-9]+\\(?:\\.[0-9]+\\)+"
223 " .*" rst-cvs-header "0.0") 224 " .*" rst-cvs-header "0.0")
@@ -246,7 +247,7 @@ SVN revision is the upstream (docutils) revision.")
246 "Official version of the package.") 247 "Official version of the package.")
247(defconst rst-official-cvs-rev 248(defconst rst-official-cvs-rev
248 (rst-extract-version "[%$]" "Revision: " "[0-9]+\\(?:\\.[0-9]+\\)+" " " 249 (rst-extract-version "[%$]" "Revision: " "[0-9]+\\(?:\\.[0-9]+\\)+" " "
249 "$Revision: 1.327.2.1 $") 250 "$Revision: 1.327.2.2 $")
250 "CVS revision of this file in the official version.") 251 "CVS revision of this file in the official version.")
251 252
252(defconst rst-version 253(defconst rst-version
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 67d7f8c01f9..46c65b25b37 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -34,7 +34,6 @@
34 34
35(eval-when-compile 35(eval-when-compile
36 (require 'skeleton) 36 (require 'skeleton)
37 (require 'outline)
38 (require 'cl-lib)) 37 (require 'cl-lib))
39 38
40(defgroup sgml nil 39(defgroup sgml nil
@@ -1938,6 +1937,10 @@ This takes effect when first loading the library.")
1938 ("wbr" . "Enable <br> within <nobr>")) 1937 ("wbr" . "Enable <br> within <nobr>"))
1939 "Value of `sgml-tag-help' for HTML mode.") 1938 "Value of `sgml-tag-help' for HTML mode.")
1940 1939
1940(defvar outline-regexp)
1941(defvar outline-heading-end-regexp)
1942(defvar outline-level)
1943
1941 1944
1942;;;###autoload 1945;;;###autoload
1943(define-derived-mode html-mode sgml-mode '(sgml-xml-mode "XHTML" "HTML") 1946(define-derived-mode html-mode sgml-mode '(sgml-xml-mode "XHTML" "HTML")
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 620a1da633e..a324daa9283 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -860,10 +860,6 @@ START is the position of the \\ and DELIM is the delimiter char."
860 (set-keymap-parent map text-mode-map) 860 (set-keymap-parent map text-mode-map)
861 (tex-define-common-keys map) 861 (tex-define-common-keys map)
862 (define-key map "\"" 'tex-insert-quote) 862 (define-key map "\"" 'tex-insert-quote)
863 (define-key map "(" 'skeleton-pair-insert-maybe)
864 (define-key map "{" 'skeleton-pair-insert-maybe)
865 (define-key map "[" 'skeleton-pair-insert-maybe)
866 (define-key map "$" 'skeleton-pair-insert-maybe)
867 (define-key map "\n" 'tex-terminate-paragraph) 863 (define-key map "\n" 'tex-terminate-paragraph)
868 (define-key map "\M-\r" 'latex-insert-item) 864 (define-key map "\M-\r" 'latex-insert-item)
869 (define-key map "\C-c}" 'up-list) 865 (define-key map "\C-c}" 'up-list)
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 30e5390a3e1..301f69f45be 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -80,18 +80,29 @@ Turning on Paragraph-Indent Text mode runs the normal hooks
80 :abbrev-table nil :syntax-table nil 80 :abbrev-table nil :syntax-table nil
81 (paragraph-indent-minor-mode)) 81 (paragraph-indent-minor-mode))
82 82
83(defun paragraph-indent-minor-mode () 83(define-minor-mode paragraph-indent-minor-mode
84 "Minor mode for editing text, with leading spaces starting a paragraph. 84 "Minor mode for editing text, with leading spaces starting a paragraph.
85In this mode, you do not need blank lines between paragraphs when the 85In this mode, you do not need blank lines between paragraphs when the
86first line of the following paragraph starts with whitespace, as with 86first line of the following paragraph starts with whitespace, as with
87`paragraph-indent-text-mode'. 87`paragraph-indent-text-mode'.
88Turning on Paragraph-Indent minor mode runs the normal hook 88Turning on Paragraph-Indent minor mode runs the normal hook
89`paragraph-indent-text-mode-hook'." 89`paragraph-indent-text-mode-hook'."
90 (interactive) 90 :initial-value nil
91 (set (make-local-variable 'paragraph-start) 91 ;; Change the definition of a paragraph start.
92 (concat "[ \t\n\f]\\|" paragraph-start)) 92 (let ((ps-re "[ \t\n\f]\\|"))
93 (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) 93 (if (eq t (compare-strings ps-re nil nil
94 (run-hooks 'paragraph-indent-text-mode-hook)) 94 paragraph-start nil (length ps-re)))
95 (if (not paragraph-indent-minor-mode)
96 (set (make-local-variable 'paragraph-start)
97 (substring paragraph-start (length ps-re))))
98 (if paragraph-indent-minor-mode
99 (set (make-local-variable 'paragraph-start)
100 (concat ps-re paragraph-start)))))
101 ;; Change the indentation function.
102 (if paragraph-indent-minor-mode
103 (set (make-local-variable 'indent-line-function) 'indent-to-left-margin)
104 (if (eq indent-line-function 'indent-to-left-margin)
105 (set (make-local-variable 'indent-line-function) 'indent-region))))
95 106
96(defalias 'indented-text-mode 'text-mode) 107(defalias 'indented-text-mode 'text-mode)
97 108
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 64879e5cfd5..6f76068ea9d 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -765,14 +765,13 @@ Run the Viper tutorial? "))
765 (funcall 'viper-tutorial 0)) 765 (funcall 'viper-tutorial 0))
766 (message "Tutorial aborted by user")) 766 (message "Tutorial aborted by user"))
767 (message prompt1))) 767 (message prompt1)))
768 (let* ((lang (if arg 768 (let* ((lang (cond
769 (let ((minibuffer-setup-hook minibuffer-setup-hook)) 769 (arg
770 (add-hook 'minibuffer-setup-hook 770 (minibuffer-with-setup-hook #'minibuffer-completion-help
771 'minibuffer-completion-help) 771 (read-language-name 'tutorial "Language: " "English")))
772 (read-language-name 'tutorial "Language: " "English")) 772 ((get-language-info current-language-environment 'tutorial)
773 (if (get-language-info current-language-environment 'tutorial) 773 current-language-environment)
774 current-language-environment 774 (t "English")))
775 "English")))
776 (filename (get-language-info lang 'tutorial)) 775 (filename (get-language-info lang 'tutorial))
777 (tut-buf-name filename) 776 (tut-buf-name filename)
778 (old-tut-buf (get-buffer tut-buf-name)) 777 (old-tut-buf (get-buffer tut-buf-name))
diff --git a/lisp/type-break.el b/lisp/type-break.el
index 8a95508d939..949b3b720a0 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -1,4 +1,4 @@
1;;; type-break.el --- encourage rests from typing at appropriate intervals 1;;; type-break.el --- encourage rests from typing at appropriate intervals -*- lexical-binding: t -*-
2 2
3;; Copyright (C) 1994-1995, 1997, 2000-2012 Free Software Foundation, Inc. 3;; Copyright (C) 1994-1995, 1997, 2000-2012 Free Software Foundation, Inc.
4 4
@@ -69,26 +69,11 @@
69 :prefix "type-break" 69 :prefix "type-break"
70 :group 'keyboard) 70 :group 'keyboard)
71 71
72;;;###autoload
73(defcustom type-break-mode nil
74 "Toggle typing break mode.
75See the docstring for the `type-break-mode' command for more information.
76Setting this variable directly does not take effect;
77use either \\[customize] or the function `type-break-mode'."
78 :set (lambda (_symbol value)
79 (type-break-mode (if value 1 -1)))
80 :initialize 'custom-initialize-default
81 :type 'boolean
82 :group 'type-break
83 :require 'type-break)
84
85;;;###autoload
86(defcustom type-break-interval (* 60 60) 72(defcustom type-break-interval (* 60 60)
87 "Number of seconds between scheduled typing breaks." 73 "Number of seconds between scheduled typing breaks."
88 :type 'integer 74 :type 'integer
89 :group 'type-break) 75 :group 'type-break)
90 76
91;;;###autoload
92(defcustom type-break-good-rest-interval (/ type-break-interval 6) 77(defcustom type-break-good-rest-interval (/ type-break-interval 6)
93 "Number of seconds of idle time considered to be an adequate typing rest. 78 "Number of seconds of idle time considered to be an adequate typing rest.
94 79
@@ -98,10 +83,10 @@ rest from typing, then the next typing break is simply rescheduled for later.
98 83
99If a break is interrupted before this much time elapses, the user will be 84If a break is interrupted before this much time elapses, the user will be
100asked whether or not really to interrupt the break." 85asked whether or not really to interrupt the break."
86 :set-after '(type-break-interval)
101 :type 'integer 87 :type 'integer
102 :group 'type-break) 88 :group 'type-break)
103 89
104;;;###autoload
105(defcustom type-break-good-break-interval nil 90(defcustom type-break-good-break-interval nil
106 "Number of seconds considered to be an adequate explicit typing rest. 91 "Number of seconds considered to be an adequate explicit typing rest.
107 92
@@ -112,7 +97,6 @@ break interruptions when `type-break-good-rest-interval' is nil."
112 :type 'integer 97 :type 'integer
113 :group 'type-break) 98 :group 'type-break)
114 99
115;;;###autoload
116(defcustom type-break-keystroke-threshold 100(defcustom type-break-keystroke-threshold
117 ;; Assuming typing speed is 35wpm (on the average, do you really 101 ;; Assuming typing speed is 35wpm (on the average, do you really
118 ;; type more than that in a minute? I spend a lot of time reading mail 102 ;; type more than that in a minute? I spend a lot of time reading mail
@@ -147,6 +131,7 @@ keystroke even though they really require multiple keys to generate them.
147 131
148The command `type-break-guesstimate-keystroke-threshold' can be used to 132The command `type-break-guesstimate-keystroke-threshold' can be used to
149guess a reasonably good pair of values for this variable." 133guess a reasonably good pair of values for this variable."
134 :set-after '(type-break-interval)
150 :type 'sexp 135 :type 'sexp
151 :group 'type-break) 136 :group 'type-break)
152 137
@@ -288,7 +273,7 @@ It will be either \"seconds\" or \"keystrokes\".")
288 273
289 274
290;;;###autoload 275;;;###autoload
291(defun type-break-mode (&optional prefix) 276(define-minor-mode type-break-mode
292 "Enable or disable typing-break mode. 277 "Enable or disable typing-break mode.
293This is a minor mode, but it is global to all buffers by default. 278This is a minor mode, but it is global to all buffers by default.
294 279
@@ -361,74 +346,61 @@ Finally, a file (named `type-break-file-name') is used to store information
361across Emacs sessions. This provides recovery of the break status between 346across Emacs sessions. This provides recovery of the break status between
362sessions and after a crash. Manual changes to the file may result in 347sessions and after a crash. Manual changes to the file may result in
363problems." 348problems."
364 (interactive "P") 349 :lighter type-break-mode-line-format
365 (type-break-check-post-command-hook) 350 :global t
366 351
367 (let ((already-enabled type-break-mode)) 352 (type-break-check-post-command-hook)
368 (setq type-break-mode (>= (prefix-numeric-value prefix) 0))
369 353
370 (cond 354 (cond
371 ((and already-enabled type-break-mode) 355 ;; ((and already-enabled type-break-mode)
372 (and (called-interactively-p 'interactive) 356 ;; (and (called-interactively-p 'interactive)
373 (message "Type Break mode is already enabled"))) 357 ;; (message "Type Break mode is already enabled")))
374 (type-break-mode 358 (type-break-mode
375 (when type-break-file-name 359 (when type-break-file-name
376 (with-current-buffer (find-file-noselect type-break-file-name 'nowarn) 360 (with-current-buffer (find-file-noselect type-break-file-name 'nowarn)
377 (setq buffer-save-without-query t))) 361 (setq buffer-save-without-query t)))
378 362
379 (or global-mode-string 363 (or global-mode-string (setq global-mode-string '(""))) ;FIXME: Why?
380 (setq global-mode-string '(""))) 364 (type-break-keystroke-reset)
381 (or (assq 'type-break-mode-line-message-mode 365 (type-break-mode-line-countdown-or-break nil)
382 minor-mode-alist) 366
383 (setq minor-mode-alist 367 (setq type-break-time-last-break
384 (cons type-break-mode-line-format 368 (or (type-break-get-previous-time)
385 minor-mode-alist))) 369 (current-time)))
386 (type-break-keystroke-reset) 370
387 (type-break-mode-line-countdown-or-break nil) 371 ;; Schedule according to break time from session file.
388 372 (type-break-schedule
389 (setq type-break-time-last-break 373 (let (diff)
390 (or (type-break-get-previous-time) 374 (if (and type-break-time-last-break
391 (current-time))) 375 (< (setq diff (type-break-time-difference
392 376 type-break-time-last-break
393 ;; schedule according to break time from session file 377 (current-time)))
394 (type-break-schedule 378 type-break-interval))
395 (let (diff) 379 ;; Use the file's value.
396 (if (and type-break-time-last-break 380 (progn
397 (< (setq diff (type-break-time-difference 381 (setq type-break-keystroke-count
398 type-break-time-last-break 382 (type-break-get-previous-count))
399 (current-time))) 383 ;; File the time, in case it was read from the auto-save file.
400 type-break-interval)) 384 (type-break-file-time type-break-interval-start)
401 ;; use the file's value 385 (setq type-break-interval-start type-break-time-last-break)
402 (progn 386 (- type-break-interval diff))
403 (setq type-break-keystroke-count 387 ;; Schedule from now.
404 (type-break-get-previous-count)) 388 (setq type-break-interval-start (current-time))
405 ;; file the time, in case it was read from the auto-save file 389 (type-break-file-time type-break-interval-start)
406 (type-break-file-time type-break-interval-start) 390 type-break-interval))
407 (setq type-break-interval-start type-break-time-last-break) 391 type-break-interval-start
408 (- type-break-interval diff)) 392 type-break-interval))
409 ;; schedule from now 393 (t
410 (setq type-break-interval-start (current-time)) 394 (type-break-keystroke-reset)
411 (type-break-file-time type-break-interval-start) 395 (type-break-mode-line-countdown-or-break nil)
412 type-break-interval)) 396 (type-break-cancel-schedule)
413 type-break-interval-start 397 (do-auto-save)
414 type-break-interval) 398 (when type-break-file-name
415 399 (with-current-buffer (find-file-noselect type-break-file-name
416 (and (called-interactively-p 'interactive) 400 'nowarn)
417 (message "Type Break mode is enabled and set"))) 401 (set-buffer-modified-p nil)
418 (t 402 (unlock-buffer)
419 (type-break-keystroke-reset) 403 (kill-this-buffer))))))
420 (type-break-mode-line-countdown-or-break nil)
421 (type-break-cancel-schedule)
422 (do-auto-save)
423 (when type-break-file-name
424 (with-current-buffer (find-file-noselect type-break-file-name
425 'nowarn)
426 (set-buffer-modified-p nil)
427 (unlock-buffer)
428 (kill-this-buffer)))
429 (and (called-interactively-p 'interactive)
430 (message "Type Break mode is disabled")))))
431 type-break-mode)
432 404
433(define-minor-mode type-break-mode-line-message-mode 405(define-minor-mode type-break-mode-line-message-mode
434 "Toggle warnings about typing breaks in the mode line. 406 "Toggle warnings about typing breaks in the mode line.
@@ -997,10 +969,11 @@ FRAC should be the inverse of the fractional value; for example, a value of
997;; "low" bits and format the time incorrectly. 969;; "low" bits and format the time incorrectly.
998(defun type-break-time-sum (&rest tmlist) 970(defun type-break-time-sum (&rest tmlist)
999 (let ((sum '(0 0 0))) 971 (let ((sum '(0 0 0)))
1000 (dolist (tem tmlist sum) 972 (dolist (tem tmlist)
1001 (setq sum (time-add sum (if (integerp tem) 973 (setq sum (time-add sum (if (integerp tem)
1002 (list (floor tem 65536) (mod tem 65536)) 974 (list (floor tem 65536) (mod tem 65536))
1003 tem)))))) 975 tem))))
976 sum))
1004 977
1005(defun type-break-time-stamp (&optional when) 978(defun type-break-time-stamp (&optional when)
1006 (if (fboundp 'format-time-string) 979 (if (fboundp 'format-time-string)
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index a72f12ccb9b..a00d748a4a4 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,22 @@
12012-09-30 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * url-handlers.el (url-file-handler): Don't assume any url-FOO function
4 is a good handler for FOO.
5 (url-copy-file, url-file-local-copy, url-insert-file-contents)
6 (url-file-name-completion, url-file-name-all-completions)
7 (url-handlers-create-wrapper): Explicitly register as handler.
8
92012-09-29 Bastien Guerry <bzg@gnu.org>
10
11 * url-util.el (url-insert-entities-in-string)
12 (url-build-query-string): Fix docstrings.
13
142012-09-25 Chong Yidong <cyd@gnu.org>
15
16 * url-parse.el (url-recreate-url-attributes):
17 * url-util.el (url-generate-unique-filename): Use declare to mark
18 obsolete.
19
12012-08-14 Stefan Monnier <monnier@iro.umontreal.ca> 202012-08-14 Stefan Monnier <monnier@iro.umontreal.ca>
2 21
3 * url-http.el (url-http-parse-headers): Re-enable file-name-handlers 22 * url-http.el (url-http-parse-headers): Re-enable file-name-handlers
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index f731f614d13..796980afbd5 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -137,11 +137,13 @@ like URLs \(Gnus is particularly bad at this\)."
137 "Function called from the `file-name-handler-alist' routines. 137 "Function called from the `file-name-handler-alist' routines.
138OPERATION is what needs to be done (`file-exists-p', etc). ARGS are 138OPERATION is what needs to be done (`file-exists-p', etc). ARGS are
139the arguments that would have been passed to OPERATION." 139the arguments that would have been passed to OPERATION."
140 (let ((fn (or (get operation 'url-file-handlers) 140 (let ((fn (get operation 'url-file-handlers))
141 (intern-soft (format "url-%s" operation))))
142 (val nil) 141 (val nil)
143 (hooked nil)) 142 (hooked nil))
144 (if (and fn (fboundp fn)) 143 (if (and (not fn) (intern-soft (format "url-%s" operation))
144 (fboundp (intern-soft (format "url-%s" operation))))
145 (error "Missing URL handler mapping for %s" operation))
146 (if fn
145 (setq hooked t 147 (setq hooked t
146 val (save-match-data (apply fn args))) 148 val (save-match-data (apply fn args)))
147 (setq hooked nil 149 (setq hooked nil
@@ -249,6 +251,7 @@ A prefix arg makes KEEP-TIME non-nil."
249 (mm-save-part-to-file handle newname) 251 (mm-save-part-to-file handle newname)
250 (kill-buffer buffer) 252 (kill-buffer buffer)
251 (mm-destroy-parts handle))) 253 (mm-destroy-parts handle)))
254(put 'copy-file 'url-file-handlers 'url-copy-file)
252 255
253;;;###autoload 256;;;###autoload
254(defun url-file-local-copy (url &rest ignored) 257(defun url-file-local-copy (url &rest ignored)
@@ -258,6 +261,7 @@ accessible."
258 (let ((filename (make-temp-file "url"))) 261 (let ((filename (make-temp-file "url")))
259 (url-copy-file url filename 'ok-if-already-exists) 262 (url-copy-file url filename 'ok-if-already-exists)
260 filename)) 263 filename))
264(put 'file-local-copy 'url-file-handlers 'url-file-local-copy)
261 265
262(defun url-insert (buffer &optional beg end) 266(defun url-insert (buffer &optional beg end)
263 "Insert the body of a URL object. 267 "Insert the body of a URL object.
@@ -300,22 +304,29 @@ They count bytes from the beginning of the body."
300 ;; usual heuristic/rules that we apply to files. 304 ;; usual heuristic/rules that we apply to files.
301 (decode-coding-inserted-region start (point) url visit beg end replace)) 305 (decode-coding-inserted-region start (point) url visit beg end replace))
302 (list url (car size-and-charset)))))) 306 (list url (car size-and-charset))))))
307(put 'insert-file-contents 'url-file-handlers 'url-insert-file-contents)
303 308
304(defun url-file-name-completion (url directory &optional predicate) 309(defun url-file-name-completion (url directory &optional predicate)
305 (error "Unimplemented")) 310 (error "Unimplemented"))
311(put 'file-name-completion 'url-file-handlers 'url-file-name-completion)
306 312
307(defun url-file-name-all-completions (file directory) 313(defun url-file-name-all-completions (file directory)
308 (error "Unimplemented")) 314 (error "Unimplemented"))
315(put 'file-name-all-completions
316 'url-file-handlers 'url-file-name-all-completions)
309 317
310;; All other handlers map onto their respective backends. 318;; All other handlers map onto their respective backends.
311(defmacro url-handlers-create-wrapper (method args) 319(defmacro url-handlers-create-wrapper (method args)
312 `(defun ,(intern (format "url-%s" method)) ,args 320 `(progn
313 ,(format "URL file-name-handler wrapper for `%s' call.\n---\n%s" method 321 (defun ,(intern (format "url-%s" method)) ,args
314 (or (documentation method t) "No original documentation.")) 322 ,(format "URL file-name-handler wrapper for `%s' call.\n---\n%s" method
315 (setq url (url-generic-parse-url url)) 323 (or (documentation method t) "No original documentation."))
316 (when (url-type url) 324 (setq url (url-generic-parse-url url))
317 (funcall (url-scheme-get-property (url-type url) (quote ,method)) 325 (when (url-type url)
318 ,@(remove '&rest (remove '&optional args)))))) 326 (funcall (url-scheme-get-property (url-type url) (quote ,method))
327 ,@(remove '&rest (remove '&optional args)))))
328 (unless (get ',method 'url-file-handlers)
329 (put ',method 'url-file-handlers ',(intern (format "url-%s" method))))))
319 330
320(url-handlers-create-wrapper file-exists-p (url)) 331(url-handlers-create-wrapper file-exists-p (url))
321(url-handlers-create-wrapper file-attributes (url &optional id-format)) 332(url-handlers-create-wrapper file-attributes (url &optional id-format))
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el
index 4007d1f35b3..cb61a021251 100644
--- a/lisp/url/url-parse.el
+++ b/lisp/url/url-parse.el
@@ -98,6 +98,7 @@ If the specified port number is the default, return nil."
98 98
99(defun url-recreate-url-attributes (urlobj) 99(defun url-recreate-url-attributes (urlobj)
100 "Recreate the attributes of an URL string from the parsed URLOBJ." 100 "Recreate the attributes of an URL string from the parsed URLOBJ."
101 (declare (obsolete nil "24.3"))
101 (when (url-attributes urlobj) 102 (when (url-attributes urlobj)
102 (concat ";" 103 (concat ";"
103 (mapconcat (lambda (x) 104 (mapconcat (lambda (x)
@@ -105,7 +106,6 @@ If the specified port number is the default, return nil."
105 (concat (car x) "=" (cdr x)) 106 (concat (car x) "=" (cdr x))
106 (car x))) 107 (car x)))
107 (url-attributes urlobj) ";")))) 108 (url-attributes urlobj) ";"))))
108(make-obsolete 'url-recreate-url-attributes nil "24.3")
109 109
110;;;###autoload 110;;;###autoload
111(defun url-generic-parse-url (url) 111(defun url-generic-parse-url (url)
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index f654830e387..038b7fcf7fe 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -132,8 +132,8 @@ If a list, it is a list of the types of messages to be logged."
132(defun url-insert-entities-in-string (string) 132(defun url-insert-entities-in-string (string)
133 "Convert HTML markup-start characters to entity references in STRING. 133 "Convert HTML markup-start characters to entity references in STRING.
134Also replaces the \" character, so that the result may be safely used as 134Also replaces the \" character, so that the result may be safely used as
135 an attribute value in a tag. Returns a new string with the result of the 135an attribute value in a tag. Returns a new string with the result of the
136 conversion. Replaces these characters as follows: 136conversion. Replaces these characters as follows:
137 & ==> &amp; 137 & ==> &amp;
138 < ==> &lt; 138 < ==> &lt;
139 > ==> &gt; 139 > ==> &gt;
@@ -294,7 +294,7 @@ Given a QUERY in the form:
294 (key2 val2) 294 (key2 val2)
295 (key3 val1 val2) 295 (key3 val1 val2)
296 (key4) 296 (key4)
297 (key5 "")) 297 (key5 \"\"))
298 298
299\(This is the same format as produced by `url-parse-query-string') 299\(This is the same format as produced by `url-parse-query-string')
300 300
@@ -593,6 +593,7 @@ Has a preference for looking backward when not directly on a symbol."
593 593
594(defun url-generate-unique-filename (&optional fmt) 594(defun url-generate-unique-filename (&optional fmt)
595 "Generate a unique filename in `url-temporary-directory'." 595 "Generate a unique filename in `url-temporary-directory'."
596 (declare (obsolete make-temp-file "23.1"))
596 ;; This variable is obsolete, but so is this function. 597 ;; This variable is obsolete, but so is this function.
597 (let ((tempdir (with-no-warnings url-temporary-directory))) 598 (let ((tempdir (with-no-warnings url-temporary-directory)))
598 (if (not fmt) 599 (if (not fmt)
@@ -614,7 +615,6 @@ Has a preference for looking backward when not directly on a symbol."
614 (setq x (1+ x) 615 (setq x (1+ x)
615 fname (format fmt (concat base (int-to-string x))))) 616 fname (format fmt (concat base (int-to-string x)))))
616 (expand-file-name fname tempdir))))) 617 (expand-file-name fname tempdir)))))
617(make-obsolete 'url-generate-unique-filename 'make-temp-file "23.1")
618 618
619(defun url-extract-mime-headers () 619(defun url-extract-mime-headers ()
620 "Set `url-current-mime-headers' in current buffer." 620 "Set `url-current-mime-headers' in current buffer."
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index 674688df1c2..2c41ce8c457 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -753,6 +753,7 @@ to temp files in buffer jobs and when Ediff needs to find fine differences."
753 "Check the current version against MAJOR and MINOR version numbers. 753 "Check the current version against MAJOR and MINOR version numbers.
754The comparison uses operator OP, which may be any of: =, >, >=, <, <=. 754The comparison uses operator OP, which may be any of: =, >, >=, <, <=.
755TYPE-OF-EMACS is either 'xemacs or 'emacs." 755TYPE-OF-EMACS is either 'xemacs or 'emacs."
756 (declare (obsolete version< "23.1"))
756 (and (cond ((eq type-of-emacs 'xemacs) (featurep 'xemacs)) 757 (and (cond ((eq type-of-emacs 'xemacs) (featurep 'xemacs))
757 ((eq type-of-emacs 'emacs) (featurep 'emacs)) 758 ((eq type-of-emacs 'emacs) (featurep 'emacs))
758 (t)) 759 (t))
@@ -767,9 +768,6 @@ TYPE-OF-EMACS is either 'xemacs or 'emacs."
767 (t 768 (t
768 (error "%S: Invalid op in ediff-check-version" op))))) 769 (error "%S: Invalid op in ediff-check-version" op)))))
769 770
770;; ediff-check-version seems to be totally unused anyway.
771(make-obsolete 'ediff-check-version 'version< "23.1")
772
773(defun ediff-color-display-p () 771(defun ediff-color-display-p ()
774 (condition-case nil 772 (condition-case nil
775 (if (featurep 'xemacs) 773 (if (featurep 'xemacs)
diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index 78a2163f653..86293ade580 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -1907,8 +1907,8 @@ in the specified buffer."
1907 1907
1908 (cond ((eq which-diff 'after) (1+ diff-no)) 1908 (cond ((eq which-diff 'after) (1+ diff-no))
1909 ((eq which-diff 'before) diff-no) 1909 ((eq which-diff 'before) diff-no)
1910 ((< (abs (count-lines pos (max 1 prev-end))) 1910 ((< (abs (count-lines pos (max (point-min) prev-end)))
1911 (abs (count-lines pos (max 1 beg)))) 1911 (abs (count-lines pos (max (point-min) beg))))
1912 diff-no) ; choose prev difference 1912 diff-no) ; choose prev difference
1913 (t 1913 (t
1914 (1+ diff-no))) ; choose next difference 1914 (1+ diff-no))) ; choose next difference
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index eee3f40fd96..d7118ad7970 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -63,13 +63,11 @@
63 63
64;; Determine which window setup function to use based on current window system. 64;; Determine which window setup function to use based on current window system.
65(defun ediff-choose-window-setup-function-automatically () 65(defun ediff-choose-window-setup-function-automatically ()
66 (declare (obsolete ediff-setup-windows-default "24.3"))
66 (if (ediff-window-display-p) 67 (if (ediff-window-display-p)
67 'ediff-setup-windows-multiframe 68 'ediff-setup-windows-multiframe
68 'ediff-setup-windows-plain)) 69 'ediff-setup-windows-plain))
69 70
70(make-obsolete 'ediff-choose-window-setup-function-automatically
71 'ediff-setup-windows-default "24.3")
72
73(defcustom ediff-window-setup-function 'ediff-setup-windows-default 71(defcustom ediff-window-setup-function 'ediff-setup-windows-default
74 "Function called to set up windows. 72 "Function called to set up windows.
75Ediff provides a choice of three functions: 73Ediff provides a choice of three functions:
diff --git a/lisp/vc/emerge.el b/lisp/vc/emerge.el
index f6942bc538d..0a1bd044125 100644
--- a/lisp/vc/emerge.el
+++ b/lisp/vc/emerge.el
@@ -76,18 +76,6 @@ Commands:
76Commands must be prefixed by \\<emerge-fast-keymap>\\[emerge-basic-keymap] in `edit' mode, 76Commands must be prefixed by \\<emerge-fast-keymap>\\[emerge-basic-keymap] in `edit' mode,
77but can be invoked directly in `fast' mode.") 77but can be invoked directly in `fast' mode.")
78 78
79(define-obsolete-variable-alias 'emerge-version 'emacs-version "23.2")
80
81(defun emerge-version ()
82 "Return string describing the version of Emerge.
83When called interactively, displays the version."
84 (interactive)
85 (if (called-interactively-p 'interactive)
86 (message "Emerge version %s" emacs-version)
87 emacs-version))
88
89(make-obsolete 'emerge-version 'emacs-version "23.2")
90
91;;; Emerge configuration variables 79;;; Emerge configuration variables
92 80
93(defgroup emerge nil 81(defgroup emerge nil
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 7ee000a8aea..932abb9818c 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -104,13 +104,7 @@ If 'changed, only request confirmation if the list of files has
104 :group 'log-edit 104 :group 'log-edit
105 :type 'boolean) 105 :type 'boolean)
106 106
107(defvar cvs-commit-buffer-require-final-newline t) 107(defcustom log-edit-require-final-newline t
108(make-obsolete-variable 'cvs-commit-buffer-require-final-newline
109 'log-edit-require-final-newline
110 "21.1")
111
112(defcustom log-edit-require-final-newline
113 cvs-commit-buffer-require-final-newline
114 "Enforce a newline at the end of commit log messages. 108 "Enforce a newline at the end of commit log messages.
115Enforce it silently if t, query if non-nil and don't do anything if nil." 109Enforce it silently if t, query if non-nil and don't do anything if nil."
116 :group 'log-edit 110 :group 'log-edit
@@ -154,12 +148,7 @@ can be obtained from `log-edit-files'."
154 :group 'log-edit 148 :group 'log-edit
155 :version "24.1") 149 :version "24.1")
156 150
157(defvar cvs-changelog-full-paragraphs t) 151(defvar log-edit-changelog-full-paragraphs t
158(make-obsolete-variable 'cvs-changelog-full-paragraphs
159 'log-edit-changelog-full-paragraphs
160 "21.1")
161
162(defvar log-edit-changelog-full-paragraphs cvs-changelog-full-paragraphs
163 "If non-nil, include full ChangeLog paragraphs in the log. 152 "If non-nil, include full ChangeLog paragraphs in the log.
164This may be set in the ``local variables'' section of a ChangeLog, to 153This may be set in the ``local variables'' section of a ChangeLog, to
165indicate the policy for that ChangeLog. 154indicate the policy for that ChangeLog.
@@ -354,14 +343,17 @@ automatically."
354 `((log-edit-match-to-eoh 343 `((log-edit-match-to-eoh
355 (,(concat "^\\(\\([[:alpha:]]+\\):\\)" log-edit-header-contents-regexp) 344 (,(concat "^\\(\\([[:alpha:]]+\\):\\)" log-edit-header-contents-regexp)
356 (progn (goto-char (match-beginning 0)) (match-end 0)) nil 345 (progn (goto-char (match-beginning 0)) (match-end 0)) nil
357 (1 (if (assoc (match-string 2) log-edit-headers-alist) 346 (1 (if (assoc-string (match-string 2) log-edit-headers-alist t)
358 'log-edit-header 347 'log-edit-header
359 'log-edit-unknown-header) 348 'log-edit-unknown-header)
360 nil lax) 349 nil lax)
361 ;; From `log-edit-header-contents-regexp': 350 ;; From `log-edit-header-contents-regexp':
362 (3 (or (cdr (assoc (match-string 2) log-edit-headers-alist)) 351 (3 (or (cdr (assoc-string (match-string 2) log-edit-headers-alist t))
363 'log-edit-header) 352 'log-edit-header)
364 nil lax))))) 353 nil lax))
354 ("^\n"
355 (progn (goto-char (match-end 0)) (1+ (match-end 0))) nil
356 (0 '(:height 0.1 :inverse-video t))))))
365 357
366(defvar log-edit-font-lock-gnu-style nil 358(defvar log-edit-font-lock-gnu-style nil
367 "If non-nil, highlight common failures to follow the GNU coding standards.") 359 "If non-nil, highlight common failures to follow the GNU coding standards.")
@@ -585,7 +577,7 @@ If you want to abort the commit, simply delete the buffer."
585 (or (= (point-min) (point-max)) 577 (or (= (point-min) (point-max))
586 (save-excursion 578 (save-excursion
587 (goto-char (point-min)) 579 (goto-char (point-min))
588 (while (and (looking-at "^\\([a-zA-Z]+: \\)?$") 580 (while (and (looking-at "^\\([a-zA-Z]+: ?\\)?$")
589 (zerop (forward-line 1)))) 581 (zerop (forward-line 1))))
590 (eobp)))) 582 (eobp))))
591 583
@@ -818,7 +810,7 @@ where LOGBUFFER is the name of the ChangeLog buffer, and each
818 change-log-default-name) 810 change-log-default-name)
819 ;; `find-change-log' uses `change-log-default-name' if set 811 ;; `find-change-log' uses `change-log-default-name' if set
820 ;; and sets it before exiting, so we need to work around 812 ;; and sets it before exiting, so we need to work around
821 ;; that memoizing which is undesired here 813 ;; that memoizing which is undesired here.
822 (setq change-log-default-name nil) 814 (setq change-log-default-name nil)
823 (find-change-log))))) 815 (find-change-log)))))
824 (with-current-buffer (find-file-noselect changelog-file-name) 816 (with-current-buffer (find-file-noselect changelog-file-name)
diff --git a/lisp/vc/pcvs-defs.el b/lisp/vc/pcvs-defs.el
index fc65d62c67d..b3c1f8c1343 100644
--- a/lisp/vc/pcvs-defs.el
+++ b/lisp/vc/pcvs-defs.el
@@ -133,14 +133,9 @@ current line. See also `cvs-invert-ignore-marks'"
133 :group 'pcl-cvs 133 :group 'pcl-cvs
134 :type '(boolean)) 134 :type '(boolean))
135 135
136(defvar cvs-diff-ignore-marks t)
137(make-obsolete-variable 'cvs-diff-ignore-marks
138 'cvs-invert-ignore-marks
139 "21.1")
140
141(defcustom cvs-invert-ignore-marks 136(defcustom cvs-invert-ignore-marks
142 (let ((l ())) 137 (let ((l ()))
143 (unless (equal cvs-diff-ignore-marks cvs-default-ignore-marks) 138 (unless (equal cvs-default-ignore-marks t)
144 (push "diff" l)) 139 (push "diff" l))
145 (when (and cvs-force-dir-tag (not cvs-default-ignore-marks)) 140 (when (and cvs-force-dir-tag (not cvs-default-ignore-marks))
146 (push "tag" l)) 141 (push "tag" l))
@@ -171,11 +166,6 @@ If set to nil, `cvs-mode-add' will always prompt for a message."
171 :type '(choice (const :tag "Prompt" nil) 166 :type '(choice (const :tag "Prompt" nil)
172 (string))) 167 (string)))
173 168
174(defvar cvs-diff-buffer-name "*cvs-diff*")
175(make-obsolete-variable 'cvs-diff-buffer-name
176 'cvs-buffer-name-alist
177 "21.1")
178
179(defcustom cvs-find-file-and-jump nil 169(defcustom cvs-find-file-and-jump nil
180 "Jump to the modified area when finding a file. 170 "Jump to the modified area when finding a file.
181If non-nil, `cvs-mode-find-file' will place the cursor at the beginning of 171If non-nil, `cvs-mode-find-file' will place the cursor at the beginning of
@@ -185,7 +175,7 @@ have no effect."
185 :type '(boolean)) 175 :type '(boolean))
186 176
187(defcustom cvs-buffer-name-alist 177(defcustom cvs-buffer-name-alist
188 '(("diff" cvs-diff-buffer-name diff-mode) 178 '(("diff" "*cvs-diff*" diff-mode)
189 ("status" "*cvs-info*" cvs-status-mode) 179 ("status" "*cvs-info*" cvs-status-mode)
190 ("tree" "*cvs-info*" cvs-status-mode) 180 ("tree" "*cvs-info*" cvs-status-mode)
191 ("message" "*cvs-commit*" nil log-edit) 181 ("message" "*cvs-commit*" nil log-edit)
diff --git a/lisp/vc/pcvs-info.el b/lisp/vc/pcvs-info.el
index 36572640cfc..e863096d587 100644
--- a/lisp/vc/pcvs-info.el
+++ b/lisp/vc/pcvs-info.el
@@ -124,7 +124,7 @@ to confuse some users sometimes."
124(define-obsolete-face-alias 'cvs-marked-face 'cvs-marked "22.1") 124(define-obsolete-face-alias 'cvs-marked-face 'cvs-marked "22.1")
125 125
126(defface cvs-msg 126(defface cvs-msg
127 '((t (:slant italic))) 127 '((t :slant italic))
128 "PCL-CVS face used to highlight CVS messages." 128 "PCL-CVS face used to highlight CVS messages."
129 :group 'pcl-cvs) 129 :group 'pcl-cvs)
130(define-obsolete-face-alias 'cvs-msg-face 'cvs-msg "22.1") 130(define-obsolete-face-alias 'cvs-msg-face 'cvs-msg "22.1")
@@ -358,7 +358,7 @@ For use by the cookie package."
358 ;;(MOD-CONFLICT "Not Removed") 358 ;;(MOD-CONFLICT "Not Removed")
359 (`DEAD "") 359 (`DEAD "")
360 (_ (capitalize (symbol-name type))))) 360 (_ (capitalize (symbol-name type)))))
361 (face (let ((sym (intern 361 (face (let ((sym (intern-soft
362 (concat "cvs-fi-" 362 (concat "cvs-fi-"
363 (downcase (symbol-name type)) 363 (downcase (symbol-name type))
364 "-face")))) 364 "-face"))))
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 659151a31e9..4bc3eaf8c2c 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -60,8 +60,6 @@
60;; - rework the displaying of error messages. 60;; - rework the displaying of error messages.
61;; - allow to flush messages only 61;; - allow to flush messages only
62;; - allow to protect files like ChangeLog from flushing 62;; - allow to protect files like ChangeLog from flushing
63;; - automatically cvs-mode-insert files from find-file-hook
64;; (and don't flush them as long as they are visited)
65;; - query the user for cvs-get-marked (for some cmds or if nothing's selected) 63;; - query the user for cvs-get-marked (for some cmds or if nothing's selected)
66;; - don't return the first (resp last) FI if the cursor is before 64;; - don't return the first (resp last) FI if the cursor is before
67;; (resp after) it. 65;; (resp after) it.
@@ -877,7 +875,10 @@ RM-MSGS if non-nil means remove messages."
877 ;; remove entries 875 ;; remove entries
878 (`DEAD nil) 876 (`DEAD nil)
879 ;; handled also? 877 ;; handled also?
880 (`UP-TO-DATE (not rm-handled)) 878 (`UP-TO-DATE
879 (if (find-buffer-visiting (cvs-fileinfo->full-name fi))
880 t
881 (not rm-handled)))
881 ;; keep the rest 882 ;; keep the rest
882 (_ (not (run-hook-with-args-until-success 883 (_ (not (run-hook-with-args-until-success
883 'cvs-cleanup-functions fi)))))) 884 'cvs-cleanup-functions fi))))))
@@ -1617,7 +1618,8 @@ With prefix argument, prompt for cvs flags."
1617(defun-cvs-mode (cvs-mode-diff . DOUBLE) (flags) 1618(defun-cvs-mode (cvs-mode-diff . DOUBLE) (flags)
1618 "Diff the selected files against the repository. 1619 "Diff the selected files against the repository.
1619This command compares the files in your working area against the 1620This command compares the files in your working area against the
1620revision which they are based upon." 1621revision which they are based upon.
1622See also `cvs-diff-ignore-marks'."
1621 (interactive 1623 (interactive
1622 (list (cvs-add-branch-prefix 1624 (list (cvs-add-branch-prefix
1623 (cvs-add-secondary-branch-prefix 1625 (cvs-add-secondary-branch-prefix
@@ -2435,6 +2437,21 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
2435 2437
2436(add-hook 'after-save-hook 'cvs-mark-buffer-changed) 2438(add-hook 'after-save-hook 'cvs-mark-buffer-changed)
2437 2439
2440(defun cvs-insert-visited-file ()
2441 (let* ((file (expand-file-name buffer-file-name))
2442 (version (and (fboundp 'vc-backend)
2443 (eq (vc-backend file) 'CVS)
2444 (vc-working-revision file))))
2445 (when version
2446 (save-current-buffer
2447 (dolist (cvs-buf (buffer-list))
2448 (set-buffer cvs-buf)
2449 ;; look for a corresponding pcl-cvs buffer
2450 (when (and (eq major-mode 'cvs-mode)
2451 (string-prefix-p default-directory file))
2452 (cvs-insert-file file)))))))
2453
2454(add-hook 'find-file-hook 'cvs-insert-visited-file 'append)
2438 2455
2439(provide 'pcvs) 2456(provide 'pcvs)
2440 2457
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 1eb33776f6a..74a61548d8b 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -150,12 +150,6 @@ Use the current Bzr root directory as the ROOT argument to
150(defconst vc-bzr-admin-branchconf 150(defconst vc-bzr-admin-branchconf
151 (concat vc-bzr-admin-dirname "/branch/branch.conf")) 151 (concat vc-bzr-admin-dirname "/branch/branch.conf"))
152 152
153;;;###autoload (defun vc-bzr-registered (file)
154;;;###autoload (if (vc-find-root file vc-bzr-admin-checkout-format-file)
155;;;###autoload (progn
156;;;###autoload (load "vc-bzr")
157;;;###autoload (vc-bzr-registered file))))
158
159(defun vc-bzr-root (file) 153(defun vc-bzr-root (file)
160 "Return the root directory of the bzr repository containing FILE." 154 "Return the root directory of the bzr repository containing FILE."
161 ;; Cache technique copied from vc-arch.el. 155 ;; Cache technique copied from vc-arch.el.
@@ -291,6 +285,14 @@ in the repository root directory of FILE."
291 (message "Falling back on \"slow\" status detection (%S)" err) 285 (message "Falling back on \"slow\" status detection (%S)" err)
292 (vc-bzr-state file)))))) 286 (vc-bzr-state file))))))
293 287
288;; This is a cheap approximation that is autoloaded. If it finds a
289;; possible match it loads this file and runs the real function.
290;; It requires vc-bzr-admin-checkout-format-file to be autoloaded too.
291;;;###autoload (defun vc-bzr-registered (file)
292;;;###autoload (if (vc-find-root file vc-bzr-admin-checkout-format-file)
293;;;###autoload (progn
294;;;###autoload (load "vc-bzr")
295;;;###autoload (vc-bzr-registered file))))
294 296
295(defun vc-bzr-registered (file) 297(defun vc-bzr-registered (file)
296 "Return non-nil if FILE is registered with bzr." 298 "Return non-nil if FILE is registered with bzr."
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 54c33769267..cac3eb559a1 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -34,18 +34,6 @@
34 34
35;; Customization Variables (the rest is in vc.el) 35;; Customization Variables (the rest is in vc.el)
36 36
37(defvar vc-ignore-vc-files nil)
38(make-obsolete-variable 'vc-ignore-vc-files
39 "set `vc-handled-backends' to nil to disable VC."
40 "21.1")
41
42(defvar vc-master-templates ())
43(make-obsolete-variable 'vc-master-templates
44 "to define master templates for a given BACKEND, use
45vc-BACKEND-master-templates. To enable or disable VC for a given
46BACKEND, use `vc-handled-backends'."
47 "21.1")
48
49(defcustom vc-ignore-dir-regexp 37(defcustom vc-ignore-dir-regexp
50 ;; Stop SMB, automounter, AFS, and DFS host lookups. 38 ;; Stop SMB, automounter, AFS, and DFS host lookups.
51 locate-dominating-stop-dir-regexp 39 locate-dominating-stop-dir-regexp
@@ -586,16 +574,7 @@ If FILE is not registered, this function always returns nil."
586 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." 574 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates."
587 (let ((sym (vc-make-backend-sym backend 'master-templates))) 575 (let ((sym (vc-make-backend-sym backend 'master-templates)))
588 (unless (get backend 'vc-templates-grabbed) 576 (unless (get backend 'vc-templates-grabbed)
589 (put backend 'vc-templates-grabbed t) 577 (put backend 'vc-templates-grabbed t))
590 (set sym (append (delq nil
591 (mapcar
592 (lambda (template)
593 (and (consp template)
594 (eq (cdr template) backend)
595 (car template)))
596 (with-no-warnings
597 vc-master-templates)))
598 (symbol-value sym))))
599 (let ((result (vc-check-master-templates file (symbol-value sym)))) 578 (let ((result (vc-check-master-templates file (symbol-value sym))))
600 (if (stringp result) 579 (if (stringp result)
601 (vc-file-setprop file 'vc-name result) 580 (vc-file-setprop file 'vc-name result)
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index ecd7b826437..baaf0c3a926 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -89,6 +89,9 @@ to use --brief and sets this variable to remember whether it worked."
89 :type '(choice (const :tag "Work out" nil) (const yes) (const no)) 89 :type '(choice (const :tag "Work out" nil) (const yes) (const no))
90 :group 'vc-rcs) 90 :group 'vc-rcs)
91 91
92;; This needs to be autoloaded because vc-rcs-registered uses it (via
93;; vc-default-registered), and vc-hooks needs to be able to check
94;; for a registered backend without loading every backend.
92;;;###autoload 95;;;###autoload
93(defcustom vc-rcs-master-templates 96(defcustom vc-rcs-master-templates
94 (purecopy '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) 97 (purecopy '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s"))
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index a34222f7236..c4f6fd10bdb 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -74,6 +74,9 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches."
74 :version "24.1" ; no longer consult the obsolete vc-header-alist 74 :version "24.1" ; no longer consult the obsolete vc-header-alist
75 :group 'vc-sccs) 75 :group 'vc-sccs)
76 76
77;; This needs to be autoloaded because vc-sccs-registered uses it (via
78;; vc-default-registered), and vc-hooks needs to be able to check
79;; for a registered backend without loading every backend.
77;;;###autoload 80;;;###autoload
78(defcustom vc-sccs-master-templates 81(defcustom vc-sccs-master-templates
79 (purecopy '("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) 82 (purecopy '("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir))
@@ -106,11 +109,10 @@ For a description of possible values, see `vc-check-master-templates'."
106 109
107;; The autoload cookie below places vc-sccs-registered directly into 110;; The autoload cookie below places vc-sccs-registered directly into
108;; loaddefs.el, so that vc-sccs.el does not need to be loaded for 111;; loaddefs.el, so that vc-sccs.el does not need to be loaded for
109;; every file that is visited. The definition is repeated below 112;; every file that is visited.
110;; so that Help and etags can find it. 113;;;###autoload
111 114(progn
112;;;###autoload (defun vc-sccs-registered(f) (vc-default-registered 'SCCS f)) 115(defun vc-sccs-registered (f) (vc-default-registered 'SCCS f)))
113(defun vc-sccs-registered (f) (vc-default-registered 'SCCS f))
114 116
115(defun vc-sccs-state (file) 117(defun vc-sccs-state (file)
116 "SCCS-specific function to compute the version control state." 118 "SCCS-specific function to compute the version control state."
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 47800bd4aac..2da721b41d8 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -808,16 +808,6 @@ is sensitive to blank lines."
808 (string :tag "Comment End"))) 808 (string :tag "Comment End")))
809 :group 'vc) 809 :group 'vc)
810 810
811(defcustom vc-checkout-carefully (= (user-uid) 0)
812 "Non-nil means be extra-careful in checkout.
813Verify that the file really is not locked
814and that its contents match what the repository version says."
815 :type 'boolean
816 :group 'vc)
817(make-obsolete-variable 'vc-checkout-carefully
818 "the corresponding checks are always done now."
819 "21.1")
820
821 811
822;; Variables users don't need to see 812;; Variables users don't need to see
823 813
@@ -1115,24 +1105,27 @@ For old-style locking-based version control systems, like RCS:
1115 ;; Files have local changes 1105 ;; Files have local changes
1116 ((vc-compatible-state state 'edited) 1106 ((vc-compatible-state state 'edited)
1117 (let ((ready-for-commit files)) 1107 (let ((ready-for-commit files))
1118 ;; If files are edited but read-only, give user a chance to correct. 1108 ;; CVS, SVN and bzr don't care about read-only (bug#9781).
1119 (dolist (file files) 1109 ;; RCS does, SCCS might (someone should check...).
1120 ;; If committing a mix of removed and edited files, the 1110 (when (memq backend '(RCS SCCS))
1121 ;; fileset has state = 'edited. Rather than checking the 1111 ;; If files are edited but read-only, give user a chance to correct.
1122 ;; state of each individual file in the fileset, it seems 1112 (dolist (file files)
1123 ;; simplest to just check if the file exists. Bug#9781. 1113 ;; If committing a mix of removed and edited files, the
1124 (when (and (file-exists-p file) (not (file-writable-p file))) 1114 ;; fileset has state = 'edited. Rather than checking the
1125 ;; Make the file+buffer read-write. 1115 ;; state of each individual file in the fileset, it seems
1126 (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue? " file)) 1116 ;; simplest to just check if the file exists. Bug#9781.
1127 (error "Aborted")) 1117 (when (and (file-exists-p file) (not (file-writable-p file)))
1128 ;; Maybe we somehow lost permissions on the directory. 1118 ;; Make the file+buffer read-write.
1129 (condition-case nil 1119 (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue? " file))
1130 (set-file-modes file (logior (file-modes file) 128)) 1120 (error "Aborted"))
1131 (error (error "Unable to make file writable"))) 1121 ;; Maybe we somehow lost permissions on the directory.
1132 (let ((visited (get-file-buffer file))) 1122 (condition-case nil
1133 (when visited 1123 (set-file-modes file (logior (file-modes file) 128))
1134 (with-current-buffer visited 1124 (error (error "Unable to make file writable")))
1135 (read-only-mode -1)))))) 1125 (let ((visited (get-file-buffer file)))
1126 (when visited
1127 (with-current-buffer visited
1128 (read-only-mode -1)))))))
1136 ;; Allow user to revert files with no changes 1129 ;; Allow user to revert files with no changes
1137 (save-excursion 1130 (save-excursion
1138 (dolist (file files) 1131 (dolist (file files)
@@ -1516,8 +1509,9 @@ to override the value of `vc-diff-switches' and `diff-switches'."
1516 (when (listp switches) switches)))) 1509 (when (listp switches) switches))))
1517 1510
1518;; Old def for compatibility with Emacs-21.[123]. 1511;; Old def for compatibility with Emacs-21.[123].
1519(defmacro vc-diff-switches-list (backend) `(vc-switches ',backend 'diff)) 1512(defmacro vc-diff-switches-list (backend)
1520(make-obsolete 'vc-diff-switches-list 'vc-switches "22.1") 1513 (declare (obsolete vc-switches "22.1"))
1514 `(vc-switches ',backend 'diff))
1521 1515
1522(defun vc-diff-finish (buffer messages) 1516(defun vc-diff-finish (buffer messages)
1523 ;; The empty sync output case has already been handled, so the only 1517 ;; The empty sync output case has already been handled, so the only
diff --git a/lisp/view.el b/lisp/view.el
index 41cb9752288..7ed42bf7ddc 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -513,6 +513,7 @@ that can be added see the RETURN-TO-ALIST argument of the
513function `view-mode-exit'. If `view-return-to-alist' contains an 513function `view-mode-exit'. If `view-return-to-alist' contains an
514entry for the selected window, purge that entry from 514entry for the selected window, purge that entry from
515`view-return-to-alist' before adding ITEM." 515`view-return-to-alist' before adding ITEM."
516 (declare (obsolete "this function has no effect." "24.1"))
516 (with-current-buffer buffer 517 (with-current-buffer buffer
517 (when view-return-to-alist 518 (when view-return-to-alist
518 (let* ((list view-return-to-alist) 519 (let* ((list view-return-to-alist)
@@ -535,7 +536,6 @@ entry for the selected window, purge that entry from
535 (when item 536 (when item
536 (setq view-return-to-alist 537 (setq view-return-to-alist
537 (cons item view-return-to-alist))))) 538 (cons item view-return-to-alist)))))
538(make-obsolete 'view-return-to-alist-update "this function has no effect." "24.1")
539 539
540;;;###autoload 540;;;###autoload
541(defun view-mode-enter (&optional quit-restore exit-action) 541(defun view-mode-enter (&optional quit-restore exit-action)
diff --git a/lisp/window.el b/lisp/window.el
index 87817fb8773..811b1781b4c 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -84,7 +84,7 @@ This hook is run by `with-temp-buffer-window' with the buffer
84displayed and current and its window selected.") 84displayed and current and its window selected.")
85 85
86(defun temp-buffer-window-setup (buffer-or-name) 86(defun temp-buffer-window-setup (buffer-or-name)
87 "Set up temporary buffer specified by BUFFER-OR-NAME 87 "Set up temporary buffer specified by BUFFER-OR-NAME.
88Return the buffer." 88Return the buffer."
89 (let ((old-dir default-directory) 89 (let ((old-dir default-directory)
90 (buffer (get-buffer-create buffer-or-name))) 90 (buffer (get-buffer-create buffer-or-name)))
@@ -508,7 +508,7 @@ failed."
508 (window-make-atom (window-parent window)) 508 (window-make-atom (window-parent window))
509 ;; Display BUFFER in NEW and return NEW. 509 ;; Display BUFFER in NEW and return NEW.
510 (window--display-buffer 510 (window--display-buffer
511 buffer new 'window display-buffer-mark-dedicated)))) 511 buffer new 'window alist display-buffer-mark-dedicated))))
512 512
513(defun window--atom-check-1 (window) 513(defun window--atom-check-1 (window)
514 "Subroutine of `window--atom-check'." 514 "Subroutine of `window--atom-check'."
@@ -677,12 +677,6 @@ The new window automatically becomes the \"major\" side window on
677SIDE. Return the new window, nil if its creation window failed." 677SIDE. Return the new window, nil if its creation window failed."
678 (let* ((root (frame-root-window)) 678 (let* ((root (frame-root-window))
679 (left-or-right (memq side '(left right))) 679 (left-or-right (memq side '(left right)))
680 (size (or (assq 'size alist)
681 (/ (window-total-size (frame-root-window) left-or-right)
682 ;; By default use a fourth of the size of the
683 ;; frame's root window. This has to be made
684 ;; customizable via ALIST.
685 4)))
686 (major (window--major-side-window side)) 680 (major (window--major-side-window side))
687 (selected-window (selected-window)) 681 (selected-window (selected-window))
688 (on-side (cond 682 (on-side (cond
@@ -694,7 +688,7 @@ SIDE. Return the new window, nil if its creation window failed."
694 ;; parent window unless needed. 688 ;; parent window unless needed.
695 (window-combination-resize 'side) 689 (window-combination-resize 'side)
696 (window-combination-limit nil) 690 (window-combination-limit nil)
697 (new (split-window major (- size) on-side)) 691 (new (split-window major nil on-side))
698 fun) 692 fun)
699 (when new 693 (when new
700 ;; Initialize `window-side' parameter of new window to SIDE. 694 ;; Initialize `window-side' parameter of new window to SIDE.
@@ -705,8 +699,22 @@ SIDE. Return the new window, nil if its creation window failed."
705 ;; the new window is deleted, a side window on the opposite side 699 ;; the new window is deleted, a side window on the opposite side
706 ;; does not get resized. 700 ;; does not get resized.
707 (set-window-parameter new 'delete-window 'delete-side-window) 701 (set-window-parameter new 'delete-window 'delete-side-window)
702 ;; Auto-adjust height/width of new window unless a size has been
703 ;; explicitly requested.
704 (unless (if left-or-right
705 (cdr (assq 'window-width alist))
706 (cdr (assq 'window-height alist)))
707 (setq alist
708 (cons
709 (cons
710 (if left-or-right 'window-width 'window-height)
711 (/ (window-total-size (frame-root-window) left-or-right)
712 ;; By default use a fourth of the size of the
713 ;; frame's root window.
714 4))
715 alist)))
708 ;; Install BUFFER in new window and return NEW. 716 ;; Install BUFFER in new window and return NEW.
709 (window--display-buffer buffer new 'window 'side)))) 717 (window--display-buffer buffer new 'window alist 'side))))
710 718
711(defun delete-side-window (window) 719(defun delete-side-window (window)
712 "Delete side window WINDOW." 720 "Delete side window WINDOW."
@@ -814,7 +822,7 @@ following symbols can be used:
814 ;; ALIST (or, better, avoided in the "other" functions). 822 ;; ALIST (or, better, avoided in the "other" functions).
815 (or (and this-window 823 (or (and this-window
816 ;; Reuse `this-window'. 824 ;; Reuse `this-window'.
817 (window--display-buffer buffer this-window 'reuse 'side)) 825 (window--display-buffer buffer this-window 'reuse alist 'side))
818 (and (or (not max-slots) (< slots max-slots)) 826 (and (or (not max-slots) (< slots max-slots))
819 (or (and next-window 827 (or (and next-window
820 ;; Make new window before `next-window'. 828 ;; Make new window before `next-window'.
@@ -839,13 +847,14 @@ following symbols can be used:
839 window 'delete-window 'delete-side-window) 847 window 'delete-window 'delete-side-window)
840 window))) 848 window)))
841 (set-window-parameter window 'window-slot slot) 849 (set-window-parameter window 'window-slot slot)
842 (window--display-buffer buffer window 'window 'side)) 850 (window--display-buffer buffer window 'window alist 'side))
843 (and best-window 851 (and best-window
844 ;; Reuse `best-window'. 852 ;; Reuse `best-window'.
845 (progn 853 (progn
846 ;; Give best-window the new slot value. 854 ;; Give best-window the new slot value.
847 (set-window-parameter best-window 'window-slot slot) 855 (set-window-parameter best-window 'window-slot slot)
848 (window--display-buffer buffer best-window 'reuse 'side))))))))) 856 (window--display-buffer
857 buffer best-window 'reuse alist 'side)))))))))
849 858
850(defun window--side-check (&optional frame) 859(defun window--side-check (&optional frame)
851 "Check the side window configuration of FRAME. 860 "Check the side window configuration of FRAME.
@@ -903,7 +912,7 @@ of all windows on FRAME to nil."
903 (if right (throw 'reset t) (setq right t))) 912 (if right (throw 'reset t) (setq right t)))
904 ((eq side 'bottom) 913 ((eq side 'bottom)
905 (if bottom (throw 'reset t) (setq bottom t))) 914 (if bottom (throw 'reset t) (setq bottom t)))
906 (t 915 (t
907 (throw 'reset t)))) 916 (throw 'reset t))))
908 frame t)) 917 frame t))
909 ;; If there's a side window, there must be at least one 918 ;; If there's a side window, there must be at least one
@@ -2079,9 +2088,9 @@ preferably only resize windows adjacent to EDGE.
2079Return the symbol `normalized' if new normal sizes have been 2088Return the symbol `normalized' if new normal sizes have been
2080already set by this routine." 2089already set by this routine."
2081 (let* ((first (window-child parent)) 2090 (let* ((first (window-child parent))
2082 (sub first) 2091 (last (window-last-child parent))
2083 (parent-total (+ (window-total-size parent horizontal) delta)) 2092 (parent-total (+ (window-total-size parent horizontal) delta))
2084 best-window best-value) 2093 sub best-window best-value)
2085 2094
2086 (if (and edge (memq trail '(before after)) 2095 (if (and edge (memq trail '(before after))
2087 (progn 2096 (progn
@@ -2125,7 +2134,7 @@ already set by this routine."
2125 ;; normal sizes have been already set. 2134 ;; normal sizes have been already set.
2126 'normalized) 2135 'normalized)
2127 ;; Resize all windows proportionally. 2136 ;; Resize all windows proportionally.
2128 (setq sub first) 2137 (setq sub last)
2129 (while sub 2138 (while sub
2130 (cond 2139 (cond
2131 ((or (window--resize-child-windows-skip-p sub) 2140 ((or (window--resize-child-windows-skip-p sub)
@@ -2154,14 +2163,14 @@ already set by this routine."
2154 parent-total) 2163 parent-total)
2155 (window-normal-size sub horizontal))))) 2164 (window-normal-size sub horizontal)))))
2156 2165
2157 (setq sub (window-right sub))) 2166 (setq sub (window-left sub)))
2158 2167
2159 (cond 2168 (cond
2160 ((< delta 0) 2169 ((< delta 0)
2161 ;; Shrink windows by delta. 2170 ;; Shrink windows by delta.
2162 (setq best-window t) 2171 (setq best-window t)
2163 (while (and best-window (not (zerop delta))) 2172 (while (and best-window (not (zerop delta)))
2164 (setq sub first) 2173 (setq sub last)
2165 (setq best-window nil) 2174 (setq best-window nil)
2166 (setq best-value most-negative-fixnum) 2175 (setq best-value most-negative-fixnum)
2167 (while sub 2176 (while sub
@@ -2171,7 +2180,7 @@ already set by this routine."
2171 (setq best-window sub) 2180 (setq best-window sub)
2172 (setq best-value (cdr (window-new-normal sub)))) 2181 (setq best-value (cdr (window-new-normal sub))))
2173 2182
2174 (setq sub (window-right sub))) 2183 (setq sub (window-left sub)))
2175 2184
2176 (when best-window 2185 (when best-window
2177 (setq delta (1+ delta))) 2186 (setq delta (1+ delta)))
@@ -2188,7 +2197,7 @@ already set by this routine."
2188 ;; Enlarge windows by delta. 2197 ;; Enlarge windows by delta.
2189 (setq best-window t) 2198 (setq best-window t)
2190 (while (and best-window (not (zerop delta))) 2199 (while (and best-window (not (zerop delta)))
2191 (setq sub first) 2200 (setq sub last)
2192 (setq best-window nil) 2201 (setq best-window nil)
2193 (setq best-value most-positive-fixnum) 2202 (setq best-value most-positive-fixnum)
2194 (while sub 2203 (while sub
@@ -2197,7 +2206,7 @@ already set by this routine."
2197 (setq best-window sub) 2206 (setq best-window sub)
2198 (setq best-value (window-new-normal sub))) 2207 (setq best-value (window-new-normal sub)))
2199 2208
2200 (setq sub (window-right sub))) 2209 (setq sub (window-left sub)))
2201 2210
2202 (when best-window 2211 (when best-window
2203 (setq delta (1- delta))) 2212 (setq delta (1- delta)))
@@ -2209,7 +2218,7 @@ already set by this routine."
2209 (window-normal-size best-window horizontal)))))) 2218 (window-normal-size best-window horizontal))))))
2210 2219
2211 (when best-window 2220 (when best-window
2212 (setq sub first) 2221 (setq sub last)
2213 (while sub 2222 (while sub
2214 (when (or (consp (window-new-normal sub)) 2223 (when (or (consp (window-new-normal sub))
2215 (numberp (window-new-normal sub))) 2224 (numberp (window-new-normal sub)))
@@ -2227,7 +2236,7 @@ already set by this routine."
2227 ;; recursively even if it's size does not change. 2236 ;; recursively even if it's size does not change.
2228 (window--resize-this-window 2237 (window--resize-this-window
2229 sub delta horizontal ignore nil trail edge)))) 2238 sub delta horizontal ignore nil trail edge))))
2230 (setq sub (window-right sub))))))) 2239 (setq sub (window-left sub)))))))
2231 2240
2232(defun window--resize-siblings (window delta &optional horizontal ignore trail edge) 2241(defun window--resize-siblings (window delta &optional horizontal ignore trail edge)
2233 "Resize other windows when WINDOW is resized vertically by DELTA lines. 2242 "Resize other windows when WINDOW is resized vertically by DELTA lines.
@@ -2406,27 +2415,33 @@ Return the number of lines that were recovered.
2406This function is only called by the minibuffer window resizing 2415This function is only called by the minibuffer window resizing
2407routines. It resizes windows proportionally and never deletes 2416routines. It resizes windows proportionally and never deletes
2408any windows." 2417any windows."
2409 (when (numberp delta) 2418 (let ((frame (window-frame window))
2410 (let (ignore) 2419 ignore)
2411 (cond 2420 (cond
2412 ((< delta 0) 2421 ((not (numberp delta))
2413 (setq delta (window-sizable window delta))) 2422 (setq delta 0))
2414 ((> delta 0) 2423 ((zerop delta))
2415 (unless (window-sizable window delta) 2424 ((< delta 0)
2416 (setq ignore t)))) 2425 (setq delta (window-sizable window delta))
2417 2426 (window--resize-reset frame)
2418 (window--resize-reset (window-frame window)) 2427 ;; When shrinking the root window, emulate an edge drag in order
2419 ;; Ideally, we would resize just the last window in a combination 2428 ;; to not resize other windows if we can avoid it (Bug#12419).
2420 ;; but that's not feasible for the following reason: If we grow 2429 (window--resize-this-window
2421 ;; the minibuffer window and the last window cannot be shrunk any 2430 window delta nil ignore t 'before
2422 ;; more, we shrink another window instead. But if we then shrink 2431 (+ (window-top-line window) (window-total-size window)))
2423 ;; the minibuffer window again, the last window might get enlarged 2432 ;; Don't record new normal sizes to make sure that shrinking back
2424 ;; and the state after shrinking is not the state before growing. 2433 ;; proportionally works as intended.
2425 ;; So, in practice, we'd need a history variable to record how to 2434 (walk-window-tree
2426 ;; proceed. But I'm not sure how such a variable could work with 2435 (lambda (window) (set-window-new-normal window 'ignore)) frame t))
2427 ;; repeated minibuffer window growing steps. 2436 ((> delta 0)
2428 (window--resize-this-window window delta nil ignore t) 2437 (window--resize-reset frame)
2429 delta))) 2438 (unless (window-sizable window delta)
2439 (setq ignore t))
2440 ;; When growing the root window, resize proportionally. This
2441 ;; should give windows back their original sizes (hopefully).
2442 (window--resize-this-window window delta nil ignore t)))
2443 ;; Return the possibly adjusted DELTA.
2444 delta))
2430 2445
2431(defun adjust-window-trailing-edge (window delta &optional horizontal) 2446(defun adjust-window-trailing-edge (window delta &optional horizontal)
2432 "Move WINDOW's bottom edge by DELTA lines. 2447 "Move WINDOW's bottom edge by DELTA lines.
@@ -5071,7 +5086,7 @@ split."
5071 (with-selected-window window 5086 (with-selected-window window
5072 (split-window-below)))))))) 5087 (split-window-below))))))))
5073 5088
5074(defun window--try-to-split-window (window) 5089(defun window--try-to-split-window (window &optional alist)
5075 "Try to split WINDOW. 5090 "Try to split WINDOW.
5076Return value returned by `split-window-preferred-function' if it 5091Return value returned by `split-window-preferred-function' if it
5077represents a live window, nil otherwise." 5092represents a live window, nil otherwise."
@@ -5079,9 +5094,14 @@ represents a live window, nil otherwise."
5079 (not (frame-parameter (window-frame window) 'unsplittable)) 5094 (not (frame-parameter (window-frame window) 'unsplittable))
5080 (let* ((window-combination-limit 5095 (let* ((window-combination-limit
5081 ;; When `window-combination-limit' equals 5096 ;; When `window-combination-limit' equals
5082 ;; `display-buffer' bind it to t so resizing steals 5097 ;; `display-buffer' or equals `resize-window' and a
5083 ;; space preferably from the window that was split. 5098 ;; `window-height' or `window-width' alist entry are
5084 (if (eq window-combination-limit 'display-buffer) 5099 ;; present, bind it to t so resizing steals space
5100 ;; preferably from the window that was split.
5101 (if (or (eq window-combination-limit 'display-buffer)
5102 (and (eq window-combination-limit 'window-size)
5103 (or (cdr (assq 'window-height alist))
5104 (cdr (assq 'window-width alist)))))
5085 t 5105 t
5086 window-combination-limit)) 5106 window-combination-limit))
5087 (new-window 5107 (new-window
@@ -5138,7 +5158,7 @@ is higher than WINDOW."
5138 (/ (- (window-total-height window) (window-total-height)) 2)) 5158 (/ (- (window-total-height window) (window-total-height)) 2))
5139 (error nil)))) 5159 (error nil))))
5140 5160
5141(defun window--display-buffer (buffer window type &optional dedicated) 5161(defun window--display-buffer (buffer window type &optional alist dedicated)
5142 "Display BUFFER in WINDOW and make its frame visible. 5162 "Display BUFFER in WINDOW and make its frame visible.
5143TYPE must be one of the symbols `reuse', `window' or `frame' and 5163TYPE must be one of the symbols `reuse', `window' or `frame' and
5144is passed unaltered to `display-buffer-record-window'. Set 5164is passed unaltered to `display-buffer-record-window'. Set
@@ -5153,6 +5173,58 @@ BUFFER and WINDOW are live."
5153 (set-window-dedicated-p window dedicated)) 5173 (set-window-dedicated-p window dedicated))
5154 (when (memq type '(window frame)) 5174 (when (memq type '(window frame))
5155 (set-window-prev-buffers window nil))) 5175 (set-window-prev-buffers window nil)))
5176 (let ((parameter (window-parameter window 'quit-restore))
5177 (height (cdr (assq 'window-height alist)))
5178 (width (cdr (assq 'window-width alist))))
5179 (when (or (memq type '(window frame))
5180 (and (eq (car parameter) 'same)
5181 (memq (nth 1 parameter) '(window frame))))
5182 ;; Adjust height of new window or frame.
5183 (cond
5184 ((not height))
5185 ((numberp height)
5186 (let* ((new-height
5187 (if (integerp height)
5188 height
5189 (round
5190 (* (window-total-size (frame-root-window window))
5191 height))))
5192 (delta (- new-height (window-total-size window))))
5193 (cond
5194 ((and (window--resizable-p window delta nil 'safe)
5195 (window-combined-p window))
5196 (window-resize window delta nil 'safe))
5197 ((or (eq type 'frame)
5198 (and (eq (car parameter) 'same)
5199 (eq (nth 1 parameter) 'frame)))
5200 (set-frame-height
5201 (window-frame window)
5202 (+ (frame-height (window-frame window)) delta))))))
5203 ((functionp height)
5204 (ignore-errors (funcall height window))))
5205 ;; Adjust width of a window or frame.
5206 (cond
5207 ((not width))
5208 ((numberp width)
5209 (let* ((new-width
5210 (if (integerp width)
5211 width
5212 (round
5213 (* (window-total-size (frame-root-window window) t)
5214 width))))
5215 (delta (- new-width (window-total-size window t))))
5216 (cond
5217 ((and (window--resizable-p window delta t 'safe)
5218 (window-combined-p window t))
5219 (window-resize window delta t 'safe))
5220 ((or (eq type 'frame)
5221 (and (eq (car parameter) 'same)
5222 (eq (nth 1 parameter) 'frame)))
5223 (set-frame-width
5224 (window-frame window)
5225 (+ (frame-width (window-frame window)) delta))))))
5226 ((functionp width)
5227 (ignore-errors (funcall width window))))))
5156 window)) 5228 window))
5157 5229
5158(defun window--maybe-raise-frame (frame) 5230(defun window--maybe-raise-frame (frame)
@@ -5394,7 +5466,7 @@ selected window."
5394 (unless (or (cdr (assq 'inhibit-same-window alist)) 5466 (unless (or (cdr (assq 'inhibit-same-window alist))
5395 (window-minibuffer-p) 5467 (window-minibuffer-p)
5396 (window-dedicated-p)) 5468 (window-dedicated-p))
5397 (window--display-buffer buffer (selected-window) 'reuse))) 5469 (window--display-buffer buffer (selected-window) 'reuse alist)))
5398 5470
5399(defun display-buffer--maybe-same-window (buffer alist) 5471(defun display-buffer--maybe-same-window (buffer alist)
5400 "Conditionally display BUFFER in the selected window. 5472 "Conditionally display BUFFER in the selected window.
@@ -5442,7 +5514,7 @@ that frame."
5442 (get-buffer-window-list buffer 'nomini 5514 (get-buffer-window-list buffer 'nomini
5443 frames)))))) 5515 frames))))))
5444 (when (window-live-p window) 5516 (when (window-live-p window)
5445 (prog1 (window--display-buffer buffer window 'reuse) 5517 (prog1 (window--display-buffer buffer window 'reuse alist)
5446 (unless (cdr (assq 'inhibit-switch-frame alist)) 5518 (unless (cdr (assq 'inhibit-switch-frame alist))
5447 (window--maybe-raise-frame (window-frame window))))))) 5519 (window--maybe-raise-frame (window-frame window)))))))
5448 5520
@@ -5479,8 +5551,8 @@ new frame."
5479 (when (and fun 5551 (when (and fun
5480 (setq frame (funcall fun)) 5552 (setq frame (funcall fun))
5481 (setq window (frame-selected-window frame))) 5553 (setq window (frame-selected-window frame)))
5482 (prog1 (window--display-buffer buffer window 5554 (prog1 (window--display-buffer
5483 'frame display-buffer-mark-dedicated) 5555 buffer window 'frame alist display-buffer-mark-dedicated)
5484 (unless (cdr (assq 'inhibit-switch-frame alist)) 5556 (unless (cdr (assq 'inhibit-switch-frame alist))
5485 (window--maybe-raise-frame frame)))))) 5557 (window--maybe-raise-frame frame))))))
5486 5558
@@ -5505,11 +5577,11 @@ raising the frame."
5505 (not (frame-parameter frame 'unsplittable)))) 5577 (not (frame-parameter frame 'unsplittable))))
5506 ;; Attempt to split largest or least recently used window. 5578 ;; Attempt to split largest or least recently used window.
5507 (setq window (or (window--try-to-split-window 5579 (setq window (or (window--try-to-split-window
5508 (get-largest-window frame t)) 5580 (get-largest-window frame t) alist)
5509 (window--try-to-split-window 5581 (window--try-to-split-window
5510 (get-lru-window frame t))))) 5582 (get-lru-window frame t) alist))))
5511 (prog1 (window--display-buffer buffer window 5583 (prog1 (window--display-buffer
5512 'window display-buffer-mark-dedicated) 5584 buffer window 'window alist display-buffer-mark-dedicated)
5513 (unless (cdr (assq 'inhibit-switch-frame alist)) 5585 (unless (cdr (assq 'inhibit-switch-frame alist))
5514 (window--maybe-raise-frame (window-frame window))))))) 5586 (window--maybe-raise-frame (window-frame window)))))))
5515 5587
@@ -5528,21 +5600,21 @@ again with `display-buffer-pop-up-window'."
5528 (and pop-up-windows 5600 (and pop-up-windows
5529 (display-buffer-pop-up-window buffer alist)))) 5601 (display-buffer-pop-up-window buffer alist))))
5530 5602
5531(defun display-buffer-below-selected (buffer _alist) 5603(defun display-buffer-below-selected (buffer alist)
5532 "Try displaying BUFFER in a window below the selected window. 5604 "Try displaying BUFFER in a window below the selected window.
5533This either splits the selected window or reuses the window below 5605This either splits the selected window or reuses the window below
5534the selected one." 5606the selected one."
5535 (let (window) 5607 (let (window)
5536 (or (and (not (frame-parameter nil 'unsplittable)) 5608 (or (and (not (frame-parameter nil 'unsplittable))
5537 (setq window (window--try-to-split-window (selected-window))) 5609 (setq window (window--try-to-split-window (selected-window) alist))
5538 (window--display-buffer 5610 (window--display-buffer
5539 buffer window 'window display-buffer-mark-dedicated)) 5611 buffer window 'window alist display-buffer-mark-dedicated))
5540 (and (setq window (window-in-direction 'below)) 5612 (and (setq window (window-in-direction 'below))
5541 (not (window-dedicated-p window)) 5613 (not (window-dedicated-p window))
5542 (window--display-buffer 5614 (window--display-buffer
5543 buffer window 'reuse display-buffer-mark-dedicated))))) 5615 buffer window 'reuse alist display-buffer-mark-dedicated)))))
5544 5616
5545(defun display-buffer-at-bottom (buffer _alist) 5617(defun display-buffer-at-bottom (buffer alist)
5546 "Try displaying BUFFER in a window at the botom of the selected frame. 5618 "Try displaying BUFFER in a window at the botom of the selected frame.
5547This either splits the window at the bottom of the frame or the 5619This either splits the window at the bottom of the frame or the
5548frame's root window, or reuses an existing window at the bottom 5620frame's root window, or reuses an existing window at the bottom
@@ -5550,20 +5622,20 @@ of the selected frame."
5550 (let (bottom-window window) 5622 (let (bottom-window window)
5551 (walk-window-tree (lambda (window) (setq bottom-window window))) 5623 (walk-window-tree (lambda (window) (setq bottom-window window)))
5552 (or (and (not (frame-parameter nil 'unsplittable)) 5624 (or (and (not (frame-parameter nil 'unsplittable))
5553 (setq window (window--try-to-split-window bottom-window)) 5625 (setq window (window--try-to-split-window bottom-window alist))
5554 (window--display-buffer 5626 (window--display-buffer
5555 buffer window 'window display-buffer-mark-dedicated)) 5627 buffer window 'window alist display-buffer-mark-dedicated))
5556 (and (not (frame-parameter nil 'unsplittable)) 5628 (and (not (frame-parameter nil 'unsplittable))
5557 (setq window 5629 (setq window
5558 (condition-case nil 5630 (condition-case nil
5559 (split-window (frame-root-window)) 5631 (split-window (frame-root-window))
5560 (error nil))) 5632 (error nil)))
5561 (window--display-buffer 5633 (window--display-buffer
5562 buffer window 'window display-buffer-mark-dedicated)) 5634 buffer window 'window alist display-buffer-mark-dedicated))
5563 (and (setq window bottom-window) 5635 (and (setq window bottom-window)
5564 (not (window-dedicated-p window)) 5636 (not (window-dedicated-p window))
5565 (window--display-buffer 5637 (window--display-buffer
5566 buffer window 'reuse display-buffer-mark-dedicated))))) 5638 buffer window 'reuse alist display-buffer-mark-dedicated)))))
5567 5639
5568(defun display-buffer-in-previous-window (buffer alist) 5640(defun display-buffer-in-previous-window (buffer alist)
5569 "Display BUFFER in a window previously showing it. 5641 "Display BUFFER in a window previously showing it.
@@ -5619,7 +5691,7 @@ above, even if that window never showed BUFFER before."
5619 (setq best-window window))) 5691 (setq best-window window)))
5620 ;; Return best or second best window found. 5692 ;; Return best or second best window found.
5621 (when (setq window (or best-window second-best-window)) 5693 (when (setq window (or best-window second-best-window))
5622 (window--display-buffer buffer window 'reuse)))) 5694 (window--display-buffer buffer window 'reuse alist))))
5623 5695
5624(defun display-buffer-use-some-window (buffer alist) 5696(defun display-buffer-use-some-window (buffer alist)
5625 "Display BUFFER in an existing window. 5697 "Display BUFFER in an existing window.
@@ -5647,7 +5719,7 @@ that frame."
5647 (get-largest-window 0 not-this-window)))) 5719 (get-largest-window 0 not-this-window))))
5648 (when (window-live-p window) 5720 (when (window-live-p window)
5649 (prog1 5721 (prog1
5650 (window--display-buffer buffer window 'reuse) 5722 (window--display-buffer buffer window 'reuse alist)
5651 (window--even-window-heights window) 5723 (window--even-window-heights window)
5652 (unless (cdr (assq 'inhibit-switch-frame alist)) 5724 (unless (cdr (assq 'inhibit-switch-frame alist))
5653 (window--maybe-raise-frame (window-frame window))))))) 5725 (window--maybe-raise-frame (window-frame window)))))))
@@ -5917,6 +5989,97 @@ WINDOW must be a live window and defaults to the selected one."
5917 window)))) 5989 window))))
5918 5990
5919;;; Resizing buffers to fit their contents exactly. 5991;;; Resizing buffers to fit their contents exactly.
5992(defcustom fit-frame-to-buffer nil
5993 "Non-nil means `fit-window-to-buffer' can resize frames.
5994A frame can be resized if and only if its root window is a live
5995window. The height of the root window is subject to the values
5996of `fit-frame-to-buffer-max-height' and `window-min-height'."
5997 :type 'boolean
5998 :version "24.2"
5999 :group 'help)
6000
6001(defcustom fit-frame-to-buffer-bottom-margin 4
6002 "Bottom margin for `fit-frame-to-buffer'.
6003This is the number of lines `fit-frame-to-buffer' leaves free at the
6004bottom of the display in order to not obscure the system task bar."
6005 :type 'integer
6006 :version "24.2"
6007 :group 'windows)
6008
6009(defun fit-frame-to-buffer (&optional frame max-height min-height)
6010 "Adjust height of FRAME to display its buffer's contents exactly.
6011FRAME can be any live frame and defaults to the selected one.
6012
6013Optional argument MAX-HEIGHT specifies the maximum height of
6014FRAME and defaults to the height of the display below the current
6015top line of FRAME minus FIT-FRAME-TO-BUFFER-BOTTOM-MARGIN.
6016Optional argument MIN-HEIGHT specifies the minimum height of
6017FRAME."
6018 (interactive)
6019 (setq frame (window-normalize-frame frame))
6020 (let* ((root (frame-root-window frame))
6021 (frame-min-height
6022 (+ (- (frame-height frame) (window-total-size root))
6023 window-min-height))
6024 (frame-top (frame-parameter frame 'top))
6025 (top (if (consp frame-top)
6026 (funcall (car frame-top) (cadr frame-top))
6027 frame-top))
6028 (frame-max-height
6029 (- (/ (- (x-display-pixel-height frame) top)
6030 (frame-char-height frame))
6031 fit-frame-to-buffer-bottom-margin))
6032 (compensate 0)
6033 delta)
6034 (when (and (window-live-p root) (not (window-size-fixed-p root)))
6035 (with-selected-window root
6036 (cond
6037 ((not max-height)
6038 (setq max-height frame-max-height))
6039 ((numberp max-height)
6040 (setq max-height (min max-height frame-max-height)))
6041 (t
6042 (error "%s is an invalid maximum height" max-height)))
6043 (cond
6044 ((not min-height)
6045 (setq min-height frame-min-height))
6046 ((numberp min-height)
6047 (setq min-height (min min-height frame-min-height)))
6048 (t
6049 (error "%s is an invalid minimum height" min-height)))
6050 ;; When tool-bar-mode is enabled and we have just created a new
6051 ;; frame, reserve lines for toolbar resizing. This is needed
6052 ;; because for reasons unknown to me Emacs (1) reserves one line
6053 ;; for the toolbar when making the initial frame and toolbars
6054 ;; are enabled, and (2) later adds the remaining lines needed.
6055 ;; Our code runs IN BETWEEN (1) and (2). YMMV when you're on a
6056 ;; system that behaves differently.
6057 (let ((quit-restore (window-parameter root 'quit-restore))
6058 (lines (tool-bar-lines-needed frame)))
6059 (when (and quit-restore (eq (car quit-restore) 'frame)
6060 (not (zerop lines)))
6061 (setq compensate (1- lines))))
6062 (message "%s" compensate)
6063 (setq delta
6064 ;; Always count a final newline - we don't do any
6065 ;; post-processing, so let's play safe.
6066 (+ (count-screen-lines nil nil t)
6067 (- (window-body-size))
6068 compensate)))
6069 ;; Move away from final newline.
6070 (when (and (eobp) (bolp) (not (bobp)))
6071 (set-window-point root (line-beginning-position 0)))
6072 (set-window-start root (point-min))
6073 (set-window-vscroll root 0)
6074 (condition-case nil
6075 (set-frame-height
6076 frame
6077 (min (max (+ (frame-height frame) delta)
6078 min-height)
6079 max-height))
6080 (error (setq delta nil))))
6081 delta))
6082
5920(defun fit-window-to-buffer (&optional window max-height min-height) 6083(defun fit-window-to-buffer (&optional window max-height min-height)
5921 "Adjust height of WINDOW to display its buffer's contents exactly. 6084 "Adjust height of WINDOW to display its buffer's contents exactly.
5922WINDOW must be a live window and defaults to the selected one. 6085WINDOW must be a live window and defaults to the selected one.
@@ -5937,9 +6100,12 @@ _all_ lines of its buffer you might not see the first lines when
5937WINDOW was scrolled." 6100WINDOW was scrolled."
5938 (interactive) 6101 (interactive)
5939 (setq window (window-normalize-window window t)) 6102 (setq window (window-normalize-window window t))
5940 ;; Can't resize a full height or fixed-size window. 6103 (cond
5941 (unless (or (window-size-fixed-p window) 6104 ((window-size-fixed-p window))
5942 (window-full-height-p window)) 6105 ((window-full-height-p window)
6106 (when fit-frame-to-buffer
6107 (fit-frame-to-buffer (window-frame window))))
6108 (t
5943 (with-selected-window window 6109 (with-selected-window window
5944 (let* ((height (window-total-size)) 6110 (let* ((height (window-total-size))
5945 (min-height 6111 (min-height
@@ -5955,7 +6121,7 @@ WINDOW was scrolled."
5955 ;; Can't get larger than height of frame. 6121 ;; Can't get larger than height of frame.
5956 (min max-height 6122 (min max-height
5957 (window-total-size (frame-root-window window))) 6123 (window-total-size (frame-root-window window)))
5958 ;, Don't delete other windows. 6124 ;; Don't delete other windows.
5959 (+ height (window-max-delta nil nil window)))) 6125 (+ height (window-max-delta nil nil window))))
5960 ;; Make `desired-height' the height necessary to show 6126 ;; Make `desired-height' the height necessary to show
5961 ;; all of WINDOW's buffer, constrained by MIN-HEIGHT 6127 ;; all of WINDOW's buffer, constrained by MIN-HEIGHT
@@ -6018,89 +6184,7 @@ WINDOW was scrolled."
6018 (window-resize window 1 nil window) 6184 (window-resize window 1 nil window)
6019 (setq desired-height (1+ desired-height))))) 6185 (setq desired-height (1+ desired-height)))))
6020 (error (setq delta nil))) 6186 (error (setq delta nil)))
6021 delta)))) 6187 delta)))))
6022
6023(defcustom fit-frame-to-buffer-bottom-margin 4
6024 "Bottom margin for `fit-frame-to-buffer'.
6025This is the number of lines `fit-frame-to-buffer' leaves free at the
6026bottom of the display in order to not obscure the system task bar."
6027 :type 'integer
6028 :version "24.2"
6029 :group 'windows)
6030
6031(defun fit-frame-to-buffer (&optional frame max-height min-height)
6032 "Adjust height of FRAME to display its buffer's contents exactly.
6033FRAME can be any live frame and defaults to the selected one.
6034
6035Optional argument MAX-HEIGHT specifies the maximum height of
6036FRAME and defaults to the height of the display below the current
6037top line of FRAME minus FIT-FRAME-TO-BUFFER-BOTTOM-MARGIN.
6038Optional argument MIN-HEIGHT specifies the minimum height of
6039FRAME."
6040 (interactive)
6041 (setq frame (window-normalize-frame frame))
6042 (let* ((root (frame-root-window frame))
6043 (frame-min-height
6044 (+ (- (frame-height frame) (window-total-size root))
6045 window-min-height))
6046 (frame-top (frame-parameter frame 'top))
6047 (top (if (consp frame-top)
6048 (funcall (car frame-top) (cadr frame-top))
6049 frame-top))
6050 (frame-max-height
6051 (- (/ (- (x-display-pixel-height frame) top)
6052 (frame-char-height frame))
6053 fit-frame-to-buffer-bottom-margin))
6054 (compensate 0)
6055 delta)
6056 (when (and (window-live-p root) (not (window-size-fixed-p root)))
6057 (with-selected-window root
6058 (cond
6059 ((not max-height)
6060 (setq max-height frame-max-height))
6061 ((numberp max-height)
6062 (setq max-height (min max-height frame-max-height)))
6063 (t
6064 (error "%s is an invalid maximum height" max-height)))
6065 (cond
6066 ((not min-height)
6067 (setq min-height frame-min-height))
6068 ((numberp min-height)
6069 (setq min-height (min min-height frame-min-height)))
6070 (t
6071 (error "%s is an invalid minimum height" min-height)))
6072 ;; When tool-bar-mode is enabled and we have just created a new
6073 ;; frame, reserve lines for toolbar resizing. This is needed
6074 ;; because for reasons unknown to me Emacs (1) reserves one line
6075 ;; for the toolbar when making the initial frame and toolbars
6076 ;; are enabled, and (2) later adds the remaining lines needed.
6077 ;; Our code runs IN BETWEEN (1) and (2). YMMV when you're on a
6078 ;; system that behaves differently.
6079 (let ((quit-restore (window-parameter root 'quit-restore))
6080 (lines (tool-bar-lines-needed frame)))
6081 (when (and quit-restore (eq (car quit-restore) 'frame)
6082 (not (zerop lines)))
6083 (setq compensate (1- lines))))
6084 (message "%s" compensate)
6085 (setq delta
6086 ;; Always count a final newline - we don't do any
6087 ;; post-processing, so let's play safe.
6088 (+ (count-screen-lines nil nil t)
6089 (- (window-body-size))
6090 compensate)))
6091 ;; Move away from final newline.
6092 (when (and (eobp) (bolp) (not (bobp)))
6093 (set-window-point root (line-beginning-position 0)))
6094 (set-window-start root (point-min))
6095 (set-window-vscroll root 0)
6096 (condition-case nil
6097 (set-frame-height
6098 frame
6099 (min (max (+ (frame-height frame) delta)
6100 min-height)
6101 max-height))
6102 (error (setq delta nil))))
6103 delta))
6104 6188
6105(defun window-safely-shrinkable-p (&optional window) 6189(defun window-safely-shrinkable-p (&optional window)
6106 "Return t if WINDOW can be shrunk without shrinking other windows. 6190 "Return t if WINDOW can be shrunk without shrinking other windows.
diff --git a/lisp/winner.el b/lisp/winner.el
index d808a54a10e..65b3d30a80c 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -63,19 +63,8 @@
63 "Restoring window configurations." 63 "Restoring window configurations."
64 :group 'windows) 64 :group 'windows)
65 65
66;;;###autoload
67(defcustom winner-mode nil
68 "Toggle Winner mode.
69Setting this variable directly does not take effect;
70use either \\[customize] or the function `winner-mode'."
71 :set #'(lambda (symbol value) (funcall symbol (or value 0)))
72 :initialize 'custom-initialize-default
73 :type 'boolean
74 :group 'winner
75 :require 'winner)
76
77(defcustom winner-dont-bind-my-keys nil 66(defcustom winner-dont-bind-my-keys nil
78 "If non-nil: Do not use `winner-mode-map' in Winner mode." 67 "Non-nil means do not bind keys in Winner mode."
79 :type 'boolean 68 :type 'boolean
80 :group 'winner) 69 :group 'winner)
81 70
@@ -85,15 +74,13 @@ use either \\[customize] or the function `winner-mode'."
85 :group 'winner) 74 :group 'winner)
86 75
87(defcustom winner-boring-buffers '("*Completions*") 76(defcustom winner-boring-buffers '("*Completions*")
88 "`winner-undo' will not restore windows displaying any of these buffers. 77 "List of buffer names whose windows `winner-undo' will not restore.
89You may want to include buffer names such as *Help*, *Apropos*, 78You may want to include buffer names such as *Help*, *Apropos*,
90*Buffer List*, *info* and *Compile-Log*." 79*Buffer List*, *info* and *Compile-Log*."
91 :type '(repeat string) 80 :type '(repeat string)
92 :group 'winner) 81 :group 'winner)
93 82
94 83
95
96
97 84
98;;;; Saving old configurations (internal variables and subroutines) 85;;;; Saving old configurations (internal variables and subroutines)
99 86
@@ -337,19 +324,23 @@ You may want to include buffer names such as *Help*, *Apropos*,
337;;;; Winner mode (a minor mode) 324;;;; Winner mode (a minor mode)
338 325
339(defcustom winner-mode-hook nil 326(defcustom winner-mode-hook nil
340 "Functions to run whenever Winner mode is turned on." 327 "Functions to run whenever Winner mode is turned on or off."
341 :type 'hook 328 :type 'hook
342 :group 'winner) 329 :group 'winner)
343 330
344(defcustom winner-mode-leave-hook nil 331(define-obsolete-variable-alias 'winner-mode-leave-hook
332 'winner-mode-off-hook "24.3")
333
334(defcustom winner-mode-off-hook nil
345 "Functions to run whenever Winner mode is turned off." 335 "Functions to run whenever Winner mode is turned off."
346 :type 'hook 336 :type 'hook
347 :group 'winner) 337 :group 'winner)
348 338
349(defvar winner-mode-map 339(defvar winner-mode-map
350 (let ((map (make-sparse-keymap))) 340 (let ((map (make-sparse-keymap)))
351 (define-key map [(control c) left] 'winner-undo) 341 (unless winner-dont-bind-my-keys
352 (define-key map [(control c) right] 'winner-redo) 342 (define-key map [(control c) left] 'winner-undo)
343 (define-key map [(control c) right] 'winner-redo))
353 map) 344 map)
354 "Keymap for Winner mode.") 345 "Keymap for Winner mode.")
355 346
@@ -364,37 +355,21 @@ You may want to include buffer names such as *Help*, *Apropos*,
364 355
365 356
366;;;###autoload 357;;;###autoload
367(defun winner-mode (&optional arg) 358(define-minor-mode winner-mode nil :global t ; let d-m-m make the doc
368 "Toggle Winner mode. 359 (if winner-mode
369With arg, turn Winner mode on if and only if arg is positive." 360 (progn
370 (interactive "P") 361 (if (winner-hook-installed-p)
371 (let ((on-p (if arg (> (prefix-numeric-value arg) 0) 362 (progn
372 (not winner-mode)))) 363 (add-hook 'window-configuration-change-hook 'winner-change-fun)
373 (cond 364 (add-hook 'post-command-hook 'winner-save-old-configurations))
374 ;; Turn mode on 365 (add-hook 'post-command-hook 'winner-save-conditionally))
375 (on-p 366 (add-hook 'minibuffer-setup-hook 'winner-save-unconditionally)
376 (setq winner-mode t) 367 (setq winner-modified-list (frame-list))
377 (cond 368 (winner-save-old-configurations))
378 ((winner-hook-installed-p) 369 (remove-hook 'window-configuration-change-hook 'winner-change-fun)
379 (add-hook 'window-configuration-change-hook 'winner-change-fun) 370 (remove-hook 'post-command-hook 'winner-save-old-configurations)
380 (add-hook 'post-command-hook 'winner-save-old-configurations)) 371 (remove-hook 'post-command-hook 'winner-save-conditionally)
381 (t (add-hook 'post-command-hook 'winner-save-conditionally))) 372 (remove-hook 'minibuffer-setup-hook 'winner-save-unconditionally)))
382 (add-hook 'minibuffer-setup-hook 'winner-save-unconditionally)
383 (setq winner-modified-list (frame-list))
384 (winner-save-old-configurations)
385 (run-hooks 'winner-mode-hook)
386 (when (called-interactively-p 'interactive)
387 (message "Winner mode enabled")))
388 ;; Turn mode off
389 (winner-mode
390 (setq winner-mode nil)
391 (remove-hook 'window-configuration-change-hook 'winner-change-fun)
392 (remove-hook 'post-command-hook 'winner-save-old-configurations)
393 (remove-hook 'post-command-hook 'winner-save-conditionally)
394 (remove-hook 'minibuffer-setup-hook 'winner-save-unconditionally)
395 (run-hooks 'winner-mode-leave-hook)
396 (when (called-interactively-p 'interactive)
397 (message "Winner mode disabled"))))))
398 373
399;; Inspired by undo (simple.el) 374;; Inspired by undo (simple.el)
400 375
@@ -461,12 +436,5 @@ In other words, \"undo\" changes in window configuration."
461 (message "Winner undid undo"))) 436 (message "Winner undid undo")))
462 (t (error "Previous command was not a `winner-undo'")))) 437 (t (error "Previous command was not a `winner-undo'"))))
463 438
464;;; To be evaluated when the package is loaded:
465
466(unless (or (assq 'winner-mode minor-mode-map-alist)
467 winner-dont-bind-my-keys)
468 (push (cons 'winner-mode winner-mode-map)
469 minor-mode-map-alist))
470
471(provide 'winner) 439(provide 'winner)
472;;; winner.el ends here 440;;; winner.el ends here
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index 12f24fab95f..600c8d3fa17 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -18,7 +18,9 @@ AC_DEFUN([gl_EXTERN_INLINE],
18 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. 18 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
19 _GL_INLINE_HEADER_END contains useful stuff to put 19 _GL_INLINE_HEADER_END contains useful stuff to put
20 in the same include file, after uses of _GL_INLINE. */ 20 in the same include file, after uses of _GL_INLINE. */
21#if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__ 21#if (__GNUC__ \
22 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
23 : 199901L <= __STDC_VERSION__)
22# define _GL_INLINE inline 24# define _GL_INLINE inline
23# define _GL_EXTERN_INLINE extern inline 25# define _GL_EXTERN_INLINE extern inline
24#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) 26#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
@@ -35,7 +37,7 @@ AC_DEFUN([gl_EXTERN_INLINE],
35#endif 37#endif
36 38
37#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) 39#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
38# if __GNUC_STDC_INLINE__ 40# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
39# define _GL_INLINE_HEADER_CONST_PRAGMA 41# define _GL_INLINE_HEADER_CONST_PRAGMA
40# else 42# else
41# define _GL_INLINE_HEADER_CONST_PRAGMA \ 43# define _GL_INLINE_HEADER_CONST_PRAGMA \
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 0d73faee8d1..de2355d87c3 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -111,6 +111,7 @@ AC_DEFUN([gl_EARLY],
111 # Code from module sys_time: 111 # Code from module sys_time:
112 # Code from module time: 112 # Code from module time:
113 # Code from module time_r: 113 # Code from module time_r:
114 # Code from module timer-time:
114 # Code from module timespec: 115 # Code from module timespec:
115 # Code from module timespec-add: 116 # Code from module timespec-add:
116 # Code from module timespec-sub: 117 # Code from module timespec-sub:
@@ -263,6 +264,7 @@ AC_DEFUN([gl_INIT],
263 gl_PREREQ_TIME_R 264 gl_PREREQ_TIME_R
264 fi 265 fi
265 gl_TIME_MODULE_INDICATOR([time_r]) 266 gl_TIME_MODULE_INDICATOR([time_r])
267 gl_TIMER_TIME
266 gl_TIMESPEC 268 gl_TIMESPEC
267 gl_UNISTD_H 269 gl_UNISTD_H
268 gl_UTIMENS 270 gl_UTIMENS
@@ -661,6 +663,7 @@ AC_DEFUN([gl_FILE_LIST], [
661 m4/sys_time_h.m4 663 m4/sys_time_h.m4
662 m4/time_h.m4 664 m4/time_h.m4
663 m4/time_r.m4 665 m4/time_r.m4
666 m4/timer_time.m4
664 m4/timespec.m4 667 m4/timespec.m4
665 m4/tm_gmtoff.m4 668 m4/tm_gmtoff.m4
666 m4/unistd_h.m4 669 m4/unistd_h.m4
diff --git a/m4/timer_time.m4 b/m4/timer_time.m4
new file mode 100644
index 00000000000..bc84554b789
--- /dev/null
+++ b/m4/timer_time.m4
@@ -0,0 +1,39 @@
1# timer_time.m4 serial 2
2dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7# Check for timer_settime, and set LIB_TIMER_TIME.
8
9AC_DEFUN([gl_TIMER_TIME],
10[
11 dnl Based on clock_time.m4. See details there.
12
13 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
14 AC_REQUIRE([gl_THREADLIB])
15
16 LIB_TIMER_TIME=
17 AC_SUBST([LIB_TIMER_TIME])
18 gl_saved_libs=$LIBS
19 AC_SEARCH_LIBS([timer_settime], [rt posix4],
20 [test "$ac_cv_search_timer_settime" = "none required" ||
21 LIB_TIMER_TIME=$ac_cv_search_timer_settime])
22 dnl GLIBC uses threads to emulate posix timers when kernel support
23 dnl is not available (like Linux < 2.6 or when used with kFreeBSD)
24 dnl Now the pthread lib is linked automatically in the normal case,
25 dnl but when linking statically, it needs to be explicitly specified.
26 AC_EGREP_CPP([Thread],
27 [
28#include <features.h>
29#ifdef __GNU_LIBRARY__
30 #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || (__GLIBC__ > 2)) \
31 && !defined __UCLIBC__
32 Thread emulation available
33 #endif
34#endif
35 ],
36 [LIB_TIMER_TIME="$LIB_TIMER_TIME $LIBMULTITHREAD"])
37 AC_CHECK_FUNCS([timer_settime])
38 LIBS=$gl_saved_libs
39])
diff --git a/msdos/ChangeLog b/msdos/ChangeLog
index 45666a335de..525868b2c70 100644
--- a/msdos/ChangeLog
+++ b/msdos/ChangeLog
@@ -1,3 +1,8 @@
12012-09-27 Paul Eggert <eggert@cs.ucla.edu>
2
3 Check more robustly for timer_settime.
4 * sed1v2.inp, sed3v2.inp (LIB_TIMER_TIME): New macro.
5
12012-08-04 Eli Zaretskii <eliz@gnu.org> 62012-08-04 Eli Zaretskii <eliz@gnu.org>
2 7
3 * sedlibmk.inp (allocator.$(OBJEXT), careadlinkat.$(OBJEXT)): Fix 8 * sedlibmk.inp (allocator.$(OBJEXT), careadlinkat.$(OBJEXT)): Fix
diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp
index 0ed88931691..fbee1dd03f9 100644
--- a/msdos/sed1v2.inp
+++ b/msdos/sed1v2.inp
@@ -106,6 +106,7 @@ s/\.h\.in/.h-in/
106/^LIBSELINUX_LIBS *=/s/@LIBSELINUX_LIBS@// 106/^LIBSELINUX_LIBS *=/s/@LIBSELINUX_LIBS@//
107/^LIB_PTHREAD_SIGMASK *=/s/@[^@\n]*@// 107/^LIB_PTHREAD_SIGMASK *=/s/@[^@\n]*@//
108/^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g 108/^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g
109/^LIB_TIMER_TIME *=/s/@[^@\n]*@//g
109/^LIBGNUTLS_LIBS *=/s/@[^@\n]*@// 110/^LIBGNUTLS_LIBS *=/s/@[^@\n]*@//
110/^LIBGNUTLS_CFLAGS *=/s/@[^@\n]*@// 111/^LIBGNUTLS_CFLAGS *=/s/@[^@\n]*@//
111/^GETLOADAVG_LIBS *=/s/@[^@\n]*@// 112/^GETLOADAVG_LIBS *=/s/@[^@\n]*@//
diff --git a/msdos/sed3v2.inp b/msdos/sed3v2.inp
index bfa008b3e81..cd58e47305c 100644
--- a/msdos/sed3v2.inp
+++ b/msdos/sed3v2.inp
@@ -36,6 +36,7 @@ s/-DVERSION[^ ]* //
36/^LIBS_MAIL *=/s/@[^@\n]*@//g 36/^LIBS_MAIL *=/s/@[^@\n]*@//g
37/^LIBS_SYSTEM *=/s/@[^@\n]*@//g 37/^LIBS_SYSTEM *=/s/@[^@\n]*@//g
38/^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g 38/^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g
39/^LIB_TIMER_TIME *=/s/@[^@\n]*@//g
39/^CFLAGS *=/s!=.*$!=-O2 -g! 40/^CFLAGS *=/s!=.*$!=-O2 -g!
40/^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS -I../msdos! 41/^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS -I../msdos!
41/^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@// 42/^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@//
diff --git a/nt/ChangeLog b/nt/ChangeLog
index 311a10f66c5..7e064cc3e42 100644
--- a/nt/ChangeLog
+++ b/nt/ChangeLog
@@ -1,3 +1,21 @@
12012-09-30 Juanma Barranquero <lekktu@gmail.com>
2
3 * config.nt: Sync with autogen/config.in.
4
52012-09-29 Juanma Barranquero <lekktu@gmail.com>
6
7 * config.nt: Sync with autogen/config.in.
8 (HAVE_TIMER_SETTIME): New macro.
9
102012-09-23 Eli Zaretskii <eliz@gnu.org>
11
12 * inc/ms-w32.h (emacs_raise): Redefine to invoke emacs_abort.
13
142012-09-23 Paul Eggert <eggert@cs.ucla.edu>
15
16 Simplify and avoid signal-handling races (Bug#12471).
17 * inc/ms-w32.h (emacs_raise): New macro.
18
12012-09-18 Eli Zaretskii <eliz@gnu.org> 192012-09-18 Eli Zaretskii <eliz@gnu.org>
2 20
3 * configure.bat: Include stddef.h before gif_lib.h, to have size_t 21 * configure.bat: Include stddef.h before gif_lib.h, to have size_t
diff --git a/nt/config.nt b/nt/config.nt
index 23b33731a36..3b398eae04c 100644
--- a/nt/config.nt
+++ b/nt/config.nt
@@ -968,6 +968,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
968/* Define to 1 if you have the tiff library (-ltiff). */ 968/* Define to 1 if you have the tiff library (-ltiff). */
969#undef HAVE_TIFF 969#undef HAVE_TIFF
970 970
971/* Define to 1 if you have the `timer_settime' function. */
972#undef HAVE_TIMER_SETTIME
973
971/* Define if struct tm has the tm_gmtoff member. */ 974/* Define if struct tm has the tm_gmtoff member. */
972#undef HAVE_TM_GMTOFF 975#undef HAVE_TM_GMTOFF
973 976
@@ -1528,7 +1531,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1528 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. 1531 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>.
1529 _GL_INLINE_HEADER_END contains useful stuff to put 1532 _GL_INLINE_HEADER_END contains useful stuff to put
1530 in the same include file, after uses of _GL_INLINE. */ 1533 in the same include file, after uses of _GL_INLINE. */
1531#if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__ 1534#if (__GNUC__ \
1535 ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \
1536 : 199901L <= __STDC_VERSION__)
1532# define _GL_INLINE inline 1537# define _GL_INLINE inline
1533# define _GL_EXTERN_INLINE extern inline 1538# define _GL_EXTERN_INLINE extern inline
1534#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__) 1539#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
@@ -1545,7 +1550,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
1545#endif 1550#endif
1546 1551
1547#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) 1552#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
1548# if __GNUC_STDC_INLINE__ 1553# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__
1549# define _GL_INLINE_HEADER_CONST_PRAGMA 1554# define _GL_INLINE_HEADER_CONST_PRAGMA
1550# else 1555# else
1551# define _GL_INLINE_HEADER_CONST_PRAGMA \ 1556# define _GL_INLINE_HEADER_CONST_PRAGMA \
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index 22255843f13..107ab6e788b 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -203,6 +203,9 @@ struct sigaction {
203#define kill sys_kill 203#define kill sys_kill
204#define signal sys_signal 204#define signal sys_signal
205 205
206/* Internal signals. */
207#define emacs_raise(sig) emacs_abort()
208
206/* termcap.c calls that are emulated. */ 209/* termcap.c calls that are emulated. */
207#define tputs sys_tputs 210#define tputs sys_tputs
208#define tgetstr sys_tgetstr 211#define tgetstr sys_tgetstr
diff --git a/src/.gdbinit b/src/.gdbinit
index 74f44cc1007..7a6bfb07fed 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1214,8 +1214,8 @@ show environment DISPLAY
1214show environment TERM 1214show environment TERM
1215 1215
1216# When debugging, it is handy to be able to "return" from 1216# When debugging, it is handy to be able to "return" from
1217# fatal_error_backtrace when an assertion failure is non-fatal. 1217# terminate_due_to_signal when an assertion failure is non-fatal.
1218break fatal_error_backtrace 1218break terminate_due_to_signal
1219 1219
1220# x_error_quitter is defined only on X. But window-system is set up 1220# x_error_quitter is defined only on X. But window-system is set up
1221# only at run time, during Emacs startup, so we need to defer setting 1221# only at run time, during Emacs startup, so we need to defer setting
diff --git a/src/ChangeLog b/src/ChangeLog
index 508ac9925a8..f69ab42bd90 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -3,6 +3,547 @@
3 * coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention 3 * coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention
4 to the buffer relocation which may be caused by ccl_driver. 4 to the buffer relocation which may be caused by ccl_driver.
5 5
62012-09-30 Jan Djärv <jan.h.d@swipnet.se>
7
8 * nsfns.m (ns_frame_parm_handlers): Add x_set_fullscreen.
9
10 * nsterm.m (NEW_STYLE_FS): New define.
11 (ns_fullscreen_hook, windowWillEnterFullScreen)
12 (windowDidEnterFullScreen, windowWillExitFullScreen)
13 (windowDidExitFullScreen, toggleFullScreen, handleFS)
14 (setFSValue): New functions.
15 (EmacsFSWindow): New implementation.
16 (canBecomeKeyWindow): New function for EmacsFSWindow.
17 (ns_create_terminal): Set fullscreen_hook to ns_fullscreen_hook.
18 (dealloc): Release nonfs_window if in fullscreen.
19 (updateFrameSize:): Call windowDidMove to update top/left.
20 (windowWillResize:toSize:): Check if frame is still maximized.
21 (initFrameFromEmacs:): Initialize fs_state, fs_before_fs,
22 next_maximized, maximized_width, maximized_height and nonfs_window.
23 Call setCollectionBehavior if NEW_STYLE_FS. Initialize bwidth and
24 tbar_height.
25 (windowWillUseStandardFrame:defaultFrame:): Update frame parameter
26 fullscreen. Set maximized_width/height. Act on next_maximized.
27
28 * nsterm.h (MAC_OS_X_VERSION_10_7, MAC_OS_X_VERSION_10_8): New.
29 (EmacsView): Add variables for fullscreen.
30 (handleFS, setFSValue, toggleFullScreen): New in EmacsView.
31 (EmacsFSWindow): New interface for fullscreen.
32
332012-09-30 Juanma Barranquero <lekktu@gmail.com>
34
35 * makefile.w32-in ($(BLD)/profiler.$(O)): Update dependencies.
36
372012-09-30 Chong Yidong <cyd@gnu.org>
38
39 * fns.c (Frandom): Doc fix.
40
412012-09-30 Martin Rudalics <rudalics@gmx.at>
42
43 * window.c (Vwindow_combination_limit): New default value.
44 (Qwindow_size): New symbol replacing Qtemp_buffer_resize.
45
462012-09-30 Paul Eggert <eggert@cs.ucla.edu>
47
48 * syssignal.h (PROFILER_CPU_SUPPORT): Don't define if PROFILING.
49 Suggested by Eli Zaretskii in
50 <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00811.html>.
51
522012-09-30 Eli Zaretskii <eliz@gnu.org>
53
54 * profiler.c (Fprofiler_cpu_stop): Use timer_settime only if
55 HAVE_TIMER_SETTIME is defined.
56
572012-09-30 Paul Eggert <eggert@cs.ucla.edu>
58
59 Profiler improvements: more-accurate timers, overflow checks.
60 * profiler.c: Don't include stdio.h, limits.h, sys/time.h,
61 signal.h, setjmp.h. Include systime.h instead.
62 (saturated_add): New function.
63 (record_backtrace, current_sample_interval): Use EMACS_INT, not size_t.
64 (record_backtrace, handle_profiler_signal): Saturate on fixnum overflow.
65 (profiler_timer, profiler_timer_ok) [HAVE_TIMER_SETTIME]:
66 New static vars.
67 (enum profiler_cpu_running): New enum.
68 (profiler_cpu_running): Now of that enum type, not bool.
69 All uses changed to store the new value.
70 (handle_profiler_signal): Rename from sigprof_handler_1,
71 for consistency with other handlers. Do not check whether
72 cpu_log is a hash-table if garbage collecting, since it
73 doesn't matter in that case.
74 (deliver_profiler_signal): Rename from sigprof_handler,
75 for consistency with other handlers.
76 (setup_cpu_timer): New function, with much of what used to be in
77 Fprofiler_cpu_start. Check for out-of-range argument.
78 Prefer timer_settime if available, and prefer
79 thread cputime clocks, then process cputime clocks, then
80 monotonic clocks, to the old realtime clock. Use make_timeval
81 to round more-correctly when falling back to setitimer.
82 (Fprofiler_cpu_start): Use it.
83 (Fprofiler_cpu_stop): Prefer timer_settime if available.
84 Don't assume that passing NULL as the 2nd argument of setitimer
85 is the same as passing a pointer to all-zero storage.
86 Ignore SIGPROF afterwards.
87 (malloc_probe): Saturate at MOST_POSITIVE_FIXNUM.
88 * sysdep.c (emacs_sigaction_init): Also mask out SIGPROF in
89 non-fatal signal handlers. Ignore SIGPROF on startup.
90 * syssignal.h (PROFILER_CPU_SUPPORT): Define this macro here, not
91 in profiler.c, since sysdep.c now uses it.
92
93 * sysdep.c (handle_fatal_signal): Bump backtrace size to 40.
94 Suggested by Eli Zaretskii in
95 <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00796.html>.
96
972012-09-29 Juanma Barranquero <lekktu@gmail.com>
98
99 * makefile.w32-in ($(BLD)/profiler.$(O)): Update dependencies.
100
1012012-09-29 Stefan Monnier <monnier@iro.umontreal.ca>
102
103 * lisp.h (struct backtrace): Remove indirection for `function' field.
104 * xdisp.c (redisplay_internal):
105 * profiler.c (record_backtrace, sigprof_handler_1):
106 * alloc.c (Fgarbage_collect):
107 * eval.c (interactive_p, Fsignal, eval_sub, Ffuncall, Fbacktrace)
108 (Fbacktrace_frame): Adjust accordingly.
109
1102012-09-28 Glenn Morris <rgm@gnu.org>
111
112 * eval.c (Frun_hook_with_args, Frun_hook_with_args_until_success)
113 (Frun_hook_with_args_until_failure): Doc fixes.
114
1152012-09-28 Eli Zaretskii <eliz@gnu.org>
116
117 * xdisp.c (syms_of_xdisp) <Qredisplay_internal>: Rename from
118 Qautomatic_redisplay and change the symbol name. All users changed.
119
1202012-09-28 Tomohiro Matsuyama <tomo@cx4a.org>
121
122 * profiler.c (sigprof_handler): Fix race condition.
123
1242012-09-28 Glenn Morris <rgm@gnu.org>
125
126 * lread.c (lisp_file_lexically_bound_p): Handle #! lines. (Bug#12528)
127
1282012-09-27 Paul Eggert <eggert@cs.ucla.edu>
129
130 Check more robustly for timer_settime.
131 * Makefile.in (LIB_TIMER_TIME): New macro.
132 (LIBES): Add it.
133 * atimer.c (alarm_timer, alarm_timer_ok, set_alarm, init_atimer):
134 Use HAVE_TIMER_SETTIME, not SIGEV_SIGNAL, to decide whether to
135 call timer_settime.
136
1372012-09-26 Tomohiro Matsuyama <tomo@cx4a.org>
138
139 * profiler.c (Fprofiler_cpu_start): Remove unnecessary flag SA_SIGINFO.
140
1412012-09-26 Juanma Barranquero <lekktu@gmail.com>
142
143 * makefile.w32-in ($(BLD)/profiler.$(O)): Update dependencies.
144
1452012-09-26 Paul Eggert <eggert@cs.ucla.edu>
146
147 * character.h (MAYBE_UNIFY_CHAR): Remove.
148 * charset.c, charset.h (maybe_unify_char): Now static.
149 * charset.c (decode_char): Use maybe_unify_char, not MAYBE_UNIFY_CHAR.
150 Since this stuff is now private to charset.c, there's no need for
151 a public macro and no need to inline by hand.
152
1532012-09-26 Tomohiro Matsuyama <tomo@cx4a.org>
154 Stefan Monnier <monnier@iro.umontreal.ca>
155 Juanma Barranquero <lekktu@gmail.com>
156
157 * profiler.c: New file.
158 * Makefile.in (base_obj): Add profiler.o.
159 * makefile.w32-in (OBJ2, GLOBAL_SOURCES): Add profiler.c.
160 ($(BLD)/profiler.$(O)): New target.
161 * emacs.c (main): Call syms_of_profiler.
162 * alloc.c (Qautomatic_gc): New constant.
163 (MALLOC_PROBE): New macro.
164 (xmalloc, xzalloc, xrealloc, lisp_malloc, lisp_align_malloc): Use it.
165 (total_bytes_of_live_objects): New function.
166 (Fgarbage_collect): Use it. Record itself in backtrace_list.
167 Call malloc_probe for the memory profiler.
168 (syms_of_alloc): Define Qautomatic_gc.
169 * eval.c (eval_sub, Ffuncall): Reorder assignments to avoid
170 race condition.
171 (struct backtrace): Move definition...
172 * lisp.h (struct backtrace): ..here.
173 (Qautomatic_gc, profiler_memory_running): Declare vars.
174 (malloc_probe, syms_of_profiler): Declare functions.
175 * xdisp.c (Qautomatic_redisplay): New constant.
176 (redisplay_internal): Record itself in backtrace_list.
177 (syms_of_xdisp): Define Qautomatic_redisplay.
178
1792012-09-25 Eli Zaretskii <eliz@gnu.org>
1802012-09-25 Juanma Barranquero <lekktu@gmail.com>
181
182 * makefile.w32-in ($(BLD)/callproc.$(O)): Update dependencies.
183
1842012-09-25 Paul Eggert <eggert@cs.ucla.edu>
185
186 Prefer POSIX timers if available.
187 They avoid a race if the timer is too close to the current time.
188 * atimer.c (alarm_timer, alarm_timer_ok) [SIGEV_SIGNAL]: New static vars.
189 (set_alarm) [SIGEV_SIGNAL]: Use POSIX timers if available.
190 (init_atimer) [SIGEV_SIGNAL]: Initialize them.
191
1922012-09-25 Eli Zaretskii <eliz@gnu.org>
193
194 * coding.c (CHAR_STRING_ADVANCE_NO_UNIFY): Make it an alias of
195 CHAR_STRING_ADVANCE.
196 (STRING_CHAR_ADVANCE_NO_UNIFY): Make it an alias of
197 STRING_CHAR_ADVANCE.
198
1992012-09-25 Juanma Barranquero <lekktu@gmail.com>
200
201 Move Vlibrary_cache to emacs.c and reset before dumping.
202
203 * lisp.h (reset_image_types): Declare.
204 [WINDOWSNT] (Vlibrary_cache): Declare.
205
206 * image.c (reset_image_types): New function.
207
208 * emacs.c [WINDOWSNT] (Vlibrary_cache): Move from w32.c.
209 (syms_of_emacs) [WINDOWSNT] <Vlibrary_cache>: Initialize and staticpro.
210 (Fdump_emacs): Reset Vlibrary_cache and image_types.
211
212 * w32.c (Vlibrary_cache): Do not define; moved to emacs.c
213 (globals_of_w32) <Vlibrary_cache>: Do not initialize.
214
215 * w32.h (Vlibrary_cache): Do not declare.
216
2172012-09-25 Eli Zaretskii <eliz@gnu.org>
218
219 * w32proc.c (sys_signal): Handle all signals defined by the
220 MS-Windows runtime, not just SIGCHLD. Actually install the signal
221 handlers for signals supported by Windows. Don't override
222 term_ntproc as the handler for SIGABRT.
223 (sigaction): Rewrite to call sys_signal instead of duplicating its
224 code.
225 (sys_kill): Improve commentary.
226
227 * w32.c (term_ntproc): Accept (and ignore) one argument, for
228 consistency with a signature of a signal handler. All callers
229 changed.
230 (init_ntproc): Accept an argument DUMPING. If dumping, don't
231 install term_ntproc as a signal handler for SIGABRT, as that
232 should be done by the dumped Emacs.
233
234 * w32.h (init_ntproc, term_ntproc): Adjust prototypes.
235
236 * w32select.c (term_w32select): Protect against repeated
237 invocation by setting clipboard_owner to NULL after calling
238 DestroyWindow.
239
240 * emacs.c (shut_down_emacs, main): Adapt the calls to init_ntproc
241 and term_ntproc to their modified signatures.
242
243 * character.c (char_string, string_char): Remove calls to
244 MAYBE_UNIFY_CHAR. See the discussion starting at
245 http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00433.html
246 for the details.
247
2482012-09-25 Chong Yidong <cyd@gnu.org>
249
250 * xdisp.c (mode_line_inverse_video): Delete obsolete variable.
251
2522012-09-24 Stefan Monnier <monnier@iro.umontreal.ca>
253
254 * bytecode.c (exec_byte_code): Signal an error instead of aborting,
255 when encountering an unknown bytecode.
256
2572012-09-24 Paul Eggert <eggert@cs.ucla.edu>
258
259 image.c, indent.c: Use bool for booleans.
260 * dispextern.h (struct image_type): Members valid_p, load, init
261 now return bool, not int. All uses changed.
262 * image.c: Omit unnecessary static decls.
263 (x_create_bitmap_mask, x_build_heuristic_mask):
264 Return void, not int, since callers don't care about the return value.
265 (x_create_bitmap_mask, define_image_type, valid_image_p)
266 (struct image_keyword, parse_image_spec, image_spec_value)
267 (check_image_size, image_background)
268 (image_background_transparent, x_clear_image_1)
269 (postprocess_image, lookup_image, x_check_image_size)
270 (x_create_x_image_and_pixmap, xbm_image_p)
271 (Create_Pixmap_From_Bitmap_Data, xbm_read_bitmap_data)
272 (xbm_load_image, xbm_file_p, xbm_load, xpm_lookup_color)
273 (init_xpm_functions, xpm_valid_color_symbols_p, xpm_image_p)
274 (xpm_load, xpm_load_image, lookup_rgb_color, lookup_pixel_color)
275 (x_to_xcolors, x_build_heuristic_mask, pbm_image_p, pbm_load)
276 (png_image_p, init_png_functions, png_load_body, png_load)
277 (jpeg_image_p, init_jpeg_functions, jpeg_load_body, jpeg_load)
278 (tiff_image_p, init_tiff_functions, tiff_load, gif_image_p)
279 (init_gif_functions, gif_load, imagemagick_image_p)
280 (imagemagick_load_image, imagemagick_load, svg_image_p)
281 (init_svg_functions, svg_load, svg_load_image, gs_image_p)
282 (gs_load):
283 * nsimage.m (ns_load_image):
284 * nsterm.m (ns_defined_color):
285 * xfaces.c (tty_lookup_color, tty_defined_color, defined_color):
286 * xfns.c (x_defined_color):
287 * xterm.c (x_alloc_lighter_color_for_widget)
288 (x_alloc_nearest_color_1, x_alloc_nearest_color)
289 (x_alloc_lighter_color):
290 * indent.c (disptab_matches_widthtab, current_column)
291 (scan_for_column, string_display_width, indented_beyond_p)
292 (compute_motion, vmotion, Fvertical_motion):
293 Use bool for booleans.
294
2952012-09-24 Chong Yidong <cyd@gnu.org>
296
297 * chartab.c (Fset_char_table_default): Obsolete function removed.
298
2992012-09-23 Paul Eggert <eggert@cs.ucla.edu>
300
301 Move pid_t related decls out of lisp.h.
302 * lisp.h, syswait.h (record_child_status_change, wait_for_termination)
303 (interruptible_wait_for_termination):
304 Move these decls from lisp.h to syswait.h, since they use pid_t.
305 Needed on FreeBSD; see Herbert J. Skuhra in
306 <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00571.html>.
307 * callproc.c: Include syswait.h.
308
309 gnutls.c, gtkutil.c: Use bool for boolean.
310 * gnutls.c (gnutls_global_initialized, init_gnutls_functions)
311 (emacs_gnutls_handle_error):
312 * gtkutil.c (xg_check_special_colors, xg_prepare_tooltip)
313 (xg_hide_tooltip, xg_create_frame_widgets)
314 (create_dialog, xg_uses_old_file_dialog)
315 (xg_get_file_with_chooser, xg_get_file_with_selection)
316 (xg_get_file_name, xg_have_tear_offs, create_menus, xg_create_widget)
317 (xg_item_label_same_p, xg_update_menubar)
318 (xg_modify_menubar_widgets, xg_event_is_for_menubar)
319 (xg_ignore_gtk_scrollbar, xg_set_toolkit_scroll_bar_thumb)
320 (xg_event_is_for_scrollbar, xg_pack_tool_bar, xg_make_tool_item)
321 (is_box_type, xg_tool_item_stale_p, xg_update_tool_bar_sizes)
322 (update_frame_tool_bar, free_frame_tool_bar):
323 * gtkutil.c, w32term.c, xterm.c (x_wm_set_size_hint):
324 * nsmenu.m (ns_update_menubar):
325 * nsmenu.m, w32menu.c, xmenu.c (set_frame_menubar):
326 * xfns.c (Fx_show_tip) [USE_GTK]:
327 Use bool for boolean.
328 * gtkutil.c (xg_update_frame_menubar):
329 * xmenu.c (update_frame_menubar):
330 Return void, not int, since caller ignores return value.
331 * gtkutil.c (xg_change_toolbar_position):
332 Return void, not 1.
333
3342012-09-23 Juanma Barranquero <lekktu@gmail.com>
335
336 * makefile.w32-in (BLOCKINPUT_H): Remove.
337 (SYSSIGNAL_H): New macro.
338 ($(BLD)/alloc.$(O), $(BLD)/atimer.$(O), $(BLD)/buffer.$(O))
339 ($(BLD)/callproc.$(O), $(BLD)/data.$(O), $(BLD)/dired.$(O))
340 ($(BLD)/dispnew.$(O), $(BLD)/editfns.$(O), $(BLD)/emacs.$(O))
341 ($(BLD)/eval.$(O), $(BLD)/fileio.$(O), $(BLD)/floatfns.$(O))
342 ($(BLD)/fns.$(O), $(BLD)/fontset.$(O), $(BLD)/frame.$(O))
343 ($(BLD)/fringe.$(O), $(BLD)/image.$(O), $(BLD)/insdel.$(O))
344 ($(BLD)/keyboard.$(O), $(BLD)/keymap.$(O), $(BLD)/lread.$(O))
345 ($(BLD)/menu.$(O), $(BLD)/w32inevt.$(O), $(BLD)/w32proc.$(O))
346 ($(BLD)/print.$(O), $(BLD)/process.$(O), $(BLD)/ralloc.$(O))
347 ($(BLD)/search.$(O), $(BLD)/sound.$(O), $(BLD)/sysdep.$(O))
348 ($(BLD)/term.$(O), $(BLD)/window.$(O), $(BLD)/xdisp.$(O))
349 ($(BLD)/xfaces.$(O), $(BLD)/w32fns.$(O), $(BLD)/w32menu.$(O))
350 ($(BLD)/w32term.$(O), $(BLD)/w32select.$(O), $(BLD)/w32reg.$(O))
351 ($(BLD)/w32xfns.$(O)): Update dependencies.
352
3532012-09-23 Eli Zaretskii <eliz@gnu.org>
354
355 * .gdbinit: Set breakpoint on terminate_due_to_signal, not on
356 fatal_error_backtrace.
357
358 * w32proc.c (sys_kill): Undo last change: don't do anything when
359 invoked to deliver SIGABRT to our own process. This is now
360 handled by emacs_raise.
361
3622012-09-23 Juanma Barranquero <lekktu@gmail.com>
363
364 * w32term.c (w32_read_socket): Remove leftover reference to
365 interrupt_input_pending.
366
3672012-09-23 Paul Eggert <eggert@cs.ucla.edu>
368
369 Do not use SA_NODEFER.
370 Problem reported by Dani Moncayo in
371 <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00557.html>.
372 * alloc.c (die):
373 * sysdep.c (emacs_abort): Do not reset signal handler.
374 * emacs.c (terminate_due_to_signal): Reset signal handler here.
375 * sysdep.c (init_signals): Do not use SA_NODEFER. It wasn't
376 wanted even on POSIXish hosts, and it doesn't work on Windows.
377
3782012-09-23 Jan Djärv <jan.h.d@swipnet.se>
379
380 * xterm.c (x_term_init): Call fixup_locale before and after calling
381 gtk_init (Bug#12392).
382
3832012-09-23 Chong Yidong <cyd@gnu.org>
384
385 * w32.c (w32_delayed_load): Remove LIBRARIES argument; always use
386 Vdynamic_library_alist.
387
388 * gnutls.c (init_gnutls_functions): Caller changed; remove arg.
389 (Fgnutls_available_p): Caller changed.
390
391 * xml.c (init_libxml2_functions, Flibxml_parse_html_region)
392 (Flibxml_parse_xml_region): Likewise.
393
394 * dispextern.h (struct image_type): Remove arg from init function.
395
396 * image.c (Finit_image_library, lookup_image_type)
397 (define_image_type): Remove now-unneeded second arg.
398 (init_xpm_functions, init_png_functions, init_jpeg_functions)
399 (init_tiff_functions, init_gif_functions, init_svg_functions):
400 Arglist and w32_delayed_load calling convention changed.
401 (gs_type): Remove init_gs_functions; there is no such function.
402 (valid_image_p, make_image): Fix caller to lookup_image_type.
403
4042012-09-23 Paul Eggert <eggert@cs.ucla.edu>
405
406 Simplify and avoid signal-handling races (Bug#12471).
407 * alloc.c (die):
408 * sysdep.c (emacs_abort) [HAVE_NTGUI]:
409 Avoid recursive loop if there's a fatal error in the function itself.
410 * atimer.c (pending_atimers):
411 * blockinput.h: Don't include "atimer.h"; no longer needed.
412 (interrupt_input_pending): Remove. All uses removed.
413 pending_signals now counts both atimers and ordinary interrupts.
414 This is less racy than having three separate pending-signal flags.
415 (block_input, unblock_input, totally_unblock_input, unblock_input_to)
416 (input_blocked_p):
417 Rename from their upper-case counterparts BLOCK_INPUT,
418 UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO,
419 INPUT_BLOCKED_P, and turn into functions. All uses changed.
420 This makes it easier to access volatile variables more accurately.
421 (BLOCK_INPUT_RESIGNAL): Remove. All uses replaced by unblock_input ().
422 (input_blocked_p): Prefer this to 'interrupt_input_blocked', as
423 that's more reliable if the code is buggy and sets
424 interrupt_input_blocked to a negative value. All uses changed.
425 * atimer.c (deliver_alarm_signal):
426 Remove. No need to deliver this to the parent; any thread can
427 handle this signal now. All uses replaced by underlying handler.
428 * atimer.c (turn_on_atimers):
429 * dispnew.c (handle_window_change_signal):
430 * emacs.c (handle_danger_signal):
431 * keyboard.c (kbd_buffer_get_event):
432 Don't reestablish signal handler; not needed with sigaction.
433 * blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT)
434 (UNBLOCK_INPUT_TO):
435 Rework to avoid unnecessary accesses to volatile variables.
436 (UNBLOCK_INPUT_TO): Now a function.
437 (totally_unblock_input, unblock_input): New decls.
438 * data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c
439 (init_data): Remove. Necessary stuff now done in init_signal.
440 * emacs.c, xdisp.c: Include "atimer.h", since we invoke atimer functions.
441 * emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c.
442 (fatal_error_code): Remove; no longer needed.
443 (terminate_due_to_signal): Rename from fatal_error_backtrace, since
444 it doesn't always backtrace. All uses changed. No need to reset
445 signal to default, since sigaction and/or die does that for us now.
446 Use emacs_raise (FOO), not kill (getpid (), FOO).
447 (main): Check more-accurately whether we're dumping.
448 Move fatal-error setup to sysdep.c
449 * floatfns.c: Do not include "syssignal.h"; no longer needed.
450 * gtkutil.c (xg_get_file_name, xg_get_font):
451 Remove no-longer-needed signal-mask manipulation.
452 * keyboard.c, process.c (POLL_FOR_INPUT):
453 Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined.
454 * keyboard.c (read_avail_input): Remove.
455 All uses replaced by gobble_input.
456 (Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code.
457 (kbd_buffer_store_event_hold, gobble_input):
458 (record_asynch_buffer_change) [USABLE_SIGIO]:
459 (store_user_signal_events):
460 No need to mess with signal mask.
461 (gobble_input): If blocking input and there are terminals, simply
462 set pending_signals to 1 and return. All hooks changed to not
463 worry about whether input is blocked.
464 (process_pending_signals): Clear pending_signals before processing
465 them, in case a signal comes in while we're processing.
466 By convention callers now test pending_signals before calling us.
467 (UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input):
468 New functions, to support changes to blockinput.h.
469 (handle_input_available_signal): Now extern.
470 (reinvoke_input_signal): Remove. All uses replaced by
471 handle_async_input.
472 (quit_count): Now volatile, since a signal handler uses it.
473 (handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg.
474 All callers changed. Block SIGINT only if not already blocked.
475 Clear sigmask reliably, even if Fsignal returns, which it can.
476 Omit unnecessary accesses to volatile var.
477 (quit_throw_to_read_char): No need to restore sigmask.
478 * keyboard.c (gobble_input, handle_user_signal):
479 * process.c (wait_reading_process_output):
480 Call signal-handling code rather than killing ourselves.
481 * lisp.h: Include <float.h>, for...
482 (IEEE_FLOATING_POINT): New macro, moved here to avoid duplication.
483 (pending_signals): Now volatile.
484 (syms_of_data): Now const if IEEE floating point.
485 (handle_input_available_signal) [USABLE_SIGIO]:
486 (terminate_due_to_signal, record_child_status_change): New decls.
487 * process.c (create_process): Avoid disaster if memory is exhausted
488 while we're processing a vfork, by tightening the critical section
489 around the vfork.
490 (send_process_frame, process_sent_to, handle_pipe_signal)
491 (deliver_pipe_signal): Remove. No longer needed, as Emacs now
492 ignores SIGPIPE.
493 (send_process): No need for setjmp/longjmp any more, since the
494 SIGPIPE stuff is now gone. Instead, report an error if errno
495 is EPIPE.
496 (record_child_status_change): Now extern. PID and W are now args.
497 Return void, not bool. All callers changed.
498 * sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]:
499 Remove. All uses removed. This bug should be fixed now in a
500 different way.
501 (wait_for_termination_1): Use waitpid rather than sigsuspend,
502 and record the child status change directly. This avoids the
503 need to futz with the signal mask.
504 (process_fatal_action): Move here from emacs.c.
505 (emacs_sigaction_flags): New function, containing
506 much of what used to be in emacs_sigaction_init.
507 (emacs_sigaction_init): Use it. Block nonfatal system signals that are
508 caught by emacs, to make races less likely.
509 (deliver_process_signal): Rename from handle_on_main_thread.
510 All uses changed.
511 (BACKTRACE_LIMIT_MAX): Now at top level.
512 (thread_backtrace_buffer, threadback_backtrace_pointers):
513 New static vars.
514 (deliver_thread_signal, deliver_fatal_thread_signal):
515 New functions, for more-accurate delivery of thread-specific signals.
516 (handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c.
517 (deliver_arith_signal): Handle in this thread, not
518 in the main thread, since it's triggered by this thread.
519 (maybe_fatal_sig): New function.
520 (init_signals): New arg DUMPING so that we can be more accurate
521 about whether we're dumping. Caller changed.
522 Treat thread-specific signals differently from process-general signals.
523 Block all signals while handling fatal error; that's safer.
524 xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal
525 on IEEE hosts.
526 When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored.
527 Ignore SIGPIPE unless batch.
528 (emacs_backtrace): Output backtrace for the appropriate thread,
529 which is not necessarily the main thread.
530 * syssignal.h: Include <stdbool.h>.
531 (emacs_raise): New macro.
532 * xterm.c (x_connection_signal): Remove; no longer needed
533 now that we use sigaction.
534 (x_connection_closed): No need to mess with sigmask now.
535 (x_initialize): No need to reset SIGPIPE handler here, since
536 init_signals does this for us now.
537
5382012-09-23 Jan Djärv <jan.h.d@swipnet.se>
539
540 * nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into,
541 background rect may be larger (Bug#12245).
542
5432012-09-23 Chong Yidong <cyd@gnu.org>
544
545 * keyboard.c (timer_check): Avoid quitting during Fcopy_sequence.
546
62012-09-22 Paul Eggert <eggert@cs.ucla.edu> 5472012-09-22 Paul Eggert <eggert@cs.ucla.edu>
7 548
8 * .gdbinit: Just stop at fatal_error_backtrace. 549 * .gdbinit: Just stop at fatal_error_backtrace.
@@ -30,8 +571,8 @@
30 if it is defined. Arguments and return value changed. 571 if it is defined. Arguments and return value changed.
31 (valid_image_p, make_image): Callers changed. 572 (valid_image_p, make_image): Callers changed.
32 (xbm_type, xpm_type, pbm_type, png_type, jpeg_type, tiff_type) 573 (xbm_type, xpm_type, pbm_type, png_type, jpeg_type, tiff_type)
33 (gif_type, imagemagick_type, svg_type, gs_type): Add 574 (gif_type, imagemagick_type, svg_type, gs_type):
34 initialization functions. 575 Add initialization functions.
35 (Finit_image_library): Call lookup_image_type. 576 (Finit_image_library): Call lookup_image_type.
36 (CHECK_LIB_AVAILABLE): Macro deleted. 577 (CHECK_LIB_AVAILABLE): Macro deleted.
37 (lookup_image_type): Call define_image_type here, rather than via 578 (lookup_image_type): Call define_image_type here, rather than via
@@ -53,8 +594,8 @@
53 * window.c (Fsplit_window_internal): Handle only Qt value of 594 * window.c (Fsplit_window_internal): Handle only Qt value of
54 Vwindow_combination_limit separately. 595 Vwindow_combination_limit separately.
55 (Qtemp_buffer_resize): New symbol. 596 (Qtemp_buffer_resize): New symbol.
56 (Vwindow_combination_limit): New default value. Rewrite 597 (Vwindow_combination_limit): New default value.
57 doc-string. 598 Rewrite doc-string.
58 599
592012-09-22 Eli Zaretskii <eliz@gnu.org> 6002012-09-22 Eli Zaretskii <eliz@gnu.org>
60 601
@@ -153,7 +694,7 @@
153 (Fx_create_frame): Call x_set_offset to correctly interpret 694 (Fx_create_frame): Call x_set_offset to correctly interpret
154 top_pos in geometry. 695 top_pos in geometry.
155 696
156 * frame.c (read_integer, XParseGeometry): Moved from w32xfns.c. 697 * frame.c (read_integer, XParseGeometry): Move from w32xfns.c.
157 (Fx_parse_geometry): If there is a space in string, call 698 (Fx_parse_geometry): If there is a space in string, call
158 Qns_parse_geometry, otherwise do as on other terms (Bug#12368). 699 Qns_parse_geometry, otherwise do as on other terms (Bug#12368).
159 700
@@ -254,8 +795,8 @@
254 795
2552012-09-16 Martin Rudalics <rudalics@gmx.at> 7962012-09-16 Martin Rudalics <rudalics@gmx.at>
256 797
257 * window.c (Fwindow_parameter, Fset_window_parameter): Accept 798 * window.c (Fwindow_parameter, Fset_window_parameter):
258 any window as argument (Bug#12452). 799 Accept any window as argument (Bug#12452).
259 800
2602012-09-16 Jan Djärv <jan.h.d@swipnet.se> 8012012-09-16 Jan Djärv <jan.h.d@swipnet.se>
261 802
@@ -330,8 +871,8 @@
3302012-09-14 Dmitry Antipov <dmantipov@yandex.ru> 8712012-09-14 Dmitry Antipov <dmantipov@yandex.ru>
331 872
332 Avoid out-of-range marker position (Bug#12426). 873 Avoid out-of-range marker position (Bug#12426).
333 * insdel.c (replace_range, replace_range_2): Adjust 874 * insdel.c (replace_range, replace_range_2):
334 markers before overlays, as suggested by comments. 875 Adjust markers before overlays, as suggested by comments.
335 (insert_1_both, insert_from_buffer_1, adjust_after_replace): 876 (insert_1_both, insert_from_buffer_1, adjust_after_replace):
336 Remove redundant check before calling offset_intervals. 877 Remove redundant check before calling offset_intervals.
337 878
@@ -630,8 +1171,8 @@
630 in the internal border. 1171 in the internal border.
631 (x_set_window_size): Remove static variables and their usage. 1172 (x_set_window_size): Remove static variables and their usage.
632 (ns_redraw_scroll_bars): Fix NSTRACE arg. 1173 (ns_redraw_scroll_bars): Fix NSTRACE arg.
633 (ns_after_update_window_line, ns_draw_fringe_bitmap): Remove 1174 (ns_after_update_window_line, ns_draw_fringe_bitmap):
634 fringe/internal border adjustment (Bug#11052). 1175 Remove fringe/internal border adjustment (Bug#11052).
635 (ns_draw_fringe_bitmap): Make code more like other terms (xterm.c). 1176 (ns_draw_fringe_bitmap): Make code more like other terms (xterm.c).
636 (ns_draw_window_cursor): Remove fringe/internal border adjustment. 1177 (ns_draw_window_cursor): Remove fringe/internal border adjustment.
637 (ns_fix_rect_ibw): Remove. 1178 (ns_fix_rect_ibw): Remove.
@@ -848,8 +1389,8 @@
848 (init_signals) [FORWARD_SIGNAL_TO_MAIN_THREAD]: Initialize it; 1389 (init_signals) [FORWARD_SIGNAL_TO_MAIN_THREAD]: Initialize it;
849 code moved here from emacs.c's main function. 1390 code moved here from emacs.c's main function.
850 * sysdep.c, syssignal.h (handle_on_main_thread): New function, 1391 * sysdep.c, syssignal.h (handle_on_main_thread): New function,
851 replacing the old SIGNAL_THREAD_CHECK. All uses changed. This 1392 replacing the old SIGNAL_THREAD_CHECK. All uses changed.
852 lets callers save and restore errno properly. 1393 This lets callers save and restore errno properly.
853 1394
8542012-09-05 Dmitry Antipov <dmantipov@yandex.ru> 13952012-09-05 Dmitry Antipov <dmantipov@yandex.ru>
855 1396
@@ -1158,8 +1699,8 @@
1158 * process.c: Include TERM_HEADER instead of listing all possible 1699 * process.c: Include TERM_HEADER instead of listing all possible
1159 window-system headers. 1700 window-system headers.
1160 1701
1161 * nsterm.h: Remove declarations now in frame.h. Define 1702 * nsterm.h: Remove declarations now in frame.h.
1162 FRAME_X_SCREEN, FRAME_X_VISUAL. 1703 Define FRAME_X_SCREEN, FRAME_X_VISUAL.
1163 1704
1164 * menu.c: Include TERM_HEADER instead of listing all possible 1705 * menu.c: Include TERM_HEADER instead of listing all possible
1165 window-system headers. 1706 window-system headers.
@@ -1355,8 +1896,8 @@
1355 1896
1356 * nsterm.h (NSPanel): New class variable dialog_return. 1897 * nsterm.h (NSPanel): New class variable dialog_return.
1357 1898
1358 * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize 1899 * nsmenu.m (initWithContentRect:styleMask:backing:defer:):
1359 dialog_return. 1900 Initialize dialog_return.
1360 (windowShouldClose:): Use stop instead of stopModalWithCode. 1901 (windowShouldClose:): Use stop instead of stopModalWithCode.
1361 (clicked:): Ditto, and also set dialog_return (Bug#12258). 1902 (clicked:): Ditto, and also set dialog_return (Bug#12258).
1362 (timeout_handler:): Use stop instead of abortModal. Send a dummy 1903 (timeout_handler:): Use stop instead of abortModal. Send a dummy
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index d3b0a8284b5..1f444b9292c 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -5532,7 +5532,7 @@
5532 (update_frame_tool_bar): Remove old_req, new_req. Do not get tool bar 5532 (update_frame_tool_bar): Remove old_req, new_req. Do not get tool bar
5533 height, call xg_update_tool_bar_sizes instead. 5533 height, call xg_update_tool_bar_sizes instead.
5534 (free_frame_tool_bar): Remove from hbox or vbox depending on 5534 (free_frame_tool_bar): Remove from hbox or vbox depending on
5535 toolbar_in_hbox, Set all FRAME_TOOLBAR_*_(WIDTH|HEIGHT) to zero. 5535 toolbar_in_hbox. Set all FRAME_TOOLBAR_*_(WIDTH|HEIGHT) to zero.
5536 (xg_change_toolbar_position): New function. 5536 (xg_change_toolbar_position): New function.
5537 5537
5538 * frame.h (struct frame): Add tool_bar_position. 5538 * frame.h (struct frame): Add tool_bar_position.
diff --git a/src/ChangeLog.2 b/src/ChangeLog.2
index 1a9728f6896..0806106836e 100644
--- a/src/ChangeLog.2
+++ b/src/ChangeLog.2
@@ -2680,7 +2680,7 @@
2680 2680
26811986-12-11 Richard Mlynarik (mly@prep) 26811986-12-11 Richard Mlynarik (mly@prep)
2682 2682
2683 * emacs.c, dispnew.c: 2683 * emacs.c, dispnew.c:
2684 Rename inhibit_x_windows inhibit_window_system. 2684 Rename inhibit_x_windows inhibit_window_system.
2685 Understand "-nw" command-line option. 2685 Understand "-nw" command-line option.
2686 Reorganize init_display a little to make other window-system 2686 Reorganize init_display a little to make other window-system
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index 6c580fe4b52..4f6e02ff8d3 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -11154,7 +11154,7 @@
11154 (classify_object): Removed code to look up a function key in the 11154 (classify_object): Removed code to look up a function key in the
11155 global and local function key keymaps, since this will be done 11155 global and local function key keymaps, since this will be done
11156 more generally. 11156 more generally.
11157 (Fexecute_mouse_event): Elided this function with a #if 0; I 11157 (Fexecute_mouse_event): Elided this function with a #if 0; I
11158 think it will go away once the more general keymap stuff is 11158 think it will go away once the more general keymap stuff is
11159 implemented, but I'm not sure. 11159 implemented, but I'm not sure.
11160 (syms_of_keyboard): Removed defsubr for Sexecute_mouse_event. 11160 (syms_of_keyboard): Removed defsubr for Sexecute_mouse_event.
diff --git a/src/Makefile.in b/src/Makefile.in
index 37da170edbd..f8da0091711 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -153,6 +153,7 @@ M17N_FLT_CFLAGS = @M17N_FLT_CFLAGS@
153M17N_FLT_LIBS = @M17N_FLT_LIBS@ 153M17N_FLT_LIBS = @M17N_FLT_LIBS@
154 154
155LIB_CLOCK_GETTIME=@LIB_CLOCK_GETTIME@ 155LIB_CLOCK_GETTIME=@LIB_CLOCK_GETTIME@
156LIB_TIMER_TIME=@LIB_TIMER_TIME@
156 157
157DBUS_CFLAGS = @DBUS_CFLAGS@ 158DBUS_CFLAGS = @DBUS_CFLAGS@
158DBUS_LIBS = @DBUS_LIBS@ 159DBUS_LIBS = @DBUS_LIBS@
@@ -339,6 +340,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \
339 process.o gnutls.o callproc.o \ 340 process.o gnutls.o callproc.o \
340 region-cache.o sound.o atimer.o \ 341 region-cache.o sound.o atimer.o \
341 doprnt.o intervals.o textprop.o composite.o xml.o \ 342 doprnt.o intervals.o textprop.o composite.o xml.o \
343 profiler.o \
342 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ 344 $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \
343 $(WINDOW_SYSTEM_OBJ) 345 $(WINDOW_SYSTEM_OBJ)
344obj = $(base_obj) $(NS_OBJC_OBJ) 346obj = $(base_obj) $(NS_OBJC_OBJ)
@@ -384,8 +386,8 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
384## duplicated symbols. If the standard libraries were compiled 386## duplicated symbols. If the standard libraries were compiled
385## with GCC, we might need LIB_GCC again after them. 387## with GCC, we might need LIB_GCC again after them.
386LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \ 388LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
387 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) $(DBUS_LIBS) \ 389 $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) $(LIB_TIMER_TIME) \
388 $(LIB_EXECINFO) \ 390 $(DBUS_LIBS) $(LIB_EXECINFO) \
389 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \ 391 $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
390 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \ 392 $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
391 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \ 393 $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
diff --git a/src/alloc.c b/src/alloc.c
index 02ba2f5f9e3..df166b4924a 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -205,6 +205,7 @@ static Lisp_Object Qintervals;
205static Lisp_Object Qbuffers; 205static Lisp_Object Qbuffers;
206static Lisp_Object Qstring_bytes, Qvector_slots, Qheap; 206static Lisp_Object Qstring_bytes, Qvector_slots, Qheap;
207static Lisp_Object Qgc_cons_threshold; 207static Lisp_Object Qgc_cons_threshold;
208Lisp_Object Qautomatic_gc;
208Lisp_Object Qchar_table_extra_slots; 209Lisp_Object Qchar_table_extra_slots;
209 210
210/* Hook run after GC has finished. */ 211/* Hook run after GC has finished. */
@@ -633,13 +634,13 @@ static void
633malloc_block_input (void) 634malloc_block_input (void)
634{ 635{
635 if (block_input_in_memory_allocators) 636 if (block_input_in_memory_allocators)
636 BLOCK_INPUT; 637 block_input ();
637} 638}
638static void 639static void
639malloc_unblock_input (void) 640malloc_unblock_input (void)
640{ 641{
641 if (block_input_in_memory_allocators) 642 if (block_input_in_memory_allocators)
642 UNBLOCK_INPUT; 643 unblock_input ();
643} 644}
644# define MALLOC_BLOCK_INPUT malloc_block_input () 645# define MALLOC_BLOCK_INPUT malloc_block_input ()
645# define MALLOC_UNBLOCK_INPUT malloc_unblock_input () 646# define MALLOC_UNBLOCK_INPUT malloc_unblock_input ()
@@ -648,6 +649,13 @@ malloc_unblock_input (void)
648# define MALLOC_UNBLOCK_INPUT ((void) 0) 649# define MALLOC_UNBLOCK_INPUT ((void) 0)
649#endif 650#endif
650 651
652#define MALLOC_PROBE(size) \
653 do { \
654 if (profiler_memory_running) \
655 malloc_probe (size); \
656 } while (0)
657
658
651/* Like malloc but check for no memory and block interrupt input.. */ 659/* Like malloc but check for no memory and block interrupt input.. */
652 660
653void * 661void *
@@ -661,6 +669,7 @@ xmalloc (size_t size)
661 669
662 if (!val && size) 670 if (!val && size)
663 memory_full (size); 671 memory_full (size);
672 MALLOC_PROBE (size);
664 return val; 673 return val;
665} 674}
666 675
@@ -678,6 +687,7 @@ xzalloc (size_t size)
678 if (!val && size) 687 if (!val && size)
679 memory_full (size); 688 memory_full (size);
680 memset (val, 0, size); 689 memset (val, 0, size);
690 MALLOC_PROBE (size);
681 return val; 691 return val;
682} 692}
683 693
@@ -699,6 +709,7 @@ xrealloc (void *block, size_t size)
699 709
700 if (!val && size) 710 if (!val && size)
701 memory_full (size); 711 memory_full (size);
712 MALLOC_PROBE (size);
702 return val; 713 return val;
703} 714}
704 715
@@ -888,6 +899,7 @@ lisp_malloc (size_t nbytes, enum mem_type type)
888 MALLOC_UNBLOCK_INPUT; 899 MALLOC_UNBLOCK_INPUT;
889 if (!val && nbytes) 900 if (!val && nbytes)
890 memory_full (nbytes); 901 memory_full (nbytes);
902 MALLOC_PROBE (nbytes);
891 return val; 903 return val;
892} 904}
893 905
@@ -1093,6 +1105,8 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
1093 1105
1094 MALLOC_UNBLOCK_INPUT; 1106 MALLOC_UNBLOCK_INPUT;
1095 1107
1108 MALLOC_PROBE (nbytes);
1109
1096 eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN); 1110 eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN);
1097 return val; 1111 return val;
1098} 1112}
@@ -5043,6 +5057,23 @@ bounded_number (EMACS_INT number)
5043 return make_number (min (MOST_POSITIVE_FIXNUM, number)); 5057 return make_number (min (MOST_POSITIVE_FIXNUM, number));
5044} 5058}
5045 5059
5060/* Calculate total bytes of live objects. */
5061
5062static size_t
5063total_bytes_of_live_objects (void)
5064{
5065 size_t tot = 0;
5066 tot += total_conses * sizeof (struct Lisp_Cons);
5067 tot += total_symbols * sizeof (struct Lisp_Symbol);
5068 tot += total_markers * sizeof (union Lisp_Misc);
5069 tot += total_string_bytes;
5070 tot += total_vector_slots * word_size;
5071 tot += total_floats * sizeof (struct Lisp_Float);
5072 tot += total_intervals * sizeof (struct interval);
5073 tot += total_strings * sizeof (struct Lisp_String);
5074 return tot;
5075}
5076
5046DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "", 5077DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",
5047 doc: /* Reclaim storage for Lisp objects no longer needed. 5078 doc: /* Reclaim storage for Lisp objects no longer needed.
5048Garbage collection happens automatically if you cons more than 5079Garbage collection happens automatically if you cons more than
@@ -5068,6 +5099,8 @@ See Info node `(elisp)Garbage Collection'. */)
5068 ptrdiff_t count = SPECPDL_INDEX (); 5099 ptrdiff_t count = SPECPDL_INDEX ();
5069 EMACS_TIME start; 5100 EMACS_TIME start;
5070 Lisp_Object retval = Qnil; 5101 Lisp_Object retval = Qnil;
5102 size_t tot_before = 0;
5103 struct backtrace backtrace;
5071 5104
5072 if (abort_on_gc) 5105 if (abort_on_gc)
5073 emacs_abort (); 5106 emacs_abort ();
@@ -5077,6 +5110,14 @@ See Info node `(elisp)Garbage Collection'. */)
5077 if (pure_bytes_used_before_overflow) 5110 if (pure_bytes_used_before_overflow)
5078 return Qnil; 5111 return Qnil;
5079 5112
5113 /* Record this function, so it appears on the profiler's backtraces. */
5114 backtrace.next = backtrace_list;
5115 backtrace.function = Qautomatic_gc;
5116 backtrace.args = &Qnil;
5117 backtrace.nargs = 0;
5118 backtrace.debug_on_exit = 0;
5119 backtrace_list = &backtrace;
5120
5080 check_cons_list (); 5121 check_cons_list ();
5081 5122
5082 /* Don't keep undo information around forever. 5123 /* Don't keep undo information around forever.
@@ -5084,6 +5125,9 @@ See Info node `(elisp)Garbage Collection'. */)
5084 FOR_EACH_BUFFER (nextb) 5125 FOR_EACH_BUFFER (nextb)
5085 compact_buffer (nextb); 5126 compact_buffer (nextb);
5086 5127
5128 if (profiler_memory_running)
5129 tot_before = total_bytes_of_live_objects ();
5130
5087 start = current_emacs_time (); 5131 start = current_emacs_time ();
5088 5132
5089 /* In case user calls debug_print during GC, 5133 /* In case user calls debug_print during GC,
@@ -5125,7 +5169,7 @@ See Info node `(elisp)Garbage Collection'. */)
5125 if (garbage_collection_messages) 5169 if (garbage_collection_messages)
5126 message1_nolog ("Garbage collecting..."); 5170 message1_nolog ("Garbage collecting...");
5127 5171
5128 BLOCK_INPUT; 5172 block_input ();
5129 5173
5130 shrink_regexp_cache (); 5174 shrink_regexp_cache ();
5131 5175
@@ -5242,7 +5286,7 @@ See Info node `(elisp)Garbage Collection'. */)
5242 dump_zombies (); 5286 dump_zombies ();
5243#endif 5287#endif
5244 5288
5245 UNBLOCK_INPUT; 5289 unblock_input ();
5246 5290
5247 check_cons_list (); 5291 check_cons_list ();
5248 5292
@@ -5255,16 +5299,7 @@ See Info node `(elisp)Garbage Collection'. */)
5255 gc_relative_threshold = 0; 5299 gc_relative_threshold = 0;
5256 if (FLOATP (Vgc_cons_percentage)) 5300 if (FLOATP (Vgc_cons_percentage))
5257 { /* Set gc_cons_combined_threshold. */ 5301 { /* Set gc_cons_combined_threshold. */
5258 double tot = 0; 5302 double tot = total_bytes_of_live_objects ();
5259
5260 tot += total_conses * sizeof (struct Lisp_Cons);
5261 tot += total_symbols * sizeof (struct Lisp_Symbol);
5262 tot += total_markers * sizeof (union Lisp_Misc);
5263 tot += total_string_bytes;
5264 tot += total_vector_slots * word_size;
5265 tot += total_floats * sizeof (struct Lisp_Float);
5266 tot += total_intervals * sizeof (struct interval);
5267 tot += total_strings * sizeof (struct Lisp_String);
5268 5303
5269 tot *= XFLOAT_DATA (Vgc_cons_percentage); 5304 tot *= XFLOAT_DATA (Vgc_cons_percentage);
5270 if (0 < tot) 5305 if (0 < tot)
@@ -5367,6 +5402,17 @@ See Info node `(elisp)Garbage Collection'. */)
5367 5402
5368 gcs_done++; 5403 gcs_done++;
5369 5404
5405 /* Collect profiling data. */
5406 if (profiler_memory_running)
5407 {
5408 size_t swept = 0;
5409 size_t tot_after = total_bytes_of_live_objects ();
5410 if (tot_before > tot_after)
5411 swept = tot_before - tot_after;
5412 malloc_probe (swept);
5413 }
5414
5415 backtrace_list = backtrace.next;
5370 return retval; 5416 return retval;
5371} 5417}
5372 5418
@@ -6395,7 +6441,7 @@ die (const char *msg, const char *file, int line)
6395{ 6441{
6396 fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", 6442 fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n",
6397 file, line, msg); 6443 file, line, msg);
6398 fatal_error_backtrace (SIGABRT, INT_MAX); 6444 terminate_due_to_signal (SIGABRT, INT_MAX);
6399} 6445}
6400#endif 6446#endif
6401 6447
@@ -6527,6 +6573,7 @@ do hash-consing of the objects allocated to pure space. */);
6527 DEFSYM (Qstring_bytes, "string-bytes"); 6573 DEFSYM (Qstring_bytes, "string-bytes");
6528 DEFSYM (Qvector_slots, "vector-slots"); 6574 DEFSYM (Qvector_slots, "vector-slots");
6529 DEFSYM (Qheap, "heap"); 6575 DEFSYM (Qheap, "heap");
6576 DEFSYM (Qautomatic_gc, "Automatic GC");
6530 6577
6531 DEFSYM (Qgc_cons_threshold, "gc-cons-threshold"); 6578 DEFSYM (Qgc_cons_threshold, "gc-cons-threshold");
6532 DEFSYM (Qchar_table_extra_slots, "char-table-extra-slots"); 6579 DEFSYM (Qchar_table_extra_slots, "char-table-extra-slots");
diff --git a/src/atimer.c b/src/atimer.c
index 5dbd807872a..048c62798ef 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -40,13 +40,12 @@ static struct atimer *stopped_atimers;
40 40
41static struct atimer *atimers; 41static struct atimer *atimers;
42 42
43/* Non-zero means alarm signal handler has found ripe timers but 43/* The alarm timer and whether it was properly initialized, if
44 interrupt_input_blocked was non-zero. In this case, timer 44 POSIX timers are available. */
45 functions are not called until the next UNBLOCK_INPUT because timer 45#ifdef HAVE_TIMER_SETTIME
46 functions are expected to call X, and X cannot be assumed to be 46static timer_t alarm_timer;
47 reentrant. */ 47static bool alarm_timer_ok;
48 48#endif
49int pending_atimers;
50 49
51/* Block/unblock SIGALRM. */ 50/* Block/unblock SIGALRM. */
52 51
@@ -295,14 +294,25 @@ set_alarm (void)
295#ifdef HAVE_SETITIMER 294#ifdef HAVE_SETITIMER
296 struct itimerval it; 295 struct itimerval it;
297#endif 296#endif
297 EMACS_TIME now, interval;
298 298
299 /* Determine s/us till the next timer is ripe. */ 299#ifdef HAVE_TIMER_SETTIME
300 EMACS_TIME now = current_emacs_time (); 300 if (alarm_timer_ok)
301 {
302 struct itimerspec ispec;
303 ispec.it_value = atimers->expiration;
304 ispec.it_interval.tv_sec = ispec.it_interval.tv_nsec = 0;
305 if (timer_settime (alarm_timer, 0, &ispec, 0) == 0)
306 return;
307 }
308#endif
301 309
302 /* Don't set the interval to 0; this disables the timer. */ 310 /* Determine interval till the next timer is ripe.
303 EMACS_TIME interval = (EMACS_TIME_LE (atimers->expiration, now) 311 Don't set the interval to 0; this disables the timer. */
304 ? make_emacs_time (0, 1000 * 1000) 312 now = current_emacs_time ();
305 : sub_emacs_time (atimers->expiration, now)); 313 interval = (EMACS_TIME_LE (atimers->expiration, now)
314 ? make_emacs_time (0, 1000 * 1000)
315 : sub_emacs_time (atimers->expiration, now));
306 316
307#ifdef HAVE_SETITIMER 317#ifdef HAVE_SETITIMER
308 318
@@ -341,16 +351,11 @@ schedule_atimer (struct atimer *t)
341static void 351static void
342run_timers (void) 352run_timers (void)
343{ 353{
344 EMACS_TIME now; 354 EMACS_TIME now = current_emacs_time ();
345 355
346 while (atimers 356 while (atimers && EMACS_TIME_LE (atimers->expiration, now))
347 && (pending_atimers = interrupt_input_blocked) == 0
348 && (now = current_emacs_time (),
349 EMACS_TIME_LE (atimers->expiration, now)))
350 { 357 {
351 struct atimer *t; 358 struct atimer *t = atimers;
352
353 t = atimers;
354 atimers = atimers->next; 359 atimers = atimers->next;
355 t->fn (t); 360 t->fn (t);
356 361
@@ -366,16 +371,7 @@ run_timers (void)
366 } 371 }
367 } 372 }
368 373
369 if (! atimers) 374 set_alarm ();
370 pending_atimers = 0;
371
372 if (pending_atimers)
373 pending_signals = 1;
374 else
375 {
376 pending_signals = interrupt_input_pending;
377 set_alarm ();
378 }
379} 375}
380 376
381 377
@@ -385,23 +381,16 @@ run_timers (void)
385static void 381static void
386handle_alarm_signal (int sig) 382handle_alarm_signal (int sig)
387{ 383{
388 pending_atimers = 1;
389 pending_signals = 1; 384 pending_signals = 1;
390} 385}
391 386
392static void
393deliver_alarm_signal (int sig)
394{
395 handle_on_main_thread (sig, handle_alarm_signal);
396}
397
398 387
399/* Call alarm signal handler for pending timers. */ 388/* Do pending timers. */
400 389
401void 390void
402do_pending_atimers (void) 391do_pending_atimers (void)
403{ 392{
404 if (pending_atimers) 393 if (atimers)
405 { 394 {
406 block_atimers (); 395 block_atimers ();
407 run_timers (); 396 run_timers ();
@@ -417,12 +406,7 @@ void
417turn_on_atimers (bool on) 406turn_on_atimers (bool on)
418{ 407{
419 if (on) 408 if (on)
420 { 409 set_alarm ();
421 struct sigaction action;
422 emacs_sigaction_init (&action, deliver_alarm_signal);
423 sigaction (SIGALRM, &action, 0);
424 set_alarm ();
425 }
426 else 410 else
427 alarm (0); 411 alarm (0);
428} 412}
@@ -432,9 +416,15 @@ void
432init_atimer (void) 416init_atimer (void)
433{ 417{
434 struct sigaction action; 418 struct sigaction action;
419#ifdef HAVE_TIMER_SETTIME
420 struct sigevent sigev;
421 sigev.sigev_notify = SIGEV_SIGNAL;
422 sigev.sigev_signo = SIGALRM;
423 sigev.sigev_value.sival_ptr = &alarm_timer;
424 alarm_timer_ok = timer_create (CLOCK_REALTIME, &sigev, &alarm_timer) == 0;
425#endif
435 free_atimers = stopped_atimers = atimers = NULL; 426 free_atimers = stopped_atimers = atimers = NULL;
436 pending_atimers = 0;
437 /* pending_signals is initialized in init_keyboard.*/ 427 /* pending_signals is initialized in init_keyboard.*/
438 emacs_sigaction_init (&action, deliver_alarm_signal); 428 emacs_sigaction_init (&action, handle_alarm_signal);
439 sigaction (SIGALRM, &action, 0); 429 sigaction (SIGALRM, &action, 0);
440} 430}
diff --git a/src/blockinput.h b/src/blockinput.h
index 7501bfc91a0..70822e29be7 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -19,103 +19,57 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19#ifndef EMACS_BLOCKINPUT_H 19#ifndef EMACS_BLOCKINPUT_H
20#define EMACS_BLOCKINPUT_H 20#define EMACS_BLOCKINPUT_H
21 21
22#include "atimer.h" 22INLINE_HEADER_BEGIN
23#ifndef BLOCKINPUT_INLINE
24# define BLOCKINPUT_INLINE INLINE
25#endif
23 26
24/* When Emacs is using signal-driven input, the processing of those 27/* Emacs should avoid doing anything hairy in a signal handler, because
25 input signals can get pretty hairy. For example, when Emacs is 28 so many system functions are non-reentrant. For example, malloc
26 running under X windows, handling an input signal can entail 29 and the Xlib functions aren't usually re-entrant, so if they were
27 retrieving events from the X event queue, or making other X calls. 30 used by the SIGIO handler, we'd lose.
28
29 If an input signal occurs while Emacs is in the midst of some
30 non-reentrant code, and the signal processing invokes that same
31 code, we lose. For example, malloc and the Xlib functions aren't
32 usually re-entrant, and both are used by the X input signal handler
33 - if we try to process an input signal in the midst of executing
34 any of these functions, we'll lose.
35 31
36 To avoid this, we make the following requirements: 32 To avoid this, we make the following requirements:
37 33
38 * Everyone must evaluate BLOCK_INPUT before entering these functions, 34 * Everyone must evaluate BLOCK_INPUT before performing actions that
39 and then call UNBLOCK_INPUT after performing them. Calls 35 might conflict with a signal handler, and then call UNBLOCK_INPUT
40 BLOCK_INPUT and UNBLOCK_INPUT may be nested. 36 after performing them. Calls BLOCK_INPUT and UNBLOCK_INPUT may be
37 nested.
41 38
42 * Any complicated interrupt handling code should test 39 * Any complicated interrupt handling code should test
43 interrupt_input_blocked, and put off its work until later. 40 INPUT_BLOCKED_P, and put off its work until later.
44 41
45 * If the interrupt handling code wishes, it may set 42 * If the interrupt handling code wishes, it may set
46 interrupt_input_pending to a non-zero value. If that flag is set 43 pending_signals to a non-zero value. If that flag is set
47 when input becomes unblocked, UNBLOCK_INPUT will send a new SIGIO. */ 44 when input becomes unblocked, UNBLOCK_INPUT will then read
48 45 input and process timers.
49extern volatile int interrupt_input_blocked;
50
51/* Nonzero means an input interrupt has arrived
52 during the current critical section. */
53extern int interrupt_input_pending;
54 46
47 Historically, Emacs signal handlers did much more than they do now,
48 and this caused many BLOCK_INPUT calls to be sprinkled around the code.
49 FIXME: Remove calls that aren't needed now. */
55 50
56/* Non-zero means asynchronous timers should be run when input is 51extern volatile int interrupt_input_blocked;
57 unblocked. */
58 52
59extern int pending_atimers; 53/* Begin critical section. */
60 54
55BLOCKINPUT_INLINE void
56block_input (void)
57{
58 interrupt_input_blocked++;
59}
61 60
62/* Begin critical section. */ 61extern void unblock_input (void);
63#define BLOCK_INPUT (interrupt_input_blocked++) 62extern void totally_unblock_input (void);
64 63extern void unblock_input_to (int);
65/* End critical section.
66
67 If doing signal-driven input, and a signal came in when input was
68 blocked, reinvoke the signal handler now to deal with it.
69
70 Always test interrupt_input_pending; that's not too expensive, and
71 it'll never get set if we don't need to resignal. This is simpler
72 than dealing here with every configuration option that might affect
73 whether interrupt_input_pending can be nonzero. */
74
75#define UNBLOCK_INPUT \
76 do \
77 { \
78 --interrupt_input_blocked; \
79 if (interrupt_input_blocked == 0) \
80 { \
81 if (interrupt_input_pending) \
82 reinvoke_input_signal (); \
83 if (pending_atimers) \
84 do_pending_atimers (); \
85 } \
86 else if (interrupt_input_blocked < 0) \
87 emacs_abort (); \
88 } \
89 while (0)
90
91/* Undo any number of BLOCK_INPUT calls,
92 and also reinvoke any pending signal. */
93
94#define TOTALLY_UNBLOCK_INPUT \
95 do if (interrupt_input_blocked != 0) \
96 { \
97 interrupt_input_blocked = 1; \
98 UNBLOCK_INPUT; \
99 } \
100 while (0)
101
102/* Undo any number of BLOCK_INPUT calls down to level LEVEL,
103 and also (if the level is now 0) reinvoke any pending signal. */
104
105#define UNBLOCK_INPUT_TO(LEVEL) \
106 do \
107 { \
108 interrupt_input_blocked = (LEVEL) + 1; \
109 UNBLOCK_INPUT; \
110 } \
111 while (0)
112
113#define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
114 64
115/* In critical section ? */ 65/* In critical section ? */
116#define INPUT_BLOCKED_P (interrupt_input_blocked > 0)
117 66
118/* Defined in keyboard.c */ 67BLOCKINPUT_INLINE bool
119extern void reinvoke_input_signal (void); 68input_blocked_p (void)
69{
70 return 0 < interrupt_input_blocked;
71}
72
73INLINE_HEADER_END
120 74
121#endif /* EMACS_BLOCKINPUT_H */ 75#endif /* EMACS_BLOCKINPUT_H */
diff --git a/src/buffer.c b/src/buffer.c
index 22624e33a4b..356a308fce6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -550,11 +550,11 @@ even if it is dead. The return value is never nil. */)
550 b->indirections = 0; 550 b->indirections = 0;
551 551
552 BUF_GAP_SIZE (b) = 20; 552 BUF_GAP_SIZE (b) = 20;
553 BLOCK_INPUT; 553 block_input ();
554 /* We allocate extra 1-byte at the tail and keep it always '\0' for 554 /* We allocate extra 1-byte at the tail and keep it always '\0' for
555 anchoring a search. */ 555 anchoring a search. */
556 alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); 556 alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1);
557 UNBLOCK_INPUT; 557 unblock_input ();
558 if (! BUF_BEG_ADDR (b)) 558 if (! BUF_BEG_ADDR (b))
559 buffer_memory_full (BUF_GAP_SIZE (b) + 1); 559 buffer_memory_full (BUF_GAP_SIZE (b) + 1);
560 560
@@ -1923,7 +1923,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1923 1923
1924 bset_name (b, Qnil); 1924 bset_name (b, Qnil);
1925 1925
1926 BLOCK_INPUT; 1926 block_input ();
1927 if (b->base_buffer) 1927 if (b->base_buffer)
1928 { 1928 {
1929 /* Notify our base buffer that we don't share the text anymore. */ 1929 /* Notify our base buffer that we don't share the text anymore. */
@@ -1946,7 +1946,7 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1946 b->width_run_cache = 0; 1946 b->width_run_cache = 0;
1947 } 1947 }
1948 bset_width_table (b, Qnil); 1948 bset_width_table (b, Qnil);
1949 UNBLOCK_INPUT; 1949 unblock_input ();
1950 bset_undo_list (b, Qnil); 1950 bset_undo_list (b, Qnil);
1951 1951
1952 /* Run buffer-list-update-hook. */ 1952 /* Run buffer-list-update-hook. */
@@ -5032,7 +5032,7 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
5032{ 5032{
5033 void *p; 5033 void *p;
5034 5034
5035 BLOCK_INPUT; 5035 block_input ();
5036#if defined USE_MMAP_FOR_BUFFERS 5036#if defined USE_MMAP_FOR_BUFFERS
5037 p = mmap_alloc ((void **) &b->text->beg, nbytes); 5037 p = mmap_alloc ((void **) &b->text->beg, nbytes);
5038#elif defined REL_ALLOC 5038#elif defined REL_ALLOC
@@ -5043,12 +5043,12 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
5043 5043
5044 if (p == NULL) 5044 if (p == NULL)
5045 { 5045 {
5046 UNBLOCK_INPUT; 5046 unblock_input ();
5047 memory_full (nbytes); 5047 memory_full (nbytes);
5048 } 5048 }
5049 5049
5050 b->text->beg = (unsigned char *) p; 5050 b->text->beg = (unsigned char *) p;
5051 UNBLOCK_INPUT; 5051 unblock_input ();
5052} 5052}
5053 5053
5054/* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means 5054/* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means
@@ -5060,7 +5060,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
5060 void *p; 5060 void *p;
5061 ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 5061 ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1
5062 + delta); 5062 + delta);
5063 BLOCK_INPUT; 5063 block_input ();
5064#if defined USE_MMAP_FOR_BUFFERS 5064#if defined USE_MMAP_FOR_BUFFERS
5065 p = mmap_realloc ((void **) &b->text->beg, nbytes); 5065 p = mmap_realloc ((void **) &b->text->beg, nbytes);
5066#elif defined REL_ALLOC 5066#elif defined REL_ALLOC
@@ -5071,12 +5071,12 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
5071 5071
5072 if (p == NULL) 5072 if (p == NULL)
5073 { 5073 {
5074 UNBLOCK_INPUT; 5074 unblock_input ();
5075 memory_full (nbytes); 5075 memory_full (nbytes);
5076 } 5076 }
5077 5077
5078 BUF_BEG_ADDR (b) = (unsigned char *) p; 5078 BUF_BEG_ADDR (b) = (unsigned char *) p;
5079 UNBLOCK_INPUT; 5079 unblock_input ();
5080} 5080}
5081 5081
5082 5082
@@ -5085,7 +5085,7 @@ enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
5085static void 5085static void
5086free_buffer_text (struct buffer *b) 5086free_buffer_text (struct buffer *b)
5087{ 5087{
5088 BLOCK_INPUT; 5088 block_input ();
5089 5089
5090#if defined USE_MMAP_FOR_BUFFERS 5090#if defined USE_MMAP_FOR_BUFFERS
5091 mmap_free ((void **) &b->text->beg); 5091 mmap_free ((void **) &b->text->beg);
@@ -5096,7 +5096,7 @@ free_buffer_text (struct buffer *b)
5096#endif 5096#endif
5097 5097
5098 BUF_BEG_ADDR (b) = NULL; 5098 BUF_BEG_ADDR (b) = NULL;
5099 UNBLOCK_INPUT; 5099 unblock_input ();
5100} 5100}
5101 5101
5102 5102
diff --git a/src/bytecode.c b/src/bytecode.c
index 5f4fdcc5eff..648813aed86 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1876,7 +1876,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
1876 /* Actually this is Bstack_ref with offset 0, but we use Bdup 1876 /* Actually this is Bstack_ref with offset 0, but we use Bdup
1877 for that instead. */ 1877 for that instead. */
1878 /* CASE (Bstack_ref): */ 1878 /* CASE (Bstack_ref): */
1879 emacs_abort (); 1879 error ("Invalid byte opcode");
1880 1880
1881 /* Handy byte-codes for lexical binding. */ 1881 /* Handy byte-codes for lexical binding. */
1882 CASE (Bstack_ref1): 1882 CASE (Bstack_ref1):
diff --git a/src/callproc.c b/src/callproc.c
index 2604d295f3e..b33882e54c2 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -51,6 +51,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51#include "process.h" 51#include "process.h"
52#include "syssignal.h" 52#include "syssignal.h"
53#include "systty.h" 53#include "systty.h"
54#include "syswait.h"
54#include "blockinput.h" 55#include "blockinput.h"
55#include "frame.h" 56#include "frame.h"
56#include "termhooks.h" 57#include "termhooks.h"
@@ -582,7 +583,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
582 0, current_dir); 583 0, current_dir);
583#else /* not WINDOWSNT */ 584#else /* not WINDOWSNT */
584 585
585 BLOCK_INPUT; 586 block_input ();
586 587
587 /* vfork, and prevent local vars from being clobbered by the vfork. */ 588 /* vfork, and prevent local vars from being clobbered by the vfork. */
588 { 589 {
@@ -626,15 +627,14 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
626 setpgrp (pid, pid); 627 setpgrp (pid, pid);
627#endif /* USG */ 628#endif /* USG */
628 629
629 /* GConf causes us to ignore SIGPIPE, make sure it is restored 630 /* Emacs ignores SIGPIPE, but the child should not. */
630 in the child. */
631 signal (SIGPIPE, SIG_DFL); 631 signal (SIGPIPE, SIG_DFL);
632 632
633 child_setup (filefd, fd1, fd_error, (char **) new_argv, 633 child_setup (filefd, fd1, fd_error, (char **) new_argv,
634 0, current_dir); 634 0, current_dir);
635 } 635 }
636 636
637 UNBLOCK_INPUT; 637 unblock_input ();
638 638
639#endif /* not WINDOWSNT */ 639#endif /* not WINDOWSNT */
640 640
@@ -976,9 +976,9 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
976 { 976 {
977 int fd; 977 int fd;
978 978
979 BLOCK_INPUT; 979 block_input ();
980 fd = mkstemp (tempfile); 980 fd = mkstemp (tempfile);
981 UNBLOCK_INPUT; 981 unblock_input ();
982 if (fd == -1) 982 if (fd == -1)
983 report_file_error ("Failed to open temporary file", 983 report_file_error ("Failed to open temporary file",
984 Fcons (build_string (tempfile), Qnil)); 984 Fcons (build_string (tempfile), Qnil));
diff --git a/src/character.c b/src/character.c
index def1ad090fd..5808d48a235 100644
--- a/src/character.c
+++ b/src/character.c
@@ -126,8 +126,6 @@ char_string (unsigned int c, unsigned char *p)
126 c &= ~CHAR_MODIFIER_MASK; 126 c &= ~CHAR_MODIFIER_MASK;
127 } 127 }
128 128
129 MAYBE_UNIFY_CHAR (c);
130
131 if (c <= MAX_3_BYTE_CHAR) 129 if (c <= MAX_3_BYTE_CHAR)
132 { 130 {
133 bytes = CHAR_STRING (c, p); 131 bytes = CHAR_STRING (c, p);
@@ -195,8 +193,6 @@ string_char (const unsigned char *p, const unsigned char **advanced, int *len)
195 p += 5; 193 p += 5;
196 } 194 }
197 195
198 MAYBE_UNIFY_CHAR (c);
199
200 if (len) 196 if (len)
201 *len = p - saved_p; 197 *len = p - saved_p;
202 if (advanced) 198 if (advanced)
diff --git a/src/character.h b/src/character.h
index 70d4e67a978..b2cdcb76699 100644
--- a/src/character.h
+++ b/src/character.h
@@ -554,23 +554,6 @@ INLINE_HEADER_BEGIN
554 } while (0) 554 } while (0)
555 555
556 556
557/* If C is a character to be unified with a Unicode character, return
558 the unified Unicode character. */
559
560#define MAYBE_UNIFY_CHAR(c) \
561 do { \
562 if (c > MAX_UNICODE_CHAR && c <= MAX_5_BYTE_CHAR) \
563 { \
564 Lisp_Object val; \
565 val = CHAR_TABLE_REF (Vchar_unify_table, c); \
566 if (INTEGERP (val)) \
567 c = XFASTINT (val); \
568 else if (! NILP (val)) \
569 c = maybe_unify_char (c, val); \
570 } \
571 } while (0)
572
573
574/* Return a non-outlandish value for the tab width. */ 557/* Return a non-outlandish value for the tab width. */
575 558
576#define SANE_TAB_WIDTH(buf) \ 559#define SANE_TAB_WIDTH(buf) \
diff --git a/src/charset.c b/src/charset.c
index d8c38e5ea3b..b0915ffde9c 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1617,7 +1617,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
1617/* Return a unified character code for C (>= 0x110000). VAL is a 1617/* Return a unified character code for C (>= 0x110000). VAL is a
1618 value of Vchar_unify_table for C; i.e. it is nil, an integer, or a 1618 value of Vchar_unify_table for C; i.e. it is nil, an integer, or a
1619 charset symbol. */ 1619 charset symbol. */
1620int 1620static int
1621maybe_unify_char (int c, Lisp_Object val) 1621maybe_unify_char (int c, Lisp_Object val)
1622{ 1622{
1623 struct charset *charset; 1623 struct charset *charset;
@@ -1723,8 +1723,12 @@ decode_char (struct charset *charset, unsigned int code)
1723 { 1723 {
1724 c = char_index + CHARSET_CODE_OFFSET (charset); 1724 c = char_index + CHARSET_CODE_OFFSET (charset);
1725 if (CHARSET_UNIFIED_P (charset) 1725 if (CHARSET_UNIFIED_P (charset)
1726 && c > MAX_UNICODE_CHAR) 1726 && MAX_UNICODE_CHAR < c && c <= MAX_5_BYTE_CHAR)
1727 MAYBE_UNIFY_CHAR (c); 1727 {
1728 /* Unify C with a Unicode character if possible. */
1729 Lisp_Object val = CHAR_TABLE_REF (Vchar_unify_table, c);
1730 c = maybe_unify_char (c, val);
1731 }
1728 } 1732 }
1729 } 1733 }
1730 1734
diff --git a/src/charset.h b/src/charset.h
index 50d230489fe..b5fa36290c8 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -538,7 +538,6 @@ extern int charset_unibyte;
538extern struct charset *char_charset (int, Lisp_Object, unsigned *); 538extern struct charset *char_charset (int, Lisp_Object, unsigned *);
539extern Lisp_Object charset_attributes (int); 539extern Lisp_Object charset_attributes (int);
540 540
541extern int maybe_unify_char (int, Lisp_Object);
542extern int decode_char (struct charset *, unsigned); 541extern int decode_char (struct charset *, unsigned);
543extern unsigned encode_char (struct charset *, int); 542extern unsigned encode_char (struct charset *, int);
544extern int string_xstring_p (Lisp_Object); 543extern int string_xstring_p (Lisp_Object);
diff --git a/src/chartab.c b/src/chartab.c
index e864514e336..7430235b4af 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -655,15 +655,6 @@ or a character code. Return VALUE. */)
655 return value; 655 return value;
656} 656}
657 657
658DEFUN ("set-char-table-default", Fset_char_table_default,
659 Sset_char_table_default, 3, 3, 0,
660 doc: /*
661This function is obsolete and has no effect. */)
662 (Lisp_Object char_table, Lisp_Object ch, Lisp_Object value)
663{
664 return Qnil;
665}
666
667/* Look up the element in TABLE at index CH, and return it as an 658/* Look up the element in TABLE at index CH, and return it as an
668 integer. If the element is not a character, return CH itself. */ 659 integer. If the element is not a character, return CH itself. */
669 660
@@ -1415,7 +1406,6 @@ syms_of_chartab (void)
1415 defsubr (&Sset_char_table_extra_slot); 1406 defsubr (&Sset_char_table_extra_slot);
1416 defsubr (&Schar_table_range); 1407 defsubr (&Schar_table_range);
1417 defsubr (&Sset_char_table_range); 1408 defsubr (&Sset_char_table_range);
1418 defsubr (&Sset_char_table_default);
1419 defsubr (&Soptimize_char_table); 1409 defsubr (&Soptimize_char_table);
1420 defsubr (&Smap_char_table); 1410 defsubr (&Smap_char_table);
1421 defsubr (&Sunicode_property_table_internal); 1411 defsubr (&Sunicode_property_table_internal);
diff --git a/src/coding.c b/src/coding.c
index 40e67b9a6c8..32d300b9923 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -920,65 +920,18 @@ record_conversion_result (struct coding_system *coding,
920 920
921 921
922/* Store multibyte form of the character C in P, and advance P to the 922/* Store multibyte form of the character C in P, and advance P to the
923 end of the multibyte form. This is like CHAR_STRING_ADVANCE but it 923 end of the multibyte form. This used to be like CHAR_STRING_ADVANCE
924 never calls MAYBE_UNIFY_CHAR. */ 924 without ever calling MAYBE_UNIFY_CHAR, but nowadays we don't call
925 925 MAYBE_UNIFY_CHAR in CHAR_STRING_ADVANCE. */
926#define CHAR_STRING_ADVANCE_NO_UNIFY(c, p) \
927 do { \
928 if ((c) <= MAX_1_BYTE_CHAR) \
929 *(p)++ = (c); \
930 else if ((c) <= MAX_2_BYTE_CHAR) \
931 *(p)++ = (0xC0 | ((c) >> 6)), \
932 *(p)++ = (0x80 | ((c) & 0x3F)); \
933 else if ((c) <= MAX_3_BYTE_CHAR) \
934 *(p)++ = (0xE0 | ((c) >> 12)), \
935 *(p)++ = (0x80 | (((c) >> 6) & 0x3F)), \
936 *(p)++ = (0x80 | ((c) & 0x3F)); \
937 else if ((c) <= MAX_4_BYTE_CHAR) \
938 *(p)++ = (0xF0 | (c >> 18)), \
939 *(p)++ = (0x80 | ((c >> 12) & 0x3F)), \
940 *(p)++ = (0x80 | ((c >> 6) & 0x3F)), \
941 *(p)++ = (0x80 | (c & 0x3F)); \
942 else if ((c) <= MAX_5_BYTE_CHAR) \
943 *(p)++ = 0xF8, \
944 *(p)++ = (0x80 | ((c >> 18) & 0x0F)), \
945 *(p)++ = (0x80 | ((c >> 12) & 0x3F)), \
946 *(p)++ = (0x80 | ((c >> 6) & 0x3F)), \
947 *(p)++ = (0x80 | (c & 0x3F)); \
948 else \
949 (p) += BYTE8_STRING ((c) - 0x3FFF80, p); \
950 } while (0)
951 926
927#define CHAR_STRING_ADVANCE_NO_UNIFY(c, p) CHAR_STRING_ADVANCE(c, p)
952 928
953/* Return the character code of character whose multibyte form is at 929/* Return the character code of character whose multibyte form is at
954 P, and advance P to the end of the multibyte form. This is like 930 P, and advance P to the end of the multibyte form. This used to be
955 STRING_CHAR_ADVANCE, but it never calls MAYBE_UNIFY_CHAR. */ 931 like STRING_CHAR_ADVANCE without ever calling MAYBE_UNIFY_CHAR, but
956 932 nowadays STRING_CHAR_ADVANCE doesn't call MAYBE_UNIFY_CHAR. */
957#define STRING_CHAR_ADVANCE_NO_UNIFY(p) \
958 (!((p)[0] & 0x80) \
959 ? *(p)++ \
960 : ! ((p)[0] & 0x20) \
961 ? ((p) += 2, \
962 ((((p)[-2] & 0x1F) << 6) \
963 | ((p)[-1] & 0x3F) \
964 | ((unsigned char) ((p)[-2]) < 0xC2 ? 0x3FFF80 : 0))) \
965 : ! ((p)[0] & 0x10) \
966 ? ((p) += 3, \
967 ((((p)[-3] & 0x0F) << 12) \
968 | (((p)[-2] & 0x3F) << 6) \
969 | ((p)[-1] & 0x3F))) \
970 : ! ((p)[0] & 0x08) \
971 ? ((p) += 4, \
972 ((((p)[-4] & 0xF) << 18) \
973 | (((p)[-3] & 0x3F) << 12) \
974 | (((p)[-2] & 0x3F) << 6) \
975 | ((p)[-1] & 0x3F))) \
976 : ((p) += 5, \
977 ((((p)[-4] & 0x3F) << 18) \
978 | (((p)[-3] & 0x3F) << 12) \
979 | (((p)[-2] & 0x3F) << 6) \
980 | ((p)[-1] & 0x3F))))
981 933
934#define STRING_CHAR_ADVANCE_NO_UNIFY(p) STRING_CHAR_ADVANCE(p)
982 935
983/* Set coding->source from coding->src_object. */ 936/* Set coding->source from coding->src_object. */
984 937
diff --git a/src/data.c b/src/data.c
index 72d7c8ccf9a..abcdd4dca0d 100644
--- a/src/data.c
+++ b/src/data.c
@@ -34,14 +34,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34#include "font.h" 34#include "font.h"
35#include "keymap.h" 35#include "keymap.h"
36 36
37#include <float.h>
38#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
39 && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
40#define IEEE_FLOATING_POINT 1
41#else
42#define IEEE_FLOATING_POINT 0
43#endif
44
45Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; 37Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
46static Lisp_Object Qsubr; 38static Lisp_Object Qsubr;
47Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; 39Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
@@ -3179,32 +3171,3 @@ syms_of_data (void)
3179 Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); 3171 Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM);
3180 XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; 3172 XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1;
3181} 3173}
3182
3183static _Noreturn void
3184handle_arith_signal (int sig)
3185{
3186 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
3187 xsignal0 (Qarith_error);
3188}
3189
3190static void
3191deliver_arith_signal (int sig)
3192{
3193 handle_on_main_thread (sig, handle_arith_signal);
3194}
3195
3196void
3197init_data (void)
3198{
3199 struct sigaction action;
3200 /* Don't do this if just dumping out.
3201 We don't want to call `signal' in this case
3202 so that we don't have trouble with dumping
3203 signal-delivering routines in an inconsistent state. */
3204#ifndef CANNOT_DUMP
3205 if (!initialized)
3206 return;
3207#endif /* CANNOT_DUMP */
3208 emacs_sigaction_init (&action, deliver_arith_signal);
3209 sigaction (SIGFPE, &action, 0);
3210}
diff --git a/src/dired.c b/src/dired.c
index 3aa27ecf920..4986f845101 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -101,9 +101,9 @@ static Lisp_Object
101directory_files_internal_unwind (Lisp_Object dh) 101directory_files_internal_unwind (Lisp_Object dh)
102{ 102{
103 DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; 103 DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer;
104 BLOCK_INPUT; 104 block_input ();
105 closedir (d); 105 closedir (d);
106 UNBLOCK_INPUT; 106 unblock_input ();
107 return Qnil; 107 return Qnil;
108} 108}
109 109
@@ -164,9 +164,9 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
164 /* Now *bufp is the compiled form of MATCH; don't call anything 164 /* Now *bufp is the compiled form of MATCH; don't call anything
165 which might compile a new regexp until we're done with the loop! */ 165 which might compile a new regexp until we're done with the loop! */
166 166
167 BLOCK_INPUT; 167 block_input ();
168 d = opendir (SSDATA (dirfilename)); 168 d = opendir (SSDATA (dirfilename));
169 UNBLOCK_INPUT; 169 unblock_input ();
170 if (d == NULL) 170 if (d == NULL)
171 report_file_error ("Opening directory", Fcons (directory, Qnil)); 171 report_file_error ("Opening directory", Fcons (directory, Qnil));
172 172
@@ -310,9 +310,9 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
310 } 310 }
311 } 311 }
312 312
313 BLOCK_INPUT; 313 block_input ();
314 closedir (d); 314 closedir (d);
315 UNBLOCK_INPUT; 315 unblock_input ();
316#ifdef WINDOWSNT 316#ifdef WINDOWSNT
317 if (attrs) 317 if (attrs)
318 Vw32_get_true_file_attributes = w32_save; 318 Vw32_get_true_file_attributes = w32_save;
@@ -486,9 +486,9 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
486 486
487 encoded_dir = ENCODE_FILE (dirname); 487 encoded_dir = ENCODE_FILE (dirname);
488 488
489 BLOCK_INPUT; 489 block_input ();
490 d = opendir (SSDATA (Fdirectory_file_name (encoded_dir))); 490 d = opendir (SSDATA (Fdirectory_file_name (encoded_dir)));
491 UNBLOCK_INPUT; 491 unblock_input ();
492 if (!d) 492 if (!d)
493 report_file_error ("Opening directory", Fcons (dirname, Qnil)); 493 report_file_error ("Opening directory", Fcons (dirname, Qnil));
494 494
@@ -962,10 +962,10 @@ so last access time will always be midnight of that day. */)
962 962
963 if (!(NILP (id_format) || EQ (id_format, Qinteger))) 963 if (!(NILP (id_format) || EQ (id_format, Qinteger)))
964 { 964 {
965 BLOCK_INPUT; 965 block_input ();
966 uname = stat_uname (&s); 966 uname = stat_uname (&s);
967 gname = stat_gname (&s); 967 gname = stat_gname (&s);
968 UNBLOCK_INPUT; 968 unblock_input ();
969 } 969 }
970 if (uname) 970 if (uname)
971 values[2] = DECODE_SYSTEM (build_string (uname)); 971 values[2] = DECODE_SYSTEM (build_string (uname));
diff --git a/src/dispextern.h b/src/dispextern.h
index 1faeeb19d5b..3c42d7abb9d 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2757,19 +2757,19 @@ struct image_type
2757 Lisp_Object *type; 2757 Lisp_Object *type;
2758 2758
2759 /* Check that SPEC is a valid image specification for the given 2759 /* Check that SPEC is a valid image specification for the given
2760 image type. Value is non-zero if SPEC is valid. */ 2760 image type. Value is true if SPEC is valid. */
2761 int (* valid_p) (Lisp_Object spec); 2761 bool (* valid_p) (Lisp_Object spec);
2762 2762
2763 /* Load IMG which is used on frame F from information contained in 2763 /* Load IMG which is used on frame F from information contained in
2764 IMG->spec. Value is non-zero if successful. */ 2764 IMG->spec. Value is true if successful. */
2765 int (* load) (struct frame *f, struct image *img); 2765 bool (* load) (struct frame *f, struct image *img);
2766 2766
2767 /* Free resources of image IMG which is used on frame F. */ 2767 /* Free resources of image IMG which is used on frame F. */
2768 void (* free) (struct frame *f, struct image *img); 2768 void (* free) (struct frame *f, struct image *img);
2769 2769
2770 /* Initialization function (used for dynamic loading of image 2770 /* Initialization function (used for dynamic loading of image
2771 libraries on Windows), or NULL if none. */ 2771 libraries on Windows), or NULL if none. */
2772 int (* init) (Lisp_Object); 2772 bool (* init) (void);
2773 2773
2774 /* Next in list of all supported image types. */ 2774 /* Next in list of all supported image types. */
2775 struct image_type *next; 2775 struct image_type *next;
@@ -3169,7 +3169,7 @@ extern ptrdiff_t x_create_bitmap_from_xpm_data (struct frame *, const char **);
3169extern void x_destroy_bitmap (struct frame *, ptrdiff_t); 3169extern void x_destroy_bitmap (struct frame *, ptrdiff_t);
3170#endif 3170#endif
3171extern void x_destroy_all_bitmaps (Display_Info *); 3171extern void x_destroy_all_bitmaps (Display_Info *);
3172extern int x_create_bitmap_mask (struct frame *, ptrdiff_t); 3172extern void x_create_bitmap_mask (struct frame *, ptrdiff_t);
3173extern Lisp_Object x_find_image_file (Lisp_Object); 3173extern Lisp_Object x_find_image_file (Lisp_Object);
3174 3174
3175void x_kill_gs_process (Pixmap, struct frame *); 3175void x_kill_gs_process (Pixmap, struct frame *);
@@ -3177,7 +3177,7 @@ struct image_cache *make_image_cache (void);
3177void free_image_cache (struct frame *); 3177void free_image_cache (struct frame *);
3178void clear_image_caches (Lisp_Object); 3178void clear_image_caches (Lisp_Object);
3179void mark_image_cache (struct image_cache *); 3179void mark_image_cache (struct image_cache *);
3180int valid_image_p (Lisp_Object); 3180bool valid_image_p (Lisp_Object);
3181void prepare_image_for_display (struct frame *, struct image *); 3181void prepare_image_for_display (struct frame *, struct image *);
3182ptrdiff_t lookup_image (struct frame *, Lisp_Object); 3182ptrdiff_t lookup_image (struct frame *, Lisp_Object);
3183 3183
diff --git a/src/dispnew.c b/src/dispnew.c
index fc966581adb..555136d785c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1834,7 +1834,7 @@ adjust_glyphs (struct frame *f)
1834{ 1834{
1835 /* Block input so that expose events and other events that access 1835 /* Block input so that expose events and other events that access
1836 glyph matrices are not processed while we are changing them. */ 1836 glyph matrices are not processed while we are changing them. */
1837 BLOCK_INPUT; 1837 block_input ();
1838 1838
1839 if (f) 1839 if (f)
1840 adjust_frame_glyphs (f); 1840 adjust_frame_glyphs (f);
@@ -1846,7 +1846,7 @@ adjust_glyphs (struct frame *f)
1846 adjust_frame_glyphs (XFRAME (lisp_frame)); 1846 adjust_frame_glyphs (XFRAME (lisp_frame));
1847 } 1847 }
1848 1848
1849 UNBLOCK_INPUT; 1849 unblock_input ();
1850} 1850}
1851 1851
1852 1852
@@ -2242,7 +2242,7 @@ free_glyphs (struct frame *f)
2242 { 2242 {
2243 /* Block interrupt input so that we don't get surprised by an X 2243 /* Block interrupt input so that we don't get surprised by an X
2244 event while we're in an inconsistent state. */ 2244 event while we're in an inconsistent state. */
2245 BLOCK_INPUT; 2245 block_input ();
2246 f->glyphs_initialized_p = 0; 2246 f->glyphs_initialized_p = 0;
2247 2247
2248 /* Release window sub-matrices. */ 2248 /* Release window sub-matrices. */
@@ -2287,7 +2287,7 @@ free_glyphs (struct frame *f)
2287 f->desired_pool = f->current_pool = NULL; 2287 f->desired_pool = f->current_pool = NULL;
2288 } 2288 }
2289 2289
2290 UNBLOCK_INPUT; 2290 unblock_input ();
2291 } 2291 }
2292} 2292}
2293 2293
@@ -5563,10 +5563,6 @@ handle_window_change_signal (int sig)
5563 int width, height; 5563 int width, height;
5564 struct tty_display_info *tty; 5564 struct tty_display_info *tty;
5565 5565
5566 struct sigaction action;
5567 emacs_sigaction_init (&action, deliver_window_change_signal);
5568 sigaction (SIGWINCH, &action, 0);
5569
5570 /* The frame size change obviously applies to a single 5566 /* The frame size change obviously applies to a single
5571 termcap-controlled terminal, but we can't decide which. 5567 termcap-controlled terminal, but we can't decide which.
5572 Therefore, we resize the frames corresponding to each tty. 5568 Therefore, we resize the frames corresponding to each tty.
@@ -5599,7 +5595,7 @@ handle_window_change_signal (int sig)
5599static void 5595static void
5600deliver_window_change_signal (int sig) 5596deliver_window_change_signal (int sig)
5601{ 5597{
5602 handle_on_main_thread (sig, handle_window_change_signal); 5598 deliver_process_signal (sig, handle_window_change_signal);
5603} 5599}
5604#endif /* SIGWINCH */ 5600#endif /* SIGWINCH */
5605 5601
@@ -5708,7 +5704,7 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
5708 && new_frame_total_cols == FRAME_TOTAL_COLS (f)) 5704 && new_frame_total_cols == FRAME_TOTAL_COLS (f))
5709 return; 5705 return;
5710 5706
5711 BLOCK_INPUT; 5707 block_input ();
5712 5708
5713#ifdef MSDOS 5709#ifdef MSDOS
5714 /* We only can set screen dimensions to certain values supported 5710 /* We only can set screen dimensions to certain values supported
@@ -5760,7 +5756,7 @@ change_frame_size_1 (struct frame *f, int newheight, int newwidth,
5760 SET_FRAME_GARBAGED (f); 5756 SET_FRAME_GARBAGED (f);
5761 f->resized_p = 1; 5757 f->resized_p = 1;
5762 5758
5763 UNBLOCK_INPUT; 5759 unblock_input ();
5764 5760
5765 record_unwind_current_buffer (); 5761 record_unwind_current_buffer ();
5766 5762
@@ -5791,9 +5787,9 @@ FILE = nil means just close any termscript file currently open. */)
5791 5787
5792 if (tty->termscript != 0) 5788 if (tty->termscript != 0)
5793 { 5789 {
5794 BLOCK_INPUT; 5790 block_input ();
5795 fclose (tty->termscript); 5791 fclose (tty->termscript);
5796 UNBLOCK_INPUT; 5792 unblock_input ();
5797 } 5793 }
5798 tty->termscript = 0; 5794 tty->termscript = 0;
5799 5795
@@ -5824,7 +5820,7 @@ when TERMINAL is nil. */)
5824 5820
5825 /* ??? Perhaps we should do something special for multibyte strings here. */ 5821 /* ??? Perhaps we should do something special for multibyte strings here. */
5826 CHECK_STRING (string); 5822 CHECK_STRING (string);
5827 BLOCK_INPUT; 5823 block_input ();
5828 5824
5829 if (!t) 5825 if (!t)
5830 error ("Unknown terminal device"); 5826 error ("Unknown terminal device");
@@ -5849,7 +5845,7 @@ when TERMINAL is nil. */)
5849 } 5845 }
5850 fwrite (SDATA (string), 1, SBYTES (string), out); 5846 fwrite (SDATA (string), 1, SBYTES (string), out);
5851 fflush (out); 5847 fflush (out);
5852 UNBLOCK_INPUT; 5848 unblock_input ();
5853 return Qnil; 5849 return Qnil;
5854} 5850}
5855 5851
diff --git a/src/dosfns.c b/src/dosfns.c
index 3c649f4d534..ce1ec4a4f93 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -480,9 +480,9 @@ x_set_title (struct frame *f, Lisp_Object name)
480 480
481 if (FRAME_MSDOS_P (f)) 481 if (FRAME_MSDOS_P (f))
482 { 482 {
483 BLOCK_INPUT; 483 block_input ();
484 w95_set_virtual_machine_title (SDATA (name)); 484 w95_set_virtual_machine_title (SDATA (name));
485 UNBLOCK_INPUT; 485 unblock_input ();
486 } 486 }
487} 487}
488#endif /* !HAVE_X_WINDOWS */ 488#endif /* !HAVE_X_WINDOWS */
diff --git a/src/editfns.c b/src/editfns.c
index acf9c48e7a0..fc6465a3d46 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1219,9 +1219,9 @@ of the user with that uid, or nil if there is no such user. */)
1219 return Vuser_login_name; 1219 return Vuser_login_name;
1220 1220
1221 CONS_TO_INTEGER (uid, uid_t, id); 1221 CONS_TO_INTEGER (uid, uid_t, id);
1222 BLOCK_INPUT; 1222 block_input ();
1223 pw = getpwuid (id); 1223 pw = getpwuid (id);
1224 UNBLOCK_INPUT; 1224 unblock_input ();
1225 return (pw ? build_string (pw->pw_name) : Qnil); 1225 return (pw ? build_string (pw->pw_name) : Qnil);
1226} 1226}
1227 1227
@@ -1279,15 +1279,15 @@ name, or nil if there is no such user. */)
1279 { 1279 {
1280 uid_t u; 1280 uid_t u;
1281 CONS_TO_INTEGER (uid, uid_t, u); 1281 CONS_TO_INTEGER (uid, uid_t, u);
1282 BLOCK_INPUT; 1282 block_input ();
1283 pw = getpwuid (u); 1283 pw = getpwuid (u);
1284 UNBLOCK_INPUT; 1284 unblock_input ();
1285 } 1285 }
1286 else if (STRINGP (uid)) 1286 else if (STRINGP (uid))
1287 { 1287 {
1288 BLOCK_INPUT; 1288 block_input ();
1289 pw = getpwnam (SSDATA (uid)); 1289 pw = getpwnam (SSDATA (uid));
1290 UNBLOCK_INPUT; 1290 unblock_input ();
1291 } 1291 }
1292 else 1292 else
1293 error ("Invalid UID specification"); 1293 error ("Invalid UID specification");
@@ -1763,14 +1763,14 @@ format_time_string (char const *format, ptrdiff_t formatlen,
1763 while (1) 1763 while (1)
1764 { 1764 {
1765 time_t *taddr = emacs_secs_addr (&t); 1765 time_t *taddr = emacs_secs_addr (&t);
1766 BLOCK_INPUT; 1766 block_input ();
1767 1767
1768 synchronize_system_time_locale (); 1768 synchronize_system_time_locale ();
1769 1769
1770 tm = ut ? gmtime (taddr) : localtime (taddr); 1770 tm = ut ? gmtime (taddr) : localtime (taddr);
1771 if (! tm) 1771 if (! tm)
1772 { 1772 {
1773 UNBLOCK_INPUT; 1773 unblock_input ();
1774 time_overflow (); 1774 time_overflow ();
1775 } 1775 }
1776 *tmp = *tm; 1776 *tmp = *tm;
@@ -1782,14 +1782,14 @@ format_time_string (char const *format, ptrdiff_t formatlen,
1782 1782
1783 /* Buffer was too small, so make it bigger and try again. */ 1783 /* Buffer was too small, so make it bigger and try again. */
1784 len = emacs_nmemftime (NULL, SIZE_MAX, format, formatlen, tm, ut, ns); 1784 len = emacs_nmemftime (NULL, SIZE_MAX, format, formatlen, tm, ut, ns);
1785 UNBLOCK_INPUT; 1785 unblock_input ();
1786 if (STRING_BYTES_BOUND <= len) 1786 if (STRING_BYTES_BOUND <= len)
1787 string_overflow (); 1787 string_overflow ();
1788 size = len + 1; 1788 size = len + 1;
1789 buf = SAFE_ALLOCA (size); 1789 buf = SAFE_ALLOCA (size);
1790 } 1790 }
1791 1791
1792 UNBLOCK_INPUT; 1792 unblock_input ();
1793 bufstring = make_unibyte_string (buf, len); 1793 bufstring = make_unibyte_string (buf, len);
1794 SAFE_FREE (); 1794 SAFE_FREE ();
1795 return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0); 1795 return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0);
@@ -1817,11 +1817,11 @@ DOW and ZONE.) */)
1817 struct tm *decoded_time; 1817 struct tm *decoded_time;
1818 Lisp_Object list_args[9]; 1818 Lisp_Object list_args[9];
1819 1819
1820 BLOCK_INPUT; 1820 block_input ();
1821 decoded_time = localtime (&time_spec); 1821 decoded_time = localtime (&time_spec);
1822 if (decoded_time) 1822 if (decoded_time)
1823 save_tm = *decoded_time; 1823 save_tm = *decoded_time;
1824 UNBLOCK_INPUT; 1824 unblock_input ();
1825 if (! (decoded_time 1825 if (! (decoded_time
1826 && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= save_tm.tm_year 1826 && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= save_tm.tm_year
1827 && save_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) 1827 && save_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE))
@@ -1837,13 +1837,13 @@ DOW and ZONE.) */)
1837 XSETFASTINT (list_args[6], save_tm.tm_wday); 1837 XSETFASTINT (list_args[6], save_tm.tm_wday);
1838 list_args[7] = save_tm.tm_isdst ? Qt : Qnil; 1838 list_args[7] = save_tm.tm_isdst ? Qt : Qnil;
1839 1839
1840 BLOCK_INPUT; 1840 block_input ();
1841 decoded_time = gmtime (&time_spec); 1841 decoded_time = gmtime (&time_spec);
1842 if (decoded_time == 0) 1842 if (decoded_time == 0)
1843 list_args[8] = Qnil; 1843 list_args[8] = Qnil;
1844 else 1844 else
1845 XSETINT (list_args[8], tm_diff (&save_tm, decoded_time)); 1845 XSETINT (list_args[8], tm_diff (&save_tm, decoded_time));
1846 UNBLOCK_INPUT; 1846 unblock_input ();
1847 return Flist (9, list_args); 1847 return Flist (9, list_args);
1848} 1848}
1849 1849
@@ -1901,9 +1901,9 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1901 zone = XCAR (zone); 1901 zone = XCAR (zone);
1902 if (NILP (zone)) 1902 if (NILP (zone))
1903 { 1903 {
1904 BLOCK_INPUT; 1904 block_input ();
1905 value = mktime (&tm); 1905 value = mktime (&tm);
1906 UNBLOCK_INPUT; 1906 unblock_input ();
1907 } 1907 }
1908 else 1908 else
1909 { 1909 {
@@ -1928,7 +1928,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1928 else 1928 else
1929 error ("Invalid time zone specification"); 1929 error ("Invalid time zone specification");
1930 1930
1931 BLOCK_INPUT; 1931 block_input ();
1932 1932
1933 /* Set TZ before calling mktime; merely adjusting mktime's returned 1933 /* Set TZ before calling mktime; merely adjusting mktime's returned
1934 value doesn't suffice, since that would mishandle leap seconds. */ 1934 value doesn't suffice, since that would mishandle leap seconds. */
@@ -1942,7 +1942,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
1942#ifdef LOCALTIME_CACHE 1942#ifdef LOCALTIME_CACHE
1943 tzset (); 1943 tzset ();
1944#endif 1944#endif
1945 UNBLOCK_INPUT; 1945 unblock_input ();
1946 1946
1947 xfree (newenv); 1947 xfree (newenv);
1948 } 1948 }
@@ -1978,7 +1978,7 @@ but this is considered obsolete. */)
1978 newline, and without the 4-digit year limit. Don't use asctime 1978 newline, and without the 4-digit year limit. Don't use asctime
1979 or ctime, as they might dump core if the year is outside the 1979 or ctime, as they might dump core if the year is outside the
1980 range -999 .. 9999. */ 1980 range -999 .. 9999. */
1981 BLOCK_INPUT; 1981 block_input ();
1982 tm = localtime (&value); 1982 tm = localtime (&value);
1983 if (tm) 1983 if (tm)
1984 { 1984 {
@@ -1994,7 +1994,7 @@ but this is considered obsolete. */)
1994 tm->tm_hour, tm->tm_min, tm->tm_sec, 1994 tm->tm_hour, tm->tm_min, tm->tm_sec,
1995 tm->tm_year + year_base); 1995 tm->tm_year + year_base);
1996 } 1996 }
1997 UNBLOCK_INPUT; 1997 unblock_input ();
1998 if (! tm) 1998 if (! tm)
1999 time_overflow (); 1999 time_overflow ();
2000 2000
@@ -2050,11 +2050,11 @@ the data it can't find. */)
2050 zone_offset = Qnil; 2050 zone_offset = Qnil;
2051 value = make_emacs_time (lisp_seconds_argument (specified_time), 0); 2051 value = make_emacs_time (lisp_seconds_argument (specified_time), 0);
2052 zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, 0, &localtm); 2052 zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, 0, &localtm);
2053 BLOCK_INPUT; 2053 block_input ();
2054 t = gmtime (emacs_secs_addr (&value)); 2054 t = gmtime (emacs_secs_addr (&value));
2055 if (t) 2055 if (t)
2056 offset = tm_diff (&localtm, t); 2056 offset = tm_diff (&localtm, t);
2057 UNBLOCK_INPUT; 2057 unblock_input ();
2058 2058
2059 if (t) 2059 if (t)
2060 { 2060 {
@@ -2101,7 +2101,7 @@ only the former. */)
2101 if (! (NILP (tz) || EQ (tz, Qt))) 2101 if (! (NILP (tz) || EQ (tz, Qt)))
2102 CHECK_STRING (tz); 2102 CHECK_STRING (tz);
2103 2103
2104 BLOCK_INPUT; 2104 block_input ();
2105 2105
2106 /* When called for the first time, save the original TZ. */ 2106 /* When called for the first time, save the original TZ. */
2107 old_environbuf = environbuf; 2107 old_environbuf = environbuf;
@@ -2118,7 +2118,7 @@ only the former. */)
2118 set_time_zone_rule (tzstring); 2118 set_time_zone_rule (tzstring);
2119 environbuf = environ; 2119 environbuf = environ;
2120 2120
2121 UNBLOCK_INPUT; 2121 unblock_input ();
2122 2122
2123 xfree (old_environbuf); 2123 xfree (old_environbuf);
2124 return Qnil; 2124 return Qnil;
diff --git a/src/emacs.c b/src/emacs.c
index 52f38925b32..05affeefde7 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -54,6 +54,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
54#include "window.h" 54#include "window.h"
55 55
56#include "systty.h" 56#include "systty.h"
57#include "atimer.h"
57#include "blockinput.h" 58#include "blockinput.h"
58#include "syssignal.h" 59#include "syssignal.h"
59#include "process.h" 60#include "process.h"
@@ -95,6 +96,11 @@ static const char emacs_copyright[] = COPYRIGHT;
95/* Empty lisp strings. To avoid having to build any others. */ 96/* Empty lisp strings. To avoid having to build any others. */
96Lisp_Object empty_unibyte_string, empty_multibyte_string; 97Lisp_Object empty_unibyte_string, empty_multibyte_string;
97 98
99#ifdef WINDOWSNT
100/* Cache for externally loaded libraries. */
101Lisp_Object Vlibrary_cache;
102#endif
103
98/* Set after Emacs has started up the first time. 104/* Set after Emacs has started up the first time.
99 Prevents reinitialization of the Lisp world and keymaps 105 Prevents reinitialization of the Lisp world and keymaps
100 on subsequent starts. */ 106 on subsequent starts. */
@@ -269,9 +275,6 @@ Report bugs to bug-gnu-emacs@gnu.org. First, please see the Bugs\n\
269section of the Emacs manual or the file BUGS.\n" 275section of the Emacs manual or the file BUGS.\n"
270 276
271 277
272/* Signal code for the fatal signal that was received. */
273static int fatal_error_code;
274
275/* True if handling a fatal error already. */ 278/* True if handling a fatal error already. */
276bool fatal_error_in_progress; 279bool fatal_error_in_progress;
277 280
@@ -282,28 +285,13 @@ static void *ns_pool;
282 285
283 286
284 287
285/* Handle bus errors, invalid instruction, etc. */
286static void
287handle_fatal_signal (int sig)
288{
289 fatal_error_backtrace (sig, 10);
290}
291
292static void
293deliver_fatal_signal (int sig)
294{
295 handle_on_main_thread (sig, handle_fatal_signal);
296}
297
298/* Report a fatal error due to signal SIG, output a backtrace of at 288/* Report a fatal error due to signal SIG, output a backtrace of at
299 most BACKTRACE_LIMIT lines, and exit. */ 289 most BACKTRACE_LIMIT lines, and exit. */
300_Noreturn void 290_Noreturn void
301fatal_error_backtrace (int sig, int backtrace_limit) 291terminate_due_to_signal (int sig, int backtrace_limit)
302{ 292{
303 fatal_error_code = sig;
304 signal (sig, SIG_DFL); 293 signal (sig, SIG_DFL);
305 294 totally_unblock_input ();
306 TOTALLY_UNBLOCK_INPUT;
307 295
308 /* If fatal error occurs in code below, avoid infinite recursion. */ 296 /* If fatal error occurs in code below, avoid infinite recursion. */
309 if (! fatal_error_in_progress) 297 if (! fatal_error_in_progress)
@@ -318,19 +306,18 @@ fatal_error_backtrace (int sig, int backtrace_limit)
318 } 306 }
319 307
320 /* Signal the same code; this time it will really be fatal. 308 /* Signal the same code; this time it will really be fatal.
321 Remember that since we're in a signal handler, the signal we're 309 Since we're in a signal handler, the signal is blocked, so we
322 going to send is probably blocked, so we have to unblock it if we 310 have to unblock it if we want to really receive it. */
323 want to really receive it. */
324#ifndef MSDOS 311#ifndef MSDOS
325 { 312 {
326 sigset_t unblocked; 313 sigset_t unblocked;
327 sigemptyset (&unblocked); 314 sigemptyset (&unblocked);
328 sigaddset (&unblocked, fatal_error_code); 315 sigaddset (&unblocked, sig);
329 pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); 316 pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
330 } 317 }
331#endif 318#endif
332 319
333 kill (getpid (), fatal_error_code); 320 emacs_raise (sig);
334 321
335 /* This shouldn't be executed, but it prevents a warning. */ 322 /* This shouldn't be executed, but it prevents a warning. */
336 exit (1); 323 exit (1);
@@ -339,15 +326,9 @@ fatal_error_backtrace (int sig, int backtrace_limit)
339#ifdef SIGDANGER 326#ifdef SIGDANGER
340 327
341/* Handler for SIGDANGER. */ 328/* Handler for SIGDANGER. */
342static void deliver_danger_signal (int);
343
344static void 329static void
345handle_danger_signal (int sig) 330handle_danger_signal (int sig)
346{ 331{
347 struct sigaction action;
348 emacs_sigaction_init (&action, deliver_danger_signal);
349 sigaction (sig, &action, 0);
350
351 malloc_warning ("Operating system warns that virtual memory is running low.\n"); 332 malloc_warning ("Operating system warns that virtual memory is running low.\n");
352 333
353 /* It might be unsafe to call do_auto_save now. */ 334 /* It might be unsafe to call do_auto_save now. */
@@ -357,7 +338,7 @@ handle_danger_signal (int sig)
357static void 338static void
358deliver_danger_signal (int sig) 339deliver_danger_signal (int sig)
359{ 340{
360 handle_on_main_thread (sig, handle_danger_signal); 341 deliver_process_signal (sig, handle_danger_signal);
361} 342}
362#endif 343#endif
363 344
@@ -680,6 +661,7 @@ main (int argc, char **argv)
680#endif 661#endif
681 char stack_bottom_variable; 662 char stack_bottom_variable;
682 bool do_initial_setlocale; 663 bool do_initial_setlocale;
664 bool dumping;
683 int skip_args = 0; 665 int skip_args = 0;
684#ifdef HAVE_SETRLIMIT 666#ifdef HAVE_SETRLIMIT
685 struct rlimit rlim; 667 struct rlimit rlim;
@@ -691,7 +673,6 @@ main (int argc, char **argv)
691 char dname_arg2[80]; 673 char dname_arg2[80];
692#endif 674#endif
693 char *ch_to_dir; 675 char *ch_to_dir;
694 struct sigaction fatal_error_action;
695 676
696#if GC_MARK_STACK 677#if GC_MARK_STACK
697 stack_base = &dummy; 678 stack_base = &dummy;
@@ -777,12 +758,11 @@ main (int argc, char **argv)
777 exit (1); 758 exit (1);
778 } 759 }
779 760
761 dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0
762 || strcmp (argv[argc - 1], "bootstrap") == 0);
780 763
781#ifdef HAVE_PERSONALITY_LINUX32 764#ifdef HAVE_PERSONALITY_LINUX32
782 if (!initialized 765 if (dumping && ! getenv ("EMACS_HEAP_EXEC"))
783 && (strcmp (argv[argc-1], "dump") == 0
784 || strcmp (argv[argc-1], "bootstrap") == 0)
785 && ! getenv ("EMACS_HEAP_EXEC"))
786 { 766 {
787 static char heapexec[] = "EMACS_HEAP_EXEC=true"; 767 static char heapexec[] = "EMACS_HEAP_EXEC=true";
788 /* Set this so we only do this once. */ 768 /* Set this so we only do this once. */
@@ -1107,119 +1087,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1107#endif 1087#endif
1108 } 1088 }
1109 1089
1110 init_signals (); 1090 init_signals (dumping);
1111 emacs_sigaction_init (&fatal_error_action, deliver_fatal_signal);
1112
1113 /* Don't catch SIGHUP if dumping. */
1114 if (1
1115#ifndef CANNOT_DUMP
1116 && initialized
1117#endif
1118 )
1119 {
1120 /* In --batch mode, don't catch SIGHUP if already ignored.
1121 That makes nohup work. */
1122 bool catch_SIGHUP = !noninteractive;
1123 if (!catch_SIGHUP)
1124 {
1125 struct sigaction old_action;
1126 sigaction (SIGHUP, 0, &old_action);
1127 catch_SIGHUP = old_action.sa_handler != SIG_IGN;
1128 }
1129 if (catch_SIGHUP)
1130 sigaction (SIGHUP, &fatal_error_action, 0);
1131 }
1132
1133 if (
1134#ifndef CANNOT_DUMP
1135 ! noninteractive || initialized
1136#else
1137 1
1138#endif
1139 )
1140 {
1141 /* Don't catch these signals in batch mode if dumping.
1142 On some machines, this sets static data that would make
1143 signal fail to work right when the dumped Emacs is run. */
1144 sigaction (SIGQUIT, &fatal_error_action, 0);
1145 sigaction (SIGILL, &fatal_error_action, 0);
1146 sigaction (SIGTRAP, &fatal_error_action, 0);
1147#ifdef SIGUSR1
1148 add_user_signal (SIGUSR1, "sigusr1");
1149#endif
1150#ifdef SIGUSR2
1151 add_user_signal (SIGUSR2, "sigusr2");
1152#endif
1153#ifdef SIGABRT
1154 sigaction (SIGABRT, &fatal_error_action, 0);
1155#endif
1156#ifdef SIGHWE
1157 sigaction (SIGHWE, &fatal_error_action, 0);
1158#endif
1159#ifdef SIGPRE
1160 sigaction (SIGPRE, &fatal_error_action, 0);
1161#endif
1162#ifdef SIGORE
1163 sigaction (SIGORE, &fatal_error_action, 0);
1164#endif
1165#ifdef SIGUME
1166 sigaction (SIGUME, &fatal_error_action, 0);
1167#endif
1168#ifdef SIGDLK
1169 sigaction (SIGDLK, &fatal_error_action, 0);
1170#endif
1171#ifdef SIGCPULIM
1172 sigaction (SIGCPULIM, &fatal_error_action, 0);
1173#endif
1174#ifdef SIGIOT
1175 /* This is missing on some systems - OS/2, for example. */
1176 sigaction (SIGIOT, &fatal_error_action, 0);
1177#endif
1178#ifdef SIGEMT
1179 sigaction (SIGEMT, &fatal_error_action, 0);
1180#endif
1181 sigaction (SIGFPE, &fatal_error_action, 0);
1182#ifdef SIGBUS
1183 sigaction (SIGBUS, &fatal_error_action, 0);
1184#endif
1185 sigaction (SIGSEGV, &fatal_error_action, 0);
1186#ifdef SIGSYS
1187 sigaction (SIGSYS, &fatal_error_action, 0);
1188#endif
1189 /* May need special treatment on MS-Windows. See
1190 http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html
1191 Please update the doc of kill-emacs, kill-emacs-hook, and
1192 NEWS if you change this.
1193 */
1194 if (noninteractive)
1195 sigaction (SIGINT, &fatal_error_action, 0);
1196 sigaction (SIGTERM, &fatal_error_action, 0);
1197#ifdef SIGXCPU
1198 sigaction (SIGXCPU, &fatal_error_action, 0);
1199#endif
1200#ifdef SIGXFSZ
1201 sigaction (SIGXFSZ, &fatal_error_action, 0);
1202#endif /* SIGXFSZ */
1203
1204#ifdef SIGDANGER
1205 /* This just means available memory is getting low. */
1206 {
1207 struct sigaction action;
1208 emacs_sigaction_init (&action, deliver_danger_signal);
1209 sigaction (SIGDANGER, &action, 0);
1210 }
1211#endif
1212
1213#ifdef AIX
1214/* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU. */
1215 sigaction (SIGXCPU, &fatal_error_action, 0);
1216 sigaction (SIGIOINT, &fatal_error_action, 0);
1217 sigaction (SIGGRANT, &fatal_error_action, 0);
1218 sigaction (SIGRETRACT, &fatal_error_action, 0);
1219 sigaction (SIGSOUND, &fatal_error_action, 0);
1220 sigaction (SIGMSG, &fatal_error_action, 0);
1221#endif /* AIX */
1222 }
1223 1091
1224 noninteractive1 = noninteractive; 1092 noninteractive1 = noninteractive;
1225 1093
@@ -1281,7 +1149,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1281 } 1149 }
1282 1150
1283 init_eval (); 1151 init_eval ();
1284 init_data ();
1285 init_atimer (); 1152 init_atimer ();
1286 running_asynch_code = 0; 1153 running_asynch_code = 0;
1287 init_random (); 1154 init_random ();
@@ -1396,7 +1263,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1396 globals_of_w32 (); 1263 globals_of_w32 ();
1397 /* Initialize environment from registry settings. */ 1264 /* Initialize environment from registry settings. */
1398 init_environment (argv); 1265 init_environment (argv);
1399 init_ntproc (); /* must precede init_editfns. */ 1266 init_ntproc (dumping); /* must precede init_editfns. */
1400#endif 1267#endif
1401 1268
1402 /* Initialize and GC-protect Vinitial_environment and 1269 /* Initialize and GC-protect Vinitial_environment and
@@ -1407,8 +1274,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1407 /* egetenv is a pretty low-level facility, which may get called in 1274 /* egetenv is a pretty low-level facility, which may get called in
1408 many circumstances; it seems flimsy to put off initializing it 1275 many circumstances; it seems flimsy to put off initializing it
1409 until calling init_callproc. Do not do it when dumping. */ 1276 until calling init_callproc. Do not do it when dumping. */
1410 if (initialized || ((strcmp (argv[argc-1], "dump") != 0 1277 if (! dumping)
1411 && strcmp (argv[argc-1], "bootstrap") != 0)))
1412 set_initial_environment (); 1278 set_initial_environment ();
1413 1279
1414 /* AIX crashes are reported in system versions 3.2.3 and 3.2.4 1280 /* AIX crashes are reported in system versions 3.2.3 and 3.2.4
@@ -1553,6 +1419,8 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1553 syms_of_ntterm (); 1419 syms_of_ntterm ();
1554#endif /* WINDOWSNT */ 1420#endif /* WINDOWSNT */
1555 1421
1422 syms_of_profiler ();
1423
1556 keys_of_casefiddle (); 1424 keys_of_casefiddle ();
1557 keys_of_cmds (); 1425 keys_of_cmds ();
1558 keys_of_buffer (); 1426 keys_of_buffer ();
@@ -2045,7 +1913,7 @@ shut_down_emacs (int sig, Lisp_Object stuff)
2045 ignore_sigio (); 1913 ignore_sigio ();
2046 1914
2047#ifdef WINDOWSNT 1915#ifdef WINDOWSNT
2048 term_ntproc (); 1916 term_ntproc (0);
2049#endif 1917#endif
2050 1918
2051 /* Do this only if terminating normally, we want glyph matrices 1919 /* Do this only if terminating normally, we want glyph matrices
@@ -2164,6 +2032,13 @@ You must run Emacs in batch mode in order to dump it. */)
2164 free (malloc_state_ptr); 2032 free (malloc_state_ptr);
2165#endif 2033#endif
2166 2034
2035#ifdef WINDOWSNT
2036 Vlibrary_cache = Qnil;
2037#endif
2038#ifdef HAVE_WINDOW_SYSTEM
2039 reset_image_types ();
2040#endif
2041
2167 Vpurify_flag = tem; 2042 Vpurify_flag = tem;
2168 2043
2169 return unbind_to (count, Qnil); 2044 return unbind_to (count, Qnil);
@@ -2496,6 +2371,11 @@ libraries; only those already known by Emacs will be loaded. */);
2496 Vdynamic_library_alist = Qnil; 2371 Vdynamic_library_alist = Qnil;
2497 Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt); 2372 Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt);
2498 2373
2374#ifdef WINDOWSNT
2375 Vlibrary_cache = Qnil;
2376 staticpro (&Vlibrary_cache);
2377#endif
2378
2499 /* Make sure IS_DAEMON starts up as false. */ 2379 /* Make sure IS_DAEMON starts up as false. */
2500 daemon_pipe[1] = 0; 2380 daemon_pipe[1] = 0;
2501} 2381}
diff --git a/src/eval.c b/src/eval.c
index e47478bb1f1..561ba922482 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -31,17 +31,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#include "xterm.h" 31#include "xterm.h"
32#endif 32#endif
33 33
34struct backtrace 34struct backtrace *backtrace_list;
35{
36 struct backtrace *next;
37 Lisp_Object *function;
38 Lisp_Object *args; /* Points to vector of args. */
39 ptrdiff_t nargs; /* Length of vector. */
40 /* Nonzero means call value of debugger when done with this operation. */
41 unsigned int debug_on_exit : 1;
42};
43
44static struct backtrace *backtrace_list;
45 35
46#if !BYTE_MARK_STACK 36#if !BYTE_MARK_STACK
47static 37static
@@ -562,7 +552,7 @@ interactive_p (void)
562 552
563 /* If this isn't a byte-compiled function, there may be a frame at 553 /* If this isn't a byte-compiled function, there may be a frame at
564 the top for Finteractive_p. If so, skip it. */ 554 the top for Finteractive_p. If so, skip it. */
565 fun = Findirect_function (*btp->function, Qnil); 555 fun = Findirect_function (btp->function, Qnil);
566 if (SUBRP (fun) && (XSUBR (fun) == &Sinteractive_p 556 if (SUBRP (fun) && (XSUBR (fun) == &Sinteractive_p
567 || XSUBR (fun) == &Scalled_interactively_p)) 557 || XSUBR (fun) == &Scalled_interactively_p))
568 btp = btp->next; 558 btp = btp->next;
@@ -575,7 +565,7 @@ interactive_p (void)
575 If this isn't a byte-compiled function, then we may now be 565 If this isn't a byte-compiled function, then we may now be
576 looking at several frames for special forms. Skip past them. */ 566 looking at several frames for special forms. Skip past them. */
577 while (btp 567 while (btp
578 && (EQ (*btp->function, Qbytecode) 568 && (EQ (btp->function, Qbytecode)
579 || btp->nargs == UNEVALLED)) 569 || btp->nargs == UNEVALLED))
580 btp = btp->next; 570 btp = btp->next;
581 571
@@ -583,13 +573,13 @@ interactive_p (void)
583 a special form, ignoring frames for Finteractive_p and/or 573 a special form, ignoring frames for Finteractive_p and/or
584 Fbytecode at the top. If this frame is for a built-in function 574 Fbytecode at the top. If this frame is for a built-in function
585 (such as load or eval-region) return false. */ 575 (such as load or eval-region) return false. */
586 fun = Findirect_function (*btp->function, Qnil); 576 fun = Findirect_function (btp->function, Qnil);
587 if (SUBRP (fun)) 577 if (SUBRP (fun))
588 return 0; 578 return 0;
589 579
590 /* `btp' points to the frame of a Lisp function that called interactive-p. 580 /* `btp' points to the frame of a Lisp function that called interactive-p.
591 Return t if that function was called interactively. */ 581 Return t if that function was called interactively. */
592 if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively)) 582 if (btp && btp->next && EQ (btp->next->function, Qcall_interactively))
593 return 1; 583 return 1;
594 return 0; 584 return 0;
595} 585}
@@ -1076,7 +1066,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
1076/* Unwind the specbind, catch, and handler stacks back to CATCH, and 1066/* Unwind the specbind, catch, and handler stacks back to CATCH, and
1077 jump to that CATCH, returning VALUE as the value of that catch. 1067 jump to that CATCH, returning VALUE as the value of that catch.
1078 1068
1079 This is the guts Fthrow and Fsignal; they differ only in the way 1069 This is the guts of Fthrow and Fsignal; they differ only in the way
1080 they choose the catch tag to throw to. A catch tag for a 1070 they choose the catch tag to throw to. A catch tag for a
1081 condition-case form has a TAG of Qnil. 1071 condition-case form has a TAG of Qnil.
1082 1072
@@ -1085,7 +1075,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
1085 the handler stack as we go, so that the proper handlers are in 1075 the handler stack as we go, so that the proper handlers are in
1086 effect for each unwind-protect clause we run. At the end, restore 1076 effect for each unwind-protect clause we run. At the end, restore
1087 some static info saved in CATCH, and longjmp to the location 1077 some static info saved in CATCH, and longjmp to the location
1088 specified in the 1078 specified there.
1089 1079
1090 This is used for correct unwinding in Fthrow and Fsignal. */ 1080 This is used for correct unwinding in Fthrow and Fsignal. */
1091 1081
@@ -1099,7 +1089,7 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1099 1089
1100 /* Restore certain special C variables. */ 1090 /* Restore certain special C variables. */
1101 set_poll_suppress_count (catch->poll_suppress_count); 1091 set_poll_suppress_count (catch->poll_suppress_count);
1102 UNBLOCK_INPUT_TO (catch->interrupt_input_blocked); 1092 unblock_input_to (catch->interrupt_input_blocked);
1103 immediate_quit = 0; 1093 immediate_quit = 0;
1104 1094
1105 do 1095 do
@@ -1114,16 +1104,6 @@ unwind_to_catch (struct catchtag *catch, Lisp_Object value)
1114 } 1104 }
1115 while (! last_time); 1105 while (! last_time);
1116 1106
1117#if HAVE_X_WINDOWS
1118 /* If x_catch_errors was done, turn it off now.
1119 (First we give unbind_to a chance to do that.) */
1120#if 0 /* This would disable x_catch_errors after x_connection_closed.
1121 The catch must remain in effect during that delicate
1122 state. --lorentey */
1123 x_fully_uncatch_errors ();
1124#endif
1125#endif
1126
1127 byte_stack_list = catch->byte_stack; 1107 byte_stack_list = catch->byte_stack;
1128 gcprolist = catch->gcpro; 1108 gcprolist = catch->gcpro;
1129#ifdef DEBUG_GCPRO 1109#ifdef DEBUG_GCPRO
@@ -1516,10 +1496,10 @@ See also the function `condition-case'. */)
1516 if (backtrace_list && !NILP (error_symbol)) 1496 if (backtrace_list && !NILP (error_symbol))
1517 { 1497 {
1518 bp = backtrace_list->next; 1498 bp = backtrace_list->next;
1519 if (bp && bp->function && EQ (*bp->function, Qerror)) 1499 if (bp && EQ (bp->function, Qerror))
1520 bp = bp->next; 1500 bp = bp->next;
1521 if (bp && bp->function) 1501 if (bp)
1522 Vsignaling_function = *bp->function; 1502 Vsignaling_function = bp->function;
1523 } 1503 }
1524 1504
1525 for (h = handlerlist; h; h = h->next) 1505 for (h = handlerlist; h; h = h->next)
@@ -1530,7 +1510,7 @@ See also the function `condition-case'. */)
1530 } 1510 }
1531 1511
1532 if (/* Don't run the debugger for a memory-full error. 1512 if (/* Don't run the debugger for a memory-full error.
1533 (There is no room in memory to do that!) */ 1513 (There is no room in memory to do that!) */
1534 !NILP (error_symbol) 1514 !NILP (error_symbol)
1535 && (!NILP (Vdebug_on_signal) 1515 && (!NILP (Vdebug_on_signal)
1536 /* If no handler is present now, try to run the debugger. */ 1516 /* If no handler is present now, try to run the debugger. */
@@ -1713,7 +1693,7 @@ maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data)
1713 if ( 1693 if (
1714 /* Don't try to run the debugger with interrupts blocked. 1694 /* Don't try to run the debugger with interrupts blocked.
1715 The editing loop would return anyway. */ 1695 The editing loop would return anyway. */
1716 ! INPUT_BLOCKED_P 1696 ! input_blocked_p ()
1717 && NILP (Vinhibit_debugger) 1697 && NILP (Vinhibit_debugger)
1718 /* Does user want to enter debugger for this kind of error? */ 1698 /* Does user want to enter debugger for this kind of error? */
1719 && (EQ (sig, Qquit) 1699 && (EQ (sig, Qquit)
@@ -2065,11 +2045,11 @@ eval_sub (Lisp_Object form)
2065 original_args = XCDR (form); 2045 original_args = XCDR (form);
2066 2046
2067 backtrace.next = backtrace_list; 2047 backtrace.next = backtrace_list;
2068 backtrace_list = &backtrace; 2048 backtrace.function = original_fun; /* This also protects them from gc. */
2069 backtrace.function = &original_fun; /* This also protects them from gc. */
2070 backtrace.args = &original_args; 2049 backtrace.args = &original_args;
2071 backtrace.nargs = UNEVALLED; 2050 backtrace.nargs = UNEVALLED;
2072 backtrace.debug_on_exit = 0; 2051 backtrace.debug_on_exit = 0;
2052 backtrace_list = &backtrace;
2073 2053
2074 if (debug_on_next_call) 2054 if (debug_on_next_call)
2075 do_debug_on_call (Qt); 2055 do_debug_on_call (Qt);
@@ -2371,14 +2351,10 @@ usage: (run-hooks &rest HOOKS) */)
2371DEFUN ("run-hook-with-args", Frun_hook_with_args, 2351DEFUN ("run-hook-with-args", Frun_hook_with_args,
2372 Srun_hook_with_args, 1, MANY, 0, 2352 Srun_hook_with_args, 1, MANY, 0,
2373 doc: /* Run HOOK with the specified arguments ARGS. 2353 doc: /* Run HOOK with the specified arguments ARGS.
2374HOOK should be a symbol, a hook variable. If HOOK has a non-nil 2354HOOK should be a symbol, a hook variable. The value of HOOK
2375value, that value may be a function or a list of functions to be 2355may be nil, a function, or a list of functions. Call each
2376called to run the hook. If the value is a function, it is called with 2356function in order with arguments ARGS. The final return value
2377the given arguments and its return value is returned. If it is a list 2357is unspecified.
2378of functions, those functions are called, in order,
2379with the given arguments ARGS.
2380It is best not to depend on the value returned by `run-hook-with-args',
2381as that may change.
2382 2358
2383Do not use `make-local-variable' to make a hook variable buffer-local. 2359Do not use `make-local-variable' to make a hook variable buffer-local.
2384Instead, use `add-hook' and specify t for the LOCAL argument. 2360Instead, use `add-hook' and specify t for the LOCAL argument.
@@ -2388,18 +2364,18 @@ usage: (run-hook-with-args HOOK &rest ARGS) */)
2388 return run_hook_with_args (nargs, args, funcall_nil); 2364 return run_hook_with_args (nargs, args, funcall_nil);
2389} 2365}
2390 2366
2367/* NB this one still documents a specific non-nil return value.
2368 (As did run-hook-with-args and run-hook-with-args-until-failure
2369 until they were changed in 24.1.) */
2391DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success, 2370DEFUN ("run-hook-with-args-until-success", Frun_hook_with_args_until_success,
2392 Srun_hook_with_args_until_success, 1, MANY, 0, 2371 Srun_hook_with_args_until_success, 1, MANY, 0,
2393 doc: /* Run HOOK with the specified arguments ARGS. 2372 doc: /* Run HOOK with the specified arguments ARGS.
2394HOOK should be a symbol, a hook variable. If HOOK has a non-nil 2373HOOK should be a symbol, a hook variable. The value of HOOK
2395value, that value may be a function or a list of functions to be 2374may be nil, a function, or a list of functions. Call each
2396called to run the hook. If the value is a function, it is called with 2375function in order with arguments ARGS, stopping at the first
2397the given arguments and its return value is returned. 2376one that returns non-nil, and return that value. Otherwise (if
2398If it is a list of functions, those functions are called, in order, 2377all functions return nil, or if there are no functions to call),
2399with the given arguments ARGS, until one of them 2378return nil.
2400returns a non-nil value. Then we return that value.
2401However, if they all return nil, we return nil.
2402If the value of HOOK is nil, this function returns nil.
2403 2379
2404Do not use `make-local-variable' to make a hook variable buffer-local. 2380Do not use `make-local-variable' to make a hook variable buffer-local.
2405Instead, use `add-hook' and specify t for the LOCAL argument. 2381Instead, use `add-hook' and specify t for the LOCAL argument.
@@ -2418,15 +2394,12 @@ funcall_not (ptrdiff_t nargs, Lisp_Object *args)
2418DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure, 2394DEFUN ("run-hook-with-args-until-failure", Frun_hook_with_args_until_failure,
2419 Srun_hook_with_args_until_failure, 1, MANY, 0, 2395 Srun_hook_with_args_until_failure, 1, MANY, 0,
2420 doc: /* Run HOOK with the specified arguments ARGS. 2396 doc: /* Run HOOK with the specified arguments ARGS.
2421HOOK should be a symbol, a hook variable. If HOOK has a non-nil 2397HOOK should be a symbol, a hook variable. The value of HOOK
2422value, that value may be a function or a list of functions to be 2398may be nil, a function, or a list of functions. Call each
2423called to run the hook. If the value is a function, it is called with 2399function in order with arguments ARGS, stopping at the first
2424the given arguments. Then we return nil if the function returns nil, 2400one that returns nil, and return nil. Otherwise (if all functions
2425and t if it returns non-nil. 2401return non-nil, or if there are no functions to call), return non-nil
2426If it is a list of functions, those functions are called, in order, 2402\(do not rely on the precise return value in this case).
2427with the given arguments ARGS, until one of them returns nil.
2428Then we return nil. However, if they all return non-nil, we return t.
2429If the value of HOOK is nil, this function returns t.
2430 2403
2431Do not use `make-local-variable' to make a hook variable buffer-local. 2404Do not use `make-local-variable' to make a hook variable buffer-local.
2432Instead, use `add-hook' and specify t for the LOCAL argument. 2405Instead, use `add-hook' and specify t for the LOCAL argument.
@@ -2740,11 +2713,11 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
2740 } 2713 }
2741 2714
2742 backtrace.next = backtrace_list; 2715 backtrace.next = backtrace_list;
2743 backtrace_list = &backtrace; 2716 backtrace.function = args[0];
2744 backtrace.function = &args[0];
2745 backtrace.args = &args[1]; /* This also GCPROs them. */ 2717 backtrace.args = &args[1]; /* This also GCPROs them. */
2746 backtrace.nargs = nargs - 1; 2718 backtrace.nargs = nargs - 1;
2747 backtrace.debug_on_exit = 0; 2719 backtrace.debug_on_exit = 0;
2720 backtrace_list = &backtrace;
2748 2721
2749 /* Call GC after setting up the backtrace, so the latter GCPROs the args. */ 2722 /* Call GC after setting up the backtrace, so the latter GCPROs the args. */
2750 maybe_gc (); 2723 maybe_gc ();
@@ -3316,12 +3289,12 @@ Output stream used is value of `standard-output'. */)
3316 write_string (backlist->debug_on_exit ? "* " : " ", 2); 3289 write_string (backlist->debug_on_exit ? "* " : " ", 2);
3317 if (backlist->nargs == UNEVALLED) 3290 if (backlist->nargs == UNEVALLED)
3318 { 3291 {
3319 Fprin1 (Fcons (*backlist->function, *backlist->args), Qnil); 3292 Fprin1 (Fcons (backlist->function, *backlist->args), Qnil);
3320 write_string ("\n", -1); 3293 write_string ("\n", -1);
3321 } 3294 }
3322 else 3295 else
3323 { 3296 {
3324 tem = *backlist->function; 3297 tem = backlist->function;
3325 Fprin1 (tem, Qnil); /* This can QUIT. */ 3298 Fprin1 (tem, Qnil); /* This can QUIT. */
3326 write_string ("(", -1); 3299 write_string ("(", -1);
3327 if (backlist->nargs == MANY) 3300 if (backlist->nargs == MANY)
@@ -3379,7 +3352,7 @@ If NFRAMES is more than the number of frames, the value is nil. */)
3379 if (!backlist) 3352 if (!backlist)
3380 return Qnil; 3353 return Qnil;
3381 if (backlist->nargs == UNEVALLED) 3354 if (backlist->nargs == UNEVALLED)
3382 return Fcons (Qnil, Fcons (*backlist->function, *backlist->args)); 3355 return Fcons (Qnil, Fcons (backlist->function, *backlist->args));
3383 else 3356 else
3384 { 3357 {
3385 if (backlist->nargs == MANY) /* FIXME: Can this happen? */ 3358 if (backlist->nargs == MANY) /* FIXME: Can this happen? */
@@ -3387,7 +3360,7 @@ If NFRAMES is more than the number of frames, the value is nil. */)
3387 else 3360 else
3388 tem = Flist (backlist->nargs, backlist->args); 3361 tem = Flist (backlist->nargs, backlist->args);
3389 3362
3390 return Fcons (Qt, Fcons (*backlist->function, tem)); 3363 return Fcons (Qt, Fcons (backlist->function, tem));
3391 } 3364 }
3392} 3365}
3393 3366
diff --git a/src/fileio.c b/src/fileio.c
index 6c4e34d7312..9d8a0dc8b45 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1025,9 +1025,9 @@ filesystem tree, not (expand-file-name ".." dirname). */)
1025 memcpy (o, nm, p - nm); 1025 memcpy (o, nm, p - nm);
1026 o [p - nm] = 0; 1026 o [p - nm] = 0;
1027 1027
1028 BLOCK_INPUT; 1028 block_input ();
1029 pw = (struct passwd *) getpwnam (o + 1); 1029 pw = (struct passwd *) getpwnam (o + 1);
1030 UNBLOCK_INPUT; 1030 unblock_input ();
1031 if (pw) 1031 if (pw)
1032 { 1032 {
1033 newdir = pw->pw_dir; 1033 newdir = pw->pw_dir;
@@ -1413,9 +1413,9 @@ See also the function `substitute-in-file-name'.")
1413 o[len] = 0; 1413 o[len] = 0;
1414 1414
1415 /* Look up the user name. */ 1415 /* Look up the user name. */
1416 BLOCK_INPUT; 1416 block_input ();
1417 pw = (struct passwd *) getpwnam (o + 1); 1417 pw = (struct passwd *) getpwnam (o + 1);
1418 UNBLOCK_INPUT; 1418 unblock_input ();
1419 if (!pw) 1419 if (!pw)
1420 error ("\"%s\" isn't a registered user", o + 1); 1420 error ("\"%s\" isn't a registered user", o + 1);
1421 1421
@@ -1531,9 +1531,9 @@ search_embedded_absfilename (char *nm, char *endp)
1531 /* If we have ~user and `user' exists, discard 1531 /* If we have ~user and `user' exists, discard
1532 everything up to ~. But if `user' does not exist, leave 1532 everything up to ~. But if `user' does not exist, leave
1533 ~user alone, it might be a literal file name. */ 1533 ~user alone, it might be a literal file name. */
1534 BLOCK_INPUT; 1534 block_input ();
1535 pw = getpwnam (o + 1); 1535 pw = getpwnam (o + 1);
1536 UNBLOCK_INPUT; 1536 unblock_input ();
1537 if (pw) 1537 if (pw)
1538 return p; 1538 return p;
1539 } 1539 }
@@ -2999,10 +2999,10 @@ The value is an integer. */)
2999 mode_t realmask; 2999 mode_t realmask;
3000 Lisp_Object value; 3000 Lisp_Object value;
3001 3001
3002 BLOCK_INPUT; 3002 block_input ();
3003 realmask = umask (0); 3003 realmask = umask (0);
3004 umask (realmask); 3004 umask (realmask);
3005 UNBLOCK_INPUT; 3005 unblock_input ();
3006 3006
3007 XSETINT (value, (~ realmask) & 0777); 3007 XSETINT (value, (~ realmask) & 0777);
3008 return value; 3008 return value;
@@ -5235,9 +5235,9 @@ do_auto_save_unwind (Lisp_Object arg) /* used as unwind-protect function */
5235 auto_saving = 0; 5235 auto_saving = 0;
5236 if (stream != NULL) 5236 if (stream != NULL)
5237 { 5237 {
5238 BLOCK_INPUT; 5238 block_input ();
5239 fclose (stream); 5239 fclose (stream);
5240 UNBLOCK_INPUT; 5240 unblock_input ();
5241 } 5241 }
5242 return Qnil; 5242 return Qnil;
5243} 5243}
@@ -5368,7 +5368,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5368 if (STRINGP (BVAR (b, auto_save_file_name)) 5368 if (STRINGP (BVAR (b, auto_save_file_name))
5369 && stream != NULL && do_handled_files == 0) 5369 && stream != NULL && do_handled_files == 0)
5370 { 5370 {
5371 BLOCK_INPUT; 5371 block_input ();
5372 if (!NILP (BVAR (b, filename))) 5372 if (!NILP (BVAR (b, filename)))
5373 { 5373 {
5374 fwrite (SDATA (BVAR (b, filename)), 1, 5374 fwrite (SDATA (BVAR (b, filename)), 1,
@@ -5378,7 +5378,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */)
5378 fwrite (SDATA (BVAR (b, auto_save_file_name)), 1, 5378 fwrite (SDATA (BVAR (b, auto_save_file_name)), 1,
5379 SBYTES (BVAR (b, auto_save_file_name)), stream); 5379 SBYTES (BVAR (b, auto_save_file_name)), stream);
5380 putc ('\n', stream); 5380 putc ('\n', stream);
5381 UNBLOCK_INPUT; 5381 unblock_input ();
5382 } 5382 }
5383 5383
5384 if (!NILP (current_only) 5384 if (!NILP (current_only)
diff --git a/src/floatfns.c b/src/floatfns.c
index 4fe209fcb61..645a5957609 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -31,15 +31,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#include <config.h> 31#include <config.h>
32 32
33#include "lisp.h" 33#include "lisp.h"
34#include "syssignal.h"
35
36#include <float.h>
37#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
38 && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
39#define IEEE_FLOATING_POINT 1
40#else
41#define IEEE_FLOATING_POINT 0
42#endif
43 34
44#include <math.h> 35#include <math.h>
45 36
diff --git a/src/fns.c b/src/fns.c
index 42c4f817f29..6d6f019b311 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -61,8 +61,9 @@ DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
61 61
62DEFUN ("random", Frandom, Srandom, 0, 1, 0, 62DEFUN ("random", Frandom, Srandom, 0, 1, 0,
63 doc: /* Return a pseudo-random number. 63 doc: /* Return a pseudo-random number.
64All integers representable in Lisp are equally likely. 64All integers representable in Lisp, i.e. between `most-negative-fixnum'
65 On most systems, this is 29 bits' worth. 65and `most-positive-fixnum', inclusive, are equally likely.
66
66With positive integer LIMIT, return random number in interval [0,LIMIT). 67With positive integer LIMIT, return random number in interval [0,LIMIT).
67With argument t, set the random number seed from the current time and pid. 68With argument t, set the random number seed from the current time and pid.
68Other values of LIMIT are ignored. */) 69Other values of LIMIT are ignored. */)
@@ -1838,13 +1839,6 @@ properties on the list. This function never signals an error. */)
1838 halftail = XCDR (halftail); 1839 halftail = XCDR (halftail);
1839 if (EQ (tail, halftail)) 1840 if (EQ (tail, halftail))
1840 break; 1841 break;
1841
1842#if 0 /* Unsafe version. */
1843 /* This function can be called asynchronously
1844 (setup_coding_system). Don't QUIT in that case. */
1845 if (!interrupt_input_blocked)
1846 QUIT;
1847#endif
1848 } 1842 }
1849 1843
1850 return Qnil; 1844 return Qnil;
diff --git a/src/fontset.c b/src/fontset.c
index 35d4bfb367e..7b051cbe1f3 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1275,7 +1275,7 @@ free_realized_fontsets (Lisp_Object base)
1275 doesn't remove FACE from a cache. Until we find a solution, we 1275 doesn't remove FACE from a cache. Until we find a solution, we
1276 suppress this code, and simply use Fclear_face_cache even though 1276 suppress this code, and simply use Fclear_face_cache even though
1277 that is not efficient. */ 1277 that is not efficient. */
1278 BLOCK_INPUT; 1278 block_input ();
1279 for (id = 0; id < ASIZE (Vfontset_table); id++) 1279 for (id = 0; id < ASIZE (Vfontset_table); id++)
1280 { 1280 {
1281 Lisp_Object this = AREF (Vfontset_table, id); 1281 Lisp_Object this = AREF (Vfontset_table, id);
@@ -1296,7 +1296,7 @@ free_realized_fontsets (Lisp_Object base)
1296 } 1296 }
1297 } 1297 }
1298 } 1298 }
1299 UNBLOCK_INPUT; 1299 unblock_input ();
1300#else /* not 0 */ 1300#else /* not 0 */
1301 /* But, we don't have to call Fclear_face_cache if no fontset has 1301 /* But, we don't have to call Fclear_face_cache if no fontset has
1302 been realized from BASE. */ 1302 been realized from BASE. */
diff --git a/src/frame.c b/src/frame.c
index f3d16171516..4bcacef39c5 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -3533,9 +3533,9 @@ x_set_alpha (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
3533 f->alpha[i] = newval[i]; 3533 f->alpha[i] = newval[i];
3534 3534
3535#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) 3535#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA)
3536 BLOCK_INPUT; 3536 block_input ();
3537 x_set_frame_alpha (f); 3537 x_set_frame_alpha (f);
3538 UNBLOCK_INPUT; 3538 unblock_input ();
3539#endif 3539#endif
3540 3540
3541 return; 3541 return;
diff --git a/src/frame.h b/src/frame.h
index 661ea2ea67c..26235cc036e 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1203,7 +1203,7 @@ extern Lisp_Object Qrun_hook_with_args;
1203extern void x_set_scroll_bar_default_width (struct frame *); 1203extern void x_set_scroll_bar_default_width (struct frame *);
1204extern void x_set_offset (struct frame *, int, int, int); 1204extern void x_set_offset (struct frame *, int, int, int);
1205extern void x_wm_set_icon_position (struct frame *, int, int); 1205extern void x_wm_set_icon_position (struct frame *, int, int);
1206extern void x_wm_set_size_hint (FRAME_PTR f, long flags, int user_position); 1206extern void x_wm_set_size_hint (FRAME_PTR f, long flags, bool user_position);
1207 1207
1208extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int); 1208extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int);
1209 1209
@@ -1249,7 +1249,7 @@ extern Lisp_Object display_x_get_resource (Display_Info *,
1249 Lisp_Object component, 1249 Lisp_Object component,
1250 Lisp_Object subclass); 1250 Lisp_Object subclass);
1251 1251
1252extern void set_frame_menubar (struct frame *f, int first_time, int deep_p); 1252extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p);
1253extern void x_set_window_size (struct frame *f, int change_grav, 1253extern void x_set_window_size (struct frame *f, int change_grav,
1254 int cols, int rows); 1254 int cols, int rows);
1255extern void x_sync (struct frame *); 1255extern void x_sync (struct frame *);
@@ -1283,9 +1283,6 @@ extern char *x_get_resource_string (const char *, const char *);
1283 1283
1284extern void x_query_colors (struct frame *f, XColor *, int); 1284extern void x_query_colors (struct frame *f, XColor *, int);
1285 1285
1286/* In xmenu.c */
1287extern void set_frame_menubar (FRAME_PTR, int, int);
1288
1289#endif /* HAVE_WINDOW_SYSTEM */ 1286#endif /* HAVE_WINDOW_SYSTEM */
1290 1287
1291INLINE_HEADER_END 1288INLINE_HEADER_END
diff --git a/src/fringe.c b/src/fringe.c
index 6e6deeddb08..d788503e91e 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -872,7 +872,7 @@ draw_fringe_bitmap (struct window *w, struct glyph_row *row, int left_p)
872void 872void
873draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row) 873draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row)
874{ 874{
875 eassert (interrupt_input_blocked); 875 eassert (input_blocked_p ());
876 876
877 /* If row is completely invisible, because of vscrolling, we 877 /* If row is completely invisible, because of vscrolling, we
878 don't have to draw anything. */ 878 don't have to draw anything. */
diff --git a/src/ftxfont.c b/src/ftxfont.c
index 466250bd43f..5effe6e9104 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -98,7 +98,7 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
98 new->colors[0].pixel = background; 98 new->colors[0].pixel = background;
99 new->colors[1].pixel = foreground; 99 new->colors[1].pixel = foreground;
100 100
101 BLOCK_INPUT; 101 block_input ();
102 XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), new->colors, 2); 102 XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), new->colors, 2);
103 for (i = 1; i < 7; i++) 103 for (i = 1; i < 7; i++)
104 { 104 {
@@ -115,14 +115,14 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
115 new->gcs[i - 1] = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 115 new->gcs[i - 1] = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
116 GCForeground, &xgcv); 116 GCForeground, &xgcv);
117 } 117 }
118 UNBLOCK_INPUT; 118 unblock_input ();
119 119
120 if (i < 7) 120 if (i < 7)
121 { 121 {
122 BLOCK_INPUT; 122 block_input ();
123 for (i--; i >= 0; i--) 123 for (i--; i >= 0; i--)
124 XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]); 124 XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]);
125 UNBLOCK_INPUT; 125 unblock_input ();
126 if (prev) 126 if (prev)
127 prev->next = new->next; 127 prev->next = new->next;
128 else if (data) 128 else if (data)
@@ -282,7 +282,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
282 282
283 n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0; 283 n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0;
284 284
285 BLOCK_INPUT; 285 block_input ();
286 if (with_background) 286 if (with_background)
287 ftxfont_draw_background (f, font, s->gc, x, y, s->width); 287 ftxfont_draw_background (f, font, s->gc, x, y, s->width);
288 code = alloca (sizeof (unsigned) * len); 288 code = alloca (sizeof (unsigned) * len);
@@ -332,7 +332,7 @@ ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y,
332 } 332 }
333 } 333 }
334 334
335 UNBLOCK_INPUT; 335 unblock_input ();
336 336
337 return len; 337 return len;
338} 338}
@@ -342,7 +342,7 @@ ftxfont_end_for_frame (FRAME_PTR f)
342{ 342{
343 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); 343 struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver);
344 344
345 BLOCK_INPUT; 345 block_input ();
346 while (data) 346 while (data)
347 { 347 {
348 struct ftxfont_frame_data *next = data->next; 348 struct ftxfont_frame_data *next = data->next;
@@ -353,7 +353,7 @@ ftxfont_end_for_frame (FRAME_PTR f)
353 free (data); 353 free (data);
354 data = next; 354 data = next;
355 } 355 }
356 UNBLOCK_INPUT; 356 unblock_input ();
357 font_put_frame_data (f, &ftxfont_driver, NULL); 357 font_put_frame_data (f, &ftxfont_driver, NULL);
358 return 0; 358 return 0;
359} 359}
diff --git a/src/gnutls.c b/src/gnutls.c
index 1c4693aee32..e3d84a0b61b 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -30,15 +30,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#include "w32.h" 30#include "w32.h"
31#endif 31#endif
32 32
33static int 33static bool emacs_gnutls_handle_error (gnutls_session_t, int);
34emacs_gnutls_handle_error (gnutls_session_t, int err);
35 34
36static Lisp_Object Qgnutls_dll; 35static Lisp_Object Qgnutls_dll;
37static Lisp_Object Qgnutls_code; 36static Lisp_Object Qgnutls_code;
38static Lisp_Object Qgnutls_anon, Qgnutls_x509pki; 37static Lisp_Object Qgnutls_anon, Qgnutls_x509pki;
39static Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again, 38static Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again,
40 Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake; 39 Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake;
41static int gnutls_global_initialized; 40static bool gnutls_global_initialized;
42 41
43/* The following are for the property list of `gnutls-boot'. */ 42/* The following are for the property list of `gnutls-boot'. */
44static Lisp_Object QCgnutls_bootprop_priority; 43static Lisp_Object QCgnutls_bootprop_priority;
@@ -141,13 +140,13 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_import,
141 gnutls_x509_crt_fmt_t)); 140 gnutls_x509_crt_fmt_t));
142DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); 141DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *));
143 142
144static int 143static bool
145init_gnutls_functions (Lisp_Object libraries) 144init_gnutls_functions (void)
146{ 145{
147 HMODULE library; 146 HMODULE library;
148 int max_log_level = 1; 147 int max_log_level = 1;
149 148
150 if (!(library = w32_delayed_load (libraries, Qgnutls_dll))) 149 if (!(library = w32_delayed_load (Qgnutls_dll)))
151 { 150 {
152 GNUTLS_LOG (1, max_log_level, "GnuTLS library not found"); 151 GNUTLS_LOG (1, max_log_level, "GnuTLS library not found");
153 return 0; 152 return 0;
@@ -438,7 +437,7 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
438 else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH) 437 else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH)
439 /* The peer closed the connection. */ 438 /* The peer closed the connection. */
440 return 0; 439 return 0;
441 else if (emacs_gnutls_handle_error (state, rtnval) == 0) 440 else if (emacs_gnutls_handle_error (state, rtnval))
442 /* non-fatal error */ 441 /* non-fatal error */
443 return -1; 442 return -1;
444 else { 443 else {
@@ -447,19 +446,19 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
447 } 446 }
448} 447}
449 448
450/* report a GnuTLS error to the user. 449/* Report a GnuTLS error to the user.
451 Returns zero if the error code was successfully handled. */ 450 Return true if the error code was successfully handled. */
452static int 451static bool
453emacs_gnutls_handle_error (gnutls_session_t session, int err) 452emacs_gnutls_handle_error (gnutls_session_t session, int err)
454{ 453{
455 int max_log_level = 0; 454 int max_log_level = 0;
456 455
457 int ret; 456 bool ret;
458 const char *str; 457 const char *str;
459 458
460 /* TODO: use a Lisp_Object generated by gnutls_make_error? */ 459 /* TODO: use a Lisp_Object generated by gnutls_make_error? */
461 if (err >= 0) 460 if (err >= 0)
462 return 0; 461 return 1;
463 462
464 max_log_level = global_gnutls_log_level; 463 max_log_level = global_gnutls_log_level;
465 464
@@ -471,12 +470,12 @@ emacs_gnutls_handle_error (gnutls_session_t session, int err)
471 470
472 if (fn_gnutls_error_is_fatal (err)) 471 if (fn_gnutls_error_is_fatal (err))
473 { 472 {
474 ret = err; 473 ret = 0;
475 GNUTLS_LOG2 (0, max_log_level, "fatal error:", str); 474 GNUTLS_LOG2 (0, max_log_level, "fatal error:", str);
476 } 475 }
477 else 476 else
478 { 477 {
479 ret = 0; 478 ret = 1;
480 GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str); 479 GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str);
481 /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2. */ 480 /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2. */
482 } 481 }
@@ -656,7 +655,7 @@ DEFUN ("gnutls-available-p", Fgnutls_available_p, Sgnutls_available_p, 0, 0, 0,
656 else 655 else
657 { 656 {
658 Lisp_Object status; 657 Lisp_Object status;
659 status = init_gnutls_functions (Vdynamic_library_alist) ? Qt : Qnil; 658 status = init_gnutls_functions () ? Qt : Qnil;
660 Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache); 659 Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache);
661 return status; 660 return status;
662 } 661 }
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 1eb4b2cabdf..1bf2b533b41 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -576,21 +576,21 @@ get_utf8_string (const char *str)
576 576
577/* Check for special colors used in face spec for region face. 577/* Check for special colors used in face spec for region face.
578 The colors are fetched from the Gtk+ theme. 578 The colors are fetched from the Gtk+ theme.
579 Return 1 if color was found, 0 if not. */ 579 Return true if color was found, false if not. */
580 580
581int 581bool
582xg_check_special_colors (struct frame *f, 582xg_check_special_colors (struct frame *f,
583 const char *color_name, 583 const char *color_name,
584 XColor *color) 584 XColor *color)
585{ 585{
586 int success_p = 0; 586 bool success_p = 0;
587 int get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0; 587 bool get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0;
588 int get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0; 588 bool get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0;
589 589
590 if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) 590 if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg))
591 return success_p; 591 return success_p;
592 592
593 BLOCK_INPUT; 593 block_input ();
594 { 594 {
595#ifdef HAVE_GTK3 595#ifdef HAVE_GTK3
596 GtkStyleContext *gsty 596 GtkStyleContext *gsty
@@ -604,8 +604,9 @@ xg_check_special_colors (struct frame *f,
604 gtk_style_context_get_background_color (gsty, state, &col); 604 gtk_style_context_get_background_color (gsty, state, &col);
605 605
606 sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue); 606 sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue);
607 success_p = XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), 607 success_p = (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
608 buf, color); 608 buf, color)
609 != 0);
609#else 610#else
610 GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); 611 GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f));
611 GdkColor *grgb = get_bg 612 GdkColor *grgb = get_bg
@@ -620,7 +621,7 @@ xg_check_special_colors (struct frame *f,
620#endif 621#endif
621 622
622 } 623 }
623 UNBLOCK_INPUT; 624 unblock_input ();
624 return success_p; 625 return success_p;
625} 626}
626 627
@@ -703,9 +704,9 @@ qttip_cb (GtkWidget *widget,
703#endif /* USE_GTK_TOOLTIP */ 704#endif /* USE_GTK_TOOLTIP */
704 705
705/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT. 706/* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT.
706 Return zero if no system tooltip available, non-zero otherwise. */ 707 Return true if a system tooltip is available. */
707 708
708int 709bool
709xg_prepare_tooltip (FRAME_PTR f, 710xg_prepare_tooltip (FRAME_PTR f,
710 Lisp_Object string, 711 Lisp_Object string,
711 int *width, 712 int *width,
@@ -725,7 +726,7 @@ xg_prepare_tooltip (FRAME_PTR f,
725 726
726 if (!x->ttip_lbl) return 0; 727 if (!x->ttip_lbl) return 0;
727 728
728 BLOCK_INPUT; 729 block_input ();
729 encoded_string = ENCODE_UTF_8 (string); 730 encoded_string = ENCODE_UTF_8 (string);
730 widget = GTK_WIDGET (x->ttip_lbl); 731 widget = GTK_WIDGET (x->ttip_lbl);
731 gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window)); 732 gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window));
@@ -753,7 +754,7 @@ xg_prepare_tooltip (FRAME_PTR f,
753 if (width) *width = req.width; 754 if (width) *width = req.width;
754 if (height) *height = req.height; 755 if (height) *height = req.height;
755 756
756 UNBLOCK_INPUT; 757 unblock_input ();
757 758
758 return 1; 759 return 1;
759#endif /* USE_GTK_TOOLTIP */ 760#endif /* USE_GTK_TOOLTIP */
@@ -769,27 +770,27 @@ xg_show_tooltip (FRAME_PTR f, int root_x, int root_y)
769 struct x_output *x = f->output_data.x; 770 struct x_output *x = f->output_data.x;
770 if (x->ttip_window) 771 if (x->ttip_window)
771 { 772 {
772 BLOCK_INPUT; 773 block_input ();
773 gtk_window_move (x->ttip_window, root_x, root_y); 774 gtk_window_move (x->ttip_window, root_x, root_y);
774 gtk_widget_show_all (GTK_WIDGET (x->ttip_window)); 775 gtk_widget_show_all (GTK_WIDGET (x->ttip_window));
775 UNBLOCK_INPUT; 776 unblock_input ();
776 } 777 }
777#endif 778#endif
778} 779}
779 780
780/* Hide tooltip if shown. Do nothing if not shown. 781/* Hide tooltip if shown. Do nothing if not shown.
781 Return non-zero if tip was hidden, non-zero if not (i.e. not using 782 Return true if tip was hidden, false if not (i.e. not using
782 system tooltips). */ 783 system tooltips). */
783 784
784int 785bool
785xg_hide_tooltip (FRAME_PTR f) 786xg_hide_tooltip (FRAME_PTR f)
786{ 787{
787 int ret = 0; 788 bool ret = 0;
788#ifdef USE_GTK_TOOLTIP 789#ifdef USE_GTK_TOOLTIP
789 if (f->output_data.x->ttip_window) 790 if (f->output_data.x->ttip_window)
790 { 791 {
791 GtkWindow *win = f->output_data.x->ttip_window; 792 GtkWindow *win = f->output_data.x->ttip_window;
792 BLOCK_INPUT; 793 block_input ();
793 gtk_widget_hide (GTK_WIDGET (win)); 794 gtk_widget_hide (GTK_WIDGET (win));
794 795
795 if (g_object_get_data (G_OBJECT (win), "restore-tt")) 796 if (g_object_get_data (G_OBJECT (win), "restore-tt"))
@@ -799,7 +800,7 @@ xg_hide_tooltip (FRAME_PTR f)
799 GtkSettings *settings = gtk_settings_get_for_screen (screen); 800 GtkSettings *settings = gtk_settings_get_for_screen (screen);
800 g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); 801 g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL);
801 } 802 }
802 UNBLOCK_INPUT; 803 unblock_input ();
803 804
804 ret = 1; 805 ret = 1;
805 } 806 }
@@ -1007,7 +1008,7 @@ xg_win_to_widget (Display *dpy, Window wdesc)
1007 gpointer gdkwin; 1008 gpointer gdkwin;
1008 GtkWidget *gwdesc = 0; 1009 GtkWidget *gwdesc = 0;
1009 1010
1010 BLOCK_INPUT; 1011 block_input ();
1011 1012
1012 gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), 1013 gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy),
1013 wdesc); 1014 wdesc);
@@ -1019,7 +1020,7 @@ xg_win_to_widget (Display *dpy, Window wdesc)
1019 gwdesc = gtk_get_event_widget (&event); 1020 gwdesc = gtk_get_event_widget (&event);
1020 } 1021 }
1021 1022
1022 UNBLOCK_INPUT; 1023 unblock_input ();
1023 return gwdesc; 1024 return gwdesc;
1024} 1025}
1025 1026
@@ -1110,9 +1111,9 @@ delete_cb (GtkWidget *widget,
1110} 1111}
1111 1112
1112/* Create and set up the GTK widgets for frame F. 1113/* Create and set up the GTK widgets for frame F.
1113 Return 0 if creation failed, non-zero otherwise. */ 1114 Return true if creation succeeded. */
1114 1115
1115int 1116bool
1116xg_create_frame_widgets (FRAME_PTR f) 1117xg_create_frame_widgets (FRAME_PTR f)
1117{ 1118{
1118 GtkWidget *wtop; 1119 GtkWidget *wtop;
@@ -1123,7 +1124,7 @@ xg_create_frame_widgets (FRAME_PTR f)
1123#endif 1124#endif
1124 char *title = 0; 1125 char *title = 0;
1125 1126
1126 BLOCK_INPUT; 1127 block_input ();
1127 1128
1128 if (FRAME_X_EMBEDDED_P (f)) 1129 if (FRAME_X_EMBEDDED_P (f))
1129 { 1130 {
@@ -1161,7 +1162,7 @@ xg_create_frame_widgets (FRAME_PTR f)
1161 if (whbox) gtk_widget_destroy (whbox); 1162 if (whbox) gtk_widget_destroy (whbox);
1162 if (wfixed) gtk_widget_destroy (wfixed); 1163 if (wfixed) gtk_widget_destroy (wfixed);
1163 1164
1164 UNBLOCK_INPUT; 1165 unblock_input ();
1165 return 0; 1166 return 0;
1166 } 1167 }
1167 1168
@@ -1275,7 +1276,7 @@ xg_create_frame_widgets (FRAME_PTR f)
1275 } 1276 }
1276 } 1277 }
1277 1278
1278 UNBLOCK_INPUT; 1279 unblock_input ();
1279 1280
1280 return 1; 1281 return 1;
1281} 1282}
@@ -1309,11 +1310,11 @@ xg_free_frame_widgets (FRAME_PTR f)
1309/* Set the normal size hints for the window manager, for frame F. 1310/* Set the normal size hints for the window manager, for frame F.
1310 FLAGS is the flags word to use--or 0 meaning preserve the flags 1311 FLAGS is the flags word to use--or 0 meaning preserve the flags
1311 that the window now has. 1312 that the window now has.
1312 If USER_POSITION is nonzero, we set the User Position 1313 If USER_POSITION, set the User Position
1313 flag (this is useful when FLAGS is 0). */ 1314 flag (this is useful when FLAGS is 0). */
1314 1315
1315void 1316void
1316x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position) 1317x_wm_set_size_hint (FRAME_PTR f, long int flags, bool user_position)
1317{ 1318{
1318 /* Must use GTK routines here, otherwise GTK resets the size hints 1319 /* Must use GTK routines here, otherwise GTK resets the size hints
1319 to its own defaults. */ 1320 to its own defaults. */
@@ -1397,12 +1398,12 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position)
1397 &f->output_data.x->size_hints, 1398 &f->output_data.x->size_hints,
1398 sizeof (size_hints)) != 0) 1399 sizeof (size_hints)) != 0)
1399 { 1400 {
1400 BLOCK_INPUT; 1401 block_input ();
1401 gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 1402 gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
1402 NULL, &size_hints, hint_flags); 1403 NULL, &size_hints, hint_flags);
1403 f->output_data.x->size_hints = size_hints; 1404 f->output_data.x->size_hints = size_hints;
1404 f->output_data.x->hint_flags = hint_flags; 1405 f->output_data.x->hint_flags = hint_flags;
1405 UNBLOCK_INPUT; 1406 unblock_input ();
1406 } 1407 }
1407} 1408}
1408 1409
@@ -1417,9 +1418,9 @@ xg_set_background_color (FRAME_PTR f, long unsigned int bg)
1417{ 1418{
1418 if (FRAME_GTK_WIDGET (f)) 1419 if (FRAME_GTK_WIDGET (f))
1419 { 1420 {
1420 BLOCK_INPUT; 1421 block_input ();
1421 xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f)); 1422 xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f));
1422 UNBLOCK_INPUT; 1423 unblock_input ();
1423 } 1424 }
1424} 1425}
1425 1426
@@ -1519,7 +1520,7 @@ create_dialog (widget_value *wv,
1519 1520
1520 /* If the number of buttons is greater than 4, make two rows of buttons 1521 /* If the number of buttons is greater than 4, make two rows of buttons
1521 instead. This looks better. */ 1522 instead. This looks better. */
1522 int make_two_rows = total_buttons > 4; 1523 bool make_two_rows = total_buttons > 4;
1523 1524
1524 if (right_buttons == 0) right_buttons = total_buttons/2; 1525 if (right_buttons == 0) right_buttons = total_buttons/2;
1525 left_buttons = total_buttons - right_buttons; 1526 left_buttons = total_buttons - right_buttons;
@@ -1637,14 +1638,14 @@ pop_down_dialog (Lisp_Object arg)
1637 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1638 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1638 struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer; 1639 struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer;
1639 1640
1640 BLOCK_INPUT; 1641 block_input ();
1641 if (dd->w) gtk_widget_destroy (dd->w); 1642 if (dd->w) gtk_widget_destroy (dd->w);
1642 if (dd->timerid != 0) g_source_remove (dd->timerid); 1643 if (dd->timerid != 0) g_source_remove (dd->timerid);
1643 1644
1644 g_main_loop_quit (dd->loop); 1645 g_main_loop_quit (dd->loop);
1645 g_main_loop_unref (dd->loop); 1646 g_main_loop_unref (dd->loop);
1646 1647
1647 UNBLOCK_INPUT; 1648 unblock_input ();
1648 1649
1649 return Qnil; 1650 return Qnil;
1650} 1651}
@@ -1716,10 +1717,9 @@ xg_dialog_run (FRAME_PTR f, GtkWidget *w)
1716/*********************************************************************** 1717/***********************************************************************
1717 File dialog functions 1718 File dialog functions
1718 ***********************************************************************/ 1719 ***********************************************************************/
1719/* Return non-zero if the old file selection dialog is being used. 1720/* Return true if the old file selection dialog is being used. */
1720 Return zero if not. */
1721 1721
1722int 1722bool
1723xg_uses_old_file_dialog (void) 1723xg_uses_old_file_dialog (void)
1724{ 1724{
1725#ifdef HAVE_GTK_FILE_SELECTION_NEW 1725#ifdef HAVE_GTK_FILE_SELECTION_NEW
@@ -1790,7 +1790,7 @@ xg_toggle_notify_cb (GObject *gobject, GParamSpec *arg1, gpointer user_data)
1790 F is the current frame. 1790 F is the current frame.
1791 PROMPT is a prompt to show to the user. May not be NULL. 1791 PROMPT is a prompt to show to the user. May not be NULL.
1792 DEFAULT_FILENAME is a default selection to be displayed. May be NULL. 1792 DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
1793 If MUSTMATCH_P is non-zero, the returned file name must be an existing 1793 If MUSTMATCH_P, the returned file name must be an existing
1794 file. (Actually, this only has cosmetic effects, the user can 1794 file. (Actually, this only has cosmetic effects, the user can
1795 still enter a non-existing file.) *FUNC is set to a function that 1795 still enter a non-existing file.) *FUNC is set to a function that
1796 can be used to retrieve the selected file name from the returned widget. 1796 can be used to retrieve the selected file name from the returned widget.
@@ -1801,7 +1801,7 @@ static GtkWidget *
1801xg_get_file_with_chooser (FRAME_PTR f, 1801xg_get_file_with_chooser (FRAME_PTR f,
1802 char *prompt, 1802 char *prompt,
1803 char *default_filename, 1803 char *default_filename,
1804 int mustmatch_p, int only_dir_p, 1804 bool mustmatch_p, bool only_dir_p,
1805 xg_get_file_func *func) 1805 xg_get_file_func *func)
1806{ 1806{
1807 char msgbuf[1024]; 1807 char msgbuf[1024];
@@ -1913,7 +1913,7 @@ xg_get_file_name_from_selector (GtkWidget *w)
1913 F is the current frame. 1913 F is the current frame.
1914 PROMPT is a prompt to show to the user. May not be NULL. 1914 PROMPT is a prompt to show to the user. May not be NULL.
1915 DEFAULT_FILENAME is a default selection to be displayed. May be NULL. 1915 DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
1916 If MUSTMATCH_P is non-zero, the returned file name must be an existing 1916 If MUSTMATCH_P, the returned file name must be an existing
1917 file. *FUNC is set to a function that can be used to retrieve the 1917 file. *FUNC is set to a function that can be used to retrieve the
1918 selected file name from the returned widget. 1918 selected file name from the returned widget.
1919 1919
@@ -1923,7 +1923,7 @@ static GtkWidget *
1923xg_get_file_with_selection (FRAME_PTR f, 1923xg_get_file_with_selection (FRAME_PTR f,
1924 char *prompt, 1924 char *prompt,
1925 char *default_filename, 1925 char *default_filename,
1926 int mustmatch_p, int only_dir_p, 1926 bool mustmatch_p, bool only_dir_p,
1927 xg_get_file_func *func) 1927 xg_get_file_func *func)
1928{ 1928{
1929 GtkWidget *filewin; 1929 GtkWidget *filewin;
@@ -1955,7 +1955,7 @@ xg_get_file_with_selection (FRAME_PTR f,
1955 F is the current frame. 1955 F is the current frame.
1956 PROMPT is a prompt to show to the user. May not be NULL. 1956 PROMPT is a prompt to show to the user. May not be NULL.
1957 DEFAULT_FILENAME is a default selection to be displayed. May be NULL. 1957 DEFAULT_FILENAME is a default selection to be displayed. May be NULL.
1958 If MUSTMATCH_P is non-zero, the returned file name must be an existing 1958 If MUSTMATCH_P, the returned file name must be an existing
1959 file. 1959 file.
1960 1960
1961 Returns a file name or NULL if no file was selected. 1961 Returns a file name or NULL if no file was selected.
@@ -1965,24 +1965,14 @@ char *
1965xg_get_file_name (FRAME_PTR f, 1965xg_get_file_name (FRAME_PTR f,
1966 char *prompt, 1966 char *prompt,
1967 char *default_filename, 1967 char *default_filename,
1968 int mustmatch_p, 1968 bool mustmatch_p,
1969 int only_dir_p) 1969 bool only_dir_p)
1970{ 1970{
1971 GtkWidget *w = 0; 1971 GtkWidget *w = 0;
1972 char *fn = 0; 1972 char *fn = 0;
1973 int filesel_done = 0; 1973 int filesel_done = 0;
1974 xg_get_file_func func; 1974 xg_get_file_func func;
1975 1975
1976#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
1977 /* I really don't know why this is needed, but without this the GLIBC add on
1978 library linuxthreads hangs when the Gnome file chooser backend creates
1979 threads. */
1980 sigset_t blocked;
1981 sigemptyset (&blocked);
1982 sigaddset (&blocked, __SIGRTMIN);
1983 pthread_sigmask (SIG_BLOCK, &blocked, 0);
1984#endif /* HAVE_PTHREAD */
1985
1986#ifdef HAVE_GTK_FILE_SELECTION_NEW 1976#ifdef HAVE_GTK_FILE_SELECTION_NEW
1987 1977
1988 if (xg_uses_old_file_dialog ()) 1978 if (xg_uses_old_file_dialog ())
@@ -2000,11 +1990,6 @@ xg_get_file_name (FRAME_PTR f,
2000 gtk_widget_set_name (w, "emacs-filedialog"); 1990 gtk_widget_set_name (w, "emacs-filedialog");
2001 1991
2002 filesel_done = xg_dialog_run (f, w); 1992 filesel_done = xg_dialog_run (f, w);
2003
2004#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
2005 pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
2006#endif
2007
2008 if (filesel_done == GTK_RESPONSE_OK) 1993 if (filesel_done == GTK_RESPONSE_OK)
2009 fn = (*func) (w); 1994 fn = (*func) (w);
2010 1995
@@ -2057,13 +2042,6 @@ xg_get_font (FRAME_PTR f, const char *default_name)
2057 int done = 0; 2042 int done = 0;
2058 Lisp_Object font = Qnil; 2043 Lisp_Object font = Qnil;
2059 2044
2060#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
2061 sigset_t blocked;
2062 sigemptyset (&blocked);
2063 sigaddset (&blocked, __SIGRTMIN);
2064 pthread_sigmask (SIG_BLOCK, &blocked, 0);
2065#endif /* HAVE_PTHREAD */
2066
2067 w = gtk_font_chooser_dialog_new 2045 w = gtk_font_chooser_dialog_new
2068 ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); 2046 ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)));
2069 2047
@@ -2088,11 +2066,6 @@ xg_get_font (FRAME_PTR f, const char *default_name)
2088 2066
2089 gtk_widget_set_name (w, "emacs-fontdialog"); 2067 gtk_widget_set_name (w, "emacs-fontdialog");
2090 done = xg_dialog_run (f, w); 2068 done = xg_dialog_run (f, w);
2091
2092#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN)
2093 pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
2094#endif
2095
2096 if (done == GTK_RESPONSE_OK) 2069 if (done == GTK_RESPONSE_OK)
2097 { 2070 {
2098#if USE_NEW_GTK_FONT_CHOOSER 2071#if USE_NEW_GTK_FONT_CHOOSER
@@ -2430,9 +2403,9 @@ make_menu_item (const char *utf8_label,
2430 2403
2431static int xg_detached_menus; 2404static int xg_detached_menus;
2432 2405
2433/* Returns non-zero if there are detached menus. */ 2406/* Return true if there are detached menus. */
2434 2407
2435int 2408bool
2436xg_have_tear_offs (void) 2409xg_have_tear_offs (void)
2437{ 2410{
2438 return xg_detached_menus > 0; 2411 return xg_detached_menus > 0;
@@ -2536,10 +2509,9 @@ xg_create_one_menuitem (widget_value *item,
2536 SELECT_CB is the callback to use when a menu item is selected. 2509 SELECT_CB is the callback to use when a menu item is selected.
2537 DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore. 2510 DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore.
2538 HIGHLIGHT_CB is the callback to call when entering/leaving menu items. 2511 HIGHLIGHT_CB is the callback to call when entering/leaving menu items.
2539 POP_UP_P is non-zero if we shall create a popup menu. 2512 If POP_UP_P, create a popup menu.
2540 MENU_BAR_P is non-zero if we shall create a menu bar. 2513 If MENU_BAR_P, create a menu bar.
2541 ADD_TEAROFF_P is non-zero if we shall add a tearoff menu item. Ignored 2514 If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P.
2542 if MENU_BAR_P is non-zero.
2543 TOPMENU is the topmost GtkWidget that others shall be placed under. 2515 TOPMENU is the topmost GtkWidget that others shall be placed under.
2544 It may be NULL, in that case we create the appropriate widget 2516 It may be NULL, in that case we create the appropriate widget
2545 (menu bar or menu item depending on POP_UP_P and MENU_BAR_P) 2517 (menu bar or menu item depending on POP_UP_P and MENU_BAR_P)
@@ -2559,9 +2531,9 @@ create_menus (widget_value *data,
2559 GCallback select_cb, 2531 GCallback select_cb,
2560 GCallback deactivate_cb, 2532 GCallback deactivate_cb,
2561 GCallback highlight_cb, 2533 GCallback highlight_cb,
2562 int pop_up_p, 2534 bool pop_up_p,
2563 int menu_bar_p, 2535 bool menu_bar_p,
2564 int add_tearoff_p, 2536 bool add_tearoff_p,
2565 GtkWidget *topmenu, 2537 GtkWidget *topmenu,
2566 xg_menu_cb_data *cl_data, 2538 xg_menu_cb_data *cl_data,
2567 const char *name) 2539 const char *name)
@@ -2701,8 +2673,8 @@ xg_create_widget (const char *type, const char *name, FRAME_PTR f, widget_value
2701 GCallback highlight_cb) 2673 GCallback highlight_cb)
2702{ 2674{
2703 GtkWidget *w = 0; 2675 GtkWidget *w = 0;
2704 int menu_bar_p = strcmp (type, "menubar") == 0; 2676 bool menu_bar_p = strcmp (type, "menubar") == 0;
2705 int pop_up_p = strcmp (type, "popup") == 0; 2677 bool pop_up_p = strcmp (type, "popup") == 0;
2706 2678
2707 if (strcmp (type, "dialog") == 0) 2679 if (strcmp (type, "dialog") == 0)
2708 { 2680 {
@@ -2755,12 +2727,12 @@ xg_get_menu_item_label (GtkMenuItem *witem)
2755 return gtk_label_get_label (wlabel); 2727 return gtk_label_get_label (wlabel);
2756} 2728}
2757 2729
2758/* Return non-zero if the menu item WITEM has the text LABEL. */ 2730/* Return true if the menu item WITEM has the text LABEL. */
2759 2731
2760static int 2732static bool
2761xg_item_label_same_p (GtkMenuItem *witem, const char *label) 2733xg_item_label_same_p (GtkMenuItem *witem, const char *label)
2762{ 2734{
2763 int is_same = 0; 2735 bool is_same = 0;
2764 char *utf8_label = get_utf8_string (label); 2736 char *utf8_label = get_utf8_string (label);
2765 const char *old_label = witem ? xg_get_menu_item_label (witem) : 0; 2737 const char *old_label = witem ? xg_get_menu_item_label (witem) : 0;
2766 2738
@@ -2851,8 +2823,8 @@ xg_update_menubar (GtkWidget *menubar,
2851 { 2823 {
2852 GtkMenuItem *witem = GTK_MENU_ITEM (iter->data); 2824 GtkMenuItem *witem = GTK_MENU_ITEM (iter->data);
2853 GtkMenuItem *witem2 = 0; 2825 GtkMenuItem *witem2 = 0;
2854 int val_in_menubar = 0; 2826 bool val_in_menubar = 0;
2855 int iter_in_new_menubar = 0; 2827 bool iter_in_new_menubar = 0;
2856 GList *iter2; 2828 GList *iter2;
2857 widget_value *cur; 2829 widget_value *cur;
2858 2830
@@ -3130,7 +3102,7 @@ xg_update_submenu (GtkWidget *submenu,
3130 GList *list = 0; 3102 GList *list = 0;
3131 GList *iter; 3103 GList *iter;
3132 widget_value *cur; 3104 widget_value *cur;
3133 int has_tearoff_p = 0; 3105 bool has_tearoff_p = 0;
3134 GList *first_radio = 0; 3106 GList *first_radio = 0;
3135 3107
3136 if (submenu) 3108 if (submenu)
@@ -3252,7 +3224,7 @@ xg_update_submenu (GtkWidget *submenu,
3252/* Update the MENUBAR. 3224/* Update the MENUBAR.
3253 F is the frame the menu bar belongs to. 3225 F is the frame the menu bar belongs to.
3254 VAL describes the contents of the menu bar. 3226 VAL describes the contents of the menu bar.
3255 If DEEP_P is non-zero, rebuild all but the top level menu names in 3227 If DEEP_P, rebuild all but the top level menu names in
3256 the MENUBAR. If DEEP_P is zero, just rebuild the names in the menubar. 3228 the MENUBAR. If DEEP_P is zero, just rebuild the names in the menubar.
3257 SELECT_CB is the callback to use when a menu item is selected. 3229 SELECT_CB is the callback to use when a menu item is selected.
3258 DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore. 3230 DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore.
@@ -3260,7 +3232,7 @@ xg_update_submenu (GtkWidget *submenu,
3260 3232
3261void 3233void
3262xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val, 3234xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val,
3263 int deep_p, 3235 bool deep_p,
3264 GCallback select_cb, GCallback deactivate_cb, 3236 GCallback select_cb, GCallback deactivate_cb,
3265 GCallback highlight_cb) 3237 GCallback highlight_cb)
3266{ 3238{
@@ -3344,21 +3316,21 @@ menubar_map_cb (GtkWidget *w, gpointer user_data)
3344} 3316}
3345 3317
3346/* Recompute all the widgets of frame F, when the menu bar has been 3318/* Recompute all the widgets of frame F, when the menu bar has been
3347 changed. Value is non-zero if widgets were updated. */ 3319 changed. */
3348 3320
3349int 3321void
3350xg_update_frame_menubar (FRAME_PTR f) 3322xg_update_frame_menubar (FRAME_PTR f)
3351{ 3323{
3352 struct x_output *x = f->output_data.x; 3324 struct x_output *x = f->output_data.x;
3353 GtkRequisition req; 3325 GtkRequisition req;
3354 3326
3355 if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget)) 3327 if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget))
3356 return 0; 3328 return;
3357 3329
3358 if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget)) 3330 if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget))
3359 return 0; /* Already done this, happens for frames created invisible. */ 3331 return; /* Already done this, happens for frames created invisible. */
3360 3332
3361 BLOCK_INPUT; 3333 block_input ();
3362 3334
3363 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->menubar_widget, 3335 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->menubar_widget,
3364 FALSE, FALSE, 0); 3336 FALSE, FALSE, 0);
@@ -3378,9 +3350,7 @@ xg_update_frame_menubar (FRAME_PTR f)
3378 FRAME_MENUBAR_HEIGHT (f) = req.height; 3350 FRAME_MENUBAR_HEIGHT (f) = req.height;
3379 xg_height_or_width_changed (f); 3351 xg_height_or_width_changed (f);
3380 } 3352 }
3381 UNBLOCK_INPUT; 3353 unblock_input ();
3382
3383 return 1;
3384} 3354}
3385 3355
3386/* Get rid of the menu bar of frame F, and free its storage. 3356/* Get rid of the menu bar of frame F, and free its storage.
@@ -3393,7 +3363,7 @@ free_frame_menubar (FRAME_PTR f)
3393 3363
3394 if (x->menubar_widget) 3364 if (x->menubar_widget)
3395 { 3365 {
3396 BLOCK_INPUT; 3366 block_input ();
3397 3367
3398 gtk_container_remove (GTK_CONTAINER (x->vbox_widget), x->menubar_widget); 3368 gtk_container_remove (GTK_CONTAINER (x->vbox_widget), x->menubar_widget);
3399 /* The menubar and its children shall be deleted when removed from 3369 /* The menubar and its children shall be deleted when removed from
@@ -3401,11 +3371,11 @@ free_frame_menubar (FRAME_PTR f)
3401 x->menubar_widget = 0; 3371 x->menubar_widget = 0;
3402 FRAME_MENUBAR_HEIGHT (f) = 0; 3372 FRAME_MENUBAR_HEIGHT (f) = 0;
3403 xg_height_or_width_changed (f); 3373 xg_height_or_width_changed (f);
3404 UNBLOCK_INPUT; 3374 unblock_input ();
3405 } 3375 }
3406} 3376}
3407 3377
3408int 3378bool
3409xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) 3379xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
3410{ 3380{
3411 struct x_output *x = f->output_data.x; 3381 struct x_output *x = f->output_data.x;
@@ -3452,7 +3422,7 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
3452 break; 3422 break;
3453 } 3423 }
3454 g_list_free (list); 3424 g_list_free (list);
3455 return iter == 0 ? 0 : 1; 3425 return iter != 0;
3456} 3426}
3457 3427
3458 3428
@@ -3465,7 +3435,7 @@ xg_event_is_for_menubar (FRAME_PTR f, XEvent *event)
3465/* Setting scroll bar values invokes the callback. Use this variable 3435/* Setting scroll bar values invokes the callback. Use this variable
3466 to indicate that callback should do nothing. */ 3436 to indicate that callback should do nothing. */
3467 3437
3468int xg_ignore_gtk_scrollbar; 3438bool xg_ignore_gtk_scrollbar;
3469 3439
3470/* The width of the scroll bar for the current theme. */ 3440/* The width of the scroll bar for the current theme. */
3471 3441
@@ -3791,7 +3761,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3791 int size, value; 3761 int size, value;
3792 int old_size; 3762 int old_size;
3793 int new_step; 3763 int new_step;
3794 int changed = 0; 3764 bool changed = 0;
3795 3765
3796 adj = gtk_range_get_adjustment (GTK_RANGE (wscroll)); 3766 adj = gtk_range_get_adjustment (GTK_RANGE (wscroll));
3797 3767
@@ -3838,7 +3808,7 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3838 3808
3839 if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) 3809 if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value)
3840 { 3810 {
3841 BLOCK_INPUT; 3811 block_input ();
3842 3812
3843 /* gtk_range_set_value invokes the callback. Set 3813 /* gtk_range_set_value invokes the callback. Set
3844 ignore_gtk_scrollbar to make the callback do nothing */ 3814 ignore_gtk_scrollbar to make the callback do nothing */
@@ -3851,22 +3821,20 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3851 3821
3852 xg_ignore_gtk_scrollbar = 0; 3822 xg_ignore_gtk_scrollbar = 0;
3853 3823
3854 UNBLOCK_INPUT; 3824 unblock_input ();
3855 } 3825 }
3856 } 3826 }
3857} 3827}
3858 3828
3859/* Return non-zero if EVENT is for a scroll bar in frame F. 3829/* Return true if EVENT is for a scroll bar in frame F.
3860 When the same X window is used for several Gtk+ widgets, we cannot 3830 When the same X window is used for several Gtk+ widgets, we cannot
3861 say for sure based on the X window alone if an event is for the 3831 say for sure based on the X window alone if an event is for the
3862 frame. This function does additional checks. 3832 frame. This function does additional checks. */
3863 3833
3864 Return non-zero if the event is for a scroll bar, zero otherwise. */ 3834bool
3865
3866int
3867xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event) 3835xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event)
3868{ 3836{
3869 int retval = 0; 3837 bool retval = 0;
3870 3838
3871 if (f && event->type == ButtonPress && event->xbutton.button < 4) 3839 if (f && event->type == ButtonPress && event->xbutton.button < 4)
3872 { 3840 {
@@ -4297,7 +4265,7 @@ static void
4297xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos) 4265xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
4298{ 4266{
4299 struct x_output *x = f->output_data.x; 4267 struct x_output *x = f->output_data.x;
4300 int into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); 4268 bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright);
4301 4269
4302 toolbar_set_orientation (x->toolbar_widget, 4270 toolbar_set_orientation (x->toolbar_widget,
4303 into_hbox 4271 into_hbox
@@ -4329,7 +4297,7 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos)
4329 } 4297 }
4330 else 4298 else
4331 { 4299 {
4332 int vbox_pos = x->menubar_widget ? 1 : 0; 4300 bool vbox_pos = x->menubar_widget != 0;
4333 gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), 4301 gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget),
4334 GTK_POS_LEFT); 4302 GTK_POS_LEFT);
4335 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, 4303 gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget,
@@ -4420,7 +4388,7 @@ xg_make_tool_item (FRAME_PTR f,
4420 GtkWidget *wimage, 4388 GtkWidget *wimage,
4421 GtkWidget **wbutton, 4389 GtkWidget **wbutton,
4422 const char *label, 4390 const char *label,
4423 int i, int horiz, int text_image) 4391 int i, bool horiz, bool text_image)
4424{ 4392{
4425 GtkToolItem *ti = gtk_tool_item_new (); 4393 GtkToolItem *ti = gtk_tool_item_new ();
4426 GtkWidget *vb = gtk_box_new (horiz 4394 GtkWidget *vb = gtk_box_new (horiz
@@ -4515,11 +4483,11 @@ xg_make_tool_item (FRAME_PTR f,
4515 return ti; 4483 return ti;
4516} 4484}
4517 4485
4518static int 4486static bool
4519is_box_type (GtkWidget *vb, int is_horizontal) 4487is_box_type (GtkWidget *vb, bool is_horizontal)
4520{ 4488{
4521#ifdef HAVE_GTK3 4489#ifdef HAVE_GTK3
4522 int ret = 0; 4490 bool ret = 0;
4523 if (GTK_IS_BOX (vb)) 4491 if (GTK_IS_BOX (vb))
4524 { 4492 {
4525 GtkOrientation ori = gtk_orientable_get_orientation (GTK_ORIENTABLE (vb)); 4493 GtkOrientation ori = gtk_orientable_get_orientation (GTK_ORIENTABLE (vb));
@@ -4533,10 +4501,10 @@ is_box_type (GtkWidget *vb, int is_horizontal)
4533} 4501}
4534 4502
4535 4503
4536static int 4504static bool
4537xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, 4505xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
4538 const char *icon_name, const struct image *img, 4506 const char *icon_name, const struct image *img,
4539 const char *label, int horiz) 4507 const char *label, bool horiz)
4540{ 4508{
4541 gpointer old; 4509 gpointer old;
4542 GtkWidget *wimage; 4510 GtkWidget *wimage;
@@ -4578,7 +4546,7 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
4578 return 0; 4546 return 0;
4579} 4547}
4580 4548
4581static int 4549static bool
4582xg_update_tool_bar_sizes (FRAME_PTR f) 4550xg_update_tool_bar_sizes (FRAME_PTR f)
4583{ 4551{
4584 struct x_output *x = f->output_data.x; 4552 struct x_output *x = f->output_data.x;
@@ -4634,15 +4602,15 @@ update_frame_tool_bar (FRAME_PTR f)
4634 GtkToolbar *wtoolbar; 4602 GtkToolbar *wtoolbar;
4635 GtkToolItem *ti; 4603 GtkToolItem *ti;
4636 GtkTextDirection dir; 4604 GtkTextDirection dir;
4637 int pack_tool_bar = x->handlebox_widget == NULL; 4605 bool pack_tool_bar = x->handlebox_widget == NULL;
4638 Lisp_Object style; 4606 Lisp_Object style;
4639 int text_image, horiz; 4607 bool text_image, horiz;
4640 struct xg_frame_tb_info *tbinfo; 4608 struct xg_frame_tb_info *tbinfo;
4641 4609
4642 if (! FRAME_GTK_WIDGET (f)) 4610 if (! FRAME_GTK_WIDGET (f))
4643 return; 4611 return;
4644 4612
4645 BLOCK_INPUT; 4613 block_input ();
4646 4614
4647 if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX)) 4615 if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX))
4648 { 4616 {
@@ -4684,7 +4652,7 @@ update_frame_tool_bar (FRAME_PTR f)
4684 && ! NILP (Fequal (tbinfo->style, style)) 4652 && ! NILP (Fequal (tbinfo->style, style))
4685 && ! NILP (Fequal (tbinfo->last_tool_bar, f->tool_bar_items))) 4653 && ! NILP (Fequal (tbinfo->last_tool_bar, f->tool_bar_items)))
4686 { 4654 {
4687 UNBLOCK_INPUT; 4655 unblock_input ();
4688 return; 4656 return;
4689 } 4657 }
4690 4658
@@ -4700,8 +4668,8 @@ update_frame_tool_bar (FRAME_PTR f)
4700 4668
4701 for (i = j = 0; i < f->n_tool_bar_items; ++i) 4669 for (i = j = 0; i < f->n_tool_bar_items; ++i)
4702 { 4670 {
4703 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); 4671 bool enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
4704 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); 4672 bool selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
4705 int idx; 4673 int idx;
4706 ptrdiff_t img_id; 4674 ptrdiff_t img_id;
4707 int icon_size = 0; 4675 int icon_size = 0;
@@ -4714,7 +4682,7 @@ update_frame_tool_bar (FRAME_PTR f)
4714 Lisp_Object rtl; 4682 Lisp_Object rtl;
4715 GtkWidget *wbutton = NULL; 4683 GtkWidget *wbutton = NULL;
4716 Lisp_Object specified_file; 4684 Lisp_Object specified_file;
4717 int vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY)); 4685 bool vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY));
4718 const char *label 4686 const char *label
4719 = (EQ (style, Qimage) || (vert_only && horiz)) ? NULL 4687 = (EQ (style, Qimage) || (vert_only && horiz)) ? NULL
4720 : STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) 4688 : STRINGP (PROP (TOOL_BAR_ITEM_LABEL))
@@ -4895,7 +4863,7 @@ update_frame_tool_bar (FRAME_PTR f)
4895 xg_height_or_width_changed (f); 4863 xg_height_or_width_changed (f);
4896 } 4864 }
4897 4865
4898 UNBLOCK_INPUT; 4866 unblock_input ();
4899} 4867}
4900 4868
4901/* Deallocate all resources for the tool bar on frame F. 4869/* Deallocate all resources for the tool bar on frame F.
@@ -4909,8 +4877,8 @@ free_frame_tool_bar (FRAME_PTR f)
4909 if (x->toolbar_widget) 4877 if (x->toolbar_widget)
4910 { 4878 {
4911 struct xg_frame_tb_info *tbinfo; 4879 struct xg_frame_tb_info *tbinfo;
4912 int is_packed = x->handlebox_widget != 0; 4880 bool is_packed = x->handlebox_widget != 0;
4913 BLOCK_INPUT; 4881 block_input ();
4914 /* We may have created the toolbar_widget in xg_create_tool_bar, but 4882 /* We may have created the toolbar_widget in xg_create_tool_bar, but
4915 not the x->handlebox_widget which is created in xg_pack_tool_bar. */ 4883 not the x->handlebox_widget which is created in xg_pack_tool_bar. */
4916 if (is_packed) 4884 if (is_packed)
@@ -4942,19 +4910,19 @@ free_frame_tool_bar (FRAME_PTR f)
4942 4910
4943 xg_height_or_width_changed (f); 4911 xg_height_or_width_changed (f);
4944 4912
4945 UNBLOCK_INPUT; 4913 unblock_input ();
4946 } 4914 }
4947} 4915}
4948 4916
4949int 4917void
4950xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos) 4918xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos)
4951{ 4919{
4952 struct x_output *x = f->output_data.x; 4920 struct x_output *x = f->output_data.x;
4953 4921
4954 if (! x->toolbar_widget || ! x->handlebox_widget) 4922 if (! x->toolbar_widget || ! x->handlebox_widget)
4955 return 1; 4923 return;
4956 4924
4957 BLOCK_INPUT; 4925 block_input ();
4958 g_object_ref (x->handlebox_widget); 4926 g_object_ref (x->handlebox_widget);
4959 if (x->toolbar_in_hbox) 4927 if (x->toolbar_in_hbox)
4960 gtk_container_remove (GTK_CONTAINER (x->hbox_widget), 4928 gtk_container_remove (GTK_CONTAINER (x->hbox_widget),
@@ -4967,8 +4935,7 @@ xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos)
4967 if (xg_update_tool_bar_sizes (f)) 4935 if (xg_update_tool_bar_sizes (f))
4968 xg_height_or_width_changed (f); 4936 xg_height_or_width_changed (f);
4969 4937
4970 UNBLOCK_INPUT; 4938 unblock_input ();
4971 return 1;
4972} 4939}
4973 4940
4974 4941
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 926478dd728..43f2b237a68 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -79,13 +79,13 @@ struct _widget_value;
79extern struct _widget_value *malloc_widget_value (void); 79extern struct _widget_value *malloc_widget_value (void);
80extern void free_widget_value (struct _widget_value *); 80extern void free_widget_value (struct _widget_value *);
81 81
82extern int xg_uses_old_file_dialog (void) ATTRIBUTE_CONST; 82extern bool xg_uses_old_file_dialog (void) ATTRIBUTE_CONST;
83 83
84extern char *xg_get_file_name (FRAME_PTR f, 84extern char *xg_get_file_name (FRAME_PTR f,
85 char *prompt, 85 char *prompt,
86 char *default_filename, 86 char *default_filename,
87 int mustmatch_p, 87 bool mustmatch_p,
88 int only_dir_p); 88 bool only_dir_p);
89 89
90extern Lisp_Object xg_get_font (FRAME_PTR f, const char *); 90extern Lisp_Object xg_get_font (FRAME_PTR f, const char *);
91 91
@@ -100,16 +100,16 @@ extern GtkWidget *xg_create_widget (const char *type,
100extern void xg_modify_menubar_widgets (GtkWidget *menubar, 100extern void xg_modify_menubar_widgets (GtkWidget *menubar,
101 FRAME_PTR f, 101 FRAME_PTR f,
102 struct _widget_value *val, 102 struct _widget_value *val,
103 int deep_p, 103 bool deep_p,
104 GCallback select_cb, 104 GCallback select_cb,
105 GCallback deactivate_cb, 105 GCallback deactivate_cb,
106 GCallback highlight_cb); 106 GCallback highlight_cb);
107 107
108extern int xg_update_frame_menubar (FRAME_PTR f); 108extern void xg_update_frame_menubar (FRAME_PTR f);
109 109
110extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event); 110extern bool xg_event_is_for_menubar (FRAME_PTR f, XEvent *event);
111 111
112extern int xg_have_tear_offs (void); 112extern bool xg_have_tear_offs (void);
113 113
114extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid); 114extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid);
115 115
@@ -131,12 +131,12 @@ extern void xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
131 int portion, 131 int portion,
132 int position, 132 int position,
133 int whole); 133 int whole);
134extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event); 134extern bool xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event);
135extern int xg_get_default_scrollbar_width (void); 135extern int xg_get_default_scrollbar_width (void);
136 136
137extern void update_frame_tool_bar (FRAME_PTR f); 137extern void update_frame_tool_bar (FRAME_PTR f);
138extern void free_frame_tool_bar (FRAME_PTR f); 138extern void free_frame_tool_bar (FRAME_PTR f);
139extern int xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos); 139extern void xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos);
140 140
141extern void xg_frame_resized (FRAME_PTR f, 141extern void xg_frame_resized (FRAME_PTR f,
142 int pixelwidth, 142 int pixelwidth,
@@ -148,23 +148,23 @@ extern void xg_display_open (char *display_name, Display **dpy);
148extern void xg_display_close (Display *dpy); 148extern void xg_display_close (Display *dpy);
149extern GdkCursor * xg_create_default_cursor (Display *dpy); 149extern GdkCursor * xg_create_default_cursor (Display *dpy);
150 150
151extern int xg_create_frame_widgets (FRAME_PTR f); 151extern bool xg_create_frame_widgets (FRAME_PTR f);
152extern void xg_free_frame_widgets (FRAME_PTR f); 152extern void xg_free_frame_widgets (FRAME_PTR f);
153extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); 153extern void xg_set_background_color (FRAME_PTR f, unsigned long bg);
154extern int xg_check_special_colors (struct frame *f, 154extern bool xg_check_special_colors (struct frame *f,
155 const char *color_name, 155 const char *color_name,
156 XColor *color); 156 XColor *color);
157 157
158extern void xg_set_frame_icon (FRAME_PTR f, 158extern void xg_set_frame_icon (FRAME_PTR f,
159 Pixmap icon_pixmap, 159 Pixmap icon_pixmap,
160 Pixmap icon_mask); 160 Pixmap icon_mask);
161 161
162extern int xg_prepare_tooltip (FRAME_PTR f, 162extern bool xg_prepare_tooltip (FRAME_PTR f,
163 Lisp_Object string, 163 Lisp_Object string,
164 int *width, 164 int *width,
165 int *height); 165 int *height);
166extern void xg_show_tooltip (FRAME_PTR f, int root_x, int root_y); 166extern void xg_show_tooltip (FRAME_PTR f, int root_x, int root_y);
167extern int xg_hide_tooltip (FRAME_PTR f); 167extern bool xg_hide_tooltip (FRAME_PTR f);
168 168
169 169
170/* Mark all callback data that are Lisp_object:s during GC. */ 170/* Mark all callback data that are Lisp_object:s during GC. */
@@ -175,7 +175,7 @@ extern void xg_initialize (void);
175 175
176/* Setting scrollbar values invokes the callback. Use this variable 176/* Setting scrollbar values invokes the callback. Use this variable
177 to indicate that the callback should do nothing. */ 177 to indicate that the callback should do nothing. */
178extern int xg_ignore_gtk_scrollbar; 178extern bool xg_ignore_gtk_scrollbar;
179 179
180#endif /* USE_GTK */ 180#endif /* USE_GTK */
181#endif /* GTKUTIL_H */ 181#endif /* GTKUTIL_H */
diff --git a/src/image.c b/src/image.c
index 0060d0d4148..7901b95f236 100644
--- a/src/image.c
+++ b/src/image.c
@@ -407,9 +407,9 @@ x_destroy_bitmap (FRAME_PTR f, ptrdiff_t id)
407 407
408 if (--bm->refcount == 0) 408 if (--bm->refcount == 0)
409 { 409 {
410 BLOCK_INPUT; 410 block_input ();
411 free_bitmap_record (dpyinfo, bm); 411 free_bitmap_record (dpyinfo, bm);
412 UNBLOCK_INPUT; 412 unblock_input ();
413 } 413 }
414 } 414 }
415} 415}
@@ -429,6 +429,9 @@ x_destroy_all_bitmaps (Display_Info *dpyinfo)
429 dpyinfo->bitmaps_last = 0; 429 dpyinfo->bitmaps_last = 0;
430} 430}
431 431
432static bool x_create_x_image_and_pixmap (struct frame *, int, int, int,
433 XImagePtr *, Pixmap *);
434static void x_destroy_x_image (XImagePtr ximg);
432 435
433#ifdef HAVE_X_WINDOWS 436#ifdef HAVE_X_WINDOWS
434 437
@@ -440,23 +443,17 @@ static unsigned long four_corners_best (XImagePtr ximg,
440 unsigned long width, 443 unsigned long width,
441 unsigned long height); 444 unsigned long height);
442 445
443static int x_create_x_image_and_pixmap (struct frame *f, int width, int height,
444 int depth, XImagePtr *ximg,
445 Pixmap *pixmap);
446
447static void x_destroy_x_image (XImagePtr ximg);
448
449 446
450/* Create a mask of a bitmap. Note is this not a perfect mask. 447/* Create a mask of a bitmap. Note is this not a perfect mask.
451 It's nicer with some borders in this context */ 448 It's nicer with some borders in this context */
452 449
453int 450void
454x_create_bitmap_mask (struct frame *f, ptrdiff_t id) 451x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
455{ 452{
456 Pixmap pixmap, mask; 453 Pixmap pixmap, mask;
457 XImagePtr ximg, mask_img; 454 XImagePtr ximg, mask_img;
458 unsigned long width, height; 455 unsigned long width, height;
459 int result; 456 bool result;
460 unsigned long bg; 457 unsigned long bg;
461 unsigned long x, y, xp, xm, yp, ym; 458 unsigned long x, y, xp, xm, yp, ym;
462 GC gc; 459 GC gc;
@@ -464,29 +461,29 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
464 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 461 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
465 462
466 if (!(id > 0)) 463 if (!(id > 0))
467 return -1; 464 return;
468 465
469 pixmap = x_bitmap_pixmap (f, id); 466 pixmap = x_bitmap_pixmap (f, id);
470 width = x_bitmap_width (f, id); 467 width = x_bitmap_width (f, id);
471 height = x_bitmap_height (f, id); 468 height = x_bitmap_height (f, id);
472 469
473 BLOCK_INPUT; 470 block_input ();
474 ximg = XGetImage (FRAME_X_DISPLAY (f), pixmap, 0, 0, width, height, 471 ximg = XGetImage (FRAME_X_DISPLAY (f), pixmap, 0, 0, width, height,
475 ~0, ZPixmap); 472 ~0, ZPixmap);
476 473
477 if (!ximg) 474 if (!ximg)
478 { 475 {
479 UNBLOCK_INPUT; 476 unblock_input ();
480 return -1; 477 return;
481 } 478 }
482 479
483 result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask); 480 result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask);
484 481
485 UNBLOCK_INPUT; 482 unblock_input ();
486 if (!result) 483 if (!result)
487 { 484 {
488 XDestroyImage (ximg); 485 XDestroyImage (ximg);
489 return -1; 486 return;
490 } 487 }
491 488
492 bg = four_corners_best (ximg, NULL, width, height); 489 bg = four_corners_best (ximg, NULL, width, height);
@@ -514,7 +511,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
514 } 511 }
515 } 512 }
516 513
517 eassert (interrupt_input_blocked); 514 eassert (input_blocked_p ());
518 gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL); 515 gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL);
519 XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0, 516 XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0,
520 width, height); 517 width, height);
@@ -525,8 +522,6 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
525 522
526 XDestroyImage (ximg); 523 XDestroyImage (ximg);
527 x_destroy_x_image (mask_img); 524 x_destroy_x_image (mask_img);
528
529 return 0;
530} 525}
531 526
532#endif /* HAVE_X_WINDOWS */ 527#endif /* HAVE_X_WINDOWS */
@@ -559,15 +554,13 @@ static Lisp_Object QCcrop, QCrotation;
559static Lisp_Object Qcount, Qextension_data, Qdelay; 554static Lisp_Object Qcount, Qextension_data, Qdelay;
560static Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic; 555static Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic;
561 556
562/* Function prototypes. */ 557/* Forward function prototypes. */
563 558
564static struct image_type *define_image_type (struct image_type *, Lisp_Object); 559static struct image_type *lookup_image_type (Lisp_Object);
565static struct image_type *lookup_image_type (Lisp_Object, Lisp_Object);
566static void image_error (const char *format, Lisp_Object, Lisp_Object);
567static void x_laplace (struct frame *, struct image *); 560static void x_laplace (struct frame *, struct image *);
568static void x_emboss (struct frame *, struct image *); 561static void x_emboss (struct frame *, struct image *);
569static int x_build_heuristic_mask (struct frame *, struct image *, 562static void x_build_heuristic_mask (struct frame *, struct image *,
570 Lisp_Object); 563 Lisp_Object);
571#ifdef HAVE_NTGUI 564#ifdef HAVE_NTGUI
572#define CACHE_IMAGE_TYPE(type, status) \ 565#define CACHE_IMAGE_TYPE(type, status) \
573 do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) 566 do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0)
@@ -579,21 +572,16 @@ static int x_build_heuristic_mask (struct frame *, struct image *,
579 do { Vimage_types = Fcons (type, Vimage_types); } while (0) 572 do { Vimage_types = Fcons (type, Vimage_types); } while (0)
580 573
581/* Define a new image type from TYPE. This adds a copy of TYPE to 574/* Define a new image type from TYPE. This adds a copy of TYPE to
582 image_types and caches the loading status of TYPE. 575 image_types and caches the loading status of TYPE. */
583
584 LIBRARIES is an alist associating dynamic libraries to external
585 files implementing them, which is passed to the image library
586 initialization function if necessary. A nil value defaults to
587 Vdynamic_library_alist. */
588 576
589static struct image_type * 577static struct image_type *
590define_image_type (struct image_type *type, Lisp_Object libraries) 578define_image_type (struct image_type *type)
591{ 579{
592 struct image_type *p = NULL; 580 struct image_type *p = NULL;
593 Lisp_Object target_type = *type->type; 581 Lisp_Object target_type = *type->type;
594 int type_valid = 1; 582 bool type_valid = 1;
595 583
596 BLOCK_INPUT; 584 block_input ();
597 585
598 for (p = image_types; p; p = p->next) 586 for (p = image_types; p; p = p->next)
599 if (EQ (*p->type, target_type)) 587 if (EQ (*p->type, target_type))
@@ -609,7 +597,7 @@ define_image_type (struct image_type *type, Lisp_Object libraries)
609 else 597 else
610#endif 598#endif
611 { 599 {
612 type_valid = type->init (libraries); 600 type_valid = type->init ();
613 CACHE_IMAGE_TYPE (target_type, type_valid ? Qt : Qnil); 601 CACHE_IMAGE_TYPE (target_type, type_valid ? Qt : Qnil);
614 } 602 }
615 } 603 }
@@ -625,22 +613,22 @@ define_image_type (struct image_type *type, Lisp_Object libraries)
625 } 613 }
626 614
627 done: 615 done:
628 UNBLOCK_INPUT; 616 unblock_input ();
629 return p; 617 return p;
630} 618}
631 619
632 620
633/* Value is non-zero if OBJECT is a valid Lisp image specification. A 621/* Value is true if OBJECT is a valid Lisp image specification. A
634 valid image specification is a list whose car is the symbol 622 valid image specification is a list whose car is the symbol
635 `image', and whose rest is a property list. The property list must 623 `image', and whose rest is a property list. The property list must
636 contain a value for key `:type'. That value must be the name of a 624 contain a value for key `:type'. That value must be the name of a
637 supported image type. The rest of the property list depends on the 625 supported image type. The rest of the property list depends on the
638 image type. */ 626 image type. */
639 627
640int 628bool
641valid_image_p (Lisp_Object object) 629valid_image_p (Lisp_Object object)
642{ 630{
643 int valid_p = 0; 631 bool valid_p = 0;
644 632
645 if (IMAGEP (object)) 633 if (IMAGEP (object))
646 { 634 {
@@ -653,7 +641,7 @@ valid_image_p (Lisp_Object object)
653 if (CONSP (tem) && SYMBOLP (XCAR (tem))) 641 if (CONSP (tem) && SYMBOLP (XCAR (tem)))
654 { 642 {
655 struct image_type *type; 643 struct image_type *type;
656 type = lookup_image_type (XCAR (tem), Qnil); 644 type = lookup_image_type (XCAR (tem));
657 if (type) 645 if (type)
658 valid_p = type->valid_p (object); 646 valid_p = type->valid_p (object);
659 } 647 }
@@ -710,8 +698,8 @@ struct image_keyword
710 /* The type of value allowed. */ 698 /* The type of value allowed. */
711 enum image_value_type type; 699 enum image_value_type type;
712 700
713 /* Non-zero means key must be present. */ 701 /* True means key must be present. */
714 int mandatory_p; 702 bool mandatory_p;
715 703
716 /* Used to recognize duplicate keywords in a property list. */ 704 /* Used to recognize duplicate keywords in a property list. */
717 int count; 705 int count;
@@ -721,18 +709,13 @@ struct image_keyword
721}; 709};
722 710
723 711
724static int parse_image_spec (Lisp_Object, struct image_keyword *,
725 int, Lisp_Object);
726static Lisp_Object image_spec_value (Lisp_Object, Lisp_Object, int *);
727
728
729/* Parse image spec SPEC according to KEYWORDS. A valid image spec 712/* Parse image spec SPEC according to KEYWORDS. A valid image spec
730 has the format (image KEYWORD VALUE ...). One of the keyword/ 713 has the format (image KEYWORD VALUE ...). One of the keyword/
731 value pairs must be `:type TYPE'. KEYWORDS is a vector of 714 value pairs must be `:type TYPE'. KEYWORDS is a vector of
732 image_keywords structures of size NKEYWORDS describing other 715 image_keywords structures of size NKEYWORDS describing other
733 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */ 716 allowed keyword/value pairs. Value is true if SPEC is valid. */
734 717
735static int 718static bool
736parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, 719parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
737 int nkeywords, Lisp_Object type) 720 int nkeywords, Lisp_Object type)
738{ 721{
@@ -864,11 +847,11 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
864 847
865 848
866/* Return the value of KEY in image specification SPEC. Value is nil 849/* Return the value of KEY in image specification SPEC. Value is nil
867 if KEY is not present in SPEC. if FOUND is not null, set *FOUND 850 if KEY is not present in SPEC. Set *FOUND depending on whether KEY
868 to 1 if KEY was found in SPEC, set it to 0 otherwise. */ 851 was found in SPEC. */
869 852
870static Lisp_Object 853static Lisp_Object
871image_spec_value (Lisp_Object spec, Lisp_Object key, int *found) 854image_spec_value (Lisp_Object spec, Lisp_Object key, bool *found)
872{ 855{
873 Lisp_Object tail; 856 Lisp_Object tail;
874 857
@@ -972,8 +955,6 @@ or omitted means use the selected frame. */)
972 Image type independent image structures 955 Image type independent image structures
973 ***********************************************************************/ 956 ***********************************************************************/
974 957
975static void free_image (struct frame *f, struct image *img);
976
977#define MAX_IMAGE_SIZE 10.0 958#define MAX_IMAGE_SIZE 10.0
978/* Allocate and return a new image structure for image specification 959/* Allocate and return a new image structure for image specification
979 SPEC. SPEC has a hash value of HASH. */ 960 SPEC. SPEC has a hash value of HASH. */
@@ -986,7 +967,7 @@ make_image (Lisp_Object spec, EMACS_UINT hash)
986 967
987 eassert (valid_image_p (spec)); 968 eassert (valid_image_p (spec));
988 img->dependencies = NILP (file) ? Qnil : list1 (file); 969 img->dependencies = NILP (file) ? Qnil : list1 (file);
989 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL), Qnil); 970 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
990 eassert (img->type != NULL); 971 eassert (img->type != NULL);
991 img->spec = spec; 972 img->spec = spec;
992 img->lisp_data = Qnil; 973 img->lisp_data = Qnil;
@@ -1023,10 +1004,9 @@ free_image (struct frame *f, struct image *img)
1023 } 1004 }
1024} 1005}
1025 1006
1026/* Return 1 if the given widths and heights are valid for display; 1007/* Return true if the given widths and heights are valid for display. */
1027 otherwise, return 0. */
1028 1008
1029static int 1009static bool
1030check_image_size (struct frame *f, int width, int height) 1010check_image_size (struct frame *f, int width, int height)
1031{ 1011{
1032 int w, h; 1012 int w, h;
@@ -1065,7 +1045,7 @@ prepare_image_for_display (struct frame *f, struct image *img)
1065 /* If IMG doesn't have a pixmap yet, load it now, using the image 1045 /* If IMG doesn't have a pixmap yet, load it now, using the image
1066 type dependent loader function. */ 1046 type dependent loader function. */
1067 if (img->pixmap == NO_PIXMAP && !img->load_failed_p) 1047 if (img->pixmap == NO_PIXMAP && !img->load_failed_p)
1068 img->load_failed_p = img->type->load (f, img) == 0; 1048 img->load_failed_p = ! img->type->load (f, img);
1069 1049
1070} 1050}
1071 1051
@@ -1198,7 +1178,7 @@ image_background (struct image *img, struct frame *f, XImagePtr_or_DC ximg)
1198 if (! img->background_valid) 1178 if (! img->background_valid)
1199 /* IMG doesn't have a background yet, try to guess a reasonable value. */ 1179 /* IMG doesn't have a background yet, try to guess a reasonable value. */
1200 { 1180 {
1201 int free_ximg = !ximg; 1181 bool free_ximg = !ximg;
1202#ifdef HAVE_NTGUI 1182#ifdef HAVE_NTGUI
1203 HGDIOBJ prev; 1183 HGDIOBJ prev;
1204#endif /* HAVE_NTGUI */ 1184#endif /* HAVE_NTGUI */
@@ -1239,7 +1219,7 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D
1239 { 1219 {
1240 if (img->mask) 1220 if (img->mask)
1241 { 1221 {
1242 int free_mask = !mask; 1222 bool free_mask = !mask;
1243#ifdef HAVE_NTGUI 1223#ifdef HAVE_NTGUI
1244 HGDIOBJ prev; 1224 HGDIOBJ prev;
1245#endif /* HAVE_NTGUI */ 1225#endif /* HAVE_NTGUI */
@@ -1277,23 +1257,13 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D
1277 Helper functions for X image types 1257 Helper functions for X image types
1278 ***********************************************************************/ 1258 ***********************************************************************/
1279 1259
1280static void x_clear_image_1 (struct frame *, struct image *, int, 1260/* Clear X resources of image IMG on frame F. PIXMAP_P means free the
1281 int, int); 1261 pixmap if any. MASK_P means clear the mask pixmap if any.
1282static void x_clear_image (struct frame *f, struct image *img); 1262 COLORS_P means free colors allocated for the image, if any. */
1283static unsigned long x_alloc_image_color (struct frame *f,
1284 struct image *img,
1285 Lisp_Object color_name,
1286 unsigned long dflt);
1287
1288
1289/* Clear X resources of image IMG on frame F. PIXMAP_P non-zero means
1290 free the pixmap if any. MASK_P non-zero means clear the mask
1291 pixmap if any. COLORS_P non-zero means free colors allocated for
1292 the image, if any. */
1293 1263
1294static void 1264static void
1295x_clear_image_1 (struct frame *f, struct image *img, int pixmap_p, int mask_p, 1265x_clear_image_1 (struct frame *f, struct image *img, bool pixmap_p,
1296 int colors_p) 1266 bool mask_p, bool colors_p)
1297{ 1267{
1298 if (pixmap_p && img->pixmap) 1268 if (pixmap_p && img->pixmap)
1299 { 1269 {
@@ -1328,9 +1298,9 @@ x_clear_image_1 (struct frame *f, struct image *img, int pixmap_p, int mask_p,
1328static void 1298static void
1329x_clear_image (struct frame *f, struct image *img) 1299x_clear_image (struct frame *f, struct image *img)
1330{ 1300{
1331 BLOCK_INPUT; 1301 block_input ();
1332 x_clear_image_1 (f, img, 1, 1, 1); 1302 x_clear_image_1 (f, img, 1, 1, 1);
1333 UNBLOCK_INPUT; 1303 unblock_input ();
1334} 1304}
1335 1305
1336 1306
@@ -1373,7 +1343,6 @@ x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name,
1373 ***********************************************************************/ 1343 ***********************************************************************/
1374 1344
1375static void cache_image (struct frame *f, struct image *img); 1345static void cache_image (struct frame *f, struct image *img);
1376static void postprocess_image (struct frame *, struct image *);
1377 1346
1378/* Return a new, initialized image cache that is allocated from the 1347/* Return a new, initialized image cache that is allocated from the
1379 heap. Call free_image_cache to free an image cache. */ 1348 heap. Call free_image_cache to free an image cache. */
@@ -1485,7 +1454,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
1485 1454
1486 /* Block input so that we won't be interrupted by a SIGIO 1455 /* Block input so that we won't be interrupted by a SIGIO
1487 while being in an inconsistent state. */ 1456 while being in an inconsistent state. */
1488 BLOCK_INPUT; 1457 block_input ();
1489 1458
1490 if (!NILP (filter)) 1459 if (!NILP (filter))
1491 { 1460 {
@@ -1551,7 +1520,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
1551 ++windows_or_buffers_changed; 1520 ++windows_or_buffers_changed;
1552 } 1521 }
1553 1522
1554 UNBLOCK_INPUT; 1523 unblock_input ();
1555 } 1524 }
1556} 1525}
1557 1526
@@ -1646,7 +1615,7 @@ postprocess_image (struct frame *f, struct image *img)
1646 x_build_heuristic_mask (f, img, mask); 1615 x_build_heuristic_mask (f, img, mask);
1647 else 1616 else
1648 { 1617 {
1649 int found_p; 1618 bool found_p;
1650 1619
1651 mask = image_spec_value (spec, QCmask, &found_p); 1620 mask = image_spec_value (spec, QCmask, &found_p);
1652 1621
@@ -1716,10 +1685,10 @@ lookup_image (struct frame *f, Lisp_Object spec)
1716 /* If not found, create a new image and cache it. */ 1685 /* If not found, create a new image and cache it. */
1717 if (img == NULL) 1686 if (img == NULL)
1718 { 1687 {
1719 BLOCK_INPUT; 1688 block_input ();
1720 img = make_image (spec, hash); 1689 img = make_image (spec, hash);
1721 cache_image (f, img); 1690 cache_image (f, img);
1722 img->load_failed_p = img->type->load (f, img) == 0; 1691 img->load_failed_p = ! img->type->load (f, img);
1723 img->frame_foreground = FRAME_FOREGROUND_PIXEL (f); 1692 img->frame_foreground = FRAME_FOREGROUND_PIXEL (f);
1724 img->frame_background = FRAME_BACKGROUND_PIXEL (f); 1693 img->frame_background = FRAME_BACKGROUND_PIXEL (f);
1725 1694
@@ -1787,7 +1756,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
1787 postprocess_image (f, img); 1756 postprocess_image (f, img);
1788 } 1757 }
1789 1758
1790 UNBLOCK_INPUT; 1759 unblock_input ();
1791 } 1760 }
1792 1761
1793 /* We're using IMG, so set its timestamp to `now'. */ 1762 /* We're using IMG, so set its timestamp to `now'. */
@@ -1878,16 +1847,11 @@ mark_image_cache (struct image_cache *c)
1878 1847
1879#endif /* HAVE_NTGUI */ 1848#endif /* HAVE_NTGUI */
1880 1849
1881static int x_create_x_image_and_pixmap (struct frame *, int, int, int, 1850/* Return true if XIMG's size WIDTH x HEIGHT doesn't break the
1882 XImagePtr *, Pixmap *);
1883static void x_destroy_x_image (XImagePtr);
1884static void x_put_x_image (struct frame *, XImagePtr, Pixmap, int, int);
1885
1886/* Return nonzero if XIMG's size WIDTH x HEIGHT doesn't break the
1887 windowing system. 1851 windowing system.
1888 WIDTH and HEIGHT must both be positive. 1852 WIDTH and HEIGHT must both be positive.
1889 If XIMG is null, assume it is a bitmap. */ 1853 If XIMG is null, assume it is a bitmap. */
1890static int 1854static bool
1891x_check_image_size (XImagePtr ximg, int width, int height) 1855x_check_image_size (XImagePtr ximg, int width, int height)
1892{ 1856{
1893#ifdef HAVE_X_WINDOWS 1857#ifdef HAVE_X_WINDOWS
@@ -1926,12 +1890,12 @@ x_check_image_size (XImagePtr ximg, int width, int height)
1926 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created. 1890 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created.
1927 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated 1891 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated
1928 via xmalloc. Print error messages via image_error if an error 1892 via xmalloc. Print error messages via image_error if an error
1929 occurs. Value is non-zero if successful. 1893 occurs. Value is true if successful.
1930 1894
1931 On W32, a DEPTH of zero signifies a 24 bit image, otherwise DEPTH 1895 On W32, a DEPTH of zero signifies a 24 bit image, otherwise DEPTH
1932 should indicate the bit depth of the image. */ 1896 should indicate the bit depth of the image. */
1933 1897
1934static int 1898static bool
1935x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth, 1899x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
1936 XImagePtr *ximg, Pixmap *pixmap) 1900 XImagePtr *ximg, Pixmap *pixmap)
1937{ 1901{
@@ -1940,7 +1904,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
1940 Window window = FRAME_X_WINDOW (f); 1904 Window window = FRAME_X_WINDOW (f);
1941 Screen *screen = FRAME_X_SCREEN (f); 1905 Screen *screen = FRAME_X_SCREEN (f);
1942 1906
1943 eassert (interrupt_input_blocked); 1907 eassert (input_blocked_p ());
1944 1908
1945 if (depth <= 0) 1909 if (depth <= 0)
1946 depth = DefaultDepthOfScreen (screen); 1910 depth = DefaultDepthOfScreen (screen);
@@ -2078,7 +2042,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
2078static void 2042static void
2079x_destroy_x_image (XImagePtr ximg) 2043x_destroy_x_image (XImagePtr ximg)
2080{ 2044{
2081 eassert (interrupt_input_blocked); 2045 eassert (input_blocked_p ());
2082 if (ximg) 2046 if (ximg)
2083 { 2047 {
2084#ifdef HAVE_X_WINDOWS 2048#ifdef HAVE_X_WINDOWS
@@ -2107,7 +2071,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he
2107#ifdef HAVE_X_WINDOWS 2071#ifdef HAVE_X_WINDOWS
2108 GC gc; 2072 GC gc;
2109 2073
2110 eassert (interrupt_input_blocked); 2074 eassert (input_blocked_p ());
2111 gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL); 2075 gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL);
2112 XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height); 2076 XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height);
2113 XFreeGC (FRAME_X_DISPLAY (f), gc); 2077 XFreeGC (FRAME_X_DISPLAY (f), gc);
@@ -2203,15 +2167,9 @@ slurp_file (char *file, ptrdiff_t *size)
2203 XBM images 2167 XBM images
2204 ***********************************************************************/ 2168 ***********************************************************************/
2205 2169
2206static int xbm_scan (unsigned char **, unsigned char *, char *, int *); 2170static bool xbm_load (struct frame *f, struct image *img);
2207static int xbm_load (struct frame *f, struct image *img); 2171static bool xbm_image_p (Lisp_Object object);
2208static int xbm_load_image (struct frame *f, struct image *img, 2172static bool xbm_file_p (Lisp_Object);
2209 unsigned char *, unsigned char *);
2210static int xbm_image_p (Lisp_Object object);
2211static int xbm_read_bitmap_data (struct frame *f,
2212 unsigned char *, unsigned char *,
2213 int *, int *, char **, int);
2214static int xbm_file_p (Lisp_Object);
2215 2173
2216 2174
2217/* Indices of image specification fields in xbm_format, below. */ 2175/* Indices of image specification fields in xbm_format, below. */
@@ -2275,10 +2233,10 @@ enum xbm_token
2275}; 2233};
2276 2234
2277 2235
2278/* Return non-zero if OBJECT is a valid XBM-type image specification. 2236/* Return true if OBJECT is a valid XBM-type image specification.
2279 A valid specification is a list starting with the symbol `image' 2237 A valid specification is a list starting with the symbol `image'
2280 The rest of the list is a property list which must contain an 2238 The rest of the list is a property list which must contain an
2281 entry `:type xbm.. 2239 entry `:type xbm'.
2282 2240
2283 If the specification specifies a file to load, it must contain 2241 If the specification specifies a file to load, it must contain
2284 an entry `:file FILENAME' where FILENAME is a string. 2242 an entry `:file FILENAME' where FILENAME is a string.
@@ -2304,7 +2262,7 @@ enum xbm_token
2304 foreground and background of the frame on which the image is 2262 foreground and background of the frame on which the image is
2305 displayed is used. */ 2263 displayed is used. */
2306 2264
2307static int 2265static bool
2308xbm_image_p (Lisp_Object object) 2266xbm_image_p (Lisp_Object object)
2309{ 2267{
2310 struct image_keyword kw[XBM_LAST]; 2268 struct image_keyword kw[XBM_LAST];
@@ -2562,7 +2520,7 @@ convert_mono_to_color_image (struct frame *f, struct image *img,
2562static void 2520static void
2563Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data, 2521Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
2564 RGB_PIXEL_COLOR fg, RGB_PIXEL_COLOR bg, 2522 RGB_PIXEL_COLOR fg, RGB_PIXEL_COLOR bg,
2565 int non_default_colors) 2523 bool non_default_colors)
2566{ 2524{
2567#ifdef HAVE_NTGUI 2525#ifdef HAVE_NTGUI
2568 img->pixmap 2526 img->pixmap
@@ -2594,20 +2552,20 @@ Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
2594 X versions. CONTENTS is a pointer to a buffer to parse; END is the 2552 X versions. CONTENTS is a pointer to a buffer to parse; END is the
2595 buffer's end. Set *WIDTH and *HEIGHT to the width and height of 2553 buffer's end. Set *WIDTH and *HEIGHT to the width and height of
2596 the image. Return in *DATA the bitmap data allocated with xmalloc. 2554 the image. Return in *DATA the bitmap data allocated with xmalloc.
2597 Value is non-zero if successful. DATA null means just test if 2555 Value is true if successful. DATA null means just test if
2598 CONTENTS looks like an in-memory XBM file. If INHIBIT_IMAGE_ERROR 2556 CONTENTS looks like an in-memory XBM file. If INHIBIT_IMAGE_ERROR,
2599 is non-zero, inhibit the call to image_error when the image size is 2557 inhibit the call to image_error when the image size is invalid (the
2600 invalid (the bitmap remains unread). */ 2558 bitmap remains unread). */
2601 2559
2602static int 2560static bool
2603xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *end, 2561xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *end,
2604 int *width, int *height, char **data, 2562 int *width, int *height, char **data,
2605 int inhibit_image_error) 2563 bool inhibit_image_error)
2606{ 2564{
2607 unsigned char *s = contents; 2565 unsigned char *s = contents;
2608 char buffer[BUFSIZ]; 2566 char buffer[BUFSIZ];
2609 int padding_p = 0; 2567 bool padding_p = 0;
2610 int v10 = 0; 2568 bool v10 = 0;
2611 int bytes_per_line, i, nbytes; 2569 int bytes_per_line, i, nbytes;
2612 char *p; 2570 char *p;
2613 int value; 2571 int value;
@@ -2754,16 +2712,16 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
2754 2712
2755 2713
2756/* Load XBM image IMG which will be displayed on frame F from buffer 2714/* Load XBM image IMG which will be displayed on frame F from buffer
2757 CONTENTS. END is the end of the buffer. Value is non-zero if 2715 CONTENTS. END is the end of the buffer. Value is true if
2758 successful. */ 2716 successful. */
2759 2717
2760static int 2718static bool
2761xbm_load_image (struct frame *f, struct image *img, unsigned char *contents, 2719xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2762 unsigned char *end) 2720 unsigned char *end)
2763{ 2721{
2764 int rc; 2722 bool rc;
2765 char *data; 2723 char *data;
2766 int success_p = 0; 2724 bool success_p = 0;
2767 2725
2768 rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height, 2726 rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height,
2769 &data, 0); 2727 &data, 0);
@@ -2771,7 +2729,7 @@ xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2771 { 2729 {
2772 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); 2730 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
2773 unsigned long background = FRAME_BACKGROUND_PIXEL (f); 2731 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
2774 int non_default_colors = 0; 2732 bool non_default_colors = 0;
2775 Lisp_Object value; 2733 Lisp_Object value;
2776 2734
2777 eassert (img->width > 0 && img->height > 0); 2735 eassert (img->width > 0 && img->height > 0);
@@ -2812,9 +2770,9 @@ xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2812} 2770}
2813 2771
2814 2772
2815/* Value is non-zero if DATA looks like an in-memory XBM file. */ 2773/* Value is true if DATA looks like an in-memory XBM file. */
2816 2774
2817static int 2775static bool
2818xbm_file_p (Lisp_Object data) 2776xbm_file_p (Lisp_Object data)
2819{ 2777{
2820 int w, h; 2778 int w, h;
@@ -2826,12 +2784,12 @@ xbm_file_p (Lisp_Object data)
2826 2784
2827 2785
2828/* Fill image IMG which is used on frame F with pixmap data. Value is 2786/* Fill image IMG which is used on frame F with pixmap data. Value is
2829 non-zero if successful. */ 2787 true if successful. */
2830 2788
2831static int 2789static bool
2832xbm_load (struct frame *f, struct image *img) 2790xbm_load (struct frame *f, struct image *img)
2833{ 2791{
2834 int success_p = 0; 2792 bool success_p = 0;
2835 Lisp_Object file_name; 2793 Lisp_Object file_name;
2836 2794
2837 eassert (xbm_image_p (img->spec)); 2795 eassert (xbm_image_p (img->spec));
@@ -2867,10 +2825,10 @@ xbm_load (struct frame *f, struct image *img)
2867 Lisp_Object data; 2825 Lisp_Object data;
2868 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f); 2826 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
2869 unsigned long background = FRAME_BACKGROUND_PIXEL (f); 2827 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
2870 int non_default_colors = 0; 2828 bool non_default_colors = 0;
2871 char *bits; 2829 char *bits;
2872 int parsed_p; 2830 bool parsed_p;
2873 int in_memory_file_p = 0; 2831 bool in_memory_file_p = 0;
2874 2832
2875 /* See if data looks like an in-memory XBM file. */ 2833 /* See if data looks like an in-memory XBM file. */
2876 data = image_spec_value (img->spec, QCdata, NULL); 2834 data = image_spec_value (img->spec, QCdata, NULL);
@@ -2879,7 +2837,6 @@ xbm_load (struct frame *f, struct image *img)
2879 /* Parse the image specification. */ 2837 /* Parse the image specification. */
2880 memcpy (fmt, xbm_format, sizeof fmt); 2838 memcpy (fmt, xbm_format, sizeof fmt);
2881 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); 2839 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
2882 (void) parsed_p;
2883 eassert (parsed_p); 2840 eassert (parsed_p);
2884 2841
2885 /* Get specified width, and height. */ 2842 /* Get specified width, and height. */
@@ -2984,9 +2941,8 @@ xbm_load (struct frame *f, struct image *img)
2984 2941
2985#if defined (HAVE_XPM) || defined (HAVE_NS) 2942#if defined (HAVE_XPM) || defined (HAVE_NS)
2986 2943
2987static int xpm_image_p (Lisp_Object object); 2944static bool xpm_image_p (Lisp_Object object);
2988static int xpm_load (struct frame *f, struct image *img); 2945static bool xpm_load (struct frame *f, struct image *img);
2989static int xpm_valid_color_symbols_p (Lisp_Object);
2990 2946
2991#endif /* HAVE_XPM || HAVE_NS */ 2947#endif /* HAVE_XPM || HAVE_NS */
2992 2948
@@ -3053,7 +3009,7 @@ static const struct image_keyword xpm_format[XPM_LAST] =
3053}; 3009};
3054 3010
3055#ifdef HAVE_NTGUI 3011#ifdef HAVE_NTGUI
3056static int init_xpm_functions (Lisp_Object); 3012static bool init_xpm_functions (void);
3057#else 3013#else
3058#define init_xpm_functions NULL 3014#define init_xpm_functions NULL
3059#endif 3015#endif
@@ -3084,10 +3040,6 @@ static struct image_type xpm_type =
3084 3040
3085#ifdef ALLOC_XPM_COLORS 3041#ifdef ALLOC_XPM_COLORS
3086 3042
3087static void xpm_init_color_cache (struct frame *, XpmAttributes *);
3088static void xpm_free_color_cache (void);
3089static int xpm_lookup_color (struct frame *, char *, XColor *);
3090static int xpm_color_bucket (char *);
3091static struct xpm_cached_color *xpm_cache_color (struct frame *, char *, 3043static struct xpm_cached_color *xpm_cache_color (struct frame *, char *,
3092 XColor *, int); 3044 XColor *, int);
3093 3045
@@ -3194,10 +3146,10 @@ xpm_cache_color (struct frame *f, char *color_name, XColor *color, int bucket)
3194 3146
3195/* Look up color COLOR_NAME for frame F in the color cache. If found, 3147/* Look up color COLOR_NAME for frame F in the color cache. If found,
3196 return the cached definition in *COLOR. Otherwise, make a new 3148 return the cached definition in *COLOR. Otherwise, make a new
3197 entry in the cache and allocate the color. Value is zero if color 3149 entry in the cache and allocate the color. Value is false if color
3198 allocation failed. */ 3150 allocation failed. */
3199 3151
3200static int 3152static bool
3201xpm_lookup_color (struct frame *f, char *color_name, XColor *color) 3153xpm_lookup_color (struct frame *f, char *color_name, XColor *color)
3202{ 3154{
3203 struct xpm_cached_color *p; 3155 struct xpm_cached_color *p;
@@ -3266,12 +3218,12 @@ DEF_IMGLIB_FN (int, XpmReadFileToImage, (Display *, char *, xpm_XImage **,
3266 xpm_XImage **, XpmAttributes *)); 3218 xpm_XImage **, XpmAttributes *));
3267DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *)); 3219DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *));
3268 3220
3269static int 3221static bool
3270init_xpm_functions (Lisp_Object libraries) 3222init_xpm_functions (void)
3271{ 3223{
3272 HMODULE library; 3224 HMODULE library;
3273 3225
3274 if (!(library = w32_delayed_load (libraries, Qxpm))) 3226 if (!(library = w32_delayed_load (Qxpm)))
3275 return 0; 3227 return 0;
3276 3228
3277 LOAD_IMGLIB_FN (library, XpmFreeAttributes); 3229 LOAD_IMGLIB_FN (library, XpmFreeAttributes);
@@ -3284,11 +3236,11 @@ init_xpm_functions (Lisp_Object libraries)
3284#endif /* HAVE_NTGUI */ 3236#endif /* HAVE_NTGUI */
3285 3237
3286 3238
3287/* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list 3239/* Value is true if COLOR_SYMBOLS is a valid color symbols list
3288 for XPM images. Such a list must consist of conses whose car and 3240 for XPM images. Such a list must consist of conses whose car and
3289 cdr are strings. */ 3241 cdr are strings. */
3290 3242
3291static int 3243static bool
3292xpm_valid_color_symbols_p (Lisp_Object color_symbols) 3244xpm_valid_color_symbols_p (Lisp_Object color_symbols)
3293{ 3245{
3294 while (CONSP (color_symbols)) 3246 while (CONSP (color_symbols))
@@ -3305,9 +3257,9 @@ xpm_valid_color_symbols_p (Lisp_Object color_symbols)
3305} 3257}
3306 3258
3307 3259
3308/* Value is non-zero if OBJECT is a valid XPM image specification. */ 3260/* Value is true if OBJECT is a valid XPM image specification. */
3309 3261
3310static int 3262static bool
3311xpm_image_p (Lisp_Object object) 3263xpm_image_p (Lisp_Object object)
3312{ 3264{
3313 struct image_keyword fmt[XPM_LAST]; 3265 struct image_keyword fmt[XPM_LAST];
@@ -3364,11 +3316,11 @@ x_create_bitmap_from_xpm_data (struct frame *f, const char **bits)
3364#endif /* defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) */ 3316#endif /* defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) */
3365 3317
3366/* Load image IMG which will be displayed on frame F. Value is 3318/* Load image IMG which will be displayed on frame F. Value is
3367 non-zero if successful. */ 3319 true if successful. */
3368 3320
3369#ifdef HAVE_XPM 3321#ifdef HAVE_XPM
3370 3322
3371static int 3323static bool
3372xpm_load (struct frame *f, struct image *img) 3324xpm_load (struct frame *f, struct image *img)
3373{ 3325{
3374 int rc; 3326 int rc;
@@ -3822,7 +3774,7 @@ xpm_str_to_color_key (const char *s)
3822 return -1; 3774 return -1;
3823} 3775}
3824 3776
3825static int 3777static bool
3826xpm_load_image (struct frame *f, 3778xpm_load_image (struct frame *f,
3827 struct image *img, 3779 struct image *img,
3828 const unsigned char *contents, 3780 const unsigned char *contents,
@@ -3837,7 +3789,8 @@ xpm_load_image (struct frame *f,
3837 void (*put_color_table) (Lisp_Object, const unsigned char *, int, Lisp_Object); 3789 void (*put_color_table) (Lisp_Object, const unsigned char *, int, Lisp_Object);
3838 Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int); 3790 Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int);
3839 Lisp_Object frame, color_symbols, color_table; 3791 Lisp_Object frame, color_symbols, color_table;
3840 int best_key, have_mask = 0; 3792 int best_key;
3793 bool have_mask = 0;
3841 XImagePtr ximg = NULL, mask_img = NULL; 3794 XImagePtr ximg = NULL, mask_img = NULL;
3842 3795
3843#define match() \ 3796#define match() \
@@ -4057,11 +4010,11 @@ xpm_load_image (struct frame *f,
4057#undef expect_ident 4010#undef expect_ident
4058} 4011}
4059 4012
4060static int 4013static bool
4061xpm_load (struct frame *f, 4014xpm_load (struct frame *f,
4062 struct image *img) 4015 struct image *img)
4063{ 4016{
4064 int success_p = 0; 4017 bool success_p = 0;
4065 Lisp_Object file_name; 4018 Lisp_Object file_name;
4066 4019
4067 /* If IMG->spec specifies a file name, create a non-file spec from it. */ 4020 /* If IMG->spec specifies a file name, create a non-file spec from it. */
@@ -4232,7 +4185,7 @@ lookup_rgb_color (struct frame *f, int r, int g, int b)
4232#ifdef HAVE_X_WINDOWS 4185#ifdef HAVE_X_WINDOWS
4233 XColor color; 4186 XColor color;
4234 Colormap cmap; 4187 Colormap cmap;
4235 int rc; 4188 bool rc;
4236#else 4189#else
4237 COLORREF color; 4190 COLORREF color;
4238#endif 4191#endif
@@ -4300,7 +4253,7 @@ lookup_pixel_color (struct frame *f, unsigned long pixel)
4300 { 4253 {
4301 XColor color; 4254 XColor color;
4302 Colormap cmap; 4255 Colormap cmap;
4303 int rc; 4256 bool rc;
4304 4257
4305 if (ct_colors_allocated_max <= ct_colors_allocated) 4258 if (ct_colors_allocated_max <= ct_colors_allocated)
4306 return FRAME_FOREGROUND_PIXEL (f); 4259 return FRAME_FOREGROUND_PIXEL (f);
@@ -4311,12 +4264,12 @@ lookup_pixel_color (struct frame *f, unsigned long pixel)
4311 x_query_color (f, &color); 4264 x_query_color (f, &color);
4312 rc = x_alloc_nearest_color (f, cmap, &color); 4265 rc = x_alloc_nearest_color (f, cmap, &color);
4313#else 4266#else
4314 BLOCK_INPUT; 4267 block_input ();
4315 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); 4268 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
4316 color.pixel = pixel; 4269 color.pixel = pixel;
4317 XQueryColor (NULL, cmap, &color); 4270 XQueryColor (NULL, cmap, &color);
4318 rc = x_alloc_nearest_color (f, cmap, &color); 4271 rc = x_alloc_nearest_color (f, cmap, &color);
4319 UNBLOCK_INPUT; 4272 unblock_input ();
4320#endif /* HAVE_X_WINDOWS */ 4273#endif /* HAVE_X_WINDOWS */
4321 4274
4322 if (rc) 4275 if (rc)
@@ -4394,14 +4347,6 @@ init_color_table (void)
4394 Algorithms 4347 Algorithms
4395 ***********************************************************************/ 4348 ***********************************************************************/
4396 4349
4397static XColor *x_to_xcolors (struct frame *, struct image *, int);
4398static void x_from_xcolors (struct frame *, struct image *, XColor *);
4399static void x_detect_edges (struct frame *, struct image *, int[9], int);
4400
4401#ifdef HAVE_NTGUI
4402static void XPutPixel (XImagePtr , int, int, COLORREF);
4403#endif /* HAVE_NTGUI */
4404
4405/* Edge detection matrices for different edge-detection 4350/* Edge detection matrices for different edge-detection
4406 strategies. */ 4351 strategies. */
4407 4352
@@ -4427,12 +4372,12 @@ static int laplace_matrix[9] = {
4427 4372
4428/* On frame F, return an array of XColor structures describing image 4373/* On frame F, return an array of XColor structures describing image
4429 IMG->pixmap. Each XColor structure has its pixel color set. RGB_P 4374 IMG->pixmap. Each XColor structure has its pixel color set. RGB_P
4430 non-zero means also fill the red/green/blue members of the XColor 4375 means also fill the red/green/blue members of the XColor
4431 structures. Value is a pointer to the array of XColors structures, 4376 structures. Value is a pointer to the array of XColors structures,
4432 allocated with xmalloc; it must be freed by the caller. */ 4377 allocated with xmalloc; it must be freed by the caller. */
4433 4378
4434static XColor * 4379static XColor *
4435x_to_xcolors (struct frame *f, struct image *img, int rgb_p) 4380x_to_xcolors (struct frame *f, struct image *img, bool rgb_p)
4436{ 4381{
4437 int x, y; 4382 int x, y;
4438 XColor *colors, *p; 4383 XColor *colors, *p;
@@ -4808,9 +4753,9 @@ x_disable_image (struct frame *f, struct image *img)
4808 determine the background color of IMG. If it is a list '(R G B)', 4753 determine the background color of IMG. If it is a list '(R G B)',
4809 with R, G, and B being integers >= 0, take that as the color of the 4754 with R, G, and B being integers >= 0, take that as the color of the
4810 background. Otherwise, determine the background color of IMG 4755 background. Otherwise, determine the background color of IMG
4811 heuristically. Value is non-zero if successful. */ 4756 heuristically. */
4812 4757
4813static int 4758static void
4814x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) 4759x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4815{ 4760{
4816 XImagePtr_or_DC ximg; 4761 XImagePtr_or_DC ximg;
@@ -4822,7 +4767,8 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4822 char *mask_img; 4767 char *mask_img;
4823 int row_width; 4768 int row_width;
4824#endif /* HAVE_NTGUI */ 4769#endif /* HAVE_NTGUI */
4825 int x, y, rc, use_img_background; 4770 int x, y;
4771 bool rc, use_img_background;
4826 unsigned long bg = 0; 4772 unsigned long bg = 0;
4827 4773
4828 if (img->mask) 4774 if (img->mask)
@@ -4838,7 +4784,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4838 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1, 4784 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
4839 &mask_img, &img->mask); 4785 &mask_img, &img->mask);
4840 if (!rc) 4786 if (!rc)
4841 return 0; 4787 return;
4842#endif /* !HAVE_NS */ 4788#endif /* !HAVE_NS */
4843 4789
4844 /* Get the X image of IMG->pixmap. */ 4790 /* Get the X image of IMG->pixmap. */
@@ -4928,8 +4874,6 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4928#endif /* HAVE_NTGUI */ 4874#endif /* HAVE_NTGUI */
4929 4875
4930 Destroy_Image (ximg, prev); 4876 Destroy_Image (ximg, prev);
4931
4932 return 1;
4933} 4877}
4934 4878
4935 4879
@@ -4937,9 +4881,8 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4937 PBM (mono, gray, color) 4881 PBM (mono, gray, color)
4938 ***********************************************************************/ 4882 ***********************************************************************/
4939 4883
4940static int pbm_image_p (Lisp_Object object); 4884static bool pbm_image_p (Lisp_Object object);
4941static int pbm_load (struct frame *f, struct image *img); 4885static bool pbm_load (struct frame *f, struct image *img);
4942static int pbm_scan_number (unsigned char **, unsigned char *);
4943 4886
4944/* The symbol `pbm' identifying images of this type. */ 4887/* The symbol `pbm' identifying images of this type. */
4945 4888
@@ -4994,9 +4937,9 @@ static struct image_type pbm_type =
4994}; 4937};
4995 4938
4996 4939
4997/* Return non-zero if OBJECT is a valid PBM image specification. */ 4940/* Return true if OBJECT is a valid PBM image specification. */
4998 4941
4999static int 4942static bool
5000pbm_image_p (Lisp_Object object) 4943pbm_image_p (Lisp_Object object)
5001{ 4944{
5002 struct image_keyword fmt[PBM_LAST]; 4945 struct image_keyword fmt[PBM_LAST];
@@ -5089,10 +5032,11 @@ pbm_read_file (Lisp_Object file, int *size)
5089 5032
5090/* Load PBM image IMG for use on frame F. */ 5033/* Load PBM image IMG for use on frame F. */
5091 5034
5092static int 5035static bool
5093pbm_load (struct frame *f, struct image *img) 5036pbm_load (struct frame *f, struct image *img)
5094{ 5037{
5095 int raw_p, x, y; 5038 bool raw_p;
5039 int x, y;
5096 int width, height, max_color_idx = 0; 5040 int width, height, max_color_idx = 0;
5097 XImagePtr ximg; 5041 XImagePtr ximg;
5098 Lisp_Object file, specified_file; 5042 Lisp_Object file, specified_file;
@@ -5355,8 +5299,8 @@ pbm_load (struct frame *f, struct image *img)
5355 5299
5356/* Function prototypes. */ 5300/* Function prototypes. */
5357 5301
5358static int png_image_p (Lisp_Object object); 5302static bool png_image_p (Lisp_Object object);
5359static int png_load (struct frame *f, struct image *img); 5303static bool png_load (struct frame *f, struct image *img);
5360 5304
5361/* The symbol `png' identifying images of this type. */ 5305/* The symbol `png' identifying images of this type. */
5362 5306
@@ -5397,7 +5341,7 @@ static const struct image_keyword png_format[PNG_LAST] =
5397}; 5341};
5398 5342
5399#ifdef HAVE_NTGUI 5343#ifdef HAVE_NTGUI
5400static int init_png_functions (Lisp_Object); 5344static bool init_png_functions (void);
5401#else 5345#else
5402#define init_png_functions NULL 5346#define init_png_functions NULL
5403#endif 5347#endif
@@ -5414,9 +5358,9 @@ static struct image_type png_type =
5414 NULL 5358 NULL
5415}; 5359};
5416 5360
5417/* Return non-zero if OBJECT is a valid PNG image specification. */ 5361/* Return true if OBJECT is a valid PNG image specification. */
5418 5362
5419static int 5363static bool
5420png_image_p (Lisp_Object object) 5364png_image_p (Lisp_Object object)
5421{ 5365{
5422 struct image_keyword fmt[PNG_LAST]; 5366 struct image_keyword fmt[PNG_LAST];
@@ -5468,12 +5412,12 @@ DEF_IMGLIB_FN (void, png_longjmp, (png_structp, int));
5468DEF_IMGLIB_FN (jmp_buf *, png_set_longjmp_fn, (png_structp, png_longjmp_ptr, size_t)); 5412DEF_IMGLIB_FN (jmp_buf *, png_set_longjmp_fn, (png_structp, png_longjmp_ptr, size_t));
5469#endif /* libpng version >= 1.5 */ 5413#endif /* libpng version >= 1.5 */
5470 5414
5471static int 5415static bool
5472init_png_functions (Lisp_Object libraries) 5416init_png_functions (void)
5473{ 5417{
5474 HMODULE library; 5418 HMODULE library;
5475 5419
5476 if (!(library = w32_delayed_load (libraries, Qpng))) 5420 if (!(library = w32_delayed_load (Qpng)))
5477 return 0; 5421 return 0;
5478 5422
5479 LOAD_IMGLIB_FN (library, png_get_io_ptr); 5423 LOAD_IMGLIB_FN (library, png_get_io_ptr);
@@ -5619,7 +5563,7 @@ png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length)
5619} 5563}
5620 5564
5621 5565
5622/* Load PNG image IMG for use on frame F. Value is non-zero if 5566/* Load PNG image IMG for use on frame F. Value is true if
5623 successful. */ 5567 successful. */
5624 5568
5625struct png_load_context 5569struct png_load_context
@@ -5633,7 +5577,7 @@ struct png_load_context
5633 png_byte **rows; 5577 png_byte **rows;
5634}; 5578};
5635 5579
5636static int 5580static bool
5637png_load_body (struct frame *f, struct image *img, struct png_load_context *c) 5581png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5638{ 5582{
5639 Lisp_Object file, specified_file; 5583 Lisp_Object file, specified_file;
@@ -5651,7 +5595,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5651 int bit_depth, color_type, interlace_type; 5595 int bit_depth, color_type, interlace_type;
5652 png_byte channels; 5596 png_byte channels;
5653 png_uint_32 row_bytes; 5597 png_uint_32 row_bytes;
5654 int transparent_p; 5598 bool transparent_p;
5655 struct png_memory_storage tbr; /* Data to be read */ 5599 struct png_memory_storage tbr; /* Data to be read */
5656 5600
5657 /* Find out what file to load. */ 5601 /* Find out what file to load. */
@@ -5984,7 +5928,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
5984 return 1; 5928 return 1;
5985} 5929}
5986 5930
5987static int 5931static bool
5988png_load (struct frame *f, struct image *img) 5932png_load (struct frame *f, struct image *img)
5989{ 5933{
5990 struct png_load_context c; 5934 struct png_load_context c;
@@ -5994,7 +5938,7 @@ png_load (struct frame *f, struct image *img)
5994#else /* HAVE_PNG */ 5938#else /* HAVE_PNG */
5995 5939
5996#ifdef HAVE_NS 5940#ifdef HAVE_NS
5997static int 5941static bool
5998png_load (struct frame *f, struct image *img) 5942png_load (struct frame *f, struct image *img)
5999{ 5943{
6000 return ns_load_image (f, img, 5944 return ns_load_image (f, img,
@@ -6014,8 +5958,8 @@ png_load (struct frame *f, struct image *img)
6014 5958
6015#if defined (HAVE_JPEG) || defined (HAVE_NS) 5959#if defined (HAVE_JPEG) || defined (HAVE_NS)
6016 5960
6017static int jpeg_image_p (Lisp_Object object); 5961static bool jpeg_image_p (Lisp_Object object);
6018static int jpeg_load (struct frame *f, struct image *img); 5962static bool jpeg_load (struct frame *f, struct image *img);
6019 5963
6020/* The symbol `jpeg' identifying images of this type. */ 5964/* The symbol `jpeg' identifying images of this type. */
6021 5965
@@ -6056,7 +6000,7 @@ static const struct image_keyword jpeg_format[JPEG_LAST] =
6056}; 6000};
6057 6001
6058#ifdef HAVE_NTGUI 6002#ifdef HAVE_NTGUI
6059static int init_jpeg_functions (Lisp_Object); 6003static bool init_jpeg_functions (void);
6060#else 6004#else
6061#define init_jpeg_functions NULL 6005#define init_jpeg_functions NULL
6062#endif 6006#endif
@@ -6073,9 +6017,9 @@ static struct image_type jpeg_type =
6073 NULL 6017 NULL
6074}; 6018};
6075 6019
6076/* Return non-zero if OBJECT is a valid JPEG image specification. */ 6020/* Return true if OBJECT is a valid JPEG image specification. */
6077 6021
6078static int 6022static bool
6079jpeg_image_p (Lisp_Object object) 6023jpeg_image_p (Lisp_Object object)
6080{ 6024{
6081 struct image_keyword fmt[JPEG_LAST]; 6025 struct image_keyword fmt[JPEG_LAST];
@@ -6124,12 +6068,12 @@ DEF_IMGLIB_FN (JDIMENSION, jpeg_read_scanlines, (j_decompress_ptr, JSAMPARRAY, J
6124DEF_IMGLIB_FN (struct jpeg_error_mgr *, jpeg_std_error, (struct jpeg_error_mgr *)); 6068DEF_IMGLIB_FN (struct jpeg_error_mgr *, jpeg_std_error, (struct jpeg_error_mgr *));
6125DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int)); 6069DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int));
6126 6070
6127static int 6071static bool
6128init_jpeg_functions (Lisp_Object libraries) 6072init_jpeg_functions (void)
6129{ 6073{
6130 HMODULE library; 6074 HMODULE library;
6131 6075
6132 if (!(library = w32_delayed_load (libraries, Qjpeg))) 6076 if (!(library = w32_delayed_load (Qjpeg)))
6133 return 0; 6077 return 0;
6134 6078
6135 LOAD_IMGLIB_FN (library, jpeg_finish_decompress); 6079 LOAD_IMGLIB_FN (library, jpeg_finish_decompress);
@@ -6394,7 +6338,7 @@ jpeg_file_src (j_decompress_ptr cinfo, FILE *fp)
6394/* Load image IMG for use on frame F. Patterned after example.c 6338/* Load image IMG for use on frame F. Patterned after example.c
6395 from the JPEG lib. */ 6339 from the JPEG lib. */
6396 6340
6397static int 6341static bool
6398jpeg_load_body (struct frame *f, struct image *img, 6342jpeg_load_body (struct frame *f, struct image *img,
6399 struct my_jpeg_error_mgr *mgr) 6343 struct my_jpeg_error_mgr *mgr)
6400{ 6344{
@@ -6575,7 +6519,7 @@ jpeg_load_body (struct frame *f, struct image *img,
6575 return 1; 6519 return 1;
6576} 6520}
6577 6521
6578static int 6522static bool
6579jpeg_load (struct frame *f, struct image *img) 6523jpeg_load (struct frame *f, struct image *img)
6580{ 6524{
6581 struct my_jpeg_error_mgr mgr; 6525 struct my_jpeg_error_mgr mgr;
@@ -6585,7 +6529,7 @@ jpeg_load (struct frame *f, struct image *img)
6585#else /* HAVE_JPEG */ 6529#else /* HAVE_JPEG */
6586 6530
6587#ifdef HAVE_NS 6531#ifdef HAVE_NS
6588static int 6532static bool
6589jpeg_load (struct frame *f, struct image *img) 6533jpeg_load (struct frame *f, struct image *img)
6590{ 6534{
6591 return ns_load_image (f, img, 6535 return ns_load_image (f, img,
@@ -6604,8 +6548,8 @@ jpeg_load (struct frame *f, struct image *img)
6604 6548
6605#if defined (HAVE_TIFF) || defined (HAVE_NS) 6549#if defined (HAVE_TIFF) || defined (HAVE_NS)
6606 6550
6607static int tiff_image_p (Lisp_Object object); 6551static bool tiff_image_p (Lisp_Object object);
6608static int tiff_load (struct frame *f, struct image *img); 6552static bool tiff_load (struct frame *f, struct image *img);
6609 6553
6610/* The symbol `tiff' identifying images of this type. */ 6554/* The symbol `tiff' identifying images of this type. */
6611 6555
@@ -6648,7 +6592,7 @@ static const struct image_keyword tiff_format[TIFF_LAST] =
6648}; 6592};
6649 6593
6650#ifdef HAVE_NTGUI 6594#ifdef HAVE_NTGUI
6651static int init_tiff_functions (Lisp_Object); 6595static bool init_tiff_functions (void);
6652#else 6596#else
6653#define init_tiff_functions NULL 6597#define init_tiff_functions NULL
6654#endif 6598#endif
@@ -6665,9 +6609,9 @@ static struct image_type tiff_type =
6665 NULL 6609 NULL
6666}; 6610};
6667 6611
6668/* Return non-zero if OBJECT is a valid TIFF image specification. */ 6612/* Return true if OBJECT is a valid TIFF image specification. */
6669 6613
6670static int 6614static bool
6671tiff_image_p (Lisp_Object object) 6615tiff_image_p (Lisp_Object object)
6672{ 6616{
6673 struct image_keyword fmt[TIFF_LAST]; 6617 struct image_keyword fmt[TIFF_LAST];
@@ -6701,12 +6645,12 @@ DEF_IMGLIB_FN (int, TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int));
6701DEF_IMGLIB_FN (void, TIFFClose, (TIFF *)); 6645DEF_IMGLIB_FN (void, TIFFClose, (TIFF *));
6702DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t)); 6646DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t));
6703 6647
6704static int 6648static bool
6705init_tiff_functions (Lisp_Object libraries) 6649init_tiff_functions (void)
6706{ 6650{
6707 HMODULE library; 6651 HMODULE library;
6708 6652
6709 if (!(library = w32_delayed_load (libraries, Qtiff))) 6653 if (!(library = w32_delayed_load (Qtiff)))
6710 return 0; 6654 return 0;
6711 6655
6712 LOAD_IMGLIB_FN (library, TIFFSetErrorHandler); 6656 LOAD_IMGLIB_FN (library, TIFFSetErrorHandler);
@@ -6871,10 +6815,10 @@ tiff_warning_handler (const char *title, const char *format, va_list ap)
6871} 6815}
6872 6816
6873 6817
6874/* Load TIFF image IMG for use on frame F. Value is non-zero if 6818/* Load TIFF image IMG for use on frame F. Value is true if
6875 successful. */ 6819 successful. */
6876 6820
6877static int 6821static bool
6878tiff_load (struct frame *f, struct image *img) 6822tiff_load (struct frame *f, struct image *img)
6879{ 6823{
6880 Lisp_Object file, specified_file; 6824 Lisp_Object file, specified_file;
@@ -7039,7 +6983,7 @@ tiff_load (struct frame *f, struct image *img)
7039#else /* HAVE_TIFF */ 6983#else /* HAVE_TIFF */
7040 6984
7041#ifdef HAVE_NS 6985#ifdef HAVE_NS
7042static int 6986static bool
7043tiff_load (struct frame *f, struct image *img) 6987tiff_load (struct frame *f, struct image *img)
7044{ 6988{
7045 return ns_load_image (f, img, 6989 return ns_load_image (f, img,
@@ -7058,8 +7002,8 @@ tiff_load (struct frame *f, struct image *img)
7058 7002
7059#if defined (HAVE_GIF) || defined (HAVE_NS) 7003#if defined (HAVE_GIF) || defined (HAVE_NS)
7060 7004
7061static int gif_image_p (Lisp_Object object); 7005static bool gif_image_p (Lisp_Object object);
7062static int gif_load (struct frame *f, struct image *img); 7006static bool gif_load (struct frame *f, struct image *img);
7063static void gif_clear_image (struct frame *f, struct image *img); 7007static void gif_clear_image (struct frame *f, struct image *img);
7064 7008
7065/* The symbol `gif' identifying images of this type. */ 7009/* The symbol `gif' identifying images of this type. */
@@ -7103,7 +7047,7 @@ static const struct image_keyword gif_format[GIF_LAST] =
7103}; 7047};
7104 7048
7105#ifdef HAVE_NTGUI 7049#ifdef HAVE_NTGUI
7106static int init_gif_functions (Lisp_Object); 7050static bool init_gif_functions (void);
7107#else 7051#else
7108#define init_gif_functions NULL 7052#define init_gif_functions NULL
7109#endif 7053#endif
@@ -7129,9 +7073,9 @@ gif_clear_image (struct frame *f, struct image *img)
7129 x_clear_image (f, img); 7073 x_clear_image (f, img);
7130} 7074}
7131 7075
7132/* Return non-zero if OBJECT is a valid GIF image specification. */ 7076/* Return true if OBJECT is a valid GIF image specification. */
7133 7077
7134static int 7078static bool
7135gif_image_p (Lisp_Object object) 7079gif_image_p (Lisp_Object object)
7136{ 7080{
7137 struct image_keyword fmt[GIF_LAST]; 7081 struct image_keyword fmt[GIF_LAST];
@@ -7174,12 +7118,12 @@ DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *));
7174DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); 7118DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc));
7175DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); 7119DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *));
7176 7120
7177static int 7121static bool
7178init_gif_functions (Lisp_Object libraries) 7122init_gif_functions (void)
7179{ 7123{
7180 HMODULE library; 7124 HMODULE library;
7181 7125
7182 if (!(library = w32_delayed_load (libraries, Qgif))) 7126 if (!(library = w32_delayed_load (Qgif)))
7183 return 0; 7127 return 0;
7184 7128
7185 LOAD_IMGLIB_FN (library, DGifCloseFile); 7129 LOAD_IMGLIB_FN (library, DGifCloseFile);
@@ -7228,7 +7172,7 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
7228} 7172}
7229 7173
7230 7174
7231/* Load GIF image IMG for use on frame F. Value is non-zero if 7175/* Load GIF image IMG for use on frame F. Value is true if
7232 successful. */ 7176 successful. */
7233 7177
7234static const int interlace_start[] = {0, 4, 2, 1}; 7178static const int interlace_start[] = {0, 4, 2, 1};
@@ -7236,7 +7180,7 @@ static const int interlace_increment[] = {8, 8, 4, 2};
7236 7180
7237#define GIF_LOCAL_DESCRIPTOR_EXTENSION 249 7181#define GIF_LOCAL_DESCRIPTOR_EXTENSION 249
7238 7182
7239static int 7183static bool
7240gif_load (struct frame *f, struct image *img) 7184gif_load (struct frame *f, struct image *img)
7241{ 7185{
7242 Lisp_Object file; 7186 Lisp_Object file;
@@ -7534,7 +7478,7 @@ gif_load (struct frame *f, struct image *img)
7534#else /* !HAVE_GIF */ 7478#else /* !HAVE_GIF */
7535 7479
7536#ifdef HAVE_NS 7480#ifdef HAVE_NS
7537static int 7481static bool
7538gif_load (struct frame *f, struct image *img) 7482gif_load (struct frame *f, struct image *img)
7539{ 7483{
7540 return ns_load_image (f, img, 7484 return ns_load_image (f, img,
@@ -7553,8 +7497,8 @@ gif_load (struct frame *f, struct image *img)
7553 7497
7554static Lisp_Object Qimagemagick; 7498static Lisp_Object Qimagemagick;
7555 7499
7556static int imagemagick_image_p (Lisp_Object); 7500static bool imagemagick_image_p (Lisp_Object);
7557static int imagemagick_load (struct frame *, struct image *); 7501static bool imagemagick_load (struct frame *, struct image *);
7558static void imagemagick_clear_image (struct frame *, struct image *); 7502static void imagemagick_clear_image (struct frame *, struct image *);
7559 7503
7560/* Indices of image specification fields in imagemagick_format. */ 7504/* Indices of image specification fields in imagemagick_format. */
@@ -7600,7 +7544,7 @@ static struct image_keyword imagemagick_format[IMAGEMAGICK_LAST] =
7600 }; 7544 };
7601 7545
7602#ifdef HAVE_NTGUI 7546#ifdef HAVE_NTGUI
7603static int init_imagemagick_functions (Lisp_Object); 7547static bool init_imagemagick_functions (void);
7604#else 7548#else
7605#define init_imagemagick_functions NULL 7549#define init_imagemagick_functions NULL
7606#endif 7550#endif
@@ -7627,11 +7571,11 @@ imagemagick_clear_image (struct frame *f,
7627 x_clear_image (f, img); 7571 x_clear_image (f, img);
7628} 7572}
7629 7573
7630/* Return non-zero if OBJECT is a valid IMAGEMAGICK image specification. Do 7574/* Return true if OBJECT is a valid IMAGEMAGICK image specification. Do
7631 this by calling parse_image_spec and supplying the keywords that 7575 this by calling parse_image_spec and supplying the keywords that
7632 identify the IMAGEMAGICK format. */ 7576 identify the IMAGEMAGICK format. */
7633 7577
7634static int 7578static bool
7635imagemagick_image_p (Lisp_Object object) 7579imagemagick_image_p (Lisp_Object object)
7636{ 7580{
7637 struct image_keyword fmt[IMAGEMAGICK_LAST]; 7581 struct image_keyword fmt[IMAGEMAGICK_LAST];
@@ -7683,9 +7627,9 @@ imagemagick_error (MagickWand *wand)
7683 be parsed; SIZE is the number of bytes of data; and FILENAME is 7627 be parsed; SIZE is the number of bytes of data; and FILENAME is
7684 either the file name or the image data. 7628 either the file name or the image data.
7685 7629
7686 Return non-zero if successful. */ 7630 Return true if successful. */
7687 7631
7688static int 7632static bool
7689imagemagick_load_image (struct frame *f, struct image *img, 7633imagemagick_load_image (struct frame *f, struct image *img,
7690 unsigned char *contents, unsigned int size, 7634 unsigned char *contents, unsigned int size,
7691 char *filename) 7635 char *filename)
@@ -8023,14 +7967,14 @@ imagemagick_load_image (struct frame *f, struct image *img,
8023} 7967}
8024 7968
8025 7969
8026/* Load IMAGEMAGICK image IMG for use on frame F. Value is non-zero if 7970/* Load IMAGEMAGICK image IMG for use on frame F. Value is true if
8027 successful. this function will go into the imagemagick_type structure, and 7971 successful. this function will go into the imagemagick_type structure, and
8028 the prototype thus needs to be compatible with that structure. */ 7972 the prototype thus needs to be compatible with that structure. */
8029 7973
8030static int 7974static bool
8031imagemagick_load (struct frame *f, struct image *img) 7975imagemagick_load (struct frame *f, struct image *img)
8032{ 7976{
8033 int success_p = 0; 7977 bool success_p = 0;
8034 Lisp_Object file_name; 7978 Lisp_Object file_name;
8035 7979
8036 /* If IMG->spec specifies a file name, create a non-file spec from it. */ 7980 /* If IMG->spec specifies a file name, create a non-file spec from it. */
@@ -8109,11 +8053,11 @@ and `imagemagick-types-inhibit'. */)
8109 8053
8110/* Function prototypes. */ 8054/* Function prototypes. */
8111 8055
8112static int svg_image_p (Lisp_Object object); 8056static bool svg_image_p (Lisp_Object object);
8113static int svg_load (struct frame *f, struct image *img); 8057static bool svg_load (struct frame *f, struct image *img);
8114 8058
8115static int svg_load_image (struct frame *, struct image *, 8059static bool svg_load_image (struct frame *, struct image *,
8116 unsigned char *, ptrdiff_t); 8060 unsigned char *, ptrdiff_t);
8117 8061
8118/* The symbol `svg' identifying images of this type. */ 8062/* The symbol `svg' identifying images of this type. */
8119 8063
@@ -8154,7 +8098,7 @@ static const struct image_keyword svg_format[SVG_LAST] =
8154}; 8098};
8155 8099
8156#ifdef HAVE_NTGUI 8100#ifdef HAVE_NTGUI
8157static int init_svg_functions (Lisp_Object); 8101static bool init_svg_functions (void);
8158#else 8102#else
8159#define init_svg_functions NULL 8103#define init_svg_functions NULL
8160#endif 8104#endif
@@ -8174,11 +8118,11 @@ static struct image_type svg_type =
8174}; 8118};
8175 8119
8176 8120
8177/* Return non-zero if OBJECT is a valid SVG image specification. Do 8121/* Return true if OBJECT is a valid SVG image specification. Do
8178 this by calling parse_image_spec and supplying the keywords that 8122 this by calling parse_image_spec and supplying the keywords that
8179 identify the SVG format. */ 8123 identify the SVG format. */
8180 8124
8181static int 8125static bool
8182svg_image_p (Lisp_Object object) 8126svg_image_p (Lisp_Object object)
8183{ 8127{
8184 struct image_keyword fmt[SVG_LAST]; 8128 struct image_keyword fmt[SVG_LAST];
@@ -8217,15 +8161,15 @@ DEF_IMGLIB_FN (void, g_error_free);
8217 8161
8218Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; 8162Lisp_Object Qgdk_pixbuf, Qglib, Qgobject;
8219 8163
8220static int 8164static bool
8221init_svg_functions (Lisp_Object libraries) 8165init_svg_functions (void)
8222{ 8166{
8223 HMODULE library, gdklib, glib, gobject; 8167 HMODULE library, gdklib, glib, gobject;
8224 8168
8225 if (!(glib = w32_delayed_load (libraries, Qglib)) 8169 if (!(glib = w32_delayed_load (Qglib))
8226 || !(gobject = w32_delayed_load (libraries, Qgobject)) 8170 || !(gobject = w32_delayed_load (Qgobject))
8227 || !(gdklib = w32_delayed_load (libraries, Qgdk_pixbuf)) 8171 || !(gdklib = w32_delayed_load (Qgdk_pixbuf))
8228 || !(library = w32_delayed_load (libraries, Qsvg))) 8172 || !(library = w32_delayed_load (Qsvg)))
8229 return 0; 8173 return 0;
8230 8174
8231 LOAD_IMGLIB_FN (library, rsvg_handle_new); 8175 LOAD_IMGLIB_FN (library, rsvg_handle_new);
@@ -8273,14 +8217,13 @@ init_svg_functions (Lisp_Object libraries)
8273#define fn_g_error_free g_error_free 8217#define fn_g_error_free g_error_free
8274#endif /* !HAVE_NTGUI */ 8218#endif /* !HAVE_NTGUI */
8275 8219
8276/* Load SVG image IMG for use on frame F. Value is non-zero if 8220/* Load SVG image IMG for use on frame F. Value is true if
8277 successful. this function will go into the svg_type structure, and 8221 successful. */
8278 the prototype thus needs to be compatible with that structure. */
8279 8222
8280static int 8223static bool
8281svg_load (struct frame *f, struct image *img) 8224svg_load (struct frame *f, struct image *img)
8282{ 8225{
8283 int success_p = 0; 8226 bool success_p = 0;
8284 Lisp_Object file_name; 8227 Lisp_Object file_name;
8285 8228
8286 /* If IMG->spec specifies a file name, create a non-file spec from it. */ 8229 /* If IMG->spec specifies a file name, create a non-file spec from it. */
@@ -8333,8 +8276,8 @@ svg_load (struct frame *f, struct image *img)
8333 8276
8334 Uses librsvg to do most of the image processing. 8277 Uses librsvg to do most of the image processing.
8335 8278
8336 Returns non-zero when successful. */ 8279 Returns true when successful. */
8337static int 8280static bool
8338svg_load_image (struct frame *f, /* Pointer to emacs frame structure. */ 8281svg_load_image (struct frame *f, /* Pointer to emacs frame structure. */
8339 struct image *img, /* Pointer to emacs image structure. */ 8282 struct image *img, /* Pointer to emacs image structure. */
8340 unsigned char *contents, /* String containing the SVG XML data to be parsed. */ 8283 unsigned char *contents, /* String containing the SVG XML data to be parsed. */
@@ -8501,8 +8444,8 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8501 8444
8502#ifdef HAVE_GHOSTSCRIPT 8445#ifdef HAVE_GHOSTSCRIPT
8503 8446
8504static int gs_image_p (Lisp_Object object); 8447static bool gs_image_p (Lisp_Object object);
8505static int gs_load (struct frame *f, struct image *img); 8448static bool gs_load (struct frame *f, struct image *img);
8506static void gs_clear_image (struct frame *f, struct image *img); 8449static void gs_clear_image (struct frame *f, struct image *img);
8507 8450
8508/* Keyword symbols. */ 8451/* Keyword symbols. */
@@ -8549,12 +8492,6 @@ static const struct image_keyword gs_format[GS_LAST] =
8549 {":background", IMAGE_STRING_OR_NIL_VALUE, 0} 8492 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
8550}; 8493};
8551 8494
8552#ifdef HAVE_NTGUI
8553static int init_gs_functions (Lisp_Object);
8554#else
8555#define init_gs_functions NULL
8556#endif
8557
8558/* Structure describing the image type `ghostscript'. */ 8495/* Structure describing the image type `ghostscript'. */
8559 8496
8560static struct image_type gs_type = 8497static struct image_type gs_type =
@@ -8563,7 +8500,7 @@ static struct image_type gs_type =
8563 gs_image_p, 8500 gs_image_p,
8564 gs_load, 8501 gs_load,
8565 gs_clear_image, 8502 gs_clear_image,
8566 init_gs_functions, 8503 NULL,
8567 NULL 8504 NULL
8568}; 8505};
8569 8506
@@ -8577,10 +8514,10 @@ gs_clear_image (struct frame *f, struct image *img)
8577} 8514}
8578 8515
8579 8516
8580/* Return non-zero if OBJECT is a valid Ghostscript image 8517/* Return true if OBJECT is a valid Ghostscript image
8581 specification. */ 8518 specification. */
8582 8519
8583static int 8520static bool
8584gs_image_p (Lisp_Object object) 8521gs_image_p (Lisp_Object object)
8585{ 8522{
8586 struct image_keyword fmt[GS_LAST]; 8523 struct image_keyword fmt[GS_LAST];
@@ -8617,10 +8554,10 @@ gs_image_p (Lisp_Object object)
8617} 8554}
8618 8555
8619 8556
8620/* Load Ghostscript image IMG for use on frame F. Value is non-zero 8557/* Load Ghostscript image IMG for use on frame F. Value is true
8621 if successful. */ 8558 if successful. */
8622 8559
8623static int 8560static bool
8624gs_load (struct frame *f, struct image *img) 8561gs_load (struct frame *f, struct image *img)
8625{ 8562{
8626 uprintmax_t printnum1, printnum2; 8563 uprintmax_t printnum1, printnum2;
@@ -8656,11 +8593,11 @@ gs_load (struct frame *f, struct image *img)
8656 if (x_check_image_size (0, img->width, img->height)) 8593 if (x_check_image_size (0, img->width, img->height))
8657 { 8594 {
8658 /* Only W32 version did BLOCK_INPUT here. ++kfs */ 8595 /* Only W32 version did BLOCK_INPUT here. ++kfs */
8659 BLOCK_INPUT; 8596 block_input ();
8660 img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 8597 img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
8661 img->width, img->height, 8598 img->width, img->height,
8662 DefaultDepthOfScreen (FRAME_X_SCREEN (f))); 8599 DefaultDepthOfScreen (FRAME_X_SCREEN (f)));
8663 UNBLOCK_INPUT; 8600 unblock_input ();
8664 } 8601 }
8665 8602
8666 if (!img->pixmap) 8603 if (!img->pixmap)
@@ -8736,7 +8673,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
8736 { 8673 {
8737 XImagePtr ximg; 8674 XImagePtr ximg;
8738 8675
8739 BLOCK_INPUT; 8676 block_input ();
8740 8677
8741 /* Try to get an XImage for img->pixmep. */ 8678 /* Try to get an XImage for img->pixmep. */
8742 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, 8679 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap,
@@ -8779,15 +8716,15 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
8779 image_error ("Cannot get X image of `%s'; colors will not be freed", 8716 image_error ("Cannot get X image of `%s'; colors will not be freed",
8780 img->spec, Qnil); 8717 img->spec, Qnil);
8781 8718
8782 UNBLOCK_INPUT; 8719 unblock_input ();
8783 } 8720 }
8784#endif /* HAVE_X_WINDOWS */ 8721#endif /* HAVE_X_WINDOWS */
8785 8722
8786 /* Now that we have the pixmap, compute mask and transform the 8723 /* Now that we have the pixmap, compute mask and transform the
8787 image if requested. */ 8724 image if requested. */
8788 BLOCK_INPUT; 8725 block_input ();
8789 postprocess_image (f, img); 8726 postprocess_image (f, img);
8790 UNBLOCK_INPUT; 8727 unblock_input ();
8791} 8728}
8792 8729
8793#endif /* HAVE_GHOSTSCRIPT */ 8730#endif /* HAVE_GHOSTSCRIPT */
@@ -8826,88 +8763,92 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "")
8826 Initialization 8763 Initialization
8827 ***********************************************************************/ 8764 ***********************************************************************/
8828 8765
8829DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0, 8766DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 1, 1, 0,
8830 doc: /* Initialize image library implementing image type TYPE. 8767 doc: /* Initialize image library implementing image type TYPE.
8831Return non-nil if TYPE is a supported image type. 8768Return non-nil if TYPE is a supported image type.
8832 8769
8833Image types pbm and xbm are prebuilt; other types are loaded here. 8770If image libraries are loaded dynamically (currently only the case on
8834Libraries to load are specified in alist LIBRARIES (usually, the value 8771MS-Windows), load the library for TYPE if it is not yet loaded, using
8835of `dynamic-library-alist', which see). */) 8772the library file(s) specified by `dynamic-library-alist'. */)
8836 (Lisp_Object type, Lisp_Object libraries) 8773 (Lisp_Object type)
8837{ 8774{
8838 return lookup_image_type (type, libraries) ? Qt : Qnil; 8775 return lookup_image_type (type) ? Qt : Qnil;
8839} 8776}
8840 8777
8841/* Look up image type TYPE, and return a pointer to its image_type 8778/* Look up image type TYPE, and return a pointer to its image_type
8842 structure. Return 0 if TYPE is not a known image type. 8779 structure. Return 0 if TYPE is not a known image type. */
8843
8844 LIBRARIES is an alist associating dynamic libraries to external
8845 files implementing them, which is passed to the image library
8846 initialization function if necessary. A nil value defaults to
8847 Vdynamic_library_alist. */
8848 8780
8849static struct image_type * 8781static struct image_type *
8850lookup_image_type (Lisp_Object type, Lisp_Object libraries) 8782lookup_image_type (Lisp_Object type)
8851{ 8783{
8852 if (NILP (libraries))
8853 libraries = Vdynamic_library_alist;
8854
8855 /* Types pbm and xbm are built-in and always available. */ 8784 /* Types pbm and xbm are built-in and always available. */
8856 if (EQ (type, Qpbm)) 8785 if (EQ (type, Qpbm))
8857 return define_image_type (&pbm_type, libraries); 8786 return define_image_type (&pbm_type);
8858 8787
8859 if (EQ (type, Qxbm)) 8788 if (EQ (type, Qxbm))
8860 return define_image_type (&xbm_type, libraries); 8789 return define_image_type (&xbm_type);
8861 8790
8862#if defined (HAVE_XPM) || defined (HAVE_NS) 8791#if defined (HAVE_XPM) || defined (HAVE_NS)
8863 if (EQ (type, Qxpm)) 8792 if (EQ (type, Qxpm))
8864 return define_image_type (&xpm_type, libraries); 8793 return define_image_type (&xpm_type);
8865#endif 8794#endif
8866 8795
8867#if defined (HAVE_JPEG) || defined (HAVE_NS) 8796#if defined (HAVE_JPEG) || defined (HAVE_NS)
8868 if (EQ (type, Qjpeg)) 8797 if (EQ (type, Qjpeg))
8869 return define_image_type (&jpeg_type, libraries); 8798 return define_image_type (&jpeg_type);
8870#endif 8799#endif
8871 8800
8872#if defined (HAVE_TIFF) || defined (HAVE_NS) 8801#if defined (HAVE_TIFF) || defined (HAVE_NS)
8873 if (EQ (type, Qtiff)) 8802 if (EQ (type, Qtiff))
8874 return define_image_type (&tiff_type, libraries); 8803 return define_image_type (&tiff_type);
8875#endif 8804#endif
8876 8805
8877#if defined (HAVE_GIF) || defined (HAVE_NS) 8806#if defined (HAVE_GIF) || defined (HAVE_NS)
8878 if (EQ (type, Qgif)) 8807 if (EQ (type, Qgif))
8879 return define_image_type (&gif_type, libraries); 8808 return define_image_type (&gif_type);
8880#endif 8809#endif
8881 8810
8882#if defined (HAVE_PNG) || defined (HAVE_NS) 8811#if defined (HAVE_PNG) || defined (HAVE_NS)
8883 if (EQ (type, Qpng)) 8812 if (EQ (type, Qpng))
8884 return define_image_type (&png_type, libraries); 8813 return define_image_type (&png_type);
8885#endif 8814#endif
8886 8815
8887#if defined (HAVE_RSVG) 8816#if defined (HAVE_RSVG)
8888 if (EQ (type, Qsvg)) 8817 if (EQ (type, Qsvg))
8889 return define_image_type (&svg_type, libraries); 8818 return define_image_type (&svg_type);
8890#endif 8819#endif
8891 8820
8892#if defined (HAVE_IMAGEMAGICK) 8821#if defined (HAVE_IMAGEMAGICK)
8893 if (EQ (type, Qimagemagick)) 8822 if (EQ (type, Qimagemagick))
8894 return define_image_type (&imagemagick_type, libraries); 8823 return define_image_type (&imagemagick_type);
8895#endif 8824#endif
8896 8825
8897#ifdef HAVE_GHOSTSCRIPT 8826#ifdef HAVE_GHOSTSCRIPT
8898 if (EQ (type, Qpostscript)) 8827 if (EQ (type, Qpostscript))
8899 return define_image_type (&gs_type, libraries); 8828 return define_image_type (&gs_type);
8900#endif 8829#endif
8901 8830
8902 return NULL; 8831 return NULL;
8903} 8832}
8904 8833
8834/* Reset image_types before dumping.
8835 Called from Fdump_emacs. */
8836
8837void
8838reset_image_types (void)
8839{
8840 while (image_types)
8841 {
8842 struct image_type *next = image_types->next;
8843 xfree (image_types);
8844 image_types = next;
8845 }
8846}
8847
8905void 8848void
8906syms_of_image (void) 8849syms_of_image (void)
8907{ 8850{
8908 /* Initialize this only once, since that's what we do with Vimage_types 8851 /* Initialize this only once; it will be reset before dumping. */
8909 and they are supposed to be in sync. Initializing here gives correct
8910 operation on GNU/Linux of calling dump-emacs after loading some images. */
8911 image_types = NULL; 8852 image_types = NULL;
8912 8853
8913 /* Must be defined now because we're going to update it below, while 8854 /* Must be defined now because we're going to update it below, while
diff --git a/src/indent.c b/src/indent.c
index 053643e6319..b368a7aeb09 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -115,7 +115,7 @@ character_width (int c, struct Lisp_Char_Table *dp)
115 for characters as WIDTHTAB. We use this to decide when to 115 for characters as WIDTHTAB. We use this to decide when to
116 invalidate the buffer's width_run_cache. */ 116 invalidate the buffer's width_run_cache. */
117 117
118int 118bool
119disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *widthtab) 119disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *widthtab)
120{ 120{
121 int i; 121 int i;
@@ -320,14 +320,14 @@ invalidate_current_column (void)
320ptrdiff_t 320ptrdiff_t
321current_column (void) 321current_column (void)
322{ 322{
323 register ptrdiff_t col; 323 ptrdiff_t col;
324 register unsigned char *ptr, *stop; 324 unsigned char *ptr, *stop;
325 register int tab_seen; 325 bool tab_seen;
326 ptrdiff_t post_tab; 326 ptrdiff_t post_tab;
327 register int c; 327 int c;
328 int tab_width = SANE_TAB_WIDTH (current_buffer); 328 int tab_width = SANE_TAB_WIDTH (current_buffer);
329 int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); 329 bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
330 register struct Lisp_Char_Table *dp = buffer_display_table (); 330 struct Lisp_Char_Table *dp = buffer_display_table ();
331 331
332 if (PT == last_known_column_point 332 if (PT == last_known_column_point
333 && MODIFF == last_known_column_modified) 333 && MODIFF == last_known_column_modified)
@@ -512,9 +512,9 @@ static void
512scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol) 512scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol)
513{ 513{
514 int tab_width = SANE_TAB_WIDTH (current_buffer); 514 int tab_width = SANE_TAB_WIDTH (current_buffer);
515 register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); 515 bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
516 register struct Lisp_Char_Table *dp = buffer_display_table (); 516 struct Lisp_Char_Table *dp = buffer_display_table ();
517 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 517 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
518 struct composition_it cmp_it; 518 struct composition_it cmp_it;
519 Lisp_Object window; 519 Lisp_Object window;
520 struct window *w; 520 struct window *w;
@@ -722,14 +722,14 @@ current_column_1 (void)
722static double 722static double
723string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end) 723string_display_width (Lisp_Object string, Lisp_Object beg, Lisp_Object end)
724{ 724{
725 register int col; 725 int col;
726 register unsigned char *ptr, *stop; 726 unsigned char *ptr, *stop;
727 register int tab_seen; 727 bool tab_seen;
728 int post_tab; 728 int post_tab;
729 register int c; 729 int c;
730 int tab_width = SANE_TAB_WIDTH (current_buffer); 730 int tab_width = SANE_TAB_WIDTH (current_buffer);
731 int ctl_arrow = !NILP (current_buffer->ctl_arrow); 731 bool ctl_arrow = !NILP (current_buffer->ctl_arrow);
732 register struct Lisp_Char_Table *dp = buffer_display_table (); 732 struct Lisp_Char_Table *dp = buffer_display_table ();
733 int b, e; 733 int b, e;
734 734
735 if (NILP (end)) 735 if (NILP (end))
@@ -945,7 +945,7 @@ position_indentation (ptrdiff_t pos_byte)
945 Blank lines are treated as if they had the same indentation as the 945 Blank lines are treated as if they had the same indentation as the
946 preceding line. */ 946 preceding line. */
947 947
948int 948bool
949indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column) 949indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column)
950{ 950{
951 ptrdiff_t val; 951 ptrdiff_t val;
@@ -1047,11 +1047,11 @@ static struct position val_compute_motion;
1047 can't hit the requested column exactly (because of a tab or other 1047 can't hit the requested column exactly (because of a tab or other
1048 multi-column character), overshoot. 1048 multi-column character), overshoot.
1049 1049
1050 DID_MOTION is 1 if FROMHPOS has already accounted for overlay strings 1050 DID_MOTION is true if FROMHPOS has already accounted for overlay strings
1051 at FROM. This is the case if FROMVPOS and FROMVPOS came from an 1051 at FROM. This is the case if FROMVPOS and FROMVPOS came from an
1052 earlier call to compute_motion. The other common case is that FROMHPOS 1052 earlier call to compute_motion. The other common case is that FROMHPOS
1053 is zero and FROM is a position that "belongs" at column zero, but might 1053 is zero and FROM is a position that "belongs" at column zero, but might
1054 be shifted by overlay strings; in this case DID_MOTION should be 0. 1054 be shifted by overlay strings; in this case DID_MOTION should be false.
1055 1055
1056 WIDTH is the number of columns available to display text; 1056 WIDTH is the number of columns available to display text;
1057 compute_motion uses this to handle continuation lines and such. 1057 compute_motion uses this to handle continuation lines and such.
@@ -1104,17 +1104,20 @@ static struct position val_compute_motion;
1104 the scroll bars if they are turned on. */ 1104 the scroll bars if they are turned on. */
1105 1105
1106struct position * 1106struct position *
1107compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_motion, ptrdiff_t to, EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, ptrdiff_t hscroll, int tab_offset, struct window *win) 1107compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos,
1108 bool did_motion, ptrdiff_t to,
1109 EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width,
1110 ptrdiff_t hscroll, int tab_offset, struct window *win)
1108{ 1111{
1109 register EMACS_INT hpos = fromhpos; 1112 EMACS_INT hpos = fromhpos;
1110 register EMACS_INT vpos = fromvpos; 1113 EMACS_INT vpos = fromvpos;
1111 1114
1112 register ptrdiff_t pos; 1115 ptrdiff_t pos;
1113 ptrdiff_t pos_byte; 1116 ptrdiff_t pos_byte;
1114 register int c = 0; 1117 int c = 0;
1115 int tab_width = SANE_TAB_WIDTH (current_buffer); 1118 int tab_width = SANE_TAB_WIDTH (current_buffer);
1116 register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); 1119 bool ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
1117 register struct Lisp_Char_Table *dp = window_display_table (win); 1120 struct Lisp_Char_Table *dp = window_display_table (win);
1118 EMACS_INT selective 1121 EMACS_INT selective
1119 = (INTEGERP (BVAR (current_buffer, selective_display)) 1122 = (INTEGERP (BVAR (current_buffer, selective_display))
1120 ? XINT (BVAR (current_buffer, selective_display)) 1123 ? XINT (BVAR (current_buffer, selective_display))
@@ -1139,7 +1142,7 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1139 ptrdiff_t next_width_run = from; 1142 ptrdiff_t next_width_run = from;
1140 Lisp_Object window; 1143 Lisp_Object window;
1141 1144
1142 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 1145 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
1143 /* If previous char scanned was a wide character, 1146 /* If previous char scanned was a wide character,
1144 this is the column where it ended. Otherwise, this is 0. */ 1147 this is the column where it ended. Otherwise, this is 0. */
1145 EMACS_INT wide_column_end_hpos = 0; 1148 EMACS_INT wide_column_end_hpos = 0;
@@ -1308,7 +1311,7 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
1308 if (hpos > width) 1311 if (hpos > width)
1309 { 1312 {
1310 EMACS_INT total_width = width + continuation_glyph_width; 1313 EMACS_INT total_width = width + continuation_glyph_width;
1311 int truncate = 0; 1314 bool truncate = 0;
1312 1315
1313 if (!NILP (Vtruncate_partial_width_windows) 1316 if (!NILP (Vtruncate_partial_width_windows)
1314 && (total_width < FRAME_COLS (XFRAME (WINDOW_FRAME (win))))) 1317 && (total_width < FRAME_COLS (XFRAME (WINDOW_FRAME (win)))))
@@ -1827,7 +1830,7 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
1827 PTRDIFF_MAX) 1830 PTRDIFF_MAX)
1828 : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); 1831 : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
1829 Lisp_Object window; 1832 Lisp_Object window;
1830 int did_motion; 1833 bool did_motion;
1831 /* This is the object we use for fetching character properties. */ 1834 /* This is the object we use for fetching character properties. */
1832 Lisp_Object text_prop_object; 1835 Lisp_Object text_prop_object;
1833 1836
@@ -2017,8 +2020,8 @@ whether or not it is currently displayed in some window. */)
2017 { 2020 {
2018 ptrdiff_t it_start, it_overshoot_count = 0; 2021 ptrdiff_t it_start, it_overshoot_count = 0;
2019 int first_x; 2022 int first_x;
2020 int overshoot_handled = 0; 2023 bool overshoot_handled = 0;
2021 int disp_string_at_start_p = 0; 2024 bool disp_string_at_start_p = 0;
2022 2025
2023 itdata = bidi_shelve_cache (); 2026 itdata = bidi_shelve_cache ();
2024 SET_TEXT_POS (pt, PT, PT_BYTE); 2027 SET_TEXT_POS (pt, PT, PT_BYTE);
diff --git a/src/indent.h b/src/indent.h
index e198137a756..abcd06036d1 100644
--- a/src/indent.h
+++ b/src/indent.h
@@ -27,7 +27,7 @@ struct position
27 }; 27 };
28 28
29struct position *compute_motion (ptrdiff_t from, EMACS_INT fromvpos, 29struct position *compute_motion (ptrdiff_t from, EMACS_INT fromvpos,
30 EMACS_INT fromhpos, int did_motion, 30 EMACS_INT fromhpos, bool did_motion,
31 ptrdiff_t to, EMACS_INT tovpos, 31 ptrdiff_t to, EMACS_INT tovpos,
32 EMACS_INT tohpos, 32 EMACS_INT tohpos,
33 EMACS_INT width, ptrdiff_t hscroll, 33 EMACS_INT width, ptrdiff_t hscroll,
@@ -45,8 +45,8 @@ extern ptrdiff_t last_known_column_point;
45/* Return true if the display table DISPTAB specifies the same widths 45/* Return true if the display table DISPTAB specifies the same widths
46 for characters as WIDTHTAB. We use this to decide when to 46 for characters as WIDTHTAB. We use this to decide when to
47 invalidate the buffer's column_cache. */ 47 invalidate the buffer's column_cache. */
48int disptab_matches_widthtab (struct Lisp_Char_Table *disptab, 48bool disptab_matches_widthtab (struct Lisp_Char_Table *disptab,
49 struct Lisp_Vector *widthtab); 49 struct Lisp_Vector *widthtab);
50 50
51/* Recompute BUF's width table, using the display table DISPTAB. */ 51/* Recompute BUF's width table, using the display table DISPTAB. */
52void recompute_width_table (struct buffer *buf, 52void recompute_width_table (struct buffer *buf,
diff --git a/src/keyboard.c b/src/keyboard.c
index 8b1113a026a..f3d7df5e98f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <config.h> 20#include <config.h>
21 21
22#define BLOCKINPUT_INLINE EXTERN_INLINE
22#define KEYBOARD_INLINE EXTERN_INLINE 23#define KEYBOARD_INLINE EXTERN_INLINE
23 24
24#include <stdio.h> 25#include <stdio.h>
@@ -72,19 +73,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
72 73
73/* Variables for blockinput.h: */ 74/* Variables for blockinput.h: */
74 75
75/* Non-zero if interrupt input is blocked right now. */ 76/* Positive if interrupt input is blocked right now. */
76volatile int interrupt_input_blocked; 77volatile int interrupt_input_blocked;
77 78
78/* Nonzero means an input interrupt has arrived 79/* Nonzero means an input interrupt or alarm signal has arrived.
79 during the current critical section. */ 80 The QUIT macro checks this. */
80int interrupt_input_pending; 81volatile int pending_signals;
81
82/* This var should be (interrupt_input_pending || pending_atimers).
83 The QUIT macro checks this instead of interrupt_input_pending and
84 pending_atimers separately, to reduce code size. So, any code that
85 changes interrupt_input_pending or pending_atimers should update
86 this too. */
87int pending_signals;
88 82
89#define KBD_BUFFER_SIZE 4096 83#define KBD_BUFFER_SIZE 4096
90 84
@@ -225,7 +219,11 @@ static Lisp_Object last_point_position_window;
225 last event came from a macro. We use this to determine when to 219 last event came from a macro. We use this to determine when to
226 generate switch-frame events. This may be cleared by functions 220 generate switch-frame events. This may be cleared by functions
227 like Fselect_frame, to make sure that a switch-frame event is 221 like Fselect_frame, to make sure that a switch-frame event is
228 generated by the next character. */ 222 generated by the next character.
223
224 FIXME: This is modified by a signal handler so it should be volatile.
225 It's exported to Lisp, though, so it can't simply be marked
226 'volatile' here. */
229Lisp_Object internal_last_event_frame; 227Lisp_Object internal_last_event_frame;
230 228
231/* The timestamp of the last input event we received from the X server. 229/* The timestamp of the last input event we received from the X server.
@@ -389,7 +387,7 @@ int interrupts_deferred;
389 387
390/* If we support a window system, turn on the code to poll periodically 388/* If we support a window system, turn on the code to poll periodically
391 to detect C-g. It isn't actually used when doing interrupt input. */ 389 to detect C-g. It isn't actually used when doing interrupt input. */
392#if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS) 390#ifdef HAVE_WINDOW_SYSTEM
393#define POLL_FOR_INPUT 391#define POLL_FOR_INPUT
394#endif 392#endif
395 393
@@ -413,7 +411,6 @@ static EMACS_TIME timer_last_idleness_start_time;
413/* Function for init_keyboard to call with no args (if nonzero). */ 411/* Function for init_keyboard to call with no args (if nonzero). */
414static void (*keyboard_init_hook) (void); 412static void (*keyboard_init_hook) (void);
415 413
416static int read_avail_input (void);
417static void get_input_pending (int *, int); 414static void get_input_pending (int *, int);
418static int readable_events (int); 415static int readable_events (int);
419static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, 416static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *,
@@ -440,7 +437,7 @@ static Lisp_Object restore_kboard_configuration (Lisp_Object);
440#ifdef USABLE_SIGIO 437#ifdef USABLE_SIGIO
441static void deliver_input_available_signal (int signo); 438static void deliver_input_available_signal (int signo);
442#endif 439#endif
443static void handle_interrupt (void); 440static void handle_interrupt (bool);
444static _Noreturn void quit_throw_to_read_char (int); 441static _Noreturn void quit_throw_to_read_char (int);
445static void process_special_events (void); 442static void process_special_events (void);
446static void timer_start_idle (void); 443static void timer_start_idle (void);
@@ -823,7 +820,7 @@ This function is called by the editor initialization to begin editing. */)
823 820
824 /* If we enter while input is blocked, don't lock up here. 821 /* If we enter while input is blocked, don't lock up here.
825 This may happen through the debugger during redisplay. */ 822 This may happen through the debugger during redisplay. */
826 if (INPUT_BLOCKED_P) 823 if (input_blocked_p ())
827 return Qnil; 824 return Qnil;
828 825
829 command_loop_level++; 826 command_loop_level++;
@@ -1216,8 +1213,7 @@ This also exits all active minibuffers. */)
1216 1213
1217 /* Unblock input if we enter with input blocked. This may happen if 1214 /* Unblock input if we enter with input blocked. This may happen if
1218 redisplay traps e.g. during tool-bar update with input blocked. */ 1215 redisplay traps e.g. during tool-bar update with input blocked. */
1219 while (INPUT_BLOCKED_P) 1216 totally_unblock_input ();
1220 UNBLOCK_INPUT;
1221 1217
1222 Fthrow (Qtop_level, Qnil); 1218 Fthrow (Qtop_level, Qnil);
1223} 1219}
@@ -1460,15 +1456,6 @@ command_loop_1 (void)
1460 } 1456 }
1461 } 1457 }
1462 1458
1463#if 0
1464 /* Select the frame that the last event came from. Usually,
1465 switch-frame events will take care of this, but if some lisp
1466 code swallows a switch-frame event, we'll fix things up here.
1467 Is this a good idea? */
1468 if (FRAMEP (internal_last_event_frame)
1469 && !EQ (internal_last_event_frame, selected_frame))
1470 Fselect_frame (internal_last_event_frame, Qnil);
1471#endif
1472 /* If it has changed current-menubar from previous value, 1459 /* If it has changed current-menubar from previous value,
1473 really recompute the menubar from the value. */ 1460 really recompute the menubar from the value. */
1474 if (! NILP (Vlucid_menu_bar_dirty_flag) 1461 if (! NILP (Vlucid_menu_bar_dirty_flag)
@@ -2008,9 +1995,9 @@ static struct atimer *poll_timer;
2008void 1995void
2009poll_for_input_1 (void) 1996poll_for_input_1 (void)
2010{ 1997{
2011 if (interrupt_input_blocked == 0 1998 if (! input_blocked_p ()
2012 && !waiting_for_input) 1999 && !waiting_for_input)
2013 read_avail_input (); 2000 gobble_input ();
2014} 2001}
2015 2002
2016/* Timer callback function for poll_timer. TIMER is equal to 2003/* Timer callback function for poll_timer. TIMER is equal to
@@ -2020,10 +2007,7 @@ static void
2020poll_for_input (struct atimer *timer) 2007poll_for_input (struct atimer *timer)
2021{ 2008{
2022 if (poll_suppress_count == 0) 2009 if (poll_suppress_count == 0)
2023 { 2010 pending_signals = 1;
2024 interrupt_input_pending = 1;
2025 pending_signals = 1;
2026 }
2027} 2011}
2028 2012
2029#endif /* POLL_FOR_INPUT */ 2013#endif /* POLL_FOR_INPUT */
@@ -3344,7 +3328,7 @@ record_char (Lisp_Object c)
3344 If you, dear reader, have a better idea, you've got the source. :-) */ 3328 If you, dear reader, have a better idea, you've got the source. :-) */
3345 if (dribble) 3329 if (dribble)
3346 { 3330 {
3347 BLOCK_INPUT; 3331 block_input ();
3348 if (INTEGERP (c)) 3332 if (INTEGERP (c))
3349 { 3333 {
3350 if (XUINT (c) < 0x100) 3334 if (XUINT (c) < 0x100)
@@ -3370,7 +3354,7 @@ record_char (Lisp_Object c)
3370 } 3354 }
3371 3355
3372 fflush (dribble); 3356 fflush (dribble);
3373 UNBLOCK_INPUT; 3357 unblock_input ();
3374 } 3358 }
3375} 3359}
3376 3360
@@ -3514,10 +3498,8 @@ kbd_buffer_store_event (register struct input_event *event)
3514 Else, if EVENT is a quit event, store the quit event 3498 Else, if EVENT is a quit event, store the quit event
3515 in HOLD_QUIT, and return (thus ignoring further events). 3499 in HOLD_QUIT, and return (thus ignoring further events).
3516 3500
3517 This is used in read_avail_input to postpone the processing 3501 This is used to postpone the processing of the quit event until all
3518 of the quit event until all subsequent input events have been 3502 subsequent input events have been parsed (and discarded). */
3519 parsed (and discarded).
3520 */
3521 3503
3522void 3504void
3523kbd_buffer_store_event_hold (register struct input_event *event, 3505kbd_buffer_store_event_hold (register struct input_event *event,
@@ -3587,7 +3569,8 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3587 } 3569 }
3588 3570
3589 last_event_timestamp = event->timestamp; 3571 last_event_timestamp = event->timestamp;
3590 handle_interrupt (); 3572
3573 handle_interrupt (0);
3591 return; 3574 return;
3592 } 3575 }
3593 3576
@@ -3643,7 +3626,6 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3643 if (immediate_quit && NILP (Vinhibit_quit)) 3626 if (immediate_quit && NILP (Vinhibit_quit))
3644 { 3627 {
3645 immediate_quit = 0; 3628 immediate_quit = 0;
3646 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
3647 QUIT; 3629 QUIT;
3648 } 3630 }
3649 } 3631 }
@@ -3793,14 +3775,6 @@ kbd_buffer_get_event (KBOARD **kbp,
3793 /* Start reading input again, we have processed enough so we can 3775 /* Start reading input again, we have processed enough so we can
3794 accept new events again. */ 3776 accept new events again. */
3795 unhold_keyboard_input (); 3777 unhold_keyboard_input ();
3796#ifdef USABLE_SIGIO
3797 if (!noninteractive)
3798 {
3799 struct sigaction action;
3800 emacs_sigaction_init (&action, deliver_input_available_signal);
3801 sigaction (SIGIO, &action, 0);
3802 }
3803#endif
3804 start_polling (); 3778 start_polling ();
3805 } 3779 }
3806#endif /* subprocesses */ 3780#endif /* subprocesses */
@@ -3869,7 +3843,7 @@ kbd_buffer_get_event (KBOARD **kbp,
3869 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); 3843 wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0);
3870 3844
3871 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) 3845 if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr)
3872 read_avail_input (); 3846 gobble_input ();
3873 } 3847 }
3874 3848
3875 if (CONSP (Vunread_command_events)) 3849 if (CONSP (Vunread_command_events))
@@ -4496,6 +4470,9 @@ timer_check (void)
4496 Lisp_Object timers, idle_timers; 4470 Lisp_Object timers, idle_timers;
4497 struct gcpro gcpro1, gcpro2; 4471 struct gcpro gcpro1, gcpro2;
4498 4472
4473 Lisp_Object tem = Vinhibit_quit;
4474 Vinhibit_quit = Qt;
4475
4499 /* We use copies of the timers' lists to allow a timer to add itself 4476 /* We use copies of the timers' lists to allow a timer to add itself
4500 again, without locking up Emacs if the newly added timer is 4477 again, without locking up Emacs if the newly added timer is
4501 already ripe when added. */ 4478 already ripe when added. */
@@ -4508,6 +4485,8 @@ timer_check (void)
4508 else 4485 else
4509 idle_timers = Qnil; 4486 idle_timers = Qnil;
4510 4487
4488 Vinhibit_quit = tem;
4489
4511 GCPRO2 (timers, idle_timers); 4490 GCPRO2 (timers, idle_timers);
4512 4491
4513 do 4492 do
@@ -6747,41 +6726,6 @@ get_input_pending (int *addr, int flags)
6747 *addr = (!NILP (Vquit_flag) || readable_events (flags)); 6726 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6748} 6727}
6749 6728
6750/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */
6751
6752void
6753gobble_input (void)
6754{
6755#ifdef USABLE_SIGIO
6756 if (interrupt_input)
6757 {
6758 sigset_t blocked, procmask;
6759 sigemptyset (&blocked);
6760 sigaddset (&blocked, SIGIO);
6761 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6762 read_avail_input ();
6763 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6764 }
6765 else
6766#ifdef POLL_FOR_INPUT
6767 /* XXX This condition was (read_socket_hook && !interrupt_input),
6768 but read_socket_hook is not global anymore. Let's pretend that
6769 it's always set. */
6770 if (!interrupt_input && poll_suppress_count == 0)
6771 {
6772 sigset_t blocked, procmask;
6773 sigemptyset (&blocked);
6774 sigaddset (&blocked, SIGALRM);
6775 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6776 read_avail_input ();
6777 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6778 }
6779 else
6780#endif
6781#endif
6782 read_avail_input ();
6783}
6784
6785/* Put a BUFFER_SWITCH_EVENT in the buffer 6729/* Put a BUFFER_SWITCH_EVENT in the buffer
6786 so that read_key_sequence will notice the new current buffer. */ 6730 so that read_key_sequence will notice the new current buffer. */
6787 6731
@@ -6809,14 +6753,7 @@ record_asynch_buffer_change (void)
6809 /* Make sure no interrupt happens while storing the event. */ 6753 /* Make sure no interrupt happens while storing the event. */
6810#ifdef USABLE_SIGIO 6754#ifdef USABLE_SIGIO
6811 if (interrupt_input) 6755 if (interrupt_input)
6812 { 6756 kbd_buffer_store_event (&event);
6813 sigset_t blocked, procmask;
6814 sigemptyset (&blocked);
6815 sigaddset (&blocked, SIGIO);
6816 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
6817 kbd_buffer_store_event (&event);
6818 pthread_sigmask (SIG_SETMASK, &procmask, 0);
6819 }
6820 else 6757 else
6821#endif 6758#endif
6822 { 6759 {
@@ -6829,13 +6766,11 @@ record_asynch_buffer_change (void)
6829/* Read any terminal input already buffered up by the system 6766/* Read any terminal input already buffered up by the system
6830 into the kbd_buffer, but do not wait. 6767 into the kbd_buffer, but do not wait.
6831 6768
6832 EXPECTED should be nonzero if the caller knows there is some input. 6769 Return the number of keyboard chars read, or -1 meaning
6833
6834 Returns the number of keyboard chars read, or -1 meaning
6835 this is a bad time to try to read input. */ 6770 this is a bad time to try to read input. */
6836 6771
6837static int 6772int
6838read_avail_input (void) 6773gobble_input (void)
6839{ 6774{
6840 int nread = 0; 6775 int nread = 0;
6841 int err = 0; 6776 int err = 0;
@@ -6855,11 +6790,17 @@ read_avail_input (void)
6855 int nr; 6790 int nr;
6856 struct input_event hold_quit; 6791 struct input_event hold_quit;
6857 6792
6793 if (input_blocked_p ())
6794 {
6795 pending_signals = 1;
6796 break;
6797 }
6798
6858 EVENT_INIT (hold_quit); 6799 EVENT_INIT (hold_quit);
6859 hold_quit.kind = NO_EVENT; 6800 hold_quit.kind = NO_EVENT;
6860 6801
6861 /* No need for FIONREAD or fcntl; just say don't wait. */ 6802 /* No need for FIONREAD or fcntl; just say don't wait. */
6862 while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit))) 6803 while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit)))
6863 nread += nr; 6804 nread += nr;
6864 6805
6865 if (nr == -1) /* Not OK to read input now. */ 6806 if (nr == -1) /* Not OK to read input now. */
@@ -6880,7 +6821,7 @@ read_avail_input (void)
6880 this process rather than to the whole process 6821 this process rather than to the whole process
6881 group? Perhaps on systems with FIONREAD Emacs is 6822 group? Perhaps on systems with FIONREAD Emacs is
6882 alone in its group. */ 6823 alone in its group. */
6883 kill (getpid (), SIGHUP); 6824 terminate_due_to_signal (SIGHUP, 10);
6884 6825
6885 /* XXX Is calling delete_terminal safe here? It calls delete_frame. */ 6826 /* XXX Is calling delete_terminal safe here? It calls delete_frame. */
6886 { 6827 {
@@ -7169,34 +7110,68 @@ tty_read_avail_input (struct terminal *terminal,
7169static void 7110static void
7170handle_async_input (void) 7111handle_async_input (void)
7171{ 7112{
7172 interrupt_input_pending = 0; 7113#ifdef USABLE_SIGIO
7173 pending_signals = pending_atimers;
7174
7175 while (1) 7114 while (1)
7176 { 7115 {
7177 int nread = read_avail_input (); 7116 int nread = gobble_input ();
7178 /* -1 means it's not ok to read the input now. 7117 /* -1 means it's not ok to read the input now.
7179 UNBLOCK_INPUT will read it later; now, avoid infinite loop. 7118 UNBLOCK_INPUT will read it later; now, avoid infinite loop.
7180 0 means there was no keyboard input available. */ 7119 0 means there was no keyboard input available. */
7181 if (nread <= 0) 7120 if (nread <= 0)
7182 break; 7121 break;
7183 } 7122 }
7123#endif
7184} 7124}
7185 7125
7186void 7126void
7187process_pending_signals (void) 7127process_pending_signals (void)
7188{ 7128{
7189 if (interrupt_input_pending) 7129 pending_signals = 0;
7190 handle_async_input (); 7130 handle_async_input ();
7191 do_pending_atimers (); 7131 do_pending_atimers ();
7192} 7132}
7193 7133
7134/* Undo any number of BLOCK_INPUT calls down to level LEVEL,
7135 and also (if the level is now 0) reinvoke any pending signal. */
7136
7137void
7138unblock_input_to (int level)
7139{
7140 interrupt_input_blocked = level;
7141 if (level == 0)
7142 {
7143 if (pending_signals)
7144 process_pending_signals ();
7145 }
7146 else if (level < 0)
7147 emacs_abort ();
7148}
7149
7150/* End critical section.
7151
7152 If doing signal-driven input, and a signal came in when input was
7153 blocked, reinvoke the signal handler now to deal with it. */
7154
7155void
7156unblock_input (void)
7157{
7158 unblock_input_to (interrupt_input_blocked - 1);
7159}
7160
7161/* Undo any number of BLOCK_INPUT calls,
7162 and also reinvoke any pending signal. */
7163
7164void
7165totally_unblock_input (void)
7166{
7167 unblock_input_to (0);
7168}
7169
7194#ifdef USABLE_SIGIO 7170#ifdef USABLE_SIGIO
7195 7171
7196static void 7172void
7197handle_input_available_signal (int sig) 7173handle_input_available_signal (int sig)
7198{ 7174{
7199 interrupt_input_pending = 1;
7200 pending_signals = 1; 7175 pending_signals = 1;
7201 7176
7202 if (input_available_clear_time) 7177 if (input_available_clear_time)
@@ -7206,25 +7181,10 @@ handle_input_available_signal (int sig)
7206static void 7181static void
7207deliver_input_available_signal (int sig) 7182deliver_input_available_signal (int sig)
7208{ 7183{
7209 handle_on_main_thread (sig, handle_input_available_signal); 7184 deliver_process_signal (sig, handle_input_available_signal);
7210} 7185}
7211#endif /* USABLE_SIGIO */ 7186#endif /* USABLE_SIGIO */
7212 7187
7213/* Send ourselves a SIGIO.
7214
7215 This function exists so that the UNBLOCK_INPUT macro in
7216 blockinput.h can have some way to take care of input we put off
7217 dealing with, without assuming that every file which uses
7218 UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */
7219void
7220reinvoke_input_signal (void)
7221{
7222#ifdef USABLE_SIGIO
7223 handle_async_input ();
7224#endif
7225}
7226
7227
7228 7188
7229/* User signal events. */ 7189/* User signal events. */
7230 7190
@@ -7295,7 +7255,7 @@ handle_user_signal (int sig)
7295 p->npending++; 7255 p->npending++;
7296#ifdef USABLE_SIGIO 7256#ifdef USABLE_SIGIO
7297 if (interrupt_input) 7257 if (interrupt_input)
7298 kill (getpid (), SIGIO); 7258 handle_input_available_signal (sig);
7299 else 7259 else
7300#endif 7260#endif
7301 { 7261 {
@@ -7311,7 +7271,7 @@ handle_user_signal (int sig)
7311static void 7271static void
7312deliver_user_signal (int sig) 7272deliver_user_signal (int sig)
7313{ 7273{
7314 handle_on_main_thread (sig, handle_user_signal); 7274 deliver_process_signal (sig, handle_user_signal);
7315} 7275}
7316 7276
7317static char * 7277static char *
@@ -7336,8 +7296,6 @@ store_user_signal_events (void)
7336 for (p = user_signals; p; p = p->next) 7296 for (p = user_signals; p; p = p->next)
7337 if (p->npending > 0) 7297 if (p->npending > 0)
7338 { 7298 {
7339 sigset_t blocked, procmask;
7340
7341 if (! buf_initialized) 7299 if (! buf_initialized)
7342 { 7300 {
7343 memset (&buf, 0, sizeof buf); 7301 memset (&buf, 0, sizeof buf);
@@ -7346,10 +7304,6 @@ store_user_signal_events (void)
7346 buf_initialized = 1; 7304 buf_initialized = 1;
7347 } 7305 }
7348 7306
7349 sigemptyset (&blocked);
7350 sigaddset (&blocked, p->sig);
7351 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
7352
7353 do 7307 do
7354 { 7308 {
7355 buf.code = p->sig; 7309 buf.code = p->sig;
@@ -7357,8 +7311,6 @@ store_user_signal_events (void)
7357 p->npending--; 7311 p->npending--;
7358 } 7312 }
7359 while (p->npending > 0); 7313 while (p->npending > 0);
7360
7361 pthread_sigmask (SIG_SETMASK, &procmask, 0);
7362 } 7314 }
7363} 7315}
7364 7316
@@ -10563,9 +10515,9 @@ The file will be closed when Emacs exits. */)
10563{ 10515{
10564 if (dribble) 10516 if (dribble)
10565 { 10517 {
10566 BLOCK_INPUT; 10518 block_input ();
10567 fclose (dribble); 10519 fclose (dribble);
10568 UNBLOCK_INPUT; 10520 unblock_input ();
10569 dribble = 0; 10521 dribble = 0;
10570 } 10522 }
10571 if (!NILP (file)) 10523 if (!NILP (file))
@@ -10754,21 +10706,21 @@ handle_interrupt_signal (int sig)
10754 from the controlling tty. */ 10706 from the controlling tty. */
10755 internal_last_event_frame = terminal->display_info.tty->top_frame; 10707 internal_last_event_frame = terminal->display_info.tty->top_frame;
10756 10708
10757 handle_interrupt (); 10709 handle_interrupt (1);
10758 } 10710 }
10759} 10711}
10760 10712
10761static void 10713static void
10762deliver_interrupt_signal (int sig) 10714deliver_interrupt_signal (int sig)
10763{ 10715{
10764 handle_on_main_thread (sig, handle_interrupt_signal); 10716 deliver_process_signal (sig, handle_interrupt_signal);
10765} 10717}
10766 10718
10767 10719
10768/* If Emacs is stuck because `inhibit-quit' is true, then keep track 10720/* If Emacs is stuck because `inhibit-quit' is true, then keep track
10769 of the number of times C-g has been requested. If C-g is pressed 10721 of the number of times C-g has been requested. If C-g is pressed
10770 enough times, then quit anyway. See bug#6585. */ 10722 enough times, then quit anyway. See bug#6585. */
10771static int force_quit_count; 10723static int volatile force_quit_count;
10772 10724
10773/* This routine is called at interrupt level in response to C-g. 10725/* This routine is called at interrupt level in response to C-g.
10774 10726
@@ -10782,7 +10734,7 @@ static int force_quit_count;
10782 non-nil, it stops the job right away. */ 10734 non-nil, it stops the job right away. */
10783 10735
10784static void 10736static void
10785handle_interrupt (void) 10737handle_interrupt (bool in_signal_handler)
10786{ 10738{
10787 char c; 10739 char c;
10788 10740
@@ -10791,13 +10743,16 @@ handle_interrupt (void)
10791 /* XXX This code needs to be revised for multi-tty support. */ 10743 /* XXX This code needs to be revised for multi-tty support. */
10792 if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty")) 10744 if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty"))
10793 { 10745 {
10794 /* If SIGINT isn't blocked, don't let us be interrupted by 10746 if (! in_signal_handler)
10795 another SIGINT, it might be harmful due to non-reentrancy 10747 {
10796 in I/O functions. */ 10748 /* If SIGINT isn't blocked, don't let us be interrupted by
10797 sigset_t blocked; 10749 a SIGINT. It might be harmful due to non-reentrancy
10798 sigemptyset (&blocked); 10750 in I/O functions. */
10799 sigaddset (&blocked, SIGINT); 10751 sigset_t blocked;
10800 pthread_sigmask (SIG_BLOCK, &blocked, 0); 10752 sigemptyset (&blocked);
10753 sigaddset (&blocked, SIGINT);
10754 pthread_sigmask (SIG_BLOCK, &blocked, 0);
10755 }
10801 10756
10802 fflush (stdout); 10757 fflush (stdout);
10803 reset_all_sys_modes (); 10758 reset_all_sys_modes ();
@@ -10868,7 +10823,6 @@ handle_interrupt (void)
10868#endif /* not MSDOS */ 10823#endif /* not MSDOS */
10869 fflush (stdout); 10824 fflush (stdout);
10870 init_all_sys_modes (); 10825 init_all_sys_modes ();
10871 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
10872 } 10826 }
10873 else 10827 else
10874 { 10828 {
@@ -10886,15 +10840,14 @@ handle_interrupt (void)
10886 GCPRO4 (saved.object, saved.global_code, 10840 GCPRO4 (saved.object, saved.global_code,
10887 saved.current_syntax_table, saved.old_prop); 10841 saved.current_syntax_table, saved.old_prop);
10888 Fsignal (Qquit, Qnil); 10842 Fsignal (Qquit, Qnil);
10889 /* FIXME: AFAIK, `quit' can never return, so this code is dead! */
10890 gl_state = saved; 10843 gl_state = saved;
10891 UNGCPRO; 10844 UNGCPRO;
10892 } 10845 }
10893 else 10846 else
10894 { /* Else request quit when it's safe. */ 10847 { /* Else request quit when it's safe. */
10895 if (NILP (Vquit_flag)) 10848 int count = NILP (Vquit_flag) ? 1 : force_quit_count + 1;
10896 force_quit_count = 0; 10849 force_quit_count = count;
10897 if (++force_quit_count == 3) 10850 if (count == 3)
10898 { 10851 {
10899 immediate_quit = 1; 10852 immediate_quit = 1;
10900 Vinhibit_quit = Qnil; 10853 Vinhibit_quit = Qnil;
@@ -10903,6 +10856,8 @@ handle_interrupt (void)
10903 } 10856 }
10904 } 10857 }
10905 10858
10859 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
10860
10906/* TODO: The longjmp in this call throws the NS event loop integration off, 10861/* TODO: The longjmp in this call throws the NS event loop integration off,
10907 and it seems to do fine without this. Probably some attention 10862 and it seems to do fine without this. Probably some attention
10908 needs to be paid to the setting of waiting_for_input in 10863 needs to be paid to the setting of waiting_for_input in
@@ -10912,7 +10867,7 @@ handle_interrupt (void)
10912 separate event loop thread like W32. */ 10867 separate event loop thread like W32. */
10913#ifndef HAVE_NS 10868#ifndef HAVE_NS
10914 if (waiting_for_input && !echoing) 10869 if (waiting_for_input && !echoing)
10915 quit_throw_to_read_char (1); 10870 quit_throw_to_read_char (in_signal_handler);
10916#endif 10871#endif
10917} 10872}
10918 10873
@@ -10926,22 +10881,12 @@ quit_throw_to_read_char (int from_signal)
10926 if (!from_signal && EQ (Vquit_flag, Qkill_emacs)) 10881 if (!from_signal && EQ (Vquit_flag, Qkill_emacs))
10927 Fkill_emacs (Qnil); 10882 Fkill_emacs (Qnil);
10928 10883
10929 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
10930 /* Prevent another signal from doing this before we finish. */ 10884 /* Prevent another signal from doing this before we finish. */
10931 clear_waiting_for_input (); 10885 clear_waiting_for_input ();
10932 input_pending = 0; 10886 input_pending = 0;
10933 10887
10934 Vunread_command_events = Qnil; 10888 Vunread_command_events = Qnil;
10935 10889
10936#if 0 /* Currently, sit_for is called from read_char without turning
10937 off polling. And that can call set_waiting_for_input.
10938 It seems to be harmless. */
10939#ifdef POLL_FOR_INPUT
10940 /* May be > 1 if in recursive minibuffer. */
10941 if (poll_suppress_count == 0)
10942 emacs_abort ();
10943#endif
10944#endif
10945 if (FRAMEP (internal_last_event_frame) 10890 if (FRAMEP (internal_last_event_frame)
10946 && !EQ (internal_last_event_frame, selected_frame)) 10891 && !EQ (internal_last_event_frame, selected_frame))
10947 do_switch_frame (make_lispy_switch_frame (internal_last_event_frame), 10892 do_switch_frame (make_lispy_switch_frame (internal_last_event_frame),
@@ -11332,7 +11277,6 @@ init_keyboard (void)
11332#endif 11277#endif
11333 input_pending = 0; 11278 input_pending = 0;
11334 interrupt_input_blocked = 0; 11279 interrupt_input_blocked = 0;
11335 interrupt_input_pending = 0;
11336 pending_signals = 0; 11280 pending_signals = 0;
11337 11281
11338 /* This means that command_loop_1 won't try to select anything the first 11282 /* This means that command_loop_1 won't try to select anything the first
@@ -11353,7 +11297,7 @@ init_keyboard (void)
11353 /* Before multi-tty support, these handlers used to be installed 11297 /* Before multi-tty support, these handlers used to be installed
11354 only if the current session was a tty session. Now an Emacs 11298 only if the current session was a tty session. Now an Emacs
11355 session may have multiple display types, so we always handle 11299 session may have multiple display types, so we always handle
11356 SIGINT. There is special code in interrupt_signal to exit 11300 SIGINT. There is special code in handle_interrupt_signal to exit
11357 Emacs on SIGINT when there are no termcap frames on the 11301 Emacs on SIGINT when there are no termcap frames on the
11358 controlling terminal. */ 11302 controlling terminal. */
11359 struct sigaction action; 11303 struct sigaction action;
diff --git a/src/keyboard.h b/src/keyboard.h
index 3601f68be9f..bc35bba4ecc 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -523,7 +523,7 @@ extern void input_poll_signal (int);
523extern void start_polling (void); 523extern void start_polling (void);
524extern void stop_polling (void); 524extern void stop_polling (void);
525extern void set_poll_suppress_count (int); 525extern void set_poll_suppress_count (int);
526extern void gobble_input (void); 526extern int gobble_input (void);
527extern int input_polling_used (void); 527extern int input_polling_used (void);
528extern void clear_input_pending (void); 528extern void clear_input_pending (void);
529extern int requeued_events_pending_p (void); 529extern int requeued_events_pending_p (void);
diff --git a/src/keymap.c b/src/keymap.c
index 66fb52061f9..6ea142651bf 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1477,7 +1477,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
1477 1477
1478 /* Use malloc here. See the comment above this function. 1478 /* Use malloc here. See the comment above this function.
1479 Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */ 1479 Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */
1480 BLOCK_INPUT; 1480 block_input ();
1481 newmodes = malloc (allocsize); 1481 newmodes = malloc (allocsize);
1482 if (newmodes) 1482 if (newmodes)
1483 { 1483 {
@@ -1501,7 +1501,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
1501 } 1501 }
1502 cmm_maps = newmaps; 1502 cmm_maps = newmaps;
1503 } 1503 }
1504 UNBLOCK_INPUT; 1504 unblock_input ();
1505 1505
1506 if (newmodes == NULL || newmaps == NULL) 1506 if (newmodes == NULL || newmaps == NULL)
1507 break; 1507 break;
diff --git a/src/lisp.h b/src/lisp.h
index 3a473a60b48..c3cabe0af29 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -25,6 +25,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
25#include <stdarg.h> 25#include <stdarg.h>
26#include <stdbool.h> 26#include <stdbool.h>
27#include <stddef.h> 27#include <stddef.h>
28#include <float.h>
28#include <inttypes.h> 29#include <inttypes.h>
29#include <limits.h> 30#include <limits.h>
30 31
@@ -1487,6 +1488,16 @@ struct Lisp_Float
1487#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data) 1488#define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data)
1488#define XFLOAT_INIT(f, n) (XFLOAT (f)->u.data = (n)) 1489#define XFLOAT_INIT(f, n) (XFLOAT (f)->u.data = (n))
1489 1490
1491/* Most hosts nowadays use IEEE floating point, so they use IEC 60559
1492 representations, have infinities and NaNs, and do not trap on
1493 exceptions. Define IEEE_FLOATING_POINT if this host is one of the
1494 typical ones. The C11 macro __STDC_IEC_559__ is close to what is
1495 wanted here, but is not quite right because Emacs does not require
1496 all the features of C11 Annex F (and does not require C11 at all,
1497 for that matter). */
1498#define IEEE_FLOATING_POINT (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
1499 && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
1500
1490/* A character, declared with the following typedef, is a member 1501/* A character, declared with the following typedef, is a member
1491 of some character set associated with the current buffer. */ 1502 of some character set associated with the current buffer. */
1492#ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ 1503#ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */
@@ -2020,6 +2031,18 @@ extern ptrdiff_t specpdl_size;
2020 2031
2021#define SPECPDL_INDEX() (specpdl_ptr - specpdl) 2032#define SPECPDL_INDEX() (specpdl_ptr - specpdl)
2022 2033
2034struct backtrace
2035{
2036 struct backtrace *next;
2037 Lisp_Object function;
2038 Lisp_Object *args; /* Points to vector of args. */
2039 ptrdiff_t nargs; /* Length of vector. */
2040 /* Nonzero means call value of debugger when done with this operation. */
2041 unsigned int debug_on_exit : 1;
2042};
2043
2044extern struct backtrace *backtrace_list;
2045
2023/* Everything needed to describe an active condition case. 2046/* Everything needed to describe an active condition case.
2024 2047
2025 Members are volatile if their values need to survive _longjmp when 2048 Members are volatile if their values need to survive _longjmp when
@@ -2108,7 +2131,7 @@ extern char *stack_bottom;
2108 a request to exit Emacs when it is safe to do. */ 2131 a request to exit Emacs when it is safe to do. */
2109 2132
2110extern void process_pending_signals (void); 2133extern void process_pending_signals (void);
2111extern int pending_signals; 2134extern int volatile pending_signals;
2112 2135
2113extern void process_quit_flag (void); 2136extern void process_quit_flag (void);
2114#define QUIT \ 2137#define QUIT \
@@ -2633,7 +2656,6 @@ extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
2633extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); 2656extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
2634extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool); 2657extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
2635extern void syms_of_data (void); 2658extern void syms_of_data (void);
2636extern void init_data (void);
2637extern void swap_in_global_binding (struct Lisp_Symbol *); 2659extern void swap_in_global_binding (struct Lisp_Symbol *);
2638 2660
2639/* Defined in cmds.c */ 2661/* Defined in cmds.c */
@@ -2721,6 +2743,7 @@ extern void init_fringe_once (void);
2721extern Lisp_Object QCascent, QCmargin, QCrelief; 2743extern Lisp_Object QCascent, QCmargin, QCrelief;
2722extern Lisp_Object QCconversion; 2744extern Lisp_Object QCconversion;
2723extern int x_bitmap_mask (struct frame *, ptrdiff_t); 2745extern int x_bitmap_mask (struct frame *, ptrdiff_t);
2746extern void reset_image_types (void);
2724extern void syms_of_image (void); 2747extern void syms_of_image (void);
2725 2748
2726/* Defined in insdel.c. */ 2749/* Defined in insdel.c. */
@@ -2905,6 +2928,7 @@ build_string (const char *str)
2905 2928
2906extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); 2929extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
2907extern void make_byte_code (struct Lisp_Vector *); 2930extern void make_byte_code (struct Lisp_Vector *);
2931extern Lisp_Object Qautomatic_gc;
2908extern Lisp_Object Qchar_table_extra_slots; 2932extern Lisp_Object Qchar_table_extra_slots;
2909extern struct Lisp_Vector *allocate_vector (EMACS_INT); 2933extern struct Lisp_Vector *allocate_vector (EMACS_INT);
2910extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, int tag); 2934extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, int tag);
@@ -3227,6 +3251,9 @@ extern int input_pending;
3227extern Lisp_Object menu_bar_items (Lisp_Object); 3251extern Lisp_Object menu_bar_items (Lisp_Object);
3228extern Lisp_Object tool_bar_items (Lisp_Object, int *); 3252extern Lisp_Object tool_bar_items (Lisp_Object, int *);
3229extern void discard_mouse_events (void); 3253extern void discard_mouse_events (void);
3254#ifdef USABLE_SIGIO
3255void handle_input_available_signal (int);
3256#endif
3230extern Lisp_Object pending_funcalls; 3257extern Lisp_Object pending_funcalls;
3231extern int detect_input_pending (void); 3258extern int detect_input_pending (void);
3232extern int detect_input_pending_ignore_squeezables (void); 3259extern int detect_input_pending_ignore_squeezables (void);
@@ -3244,7 +3271,7 @@ extern void keys_of_keyboard (void);
3244/* Defined in indent.c. */ 3271/* Defined in indent.c. */
3245extern ptrdiff_t current_column (void); 3272extern ptrdiff_t current_column (void);
3246extern void invalidate_current_column (void); 3273extern void invalidate_current_column (void);
3247extern int indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT); 3274extern bool indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT);
3248extern void syms_of_indent (void); 3275extern void syms_of_indent (void);
3249 3276
3250/* Defined in frame.c. */ 3277/* Defined in frame.c. */
@@ -3269,8 +3296,11 @@ extern bool display_arg;
3269extern Lisp_Object decode_env_path (const char *, const char *); 3296extern Lisp_Object decode_env_path (const char *, const char *);
3270extern Lisp_Object empty_unibyte_string, empty_multibyte_string; 3297extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
3271extern Lisp_Object Qfile_name_handler_alist; 3298extern Lisp_Object Qfile_name_handler_alist;
3272extern _Noreturn void fatal_error_backtrace (int, int); 3299extern _Noreturn void terminate_due_to_signal (int, int);
3273extern Lisp_Object Qkill_emacs; 3300extern Lisp_Object Qkill_emacs;
3301#ifdef WINDOWSNT
3302extern Lisp_Object Vlibrary_cache;
3303#endif
3274#if HAVE_SETLOCALE 3304#if HAVE_SETLOCALE
3275void fixup_locale (void); 3305void fixup_locale (void);
3276void synchronize_system_messages_locale (void); 3306void synchronize_system_messages_locale (void);
@@ -3407,8 +3437,6 @@ extern void init_sys_modes (struct tty_display_info *);
3407extern void reset_sys_modes (struct tty_display_info *); 3437extern void reset_sys_modes (struct tty_display_info *);
3408extern void init_all_sys_modes (void); 3438extern void init_all_sys_modes (void);
3409extern void reset_all_sys_modes (void); 3439extern void reset_all_sys_modes (void);
3410extern void wait_for_termination (pid_t);
3411extern void interruptible_wait_for_termination (pid_t);
3412extern void flush_pending_output (int) ATTRIBUTE_CONST; 3440extern void flush_pending_output (int) ATTRIBUTE_CONST;
3413extern void child_setup_tty (int); 3441extern void child_setup_tty (int);
3414extern void setup_pty (int); 3442extern void setup_pty (int);
@@ -3519,6 +3547,13 @@ extern int have_menus_p (void);
3519void syms_of_dbusbind (void); 3547void syms_of_dbusbind (void);
3520#endif 3548#endif
3521 3549
3550
3551/* Defined in profiler.c. */
3552extern bool profiler_memory_running;
3553extern void malloc_probe (size_t);
3554extern void syms_of_profiler (void);
3555
3556
3522#ifdef DOS_NT 3557#ifdef DOS_NT
3523/* Defined in msdos.c, w32.c. */ 3558/* Defined in msdos.c, w32.c. */
3524extern char *emacs_root_dir (void); 3559extern char *emacs_root_dir (void);
diff --git a/src/lread.c b/src/lread.c
index 08d5f97292b..d22011be7c8 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -408,9 +408,9 @@ unreadchar (Lisp_Object readcharfun, int c)
408 { 408 {
409 if (load_each_byte) 409 if (load_each_byte)
410 { 410 {
411 BLOCK_INPUT; 411 block_input ();
412 ungetc (c, instream); 412 ungetc (c, instream);
413 UNBLOCK_INPUT; 413 unblock_input ();
414 } 414 }
415 else 415 else
416 unread_char = c; 416 unread_char = c;
@@ -431,28 +431,28 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
431{ 431{
432 if (c >= 0) 432 if (c >= 0)
433 { 433 {
434 BLOCK_INPUT; 434 block_input ();
435 ungetc (c, instream); 435 ungetc (c, instream);
436 UNBLOCK_INPUT; 436 unblock_input ();
437 return 0; 437 return 0;
438 } 438 }
439 439
440 BLOCK_INPUT; 440 block_input ();
441 c = getc (instream); 441 c = getc (instream);
442 442
443#ifdef EINTR 443#ifdef EINTR
444 /* Interrupted reads have been observed while reading over the network. */ 444 /* Interrupted reads have been observed while reading over the network. */
445 while (c == EOF && ferror (instream) && errno == EINTR) 445 while (c == EOF && ferror (instream) && errno == EINTR)
446 { 446 {
447 UNBLOCK_INPUT; 447 unblock_input ();
448 QUIT; 448 QUIT;
449 BLOCK_INPUT; 449 block_input ();
450 clearerr (instream); 450 clearerr (instream);
451 c = getc (instream); 451 c = getc (instream);
452 } 452 }
453#endif 453#endif
454 454
455 UNBLOCK_INPUT; 455 unblock_input ();
456 456
457 return (c == EOF ? -1 : c); 457 return (c == EOF ? -1 : c);
458} 458}
@@ -753,9 +753,9 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
753 (void) 753 (void)
754{ 754{
755 register Lisp_Object val; 755 register Lisp_Object val;
756 BLOCK_INPUT; 756 block_input ();
757 XSETINT (val, getc (instream)); 757 XSETINT (val, getc (instream));
758 UNBLOCK_INPUT; 758 unblock_input ();
759 return val; 759 return val;
760} 760}
761 761
@@ -764,13 +764,30 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
764 764
765/* Return true if the lisp code read using READCHARFUN defines a non-nil 765/* Return true if the lisp code read using READCHARFUN defines a non-nil
766 `lexical-binding' file variable. After returning, the stream is 766 `lexical-binding' file variable. After returning, the stream is
767 positioned following the first line, if it is a comment, otherwise 767 positioned following the first line, if it is a comment or #! line,
768 nothing is read. */ 768 otherwise nothing is read. */
769 769
770static int 770static int
771lisp_file_lexically_bound_p (Lisp_Object readcharfun) 771lisp_file_lexically_bound_p (Lisp_Object readcharfun)
772{ 772{
773 int ch = READCHAR; 773 int ch = READCHAR;
774
775 if (ch == '#')
776 {
777 ch = READCHAR;
778 if (ch != '!')
779 {
780 UNREAD (ch);
781 UNREAD ('#');
782 return 0;
783 }
784 while (ch != '\n' && ch != EOF)
785 ch = READCHAR;
786 if (ch == '\n') ch = READCHAR;
787 /* It is OK to leave the position after a #! line, since
788 that is what read1 does. */
789 }
790
774 if (ch != ';') 791 if (ch != ';')
775 /* The first line isn't a comment, just give up. */ 792 /* The first line isn't a comment, just give up. */
776 { 793 {
@@ -1350,9 +1367,9 @@ load_unwind (Lisp_Object arg) /* Used as unwind-protect function in load. */
1350 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; 1367 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
1351 if (stream != NULL) 1368 if (stream != NULL)
1352 { 1369 {
1353 BLOCK_INPUT; 1370 block_input ();
1354 fclose (stream); 1371 fclose (stream);
1355 UNBLOCK_INPUT; 1372 unblock_input ();
1356 } 1373 }
1357 return Qnil; 1374 return Qnil;
1358} 1375}
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 24ecb2676da..3d1464cc742 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -125,6 +125,7 @@ OBJ2 = $(BLD)/sysdep.$(O) \
125 $(BLD)/terminal.$(O) \ 125 $(BLD)/terminal.$(O) \
126 $(BLD)/menu.$(O) \ 126 $(BLD)/menu.$(O) \
127 $(BLD)/xml.$(O) \ 127 $(BLD)/xml.$(O) \
128 $(BLD)/profiler.$(O) \
128 $(BLD)/w32term.$(O) \ 129 $(BLD)/w32term.$(O) \
129 $(BLD)/w32xfns.$(O) \ 130 $(BLD)/w32xfns.$(O) \
130 $(BLD)/w32fns.$(O) \ 131 $(BLD)/w32fns.$(O) \
@@ -222,7 +223,7 @@ GLOBAL_SOURCES = dosfns.c msdos.c \
222 process.c callproc.c unexw32.c \ 223 process.c callproc.c unexw32.c \
223 region-cache.c sound.c atimer.c \ 224 region-cache.c sound.c atimer.c \
224 doprnt.c intervals.c textprop.c composite.c \ 225 doprnt.c intervals.c textprop.c composite.c \
225 gnutls.c xml.c 226 gnutls.c xml.c profiler.c
226SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ 227SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
227 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o 228 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
228obj = $(GLOBAL_SOURCES:.c=.o) 229obj = $(GLOBAL_SOURCES:.c=.o)
@@ -392,8 +393,6 @@ SYSTIME_H = $(SRC)/systime.h \
392ATIMER_H = $(SRC)/atimer.h \ 393ATIMER_H = $(SRC)/atimer.h \
393 $(NT_INC)/stdbool.h \ 394 $(NT_INC)/stdbool.h \
394 $(SYSTIME_H) 395 $(SYSTIME_H)
395BLOCKINPUT_H = $(SRC)/blockinput.h \
396 $(ATIMER_H)
397BUFFER_H = $(SRC)/buffer.h \ 396BUFFER_H = $(SRC)/buffer.h \
398 $(SYSTIME_H) 397 $(SYSTIME_H)
399C_CTYPE_H = $(GNU_LIB)/c-ctype.h \ 398C_CTYPE_H = $(GNU_LIB)/c-ctype.h \
@@ -467,6 +466,8 @@ SOCKET_H = $(NT_INC)/sys/socket.h \
467 $(SRC)/w32.h 466 $(SRC)/w32.h
468STAT_TIME_H = $(GNU_LIB)/stat-time.h \ 467STAT_TIME_H = $(GNU_LIB)/stat-time.h \
469 $(NT_INC)/sys/stat.h 468 $(NT_INC)/sys/stat.h
469SYSSIGNAL_H = $(SRC)/syssignal.h \
470 $(NT_INC)/stdbool.h
470SYSTTY_H = $(SRC)/systty.h \ 471SYSTTY_H = $(SRC)/systty.h \
471 $(NT_INC)/sys/ioctl.h \ 472 $(NT_INC)/sys/ioctl.h \
472 $(NT_INC)/unistd.h 473 $(NT_INC)/unistd.h
@@ -481,11 +482,11 @@ WINDOW_H = $(SRC)/window.h \
481 482
482$(BLD)/alloc.$(O) : \ 483$(BLD)/alloc.$(O) : \
483 $(SRC)/alloc.c \ 484 $(SRC)/alloc.c \
485 $(SRC)/blockinput.h \
484 $(SRC)/puresize.h \ 486 $(SRC)/puresize.h \
485 $(SRC)/w32.h \ 487 $(SRC)/w32.h \
486 $(NT_INC)/unistd.h \ 488 $(NT_INC)/unistd.h \
487 $(GNU_LIB)/verify.h \ 489 $(GNU_LIB)/verify.h \
488 $(BLOCKINPUT_H) \
489 $(BUFFER_H) \ 490 $(BUFFER_H) \
490 $(CHARACTER_H) \ 491 $(CHARACTER_H) \
491 $(CONFIG_H) \ 492 $(CONFIG_H) \
@@ -499,12 +500,12 @@ $(BLD)/alloc.$(O) : \
499 500
500$(BLD)/atimer.$(O) : \ 501$(BLD)/atimer.$(O) : \
501 $(SRC)/atimer.c \ 502 $(SRC)/atimer.c \
502 $(SRC)/syssignal.h \ 503 $(SRC)/blockinput.h \
503 $(NT_INC)/unistd.h \ 504 $(NT_INC)/unistd.h \
504 $(ATIMER_H) \ 505 $(ATIMER_H) \
505 $(BLOCKINPUT_H) \
506 $(CONFIG_H) \ 506 $(CONFIG_H) \
507 $(LISP_H) \ 507 $(LISP_H) \
508 $(SYSSIGNAL_H) \
508 $(SYSTIME_H) 509 $(SYSTIME_H)
509 510
510$(BLD)/bidi.$(O) : \ 511$(BLD)/bidi.$(O) : \
@@ -517,6 +518,7 @@ $(BLD)/bidi.$(O) : \
517 518
518$(BLD)/buffer.$(O) : \ 519$(BLD)/buffer.$(O) : \
519 $(SRC)/buffer.c \ 520 $(SRC)/buffer.c \
521 $(SRC)/blockinput.h \
520 $(SRC)/commands.h \ 522 $(SRC)/commands.h \
521 $(SRC)/indent.h \ 523 $(SRC)/indent.h \
522 $(SRC)/keymap.h \ 524 $(SRC)/keymap.h \
@@ -525,7 +527,6 @@ $(BLD)/buffer.$(O) : \
525 $(NT_INC)/sys/stat.h \ 527 $(NT_INC)/sys/stat.h \
526 $(NT_INC)/unistd.h \ 528 $(NT_INC)/unistd.h \
527 $(GNU_LIB)/verify.h \ 529 $(GNU_LIB)/verify.h \
528 $(BLOCKINPUT_H) \
529 $(BUFFER_H) \ 530 $(BUFFER_H) \
530 $(CHARACTER_H) \ 531 $(CHARACTER_H) \
531 $(CONFIG_H) \ 532 $(CONFIG_H) \
@@ -557,14 +558,14 @@ $(BLD)/callint.$(O) : \
557 558
558$(BLD)/callproc.$(O) : \ 559$(BLD)/callproc.$(O) : \
559 $(SRC)/callproc.c \ 560 $(SRC)/callproc.c \
561 $(SRC)/blockinput.h \
560 $(SRC)/commands.h \ 562 $(SRC)/commands.h \
561 $(SRC)/composite.h \ 563 $(SRC)/composite.h \
562 $(SRC)/epaths.h \ 564 $(SRC)/epaths.h \
563 $(SRC)/syssignal.h \ 565 $(SRC)/syswait.h \
564 $(SRC)/w32.h \ 566 $(SRC)/w32.h \
565 $(NT_INC)/sys/file.h \ 567 $(NT_INC)/sys/file.h \
566 $(NT_INC)/unistd.h \ 568 $(NT_INC)/unistd.h \
567 $(BLOCKINPUT_H) \
568 $(BUFFER_H) \ 569 $(BUFFER_H) \
569 $(CCL_H) \ 570 $(CCL_H) \
570 $(CHARACTER_H) \ 571 $(CHARACTER_H) \
@@ -573,6 +574,7 @@ $(BLD)/callproc.$(O) : \
573 $(FRAME_H) \ 574 $(FRAME_H) \
574 $(LISP_H) \ 575 $(LISP_H) \
575 $(PROCESS_H) \ 576 $(PROCESS_H) \
577 $(SYSSIGNAL_H) \
576 $(SYSTTY_H) \ 578 $(SYSTTY_H) \
577 $(TERMHOOKS_H) 579 $(TERMHOOKS_H)
578 580
@@ -690,7 +692,6 @@ $(BLD)/data.$(O) : \
690 $(SRC)/data.c \ 692 $(SRC)/data.c \
691 $(SRC)/keymap.h \ 693 $(SRC)/keymap.h \
692 $(SRC)/puresize.h \ 694 $(SRC)/puresize.h \
693 $(SRC)/syssignal.h \
694 $(GNU_LIB)/intprops.h \ 695 $(GNU_LIB)/intprops.h \
695 $(BUFFER_H) \ 696 $(BUFFER_H) \
696 $(CHARACTER_H) \ 697 $(CHARACTER_H) \
@@ -699,16 +700,17 @@ $(BLD)/data.$(O) : \
699 $(FRAME_H) \ 700 $(FRAME_H) \
700 $(KEYBOARD_H) \ 701 $(KEYBOARD_H) \
701 $(LISP_H) \ 702 $(LISP_H) \
703 $(SYSSIGNAL_H) \
702 $(TERMHOOKS_H) 704 $(TERMHOOKS_H)
703 705
704$(BLD)/dired.$(O) : \ 706$(BLD)/dired.$(O) : \
705 $(SRC)/dired.c \ 707 $(SRC)/dired.c \
708 $(SRC)/blockinput.h \
706 $(SRC)/commands.h \ 709 $(SRC)/commands.h \
707 $(SRC)/regex.h \ 710 $(SRC)/regex.h \
708 $(NT_INC)/pwd.h \ 711 $(NT_INC)/pwd.h \
709 $(NT_INC)/sys/stat.h \ 712 $(NT_INC)/sys/stat.h \
710 $(NT_INC)/unistd.h \ 713 $(NT_INC)/unistd.h \
711 $(BLOCKINPUT_H) \
712 $(BUFFER_H) \ 714 $(BUFFER_H) \
713 $(CHARACTER_H) \ 715 $(CHARACTER_H) \
714 $(CHARSET_H) \ 716 $(CHARSET_H) \
@@ -723,15 +725,14 @@ $(BLD)/dired.$(O) : \
723 725
724$(BLD)/dispnew.$(O) : \ 726$(BLD)/dispnew.$(O) : \
725 $(SRC)/dispnew.c \ 727 $(SRC)/dispnew.c \
728 $(SRC)/blockinput.h \
726 $(SRC)/cm.h \ 729 $(SRC)/cm.h \
727 $(SRC)/commands.h \ 730 $(SRC)/commands.h \
728 $(SRC)/disptab.h \ 731 $(SRC)/disptab.h \
729 $(SRC)/indent.h \ 732 $(SRC)/indent.h \
730 $(SRC)/syssignal.h \
731 $(SRC)/termchar.h \ 733 $(SRC)/termchar.h \
732 $(SRC)/termopts.h \ 734 $(SRC)/termopts.h \
733 $(NT_INC)/unistd.h \ 735 $(NT_INC)/unistd.h \
734 $(BLOCKINPUT_H) \
735 $(BUFFER_H) \ 736 $(BUFFER_H) \
736 $(CHARACTER_H) \ 737 $(CHARACTER_H) \
737 $(CONFIG_H) \ 738 $(CONFIG_H) \
@@ -741,6 +742,7 @@ $(BLD)/dispnew.$(O) : \
741 $(KEYBOARD_H) \ 742 $(KEYBOARD_H) \
742 $(LISP_H) \ 743 $(LISP_H) \
743 $(PROCESS_H) \ 744 $(PROCESS_H) \
745 $(SYSSIGNAL_H) \
744 $(SYSTIME_H) \ 746 $(SYSTIME_H) \
745 $(TERMHOOKS_H) \ 747 $(TERMHOOKS_H) \
746 $(W32TERM_H) \ 748 $(W32TERM_H) \
@@ -768,12 +770,12 @@ $(BLD)/doprnt.$(O) : \
768 770
769$(BLD)/editfns.$(O) : \ 771$(BLD)/editfns.$(O) : \
770 $(SRC)/editfns.c \ 772 $(SRC)/editfns.c \
773 $(SRC)/blockinput.h \
771 $(NT_INC)/pwd.h \ 774 $(NT_INC)/pwd.h \
772 $(NT_INC)/unistd.h \ 775 $(NT_INC)/unistd.h \
773 $(GNU_LIB)/intprops.h \ 776 $(GNU_LIB)/intprops.h \
774 $(GNU_LIB)/strftime.h \ 777 $(GNU_LIB)/strftime.h \
775 $(GNU_LIB)/verify.h \ 778 $(GNU_LIB)/verify.h \
776 $(BLOCKINPUT_H) \
777 $(BUFFER_H) \ 779 $(BUFFER_H) \
778 $(CHARACTER_H) \ 780 $(CHARACTER_H) \
779 $(CODING_H) \ 781 $(CODING_H) \
@@ -786,16 +788,17 @@ $(BLD)/editfns.$(O) : \
786 788
787$(BLD)/emacs.$(O) : \ 789$(BLD)/emacs.$(O) : \
788 $(SRC)/emacs.c \ 790 $(SRC)/emacs.c \
791 $(SRC)/blockinput.h \
789 $(SRC)/commands.h \ 792 $(SRC)/commands.h \
790 $(SRC)/gnutls.h \ 793 $(SRC)/gnutls.h \
791 $(SRC)/keymap.h \ 794 $(SRC)/keymap.h \
792 $(SRC)/syssignal.h \
793 $(SRC)/unexec.h \ 795 $(SRC)/unexec.h \
794 $(SRC)/w32.h \ 796 $(SRC)/w32.h \
795 $(SRC)/w32heap.h \ 797 $(SRC)/w32heap.h \
796 $(NT_INC)/sys/file.h \ 798 $(NT_INC)/sys/file.h \
797 $(NT_INC)/unistd.h \ 799 $(NT_INC)/unistd.h \
798 $(BLOCKINPUT_H) \ 800 $(GNU_LIB)/ignore-value.h \
801 $(ATIMER_H) \
799 $(BUFFER_H) \ 802 $(BUFFER_H) \
800 $(CHARACTER_H) \ 803 $(CHARACTER_H) \
801 $(CONFIG_H) \ 804 $(CONFIG_H) \
@@ -804,6 +807,7 @@ $(BLD)/emacs.$(O) : \
804 $(KEYBOARD_H) \ 807 $(KEYBOARD_H) \
805 $(LISP_H) \ 808 $(LISP_H) \
806 $(PROCESS_H) \ 809 $(PROCESS_H) \
810 $(SYSSIGNAL_H) \
807 $(SYSTTY_H) \ 811 $(SYSTTY_H) \
808 $(TERMHOOKS_H) \ 812 $(TERMHOOKS_H) \
809 $(W32TERM_H) \ 813 $(W32TERM_H) \
@@ -811,8 +815,8 @@ $(BLD)/emacs.$(O) : \
811 815
812$(BLD)/eval.$(O) : \ 816$(BLD)/eval.$(O) : \
813 $(SRC)/eval.c \ 817 $(SRC)/eval.c \
818 $(SRC)/blockinput.h \
814 $(SRC)/commands.h \ 819 $(SRC)/commands.h \
815 $(BLOCKINPUT_H) \
816 $(CONFIG_H) \ 820 $(CONFIG_H) \
817 $(DISPEXTERN_H) \ 821 $(DISPEXTERN_H) \
818 $(FRAME_H) \ 822 $(FRAME_H) \
@@ -821,11 +825,11 @@ $(BLD)/eval.$(O) : \
821 825
822$(BLD)/fileio.$(O) : \ 826$(BLD)/fileio.$(O) : \
823 $(SRC)/fileio.c \ 827 $(SRC)/fileio.c \
828 $(SRC)/blockinput.h \
824 $(SRC)/commands.h \ 829 $(SRC)/commands.h \
825 $(NT_INC)/pwd.h \ 830 $(NT_INC)/pwd.h \
826 $(NT_INC)/sys/stat.h \ 831 $(NT_INC)/sys/stat.h \
827 $(NT_INC)/unistd.h \ 832 $(NT_INC)/unistd.h \
828 $(BLOCKINPUT_H) \
829 $(BUFFER_H) \ 833 $(BUFFER_H) \
830 $(CHARACTER_H) \ 834 $(CHARACTER_H) \
831 $(CODING_H) \ 835 $(CODING_H) \
@@ -858,17 +862,16 @@ $(BLD)/firstfile.$(O) : \
858 862
859$(BLD)/floatfns.$(O) : \ 863$(BLD)/floatfns.$(O) : \
860 $(SRC)/floatfns.c \ 864 $(SRC)/floatfns.c \
861 $(SRC)/syssignal.h \
862 $(CONFIG_H) \ 865 $(CONFIG_H) \
863 $(LISP_H) 866 $(LISP_H)
864 867
865$(BLD)/fns.$(O) : \ 868$(BLD)/fns.$(O) : \
866 $(SRC)/fns.c \ 869 $(SRC)/fns.c \
870 $(SRC)/blockinput.h \
867 $(SRC)/commands.h \ 871 $(SRC)/commands.h \
868 $(SRC)/keymap.h \ 872 $(SRC)/keymap.h \
869 $(NT_INC)/unistd.h \ 873 $(NT_INC)/unistd.h \
870 $(GNU_LIB)/intprops.h \ 874 $(GNU_LIB)/intprops.h \
871 $(BLOCKINPUT_H) \
872 $(BUFFER_H) \ 875 $(BUFFER_H) \
873 $(CHARACTER_H) \ 876 $(CHARACTER_H) \
874 $(CODING_H) \ 877 $(CODING_H) \
@@ -902,8 +905,8 @@ $(BLD)/font.$(O) : \
902 905
903$(BLD)/fontset.$(O) : \ 906$(BLD)/fontset.$(O) : \
904 $(SRC)/fontset.c \ 907 $(SRC)/fontset.c \
908 $(SRC)/blockinput.h \
905 $(SRC)/fontset.h \ 909 $(SRC)/fontset.h \
906 $(BLOCKINPUT_H) \
907 $(BUFFER_H) \ 910 $(BUFFER_H) \
908 $(CCL_H) \ 911 $(CCL_H) \
909 $(CHARACTER_H) \ 912 $(CHARACTER_H) \
@@ -921,10 +924,10 @@ $(BLD)/fontset.$(O) : \
921 924
922$(BLD)/frame.$(O) : \ 925$(BLD)/frame.$(O) : \
923 $(SRC)/frame.c \ 926 $(SRC)/frame.c \
927 $(SRC)/blockinput.h \
924 $(SRC)/commands.h \ 928 $(SRC)/commands.h \
925 $(SRC)/fontset.h \ 929 $(SRC)/fontset.h \
926 $(SRC)/termchar.h \ 930 $(SRC)/termchar.h \
927 $(BLOCKINPUT_H) \
928 $(BUFFER_H) \ 931 $(BUFFER_H) \
929 $(CHARACTER_H) \ 932 $(CHARACTER_H) \
930 $(CONFIG_H) \ 933 $(CONFIG_H) \
@@ -940,7 +943,7 @@ $(BLD)/frame.$(O) : \
940 943
941$(BLD)/fringe.$(O) : \ 944$(BLD)/fringe.$(O) : \
942 $(SRC)/fringe.c \ 945 $(SRC)/fringe.c \
943 $(BLOCKINPUT_H) \ 946 $(SRC)/blockinput.h \
944 $(BUFFER_H) \ 947 $(BUFFER_H) \
945 $(CHARACTER_H) \ 948 $(CHARACTER_H) \
946 $(CONFIG_H) \ 949 $(CONFIG_H) \
@@ -971,12 +974,19 @@ $(BLD)/xml.$(O) : \
971 $(CONFIG_H) \ 974 $(CONFIG_H) \
972 $(LISP_H) 975 $(LISP_H)
973 976
977$(BLD)/profiler.$(O) : \
978 $(SRC)/profiler.c \
979 $(CONFIG_H) \
980 $(LISP_H) \
981 $(SYSSIGNAL_H) \
982 $(SYSTIME_H)
983
974$(BLD)/image.$(O) : \ 984$(BLD)/image.$(O) : \
975 $(SRC)/image.c \ 985 $(SRC)/image.c \
986 $(SRC)/blockinput.h \
976 $(SRC)/epaths.h \ 987 $(SRC)/epaths.h \
977 $(SRC)/w32.h \ 988 $(SRC)/w32.h \
978 $(NT_INC)/unistd.h \ 989 $(NT_INC)/unistd.h \
979 $(BLOCKINPUT_H) \
980 $(CHARACTER_H) \ 990 $(CHARACTER_H) \
981 $(CODING_H) \ 991 $(CODING_H) \
982 $(CONFIG_H) \ 992 $(CONFIG_H) \
@@ -1011,9 +1021,9 @@ $(BLD)/indent.$(O) : \
1011 1021
1012$(BLD)/insdel.$(O) : \ 1022$(BLD)/insdel.$(O) : \
1013 $(SRC)/insdel.c \ 1023 $(SRC)/insdel.c \
1024 $(SRC)/blockinput.h \
1014 $(SRC)/region-cache.h \ 1025 $(SRC)/region-cache.h \
1015 $(GNU_LIB)/intprops.h \ 1026 $(GNU_LIB)/intprops.h \
1016 $(BLOCKINPUT_H) \
1017 $(BUFFER_H) \ 1027 $(BUFFER_H) \
1018 $(CHARACTER_H) \ 1028 $(CHARACTER_H) \
1019 $(CONFIG_H) \ 1029 $(CONFIG_H) \
@@ -1035,19 +1045,18 @@ $(BLD)/intervals.$(O) : \
1035 1045
1036$(BLD)/keyboard.$(O) : \ 1046$(BLD)/keyboard.$(O) : \
1037 $(SRC)/keyboard.c \ 1047 $(SRC)/keyboard.c \
1048 $(SRC)/blockinput.h \
1038 $(SRC)/commands.h \ 1049 $(SRC)/commands.h \
1039 $(SRC)/disptab.h \ 1050 $(SRC)/disptab.h \
1040 $(SRC)/keymap.h \ 1051 $(SRC)/keymap.h \
1041 $(SRC)/macros.h \ 1052 $(SRC)/macros.h \
1042 $(SRC)/puresize.h \ 1053 $(SRC)/puresize.h \
1043 $(SRC)/syntax.h \ 1054 $(SRC)/syntax.h \
1044 $(SRC)/syssignal.h \
1045 $(SRC)/termchar.h \ 1055 $(SRC)/termchar.h \
1046 $(SRC)/termopts.h \ 1056 $(SRC)/termopts.h \
1047 $(NT_INC)/sys/ioctl.h \ 1057 $(NT_INC)/sys/ioctl.h \
1048 $(NT_INC)/unistd.h \ 1058 $(NT_INC)/unistd.h \
1049 $(ATIMER_H) \ 1059 $(ATIMER_H) \
1050 $(BLOCKINPUT_H) \
1051 $(BUFFER_H) \ 1060 $(BUFFER_H) \
1052 $(CHARACTER_H) \ 1061 $(CHARACTER_H) \
1053 $(CONFIG_H) \ 1062 $(CONFIG_H) \
@@ -1057,6 +1066,7 @@ $(BLD)/keyboard.$(O) : \
1057 $(KEYBOARD_H) \ 1066 $(KEYBOARD_H) \
1058 $(LISP_H) \ 1067 $(LISP_H) \
1059 $(PROCESS_H) \ 1068 $(PROCESS_H) \
1069 $(SYSSIGNAL_H) \
1060 $(SYSTIME_H) \ 1070 $(SYSTIME_H) \
1061 $(TERMHOOKS_H) \ 1071 $(TERMHOOKS_H) \
1062 $(W32TERM_H) \ 1072 $(W32TERM_H) \
@@ -1064,10 +1074,10 @@ $(BLD)/keyboard.$(O) : \
1064 1074
1065$(BLD)/keymap.$(O) : \ 1075$(BLD)/keymap.$(O) : \
1066 $(SRC)/keymap.c \ 1076 $(SRC)/keymap.c \
1077 $(SRC)/blockinput.h \
1067 $(SRC)/commands.h \ 1078 $(SRC)/commands.h \
1068 $(SRC)/keymap.h \ 1079 $(SRC)/keymap.h \
1069 $(SRC)/puresize.h \ 1080 $(SRC)/puresize.h \
1070 $(BLOCKINPUT_H) \
1071 $(BUFFER_H) \ 1081 $(BUFFER_H) \
1072 $(CHARACTER_H) \ 1082 $(CHARACTER_H) \
1073 $(CHARSET_H) \ 1083 $(CHARSET_H) \
@@ -1085,12 +1095,12 @@ $(BLD)/lastfile.$(O) : \
1085 1095
1086$(BLD)/lread.$(O) : \ 1096$(BLD)/lread.$(O) : \
1087 $(SRC)/lread.c \ 1097 $(SRC)/lread.c \
1098 $(SRC)/blockinput.h \
1088 $(SRC)/commands.h \ 1099 $(SRC)/commands.h \
1089 $(SRC)/epaths.h \ 1100 $(SRC)/epaths.h \
1090 $(NT_INC)/sys/file.h \ 1101 $(NT_INC)/sys/file.h \
1091 $(NT_INC)/sys/stat.h \ 1102 $(NT_INC)/sys/stat.h \
1092 $(NT_INC)/unistd.h \ 1103 $(NT_INC)/unistd.h \
1093 $(BLOCKINPUT_H) \
1094 $(BUFFER_H) \ 1104 $(BUFFER_H) \
1095 $(CHARACTER_H) \ 1105 $(CHARACTER_H) \
1096 $(CHARSET_H) \ 1106 $(CHARSET_H) \
@@ -1123,8 +1133,8 @@ $(BLD)/marker.$(O) : \
1123 1133
1124$(BLD)/menu.$(O) : \ 1134$(BLD)/menu.$(O) : \
1125 $(SRC)/menu.c \ 1135 $(SRC)/menu.c \
1136 $(SRC)/blockinput.h \
1126 $(SRC)/keymap.h \ 1137 $(SRC)/keymap.h \
1127 $(BLOCKINPUT_H) \
1128 $(CONFIG_H) \ 1138 $(CONFIG_H) \
1129 $(DISPEXTERN_H) \ 1139 $(DISPEXTERN_H) \
1130 $(FRAME_H) \ 1140 $(FRAME_H) \
@@ -1178,10 +1188,10 @@ $(BLD)/w32heap.$(O) : \
1178 1188
1179$(BLD)/w32inevt.$(O) : \ 1189$(BLD)/w32inevt.$(O) : \
1180 $(SRC)/w32inevt.c \ 1190 $(SRC)/w32inevt.c \
1191 $(SRC)/blockinput.h \
1181 $(SRC)/termchar.h \ 1192 $(SRC)/termchar.h \
1182 $(SRC)/w32heap.h \ 1193 $(SRC)/w32heap.h \
1183 $(SRC)/w32inevt.h \ 1194 $(SRC)/w32inevt.h \
1184 $(BLOCKINPUT_H) \
1185 $(CONFIG_H) \ 1195 $(CONFIG_H) \
1186 $(DISPEXTERN_H) \ 1196 $(DISPEXTERN_H) \
1187 $(FRAME_H) \ 1197 $(FRAME_H) \
@@ -1193,7 +1203,6 @@ $(BLD)/w32inevt.$(O) : \
1193 1203
1194$(BLD)/w32proc.$(O) : \ 1204$(BLD)/w32proc.$(O) : \
1195 $(SRC)/w32proc.c \ 1205 $(SRC)/w32proc.c \
1196 $(SRC)/syssignal.h \
1197 $(SRC)/syswait.h \ 1206 $(SRC)/syswait.h \
1198 $(SRC)/w32.h \ 1207 $(SRC)/w32.h \
1199 $(SRC)/w32heap.h \ 1208 $(SRC)/w32heap.h \
@@ -1205,6 +1214,7 @@ $(BLD)/w32proc.$(O) : \
1205 $(LANGINFO_H) \ 1214 $(LANGINFO_H) \
1206 $(LISP_H) \ 1215 $(LISP_H) \
1207 $(PROCESS_H) \ 1216 $(PROCESS_H) \
1217 $(SYSSIGNAL_H) \
1208 $(SYSTIME_H) \ 1218 $(SYSTIME_H) \
1209 $(W32TERM_H) 1219 $(W32TERM_H)
1210 1220
@@ -1225,8 +1235,8 @@ $(BLD)/w32console.$(O) : \
1225 1235
1226$(BLD)/print.$(O) : \ 1236$(BLD)/print.$(O) : \
1227 $(SRC)/print.c \ 1237 $(SRC)/print.c \
1238 $(SRC)/blockinput.h \
1228 $(SRC)/termchar.h \ 1239 $(SRC)/termchar.h \
1229 $(BLOCKINPUT_H) \
1230 $(BUFFER_H) \ 1240 $(BUFFER_H) \
1231 $(CHARACTER_H) \ 1241 $(CHARACTER_H) \
1232 $(CHARSET_H) \ 1242 $(CHARSET_H) \
@@ -1244,11 +1254,11 @@ $(BLD)/print.$(O) : \
1244 1254
1245$(BLD)/process.$(O) : \ 1255$(BLD)/process.$(O) : \
1246 $(SRC)/process.c \ 1256 $(SRC)/process.c \
1257 $(SRC)/blockinput.h \
1247 $(SRC)/commands.h \ 1258 $(SRC)/commands.h \
1248 $(SRC)/composite.h \ 1259 $(SRC)/composite.h \
1249 $(SRC)/gnutls.h \ 1260 $(SRC)/gnutls.h \
1250 $(SRC)/sysselect.h \ 1261 $(SRC)/sysselect.h \
1251 $(SRC)/syssignal.h \
1252 $(SRC)/syswait.h \ 1262 $(SRC)/syswait.h \
1253 $(SRC)/termopts.h \ 1263 $(SRC)/termopts.h \
1254 $(NT_INC)/arpa/inet.h \ 1264 $(NT_INC)/arpa/inet.h \
@@ -1259,7 +1269,6 @@ $(BLD)/process.$(O) : \
1259 $(NT_INC)/sys/stat.h \ 1269 $(NT_INC)/sys/stat.h \
1260 $(NT_INC)/unistd.h \ 1270 $(NT_INC)/unistd.h \
1261 $(ATIMER_H) \ 1271 $(ATIMER_H) \
1262 $(BLOCKINPUT_H) \
1263 $(BUFFER_H) \ 1272 $(BUFFER_H) \
1264 $(CHARACTER_H) \ 1273 $(CHARACTER_H) \
1265 $(CODING_H) \ 1274 $(CODING_H) \
@@ -1270,6 +1279,7 @@ $(BLD)/process.$(O) : \
1270 $(LISP_H) \ 1279 $(LISP_H) \
1271 $(PROCESS_H) \ 1280 $(PROCESS_H) \
1272 $(SOCKET_H) \ 1281 $(SOCKET_H) \
1282 $(SYSSIGNAL_H) \
1273 $(SYSTIME_H) \ 1283 $(SYSTIME_H) \
1274 $(SYSTTY_H) \ 1284 $(SYSTTY_H) \
1275 $(TERMHOOKS_H) \ 1285 $(TERMHOOKS_H) \
@@ -1278,9 +1288,9 @@ $(BLD)/process.$(O) : \
1278 1288
1279$(BLD)/ralloc.$(O) : \ 1289$(BLD)/ralloc.$(O) : \
1280 $(SRC)/ralloc.c \ 1290 $(SRC)/ralloc.c \
1291 $(SRC)/blockinput.h \
1281 $(SRC)/getpagesize.h \ 1292 $(SRC)/getpagesize.h \
1282 $(NT_INC)/unistd.h \ 1293 $(NT_INC)/unistd.h \
1283 $(BLOCKINPUT_H) \
1284 $(CONFIG_H) \ 1294 $(CONFIG_H) \
1285 $(LISP_H) 1295 $(LISP_H)
1286 1296
@@ -1315,12 +1325,12 @@ $(BLD)/scroll.$(O) : \
1315 1325
1316$(BLD)/search.$(O) : \ 1326$(BLD)/search.$(O) : \
1317 $(SRC)/search.c \ 1327 $(SRC)/search.c \
1328 $(SRC)/blockinput.h \
1318 $(SRC)/category.h \ 1329 $(SRC)/category.h \
1319 $(SRC)/commands.h \ 1330 $(SRC)/commands.h \
1320 $(SRC)/regex.h \ 1331 $(SRC)/regex.h \
1321 $(SRC)/region-cache.h \ 1332 $(SRC)/region-cache.h \
1322 $(SRC)/syntax.h \ 1333 $(SRC)/syntax.h \
1323 $(BLOCKINPUT_H) \
1324 $(BUFFER_H) \ 1334 $(BUFFER_H) \
1325 $(CHARACTER_H) \ 1335 $(CHARACTER_H) \
1326 $(CHARSET_H) \ 1336 $(CHARSET_H) \
@@ -1330,12 +1340,12 @@ $(BLD)/search.$(O) : \
1330 1340
1331$(BLD)/sound.$(O) : \ 1341$(BLD)/sound.$(O) : \
1332 $(SRC)/sound.c \ 1342 $(SRC)/sound.c \
1333 $(SRC)/syssignal.h \
1334 $(NT_INC)/unistd.h \ 1343 $(NT_INC)/unistd.h \
1335 $(ATIMER_H) \ 1344 $(ATIMER_H) \
1336 $(CONFIG_H) \ 1345 $(CONFIG_H) \
1337 $(DISPEXTERN_H) \ 1346 $(DISPEXTERN_H) \
1338 $(LISP_H) 1347 $(LISP_H) \
1348 $(SYSSIGNAL_H)
1339 1349
1340$(BLD)/syntax.$(O) : \ 1350$(BLD)/syntax.$(O) : \
1341 $(SRC)/syntax.c \ 1351 $(SRC)/syntax.c \
@@ -1352,9 +1362,9 @@ $(BLD)/syntax.$(O) : \
1352 1362
1353$(BLD)/sysdep.$(O) : \ 1363$(BLD)/sysdep.$(O) : \
1354 $(SRC)/sysdep.c \ 1364 $(SRC)/sysdep.c \
1365 $(SRC)/blockinput.h \
1355 $(SRC)/cm.h \ 1366 $(SRC)/cm.h \
1356 $(SRC)/sysselect.h \ 1367 $(SRC)/sysselect.h \
1357 $(SRC)/syssignal.h \
1358 $(SRC)/syswait.h \ 1368 $(SRC)/syswait.h \
1359 $(SRC)/termchar.h \ 1369 $(SRC)/termchar.h \
1360 $(SRC)/termopts.h \ 1370 $(SRC)/termopts.h \
@@ -1367,7 +1377,6 @@ $(BLD)/sysdep.$(O) : \
1367 $(GNU_LIB)/execinfo.h \ 1377 $(GNU_LIB)/execinfo.h \
1368 $(GNU_LIB)/ignore-value.h \ 1378 $(GNU_LIB)/ignore-value.h \
1369 $(GNU_LIB)/utimens.h \ 1379 $(GNU_LIB)/utimens.h \
1370 $(BLOCKINPUT_H) \
1371 $(CAREADLINKAT_H) \ 1380 $(CAREADLINKAT_H) \
1372 $(CONFIG_H) \ 1381 $(CONFIG_H) \
1373 $(C_CTYPE_H) \ 1382 $(C_CTYPE_H) \
@@ -1378,6 +1387,7 @@ $(BLD)/sysdep.$(O) : \
1378 $(LISP_H) \ 1387 $(LISP_H) \
1379 $(PROCESS_H) \ 1388 $(PROCESS_H) \
1380 $(SOCKET_H) \ 1389 $(SOCKET_H) \
1390 $(SYSSIGNAL_H) \
1381 $(SYSTIME_H) \ 1391 $(SYSTIME_H) \
1382 $(SYSTTY_H) \ 1392 $(SYSTTY_H) \
1383 $(TERMHOOKS_H) \ 1393 $(TERMHOOKS_H) \
@@ -1385,18 +1395,17 @@ $(BLD)/sysdep.$(O) : \
1385 1395
1386$(BLD)/term.$(O) : \ 1396$(BLD)/term.$(O) : \
1387 $(SRC)/term.c \ 1397 $(SRC)/term.c \
1398 $(SRC)/blockinput.h \
1388 $(SRC)/cm.h \ 1399 $(SRC)/cm.h \
1389 $(SRC)/composite.h \ 1400 $(SRC)/composite.h \
1390 $(SRC)/disptab.h \ 1401 $(SRC)/disptab.h \
1391 $(SRC)/keymap.h \ 1402 $(SRC)/keymap.h \
1392 $(SRC)/syssignal.h \
1393 $(SRC)/termchar.h \ 1403 $(SRC)/termchar.h \
1394 $(SRC)/termopts.h \ 1404 $(SRC)/termopts.h \
1395 $(SRC)/tparam.h \ 1405 $(SRC)/tparam.h \
1396 $(NT_INC)/sys/file.h \ 1406 $(NT_INC)/sys/file.h \
1397 $(NT_INC)/sys/time.h \ 1407 $(NT_INC)/sys/time.h \
1398 $(NT_INC)/unistd.h \ 1408 $(NT_INC)/unistd.h \
1399 $(BLOCKINPUT_H) \
1400 $(BUFFER_H) \ 1409 $(BUFFER_H) \
1401 $(CHARACTER_H) \ 1410 $(CHARACTER_H) \
1402 $(CHARSET_H) \ 1411 $(CHARSET_H) \
@@ -1407,6 +1416,7 @@ $(BLD)/term.$(O) : \
1407 $(INTERVALS_H) \ 1416 $(INTERVALS_H) \
1408 $(KEYBOARD_H) \ 1417 $(KEYBOARD_H) \
1409 $(LISP_H) \ 1418 $(LISP_H) \
1419 $(SYSSIGNAL_H) \
1410 $(SYSTTY_H) \ 1420 $(SYSTTY_H) \
1411 $(TERMHOOKS_H) \ 1421 $(TERMHOOKS_H) \
1412 $(WINDOW_H) 1422 $(WINDOW_H)
@@ -1461,12 +1471,12 @@ $(BLD)/vm-limit.$(O) : \
1461 1471
1462$(BLD)/window.$(O) : \ 1472$(BLD)/window.$(O) : \
1463 $(SRC)/window.c \ 1473 $(SRC)/window.c \
1474 $(SRC)/blockinput.h \
1464 $(SRC)/commands.h \ 1475 $(SRC)/commands.h \
1465 $(SRC)/disptab.h \ 1476 $(SRC)/disptab.h \
1466 $(SRC)/indent.h \ 1477 $(SRC)/indent.h \
1467 $(SRC)/keymap.h \ 1478 $(SRC)/keymap.h \
1468 $(SRC)/termchar.h \ 1479 $(SRC)/termchar.h \
1469 $(BLOCKINPUT_H) \
1470 $(BUFFER_H) \ 1480 $(BUFFER_H) \
1471 $(CHARACTER_H) \ 1481 $(CHARACTER_H) \
1472 $(CONFIG_H) \ 1482 $(CONFIG_H) \
@@ -1481,6 +1491,7 @@ $(BLD)/window.$(O) : \
1481 1491
1482$(BLD)/xdisp.$(O) : \ 1492$(BLD)/xdisp.$(O) : \
1483 $(SRC)/xdisp.c \ 1493 $(SRC)/xdisp.c \
1494 $(SRC)/blockinput.h \
1484 $(SRC)/commands.h \ 1495 $(SRC)/commands.h \
1485 $(SRC)/disptab.h \ 1496 $(SRC)/disptab.h \
1486 $(SRC)/fontset.h \ 1497 $(SRC)/fontset.h \
@@ -1490,7 +1501,7 @@ $(BLD)/xdisp.$(O) : \
1490 $(SRC)/region-cache.h \ 1501 $(SRC)/region-cache.h \
1491 $(SRC)/termchar.h \ 1502 $(SRC)/termchar.h \
1492 $(SRC)/termopts.h \ 1503 $(SRC)/termopts.h \
1493 $(BLOCKINPUT_H) \ 1504 $(ATIMER_H) \
1494 $(BUFFER_H) \ 1505 $(BUFFER_H) \
1495 $(CHARACTER_H) \ 1506 $(CHARACTER_H) \
1496 $(CHARSET_H) \ 1507 $(CHARSET_H) \
@@ -1509,10 +1520,10 @@ $(BLD)/xdisp.$(O) : \
1509 1520
1510$(BLD)/xfaces.$(O) : \ 1521$(BLD)/xfaces.$(O) : \
1511 $(SRC)/xfaces.c \ 1522 $(SRC)/xfaces.c \
1523 $(SRC)/blockinput.h \
1512 $(SRC)/fontset.h \ 1524 $(SRC)/fontset.h \
1513 $(SRC)/termchar.h \ 1525 $(SRC)/termchar.h \
1514 $(NT_INC)/sys/stat.h \ 1526 $(NT_INC)/sys/stat.h \
1515 $(BLOCKINPUT_H) \
1516 $(BUFFER_H) \ 1527 $(BUFFER_H) \
1517 $(CHARACTER_H) \ 1528 $(CHARACTER_H) \
1518 $(CHARSET_H) \ 1529 $(CHARSET_H) \
@@ -1530,11 +1541,11 @@ $(BLD)/xfaces.$(O) : \
1530 1541
1531$(BLD)/w32fns.$(O) : \ 1542$(BLD)/w32fns.$(O) : \
1532 $(SRC)/w32fns.c \ 1543 $(SRC)/w32fns.c \
1544 $(SRC)/blockinput.h \
1533 $(SRC)/epaths.h \ 1545 $(SRC)/epaths.h \
1534 $(SRC)/fontset.h \ 1546 $(SRC)/fontset.h \
1535 $(SRC)/w32.h \ 1547 $(SRC)/w32.h \
1536 $(SRC)/w32heap.h \ 1548 $(SRC)/w32heap.h \
1537 $(BLOCKINPUT_H) \
1538 $(BUFFER_H) \ 1549 $(BUFFER_H) \
1539 $(CCL_H) \ 1550 $(CCL_H) \
1540 $(CHARACTER_H) \ 1551 $(CHARACTER_H) \
@@ -1555,9 +1566,9 @@ $(BLD)/w32fns.$(O) : \
1555 1566
1556$(BLD)/w32menu.$(O) : \ 1567$(BLD)/w32menu.$(O) : \
1557 $(SRC)/w32menu.c \ 1568 $(SRC)/w32menu.c \
1569 $(SRC)/blockinput.h \
1558 $(SRC)/keymap.h \ 1570 $(SRC)/keymap.h \
1559 $(SRC)/w32heap.h \ 1571 $(SRC)/w32heap.h \
1560 $(BLOCKINPUT_H) \
1561 $(BUFFER_H) \ 1572 $(BUFFER_H) \
1562 $(CHARACTER_H) \ 1573 $(CHARACTER_H) \
1563 $(CHARSET_H) \ 1574 $(CHARSET_H) \
@@ -1574,6 +1585,7 @@ $(BLD)/w32menu.$(O) : \
1574 1585
1575$(BLD)/w32term.$(O) : \ 1586$(BLD)/w32term.$(O) : \
1576 $(SRC)/w32term.c \ 1587 $(SRC)/w32term.c \
1588 $(SRC)/blockinput.h \
1577 $(SRC)/disptab.h \ 1589 $(SRC)/disptab.h \
1578 $(SRC)/fontset.h \ 1590 $(SRC)/fontset.h \
1579 $(SRC)/keymap.h \ 1591 $(SRC)/keymap.h \
@@ -1582,7 +1594,6 @@ $(BLD)/w32term.$(O) : \
1582 $(SRC)/w32heap.h \ 1594 $(SRC)/w32heap.h \
1583 $(NT_INC)/sys/stat.h \ 1595 $(NT_INC)/sys/stat.h \
1584 $(ATIMER_H) \ 1596 $(ATIMER_H) \
1585 $(BLOCKINPUT_H) \
1586 $(BUFFER_H) \ 1597 $(BUFFER_H) \
1587 $(CCL_H) \ 1598 $(CCL_H) \
1588 $(CHARACTER_H) \ 1599 $(CHARACTER_H) \
@@ -1605,9 +1616,9 @@ $(BLD)/w32term.$(O) : \
1605 1616
1606$(BLD)/w32select.$(O) : \ 1617$(BLD)/w32select.$(O) : \
1607 $(SRC)/w32select.c \ 1618 $(SRC)/w32select.c \
1619 $(SRC)/blockinput.h \
1608 $(SRC)/composite.h \ 1620 $(SRC)/composite.h \
1609 $(SRC)/w32heap.h \ 1621 $(SRC)/w32heap.h \
1610 $(BLOCKINPUT_H) \
1611 $(CHARSET_H) \ 1622 $(CHARSET_H) \
1612 $(CODING_H) \ 1623 $(CODING_H) \
1613 $(CONFIG_H) \ 1624 $(CONFIG_H) \
@@ -1616,15 +1627,15 @@ $(BLD)/w32select.$(O) : \
1616 1627
1617$(BLD)/w32reg.$(O) : \ 1628$(BLD)/w32reg.$(O) : \
1618 $(SRC)/w32reg.c \ 1629 $(SRC)/w32reg.c \
1619 $(BLOCKINPUT_H) \ 1630 $(SRC)/blockinput.h \
1620 $(CONFIG_H) \ 1631 $(CONFIG_H) \
1621 $(LISP_H) \ 1632 $(LISP_H) \
1622 $(W32TERM_H) 1633 $(W32TERM_H)
1623 1634
1624$(BLD)/w32xfns.$(O) : \ 1635$(BLD)/w32xfns.$(O) : \
1625 $(SRC)/w32xfns.c \ 1636 $(SRC)/w32xfns.c \
1637 $(SRC)/blockinput.h \
1626 $(SRC)/fontset.h \ 1638 $(SRC)/fontset.h \
1627 $(BLOCKINPUT_H) \
1628 $(CHARSET_H) \ 1639 $(CHARSET_H) \
1629 $(CONFIG_H) \ 1640 $(CONFIG_H) \
1630 $(FRAME_H) \ 1641 $(FRAME_H) \
diff --git a/src/menu.c b/src/menu.c
index 7b01d1faefc..5374aa9157a 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -573,9 +573,9 @@ xmalloc_widget_value (void)
573{ 573{
574 widget_value *value; 574 widget_value *value;
575 575
576 BLOCK_INPUT; 576 block_input ();
577 value = malloc_widget_value (); 577 value = malloc_widget_value ();
578 UNBLOCK_INPUT; 578 unblock_input ();
579 579
580 return value; 580 return value;
581} 581}
@@ -602,9 +602,9 @@ free_menubar_widget_value_tree (widget_value *wv)
602 free_menubar_widget_value_tree (wv->next); 602 free_menubar_widget_value_tree (wv->next);
603 wv->next = (widget_value *) 0xDEADBEEF; 603 wv->next = (widget_value *) 0xDEADBEEF;
604 } 604 }
605 BLOCK_INPUT; 605 block_input ();
606 free_widget_value (wv); 606 free_widget_value (wv);
607 UNBLOCK_INPUT; 607 unblock_input ();
608} 608}
609 609
610/* Create a tree of widget_value objects 610/* Create a tree of widget_value objects
@@ -1313,7 +1313,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1313#endif 1313#endif
1314 1314
1315 /* Display them in a menu. */ 1315 /* Display them in a menu. */
1316 BLOCK_INPUT; 1316 block_input ();
1317 1317
1318 /* FIXME: Use a terminal hook! */ 1318 /* FIXME: Use a terminal hook! */
1319#if defined HAVE_NTGUI 1319#if defined HAVE_NTGUI
@@ -1332,7 +1332,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1332 last_event_timestamp); 1332 last_event_timestamp);
1333#endif 1333#endif
1334 1334
1335 UNBLOCK_INPUT; 1335 unblock_input ();
1336 1336
1337#ifdef HAVE_NS 1337#ifdef HAVE_NS
1338 unbind_to (specpdl_count, Qnil); 1338 unbind_to (specpdl_count, Qnil);
diff --git a/src/msdos.c b/src/msdos.c
index ed5d3240aa1..bac6b977fdf 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1229,7 +1229,7 @@ IT_update_begin (struct frame *f)
1229 if (display_info->termscript) 1229 if (display_info->termscript)
1230 fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN"); 1230 fprintf (display_info->termscript, "\n\n<UPDATE_BEGIN");
1231 1231
1232 BLOCK_INPUT; 1232 block_input ();
1233 1233
1234 if (f && f == mouse_face_frame) 1234 if (f && f == mouse_face_frame)
1235 { 1235 {
@@ -1279,7 +1279,7 @@ IT_update_begin (struct frame *f)
1279 hlinfo->mouse_face_mouse_frame = NULL; 1279 hlinfo->mouse_face_mouse_frame = NULL;
1280 } 1280 }
1281 1281
1282 UNBLOCK_INPUT; 1282 unblock_input ();
1283} 1283}
1284 1284
1285static void 1285static void
@@ -1302,13 +1302,13 @@ IT_frame_up_to_date (struct frame *f)
1302 if (hlinfo->mouse_face_deferred_gc 1302 if (hlinfo->mouse_face_deferred_gc
1303 || (f && f == hlinfo->mouse_face_mouse_frame)) 1303 || (f && f == hlinfo->mouse_face_mouse_frame))
1304 { 1304 {
1305 BLOCK_INPUT; 1305 block_input ();
1306 if (hlinfo->mouse_face_mouse_frame) 1306 if (hlinfo->mouse_face_mouse_frame)
1307 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, 1307 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
1308 hlinfo->mouse_face_mouse_x, 1308 hlinfo->mouse_face_mouse_x,
1309 hlinfo->mouse_face_mouse_y); 1309 hlinfo->mouse_face_mouse_y);
1310 hlinfo->mouse_face_deferred_gc = 0; 1310 hlinfo->mouse_face_deferred_gc = 0;
1311 UNBLOCK_INPUT; 1311 unblock_input ();
1312 } 1312 }
1313 1313
1314 /* Set the cursor type to whatever they wanted. In a minibuffer 1314 /* Set the cursor type to whatever they wanted. In a minibuffer
diff --git a/src/nsfns.m b/src/nsfns.m
index e2c8c3722c0..c96ec99ed2e 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -615,7 +615,7 @@ ns_set_name_as_filename (struct frame *f)
615 if (f->explicit_name || ! NILP (f->title) || ns_in_resize) 615 if (f->explicit_name || ! NILP (f->title) || ns_in_resize)
616 return; 616 return;
617 617
618 BLOCK_INPUT; 618 block_input ();
619 pool = [[NSAutoreleasePool alloc] init]; 619 pool = [[NSAutoreleasePool alloc] init];
620 filename = BVAR (XBUFFER (buf), filename); 620 filename = BVAR (XBUFFER (buf), filename);
621 name = BVAR (XBUFFER (buf), name); 621 name = BVAR (XBUFFER (buf), name);
@@ -640,7 +640,7 @@ ns_set_name_as_filename (struct frame *f)
640 if (title && (! strcmp (title, SSDATA (encoded_name)))) 640 if (title && (! strcmp (title, SSDATA (encoded_name))))
641 { 641 {
642 [pool release]; 642 [pool release];
643 UNBLOCK_INPUT; 643 unblock_input ();
644 return; 644 return;
645 } 645 }
646 646
@@ -678,7 +678,7 @@ ns_set_name_as_filename (struct frame *f)
678 } 678 }
679 679
680 [pool release]; 680 [pool release];
681 UNBLOCK_INPUT; 681 unblock_input ();
682} 682}
683 683
684 684
@@ -689,11 +689,11 @@ ns_set_doc_edited (struct frame *f, Lisp_Object arg)
689 NSAutoreleasePool *pool; 689 NSAutoreleasePool *pool;
690 if (!MINI_WINDOW_P (XWINDOW (f->selected_window))) 690 if (!MINI_WINDOW_P (XWINDOW (f->selected_window)))
691 { 691 {
692 BLOCK_INPUT; 692 block_input ();
693 pool = [[NSAutoreleasePool alloc] init]; 693 pool = [[NSAutoreleasePool alloc] init];
694 [[view window] setDocumentEdited: !NILP (arg)]; 694 [[view window] setDocumentEdited: !NILP (arg)];
695 [pool release]; 695 [pool release];
696 UNBLOCK_INPUT; 696 unblock_input ();
697 } 697 }
698} 698}
699 699
@@ -771,14 +771,14 @@ ns_implicitly_set_icon_type (struct frame *f)
771 771
772 NSTRACE (ns_implicitly_set_icon_type); 772 NSTRACE (ns_implicitly_set_icon_type);
773 773
774 BLOCK_INPUT; 774 block_input ();
775 pool = [[NSAutoreleasePool alloc] init]; 775 pool = [[NSAutoreleasePool alloc] init];
776 if (f->output_data.ns->miniimage 776 if (f->output_data.ns->miniimage
777 && [[NSString stringWithUTF8String: SSDATA (f->name)] 777 && [[NSString stringWithUTF8String: SSDATA (f->name)]
778 isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]]) 778 isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]])
779 { 779 {
780 [pool release]; 780 [pool release];
781 UNBLOCK_INPUT; 781 unblock_input ();
782 return; 782 return;
783 } 783 }
784 784
@@ -786,7 +786,7 @@ ns_implicitly_set_icon_type (struct frame *f)
786 if (CONSP (tem) && ! NILP (XCDR (tem))) 786 if (CONSP (tem) && ! NILP (XCDR (tem)))
787 { 787 {
788 [pool release]; 788 [pool release];
789 UNBLOCK_INPUT; 789 unblock_input ();
790 return; 790 return;
791 } 791 }
792 792
@@ -826,7 +826,7 @@ ns_implicitly_set_icon_type (struct frame *f)
826 f->output_data.ns->miniimage = image; 826 f->output_data.ns->miniimage = image;
827 [view setMiniwindowImage: setMini]; 827 [view setMiniwindowImage: setMini];
828 [pool release]; 828 [pool release];
829 UNBLOCK_INPUT; 829 unblock_input ();
830} 830}
831 831
832 832
@@ -1018,7 +1018,7 @@ frame_parm_handler ns_frame_parm_handlers[] =
1018 x_set_fringe_width, /* generic OK */ 1018 x_set_fringe_width, /* generic OK */
1019 x_set_fringe_width, /* generic OK */ 1019 x_set_fringe_width, /* generic OK */
1020 0, /* x_set_wait_for_wm, will ignore */ 1020 0, /* x_set_wait_for_wm, will ignore */
1021 0, /* x_set_fullscreen will ignore */ 1021 x_set_fullscreen, /* generic OK */
1022 x_set_font_backend, /* generic OK */ 1022 x_set_font_backend, /* generic OK */
1023 x_set_alpha, 1023 x_set_alpha,
1024 0, /* x_set_sticky */ 1024 0, /* x_set_sticky */
@@ -1232,7 +1232,7 @@ This function is an internal primitive--use `make-frame' instead. */)
1232 f->resx = dpyinfo->resx; 1232 f->resx = dpyinfo->resx;
1233 f->resy = dpyinfo->resy; 1233 f->resy = dpyinfo->resy;
1234 1234
1235 BLOCK_INPUT; 1235 block_input ();
1236 register_font_driver (&nsfont_driver, f); 1236 register_font_driver (&nsfont_driver, f);
1237 x_default_parameter (f, parms, Qfont_backend, Qnil, 1237 x_default_parameter (f, parms, Qfont_backend, Qnil,
1238 "fontBackend", "FontBackend", RES_TYPE_STRING); 1238 "fontBackend", "FontBackend", RES_TYPE_STRING);
@@ -1247,7 +1247,7 @@ This function is an internal primitive--use `make-frame' instead. */)
1247 build_string ([[font fontName] UTF8String]), 1247 build_string ([[font fontName] UTF8String]),
1248 "font", "Font", RES_TYPE_STRING); 1248 "font", "Font", RES_TYPE_STRING);
1249 } 1249 }
1250 UNBLOCK_INPUT; 1250 unblock_input ();
1251 1251
1252 x_default_parameter (f, parms, Qborder_width, make_number (0), 1252 x_default_parameter (f, parms, Qborder_width, make_number (0),
1253 "borderwidth", "BorderWidth", RES_TYPE_NUMBER); 1253 "borderwidth", "BorderWidth", RES_TYPE_NUMBER);
@@ -1411,10 +1411,10 @@ FRAME nil means use the selected frame. */)
1411 if (dpyinfo->x_focus_frame != f) 1411 if (dpyinfo->x_focus_frame != f)
1412 { 1412 {
1413 EmacsView *view = FRAME_NS_VIEW (f); 1413 EmacsView *view = FRAME_NS_VIEW (f);
1414 BLOCK_INPUT; 1414 block_input ();
1415 [NSApp activateIgnoringOtherApps: YES]; 1415 [NSApp activateIgnoringOtherApps: YES];
1416 [[view window] makeKeyAndOrderFront: view]; 1416 [[view window] makeKeyAndOrderFront: view];
1417 UNBLOCK_INPUT; 1417 unblock_input ();
1418 } 1418 }
1419 1419
1420 return Qnil; 1420 return Qnil;
@@ -1511,7 +1511,7 @@ Optional arg INIT, if non-nil, provides a default file name to use. */)
1511 [panel setDelegate: fileDelegate]; 1511 [panel setDelegate: fileDelegate];
1512 1512
1513 panelOK = 0; 1513 panelOK = 0;
1514 BLOCK_INPUT; 1514 block_input ();
1515 if (NILP (mustmatch)) 1515 if (NILP (mustmatch))
1516 { 1516 {
1517 ret = [panel runModalForDirectory: dirS file: initS]; 1517 ret = [panel runModalForDirectory: dirS file: initS];
@@ -1528,7 +1528,7 @@ Optional arg INIT, if non-nil, provides a default file name to use. */)
1528 fname = build_string ([[panel filename] UTF8String]); 1528 fname = build_string ([[panel filename] UTF8String]);
1529 1529
1530 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; 1530 [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow];
1531 UNBLOCK_INPUT; 1531 unblock_input ();
1532 1532
1533 return ret ? fname : Qnil; 1533 return ret ? fname : Qnil;
1534} 1534}
@@ -1899,7 +1899,7 @@ The optional argument FRAME is currently ignored. */)
1899 error ("non-Nextstep frame used in `ns-list-colors'"); 1899 error ("non-Nextstep frame used in `ns-list-colors'");
1900 } 1900 }
1901 1901
1902 BLOCK_INPUT; 1902 block_input ();
1903 1903
1904 colorlists = [[NSColorList availableColorLists] objectEnumerator]; 1904 colorlists = [[NSColorList availableColorLists] objectEnumerator];
1905 while ((clist = [colorlists nextObject])) 1905 while ((clist = [colorlists nextObject]))
@@ -1917,7 +1917,7 @@ The optional argument FRAME is currently ignored. */)
1917 } 1917 }
1918 } 1918 }
1919 1919
1920 UNBLOCK_INPUT; 1920 unblock_input ();
1921 1921
1922 return list; 1922 return list;
1923} 1923}
@@ -2115,7 +2115,7 @@ In case the execution fails, an error is signaled. */)
2115 CHECK_STRING (script); 2115 CHECK_STRING (script);
2116 check_ns (); 2116 check_ns ();
2117 2117
2118 BLOCK_INPUT; 2118 block_input ();
2119 2119
2120 as_script = script; 2120 as_script = script;
2121 as_result = &result; 2121 as_result = &result;
@@ -2141,7 +2141,7 @@ In case the execution fails, an error is signaled. */)
2141 as_status = 0; 2141 as_status = 0;
2142 as_script = Qnil; 2142 as_script = Qnil;
2143 as_result = 0; 2143 as_result = 0;
2144 UNBLOCK_INPUT; 2144 unblock_input ();
2145 if (status == 0) 2145 if (status == 0)
2146 return result; 2146 return result;
2147 else if (!STRINGP (result)) 2147 else if (!STRINGP (result))
@@ -2548,7 +2548,7 @@ Text larger than the specified size is clipped. */)
2548 else 2548 else
2549 CHECK_NUMBER (dy); 2549 CHECK_NUMBER (dy);
2550 2550
2551 BLOCK_INPUT; 2551 block_input ();
2552 if (ns_tooltip == nil) 2552 if (ns_tooltip == nil)
2553 ns_tooltip = [[EmacsTooltip alloc] init]; 2553 ns_tooltip = [[EmacsTooltip alloc] init];
2554 else 2554 else
@@ -2563,7 +2563,7 @@ Text larger than the specified size is clipped. */)
2563 &root_x, &root_y); 2563 &root_x, &root_y);
2564 2564
2565 [ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)]; 2565 [ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)];
2566 UNBLOCK_INPUT; 2566 unblock_input ();
2567 2567
2568 UNGCPRO; 2568 UNGCPRO;
2569 return unbind_to (count, Qnil); 2569 return unbind_to (count, Qnil);
diff --git a/src/nsfont.m b/src/nsfont.m
index eba1eb04765..b13c96aa6ed 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -821,7 +821,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
821 font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); 821 font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs);
822 font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); 822 font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics);
823 823
824 BLOCK_INPUT; 824 block_input ();
825 825
826 /* for metrics */ 826 /* for metrics */
827 sfont = [nsfont screenFont]; 827 sfont = [nsfont screenFont];
@@ -932,7 +932,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
932 font->props[FONT_FULLNAME_INDEX] = 932 font->props[FONT_FULLNAME_INDEX] =
933 make_unibyte_string (font_info->name, strlen (font_info->name)); 933 make_unibyte_string (font_info->name, strlen (font_info->name));
934 } 934 }
935 UNBLOCK_INPUT; 935 unblock_input ();
936 936
937 return font_object; 937 return font_object;
938} 938}
@@ -1316,7 +1316,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block)
1316 fprintf (stderr, "%p\tFinding glyphs for glyphs in block %d\n", 1316 fprintf (stderr, "%p\tFinding glyphs for glyphs in block %d\n",
1317 font_info, block); 1317 font_info, block);
1318 1318
1319 BLOCK_INPUT; 1319 block_input ();
1320 1320
1321#ifdef NS_IMPL_COCOA 1321#ifdef NS_IMPL_COCOA
1322 if (firstTime) 1322 if (firstTime)
@@ -1373,7 +1373,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block)
1373#endif 1373#endif
1374 } 1374 }
1375 1375
1376 UNBLOCK_INPUT; 1376 unblock_input ();
1377 xfree (unichars); 1377 xfree (unichars);
1378} 1378}
1379 1379
@@ -1398,7 +1398,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
1398 numGlyphs = 0x10000; 1398 numGlyphs = 0x10000;
1399#endif 1399#endif
1400 1400
1401 BLOCK_INPUT; 1401 block_input ();
1402 sfont = [font_info->nsfont screenFont]; 1402 sfont = [font_info->nsfont screenFont];
1403 1403
1404 font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics)); 1404 font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics));
@@ -1427,7 +1427,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
1427 metrics->ascent = r.size.height - metrics->descent; 1427 metrics->ascent = r.size.height - metrics->descent;
1428/*-lrint (hshrink* [sfont descender] - expand * hd/2); */ 1428/*-lrint (hshrink* [sfont descender] - expand * hd/2); */
1429 } 1429 }
1430 UNBLOCK_INPUT; 1430 unblock_input ();
1431} 1431}
1432 1432
1433 1433
diff --git a/src/nsimage.m b/src/nsimage.m
index 668664c7a20..370cf832c7c 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -78,7 +78,7 @@ ns_image_from_file (Lisp_Object file)
78 return [EmacsImage allocInitFromFile: file]; 78 return [EmacsImage allocInitFromFile: file];
79} 79}
80 80
81int 81bool
82ns_load_image (struct frame *f, struct image *img, 82ns_load_image (struct frame *f, struct image *img,
83 Lisp_Object spec_file, Lisp_Object spec_data) 83 Lisp_Object spec_file, Lisp_Object spec_data)
84{ 84{
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 907d3eac622..b60cc005c5f 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -115,13 +115,13 @@ popup_activated (void)
115 115
116/* -------------------------------------------------------------------------- 116/* --------------------------------------------------------------------------
117 Update menubar. Three cases: 117 Update menubar. Three cases:
118 1) deep_p = 0, submenu = nil: Fresh switch onto a frame -- either set up 118 1) ! deep_p, submenu = nil: Fresh switch onto a frame -- either set up
119 just top-level menu strings (OS X), or goto case (2) (GNUstep). 119 just top-level menu strings (OS X), or goto case (2) (GNUstep).
120 2) deep_p = 1, submenu = nil: Recompute all submenus. 120 2) deep_p, submenu = nil: Recompute all submenus.
121 3) deep_p = 1, submenu = non-nil: Update contents of a single submenu. 121 3) deep_p, submenu = non-nil: Update contents of a single submenu.
122 -------------------------------------------------------------------------- */ 122 -------------------------------------------------------------------------- */
123void 123void
124ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) 124ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
125{ 125{
126 NSAutoreleasePool *pool; 126 NSAutoreleasePool *pool;
127 id menu = [NSApp mainMenu]; 127 id menu = [NSApp mainMenu];
@@ -146,7 +146,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
146 XSETFRAME (Vmenu_updating_frame, f); 146 XSETFRAME (Vmenu_updating_frame, f);
147/*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */ 147/*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */
148 148
149 BLOCK_INPUT; 149 block_input ();
150 pool = [[NSAutoreleasePool alloc] init]; 150 pool = [[NSAutoreleasePool alloc] init];
151 151
152 /* Menu may have been created automatically; if so, discard it. */ 152 /* Menu may have been created automatically; if so, discard it. */
@@ -271,7 +271,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
271 discard_menu_items (); 271 discard_menu_items ();
272 unbind_to (specpdl_count, Qnil); 272 unbind_to (specpdl_count, Qnil);
273 [pool release]; 273 [pool release];
274 UNBLOCK_INPUT; 274 unblock_input ();
275 return; 275 return;
276 } 276 }
277 277
@@ -333,7 +333,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
333 discard_menu_items (); 333 discard_menu_items ();
334 unbind_to (specpdl_count, Qnil); 334 unbind_to (specpdl_count, Qnil);
335 [pool release]; 335 [pool release];
336 UNBLOCK_INPUT; 336 unblock_input ();
337 return; 337 return;
338 } 338 }
339 } 339 }
@@ -404,7 +404,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
404 { 404 {
405 free_menubar_widget_value_tree (first_wv); 405 free_menubar_widget_value_tree (first_wv);
406 [pool release]; 406 [pool release];
407 UNBLOCK_INPUT; 407 unblock_input ();
408 return; 408 return;
409 } 409 }
410 410
@@ -435,7 +435,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
435 { 435 {
436 free_menubar_widget_value_tree (first_wv); 436 free_menubar_widget_value_tree (first_wv);
437 [pool release]; 437 [pool release];
438 UNBLOCK_INPUT; 438 unblock_input ();
439 return; 439 return;
440 } 440 }
441 } 441 }
@@ -498,7 +498,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
498 [NSApp setMainMenu: menu]; 498 [NSApp setMainMenu: menu];
499 499
500 [pool release]; 500 [pool release];
501 UNBLOCK_INPUT; 501 unblock_input ();
502 502
503} 503}
504 504
@@ -507,7 +507,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
507 frame's menus have changed, and the *step representation should be updated 507 frame's menus have changed, and the *step representation should be updated
508 from Lisp. */ 508 from Lisp. */
509void 509void
510set_frame_menubar (struct frame *f, int first_time, int deep_p) 510set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
511{ 511{
512 ns_update_menubar (f, deep_p, nil); 512 ns_update_menubar (f, deep_p, nil);
513} 513}
@@ -1012,10 +1012,10 @@ free_frame_tool_bar (FRAME_PTR f)
1012 Under NS we just hide the toolbar until it might be needed again. 1012 Under NS we just hide the toolbar until it might be needed again.
1013 -------------------------------------------------------------------------- */ 1013 -------------------------------------------------------------------------- */
1014{ 1014{
1015 BLOCK_INPUT; 1015 block_input ();
1016 [[FRAME_NS_VIEW (f) toolbar] setVisible: NO]; 1016 [[FRAME_NS_VIEW (f) toolbar] setVisible: NO];
1017 FRAME_TOOLBAR_HEIGHT (f) = 0; 1017 FRAME_TOOLBAR_HEIGHT (f) = 0;
1018 UNBLOCK_INPUT; 1018 unblock_input ();
1019} 1019}
1020 1020
1021void 1021void
@@ -1029,7 +1029,7 @@ update_frame_tool_bar (FRAME_PTR f)
1029 NSWindow *window = [view window]; 1029 NSWindow *window = [view window];
1030 EmacsToolbar *toolbar = [view toolbar]; 1030 EmacsToolbar *toolbar = [view toolbar];
1031 1031
1032 BLOCK_INPUT; 1032 block_input ();
1033 [toolbar clearActive]; 1033 [toolbar clearActive];
1034 1034
1035 /* update EmacsToolbar as in GtkUtils, build items list */ 1035 /* update EmacsToolbar as in GtkUtils, build items list */
@@ -1115,7 +1115,7 @@ update_frame_tool_bar (FRAME_PTR f)
1115 FRAME_TOOLBAR_HEIGHT (f) = 1115 FRAME_TOOLBAR_HEIGHT (f) =
1116 NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) 1116 NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)])
1117 - FRAME_NS_TITLEBAR_HEIGHT (f); 1117 - FRAME_NS_TITLEBAR_HEIGHT (f);
1118 UNBLOCK_INPUT; 1118 unblock_input ();
1119} 1119}
1120 1120
1121 1121
@@ -1355,7 +1355,7 @@ pop_down_menu (Lisp_Object arg)
1355 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1355 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1356 struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer; 1356 struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer;
1357 1357
1358 BLOCK_INPUT; 1358 block_input ();
1359 if (popup_activated_flag) 1359 if (popup_activated_flag)
1360 { 1360 {
1361 EmacsDialogPanel *panel = unwind_data->dialog; 1361 EmacsDialogPanel *panel = unwind_data->dialog;
@@ -1366,7 +1366,7 @@ pop_down_menu (Lisp_Object arg)
1366 } 1366 }
1367 1367
1368 xfree (unwind_data); 1368 xfree (unwind_data);
1369 UNBLOCK_INPUT; 1369 unblock_input ();
1370 1370
1371 return Qnil; 1371 return Qnil;
1372} 1372}
@@ -1434,7 +1434,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1434 the dialog. */ 1434 the dialog. */
1435 contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil)); 1435 contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil));
1436 1436
1437 BLOCK_INPUT; 1437 block_input ();
1438 pool = [[NSAutoreleasePool alloc] init]; 1438 pool = [[NSAutoreleasePool alloc] init];
1439 dialog = [[EmacsDialogPanel alloc] initFromContents: contents 1439 dialog = [[EmacsDialogPanel alloc] initFromContents: contents
1440 isQuestion: isQ]; 1440 isQuestion: isQ];
@@ -1452,7 +1452,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1452 unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ 1452 unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */
1453 } 1453 }
1454 1454
1455 UNBLOCK_INPUT; 1455 unblock_input ();
1456 1456
1457 return tem; 1457 return tem;
1458} 1458}
@@ -1766,7 +1766,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
1766} 1766}
1767 1767
1768 1768
1769 1769
1770- (void)timeout_handler: (NSTimer *)timedEntry 1770- (void)timeout_handler: (NSTimer *)timedEntry
1771{ 1771{
1772 NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined 1772 NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined
diff --git a/src/nsterm.h b/src/nsterm.h
index f3adab883a1..f06e0cb0f7f 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -38,6 +38,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#ifndef MAC_OS_X_VERSION_10_6 38#ifndef MAC_OS_X_VERSION_10_6
39#define MAC_OS_X_VERSION_10_6 1060 39#define MAC_OS_X_VERSION_10_6 1060
40#endif 40#endif
41#ifndef MAC_OS_X_VERSION_10_7
42#define MAC_OS_X_VERSION_10_7 1070
43#endif
44#ifndef MAC_OS_X_VERSION_10_8
45#define MAC_OS_X_VERSION_10_8 1080
46#endif
41#endif /* NS_IMPL_COCOA */ 47#endif /* NS_IMPL_COCOA */
42 48
43#ifdef __OBJC__ 49#ifdef __OBJC__
@@ -80,6 +86,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
80 BOOL windowClosing; 86 BOOL windowClosing;
81 NSString *workingText; 87 NSString *workingText;
82 BOOL processingCompose; 88 BOOL processingCompose;
89 int fs_state, fs_before_fs, next_maximized, tbar_height, bwidth;
90 int maximized_width, maximized_height;
91 NSWindow *nonfs_window;
83@public 92@public
84 struct frame *emacsframe; 93 struct frame *emacsframe;
85 int rows, cols; 94 int rows, cols;
@@ -104,6 +113,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
104- (EmacsToolbar *) toolbar; 113- (EmacsToolbar *) toolbar;
105- (void) deleteWorkingText; 114- (void) deleteWorkingText;
106- (void) updateFrameSize: (BOOL) delay; 115- (void) updateFrameSize: (BOOL) delay;
116- (void) handleFS;
117- (void) setFSValue: (int)value;
118- (void) toggleFullScreen: (id) sender;
107 119
108#ifdef NS_IMPL_GNUSTEP 120#ifdef NS_IMPL_GNUSTEP
109/* Not declared, but useful. */ 121/* Not declared, but useful. */
@@ -120,6 +132,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
120@end 132@end
121 133
122 134
135/* Fullscreen version of the above. */
136@interface EmacsFSWindow : EmacsWindow
137{
138}
139@end
140
123/* ========================================================================== 141/* ==========================================================================
124 142
125 The main menu implementation 143 The main menu implementation
@@ -749,11 +767,11 @@ extern Lisp_Object ns_cursor_type_to_lisp (int arg);
749extern void ns_set_name_as_filename (struct frame *f); 767extern void ns_set_name_as_filename (struct frame *f);
750extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg); 768extern void ns_set_doc_edited (struct frame *f, Lisp_Object arg);
751 769
752extern int 770extern bool
753ns_defined_color (struct frame *f, 771ns_defined_color (struct frame *f,
754 const char *name, 772 const char *name,
755 XColor *color_def, int alloc, 773 XColor *color_def, bool alloc,
756 char makeIndex); 774 bool makeIndex);
757extern void 775extern void
758ns_query_color (void *col, XColor *color_def, int setPixel); 776ns_query_color (void *col, XColor *color_def, int setPixel);
759 777
@@ -799,8 +817,8 @@ struct image;
799extern void *ns_image_from_XBM (unsigned char *bits, int width, int height); 817extern void *ns_image_from_XBM (unsigned char *bits, int width, int height);
800extern void *ns_image_for_XPM (int width, int height, int depth); 818extern void *ns_image_for_XPM (int width, int height, int depth);
801extern void *ns_image_from_file (Lisp_Object file); 819extern void *ns_image_from_file (Lisp_Object file);
802extern int ns_load_image (struct frame *f, struct image *img, 820extern bool ns_load_image (struct frame *f, struct image *img,
803 Lisp_Object spec_file, Lisp_Object spec_data); 821 Lisp_Object spec_file, Lisp_Object spec_data);
804extern int ns_image_width (void *img); 822extern int ns_image_width (void *img);
805extern int ns_image_height (void *img); 823extern int ns_image_height (void *img);
806extern unsigned long ns_get_pixel (void *img, int x, int y); 824extern unsigned long ns_get_pixel (void *img, int x, int y);
diff --git a/src/nsterm.m b/src/nsterm.m
index aa869e3ff44..d41c38f4e40 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -72,6 +72,11 @@ int term_trace_num = 0;
72#define NSTRACE(x) 72#define NSTRACE(x)
73#endif 73#endif
74 74
75#if defined (NS_IMPL_COCOA) && \
76 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
77#define NEW_STYLE_FS
78#endif
79
75extern NSString *NSMenuDidBeginTrackingNotification; 80extern NSString *NSMenuDidBeginTrackingNotification;
76 81
77/* ========================================================================== 82/* ==========================================================================
@@ -581,7 +586,7 @@ ns_update_auto_hide_menu_bar (void)
581#endif 586#endif
582#ifdef NS_IMPL_COCOA 587#ifdef NS_IMPL_COCOA
583#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 588#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
584 BLOCK_INPUT; 589 block_input ();
585 590
586 NSTRACE (ns_update_auto_hide_menu_bar); 591 NSTRACE (ns_update_auto_hide_menu_bar);
587 592
@@ -612,7 +617,7 @@ ns_update_auto_hide_menu_bar (void)
612 } 617 }
613 } 618 }
614 619
615 UNBLOCK_INPUT; 620 unblock_input ();
616#endif 621#endif
617#endif 622#endif
618} 623}
@@ -662,7 +667,7 @@ ns_update_window_begin (struct window *w)
662 updated_window = w; 667 updated_window = w;
663 set_output_cursor (&w->cursor); 668 set_output_cursor (&w->cursor);
664 669
665 BLOCK_INPUT; 670 block_input ();
666 671
667 if (f == hlinfo->mouse_face_mouse_frame) 672 if (f == hlinfo->mouse_face_mouse_frame)
668 { 673 {
@@ -677,7 +682,7 @@ ns_update_window_begin (struct window *w)
677 /* (further code for mouse faces ifdef'd out in other terms elided) */ 682 /* (further code for mouse faces ifdef'd out in other terms elided) */
678 } 683 }
679 684
680 UNBLOCK_INPUT; 685 unblock_input ();
681} 686}
682 687
683 688
@@ -694,7 +699,7 @@ ns_update_window_end (struct window *w, int cursor_on_p,
694 /* note: this fn is nearly identical in all terms */ 699 /* note: this fn is nearly identical in all terms */
695 if (!w->pseudo_window_p) 700 if (!w->pseudo_window_p)
696 { 701 {
697 BLOCK_INPUT; 702 block_input ();
698 703
699 if (cursor_on_p) 704 if (cursor_on_p)
700 display_and_set_cursor (w, 1, 705 display_and_set_cursor (w, 1,
@@ -704,7 +709,7 @@ ns_update_window_end (struct window *w, int cursor_on_p,
704 if (draw_window_fringes (w, 1)) 709 if (draw_window_fringes (w, 1))
705 x_draw_vertical_border (w); 710 x_draw_vertical_border (w);
706 711
707 UNBLOCK_INPUT; 712 unblock_input ();
708 } 713 }
709 714
710 /* If a row with mouse-face was overwritten, arrange for 715 /* If a row with mouse-face was overwritten, arrange for
@@ -733,7 +738,7 @@ ns_update_end (struct frame *f)
733/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ 738/* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */
734 MOUSE_HL_INFO (f)->mouse_face_defer = 0; 739 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
735 740
736 BLOCK_INPUT; 741 block_input ();
737 742
738#ifdef NS_IMPL_GNUSTEP 743#ifdef NS_IMPL_GNUSTEP
739 /* trigger flush only in the rectangle we tracked as being drawn */ 744 /* trigger flush only in the rectangle we tracked as being drawn */
@@ -745,7 +750,7 @@ ns_update_end (struct frame *f)
745 [view unlockFocus]; 750 [view unlockFocus];
746 [[view window] flushWindow]; 751 [[view window] flushWindow];
747 752
748 UNBLOCK_INPUT; 753 unblock_input ();
749 ns_updating_frame = NULL; 754 ns_updating_frame = NULL;
750 NSTRACE (ns_update_end); 755 NSTRACE (ns_update_end);
751} 756}
@@ -902,7 +907,7 @@ ns_ring_bell (struct frame *f)
902 struct frame *frame = SELECTED_FRAME (); 907 struct frame *frame = SELECTED_FRAME ();
903 NSView *view; 908 NSView *view;
904 909
905 BLOCK_INPUT; 910 block_input ();
906 pool = [[NSAutoreleasePool alloc] init]; 911 pool = [[NSAutoreleasePool alloc] init];
907 912
908 view = FRAME_NS_VIEW (frame); 913 view = FRAME_NS_VIEW (frame);
@@ -929,7 +934,7 @@ ns_ring_bell (struct frame *f)
929 ns_unfocus (frame); 934 ns_unfocus (frame);
930 } 935 }
931 [pool release]; 936 [pool release];
932 UNBLOCK_INPUT; 937 unblock_input ();
933 } 938 }
934 else 939 else
935 { 940 {
@@ -970,13 +975,13 @@ ns_raise_frame (struct frame *f)
970{ 975{
971 NSView *view = FRAME_NS_VIEW (f); 976 NSView *view = FRAME_NS_VIEW (f);
972 check_ns (); 977 check_ns ();
973 BLOCK_INPUT; 978 block_input ();
974 FRAME_SAMPLE_VISIBILITY (f); 979 FRAME_SAMPLE_VISIBILITY (f);
975 if (FRAME_VISIBLE_P (f)) 980 if (FRAME_VISIBLE_P (f))
976 { 981 {
977 [[view window] makeKeyAndOrderFront: NSApp]; 982 [[view window] makeKeyAndOrderFront: NSApp];
978 } 983 }
979 UNBLOCK_INPUT; 984 unblock_input ();
980} 985}
981 986
982 987
@@ -988,9 +993,9 @@ ns_lower_frame (struct frame *f)
988{ 993{
989 NSView *view = FRAME_NS_VIEW (f); 994 NSView *view = FRAME_NS_VIEW (f);
990 check_ns (); 995 check_ns ();
991 BLOCK_INPUT; 996 block_input ();
992 [[view window] orderBack: NSApp]; 997 [[view window] orderBack: NSApp];
993 UNBLOCK_INPUT; 998 unblock_input ();
994} 999}
995 1000
996 1001
@@ -1126,7 +1131,7 @@ x_free_frame_resources (struct frame *f)
1126 1131
1127 [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ 1132 [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */
1128 1133
1129 BLOCK_INPUT; 1134 block_input ();
1130 1135
1131 free_frame_menubar (f); 1136 free_frame_menubar (f);
1132 1137
@@ -1154,7 +1159,7 @@ x_free_frame_resources (struct frame *f)
1154 1159
1155 xfree (f->output_data.ns); 1160 xfree (f->output_data.ns);
1156 1161
1157 UNBLOCK_INPUT; 1162 unblock_input ();
1158} 1163}
1159 1164
1160void 1165void
@@ -1183,7 +1188,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav)
1183 1188
1184 NSTRACE (x_set_offset); 1189 NSTRACE (x_set_offset);
1185 1190
1186 BLOCK_INPUT; 1191 block_input ();
1187 1192
1188 f->left_pos = xoff; 1193 f->left_pos = xoff;
1189 f->top_pos = yoff; 1194 f->top_pos = yoff;
@@ -1215,7 +1220,7 @@ x_set_offset (struct frame *f, int xoff, int yoff, int change_grav)
1215 f->size_hint_flags &= ~(XNegative|YNegative); 1220 f->size_hint_flags &= ~(XNegative|YNegative);
1216 } 1221 }
1217 1222
1218 UNBLOCK_INPUT; 1223 unblock_input ();
1219} 1224}
1220 1225
1221 1226
@@ -1240,7 +1245,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
1240 1245
1241/*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ 1246/*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */
1242 1247
1243 BLOCK_INPUT; 1248 block_input ();
1244 1249
1245 check_frame_size (f, &rows, &cols); 1250 check_frame_size (f, &rows, &cols);
1246 1251
@@ -1302,10 +1307,21 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
1302 mark_window_cursors_off (XWINDOW (f->root_window)); 1307 mark_window_cursors_off (XWINDOW (f->root_window));
1303 cancel_mouse_face (f); 1308 cancel_mouse_face (f);
1304 1309
1305 UNBLOCK_INPUT; 1310 unblock_input ();
1306} 1311}
1307 1312
1308 1313
1314static void
1315ns_fullscreen_hook (FRAME_PTR f)
1316{
1317 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
1318
1319 if (! f->async_visible) return;
1320
1321 block_input ();
1322 [view handleFS];
1323 unblock_input ();
1324}
1309 1325
1310/* ========================================================================== 1326/* ==========================================================================
1311 1327
@@ -1414,7 +1430,7 @@ ns_get_color (const char *name, NSColor **col)
1414 NSString *nsname = [NSString stringWithUTF8String: name]; 1430 NSString *nsname = [NSString stringWithUTF8String: name];
1415 1431
1416/*fprintf (stderr, "ns_get_color: '%s'\n", name); */ 1432/*fprintf (stderr, "ns_get_color: '%s'\n", name); */
1417 BLOCK_INPUT; 1433 block_input ();
1418 1434
1419 if ([nsname isEqualToString: @"ns_selection_color"]) 1435 if ([nsname isEqualToString: @"ns_selection_color"])
1420 { 1436 {
@@ -1461,7 +1477,7 @@ ns_get_color (const char *name, NSColor **col)
1461 if (r >= 0.0) 1477 if (r >= 0.0)
1462 { 1478 {
1463 *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; 1479 *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];
1464 UNBLOCK_INPUT; 1480 unblock_input ();
1465 return 0; 1481 return 0;
1466 } 1482 }
1467 1483
@@ -1493,7 +1509,7 @@ ns_get_color (const char *name, NSColor **col)
1493 1509
1494 if (new) 1510 if (new)
1495 *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; 1511 *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
1496 UNBLOCK_INPUT; 1512 unblock_input ();
1497 return new ? 0 : 1; 1513 return new ? 0 : 1;
1498} 1514}
1499 1515
@@ -1524,12 +1540,12 @@ ns_color_to_lisp (NSColor *col)
1524 const char *str; 1540 const char *str;
1525 NSTRACE (ns_color_to_lisp); 1541 NSTRACE (ns_color_to_lisp);
1526 1542
1527 BLOCK_INPUT; 1543 block_input ();
1528 if ([[col colorSpaceName] isEqualToString: NSNamedColorSpace]) 1544 if ([[col colorSpaceName] isEqualToString: NSNamedColorSpace])
1529 1545
1530 if ((str =[[col colorNameComponent] UTF8String])) 1546 if ((str =[[col colorNameComponent] UTF8String]))
1531 { 1547 {
1532 UNBLOCK_INPUT; 1548 unblock_input ();
1533 return build_string ((char *)str); 1549 return build_string ((char *)str);
1534 } 1550 }
1535 1551
@@ -1541,14 +1557,14 @@ ns_color_to_lisp (NSColor *col)
1541 getWhite: &gray alpha: &alpha]; 1557 getWhite: &gray alpha: &alpha];
1542 snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", 1558 snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx",
1543 lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff)); 1559 lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff));
1544 UNBLOCK_INPUT; 1560 unblock_input ();
1545 return build_string (buf); 1561 return build_string (buf);
1546 } 1562 }
1547 1563
1548 snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", 1564 snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx",
1549 lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff)); 1565 lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff));
1550 1566
1551 UNBLOCK_INPUT; 1567 unblock_input ();
1552 return build_string (buf); 1568 return build_string (buf);
1553} 1569}
1554 1570
@@ -1575,33 +1591,33 @@ ns_query_color(void *col, XColor *color_def, int setPixel)
1575} 1591}
1576 1592
1577 1593
1578int 1594bool
1579ns_defined_color (struct frame *f, 1595ns_defined_color (struct frame *f,
1580 const char *name, 1596 const char *name,
1581 XColor *color_def, 1597 XColor *color_def,
1582 int alloc, 1598 bool alloc,
1583 char makeIndex) 1599 bool makeIndex)
1584/* -------------------------------------------------------------------------- 1600/* --------------------------------------------------------------------------
1585 Return 1 if named color found, and set color_def rgb accordingly. 1601 Return true if named color found, and set color_def rgb accordingly.
1586 If makeIndex and alloc are nonzero put the color in the color_table, 1602 If makeIndex and alloc are nonzero put the color in the color_table,
1587 and set color_def pixel to the resulting index. 1603 and set color_def pixel to the resulting index.
1588 If makeIndex is zero, set color_def pixel to ARGB. 1604 If makeIndex is zero, set color_def pixel to ARGB.
1589 Return 0 if not found 1605 Return false if not found
1590 -------------------------------------------------------------------------- */ 1606 -------------------------------------------------------------------------- */
1591{ 1607{
1592 NSColor *col; 1608 NSColor *col;
1593 NSTRACE (ns_defined_color); 1609 NSTRACE (ns_defined_color);
1594 1610
1595 BLOCK_INPUT; 1611 block_input ();
1596 if (ns_get_color (name, &col) != 0) /* Color not found */ 1612 if (ns_get_color (name, &col) != 0) /* Color not found */
1597 { 1613 {
1598 UNBLOCK_INPUT; 1614 unblock_input ();
1599 return 0; 1615 return 0;
1600 } 1616 }
1601 if (makeIndex && alloc) 1617 if (makeIndex && alloc)
1602 color_def->pixel = ns_index_color (col, f); 1618 color_def->pixel = ns_index_color (col, f);
1603 ns_query_color (col, color_def, !makeIndex); 1619 ns_query_color (col, color_def, !makeIndex);
1604 UNBLOCK_INPUT; 1620 unblock_input ();
1605 return 1; 1621 return 1;
1606} 1622}
1607 1623
@@ -1767,7 +1783,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
1767 1783
1768 dpyinfo = FRAME_NS_DISPLAY_INFO (*fp); 1784 dpyinfo = FRAME_NS_DISPLAY_INFO (*fp);
1769 1785
1770 BLOCK_INPUT; 1786 block_input ();
1771 1787
1772 if (last_mouse_scroll_bar != nil && insist == 0) 1788 if (last_mouse_scroll_bar != nil && insist == 0)
1773 { 1789 {
@@ -1812,7 +1828,7 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
1812 } 1828 }
1813 } 1829 }
1814 1830
1815 UNBLOCK_INPUT; 1831 unblock_input ();
1816} 1832}
1817 1833
1818 1834
@@ -1832,7 +1848,7 @@ ns_frame_up_to_date (struct frame *f)
1832 if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) 1848 if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame)
1833 /*&& hlinfo->mouse_face_mouse_frame*/) 1849 /*&& hlinfo->mouse_face_mouse_frame*/)
1834 { 1850 {
1835 BLOCK_INPUT; 1851 block_input ();
1836 ns_update_begin(f); 1852 ns_update_begin(f);
1837 if (hlinfo->mouse_face_mouse_frame) 1853 if (hlinfo->mouse_face_mouse_frame)
1838 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, 1854 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
@@ -1840,7 +1856,7 @@ ns_frame_up_to_date (struct frame *f)
1840 hlinfo->mouse_face_mouse_y); 1856 hlinfo->mouse_face_mouse_y);
1841 hlinfo->mouse_face_deferred_gc = 0; 1857 hlinfo->mouse_face_deferred_gc = 0;
1842 ns_update_end(f); 1858 ns_update_end(f);
1843 UNBLOCK_INPUT; 1859 unblock_input ();
1844 } 1860 }
1845 } 1861 }
1846} 1862}
@@ -1955,7 +1971,7 @@ ns_clear_frame (struct frame *f)
1955 1971
1956 r = [view bounds]; 1972 r = [view bounds];
1957 1973
1958 BLOCK_INPUT; 1974 block_input ();
1959 ns_focus (f, &r, 1); 1975 ns_focus (f, &r, 1);
1960 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (FRAME_DEFAULT_FACE (f)), f) set]; 1976 [ns_lookup_indexed_color (NS_FACE_BACKGROUND (FRAME_DEFAULT_FACE (f)), f) set];
1961 NSRectFill (r); 1977 NSRectFill (r);
@@ -1967,7 +1983,7 @@ ns_clear_frame (struct frame *f)
1967 1983
1968 /* as of 2006/11 or so this is now needed */ 1984 /* as of 2006/11 or so this is now needed */
1969 ns_redraw_scroll_bars (f); 1985 ns_redraw_scroll_bars (f);
1970 UNBLOCK_INPUT; 1986 unblock_input ();
1971} 1987}
1972 1988
1973 1989
@@ -2068,7 +2084,7 @@ ns_scroll_run (struct window *w, struct run *run)
2068 if (height == 0) 2084 if (height == 0)
2069 return; 2085 return;
2070 2086
2071 BLOCK_INPUT; 2087 block_input ();
2072 2088
2073 updated_window = w; 2089 updated_window = w;
2074 x_clear_cursor (w); 2090 x_clear_cursor (w);
@@ -2083,7 +2099,7 @@ ns_scroll_run (struct window *w, struct run *run)
2083 ns_unfocus (f); 2099 ns_unfocus (f);
2084 } 2100 }
2085 2101
2086 UNBLOCK_INPUT; 2102 unblock_input ();
2087} 2103}
2088 2104
2089 2105
@@ -2117,12 +2133,12 @@ ns_after_update_window_line (struct glyph_row *desired_row)
2117 { 2133 {
2118 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 2134 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
2119 2135
2120 BLOCK_INPUT; 2136 block_input ();
2121 ns_clear_frame_area (f, 0, y, width, height); 2137 ns_clear_frame_area (f, 0, y, width, height);
2122 ns_clear_frame_area (f, 2138 ns_clear_frame_area (f,
2123 FRAME_PIXEL_WIDTH (f) - width, 2139 FRAME_PIXEL_WIDTH (f) - width,
2124 y, width, height); 2140 y, width, height);
2125 UNBLOCK_INPUT; 2141 unblock_input ();
2126 } 2142 }
2127} 2143}
2128 2144
@@ -2489,12 +2505,12 @@ show_hourglass (struct atimer *timer)
2489 if (hourglass_shown_p) 2505 if (hourglass_shown_p)
2490 return; 2506 return;
2491 2507
2492 BLOCK_INPUT; 2508 block_input ();
2493 2509
2494 /* TODO: add NSProgressIndicator to selected frame (see macfns.c) */ 2510 /* TODO: add NSProgressIndicator to selected frame (see macfns.c) */
2495 2511
2496 hourglass_shown_p = 1; 2512 hourglass_shown_p = 1;
2497 UNBLOCK_INPUT; 2513 unblock_input ();
2498} 2514}
2499 2515
2500 2516
@@ -2504,12 +2520,12 @@ hide_hourglass (void)
2504 if (!hourglass_shown_p) 2520 if (!hourglass_shown_p)
2505 return; 2521 return;
2506 2522
2507 BLOCK_INPUT; 2523 block_input ();
2508 2524
2509 /* TODO: remove NSProgressIndicator from all frames */ 2525 /* TODO: remove NSProgressIndicator from all frames */
2510 2526
2511 hourglass_shown_p = 0; 2527 hourglass_shown_p = 0;
2512 UNBLOCK_INPUT; 2528 unblock_input ();
2513} 2529}
2514 2530
2515 2531
@@ -2979,7 +2995,8 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
2979 if (img != nil) 2995 if (img != nil)
2980 { 2996 {
2981#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 2997#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
2982 [img drawInRect: br 2998 NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height);
2999 [img drawInRect: dr
2983 fromRect: NSZeroRect 3000 fromRect: NSZeroRect
2984 operation: NSCompositeSourceOver 3001 operation: NSCompositeSourceOver
2985 fraction: 1.0 3002 fraction: 1.0
@@ -3351,17 +3368,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3351 if ([NSApp modalWindow] != nil) 3368 if ([NSApp modalWindow] != nil)
3352 return -1; 3369 return -1;
3353 3370
3354 if (interrupt_input_blocked) 3371 block_input ();
3355 {
3356 interrupt_input_pending = 1;
3357 pending_signals = 1;
3358 return -1;
3359 }
3360
3361 interrupt_input_pending = 0;
3362 pending_signals = pending_atimers;
3363
3364 BLOCK_INPUT;
3365 n_emacs_events_pending = 0; 3372 n_emacs_events_pending = 0;
3366 EVENT_INIT (ev); 3373 EVENT_INIT (ev);
3367 emacs_event = &ev; 3374 emacs_event = &ev;
@@ -3406,7 +3413,7 @@ ns_read_socket (struct terminal *terminal, struct input_event *hold_quit)
3406 nevents = n_emacs_events_pending; 3413 nevents = n_emacs_events_pending;
3407 n_emacs_events_pending = 0; 3414 n_emacs_events_pending = 0;
3408 emacs_event = q_event_ptr = NULL; 3415 emacs_event = q_event_ptr = NULL;
3409 UNBLOCK_INPUT; 3416 unblock_input ();
3410 3417
3411 return nevents; 3418 return nevents;
3412} 3419}
@@ -3486,7 +3493,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
3486 } 3493 }
3487 3494
3488 EVENT_INIT (event); 3495 EVENT_INIT (event);
3489 BLOCK_INPUT; 3496 block_input ();
3490 emacs_event = &event; 3497 emacs_event = &event;
3491 if (++apploopnr != 1) 3498 if (++apploopnr != 1)
3492 { 3499 {
@@ -3500,7 +3507,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
3500 c = 's'; 3507 c = 's';
3501 write (selfds[1], &c, 1); 3508 write (selfds[1], &c, 1);
3502 } 3509 }
3503 UNBLOCK_INPUT; 3510 unblock_input ();
3504 3511
3505 ev = last_appdefined_event; 3512 ev = last_appdefined_event;
3506 3513
@@ -3612,7 +3619,7 @@ ns_set_vertical_scroll_bar (struct window *window,
3612 || WINDOW_RIGHT_MARGIN_COLS (window) == 0)); 3619 || WINDOW_RIGHT_MARGIN_COLS (window) == 0));
3613 3620
3614 XSETWINDOW (win, window); 3621 XSETWINDOW (win, window);
3615 BLOCK_INPUT; 3622 block_input ();
3616 3623
3617 /* we want at least 5 lines to display a scrollbar */ 3624 /* we want at least 5 lines to display a scrollbar */
3618 if (WINDOW_TOTAL_LINES (window) < 5) 3625 if (WINDOW_TOTAL_LINES (window) < 5)
@@ -3624,7 +3631,7 @@ ns_set_vertical_scroll_bar (struct window *window,
3624 wset_vertical_scroll_bar (window, Qnil); 3631 wset_vertical_scroll_bar (window, Qnil);
3625 } 3632 }
3626 ns_clear_frame_area (f, sb_left, top, width, height); 3633 ns_clear_frame_area (f, sb_left, top, width, height);
3627 UNBLOCK_INPUT; 3634 unblock_input ();
3628 return; 3635 return;
3629 } 3636 }
3630 3637
@@ -3656,7 +3663,7 @@ ns_set_vertical_scroll_bar (struct window *window,
3656 } 3663 }
3657 3664
3658 [bar setPosition: position portion: portion whole: whole]; 3665 [bar setPosition: position portion: portion whole: whole];
3659 UNBLOCK_INPUT; 3666 unblock_input ();
3660} 3667}
3661 3668
3662 3669
@@ -3900,11 +3907,11 @@ ns_delete_terminal (struct terminal *terminal)
3900 if (!terminal->name) 3907 if (!terminal->name)
3901 return; 3908 return;
3902 3909
3903 BLOCK_INPUT; 3910 block_input ();
3904 3911
3905 x_destroy_all_bitmaps (dpyinfo); 3912 x_destroy_all_bitmaps (dpyinfo);
3906 ns_delete_display (dpyinfo); 3913 ns_delete_display (dpyinfo);
3907 UNBLOCK_INPUT; 3914 unblock_input ();
3908} 3915}
3909 3916
3910 3917
@@ -3941,7 +3948,7 @@ ns_create_terminal (struct ns_display_info *dpyinfo)
3941 terminal->frame_rehighlight_hook = ns_frame_rehighlight; 3948 terminal->frame_rehighlight_hook = ns_frame_rehighlight;
3942 terminal->frame_raise_lower_hook = ns_frame_raise_lower; 3949 terminal->frame_raise_lower_hook = ns_frame_raise_lower;
3943 3950
3944 terminal->fullscreen_hook = 0; /* see XTfullscreen_hook */ 3951 terminal->fullscreen_hook = ns_fullscreen_hook;
3945 3952
3946 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar; 3953 terminal->set_vertical_scroll_bar_hook = ns_set_vertical_scroll_bar;
3947 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars; 3954 terminal->condemn_scroll_bars_hook = ns_condemn_scroll_bars;
@@ -3982,7 +3989,7 @@ ns_term_init (Lisp_Object display_name)
3982 3989
3983 /* count object allocs (About, click icon); on OS X use ObjectAlloc tool */ 3990 /* count object allocs (About, click icon); on OS X use ObjectAlloc tool */
3984 /*GSDebugAllocationActive (YES); */ 3991 /*GSDebugAllocationActive (YES); */
3985 BLOCK_INPUT; 3992 block_input ();
3986 3993
3987 baud_rate = 38400; 3994 baud_rate = 38400;
3988 Fset_input_interrupt_mode (Qnil); 3995 Fset_input_interrupt_mode (Qnil);
@@ -4051,7 +4058,7 @@ ns_term_init (Lisp_Object display_name)
4051 4058
4052 terminal->name = xstrdup (SSDATA (display_name)); 4059 terminal->name = xstrdup (SSDATA (display_name));
4053 4060
4054 UNBLOCK_INPUT; 4061 unblock_input ();
4055 4062
4056 if (!inhibit_x_resources) 4063 if (!inhibit_x_resources)
4057 { 4064 {
@@ -4696,6 +4703,8 @@ not_in_argv (NSString *arg)
4696{ 4703{
4697 NSTRACE (EmacsView_dealloc); 4704 NSTRACE (EmacsView_dealloc);
4698 [toolbar release]; 4705 [toolbar release];
4706 if (fs_state == FULLSCREEN_BOTH)
4707 [nonfs_window release];
4699 [super dealloc]; 4708 [super dealloc];
4700} 4709}
4701 4710
@@ -5414,6 +5423,7 @@ not_in_argv (NSString *arg)
5414 SET_FRAME_GARBAGED (emacsframe); 5423 SET_FRAME_GARBAGED (emacsframe);
5415 cancel_mouse_face (emacsframe); 5424 cancel_mouse_face (emacsframe);
5416 [view setFrame: NSMakeRect (0, 0, neww, newh)]; 5425 [view setFrame: NSMakeRect (0, 0, neww, newh)];
5426 [self windowDidMove:nil]; // Update top/left.
5417 } 5427 }
5418} 5428}
5419 5429
@@ -5423,6 +5433,19 @@ not_in_argv (NSString *arg)
5423 NSTRACE (windowWillResize); 5433 NSTRACE (windowWillResize);
5424/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ 5434/*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */
5425 5435
5436 if (fs_state == FULLSCREEN_MAXIMIZED
5437 && (maximized_width != (int)frameSize.width
5438 || maximized_height != (int)frameSize.height))
5439 [self setFSValue: FULLSCREEN_NONE];
5440 else if (fs_state == FULLSCREEN_WIDTH
5441 && maximized_width != (int)frameSize.width)
5442 [self setFSValue: FULLSCREEN_NONE];
5443 else if (fs_state == FULLSCREEN_HEIGHT
5444 && maximized_height != (int)frameSize.height)
5445 [self setFSValue: FULLSCREEN_NONE];
5446 if (fs_state == FULLSCREEN_NONE)
5447 maximized_width = maximized_height = -1;
5448
5426 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, 5449 cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe,
5427#ifdef NS_IMPL_GNUSTEP 5450#ifdef NS_IMPL_GNUSTEP
5428 frameSize.width + 3); 5451 frameSize.width + 3);
@@ -5604,6 +5627,10 @@ not_in_argv (NSString *arg)
5604 windowClosing = NO; 5627 windowClosing = NO;
5605 processingCompose = NO; 5628 processingCompose = NO;
5606 scrollbarsNeedingUpdate = 0; 5629 scrollbarsNeedingUpdate = 0;
5630 fs_state = FULLSCREEN_NONE;
5631 fs_before_fs = next_maximized = -1;
5632 maximized_width = maximized_height = -1;
5633 nonfs_window = nil;
5607 5634
5608/*fprintf (stderr,"init with %d, %d\n",f->text_cols, f->text_lines); */ 5635/*fprintf (stderr,"init with %d, %d\n",f->text_cols, f->text_lines); */
5609 5636
@@ -5628,9 +5655,13 @@ not_in_argv (NSString *arg)
5628 backing: NSBackingStoreBuffered 5655 backing: NSBackingStoreBuffered
5629 defer: YES]; 5656 defer: YES];
5630 5657
5658#ifdef NEW_STYLE_FS
5659 [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
5660#endif
5661
5631 wr = [win frame]; 5662 wr = [win frame];
5632 f->border_width = wr.size.width - r.size.width; 5663 bwidth = f->border_width = wr.size.width - r.size.width;
5633 FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height; 5664 tbar_height = FRAME_NS_TITLEBAR_HEIGHT (f) = wr.size.height - r.size.height;
5634 5665
5635 [win setAcceptsMouseMovedEvents: YES]; 5666 [win setAcceptsMouseMovedEvents: YES];
5636 [win setDelegate: self]; 5667 [win setDelegate: self];
@@ -5736,27 +5767,50 @@ not_in_argv (NSString *arg)
5736 5767
5737 NSTRACE (windowWillUseStandardFrame); 5768 NSTRACE (windowWillUseStandardFrame);
5738 5769
5739 if (abs (defaultFrame.size.height - result.size.height) 5770 if (fs_before_fs != -1) /* Entering fullscreen */
5740 > FRAME_LINE_HEIGHT (emacsframe)) 5771 {
5772 result = defaultFrame;
5773 }
5774 else if (next_maximized == FULLSCREEN_HEIGHT
5775 || (next_maximized == -1
5776 && abs (defaultFrame.size.height - result.size.height)
5777 > FRAME_LINE_HEIGHT (emacsframe)))
5741 { 5778 {
5742 /* first click */ 5779 /* first click */
5743 ns_userRect = result; 5780 ns_userRect = result;
5744 result.size.height = defaultFrame.size.height; 5781 maximized_height = result.size.height = defaultFrame.size.height;
5782 maximized_width = -1;
5745 result.origin.y = defaultFrame.origin.y; 5783 result.origin.y = defaultFrame.origin.y;
5784 [self setFSValue: FULLSCREEN_HEIGHT];
5785 }
5786 else if (next_maximized == FULLSCREEN_WIDTH)
5787 {
5788 ns_userRect = result;
5789 maximized_width = result.size.width = defaultFrame.size.width;
5790 maximized_height = -1;
5791 result.origin.x = defaultFrame.origin.x;
5792 [self setFSValue: FULLSCREEN_WIDTH];
5793 }
5794 else if (next_maximized == FULLSCREEN_MAXIMIZED
5795 || (next_maximized == -1
5796 && abs (defaultFrame.size.width - result.size.width)
5797 > FRAME_COLUMN_WIDTH (emacsframe)))
5798 {
5799 result = defaultFrame; /* second click */
5800 maximized_width = result.size.width;
5801 maximized_height = result.size.height;
5802 [self setFSValue: FULLSCREEN_MAXIMIZED];
5746 } 5803 }
5747 else 5804 else
5748 { 5805 {
5749 if (abs (defaultFrame.size.width - result.size.width) 5806 /* restore */
5750 > FRAME_COLUMN_WIDTH (emacsframe)) 5807 result = ns_userRect.size.height ? ns_userRect : result;
5751 result = defaultFrame; /* second click */ 5808 ns_userRect = NSMakeRect (0, 0, 0, 0);
5752 else 5809 [self setFSValue: FULLSCREEN_NONE];
5753 { 5810 maximized_width = maximized_width = -1;
5754 /* restore */
5755 result = ns_userRect.size.height ? ns_userRect : result;
5756 ns_userRect = NSMakeRect (0, 0, 0, 0);
5757 }
5758 } 5811 }
5759 5812
5813 if (fs_before_fs == -1) next_maximized = -1;
5760 [self windowWillResize: sender toSize: result.size]; 5814 [self windowWillResize: sender toSize: result.size];
5761 return result; 5815 return result;
5762} 5816}
@@ -5808,6 +5862,200 @@ not_in_argv (NSString *arg)
5808 } 5862 }
5809} 5863}
5810 5864
5865- (void)windowWillEnterFullScreen:(NSNotification *)notification
5866{
5867 fs_before_fs = fs_state;
5868}
5869
5870- (void)windowDidEnterFullScreen:(NSNotification *)notification
5871{
5872 [self setFSValue: FULLSCREEN_BOTH];
5873#ifndef NEW_STYLE_FS
5874 fprintf(stderr, "%s %d\n", __func__, FRAME_PIXEL_WIDTH (emacsframe));
5875 [self windowDidBecomeKey:notification];
5876#endif
5877}
5878
5879- (void)windowWillExitFullScreen:(NSNotification *)notification
5880{
5881 if (next_maximized != -1)
5882 fs_before_fs = next_maximized;
5883}
5884
5885- (void)windowDidExitFullScreen:(NSNotification *)notification
5886{
5887 [self setFSValue: fs_before_fs];
5888 fs_before_fs = -1;
5889 if (next_maximized != -1)
5890 [[self window] performZoom:self];
5891}
5892
5893- (void)toggleFullScreen: (id)sender
5894{
5895 /* Bugs remain:
5896 1) Having fullscreen in initial/default frame alist.
5897 2) Fullscreen in default frame alist only applied to first frame.
5898 */
5899
5900#ifdef NEW_STYLE_FS
5901 [[self window] toggleFullScreen:sender];
5902#else
5903 NSWindow *w = [self window], *fw;
5904 BOOL onFirstScreen = [[w screen]
5905 isEqual:[[NSScreen screens] objectAtIndex:0]];
5906 struct frame *f = emacsframe;
5907 NSSize sz;
5908 NSRect r;
5909 NSColor *col = ns_lookup_indexed_color (NS_FACE_BACKGROUND
5910 (FRAME_DEFAULT_FACE (f)),
5911 f);
5912
5913 sz.width = FRAME_COLUMN_WIDTH (f);
5914 sz.height = FRAME_LINE_HEIGHT (f);
5915
5916 if (fs_state != FULLSCREEN_BOTH)
5917 {
5918 /* Hide dock and menubar if we are on the primary screen. */
5919 if (onFirstScreen)
5920 {
5921#if defined (NS_IMPL_COCOA) && \
5922 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
5923 NSApplicationPresentationOptions options
5924 = NSApplicationPresentationAutoHideDock
5925 | NSApplicationPresentationAutoHideMenuBar;
5926
5927 [NSApp setPresentationOptions: options];
5928#else
5929 [NSMenu setMenuBarVisible:NO];
5930#endif
5931 }
5932
5933 fw = [[EmacsFSWindow alloc]
5934 initWithContentRect:[w contentRectForFrameRect:[w frame]]
5935 styleMask:NSBorderlessWindowMask
5936 backing:NSBackingStoreBuffered
5937 defer:YES
5938 screen:[w screen]];
5939
5940 [fw setContentView:[w contentView]];
5941 [fw setTitle:[w title]];
5942 [fw makeKeyAndOrderFront:NSApp];
5943 [fw setDelegate:self];
5944 [fw makeFirstResponder:self];
5945 [fw setAcceptsMouseMovedEvents: YES];
5946 [fw useOptimizedDrawing: YES];
5947 [fw setResizeIncrements: sz];
5948 [fw setBackgroundColor: col];
5949 if ([col alphaComponent] != 1.0)
5950 [fw setOpaque: NO];
5951
5952 f->border_width = 0;
5953 FRAME_NS_TITLEBAR_HEIGHT (f) = 0;
5954
5955 nonfs_window = w;
5956 [self windowWillEnterFullScreen:nil];
5957 [w orderOut:self];
5958 r = [fw frameRectForContentRect:[[fw screen] frame]];
5959 [fw setFrame: r display:YES animate:YES];
5960 [self windowDidEnterFullScreen:nil];
5961 }
5962 else
5963 {
5964 fw = w;
5965 w = nonfs_window;
5966
5967 if (onFirstScreen)
5968 {
5969#if defined (NS_IMPL_COCOA) && \
5970 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
5971 [NSApp setPresentationOptions: NSApplicationPresentationDefault];
5972#else
5973 [NSMenu setMenuBarVisible:YES];
5974#endif
5975 }
5976
5977 [w setContentView:[fw contentView]];
5978 [w setResizeIncrements: sz];
5979 [w setBackgroundColor: col];
5980 if ([col alphaComponent] != 1.0)
5981 [w setOpaque: NO];
5982
5983 f->border_width = bwidth;
5984 FRAME_NS_TITLEBAR_HEIGHT (f) = tbar_height;
5985
5986 [self windowWillExitFullScreen:nil];
5987 [fw setFrame: [w frame] display:YES animate:YES];
5988 [fw close];
5989 [w makeKeyAndOrderFront:NSApp];
5990 [self windowDidExitFullScreen:nil];
5991 }
5992#endif
5993}
5994
5995- (void)handleFS
5996{
5997 if (fs_state != emacsframe->want_fullscreen)
5998 {
5999 if (fs_state == FULLSCREEN_BOTH)
6000 {
6001 [self toggleFullScreen:self];
6002 }
6003
6004 switch (emacsframe->want_fullscreen)
6005 {
6006 case FULLSCREEN_BOTH:
6007 [self toggleFullScreen:self];
6008 break;
6009 case FULLSCREEN_WIDTH:
6010 next_maximized = FULLSCREEN_WIDTH;
6011 if (fs_state != FULLSCREEN_BOTH)
6012 [[self window] performZoom:self];
6013 break;
6014 case FULLSCREEN_HEIGHT:
6015 next_maximized = FULLSCREEN_HEIGHT;
6016 if (fs_state != FULLSCREEN_BOTH)
6017 [[self window] performZoom:self];
6018 break;
6019 case FULLSCREEN_MAXIMIZED:
6020 next_maximized = FULLSCREEN_MAXIMIZED;
6021 if (fs_state != FULLSCREEN_BOTH)
6022 [[self window] performZoom:self];
6023 break;
6024 case FULLSCREEN_NONE:
6025 if (fs_state != FULLSCREEN_BOTH)
6026 {
6027 next_maximized = FULLSCREEN_NONE;
6028 [[self window] performZoom:self];
6029 }
6030 break;
6031 }
6032
6033 emacsframe->want_fullscreen = FULLSCREEN_NONE;
6034 }
6035
6036}
6037
6038- (void) setFSValue: (int)value
6039{
6040 Lisp_Object lval = Qnil;
6041 switch (value)
6042 {
6043 case FULLSCREEN_BOTH:
6044 lval = Qfullboth;
6045 break;
6046 case FULLSCREEN_WIDTH:
6047 lval = Qfullwidth;
6048 break;
6049 case FULLSCREEN_HEIGHT:
6050 lval = Qfullheight;
6051 break;
6052 case FULLSCREEN_MAXIMIZED:
6053 lval = Qmaximized;
6054 break;
6055 }
6056 store_frame_param (emacsframe, Qfullscreen, lval);
6057 fs_state = value;
6058}
5811 6059
5812- (void)mouseEntered: (NSEvent *)theEvent 6060- (void)mouseEntered: (NSEvent *)theEvent
5813{ 6061{
@@ -6299,6 +6547,15 @@ not_in_argv (NSString *arg)
6299@end /* EmacsWindow */ 6547@end /* EmacsWindow */
6300 6548
6301 6549
6550@implementation EmacsFSWindow
6551
6552- (BOOL)canBecomeKeyWindow
6553{
6554 return YES;
6555}
6556
6557@end
6558
6302/* ========================================================================== 6559/* ==========================================================================
6303 6560
6304 EmacsScroller implementation 6561 EmacsScroller implementation
@@ -6369,13 +6626,13 @@ not_in_argv (NSString *arg)
6369- (void)setFrame: (NSRect)newRect 6626- (void)setFrame: (NSRect)newRect
6370{ 6627{
6371 NSTRACE (EmacsScroller_setFrame); 6628 NSTRACE (EmacsScroller_setFrame);
6372/* BLOCK_INPUT; */ 6629/* block_input (); */
6373 pixel_height = NSHeight (newRect); 6630 pixel_height = NSHeight (newRect);
6374 if (pixel_height == 0) pixel_height = 1; 6631 if (pixel_height == 0) pixel_height = 1;
6375 min_portion = 20 / pixel_height; 6632 min_portion = 20 / pixel_height;
6376 [super setFrame: newRect]; 6633 [super setFrame: newRect];
6377 [self display]; 6634 [self display];
6378/* UNBLOCK_INPUT; */ 6635/* unblock_input (); */
6379} 6636}
6380 6637
6381 6638
@@ -6410,14 +6667,14 @@ not_in_argv (NSString *arg)
6410 if (condemned) 6667 if (condemned)
6411 { 6668 {
6412 EmacsView *view; 6669 EmacsView *view;
6413 BLOCK_INPUT; 6670 block_input ();
6414 /* ensure other scrollbar updates after deletion */ 6671 /* ensure other scrollbar updates after deletion */
6415 view = (EmacsView *)FRAME_NS_VIEW (frame); 6672 view = (EmacsView *)FRAME_NS_VIEW (frame);
6416 if (view != nil) 6673 if (view != nil)
6417 view->scrollbarsNeedingUpdate++; 6674 view->scrollbarsNeedingUpdate++;
6418 [self removeFromSuperview]; 6675 [self removeFromSuperview];
6419 [self release]; 6676 [self release];
6420 UNBLOCK_INPUT; 6677 unblock_input ();
6421 } 6678 }
6422 return self; 6679 return self;
6423} 6680}
diff --git a/src/print.c b/src/print.c
index aae13bb6764..49b491faec8 100644
--- a/src/print.c
+++ b/src/print.c
@@ -753,9 +753,9 @@ append to existing target file. */)
753{ 753{
754 if (initial_stderr_stream != NULL) 754 if (initial_stderr_stream != NULL)
755 { 755 {
756 BLOCK_INPUT; 756 block_input ();
757 fclose (stderr); 757 fclose (stderr);
758 UNBLOCK_INPUT; 758 unblock_input ();
759 } 759 }
760 stderr = initial_stderr_stream; 760 stderr = initial_stderr_stream;
761 initial_stderr_stream = NULL; 761 initial_stderr_stream = NULL;
diff --git a/src/process.c b/src/process.c
index c654369627d..ab215766c07 100644
--- a/src/process.c
+++ b/src/process.c
@@ -255,11 +255,12 @@ static int keyboard_bit_set (SELECT_TYPE *);
255static void deactivate_process (Lisp_Object); 255static void deactivate_process (Lisp_Object);
256static void status_notify (struct Lisp_Process *); 256static void status_notify (struct Lisp_Process *);
257static int read_process_output (Lisp_Object, int); 257static int read_process_output (Lisp_Object, int);
258static void handle_child_signal (int);
258static void create_pty (Lisp_Object); 259static void create_pty (Lisp_Object);
259 260
260/* If we support a window system, turn on the code to poll periodically 261/* If we support a window system, turn on the code to poll periodically
261 to detect C-g. It isn't actually used when doing interrupt input. */ 262 to detect C-g. It isn't actually used when doing interrupt input. */
262#if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS) 263#ifdef HAVE_WINDOW_SYSTEM
263#define POLL_FOR_INPUT 264#define POLL_FOR_INPUT
264#endif 265#endif
265 266
@@ -1610,11 +1611,16 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1610 int wait_child_setup[2]; 1611 int wait_child_setup[2];
1611#endif 1612#endif
1612#ifdef SIGCHLD 1613#ifdef SIGCHLD
1613 sigset_t blocked, procmask; 1614 sigset_t blocked;
1614#endif 1615#endif
1615 /* Use volatile to protect variables from being clobbered by vfork. */ 1616 /* Use volatile to protect variables from being clobbered by vfork. */
1616 volatile int forkin, forkout; 1617 volatile int forkin, forkout;
1617 volatile int pty_flag = 0; 1618 volatile int pty_flag = 0;
1619 volatile Lisp_Object lisp_pty_name = Qnil;
1620 volatile Lisp_Object encoded_current_dir;
1621#if HAVE_WORKING_VFORK
1622 char **volatile save_environ;
1623#endif
1618 1624
1619 inchannel = outchannel = -1; 1625 inchannel = outchannel = -1;
1620 1626
@@ -1640,6 +1646,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1640 forkin = forkout = -1; 1646 forkin = forkout = -1;
1641#endif /* not USG, or USG_SUBTTY_WORKS */ 1647#endif /* not USG, or USG_SUBTTY_WORKS */
1642 pty_flag = 1; 1648 pty_flag = 1;
1649 lisp_pty_name = build_string (pty_name);
1643 } 1650 }
1644 else 1651 else
1645#endif /* HAVE_PTYS */ 1652#endif /* HAVE_PTYS */
@@ -1704,14 +1711,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1704 XPROCESS (process)->pty_flag = pty_flag; 1711 XPROCESS (process)->pty_flag = pty_flag;
1705 pset_status (XPROCESS (process), Qrun); 1712 pset_status (XPROCESS (process), Qrun);
1706 1713
1707#ifdef SIGCHLD
1708 /* Delay interrupts until we have a chance to store
1709 the new fork's pid in its process structure */
1710 sigemptyset (&blocked);
1711 sigaddset (&blocked, SIGCHLD);
1712 pthread_sigmask (SIG_BLOCK, &blocked, &procmask);
1713#endif
1714
1715 FD_SET (inchannel, &input_wait_mask); 1714 FD_SET (inchannel, &input_wait_mask);
1716 FD_SET (inchannel, &non_keyboard_wait_mask); 1715 FD_SET (inchannel, &non_keyboard_wait_mask);
1717 if (inchannel > max_process_desc) 1716 if (inchannel > max_process_desc)
@@ -1729,89 +1728,99 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1729 error. */ 1728 error. */
1730 setup_process_coding_systems (process); 1729 setup_process_coding_systems (process);
1731 1730
1732 BLOCK_INPUT; 1731 encoded_current_dir = ENCODE_FILE (current_dir);
1733 1732
1734 { 1733 block_input ();
1735 /* child_setup must clobber environ on systems with true vfork. 1734
1736 Protect it from permanent change. */ 1735#ifdef SIGCHLD
1737 char **save_environ = environ; 1736 /* Block SIGCHLD until we have a chance to store the new fork's
1738 volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir); 1737 pid in its process structure. */
1738 sigemptyset (&blocked);
1739 sigaddset (&blocked, SIGCHLD);
1740 pthread_sigmask (SIG_BLOCK, &blocked, 0);
1741#endif
1742
1743#if HAVE_WORKING_VFORK
1744 /* child_setup must clobber environ on systems with true vfork.
1745 Protect it from permanent change. */
1746 save_environ = environ;
1747#endif
1739 1748
1740#ifndef WINDOWSNT 1749#ifndef WINDOWSNT
1741 pid = vfork (); 1750 pid = vfork ();
1742 if (pid == 0) 1751 if (pid == 0)
1743#endif /* not WINDOWSNT */ 1752#endif /* not WINDOWSNT */
1744 { 1753 {
1745 int xforkin = forkin; 1754 int xforkin = forkin;
1746 int xforkout = forkout; 1755 int xforkout = forkout;
1747 1756
1748 /* Make the pty be the controlling terminal of the process. */ 1757 /* Make the pty be the controlling terminal of the process. */
1749#ifdef HAVE_PTYS 1758#ifdef HAVE_PTYS
1750 /* First, disconnect its current controlling terminal. */ 1759 /* First, disconnect its current controlling terminal. */
1751#ifdef HAVE_SETSID 1760#ifdef HAVE_SETSID
1752 /* We tried doing setsid only if pty_flag, but it caused 1761 /* We tried doing setsid only if pty_flag, but it caused
1753 process_set_signal to fail on SGI when using a pipe. */ 1762 process_set_signal to fail on SGI when using a pipe. */
1754 setsid (); 1763 setsid ();
1755 /* Make the pty's terminal the controlling terminal. */ 1764 /* Make the pty's terminal the controlling terminal. */
1756 if (pty_flag && xforkin >= 0) 1765 if (pty_flag && xforkin >= 0)
1757 { 1766 {
1758#ifdef TIOCSCTTY 1767#ifdef TIOCSCTTY
1759 /* We ignore the return value 1768 /* We ignore the return value
1760 because faith@cs.unc.edu says that is necessary on Linux. */ 1769 because faith@cs.unc.edu says that is necessary on Linux. */
1761 ioctl (xforkin, TIOCSCTTY, 0); 1770 ioctl (xforkin, TIOCSCTTY, 0);
1762#endif 1771#endif
1763 } 1772 }
1764#else /* not HAVE_SETSID */ 1773#else /* not HAVE_SETSID */
1765#ifdef USG 1774#ifdef USG
1766 /* It's very important to call setpgrp here and no time 1775 /* It's very important to call setpgrp here and no time
1767 afterwards. Otherwise, we lose our controlling tty which 1776 afterwards. Otherwise, we lose our controlling tty which
1768 is set when we open the pty. */ 1777 is set when we open the pty. */
1769 setpgrp (); 1778 setpgrp ();
1770#endif /* USG */ 1779#endif /* USG */
1771#endif /* not HAVE_SETSID */ 1780#endif /* not HAVE_SETSID */
1772#if defined (LDISC1) 1781#if defined (LDISC1)
1773 if (pty_flag && xforkin >= 0) 1782 if (pty_flag && xforkin >= 0)
1774 { 1783 {
1775 struct termios t; 1784 struct termios t;
1776 tcgetattr (xforkin, &t); 1785 tcgetattr (xforkin, &t);
1777 t.c_lflag = LDISC1; 1786 t.c_lflag = LDISC1;
1778 if (tcsetattr (xforkin, TCSANOW, &t) < 0) 1787 if (tcsetattr (xforkin, TCSANOW, &t) < 0)
1779 emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39); 1788 emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39);
1780 } 1789 }
1781#else 1790#else
1782#if defined (NTTYDISC) && defined (TIOCSETD) 1791#if defined (NTTYDISC) && defined (TIOCSETD)
1783 if (pty_flag && xforkin >= 0) 1792 if (pty_flag && xforkin >= 0)
1784 { 1793 {
1785 /* Use new line discipline. */ 1794 /* Use new line discipline. */
1786 int ldisc = NTTYDISC; 1795 int ldisc = NTTYDISC;
1787 ioctl (xforkin, TIOCSETD, &ldisc); 1796 ioctl (xforkin, TIOCSETD, &ldisc);
1788 } 1797 }
1789#endif 1798#endif
1790#endif 1799#endif
1791#ifdef TIOCNOTTY 1800#ifdef TIOCNOTTY
1792 /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you 1801 /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you
1793 can do TIOCSPGRP only to the process's controlling tty. */ 1802 can do TIOCSPGRP only to the process's controlling tty. */
1794 if (pty_flag) 1803 if (pty_flag)
1795 { 1804 {
1796 /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? 1805 /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
1797 I can't test it since I don't have 4.3. */ 1806 I can't test it since I don't have 4.3. */
1798 int j = emacs_open ("/dev/tty", O_RDWR, 0); 1807 int j = emacs_open ("/dev/tty", O_RDWR, 0);
1799 if (j >= 0) 1808 if (j >= 0)
1800 { 1809 {
1801 ioctl (j, TIOCNOTTY, 0); 1810 ioctl (j, TIOCNOTTY, 0);
1802 emacs_close (j); 1811 emacs_close (j);
1803 } 1812 }
1804#ifndef USG 1813#ifndef USG
1805 /* In order to get a controlling terminal on some versions 1814 /* In order to get a controlling terminal on some versions
1806 of BSD, it is necessary to put the process in pgrp 0 1815 of BSD, it is necessary to put the process in pgrp 0
1807 before it opens the terminal. */ 1816 before it opens the terminal. */
1808#ifdef HAVE_SETPGID 1817#ifdef HAVE_SETPGID
1809 setpgid (0, 0); 1818 setpgid (0, 0);
1810#else 1819#else
1811 setpgrp (0, 0); 1820 setpgrp (0, 0);
1812#endif 1821#endif
1813#endif 1822#endif
1814 } 1823 }
1815#endif /* TIOCNOTTY */ 1824#endif /* TIOCNOTTY */
1816 1825
1817#if !defined (DONT_REOPEN_PTY) 1826#if !defined (DONT_REOPEN_PTY)
@@ -1823,70 +1832,79 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1823 both HAVE_SETSID and TIOCSCTTY are defined. */ 1832 both HAVE_SETSID and TIOCSCTTY are defined. */
1824 /* Now close the pty (if we had it open) and reopen it. 1833 /* Now close the pty (if we had it open) and reopen it.
1825 This makes the pty the controlling terminal of the subprocess. */ 1834 This makes the pty the controlling terminal of the subprocess. */
1826 if (pty_flag) 1835 if (pty_flag)
1827 { 1836 {
1828 1837
1829 /* I wonder if emacs_close (emacs_open (pty_name, ...)) 1838 /* I wonder if emacs_close (emacs_open (pty_name, ...))
1830 would work? */ 1839 would work? */
1831 if (xforkin >= 0) 1840 if (xforkin >= 0)
1832 emacs_close (xforkin); 1841 emacs_close (xforkin);
1833 xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0); 1842 xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0);
1834 1843
1835 if (xforkin < 0) 1844 if (xforkin < 0)
1836 { 1845 {
1837 emacs_write (1, "Couldn't open the pty terminal ", 31); 1846 emacs_write (1, "Couldn't open the pty terminal ", 31);
1838 emacs_write (1, pty_name, strlen (pty_name)); 1847 emacs_write (1, pty_name, strlen (pty_name));
1839 emacs_write (1, "\n", 1); 1848 emacs_write (1, "\n", 1);
1840 _exit (1); 1849 _exit (1);
1841 } 1850 }
1842 1851
1843 } 1852 }
1844#endif /* not DONT_REOPEN_PTY */ 1853#endif /* not DONT_REOPEN_PTY */
1845 1854
1846#ifdef SETUP_SLAVE_PTY 1855#ifdef SETUP_SLAVE_PTY
1847 if (pty_flag) 1856 if (pty_flag)
1848 { 1857 {
1849 SETUP_SLAVE_PTY; 1858 SETUP_SLAVE_PTY;
1850 } 1859 }
1851#endif /* SETUP_SLAVE_PTY */ 1860#endif /* SETUP_SLAVE_PTY */
1852#ifdef AIX 1861#ifdef AIX
1853 /* On AIX, we've disabled SIGHUP above once we start a child on a pty. 1862 /* On AIX, we've disabled SIGHUP above once we start a child on a pty.
1854 Now reenable it in the child, so it will die when we want it to. */ 1863 Now reenable it in the child, so it will die when we want it to. */
1855 if (pty_flag) 1864 if (pty_flag)
1856 signal (SIGHUP, SIG_DFL); 1865 signal (SIGHUP, SIG_DFL);
1857#endif 1866#endif
1858#endif /* HAVE_PTYS */ 1867#endif /* HAVE_PTYS */
1859 1868
1860 signal (SIGINT, SIG_DFL); 1869 signal (SIGINT, SIG_DFL);
1861 signal (SIGQUIT, SIG_DFL); 1870 signal (SIGQUIT, SIG_DFL);
1862 /* GConf causes us to ignore SIGPIPE, make sure it is restored 1871
1863 in the child. */ 1872 /* Emacs ignores SIGPIPE, but the child should not. */
1864 signal (SIGPIPE, SIG_DFL); 1873 signal (SIGPIPE, SIG_DFL);
1865 1874
1866#ifdef SIGCHLD 1875#ifdef SIGCHLD
1867 /* Stop blocking signals in the child. */ 1876 /* Stop blocking signals in the child. */
1868 pthread_sigmask (SIG_SETMASK, &procmask, 0); 1877 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
1869#endif 1878#endif
1870 1879
1871 if (pty_flag) 1880 if (pty_flag)
1872 child_setup_tty (xforkout); 1881 child_setup_tty (xforkout);
1873#ifdef WINDOWSNT 1882#ifdef WINDOWSNT
1874 pid = child_setup (xforkin, xforkout, xforkout, 1883 pid = child_setup (xforkin, xforkout, xforkout,
1875 new_argv, 1, encoded_current_dir); 1884 new_argv, 1, encoded_current_dir);
1876#else /* not WINDOWSNT */ 1885#else /* not WINDOWSNT */
1877#ifdef FD_CLOEXEC 1886#ifdef FD_CLOEXEC
1878 emacs_close (wait_child_setup[0]); 1887 emacs_close (wait_child_setup[0]);
1879#endif 1888#endif
1880 child_setup (xforkin, xforkout, xforkout, 1889 child_setup (xforkin, xforkout, xforkout,
1881 new_argv, 1, encoded_current_dir); 1890 new_argv, 1, encoded_current_dir);
1882#endif /* not WINDOWSNT */ 1891#endif /* not WINDOWSNT */
1883 } 1892 }
1884 environ = save_environ; 1893
1885 } 1894 /* Back in the parent process. */
1895
1896#if HAVE_WORKING_VFORK
1897 environ = save_environ;
1898#endif
1899
1900 XPROCESS (process)->pid = pid;
1886 1901
1887 UNBLOCK_INPUT; 1902 /* Stop blocking signals in the parent. */
1903#ifdef SIGCHLD
1904 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
1905#endif
1906 unblock_input ();
1888 1907
1889 /* This runs in the Emacs process. */
1890 if (pid < 0) 1908 if (pid < 0)
1891 { 1909 {
1892 if (forkin >= 0) 1910 if (forkin >= 0)
@@ -1897,7 +1915,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1897 else 1915 else
1898 { 1916 {
1899 /* vfork succeeded. */ 1917 /* vfork succeeded. */
1900 XPROCESS (process)->pid = pid;
1901 1918
1902#ifdef WINDOWSNT 1919#ifdef WINDOWSNT
1903 register_child (pid, inchannel); 1920 register_child (pid, inchannel);
@@ -1923,12 +1940,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1923 if (forkin != forkout && forkout >= 0) 1940 if (forkin != forkout && forkout >= 0)
1924 emacs_close (forkout); 1941 emacs_close (forkout);
1925 1942
1926#ifdef HAVE_PTYS 1943 pset_tty_name (XPROCESS (process), lisp_pty_name);
1927 if (pty_flag)
1928 pset_tty_name (XPROCESS (process), build_string (pty_name));
1929 else
1930#endif
1931 pset_tty_name (XPROCESS (process), Qnil);
1932 1944
1933#if !defined (WINDOWSNT) && defined (FD_CLOEXEC) 1945#if !defined (WINDOWSNT) && defined (FD_CLOEXEC)
1934 /* Wait for child_setup to complete in case that vfork is 1946 /* Wait for child_setup to complete in case that vfork is
@@ -1945,11 +1957,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1945#endif 1957#endif
1946 } 1958 }
1947 1959
1948#ifdef SIGCHLD
1949 /* Stop blocking signals in the parent. */
1950 pthread_sigmask (SIG_SETMASK, &procmask, 0);
1951#endif
1952
1953 /* Now generate the error if vfork failed. */ 1960 /* Now generate the error if vfork failed. */
1954 if (pid < 0) 1961 if (pid < 0)
1955 report_file_error ("Doing vfork", Qnil); 1962 report_file_error ("Doing vfork", Qnil);
@@ -3402,9 +3409,9 @@ usage: (make-network-process &rest ARGS) */)
3402#ifdef HAVE_GETADDRINFO 3409#ifdef HAVE_GETADDRINFO
3403 if (res != &ai) 3410 if (res != &ai)
3404 { 3411 {
3405 BLOCK_INPUT; 3412 block_input ();
3406 freeaddrinfo (res); 3413 freeaddrinfo (res);
3407 UNBLOCK_INPUT; 3414 unblock_input ();
3408 } 3415 }
3409#endif 3416#endif
3410 3417
@@ -4372,7 +4379,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4372 Otherwise, do pending quit if requested. */ 4379 Otherwise, do pending quit if requested. */
4373 if (read_kbd >= 0) 4380 if (read_kbd >= 0)
4374 QUIT; 4381 QUIT;
4375 else 4382 else if (pending_signals)
4376 process_pending_signals (); 4383 process_pending_signals ();
4377 4384
4378 /* Exit now if the cell we're waiting for became non-nil. */ 4385 /* Exit now if the cell we're waiting for became non-nil. */
@@ -4739,21 +4746,6 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4739 check_write = 0; 4746 check_write = 0;
4740 } 4747 }
4741 4748
4742#if 0 /* When polling is used, interrupt_input is 0,
4743 so get_input_pending should read the input.
4744 So this should not be needed. */
4745 /* If we are using polling for input,
4746 and we see input available, make it get read now.
4747 Otherwise it might not actually get read for a second.
4748 And on hpux, since we turn off polling in wait_reading_process_output,
4749 it might never get read at all if we don't spend much time
4750 outside of wait_reading_process_output. */
4751 if (read_kbd && interrupt_input
4752 && keyboard_bit_set (&Available)
4753 && input_polling_used ())
4754 kill (getpid (), SIGALRM);
4755#endif
4756
4757 /* Check for keyboard input */ 4749 /* Check for keyboard input */
4758 /* If there is any, return immediately 4750 /* If there is any, return immediately
4759 to give it higher priority than subprocesses */ 4751 to give it higher priority than subprocesses */
@@ -4817,7 +4809,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4817 4809
4818 if (read_kbd && interrupt_input 4810 if (read_kbd && interrupt_input
4819 && keyboard_bit_set (&Available) && ! noninteractive) 4811 && keyboard_bit_set (&Available) && ! noninteractive)
4820 kill (getpid (), SIGIO); 4812 handle_input_available_signal (SIGIO);
4821#endif 4813#endif
4822 4814
4823 if (! wait_proc) 4815 if (! wait_proc)
@@ -4937,7 +4929,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4937 pset_status (p, Qfailed); 4929 pset_status (p, Qfailed);
4938 } 4930 }
4939 else 4931 else
4940 kill (getpid (), SIGCHLD); 4932 handle_child_signal (SIGCHLD);
4941 } 4933 }
4942#endif /* HAVE_PTYS */ 4934#endif /* HAVE_PTYS */
4943 /* If we can detect process termination, don't consider the 4935 /* If we can detect process termination, don't consider the
@@ -5393,25 +5385,6 @@ read_process_output (Lisp_Object proc, register int channel)
5393 5385
5394/* Sending data to subprocess */ 5386/* Sending data to subprocess */
5395 5387
5396static sys_jmp_buf send_process_frame;
5397static Lisp_Object process_sent_to;
5398
5399static _Noreturn void
5400handle_pipe_signal (int sig)
5401{
5402 sigset_t unblocked;
5403 sigemptyset (&unblocked);
5404 sigaddset (&unblocked, SIGPIPE);
5405 pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
5406 sys_longjmp (send_process_frame, 1);
5407}
5408
5409static void
5410deliver_pipe_signal (int sig)
5411{
5412 handle_on_main_thread (sig, handle_pipe_signal);
5413}
5414
5415/* In send_process, when a write fails temporarily, 5388/* In send_process, when a write fails temporarily,
5416 wait_reading_process_output is called. It may execute user code, 5389 wait_reading_process_output is called. It may execute user code,
5417 e.g. timers, that attempts to write new data to the same process. 5390 e.g. timers, that attempts to write new data to the same process.
@@ -5495,14 +5468,12 @@ write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
5495 This function can evaluate Lisp code and can garbage collect. */ 5468 This function can evaluate Lisp code and can garbage collect. */
5496 5469
5497static void 5470static void
5498send_process (volatile Lisp_Object proc, const char *volatile buf, 5471send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
5499 volatile ptrdiff_t len, volatile Lisp_Object object) 5472 Lisp_Object object)
5500{ 5473{
5501 /* Use volatile to protect variables from being clobbered by longjmp. */
5502 struct Lisp_Process *p = XPROCESS (proc); 5474 struct Lisp_Process *p = XPROCESS (proc);
5503 ssize_t rv; 5475 ssize_t rv;
5504 struct coding_system *coding; 5476 struct coding_system *coding;
5505 struct sigaction old_sigpipe_action;
5506 5477
5507 if (p->raw_status_new) 5478 if (p->raw_status_new)
5508 update_status (p); 5479 update_status (p);
@@ -5609,145 +5580,126 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
5609 pty_max_bytes--; 5580 pty_max_bytes--;
5610 } 5581 }
5611 5582
5612 /* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2, 5583 /* If there is already data in the write_queue, put the new data
5613 CFLAGS="-g -O": The value of the parameter `proc' is clobbered 5584 in the back of queue. Otherwise, ignore it. */
5614 when returning with longjmp despite being declared volatile. */ 5585 if (!NILP (p->write_queue))
5615 if (!sys_setjmp (send_process_frame)) 5586 write_queue_push (p, object, buf, len, 0);
5616 {
5617 p = XPROCESS (proc); /* Repair any setjmp clobbering. */
5618 process_sent_to = proc;
5619 5587
5620 /* If there is already data in the write_queue, put the new data 5588 do /* while !NILP (p->write_queue) */
5621 in the back of queue. Otherwise, ignore it. */ 5589 {
5622 if (!NILP (p->write_queue)) 5590 ptrdiff_t cur_len = -1;
5623 write_queue_push (p, object, buf, len, 0); 5591 const char *cur_buf;
5592 Lisp_Object cur_object;
5624 5593
5625 do /* while !NILP (p->write_queue) */ 5594 /* If write_queue is empty, ignore it. */
5595 if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len))
5626 { 5596 {
5627 ptrdiff_t cur_len = -1; 5597 cur_len = len;
5628 const char *cur_buf; 5598 cur_buf = buf;
5629 Lisp_Object cur_object; 5599 cur_object = object;
5600 }
5630 5601
5631 /* If write_queue is empty, ignore it. */ 5602 while (cur_len > 0)
5632 if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len)) 5603 {
5604 /* Send this batch, using one or more write calls. */
5605 ptrdiff_t written = 0;
5606 int outfd = p->outfd;
5607#ifdef DATAGRAM_SOCKETS
5608 if (DATAGRAM_CHAN_P (outfd))
5633 { 5609 {
5634 cur_len = len; 5610 rv = sendto (outfd, cur_buf, cur_len,
5635 cur_buf = buf; 5611 0, datagram_address[outfd].sa,
5636 cur_object = object; 5612 datagram_address[outfd].len);
5613 if (0 <= rv)
5614 written = rv;
5615 else if (errno == EMSGSIZE)
5616 report_file_error ("sending datagram", Fcons (proc, Qnil));
5637 } 5617 }
5638 5618 else
5639 while (cur_len > 0)
5640 {
5641 /* Send this batch, using one or more write calls. */
5642 ptrdiff_t written = 0;
5643 int outfd = p->outfd;
5644 struct sigaction action;
5645 emacs_sigaction_init (&action, deliver_pipe_signal);
5646 sigaction (SIGPIPE, &action, &old_sigpipe_action);
5647#ifdef DATAGRAM_SOCKETS
5648 if (DATAGRAM_CHAN_P (outfd))
5649 {
5650 rv = sendto (outfd, cur_buf, cur_len,
5651 0, datagram_address[outfd].sa,
5652 datagram_address[outfd].len);
5653 if (0 <= rv)
5654 written = rv;
5655 else if (errno == EMSGSIZE)
5656 {
5657 sigaction (SIGPIPE, &old_sigpipe_action, 0);
5658 report_file_error ("sending datagram",
5659 Fcons (proc, Qnil));
5660 }
5661 }
5662 else
5663#endif 5619#endif
5664 { 5620 {
5665#ifdef HAVE_GNUTLS 5621#ifdef HAVE_GNUTLS
5666 if (p->gnutls_p) 5622 if (p->gnutls_p)
5667 written = emacs_gnutls_write (p, cur_buf, cur_len); 5623 written = emacs_gnutls_write (p, cur_buf, cur_len);
5668 else 5624 else
5669#endif 5625#endif
5670 written = emacs_write (outfd, cur_buf, cur_len); 5626 written = emacs_write (outfd, cur_buf, cur_len);
5671 rv = (written ? 0 : -1); 5627 rv = (written ? 0 : -1);
5672#ifdef ADAPTIVE_READ_BUFFERING 5628#ifdef ADAPTIVE_READ_BUFFERING
5673 if (p->read_output_delay > 0 5629 if (p->read_output_delay > 0
5674 && p->adaptive_read_buffering == 1) 5630 && p->adaptive_read_buffering == 1)
5675 { 5631 {
5676 p->read_output_delay = 0; 5632 p->read_output_delay = 0;
5677 process_output_delay_count--; 5633 process_output_delay_count--;
5678 p->read_output_skip = 0; 5634 p->read_output_skip = 0;
5679 }
5680#endif
5681 } 5635 }
5682 sigaction (SIGPIPE, &old_sigpipe_action, 0); 5636#endif
5637 }
5683 5638
5684 if (rv < 0) 5639 if (rv < 0)
5685 { 5640 {
5686 if (0 5641 if (0
5687#ifdef EWOULDBLOCK 5642#ifdef EWOULDBLOCK
5688 || errno == EWOULDBLOCK 5643 || errno == EWOULDBLOCK
5689#endif 5644#endif
5690#ifdef EAGAIN 5645#ifdef EAGAIN
5691 || errno == EAGAIN 5646 || errno == EAGAIN
5692#endif 5647#endif
5693 ) 5648 )
5694 /* Buffer is full. Wait, accepting input; 5649 /* Buffer is full. Wait, accepting input;
5695 that may allow the program 5650 that may allow the program
5696 to finish doing output and read more. */ 5651 to finish doing output and read more. */
5697 { 5652 {
5698#ifdef BROKEN_PTY_READ_AFTER_EAGAIN 5653#ifdef BROKEN_PTY_READ_AFTER_EAGAIN
5699 /* A gross hack to work around a bug in FreeBSD. 5654 /* A gross hack to work around a bug in FreeBSD.
5700 In the following sequence, read(2) returns 5655 In the following sequence, read(2) returns
5701 bogus data: 5656 bogus data:
5702 5657
5703 write(2) 1022 bytes 5658 write(2) 1022 bytes
5704 write(2) 954 bytes, get EAGAIN 5659 write(2) 954 bytes, get EAGAIN
5705 read(2) 1024 bytes in process_read_output 5660 read(2) 1024 bytes in process_read_output
5706 read(2) 11 bytes in process_read_output 5661 read(2) 11 bytes in process_read_output
5707 5662
5708 That is, read(2) returns more bytes than have 5663 That is, read(2) returns more bytes than have
5709 ever been written successfully. The 1033 bytes 5664 ever been written successfully. The 1033 bytes
5710 read are the 1022 bytes written successfully 5665 read are the 1022 bytes written successfully
5711 after processing (for example with CRs added if 5666 after processing (for example with CRs added if
5712 the terminal is set up that way which it is 5667 the terminal is set up that way which it is
5713 here). The same bytes will be seen again in a 5668 here). The same bytes will be seen again in a
5714 later read(2), without the CRs. */ 5669 later read(2), without the CRs. */
5715 5670
5716 if (errno == EAGAIN) 5671 if (errno == EAGAIN)
5717 { 5672 {
5718 int flags = FWRITE; 5673 int flags = FWRITE;
5719 ioctl (p->outfd, TIOCFLUSH, &flags); 5674 ioctl (p->outfd, TIOCFLUSH, &flags);
5720 } 5675 }
5721#endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ 5676#endif /* BROKEN_PTY_READ_AFTER_EAGAIN */
5722 5677
5723 /* Put what we should have written in wait_queue. */ 5678 /* Put what we should have written in wait_queue. */
5724 write_queue_push (p, cur_object, cur_buf, cur_len, 1); 5679 write_queue_push (p, cur_object, cur_buf, cur_len, 1);
5725 wait_reading_process_output (0, 20 * 1000 * 1000, 5680 wait_reading_process_output (0, 20 * 1000 * 1000,
5726 0, 0, Qnil, NULL, 0); 5681 0, 0, Qnil, NULL, 0);
5727 /* Reread queue, to see what is left. */ 5682 /* Reread queue, to see what is left. */
5728 break; 5683 break;
5729 }
5730 else
5731 /* This is a real error. */
5732 report_file_error ("writing to process", Fcons (proc, Qnil));
5733 } 5684 }
5734 cur_buf += written; 5685 else if (errno == EPIPE)
5735 cur_len -= written; 5686 {
5687 p->raw_status_new = 0;
5688 pset_status (p, list2 (Qexit, make_number (256)));
5689 p->tick = ++process_tick;
5690 deactivate_process (proc);
5691 error ("process %s no longer connected to pipe; closed it",
5692 SDATA (p->name));
5693 }
5694 else
5695 /* This is a real error. */
5696 report_file_error ("writing to process", Fcons (proc, Qnil));
5736 } 5697 }
5698 cur_buf += written;
5699 cur_len -= written;
5737 } 5700 }
5738 while (!NILP (p->write_queue));
5739 }
5740 else
5741 {
5742 sigaction (SIGPIPE, &old_sigpipe_action, 0);
5743 proc = process_sent_to;
5744 p = XPROCESS (proc);
5745 p->raw_status_new = 0;
5746 pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil)));
5747 p->tick = ++process_tick;
5748 deactivate_process (proc);
5749 error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
5750 } 5701 }
5702 while (!NILP (p->write_queue));
5751} 5703}
5752 5704
5753DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region, 5705DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region,
@@ -6178,39 +6130,27 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */)
6178#ifdef SIGUSR2 6130#ifdef SIGUSR2
6179 parse_signal ("usr2", SIGUSR2); 6131 parse_signal ("usr2", SIGUSR2);
6180#endif 6132#endif
6181#ifdef SIGTERM
6182 parse_signal ("term", SIGTERM); 6133 parse_signal ("term", SIGTERM);
6183#endif
6184#ifdef SIGHUP 6134#ifdef SIGHUP
6185 parse_signal ("hup", SIGHUP); 6135 parse_signal ("hup", SIGHUP);
6186#endif 6136#endif
6187#ifdef SIGINT
6188 parse_signal ("int", SIGINT); 6137 parse_signal ("int", SIGINT);
6189#endif
6190#ifdef SIGQUIT 6138#ifdef SIGQUIT
6191 parse_signal ("quit", SIGQUIT); 6139 parse_signal ("quit", SIGQUIT);
6192#endif 6140#endif
6193#ifdef SIGILL
6194 parse_signal ("ill", SIGILL); 6141 parse_signal ("ill", SIGILL);
6195#endif
6196#ifdef SIGABRT
6197 parse_signal ("abrt", SIGABRT); 6142 parse_signal ("abrt", SIGABRT);
6198#endif
6199#ifdef SIGEMT 6143#ifdef SIGEMT
6200 parse_signal ("emt", SIGEMT); 6144 parse_signal ("emt", SIGEMT);
6201#endif 6145#endif
6202#ifdef SIGKILL 6146#ifdef SIGKILL
6203 parse_signal ("kill", SIGKILL); 6147 parse_signal ("kill", SIGKILL);
6204#endif 6148#endif
6205#ifdef SIGFPE
6206 parse_signal ("fpe", SIGFPE); 6149 parse_signal ("fpe", SIGFPE);
6207#endif
6208#ifdef SIGBUS 6150#ifdef SIGBUS
6209 parse_signal ("bus", SIGBUS); 6151 parse_signal ("bus", SIGBUS);
6210#endif 6152#endif
6211#ifdef SIGSEGV
6212 parse_signal ("segv", SIGSEGV); 6153 parse_signal ("segv", SIGSEGV);
6213#endif
6214#ifdef SIGSYS 6154#ifdef SIGSYS
6215 parse_signal ("sys", SIGSYS); 6155 parse_signal ("sys", SIGSYS);
6216#endif 6156#endif
@@ -6375,27 +6315,15 @@ process has been transmitted to the serial port. */)
6375 ** Malloc WARNING: This should never call malloc either directly or 6315 ** Malloc WARNING: This should never call malloc either directly or
6376 indirectly; if it does, that is a bug */ 6316 indirectly; if it does, that is a bug */
6377 6317
6378#ifdef SIGCHLD 6318/* Record the changed status of the child process PID with wait status W. */
6379 6319void
6380/* Record one child's changed status. Return true if a child was found. */ 6320record_child_status_change (pid_t pid, int w)
6381static bool
6382record_child_status_change (void)
6383{ 6321{
6322#ifdef SIGCHLD
6384 Lisp_Object proc; 6323 Lisp_Object proc;
6385 struct Lisp_Process *p; 6324 struct Lisp_Process *p;
6386 pid_t pid;
6387 int w;
6388 Lisp_Object tail; 6325 Lisp_Object tail;
6389 6326
6390 do
6391 pid = waitpid (-1, &w, WNOHANG | WUNTRACED);
6392 while (pid < 0 && errno == EINTR);
6393
6394 /* PID == 0 means no processes found, PID == -1 means a real failure.
6395 Either way, we have done all our job. */
6396 if (pid <= 0)
6397 return false;
6398
6399 /* Find the process that signaled us, and record its status. */ 6327 /* Find the process that signaled us, and record its status. */
6400 6328
6401 /* The process can have been deleted by Fdelete_process. */ 6329 /* The process can have been deleted by Fdelete_process. */
@@ -6406,7 +6334,7 @@ record_child_status_change (void)
6406 || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid))) 6334 || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid)))
6407 { 6335 {
6408 XSETCAR (tail, Qnil); 6336 XSETCAR (tail, Qnil);
6409 return true; 6337 return;
6410 } 6338 }
6411 } 6339 }
6412 6340
@@ -6476,10 +6404,11 @@ record_child_status_change (void)
6476 if (input_available_clear_time) 6404 if (input_available_clear_time)
6477 *input_available_clear_time = make_emacs_time (0, 0); 6405 *input_available_clear_time = make_emacs_time (0, 0);
6478 } 6406 }
6479 6407#endif
6480 return true;
6481} 6408}
6482 6409
6410#ifdef SIGCHLD
6411
6483/* On some systems, the SIGCHLD handler must return right away. If 6412/* On some systems, the SIGCHLD handler must return right away. If
6484 any more processes want to signal us, we will get another signal. 6413 any more processes want to signal us, we will get another signal.
6485 Otherwise, loop around to use up all the processes that have 6414 Otherwise, loop around to use up all the processes that have
@@ -6495,14 +6424,29 @@ enum { CAN_HANDLE_MULTIPLE_CHILDREN = 1 };
6495static void 6424static void
6496handle_child_signal (int sig) 6425handle_child_signal (int sig)
6497{ 6426{
6498 while (record_child_status_change () && CAN_HANDLE_MULTIPLE_CHILDREN) 6427 do
6499 continue; 6428 {
6429 pid_t pid;
6430 int status;
6431
6432 do
6433 pid = waitpid (-1, &status, WNOHANG | WUNTRACED);
6434 while (pid < 0 && errno == EINTR);
6435
6436 /* PID == 0 means no processes found, PID == -1 means a real failure.
6437 Either way, we have done all our job. */
6438 if (pid <= 0)
6439 break;
6440
6441 record_child_status_change (pid, status);
6442 }
6443 while (CAN_HANDLE_MULTIPLE_CHILDREN);
6500} 6444}
6501 6445
6502static void 6446static void
6503deliver_child_signal (int sig) 6447deliver_child_signal (int sig)
6504{ 6448{
6505 handle_on_main_thread (sig, handle_child_signal); 6449 deliver_process_signal (sig, handle_child_signal);
6506} 6450}
6507 6451
6508#endif /* SIGCHLD */ 6452#endif /* SIGCHLD */
diff --git a/src/profiler.c b/src/profiler.c
new file mode 100644
index 00000000000..90a85c5230e
--- /dev/null
+++ b/src/profiler.c
@@ -0,0 +1,518 @@
1/* Profiler implementation.
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#include <config.h>
21#include "lisp.h"
22#include "syssignal.h"
23#include "systime.h"
24
25/* Return A + B, but return the maximum fixnum if the result would overflow.
26 Assume A and B are nonnegative and in fixnum range. */
27
28static EMACS_INT
29saturated_add (EMACS_INT a, EMACS_INT b)
30{
31 return min (a + b, MOST_POSITIVE_FIXNUM);
32}
33
34/* Logs. */
35
36typedef struct Lisp_Hash_Table log_t;
37
38static Lisp_Object
39make_log (int heap_size, int max_stack_depth)
40{
41 /* We use a standard Elisp hash-table object, but we use it in
42 a special way. This is OK as long as the object is not exposed
43 to Elisp, i.e. until it is returned by *-profiler-log, after which
44 it can't be used any more. */
45 Lisp_Object log = make_hash_table (Qequal, make_number (heap_size),
46 make_float (DEFAULT_REHASH_SIZE),
47 make_float (DEFAULT_REHASH_THRESHOLD),
48 Qnil, Qnil, Qnil);
49 struct Lisp_Hash_Table *h = XHASH_TABLE (log);
50
51 /* What is special about our hash-tables is that the keys are pre-filled
52 with the vectors we'll put in them. */
53 int i = ASIZE (h->key_and_value) / 2;
54 while (0 < i)
55 set_hash_key_slot (h, --i,
56 Fmake_vector (make_number (max_stack_depth), Qnil));
57 return log;
58}
59
60/* Evict the least used half of the hash_table.
61
62 When the table is full, we have to evict someone.
63 The easiest and most efficient is to evict the value we're about to add
64 (i.e. once the table is full, stop sampling).
65
66 We could also pick the element with the lowest count and evict it,
67 but finding it is O(N) and for that amount of work we get very
68 little in return: for the next sample, this latest sample will have
69 count==1 and will hence be a prime candidate for eviction :-(
70
71 So instead, we take O(N) time to eliminate more or less half of the
72 entries (the half with the lowest counts). So we get an amortized
73 cost of O(1) and we get O(N) time for a new entry to grow larger
74 than the other least counts before a new round of eviction. */
75
76static EMACS_INT approximate_median (log_t *log,
77 ptrdiff_t start, ptrdiff_t size)
78{
79 eassert (size > 0);
80 if (size < 2)
81 return XINT (HASH_VALUE (log, start));
82 if (size < 3)
83 /* Not an actual median, but better for our application than
84 choosing either of the two numbers. */
85 return ((XINT (HASH_VALUE (log, start))
86 + XINT (HASH_VALUE (log, start + 1)))
87 / 2);
88 else
89 {
90 ptrdiff_t newsize = size / 3;
91 ptrdiff_t start2 = start + newsize;
92 EMACS_INT i1 = approximate_median (log, start, newsize);
93 EMACS_INT i2 = approximate_median (log, start2, newsize);
94 EMACS_INT i3 = approximate_median (log, start2 + newsize,
95 size - 2 * newsize);
96 return (i1 < i2
97 ? (i2 < i3 ? i2 : (i1 < i3 ? i3 : i1))
98 : (i1 < i3 ? i1 : (i2 < i3 ? i3 : i2)));
99 }
100}
101
102static void evict_lower_half (log_t *log)
103{
104 ptrdiff_t size = ASIZE (log->key_and_value) / 2;
105 EMACS_INT median = approximate_median (log, 0, size);
106 ptrdiff_t i;
107
108 for (i = 0; i < size; i++)
109 /* Evict not only values smaller but also values equal to the median,
110 so as to make sure we evict something no matter what. */
111 if (XINT (HASH_VALUE (log, i)) <= median)
112 {
113 Lisp_Object key = HASH_KEY (log, i);
114 { /* FIXME: we could make this more efficient. */
115 Lisp_Object tmp;
116 XSET_HASH_TABLE (tmp, log); /* FIXME: Use make_lisp_ptr. */
117 Fremhash (key, tmp);
118 }
119 eassert (EQ (log->next_free, make_number (i)));
120 {
121 int j;
122 eassert (VECTORP (key));
123 for (j = 0; j < ASIZE (key); j++)
124 ASET (key, j, Qnil);
125 }
126 set_hash_key_slot (log, i, key);
127 }
128}
129
130/* Record the current backtrace in LOG. COUNT is the weight of this
131 current backtrace: milliseconds for CPU counts, and the allocation
132 size for memory logs. */
133
134static void
135record_backtrace (log_t *log, EMACS_INT count)
136{
137 struct backtrace *backlist = backtrace_list;
138 Lisp_Object backtrace;
139 ptrdiff_t index, i = 0;
140 ptrdiff_t asize;
141
142 if (!INTEGERP (log->next_free))
143 /* FIXME: transfer the evicted counts to a special entry rather
144 than dropping them on the floor. */
145 evict_lower_half (log);
146 index = XINT (log->next_free);
147
148 /* Get a "working memory" vector. */
149 backtrace = HASH_KEY (log, index);
150 asize = ASIZE (backtrace);
151
152 /* Copy the backtrace contents into working memory. */
153 for (; i < asize && backlist; i++, backlist = backlist->next)
154 /* FIXME: For closures we should ignore the environment. */
155 ASET (backtrace, i, backlist->function);
156
157 /* Make sure that unused space of working memory is filled with nil. */
158 for (; i < asize; i++)
159 ASET (backtrace, i, Qnil);
160
161 { /* We basically do a `gethash+puthash' here, except that we have to be
162 careful to avoid memory allocation since we're in a signal
163 handler, and we optimize the code to try and avoid computing the
164 hash+lookup twice. See fns.c:Fputhash for reference. */
165 EMACS_UINT hash;
166 ptrdiff_t j = hash_lookup (log, backtrace, &hash);
167 if (j >= 0)
168 {
169 EMACS_INT old_val = XINT (HASH_VALUE (log, j));
170 EMACS_INT new_val = saturated_add (old_val, count);
171 set_hash_value_slot (log, j, make_number (new_val));
172 }
173 else
174 { /* BEWARE! hash_put in general can allocate memory.
175 But currently it only does that if log->next_free is nil. */
176 int j;
177 eassert (!NILP (log->next_free));
178 j = hash_put (log, backtrace, make_number (count), hash);
179 /* Let's make sure we've put `backtrace' right where it
180 already was to start with. */
181 eassert (index == j);
182
183 /* FIXME: If the hash-table is almost full, we should set
184 some global flag so that some Elisp code can offload its
185 data elsewhere, so as to avoid the eviction code.
186 There are 2 ways to do that, AFAICT:
187 - Set a flag checked in QUIT, such that QUIT can then call
188 Fprofiler_cpu_log and stash the full log for later use.
189 - Set a flag check in post-gc-hook, so that Elisp code can call
190 profiler-cpu-log. That gives us more flexibility since that
191 Elisp code can then do all kinds of fun stuff like write
192 the log to disk. Or turn it right away into a call tree.
193 Of course, using Elisp is generally preferable, but it may
194 take longer until we get a chance to run the Elisp code, so
195 there's more risk that the table will get full before we
196 get there. */
197 }
198 }
199}
200
201/* Sample profiler. */
202
203/* FIXME: Add support for the CPU profiler in W32. */
204
205#ifdef PROFILER_CPU_SUPPORT
206
207/* The profiler timer and whether it was properly initialized, if
208 POSIX timers are available. */
209#ifdef HAVE_TIMER_SETTIME
210static timer_t profiler_timer;
211static bool profiler_timer_ok;
212#endif
213
214/* Status of sampling profiler. */
215static enum profiler_cpu_running
216 { NOT_RUNNING, TIMER_SETTIME_RUNNING, SETITIMER_RUNNING }
217 profiler_cpu_running;
218
219/* Hash-table log of CPU profiler. */
220static Lisp_Object cpu_log;
221
222/* Separate counter for the time spent in the GC. */
223static EMACS_INT cpu_gc_count;
224
225/* The current sample interval in milliseconds. */
226static EMACS_INT current_sample_interval;
227
228/* Signal handler for sample profiler. */
229
230static void
231handle_profiler_signal (int signal)
232{
233 if (backtrace_list && EQ (backtrace_list->function, Qautomatic_gc))
234 /* Special case the time-count inside GC because the hash-table
235 code is not prepared to be used while the GC is running.
236 More specifically it uses ASIZE at many places where it does
237 not expect the ARRAY_MARK_FLAG to be set. We could try and
238 harden the hash-table code, but it doesn't seem worth the
239 effort. */
240 cpu_gc_count = saturated_add (cpu_gc_count, current_sample_interval);
241 else
242 {
243 eassert (HASH_TABLE_P (cpu_log));
244 record_backtrace (XHASH_TABLE (cpu_log), current_sample_interval);
245 }
246}
247
248static void
249deliver_profiler_signal (int signal)
250{
251 deliver_process_signal (signal, handle_profiler_signal);
252}
253
254static enum profiler_cpu_running
255setup_cpu_timer (Lisp_Object sample_interval)
256{
257 struct sigaction action;
258 struct itimerval timer;
259 struct timespec interval;
260
261 if (! RANGED_INTEGERP (1, sample_interval,
262 (TYPE_MAXIMUM (time_t) < EMACS_INT_MAX / 1000
263 ? (EMACS_INT) TYPE_MAXIMUM (time_t) * 1000 + 999
264 : EMACS_INT_MAX)))
265 return NOT_RUNNING;
266
267 current_sample_interval = XINT (sample_interval);
268 interval = make_emacs_time (current_sample_interval / 1000,
269 current_sample_interval % 1000 * 1000000);
270 emacs_sigaction_init (&action, deliver_profiler_signal);
271 sigaction (SIGPROF, &action, 0);
272
273#ifdef HAVE_TIMER_SETTIME
274 if (! profiler_timer_ok)
275 {
276 /* System clocks to try, in decreasing order of desirability. */
277 static clockid_t const system_clock[] = {
278#ifdef CLOCK_THREAD_CPUTIME_ID
279 CLOCK_THREAD_CPUTIME_ID,
280#endif
281#ifdef CLOCK_PROCESS_CPUTIME_ID
282 CLOCK_PROCESS_CPUTIME_ID,
283#endif
284#ifdef CLOCK_MONOTONIC
285 CLOCK_MONOTONIC,
286#endif
287 CLOCK_REALTIME
288 };
289 int i;
290 struct sigevent sigev;
291 sigev.sigev_value.sival_ptr = &profiler_timer;
292 sigev.sigev_signo = SIGPROF;
293 sigev.sigev_notify = SIGEV_SIGNAL;
294
295 for (i = 0; i < sizeof system_clock / sizeof *system_clock; i++)
296 if (timer_create (system_clock[i], &sigev, &profiler_timer) == 0)
297 {
298 profiler_timer_ok = 1;
299 break;
300 }
301 }
302
303 if (profiler_timer_ok)
304 {
305 struct itimerspec ispec;
306 ispec.it_value = ispec.it_interval = interval;
307 timer_settime (profiler_timer, 0, &ispec, 0);
308 return TIMER_SETTIME_RUNNING;
309 }
310#endif
311
312 timer.it_value = timer.it_interval = make_timeval (interval);
313 setitimer (ITIMER_PROF, &timer, 0);
314 return SETITIMER_RUNNING;
315}
316
317DEFUN ("profiler-cpu-start", Fprofiler_cpu_start, Sprofiler_cpu_start,
318 1, 1, 0,
319 doc: /* Start or restart the cpu profiler.
320It takes call-stack samples each SAMPLE-INTERVAL milliseconds.
321See also `profiler-log-size' and `profiler-max-stack-depth'. */)
322 (Lisp_Object sample_interval)
323{
324 if (profiler_cpu_running)
325 error ("Sample profiler is already running");
326
327 if (NILP (cpu_log))
328 {
329 cpu_gc_count = 0;
330 cpu_log = make_log (profiler_log_size,
331 profiler_max_stack_depth);
332 }
333
334 profiler_cpu_running = setup_cpu_timer (sample_interval);
335 if (! profiler_cpu_running)
336 error ("Invalid sample interval");
337
338 return Qt;
339}
340
341DEFUN ("profiler-cpu-stop", Fprofiler_cpu_stop, Sprofiler_cpu_stop,
342 0, 0, 0,
343 doc: /* Stop the cpu profiler. The profiler log is not affected.
344Return non-nil if the profiler was running. */)
345 (void)
346{
347 switch (profiler_cpu_running)
348 {
349 case NOT_RUNNING:
350 return Qnil;
351
352#ifdef HAVE_TIMER_SETTIME
353 case TIMER_SETTIME_RUNNING:
354 {
355 struct itimerspec disable;
356 memset (&disable, 0, sizeof disable);
357 timer_settime (profiler_timer, 0, &disable, 0);
358 }
359 break;
360#endif
361
362 case SETITIMER_RUNNING:
363 {
364 struct itimerval disable;
365 memset (&disable, 0, sizeof disable);
366 setitimer (ITIMER_PROF, &disable, 0);
367 }
368 break;
369 }
370
371 signal (SIGPROF, SIG_IGN);
372 profiler_cpu_running = NOT_RUNNING;
373 return Qt;
374}
375
376DEFUN ("profiler-cpu-running-p",
377 Fprofiler_cpu_running_p, Sprofiler_cpu_running_p,
378 0, 0, 0,
379 doc: /* Return non-nil iff cpu profiler is running. */)
380 (void)
381{
382 return profiler_cpu_running ? Qt : Qnil;
383}
384
385DEFUN ("profiler-cpu-log", Fprofiler_cpu_log, Sprofiler_cpu_log,
386 0, 0, 0,
387 doc: /* Return the current cpu profiler log.
388The log is a hash-table mapping backtraces to counters which represent
389the amount of time spent at those points. Every backtrace is a vector
390of functions, where the last few elements may be nil.
391Before returning, a new log is allocated for future samples. */)
392 (void)
393{
394 Lisp_Object result = cpu_log;
395 /* Here we're making the log visible to Elisp, so it's not safe any
396 more for our use afterwards since we can't rely on its special
397 pre-allocated keys anymore. So we have to allocate a new one. */
398 cpu_log = (profiler_cpu_running
399 ? make_log (profiler_log_size, profiler_max_stack_depth)
400 : Qnil);
401 Fputhash (Fmake_vector (make_number (1), Qautomatic_gc),
402 make_number (cpu_gc_count),
403 result);
404 cpu_gc_count = 0;
405 return result;
406}
407#endif /* PROFILER_CPU_SUPPORT */
408
409/* Memory profiler. */
410
411/* True if memory profiler is running. */
412bool profiler_memory_running;
413
414static Lisp_Object memory_log;
415
416DEFUN ("profiler-memory-start", Fprofiler_memory_start, Sprofiler_memory_start,
417 0, 0, 0,
418 doc: /* Start/restart the memory profiler.
419The memory profiler will take samples of the call-stack whenever a new
420allocation takes place. Note that most small allocations only trigger
421the profiler occasionally.
422See also `profiler-log-size' and `profiler-max-stack-depth'. */)
423 (void)
424{
425 if (profiler_memory_running)
426 error ("Memory profiler is already running");
427
428 if (NILP (memory_log))
429 memory_log = make_log (profiler_log_size,
430 profiler_max_stack_depth);
431
432 profiler_memory_running = true;
433
434 return Qt;
435}
436
437DEFUN ("profiler-memory-stop",
438 Fprofiler_memory_stop, Sprofiler_memory_stop,
439 0, 0, 0,
440 doc: /* Stop the memory profiler. The profiler log is not affected.
441Return non-nil if the profiler was running. */)
442 (void)
443{
444 if (!profiler_memory_running)
445 return Qnil;
446 profiler_memory_running = false;
447 return Qt;
448}
449
450DEFUN ("profiler-memory-running-p",
451 Fprofiler_memory_running_p, Sprofiler_memory_running_p,
452 0, 0, 0,
453 doc: /* Return non-nil if memory profiler is running. */)
454 (void)
455{
456 return profiler_memory_running ? Qt : Qnil;
457}
458
459DEFUN ("profiler-memory-log",
460 Fprofiler_memory_log, Sprofiler_memory_log,
461 0, 0, 0,
462 doc: /* Return the current memory profiler log.
463The log is a hash-table mapping backtraces to counters which represent
464the amount of memory allocated at those points. Every backtrace is a vector
465of functions, where the last few elements may be nil.
466Before returning, a new log is allocated for future samples. */)
467 (void)
468{
469 Lisp_Object result = memory_log;
470 /* Here we're making the log visible to Elisp , so it's not safe any
471 more for our use afterwards since we can't rely on its special
472 pre-allocated keys anymore. So we have to allocate a new one. */
473 memory_log = (profiler_memory_running
474 ? make_log (profiler_log_size, profiler_max_stack_depth)
475 : Qnil);
476 return result;
477}
478
479
480/* Signals and probes. */
481
482/* Record that the current backtrace allocated SIZE bytes. */
483void
484malloc_probe (size_t size)
485{
486 eassert (HASH_TABLE_P (memory_log));
487 record_backtrace (XHASH_TABLE (memory_log), min (size, MOST_POSITIVE_FIXNUM));
488}
489
490void
491syms_of_profiler (void)
492{
493 DEFVAR_INT ("profiler-max-stack-depth", profiler_max_stack_depth,
494 doc: /* Number of elements from the call-stack recorded in the log. */);
495 profiler_max_stack_depth = 16;
496 DEFVAR_INT ("profiler-log-size", profiler_log_size,
497 doc: /* Number of distinct call-stacks that can be recorded in a profiler log.
498If the log gets full, some of the least-seen call-stacks will be evicted
499to make room for new entries. */);
500 profiler_log_size = 10000;
501
502#ifdef PROFILER_CPU_SUPPORT
503 profiler_cpu_running = NOT_RUNNING;
504 cpu_log = Qnil;
505 staticpro (&cpu_log);
506 defsubr (&Sprofiler_cpu_start);
507 defsubr (&Sprofiler_cpu_stop);
508 defsubr (&Sprofiler_cpu_running_p);
509 defsubr (&Sprofiler_cpu_log);
510#endif
511 profiler_memory_running = false;
512 memory_log = Qnil;
513 staticpro (&memory_log);
514 defsubr (&Sprofiler_memory_start);
515 defsubr (&Sprofiler_memory_stop);
516 defsubr (&Sprofiler_memory_running_p);
517 defsubr (&Sprofiler_memory_log);
518}
diff --git a/src/ralloc.c b/src/ralloc.c
index 9a4b1ada229..ab91baae5b5 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -1199,9 +1199,9 @@ r_alloc_init (void)
1199#endif 1199#endif
1200 1200
1201#ifdef DOUG_LEA_MALLOC 1201#ifdef DOUG_LEA_MALLOC
1202 BLOCK_INPUT; 1202 block_input ();
1203 mallopt (M_TOP_PAD, 64 * 4096); 1203 mallopt (M_TOP_PAD, 64 * 4096);
1204 UNBLOCK_INPUT; 1204 unblock_input ();
1205#else 1205#else
1206#ifndef SYSTEM_MALLOC 1206#ifndef SYSTEM_MALLOC
1207 /* Give GNU malloc's morecore some hysteresis so that we move all 1207 /* Give GNU malloc's morecore some hysteresis so that we move all
diff --git a/src/search.c b/src/search.c
index 5224556fa17..7c084c62e28 100644
--- a/src/search.c
+++ b/src/search.c
@@ -156,7 +156,7 @@ compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object tra
156 re_set_whitespace_regexp (NULL); 156 re_set_whitespace_regexp (NULL);
157 157
158 re_set_syntax (old); 158 re_set_syntax (old);
159 /* UNBLOCK_INPUT; */ 159 /* unblock_input (); */
160 if (val) 160 if (val)
161 xsignal1 (Qinvalid_regexp, build_string (val)); 161 xsignal1 (Qinvalid_regexp, build_string (val));
162 162
diff --git a/src/sysdep.c b/src/sysdep.c
index dbfd9efc7d4..b7141011d05 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -279,10 +279,6 @@ init_baud_rate (int fd)
279 279
280 280
281 281
282/* Set nonzero to make following function work under dbx
283 (at least for bsd). */
284int wait_debugging EXTERNALLY_VISIBLE;
285
286#ifndef MSDOS 282#ifndef MSDOS
287 283
288static void 284static void
@@ -290,48 +286,24 @@ wait_for_termination_1 (pid_t pid, int interruptible)
290{ 286{
291 while (1) 287 while (1)
292 { 288 {
293#if (defined (BSD_SYSTEM) || defined (HPUX)) && !defined (__GNU__)
294 /* Note that kill returns -1 even if the process is just a zombie now.
295 But inevitably a SIGCHLD interrupt should be generated
296 and child_sig will do waitpid and make the process go away. */
297 /* There is some indication that there is a bug involved with
298 termination of subprocesses, perhaps involving a kernel bug too,
299 but no idea what it is. Just as a hunch we signal SIGCHLD to see
300 if that causes the problem to go away or get worse. */
301 sigset_t sigchild_mask;
302 sigemptyset (&sigchild_mask);
303 sigaddset (&sigchild_mask, SIGCHLD);
304 pthread_sigmask (SIG_SETMASK, &sigchild_mask, 0);
305
306 if (0 > kill (pid, 0))
307 {
308 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
309 kill (getpid (), SIGCHLD);
310 break;
311 }
312 if (wait_debugging)
313 sleep (1);
314 else
315 sigsuspend (&empty_mask);
316#else /* not BSD_SYSTEM, and not HPUX version >= 6 */
317#ifdef WINDOWSNT 289#ifdef WINDOWSNT
318 wait (0); 290 wait (0);
319 break; 291 break;
320#else /* not WINDOWSNT */ 292#else /* not WINDOWSNT */
321 sigset_t blocked; 293 int status;
322 sigemptyset (&blocked); 294 int wait_result = waitpid (pid, &status, 0);
323 sigaddset (&blocked, SIGCHLD); 295 if (wait_result < 0)
324 pthread_sigmask (SIG_BLOCK, &blocked, 0);
325 errno = 0;
326 if (kill (pid, 0) == -1 && errno == ESRCH)
327 { 296 {
328 pthread_sigmask (SIG_UNBLOCK, &blocked, 0); 297 if (errno != EINTR)
298 break;
299 }
300 else
301 {
302 record_child_status_change (wait_result, status);
329 break; 303 break;
330 } 304 }
331 305
332 sigsuspend (&empty_mask);
333#endif /* not WINDOWSNT */ 306#endif /* not WINDOWSNT */
334#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */
335 if (interruptible) 307 if (interruptible)
336 QUIT; 308 QUIT;
337 } 309 }
@@ -1438,40 +1410,80 @@ init_system_name (void)
1438 1410
1439sigset_t empty_mask; 1411sigset_t empty_mask;
1440 1412
1441/* Store into *ACTION a signal action suitable for Emacs, with handler 1413static struct sigaction process_fatal_action;
1442 HANDLER. */ 1414
1443void 1415static int
1444emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) 1416emacs_sigaction_flags (void)
1445{ 1417{
1446 sigemptyset (&action->sa_mask); 1418#ifdef SA_RESTART
1447 action->sa_handler = handler;
1448 action->sa_flags = 0;
1449#if defined (SA_RESTART)
1450 /* SA_RESTART causes interruptible functions with timeouts (e.g., 1419 /* SA_RESTART causes interruptible functions with timeouts (e.g.,
1451 'select') to reset their timeout on some platforms (e.g., 1420 'select') to reset their timeout on some platforms (e.g.,
1452 HP-UX 11), which is not what we want. Also, when Emacs is 1421 HP-UX 11), which is not what we want. Also, when Emacs is
1453 interactive, we don't want SA_RESTART because we need to poll 1422 interactive, we don't want SA_RESTART because we need to poll
1454 for pending input so we need long-running syscalls to be interrupted 1423 for pending input so we need long-running syscalls to be interrupted
1455 after a signal that sets the interrupt_input_pending flag. */ 1424 after a signal that sets pending_signals.
1456 /* Non-interactive keyboard input goes through stdio, where we always 1425
1457 want restartable system calls. */ 1426 Non-interactive keyboard input goes through stdio, where we
1427 always want restartable system calls. */
1458 if (noninteractive) 1428 if (noninteractive)
1459 action->sa_flags = SA_RESTART; 1429 return SA_RESTART;
1430#endif
1431 return 0;
1432}
1433
1434/* Store into *ACTION a signal action suitable for Emacs, with handler
1435 HANDLER. */
1436void
1437emacs_sigaction_init (struct sigaction *action, signal_handler_t handler)
1438{
1439 sigemptyset (&action->sa_mask);
1440
1441 /* When handling a signal, block nonfatal system signals that are caught
1442 by Emacs. This makes race conditions less likely. */
1443 sigaddset (&action->sa_mask, SIGALRM);
1444#ifdef SIGCHLD
1445 sigaddset (&action->sa_mask, SIGCHLD);
1446#endif
1447#ifdef SIGDANGER
1448 sigaddset (&action->sa_mask, SIGDANGER);
1460#endif 1449#endif
1450#ifdef PROFILER_CPU_SUPPORT
1451 sigaddset (&action->sa_mask, SIGPROF);
1452#endif
1453#ifdef SIGWINCH
1454 sigaddset (&action->sa_mask, SIGWINCH);
1455#endif
1456 if (! noninteractive)
1457 {
1458 sigaddset (&action->sa_mask, SIGINT);
1459 sigaddset (&action->sa_mask, SIGQUIT);
1460#ifdef USABLE_SIGIO
1461 sigaddset (&action->sa_mask, SIGIO);
1462#endif
1463 }
1464
1465 if (! IEEE_FLOATING_POINT)
1466 sigaddset (&action->sa_mask, SIGFPE);
1467
1468 action->sa_handler = handler;
1469 action->sa_flags = emacs_sigaction_flags ();
1461} 1470}
1462 1471
1463#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD 1472#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
1464static pthread_t main_thread; 1473static pthread_t main_thread;
1465#endif 1474#endif
1466 1475
1467/* If we are on the main thread, handle the signal SIG with HANDLER. 1476/* SIG has arrived at the current process. Deliver it to the main
1477 thread, which should handle it with HANDLER.
1478
1479 If we are on the main thread, handle the signal SIG with HANDLER.
1468 Otherwise, redirect the signal to the main thread, blocking it from 1480 Otherwise, redirect the signal to the main thread, blocking it from
1469 this thread. POSIX says any thread can receive a signal that is 1481 this thread. POSIX says any thread can receive a signal that is
1470 associated with a process, process group, or asynchronous event. 1482 associated with a process, process group, or asynchronous event.
1471 On GNU/Linux that is not true, but for other systems (FreeBSD at 1483 On GNU/Linux that is not true, but for other systems (FreeBSD at
1472 least) it is. */ 1484 least) it is. */
1473void 1485void
1474handle_on_main_thread (int sig, signal_handler_t handler) 1486deliver_process_signal (int sig, signal_handler_t handler)
1475{ 1487{
1476 /* Preserve errno, to avoid race conditions with signal handlers that 1488 /* Preserve errno, to avoid race conditions with signal handlers that
1477 might change errno. Races can occur even in single-threaded hosts. */ 1489 might change errno. Races can occur even in single-threaded hosts. */
@@ -1494,6 +1506,39 @@ handle_on_main_thread (int sig, signal_handler_t handler)
1494 1506
1495 errno = old_errno; 1507 errno = old_errno;
1496} 1508}
1509
1510/* Static location to save a fatal backtrace in a thread.
1511 FIXME: If two subsidiary threads fail simultaneously, the resulting
1512 backtrace may be garbage. */
1513enum { BACKTRACE_LIMIT_MAX = 500 };
1514static void *thread_backtrace_buffer[BACKTRACE_LIMIT_MAX + 1];
1515static int thread_backtrace_npointers;
1516
1517/* SIG has arrived at the current thread.
1518 If we are on the main thread, handle the signal SIG with HANDLER.
1519 Otherwise, this is a fatal error in the handling thread. */
1520static void
1521deliver_thread_signal (int sig, signal_handler_t handler)
1522{
1523 int old_errno = errno;
1524
1525#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
1526 if (! pthread_equal (pthread_self (), main_thread))
1527 {
1528 thread_backtrace_npointers
1529 = backtrace (thread_backtrace_buffer, BACKTRACE_LIMIT_MAX);
1530 sigaction (sig, &process_fatal_action, 0);
1531 pthread_kill (main_thread, sig);
1532
1533 /* Avoid further damage while the main thread is exiting. */
1534 while (1)
1535 sigsuspend (&empty_mask);
1536 }
1537#endif
1538
1539 handler (sig);
1540 errno = old_errno;
1541}
1497 1542
1498#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST 1543#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
1499static char *my_sys_siglist[NSIG]; 1544static char *my_sys_siglist[NSIG];
@@ -1503,9 +1548,60 @@ static char *my_sys_siglist[NSIG];
1503# define sys_siglist my_sys_siglist 1548# define sys_siglist my_sys_siglist
1504#endif 1549#endif
1505 1550
1551/* Handle bus errors, invalid instruction, etc. */
1552static void
1553handle_fatal_signal (int sig)
1554{
1555 terminate_due_to_signal (sig, 40);
1556}
1557
1558static void
1559deliver_fatal_signal (int sig)
1560{
1561 deliver_process_signal (sig, handle_fatal_signal);
1562}
1563
1564static void
1565deliver_fatal_thread_signal (int sig)
1566{
1567 deliver_thread_signal (sig, handle_fatal_signal);
1568}
1569
1570static _Noreturn void
1571handle_arith_signal (int sig)
1572{
1573 pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
1574 xsignal0 (Qarith_error);
1575}
1576
1577static void
1578deliver_arith_signal (int sig)
1579{
1580 deliver_thread_signal (sig, handle_arith_signal);
1581}
1582
1583/* Treat SIG as a terminating signal, unless it is already ignored and
1584 we are in --batch mode. Among other things, this makes nohup work. */
1585static void
1586maybe_fatal_sig (int sig)
1587{
1588 bool catch_sig = !noninteractive;
1589 if (!catch_sig)
1590 {
1591 struct sigaction old_action;
1592 sigaction (sig, 0, &old_action);
1593 catch_sig = old_action.sa_handler != SIG_IGN;
1594 }
1595 if (catch_sig)
1596 sigaction (sig, &process_fatal_action, 0);
1597}
1598
1506void 1599void
1507init_signals (void) 1600init_signals (bool dumping)
1508{ 1601{
1602 struct sigaction thread_fatal_action;
1603 struct sigaction action;
1604
1509 sigemptyset (&empty_mask); 1605 sigemptyset (&empty_mask);
1510 1606
1511#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD 1607#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
@@ -1515,9 +1611,7 @@ init_signals (void)
1515#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST 1611#if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST
1516 if (! initialized) 1612 if (! initialized)
1517 { 1613 {
1518# ifdef SIGABRT
1519 sys_siglist[SIGABRT] = "Aborted"; 1614 sys_siglist[SIGABRT] = "Aborted";
1520# endif
1521# ifdef SIGAIO 1615# ifdef SIGAIO
1522 sys_siglist[SIGAIO] = "LAN I/O interrupt"; 1616 sys_siglist[SIGAIO] = "LAN I/O interrupt";
1523# endif 1617# endif
@@ -1545,9 +1639,7 @@ init_signals (void)
1545# ifdef SIGEMT 1639# ifdef SIGEMT
1546 sys_siglist[SIGEMT] = "Emulation trap"; 1640 sys_siglist[SIGEMT] = "Emulation trap";
1547# endif 1641# endif
1548# ifdef SIGFPE
1549 sys_siglist[SIGFPE] = "Arithmetic exception"; 1642 sys_siglist[SIGFPE] = "Arithmetic exception";
1550# endif
1551# ifdef SIGFREEZE 1643# ifdef SIGFREEZE
1552 sys_siglist[SIGFREEZE] = "SIGFREEZE"; 1644 sys_siglist[SIGFREEZE] = "SIGFREEZE";
1553# endif 1645# endif
@@ -1557,12 +1649,8 @@ init_signals (void)
1557# ifdef SIGHUP 1649# ifdef SIGHUP
1558 sys_siglist[SIGHUP] = "Hangup"; 1650 sys_siglist[SIGHUP] = "Hangup";
1559# endif 1651# endif
1560# ifdef SIGILL
1561 sys_siglist[SIGILL] = "Illegal instruction"; 1652 sys_siglist[SIGILL] = "Illegal instruction";
1562# endif
1563# ifdef SIGINT
1564 sys_siglist[SIGINT] = "Interrupt"; 1653 sys_siglist[SIGINT] = "Interrupt";
1565# endif
1566# ifdef SIGIO 1654# ifdef SIGIO
1567 sys_siglist[SIGIO] = "I/O possible"; 1655 sys_siglist[SIGIO] = "I/O possible";
1568# endif 1656# endif
@@ -1611,9 +1699,7 @@ init_signals (void)
1611# ifdef SIGSAK 1699# ifdef SIGSAK
1612 sys_siglist[SIGSAK] = "Secure attention"; 1700 sys_siglist[SIGSAK] = "Secure attention";
1613# endif 1701# endif
1614# ifdef SIGSEGV
1615 sys_siglist[SIGSEGV] = "Segmentation violation"; 1702 sys_siglist[SIGSEGV] = "Segmentation violation";
1616# endif
1617# ifdef SIGSOUND 1703# ifdef SIGSOUND
1618 sys_siglist[SIGSOUND] = "Sound completed"; 1704 sys_siglist[SIGSOUND] = "Sound completed";
1619# endif 1705# endif
@@ -1626,9 +1712,7 @@ init_signals (void)
1626# ifdef SIGSYS 1712# ifdef SIGSYS
1627 sys_siglist[SIGSYS] = "Bad argument to system call"; 1713 sys_siglist[SIGSYS] = "Bad argument to system call";
1628# endif 1714# endif
1629# ifdef SIGTERM
1630 sys_siglist[SIGTERM] = "Terminated"; 1715 sys_siglist[SIGTERM] = "Terminated";
1631# endif
1632# ifdef SIGTHAW 1716# ifdef SIGTHAW
1633 sys_siglist[SIGTHAW] = "SIGTHAW"; 1717 sys_siglist[SIGTHAW] = "SIGTHAW";
1634# endif 1718# endif
@@ -1673,6 +1757,129 @@ init_signals (void)
1673# endif 1757# endif
1674 } 1758 }
1675#endif /* !defined HAVE_STRSIGNAL && !defined HAVE_DECL_SYS_SIGLIST */ 1759#endif /* !defined HAVE_STRSIGNAL && !defined HAVE_DECL_SYS_SIGLIST */
1760
1761 /* Don't alter signal handlers if dumping. On some machines,
1762 changing signal handlers sets static data that would make signals
1763 fail to work right when the dumped Emacs is run. */
1764 if (dumping)
1765 return;
1766
1767 sigfillset (&process_fatal_action.sa_mask);
1768 process_fatal_action.sa_handler = deliver_fatal_signal;
1769 process_fatal_action.sa_flags = emacs_sigaction_flags ();
1770
1771 sigfillset (&thread_fatal_action.sa_mask);
1772 thread_fatal_action.sa_handler = deliver_fatal_thread_signal;
1773 thread_fatal_action.sa_flags = process_fatal_action.sa_flags;
1774
1775 /* SIGINT may need special treatment on MS-Windows. See
1776 http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html
1777 Please update the doc of kill-emacs, kill-emacs-hook, and
1778 NEWS if you change this. */
1779
1780 maybe_fatal_sig (SIGHUP);
1781 maybe_fatal_sig (SIGINT);
1782 maybe_fatal_sig (SIGTERM);
1783
1784 /* Emacs checks for write errors, so it can safely ignore SIGPIPE.
1785 However, in batch mode leave SIGPIPE alone, as that causes Emacs
1786 to behave more like typical batch applications do. */
1787 if (! noninteractive)
1788 signal (SIGPIPE, SIG_IGN);
1789
1790 sigaction (SIGQUIT, &process_fatal_action, 0);
1791 sigaction (SIGILL, &thread_fatal_action, 0);
1792 sigaction (SIGTRAP, &thread_fatal_action, 0);
1793
1794 /* Typically SIGFPE is thread-specific and is fatal, like SIGILL.
1795 But on a non-IEEE host SIGFPE can come from a trap in the Lisp
1796 interpreter's floating point operations, so treat SIGFPE as an
1797 arith-error if it arises in the main thread. */
1798 if (IEEE_FLOATING_POINT)
1799 sigaction (SIGFPE, &thread_fatal_action, 0);
1800 else
1801 {
1802 emacs_sigaction_init (&action, deliver_arith_signal);
1803 sigaction (SIGFPE, &action, 0);
1804 }
1805
1806#ifdef SIGUSR1
1807 add_user_signal (SIGUSR1, "sigusr1");
1808#endif
1809#ifdef SIGUSR2
1810 add_user_signal (SIGUSR2, "sigusr2");
1811#endif
1812 sigaction (SIGABRT, &thread_fatal_action, 0);
1813#ifdef SIGPRE
1814 sigaction (SIGPRE, &thread_fatal_action, 0);
1815#endif
1816#ifdef SIGORE
1817 sigaction (SIGORE, &thread_fatal_action, 0);
1818#endif
1819#ifdef SIGUME
1820 sigaction (SIGUME, &thread_fatal_action, 0);
1821#endif
1822#ifdef SIGDLK
1823 sigaction (SIGDLK, &process_fatal_action, 0);
1824#endif
1825#ifdef SIGCPULIM
1826 sigaction (SIGCPULIM, &process_fatal_action, 0);
1827#endif
1828#ifdef SIGIOT
1829 sigaction (SIGIOT, &thread_fatal_action, 0);
1830#endif
1831#ifdef SIGEMT
1832 sigaction (SIGEMT, &thread_fatal_action, 0);
1833#endif
1834#ifdef SIGBUS
1835 sigaction (SIGBUS, &thread_fatal_action, 0);
1836#endif
1837 sigaction (SIGSEGV, &thread_fatal_action, 0);
1838#ifdef SIGSYS
1839 sigaction (SIGSYS, &thread_fatal_action, 0);
1840#endif
1841 sigaction (SIGTERM, &process_fatal_action, 0);
1842#ifdef SIGPROF
1843 signal (SIGPROF, SIG_IGN);
1844#endif
1845#ifdef SIGVTALRM
1846 sigaction (SIGVTALRM, &process_fatal_action, 0);
1847#endif
1848#ifdef SIGXCPU
1849 sigaction (SIGXCPU, &process_fatal_action, 0);
1850#endif
1851#ifdef SIGXFSZ
1852 sigaction (SIGXFSZ, &process_fatal_action, 0);
1853#endif
1854
1855#ifdef SIGDANGER
1856 /* This just means available memory is getting low. */
1857 emacs_sigaction_init (&action, deliver_danger_signal);
1858 sigaction (SIGDANGER, &action, 0);
1859#endif
1860
1861 /* AIX-specific signals. */
1862#ifdef SIGGRANT
1863 sigaction (SIGGRANT, &process_fatal_action, 0);
1864#endif
1865#ifdef SIGMIGRATE
1866 sigaction (SIGMIGRATE, &process_fatal_action, 0);
1867#endif
1868#ifdef SIGMSG
1869 sigaction (SIGMSG, &process_fatal_action, 0);
1870#endif
1871#ifdef SIGRETRACT
1872 sigaction (SIGRETRACT, &process_fatal_action, 0);
1873#endif
1874#ifdef SIGSAK
1875 sigaction (SIGSAK, &process_fatal_action, 0);
1876#endif
1877#ifdef SIGSOUND
1878 sigaction (SIGSOUND, &process_fatal_action, 0);
1879#endif
1880#ifdef SIGTALRM
1881 sigaction (SIGTALRM, &thread_fatal_action, 0);
1882#endif
1676} 1883}
1677 1884
1678#ifndef HAVE_RANDOM 1885#ifndef HAVE_RANDOM
@@ -1811,23 +2018,36 @@ snprintf (char *buf, size_t bufsize, char const *format, ...)
1811void 2018void
1812emacs_backtrace (int backtrace_limit) 2019emacs_backtrace (int backtrace_limit)
1813{ 2020{
1814 enum { BACKTRACE_LIMIT_MAX = 500 }; 2021 void *main_backtrace_buffer[BACKTRACE_LIMIT_MAX + 1];
1815 void *buffer[BACKTRACE_LIMIT_MAX + 1];
1816 int bounded_limit = min (backtrace_limit, BACKTRACE_LIMIT_MAX); 2022 int bounded_limit = min (backtrace_limit, BACKTRACE_LIMIT_MAX);
1817 int npointers = backtrace (buffer, bounded_limit + 1); 2023 void *buffer;
2024 int npointers;
2025
2026 if (thread_backtrace_npointers)
2027 {
2028 buffer = thread_backtrace_buffer;
2029 npointers = thread_backtrace_npointers;
2030 }
2031 else
2032 {
2033 buffer = main_backtrace_buffer;
2034 npointers = backtrace (buffer, bounded_limit + 1);
2035 }
2036
1818 if (npointers) 2037 if (npointers)
1819 ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12)); 2038 {
1820 backtrace_symbols_fd (buffer, bounded_limit, STDERR_FILENO); 2039 ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12));
1821 if (bounded_limit < npointers) 2040 backtrace_symbols_fd (buffer, npointers, STDERR_FILENO);
1822 ignore_value (write (STDERR_FILENO, "...\n", 4)); 2041 if (bounded_limit < npointers)
2042 ignore_value (write (STDERR_FILENO, "...\n", 4));
2043 }
1823} 2044}
1824 2045
1825#ifndef HAVE_NTGUI 2046#ifndef HAVE_NTGUI
1826/* Using emacs_abort lets GDB return from a breakpoint here. */
1827void 2047void
1828emacs_abort (void) 2048emacs_abort (void)
1829{ 2049{
1830 fatal_error_backtrace (SIGABRT, 10); 2050 terminate_due_to_signal (SIGABRT, 10);
1831} 2051}
1832#endif 2052#endif
1833 2053
@@ -1910,7 +2130,8 @@ emacs_write (int fildes, const char *buf, ptrdiff_t nbyte)
1910 { 2130 {
1911 /* I originally used `QUIT' but that might causes files to 2131 /* I originally used `QUIT' but that might causes files to
1912 be truncated if you hit C-g in the middle of it. --Stef */ 2132 be truncated if you hit C-g in the middle of it. --Stef */
1913 process_pending_signals (); 2133 if (pending_signals)
2134 process_pending_signals ();
1914 continue; 2135 continue;
1915 } 2136 }
1916 else 2137 else
@@ -1975,11 +2196,11 @@ getwd (char *pathname)
1975 char *npath, *spath; 2196 char *npath, *spath;
1976 extern char *getcwd (char *, size_t); 2197 extern char *getcwd (char *, size_t);
1977 2198
1978 BLOCK_INPUT; /* getcwd uses malloc */ 2199 block_input (); /* getcwd uses malloc */
1979 spath = npath = getcwd ((char *) 0, MAXPATHLEN); 2200 spath = npath = getcwd ((char *) 0, MAXPATHLEN);
1980 if (spath == 0) 2201 if (spath == 0)
1981 { 2202 {
1982 UNBLOCK_INPUT; 2203 unblock_input ();
1983 return spath; 2204 return spath;
1984 } 2205 }
1985 /* On Altos 3068, getcwd can return @hostname/dir, so discard 2206 /* On Altos 3068, getcwd can return @hostname/dir, so discard
@@ -1988,7 +2209,7 @@ getwd (char *pathname)
1988 npath++; 2209 npath++;
1989 strcpy (pathname, npath); 2210 strcpy (pathname, npath);
1990 free (spath); /* getcwd uses malloc */ 2211 free (spath); /* getcwd uses malloc */
1991 UNBLOCK_INPUT; 2212 unblock_input ();
1992 return pathname; 2213 return pathname;
1993} 2214}
1994 2215
@@ -2422,7 +2643,7 @@ get_up_time (void)
2422 FILE *fup; 2643 FILE *fup;
2423 EMACS_TIME up = make_emacs_time (0, 0); 2644 EMACS_TIME up = make_emacs_time (0, 0);
2424 2645
2425 BLOCK_INPUT; 2646 block_input ();
2426 fup = fopen ("/proc/uptime", "r"); 2647 fup = fopen ("/proc/uptime", "r");
2427 2648
2428 if (fup) 2649 if (fup)
@@ -2453,7 +2674,7 @@ get_up_time (void)
2453 } 2674 }
2454 fclose (fup); 2675 fclose (fup);
2455 } 2676 }
2456 UNBLOCK_INPUT; 2677 unblock_input ();
2457 2678
2458 return up; 2679 return up;
2459} 2680}
@@ -2467,7 +2688,7 @@ procfs_ttyname (int rdev)
2467 FILE *fdev = NULL; 2688 FILE *fdev = NULL;
2468 char name[PATH_MAX]; 2689 char name[PATH_MAX];
2469 2690
2470 BLOCK_INPUT; 2691 block_input ();
2471 fdev = fopen ("/proc/tty/drivers", "r"); 2692 fdev = fopen ("/proc/tty/drivers", "r");
2472 2693
2473 if (fdev) 2694 if (fdev)
@@ -2499,7 +2720,7 @@ procfs_ttyname (int rdev)
2499 } 2720 }
2500 fclose (fdev); 2721 fclose (fdev);
2501 } 2722 }
2502 UNBLOCK_INPUT; 2723 unblock_input ();
2503 return build_string (name); 2724 return build_string (name);
2504} 2725}
2505 2726
@@ -2509,7 +2730,7 @@ procfs_get_total_memory (void)
2509 FILE *fmem = NULL; 2730 FILE *fmem = NULL;
2510 unsigned long retval = 2 * 1024 * 1024; /* default: 2GB */ 2731 unsigned long retval = 2 * 1024 * 1024; /* default: 2GB */
2511 2732
2512 BLOCK_INPUT; 2733 block_input ();
2513 fmem = fopen ("/proc/meminfo", "r"); 2734 fmem = fopen ("/proc/meminfo", "r");
2514 2735
2515 if (fmem) 2736 if (fmem)
@@ -2528,7 +2749,7 @@ procfs_get_total_memory (void)
2528 } 2749 }
2529 fclose (fmem); 2750 fclose (fmem);
2530 } 2751 }
2531 UNBLOCK_INPUT; 2752 unblock_input ();
2532 return retval; 2753 return retval;
2533} 2754}
2534 2755
@@ -2574,17 +2795,17 @@ system_process_attributes (Lisp_Object pid)
2574 /* euid egid */ 2795 /* euid egid */
2575 uid = st.st_uid; 2796 uid = st.st_uid;
2576 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); 2797 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
2577 BLOCK_INPUT; 2798 block_input ();
2578 pw = getpwuid (uid); 2799 pw = getpwuid (uid);
2579 UNBLOCK_INPUT; 2800 unblock_input ();
2580 if (pw) 2801 if (pw)
2581 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); 2802 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
2582 2803
2583 gid = st.st_gid; 2804 gid = st.st_gid;
2584 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); 2805 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
2585 BLOCK_INPUT; 2806 block_input ();
2586 gr = getgrgid (gid); 2807 gr = getgrgid (gid);
2587 UNBLOCK_INPUT; 2808 unblock_input ();
2588 if (gr) 2809 if (gr)
2589 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); 2810 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
2590 2811
@@ -2812,17 +3033,17 @@ system_process_attributes (Lisp_Object pid)
2812 /* euid egid */ 3033 /* euid egid */
2813 uid = st.st_uid; 3034 uid = st.st_uid;
2814 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); 3035 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
2815 BLOCK_INPUT; 3036 block_input ();
2816 pw = getpwuid (uid); 3037 pw = getpwuid (uid);
2817 UNBLOCK_INPUT; 3038 unblock_input ();
2818 if (pw) 3039 if (pw)
2819 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); 3040 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
2820 3041
2821 gid = st.st_gid; 3042 gid = st.st_gid;
2822 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); 3043 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
2823 BLOCK_INPUT; 3044 block_input ();
2824 gr = getgrgid (gid); 3045 gr = getgrgid (gid);
2825 UNBLOCK_INPUT; 3046 unblock_input ();
2826 if (gr) 3047 if (gr)
2827 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); 3048 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
2828 3049
@@ -2943,17 +3164,17 @@ system_process_attributes (Lisp_Object pid)
2943 3164
2944 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs); 3165 attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs);
2945 3166
2946 BLOCK_INPUT; 3167 block_input ();
2947 pw = getpwuid (proc.ki_uid); 3168 pw = getpwuid (proc.ki_uid);
2948 UNBLOCK_INPUT; 3169 unblock_input ();
2949 if (pw) 3170 if (pw)
2950 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); 3171 attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
2951 3172
2952 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs); 3173 attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs);
2953 3174
2954 BLOCK_INPUT; 3175 block_input ();
2955 gr = getgrgid (proc.ki_svgid); 3176 gr = getgrgid (proc.ki_svgid);
2956 UNBLOCK_INPUT; 3177 unblock_input ();
2957 if (gr) 3178 if (gr)
2958 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); 3179 attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
2959 3180
@@ -2993,9 +3214,9 @@ system_process_attributes (Lisp_Object pid)
2993 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs); 3214 attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs);
2994 attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs); 3215 attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs);
2995 3216
2996 BLOCK_INPUT; 3217 block_input ();
2997 ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR); 3218 ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR);
2998 UNBLOCK_INPUT; 3219 unblock_input ();
2999 if (ttyname) 3220 if (ttyname)
3000 attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); 3221 attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs);
3001 3222
diff --git a/src/syssignal.h b/src/syssignal.h
index e309e6725b7..ece2515dec9 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -18,8 +18,9 @@ You should have received a copy of the GNU General Public License
18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 18along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20#include <signal.h> 20#include <signal.h>
21#include <stdbool.h>
21 22
22extern void init_signals (void); 23extern void init_signals (bool);
23 24
24#ifdef HAVE_PTHREAD 25#ifdef HAVE_PTHREAD
25#include <pthread.h> 26#include <pthread.h>
@@ -28,6 +29,11 @@ extern void init_signals (void);
28#define FORWARD_SIGNAL_TO_MAIN_THREAD 29#define FORWARD_SIGNAL_TO_MAIN_THREAD
29#endif 30#endif
30 31
32#if (defined SIGPROF && (defined HAVE_TIMER_SETTIME || defined HAVE_SETITIMER) \
33 && !defined PROFILING)
34# define PROFILER_CPU_SUPPORT
35#endif
36
31extern sigset_t empty_mask; 37extern sigset_t empty_mask;
32 38
33typedef void (*signal_handler_t) (int); 39typedef void (*signal_handler_t) (int);
@@ -39,6 +45,10 @@ extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
39# define NSIG NSIG_MINIMUM 45# define NSIG NSIG_MINIMUM
40#endif 46#endif
41 47
48#ifndef emacs_raise
49# define emacs_raise(sig) raise (sig)
50#endif
51
42/* On bsd, [man says] kill does not accept a negative number to kill a pgrp. 52/* On bsd, [man says] kill does not accept a negative number to kill a pgrp.
43 Must do that using the killpg call. */ 53 Must do that using the killpg call. */
44#ifdef BSD_SYSTEM 54#ifdef BSD_SYSTEM
@@ -64,4 +74,4 @@ extern void emacs_sigaction_init (struct sigaction *, signal_handler_t);
64char *strsignal (int); 74char *strsignal (int);
65#endif 75#endif
66 76
67void handle_on_main_thread (int, signal_handler_t); 77void deliver_process_signal (int, signal_handler_t);
diff --git a/src/syswait.h b/src/syswait.h
index 9d84876d4be..aa4c4bcf527 100644
--- a/src/syswait.h
+++ b/src/syswait.h
@@ -51,4 +51,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
51#define WTERMSIG(status) ((status) & 0x7f) 51#define WTERMSIG(status) ((status) & 0x7f)
52#endif 52#endif
53 53
54/* Defined in process.c. */
55extern void record_child_status_change (pid_t, int);
56
57/* Defined in sysdep.c. */
58extern void wait_for_termination (pid_t);
59extern void interruptible_wait_for_termination (pid_t);
60
54#endif /* EMACS_SYSWAIT_H */ 61#endif /* EMACS_SYSWAIT_H */
diff --git a/src/term.c b/src/term.c
index f4117d67dec..189fb783cbc 100644
--- a/src/term.c
+++ b/src/term.c
@@ -753,13 +753,13 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len)
753 conversion_buffer = encode_terminal_code (string, n, coding); 753 conversion_buffer = encode_terminal_code (string, n, coding);
754 if (coding->produced > 0) 754 if (coding->produced > 0)
755 { 755 {
756 BLOCK_INPUT; 756 block_input ();
757 fwrite (conversion_buffer, 1, coding->produced, tty->output); 757 fwrite (conversion_buffer, 1, coding->produced, tty->output);
758 if (ferror (tty->output)) 758 if (ferror (tty->output))
759 clearerr (tty->output); 759 clearerr (tty->output);
760 if (tty->termscript) 760 if (tty->termscript)
761 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); 761 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
762 UNBLOCK_INPUT; 762 unblock_input ();
763 } 763 }
764 string += n; 764 string += n;
765 765
@@ -814,13 +814,13 @@ tty_write_glyphs_with_face (register struct frame *f, register struct glyph *str
814 conversion_buffer = encode_terminal_code (string, len, coding); 814 conversion_buffer = encode_terminal_code (string, len, coding);
815 if (coding->produced > 0) 815 if (coding->produced > 0)
816 { 816 {
817 BLOCK_INPUT; 817 block_input ();
818 fwrite (conversion_buffer, 1, coding->produced, tty->output); 818 fwrite (conversion_buffer, 1, coding->produced, tty->output);
819 if (ferror (tty->output)) 819 if (ferror (tty->output))
820 clearerr (tty->output); 820 clearerr (tty->output);
821 if (tty->termscript) 821 if (tty->termscript)
822 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); 822 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
823 UNBLOCK_INPUT; 823 unblock_input ();
824 } 824 }
825 825
826 /* Turn appearance modes off. */ 826 /* Turn appearance modes off. */
@@ -900,13 +900,13 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
900 900
901 if (coding->produced > 0) 901 if (coding->produced > 0)
902 { 902 {
903 BLOCK_INPUT; 903 block_input ();
904 fwrite (conversion_buffer, 1, coding->produced, tty->output); 904 fwrite (conversion_buffer, 1, coding->produced, tty->output);
905 if (ferror (tty->output)) 905 if (ferror (tty->output))
906 clearerr (tty->output); 906 clearerr (tty->output);
907 if (tty->termscript) 907 if (tty->termscript)
908 fwrite (conversion_buffer, 1, coding->produced, tty->termscript); 908 fwrite (conversion_buffer, 1, coding->produced, tty->termscript);
909 UNBLOCK_INPUT; 909 unblock_input ();
910 } 910 }
911 911
912 OUTPUT1_IF (tty, tty->TS_pad_inserted_char); 912 OUTPUT1_IF (tty, tty->TS_pad_inserted_char);
diff --git a/src/termhooks.h b/src/termhooks.h
index 53e401de409..f35bd929af1 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -591,8 +591,7 @@ struct terminal
591 /* Called to read input events. 591 /* Called to read input events.
592 592
593 TERMINAL indicates which terminal device to read from. Input 593 TERMINAL indicates which terminal device to read from. Input
594 events should be read into BUF, the size of which is given in 594 events should be read into HOLD_QUIT.
595 SIZE.
596 595
597 A positive return value indicates that that many input events 596 A positive return value indicates that that many input events
598 were read into BUF. 597 were read into BUF.
diff --git a/src/w16select.c b/src/w16select.c
index a3f6f1fb9ae..b8aaa3619ba 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -459,7 +459,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
459 if ( !FRAME_MSDOS_P (XFRAME (frame))) 459 if ( !FRAME_MSDOS_P (XFRAME (frame)))
460 goto done; 460 goto done;
461 461
462 BLOCK_INPUT; 462 block_input ();
463 463
464 if (!open_clipboard ()) 464 if (!open_clipboard ())
465 goto error; 465 goto error;
@@ -520,7 +520,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
520 520
521 unblock: 521 unblock:
522 xfree (dst); 522 xfree (dst);
523 UNBLOCK_INPUT; 523 unblock_input ();
524 524
525 /* Notify user if the text is too large to fit into DOS memory. 525 /* Notify user if the text is too large to fit into DOS memory.
526 (This will happen somewhere after 600K bytes (470K in DJGPP v1.x), 526 (This will happen somewhere after 600K bytes (470K in DJGPP v1.x),
@@ -565,7 +565,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat
565 if ( !FRAME_MSDOS_P (XFRAME (frame))) 565 if ( !FRAME_MSDOS_P (XFRAME (frame)))
566 goto done; 566 goto done;
567 567
568 BLOCK_INPUT; 568 block_input ();
569 569
570 if (!open_clipboard ()) 570 if (!open_clipboard ())
571 goto unblock; 571 goto unblock;
@@ -626,7 +626,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat
626 close_clipboard (); 626 close_clipboard ();
627 627
628 unblock: 628 unblock:
629 UNBLOCK_INPUT; 629 unblock_input ();
630 630
631 done: 631 done:
632 632
diff --git a/src/w32.c b/src/w32.c
index bcb0511e2fa..3154c725abf 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -6521,33 +6521,27 @@ sys_localtime (const time_t *t)
6521 6521
6522 6522
6523 6523
6524/* Delayed loading of libraries. */ 6524/* Try loading LIBRARY_ID from the file(s) specified in
6525 6525 Vdynamic_library_alist. If the library is loaded successfully,
6526Lisp_Object Vlibrary_cache; 6526 return the handle of the DLL, and record the filename in the
6527 6527 property :loaded-from of LIBRARY_ID. If the library could not be
6528/* The argument LIBRARIES is an alist that associates a symbol 6528 found, or when it was already loaded (because the handle is not
6529 LIBRARY_ID, identifying an external DLL library known to Emacs, to 6529 recorded anywhere, and so is lost after use), return NULL.
6530 a list of filenames under which the library is usually found. In 6530
6531 most cases, the argument passed as LIBRARIES is the variable 6531 We could also save the handle in :loaded-from, but currently
6532 `dynamic-library-alist', which is initialized to a list of common 6532 there's no use case for it. */
6533 library names. If the function loads the library successfully, it
6534 returns the handle of the DLL, and records the filename in the
6535 property :loaded-from of LIBRARY_ID; it returns NULL if the library
6536 could not be found, or when it was already loaded (because the
6537 handle is not recorded anywhere, and so is lost after use). It
6538 would be trivial to save the handle too in :loaded-from, but
6539 currently there's no use case for it. */
6540HMODULE 6533HMODULE
6541w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id) 6534w32_delayed_load (Lisp_Object library_id)
6542{ 6535{
6543 HMODULE library_dll = NULL; 6536 HMODULE library_dll = NULL;
6544 6537
6545 CHECK_SYMBOL (library_id); 6538 CHECK_SYMBOL (library_id);
6546 6539
6547 if (CONSP (libraries) && NILP (Fassq (library_id, Vlibrary_cache))) 6540 if (CONSP (Vdynamic_library_alist)
6541 && NILP (Fassq (library_id, Vlibrary_cache)))
6548 { 6542 {
6549 Lisp_Object found = Qnil; 6543 Lisp_Object found = Qnil;
6550 Lisp_Object dlls = Fassq (library_id, libraries); 6544 Lisp_Object dlls = Fassq (library_id, Vdynamic_library_alist);
6551 6545
6552 if (CONSP (dlls)) 6546 if (CONSP (dlls))
6553 for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls)) 6547 for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls))
@@ -6626,8 +6620,9 @@ check_windows_init_file (void)
6626} 6620}
6627 6621
6628void 6622void
6629term_ntproc (void) 6623term_ntproc (int ignored)
6630{ 6624{
6625 (void)ignored;
6631 /* shutdown the socket interface if necessary */ 6626 /* shutdown the socket interface if necessary */
6632 term_winsock (); 6627 term_winsock ();
6633 6628
@@ -6635,7 +6630,7 @@ term_ntproc (void)
6635} 6630}
6636 6631
6637void 6632void
6638init_ntproc (void) 6633init_ntproc (int dumping)
6639{ 6634{
6640 /* Initialize the socket interface now if available and requested by 6635 /* Initialize the socket interface now if available and requested by
6641 the user by defining PRELOAD_WINSOCK; otherwise loading will be 6636 the user by defining PRELOAD_WINSOCK; otherwise loading will be
@@ -6712,7 +6707,8 @@ init_ntproc (void)
6712 6707
6713 /* unfortunately, atexit depends on implementation of malloc */ 6708 /* unfortunately, atexit depends on implementation of malloc */
6714 /* atexit (term_ntproc); */ 6709 /* atexit (term_ntproc); */
6715 signal (SIGABRT, term_ntproc); 6710 if (!dumping)
6711 signal (SIGABRT, term_ntproc);
6716 6712
6717 /* determine which drives are fixed, for GetCachedVolumeInformation */ 6713 /* determine which drives are fixed, for GetCachedVolumeInformation */
6718 { 6714 {
@@ -6769,9 +6765,6 @@ globals_of_w32 (void)
6769 6765
6770 DEFSYM (QCloaded_from, ":loaded-from"); 6766 DEFSYM (QCloaded_from, ":loaded-from");
6771 6767
6772 Vlibrary_cache = Qnil;
6773 staticpro (&Vlibrary_cache);
6774
6775 g_b_init_is_windows_9x = 0; 6768 g_b_init_is_windows_9x = 0;
6776 g_b_init_open_process_token = 0; 6769 g_b_init_open_process_token = 0;
6777 g_b_init_get_token_information = 0; 6770 g_b_init_get_token_information = 0;
diff --git a/src/w32.h b/src/w32.h
index 73d57a65a4a..a833c8f4315 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -127,8 +127,8 @@ extern void reset_standard_handles (int in, int out,
127/* Return the string resource associated with KEY of type TYPE. */ 127/* Return the string resource associated with KEY of type TYPE. */
128extern LPBYTE w32_get_resource (char * key, LPDWORD type); 128extern LPBYTE w32_get_resource (char * key, LPDWORD type);
129 129
130extern void init_ntproc (void); 130extern void init_ntproc (int);
131extern void term_ntproc (void); 131extern void term_ntproc (int);
132extern void globals_of_w32 (void); 132extern void globals_of_w32 (void);
133extern void syms_of_w32term (void); 133extern void syms_of_w32term (void);
134extern void syms_of_w32fns (void); 134extern void syms_of_w32fns (void);
@@ -145,8 +145,8 @@ extern void check_windows_init_file (void);
145extern int _sys_read_ahead (int fd); 145extern int _sys_read_ahead (int fd);
146extern int _sys_wait_accept (int fd); 146extern int _sys_wait_accept (int fd);
147 147
148extern Lisp_Object Vlibrary_cache, QCloaded_from; 148extern Lisp_Object QCloaded_from;
149extern HMODULE w32_delayed_load (Lisp_Object, Lisp_Object); 149extern HMODULE w32_delayed_load (Lisp_Object);
150 150
151#ifdef HAVE_GNUTLS 151#ifdef HAVE_GNUTLS
152#include <gnutls/gnutls.h> 152#include <gnutls/gnutls.h>
diff --git a/src/w32fns.c b/src/w32fns.c
index be008bb18c8..808e19d0b66 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -364,7 +364,7 @@ if the entry is new. */)
364 364
365 XSETINT (rgb, RGB (XUINT (red), XUINT (green), XUINT (blue))); 365 XSETINT (rgb, RGB (XUINT (red), XUINT (green), XUINT (blue)));
366 366
367 BLOCK_INPUT; 367 block_input ();
368 368
369 /* replace existing entry in w32-color-map or add new entry. */ 369 /* replace existing entry in w32-color-map or add new entry. */
370 entry = Fassoc (name, Vw32_color_map); 370 entry = Fassoc (name, Vw32_color_map);
@@ -379,7 +379,7 @@ if the entry is new. */)
379 Fsetcdr (entry, rgb); 379 Fsetcdr (entry, rgb);
380 } 380 }
381 381
382 UNBLOCK_INPUT; 382 unblock_input ();
383 383
384 return (oldrgb); 384 return (oldrgb);
385} 385}
@@ -642,7 +642,7 @@ w32_default_color_map (void)
642 colormap_t *pc = w32_color_map; 642 colormap_t *pc = w32_color_map;
643 Lisp_Object cmap; 643 Lisp_Object cmap;
644 644
645 BLOCK_INPUT; 645 block_input ();
646 646
647 cmap = Qnil; 647 cmap = Qnil;
648 648
@@ -652,7 +652,7 @@ w32_default_color_map (void)
652 make_number (pc->colorref)), 652 make_number (pc->colorref)),
653 cmap); 653 cmap);
654 654
655 UNBLOCK_INPUT; 655 unblock_input ();
656 656
657 return (cmap); 657 return (cmap);
658} 658}
@@ -669,7 +669,7 @@ w32_color_map_lookup (char *colorname)
669{ 669{
670 Lisp_Object tail, ret = Qnil; 670 Lisp_Object tail, ret = Qnil;
671 671
672 BLOCK_INPUT; 672 block_input ();
673 673
674 for (tail = Vw32_color_map; CONSP (tail); tail = XCDR (tail)) 674 for (tail = Vw32_color_map; CONSP (tail); tail = XCDR (tail))
675 { 675 {
@@ -689,7 +689,7 @@ w32_color_map_lookup (char *colorname)
689 QUIT; 689 QUIT;
690 } 690 }
691 691
692 UNBLOCK_INPUT; 692 unblock_input ();
693 693
694 return ret; 694 return ret;
695} 695}
@@ -701,7 +701,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors)
701 HKEY colors_key; 701 HKEY colors_key;
702 702
703 /* Other registry operations are done with input blocked. */ 703 /* Other registry operations are done with input blocked. */
704 BLOCK_INPUT; 704 block_input ();
705 705
706 /* Look for "Control Panel/Colors" under User and Machine registry 706 /* Look for "Control Panel/Colors" under User and Machine registry
707 settings. */ 707 settings. */
@@ -739,7 +739,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors)
739 RegCloseKey (colors_key); 739 RegCloseKey (colors_key);
740 } 740 }
741 741
742 UNBLOCK_INPUT; 742 unblock_input ();
743} 743}
744 744
745 745
@@ -748,7 +748,7 @@ x_to_w32_color (char * colorname)
748{ 748{
749 register Lisp_Object ret = Qnil; 749 register Lisp_Object ret = Qnil;
750 750
751 BLOCK_INPUT; 751 block_input ();
752 752
753 if (colorname[0] == '#') 753 if (colorname[0] == '#')
754 { 754 {
@@ -801,7 +801,7 @@ x_to_w32_color (char * colorname)
801 pos += 0x8; 801 pos += 0x8;
802 if (i == 2) 802 if (i == 2)
803 { 803 {
804 UNBLOCK_INPUT; 804 unblock_input ();
805 XSETINT (ret, colorval); 805 XSETINT (ret, colorval);
806 return ret; 806 return ret;
807 } 807 }
@@ -855,7 +855,7 @@ x_to_w32_color (char * colorname)
855 { 855 {
856 if (*end != '\0') 856 if (*end != '\0')
857 break; 857 break;
858 UNBLOCK_INPUT; 858 unblock_input ();
859 XSETINT (ret, colorval); 859 XSETINT (ret, colorval);
860 return ret; 860 return ret;
861 } 861 }
@@ -897,7 +897,7 @@ x_to_w32_color (char * colorname)
897 { 897 {
898 if (*end != '\0') 898 if (*end != '\0')
899 break; 899 break;
900 UNBLOCK_INPUT; 900 unblock_input ();
901 XSETINT (ret, colorval); 901 XSETINT (ret, colorval);
902 return ret; 902 return ret;
903 } 903 }
@@ -932,7 +932,7 @@ x_to_w32_color (char * colorname)
932 } 932 }
933 } 933 }
934 934
935 UNBLOCK_INPUT; 935 unblock_input ();
936 return ret; 936 return ret;
937} 937}
938 938
@@ -1235,7 +1235,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1235 f->output_data.w32->mouse_pixel = FRAME_FOREGROUND_PIXEL (f); 1235 f->output_data.w32->mouse_pixel = FRAME_FOREGROUND_PIXEL (f);
1236 1236
1237#if 0 /* TODO : Mouse cursor customization. */ 1237#if 0 /* TODO : Mouse cursor customization. */
1238 BLOCK_INPUT; 1238 block_input ();
1239 1239
1240 /* It's not okay to crash if the user selects a screwy cursor. */ 1240 /* It's not okay to crash if the user selects a screwy cursor. */
1241 count = x_catch_errors (FRAME_W32_DISPLAY (f)); 1241 count = x_catch_errors (FRAME_W32_DISPLAY (f));
@@ -1358,7 +1358,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1358 f->output_data.w32->hand_cursor = hand_cursor; 1358 f->output_data.w32->hand_cursor = hand_cursor;
1359 1359
1360 XFlush (FRAME_W32_DISPLAY (f)); 1360 XFlush (FRAME_W32_DISPLAY (f));
1361 UNBLOCK_INPUT; 1361 unblock_input ();
1362 1362
1363 update_face_from_frame_parameter (f, Qmouse_color, arg); 1363 update_face_from_frame_parameter (f, Qmouse_color, arg);
1364#endif /* TODO */ 1364#endif /* TODO */
@@ -1390,12 +1390,12 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1390 1390
1391 if (FRAME_W32_WINDOW (f) != 0) 1391 if (FRAME_W32_WINDOW (f) != 0)
1392 { 1392 {
1393 BLOCK_INPUT; 1393 block_input ();
1394 /* Update frame's cursor_gc. */ 1394 /* Update frame's cursor_gc. */
1395 f->output_data.w32->cursor_gc->foreground = fore_pixel; 1395 f->output_data.w32->cursor_gc->foreground = fore_pixel;
1396 f->output_data.w32->cursor_gc->background = pixel; 1396 f->output_data.w32->cursor_gc->background = pixel;
1397 1397
1398 UNBLOCK_INPUT; 1398 unblock_input ();
1399 1399
1400 if (FRAME_VISIBLE_P (f)) 1400 if (FRAME_VISIBLE_P (f))
1401 { 1401 {
@@ -1466,16 +1466,16 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1466 if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval)) 1466 if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval))
1467 return; 1467 return;
1468 1468
1469 BLOCK_INPUT; 1469 block_input ();
1470 1470
1471 result = x_bitmap_icon (f, arg); 1471 result = x_bitmap_icon (f, arg);
1472 if (result) 1472 if (result)
1473 { 1473 {
1474 UNBLOCK_INPUT; 1474 unblock_input ();
1475 error ("No icon window available"); 1475 error ("No icon window available");
1476 } 1476 }
1477 1477
1478 UNBLOCK_INPUT; 1478 unblock_input ();
1479} 1479}
1480 1480
1481void 1481void
@@ -1495,7 +1495,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1495 if (f->output_data.w32->icon_bitmap != 0) 1495 if (f->output_data.w32->icon_bitmap != 0)
1496 return; 1496 return;
1497 1497
1498 BLOCK_INPUT; 1498 block_input ();
1499 1499
1500 result = x_text_icon (f, 1500 result = x_text_icon (f,
1501 SSDATA ((!NILP (f->icon_name) 1501 SSDATA ((!NILP (f->icon_name)
@@ -1506,7 +1506,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1506 1506
1507 if (result) 1507 if (result)
1508 { 1508 {
1509 UNBLOCK_INPUT; 1509 unblock_input ();
1510 error ("No icon window available"); 1510 error ("No icon window available");
1511 } 1511 }
1512 1512
@@ -1521,7 +1521,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1521 } 1521 }
1522 1522
1523 XFlush (FRAME_W32_DISPLAY (f)); 1523 XFlush (FRAME_W32_DISPLAY (f));
1524 UNBLOCK_INPUT; 1524 unblock_input ();
1525#endif 1525#endif
1526} 1526}
1527 1527
@@ -1623,13 +1623,13 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1623 int width = FRAME_PIXEL_WIDTH (f); 1623 int width = FRAME_PIXEL_WIDTH (f);
1624 int y = nlines * FRAME_LINE_HEIGHT (f); 1624 int y = nlines * FRAME_LINE_HEIGHT (f);
1625 1625
1626 BLOCK_INPUT; 1626 block_input ();
1627 { 1627 {
1628 HDC hdc = get_frame_dc (f); 1628 HDC hdc = get_frame_dc (f);
1629 w32_clear_area (f, hdc, 0, y, width, height); 1629 w32_clear_area (f, hdc, 0, y, width, height);
1630 release_frame_dc (f, hdc); 1630 release_frame_dc (f, hdc);
1631 } 1631 }
1632 UNBLOCK_INPUT; 1632 unblock_input ();
1633 1633
1634 if (WINDOWP (f->tool_bar_window)) 1634 if (WINDOWP (f->tool_bar_window))
1635 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); 1635 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
@@ -1697,9 +1697,9 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1697 if (STRING_MULTIBYTE (name)) 1697 if (STRING_MULTIBYTE (name))
1698 name = ENCODE_SYSTEM (name); 1698 name = ENCODE_SYSTEM (name);
1699 1699
1700 BLOCK_INPUT; 1700 block_input ();
1701 SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); 1701 SetWindowText (FRAME_W32_WINDOW (f), SDATA (name));
1702 UNBLOCK_INPUT; 1702 unblock_input ();
1703 } 1703 }
1704} 1704}
1705 1705
@@ -1743,9 +1743,9 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1743 if (STRING_MULTIBYTE (name)) 1743 if (STRING_MULTIBYTE (name))
1744 name = ENCODE_SYSTEM (name); 1744 name = ENCODE_SYSTEM (name);
1745 1745
1746 BLOCK_INPUT; 1746 block_input ();
1747 SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); 1747 SetWindowText (FRAME_W32_WINDOW (f), SDATA (name));
1748 UNBLOCK_INPUT; 1748 unblock_input ();
1749 } 1749 }
1750} 1750}
1751 1751
@@ -3896,7 +3896,7 @@ my_create_tip_window (struct frame *f)
3896static void 3896static void
3897w32_window (struct frame *f, long window_prompting, int minibuffer_only) 3897w32_window (struct frame *f, long window_prompting, int minibuffer_only)
3898{ 3898{
3899 BLOCK_INPUT; 3899 block_input ();
3900 3900
3901 /* Use the resource name as the top-level window name 3901 /* Use the resource name as the top-level window name
3902 for looking up resources. Make a non-Lisp copy 3902 for looking up resources. Make a non-Lisp copy
@@ -3928,7 +3928,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
3928 x_set_name (f, name, explicit); 3928 x_set_name (f, name, explicit);
3929 } 3929 }
3930 3930
3931 UNBLOCK_INPUT; 3931 unblock_input ();
3932 3932
3933 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) 3933 if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f))
3934 initialize_frame_menubar (f); 3934 initialize_frame_menubar (f);
@@ -3959,7 +3959,7 @@ x_icon (struct frame *f, Lisp_Object parms)
3959 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) 3959 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
3960 error ("Both left and top icon corners of icon must be specified"); 3960 error ("Both left and top icon corners of icon must be specified");
3961 3961
3962 BLOCK_INPUT; 3962 block_input ();
3963 3963
3964 if (! EQ (icon_x, Qunbound)) 3964 if (! EQ (icon_x, Qunbound))
3965 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); 3965 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
@@ -3976,7 +3976,7 @@ x_icon (struct frame *f, Lisp_Object parms)
3976 : f->name))); 3976 : f->name)));
3977#endif 3977#endif
3978 3978
3979 UNBLOCK_INPUT; 3979 unblock_input ();
3980} 3980}
3981 3981
3982 3982
@@ -3985,7 +3985,7 @@ x_make_gc (struct frame *f)
3985{ 3985{
3986 XGCValues gc_values; 3986 XGCValues gc_values;
3987 3987
3988 BLOCK_INPUT; 3988 block_input ();
3989 3989
3990 /* Create the GC's of this frame. 3990 /* Create the GC's of this frame.
3991 Note that many default values are used. */ 3991 Note that many default values are used. */
@@ -4005,7 +4005,7 @@ x_make_gc (struct frame *f)
4005 f->output_data.w32->white_relief.gc = 0; 4005 f->output_data.w32->white_relief.gc = 0;
4006 f->output_data.w32->black_relief.gc = 0; 4006 f->output_data.w32->black_relief.gc = 0;
4007 4007
4008 UNBLOCK_INPUT; 4008 unblock_input ();
4009} 4009}
4010 4010
4011 4011
@@ -4351,9 +4351,9 @@ This function is an internal primitive--use `make-frame' instead. */)
4351 /* Tell the server what size and position, etc, we want, and how 4351 /* Tell the server what size and position, etc, we want, and how
4352 badly we want them. This should be done after we have the menu 4352 badly we want them. This should be done after we have the menu
4353 bar so that its size can be taken into account. */ 4353 bar so that its size can be taken into account. */
4354 BLOCK_INPUT; 4354 block_input ();
4355 x_wm_set_size_hint (f, window_prompting, 0); 4355 x_wm_set_size_hint (f, window_prompting, 0);
4356 UNBLOCK_INPUT; 4356 unblock_input ();
4357 4357
4358 /* Make the window appear on the frame and enable display, unless 4358 /* Make the window appear on the frame and enable display, unless
4359 the caller says not to. However, with explicit parent, Emacs 4359 the caller says not to. However, with explicit parent, Emacs
@@ -4862,11 +4862,11 @@ If DISPLAY is nil, that stands for the selected frame's display. */)
4862 if (dpyinfo->reference_count > 0) 4862 if (dpyinfo->reference_count > 0)
4863 error ("Display still has frames on it"); 4863 error ("Display still has frames on it");
4864 4864
4865 BLOCK_INPUT; 4865 block_input ();
4866 x_destroy_all_bitmaps (dpyinfo); 4866 x_destroy_all_bitmaps (dpyinfo);
4867 4867
4868 x_delete_display (dpyinfo); 4868 x_delete_display (dpyinfo);
4869 UNBLOCK_INPUT; 4869 unblock_input ();
4870 4870
4871 return Qnil; 4871 return Qnil;
4872} 4872}
@@ -4935,7 +4935,7 @@ FRAME. Default is to change on the edit X window. */)
4935 CHECK_STRING (prop); 4935 CHECK_STRING (prop);
4936 CHECK_STRING (value); 4936 CHECK_STRING (value);
4937 4937
4938 BLOCK_INPUT; 4938 block_input ();
4939 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); 4939 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
4940 XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), 4940 XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
4941 prop_atom, XA_STRING, 8, PropModeReplace, 4941 prop_atom, XA_STRING, 8, PropModeReplace,
@@ -4943,7 +4943,7 @@ FRAME. Default is to change on the edit X window. */)
4943 4943
4944 /* Make sure the property is set when we return. */ 4944 /* Make sure the property is set when we return. */
4945 XFlush (FRAME_W32_DISPLAY (f)); 4945 XFlush (FRAME_W32_DISPLAY (f));
4946 UNBLOCK_INPUT; 4946 unblock_input ();
4947 4947
4948 return value; 4948 return value;
4949} 4949}
@@ -4959,13 +4959,13 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */)
4959 Atom prop_atom; 4959 Atom prop_atom;
4960 4960
4961 CHECK_STRING (prop); 4961 CHECK_STRING (prop);
4962 BLOCK_INPUT; 4962 block_input ();
4963 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); 4963 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
4964 XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom); 4964 XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom);
4965 4965
4966 /* Make sure the property is removed when we return. */ 4966 /* Make sure the property is removed when we return. */
4967 XFlush (FRAME_W32_DISPLAY (f)); 4967 XFlush (FRAME_W32_DISPLAY (f));
4968 UNBLOCK_INPUT; 4968 unblock_input ();
4969 4969
4970 return prop; 4970 return prop;
4971} 4971}
@@ -5001,7 +5001,7 @@ no value of TYPE (always string in the MS Windows case). */)
5001 unsigned long actual_size, bytes_remaining; 5001 unsigned long actual_size, bytes_remaining;
5002 5002
5003 CHECK_STRING (prop); 5003 CHECK_STRING (prop);
5004 BLOCK_INPUT; 5004 block_input ();
5005 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); 5005 prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False);
5006 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), 5006 rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f),
5007 prop_atom, 0, 0, False, XA_STRING, 5007 prop_atom, 0, 0, False, XA_STRING,
@@ -5026,7 +5026,7 @@ no value of TYPE (always string in the MS Windows case). */)
5026 XFree (tmp_data); 5026 XFree (tmp_data);
5027 } 5027 }
5028 5028
5029 UNBLOCK_INPUT; 5029 unblock_input ();
5030 5030
5031 return prop_value; 5031 return prop_value;
5032 5032
@@ -5349,9 +5349,9 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5349 f->left_fringe_width = 0; 5349 f->left_fringe_width = 0;
5350 f->right_fringe_width = 0; 5350 f->right_fringe_width = 0;
5351 5351
5352 BLOCK_INPUT; 5352 block_input ();
5353 my_create_tip_window (f); 5353 my_create_tip_window (f);
5354 UNBLOCK_INPUT; 5354 unblock_input ();
5355 5355
5356 x_make_gc (f); 5356 x_make_gc (f);
5357 5357
@@ -5457,11 +5457,11 @@ compute_tip_xy (struct frame *f,
5457 max_x = x_display_pixel_width (FRAME_W32_DISPLAY_INFO (f)); 5457 max_x = x_display_pixel_width (FRAME_W32_DISPLAY_INFO (f));
5458 max_y = x_display_pixel_height (FRAME_W32_DISPLAY_INFO (f)); 5458 max_y = x_display_pixel_height (FRAME_W32_DISPLAY_INFO (f));
5459 5459
5460 BLOCK_INPUT; 5460 block_input ();
5461 GetCursorPos (&pt); 5461 GetCursorPos (&pt);
5462 *root_x = pt.x; 5462 *root_x = pt.x;
5463 *root_y = pt.y; 5463 *root_y = pt.y;
5464 UNBLOCK_INPUT; 5464 unblock_input ();
5465 5465
5466 /* If multiple monitor support is available, constrain the tip onto 5466 /* If multiple monitor support is available, constrain the tip onto
5467 the current monitor. This improves the above by allowing negative 5467 the current monitor. This improves the above by allowing negative
@@ -5596,7 +5596,7 @@ Text larger than the specified size is clipped. */)
5596 call1 (Qcancel_timer, timer); 5596 call1 (Qcancel_timer, timer);
5597 } 5597 }
5598 5598
5599 BLOCK_INPUT; 5599 block_input ();
5600 compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f), 5600 compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f),
5601 FRAME_PIXEL_HEIGHT (f), &root_x, &root_y); 5601 FRAME_PIXEL_HEIGHT (f), &root_x, &root_y);
5602 5602
@@ -5610,7 +5610,7 @@ Text larger than the specified size is clipped. */)
5610 0, 0, 0, 0, 5610 0, 0, 0, 0,
5611 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); 5611 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
5612 5612
5613 UNBLOCK_INPUT; 5613 unblock_input ();
5614 goto start_timer; 5614 goto start_timer;
5615 } 5615 }
5616 } 5616 }
@@ -5637,7 +5637,7 @@ Text larger than the specified size is clipped. */)
5637 5637
5638 /* Block input until the tip has been fully drawn, to avoid crashes 5638 /* Block input until the tip has been fully drawn, to avoid crashes
5639 when drawing tips in menus. */ 5639 when drawing tips in menus. */
5640 BLOCK_INPUT; 5640 block_input ();
5641 5641
5642 /* Create a frame for the tooltip, and record it in the global 5642 /* Create a frame for the tooltip, and record it in the global
5643 variable tip_frame. */ 5643 variable tip_frame. */
@@ -5809,7 +5809,7 @@ Text larger than the specified size is clipped. */)
5809 w->must_be_updated_p = 1; 5809 w->must_be_updated_p = 1;
5810 update_single_window (w, 1); 5810 update_single_window (w, 1);
5811 5811
5812 UNBLOCK_INPUT; 5812 unblock_input ();
5813 5813
5814 /* Restore original current buffer. */ 5814 /* Restore original current buffer. */
5815 set_buffer_internal_1 (old_buffer); 5815 set_buffer_internal_1 (old_buffer);
@@ -6002,7 +6002,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
6002 6002
6003 /* Prevent redisplay. */ 6003 /* Prevent redisplay. */
6004 specbind (Qinhibit_redisplay, Qt); 6004 specbind (Qinhibit_redisplay, Qt);
6005 BLOCK_INPUT; 6005 block_input ();
6006 6006
6007 memset (&new_file_details, 0, sizeof (new_file_details)); 6007 memset (&new_file_details, 0, sizeof (new_file_details));
6008 /* Apparently NT4 crashes if you give it an unexpected size. 6008 /* Apparently NT4 crashes if you give it an unexpected size.
@@ -6041,7 +6041,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
6041 6041
6042 file_opened = GetOpenFileName (file_details); 6042 file_opened = GetOpenFileName (file_details);
6043 6043
6044 UNBLOCK_INPUT; 6044 unblock_input ();
6045 6045
6046 if (file_opened) 6046 if (file_opened)
6047 { 6047 {
diff --git a/src/w32inevt.c b/src/w32inevt.c
index a96d8d70483..ebb95dcace5 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -567,7 +567,7 @@ w32_console_mouse_position (FRAME_PTR *f,
567 Lisp_Object *y, 567 Lisp_Object *y,
568 Time *time) 568 Time *time)
569{ 569{
570 BLOCK_INPUT; 570 block_input ();
571 571
572 insist = insist; 572 insist = insist;
573 573
@@ -580,7 +580,7 @@ w32_console_mouse_position (FRAME_PTR *f,
580 XSETINT (*y, movement_pos.Y); 580 XSETINT (*y, movement_pos.Y);
581 *time = movement_time; 581 *time = movement_time;
582 582
583 UNBLOCK_INPUT; 583 unblock_input ();
584} 584}
585 585
586/* Remember mouse motion and notify emacs. */ 586/* Remember mouse motion and notify emacs. */
@@ -749,14 +749,7 @@ w32_console_read_socket (struct terminal *terminal,
749 int nev, add; 749 int nev, add;
750 int isdead; 750 int isdead;
751 751
752 if (interrupt_input_blocked) 752 block_input ();
753 {
754 interrupt_input_pending = 1;
755 return -1;
756 }
757
758 interrupt_input_pending = 0;
759 BLOCK_INPUT;
760 753
761 for (;;) 754 for (;;)
762 { 755 {
@@ -818,6 +811,6 @@ w32_console_read_socket (struct terminal *terminal,
818 if (!w32_use_full_screen_buffer) 811 if (!w32_use_full_screen_buffer)
819 maybe_generate_resize_event (); 812 maybe_generate_resize_event ();
820 813
821 UNBLOCK_INPUT; 814 unblock_input ();
822 return nev; 815 return nev;
823} 816}
diff --git a/src/w32menu.c b/src/w32menu.c
index fa7db64f147..fb1cb606940 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -85,7 +85,7 @@ MessageBoxW_Proc unicode_message_box = NULL;
85 85
86Lisp_Object Qdebug_on_next_call; 86Lisp_Object Qdebug_on_next_call;
87 87
88void set_frame_menubar (FRAME_PTR, int, int); 88void set_frame_menubar (FRAME_PTR, bool, bool);
89 89
90#ifdef HAVE_DIALOGS 90#ifdef HAVE_DIALOGS
91static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**); 91static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**);
@@ -221,9 +221,9 @@ otherwise it is "Question". */)
221 list_of_panes (Fcons (contents, Qnil)); 221 list_of_panes (Fcons (contents, Qnil));
222 222
223 /* Display them in a dialog box. */ 223 /* Display them in a dialog box. */
224 BLOCK_INPUT; 224 block_input ();
225 selection = w32_dialog_show (f, 0, title, header, &error_name); 225 selection = w32_dialog_show (f, 0, title, header, &error_name);
226 UNBLOCK_INPUT; 226 unblock_input ();
227 227
228 discard_menu_items (); 228 discard_menu_items ();
229 FRAME_X_DISPLAY_INFO (f)->grabbed = 0; 229 FRAME_X_DISPLAY_INFO (f)->grabbed = 0;
@@ -356,7 +356,7 @@ menubar_selection_callback (FRAME_PTR f, void * client_data)
356 it is set the first time this is called, from initialize_frame_menubar. */ 356 it is set the first time this is called, from initialize_frame_menubar. */
357 357
358void 358void
359set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) 359set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
360{ 360{
361 HMENU menubar_widget = f->output_data.w32->menubar_widget; 361 HMENU menubar_widget = f->output_data.w32->menubar_widget;
362 Lisp_Object items; 362 Lisp_Object items;
@@ -571,7 +571,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
571 571
572 /* Create or update the menu bar widget. */ 572 /* Create or update the menu bar widget. */
573 573
574 BLOCK_INPUT; 574 block_input ();
575 575
576 if (menubar_widget) 576 if (menubar_widget)
577 { 577 {
@@ -601,7 +601,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
601 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); 601 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
602 } 602 }
603 603
604 UNBLOCK_INPUT; 604 unblock_input ();
605} 605}
606 606
607/* Called from Fx_create_frame to create the initial menubar of a frame 607/* Called from Fx_create_frame to create the initial menubar of a frame
@@ -624,7 +624,7 @@ initialize_frame_menubar (FRAME_PTR f)
624void 624void
625free_frame_menubar (FRAME_PTR f) 625free_frame_menubar (FRAME_PTR f)
626{ 626{
627 BLOCK_INPUT; 627 block_input ();
628 628
629 { 629 {
630 HMENU old = GetMenu (FRAME_W32_WINDOW (f)); 630 HMENU old = GetMenu (FRAME_W32_WINDOW (f));
@@ -633,7 +633,7 @@ free_frame_menubar (FRAME_PTR f)
633 DestroyMenu (old); 633 DestroyMenu (old);
634 } 634 }
635 635
636 UNBLOCK_INPUT; 636 unblock_input ();
637} 637}
638 638
639 639
diff --git a/src/w32proc.c b/src/w32proc.c
index 26a0925ad87..b367b42d8c6 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -86,19 +86,34 @@ typedef void (_CALLBACK_ *signal_handler) (int);
86/* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */ 86/* Signal handlers...SIG_DFL == 0 so this is initialized correctly. */
87static signal_handler sig_handlers[NSIG]; 87static signal_handler sig_handlers[NSIG];
88 88
89/* Fake signal implementation to record the SIGCHLD handler. */ 89/* Improve on the CRT 'signal' implementation so that we could record
90 the SIGCHLD handler. */
90signal_handler 91signal_handler
91sys_signal (int sig, signal_handler handler) 92sys_signal (int sig, signal_handler handler)
92{ 93{
93 signal_handler old; 94 signal_handler old;
94 95
95 if (sig != SIGCHLD) 96 /* SIGCHLD is needed for supporting subprocesses, see sys_kill
97 below. All the others are the only ones supported by the MS
98 runtime. */
99 if (!(sig == SIGCHLD || sig == SIGSEGV || sig == SIGILL
100 || sig == SIGFPE || sig == SIGABRT || sig == SIGTERM))
96 { 101 {
97 errno = EINVAL; 102 errno = EINVAL;
98 return SIG_ERR; 103 return SIG_ERR;
99 } 104 }
100 old = sig_handlers[sig]; 105 old = sig_handlers[sig];
101 sig_handlers[sig] = handler; 106 /* SIGABRT is treated specially because w32.c installs term_ntproc
107 as its handler, so we don't want to override that afterwards.
108 Aborting Emacs works specially anyway: either by calling
109 emacs_abort directly or through terminate_due_to_signal, which
110 calls emacs_abort through emacs_raise. */
111 if (!(sig == SIGABRT && old == term_ntproc))
112 {
113 sig_handlers[sig] = handler;
114 if (sig != SIGCHLD)
115 signal (sig, handler);
116 }
102 return old; 117 return old;
103} 118}
104 119
@@ -106,23 +121,26 @@ sys_signal (int sig, signal_handler handler)
106int 121int
107sigaction (int sig, const struct sigaction *act, struct sigaction *oact) 122sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
108{ 123{
109 signal_handler old; 124 signal_handler old = SIG_DFL;
125 int retval = 0;
110 126
111 if (sig != SIGCHLD) 127 if (act)
128 old = sys_signal (sig, act->sa_handler);
129 else if (oact)
130 old = sig_handlers[sig];
131
132 if (old == SIG_ERR)
112 { 133 {
113 errno = EINVAL; 134 errno = EINVAL;
114 return -1; 135 retval = -1;
115 } 136 }
116 old = sig_handlers[sig];
117 if (act)
118 sig_handlers[sig] = act->sa_handler;
119 if (oact) 137 if (oact)
120 { 138 {
121 oact->sa_handler = old; 139 oact->sa_handler = old;
122 oact->sa_flags = 0; 140 oact->sa_flags = 0;
123 oact->sa_mask = empty_mask; 141 oact->sa_mask = empty_mask;
124 } 142 }
125 return 0; 143 return retval;
126} 144}
127 145
128/* Defined in <process.h> which conflicts with the local copy */ 146/* Defined in <process.h> which conflicts with the local copy */
@@ -1420,6 +1438,7 @@ find_child_console (HWND hwnd, LPARAM arg)
1420 return TRUE; 1438 return TRUE;
1421} 1439}
1422 1440
1441/* Emulate 'kill', but only for other processes. */
1423int 1442int
1424sys_kill (int pid, int sig) 1443sys_kill (int pid, int sig)
1425{ 1444{
@@ -1428,9 +1447,6 @@ sys_kill (int pid, int sig)
1428 int need_to_free = 0; 1447 int need_to_free = 0;
1429 int rc = 0; 1448 int rc = 0;
1430 1449
1431 if (pid == getpid () && sig == SIGABRT)
1432 emacs_abort ();
1433
1434 /* Only handle signals that will result in the process dying */ 1450 /* Only handle signals that will result in the process dying */
1435 if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) 1451 if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP)
1436 { 1452 {
@@ -1441,6 +1457,11 @@ sys_kill (int pid, int sig)
1441 cp = find_child_pid (pid); 1457 cp = find_child_pid (pid);
1442 if (cp == NULL) 1458 if (cp == NULL)
1443 { 1459 {
1460 /* We were passed a PID of something other than our subprocess.
1461 If that is our own PID, we will send to ourself a message to
1462 close the selected frame, which does not necessarily
1463 terminates Emacs. But then we are not supposed to call
1464 sys_kill with our own PID. */
1444 proc_hand = OpenProcess (PROCESS_TERMINATE, 0, pid); 1465 proc_hand = OpenProcess (PROCESS_TERMINATE, 0, pid);
1445 if (proc_hand == NULL) 1466 if (proc_hand == NULL)
1446 { 1467 {
diff --git a/src/w32reg.c b/src/w32reg.c
index 8a6a3c853b1..8b6c76503a6 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -84,7 +84,7 @@ w32_get_string_resource (char *name, char *class, DWORD dwexptype)
84 84
85 trykey: 85 trykey:
86 86
87 BLOCK_INPUT; 87 block_input ();
88 88
89 /* Check both the current user and the local machine to see if we have 89 /* Check both the current user and the local machine to see if we have
90 any resources */ 90 any resources */
@@ -115,7 +115,7 @@ w32_get_string_resource (char *name, char *class, DWORD dwexptype)
115 RegCloseKey (hrootkey); 115 RegCloseKey (hrootkey);
116 } 116 }
117 117
118 UNBLOCK_INPUT; 118 unblock_input ();
119 119
120 if (!ok) 120 if (!ok)
121 { 121 {
diff --git a/src/w32select.c b/src/w32select.c
index 11c68c9c617..66f9f7ab041 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -391,7 +391,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg)
391 extern int waiting_for_input; /* from keyboard.c */ 391 extern int waiting_for_input; /* from keyboard.c */
392 int owfi; 392 int owfi;
393 393
394 BLOCK_INPUT; 394 block_input ();
395 395
396 /* Fsignal calls emacs_abort () if it sees that waiting_for_input is 396 /* Fsignal calls emacs_abort () if it sees that waiting_for_input is
397 set. */ 397 set. */
@@ -402,7 +402,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg)
402 402
403 waiting_for_input = owfi; 403 waiting_for_input = owfi;
404 404
405 UNBLOCK_INPUT; 405 unblock_input ();
406} 406}
407 407
408static Lisp_Object 408static Lisp_Object
@@ -474,7 +474,10 @@ term_w32select (void)
474{ 474{
475 /* This is needed to trigger WM_RENDERALLFORMATS. */ 475 /* This is needed to trigger WM_RENDERALLFORMATS. */
476 if (clipboard_owner != NULL) 476 if (clipboard_owner != NULL)
477 DestroyWindow (clipboard_owner); 477 {
478 DestroyWindow (clipboard_owner);
479 clipboard_owner = NULL;
480 }
478} 481}
479 482
480static void 483static void
@@ -694,7 +697,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
694 current_num_nls = 0; 697 current_num_nls = 0;
695 current_requires_encoding = 0; 698 current_requires_encoding = 0;
696 699
697 BLOCK_INPUT; 700 block_input ();
698 701
699 /* Check for non-ASCII characters. While we are at it, count the 702 /* Check for non-ASCII characters. While we are at it, count the
700 number of LFs, so we know how many CRs we will have to add later 703 number of LFs, so we know how many CRs we will have to add later
@@ -782,7 +785,7 @@ DEFUN ("w32-set-clipboard-data", Fw32_set_clipboard_data,
782 current_coding_system = Qnil; 785 current_coding_system = Qnil;
783 786
784 done: 787 done:
785 UNBLOCK_INPUT; 788 unblock_input ();
786 789
787 return (ok ? string : Qnil); 790 return (ok ? string : Qnil);
788} 791}
@@ -810,7 +813,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
810 setup_config (); 813 setup_config ();
811 actual_clipboard_type = cfg_clipboard_type; 814 actual_clipboard_type = cfg_clipboard_type;
812 815
813 BLOCK_INPUT; 816 block_input ();
814 817
815 if (!OpenClipboard (clipboard_owner)) 818 if (!OpenClipboard (clipboard_owner))
816 goto done; 819 goto done;
@@ -1000,7 +1003,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
1000 CloseClipboard (); 1003 CloseClipboard ();
1001 1004
1002 done: 1005 done:
1003 UNBLOCK_INPUT; 1006 unblock_input ();
1004 1007
1005 return (ret); 1008 return (ret);
1006} 1009}
diff --git a/src/w32term.c b/src/w32term.c
index b8227c52fed..5d5e572c475 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -197,7 +197,7 @@ static void w32_define_cursor (Window, Cursor);
197 197
198void x_lower_frame (struct frame *); 198void x_lower_frame (struct frame *);
199void x_scroll_bar_clear (struct frame *); 199void x_scroll_bar_clear (struct frame *);
200void x_wm_set_size_hint (struct frame *, long, int); 200void x_wm_set_size_hint (struct frame *, long, bool);
201void x_raise_frame (struct frame *); 201void x_raise_frame (struct frame *);
202void x_set_window_size (struct frame *, int, int, int); 202void x_set_window_size (struct frame *, int, int, int);
203void x_wm_set_window_state (struct frame *, int); 203void x_wm_set_window_state (struct frame *, int);
@@ -563,7 +563,7 @@ x_update_window_begin (struct window *w)
563 updated_window = w; 563 updated_window = w;
564 set_output_cursor (&w->cursor); 564 set_output_cursor (&w->cursor);
565 565
566 BLOCK_INPUT; 566 block_input ();
567 567
568 if (f == hlinfo->mouse_face_mouse_frame) 568 if (f == hlinfo->mouse_face_mouse_frame)
569 { 569 {
@@ -602,7 +602,7 @@ x_update_window_begin (struct window *w)
602#endif /* 0 */ 602#endif /* 0 */
603 } 603 }
604 604
605 UNBLOCK_INPUT; 605 unblock_input ();
606} 606}
607 607
608/* Draw a vertical window border from (x,y0) to (x,y1) */ 608/* Draw a vertical window border from (x,y0) to (x,y1) */
@@ -652,7 +652,7 @@ x_update_window_end (struct window *w, int cursor_on_p,
652 652
653 if (!w->pseudo_window_p) 653 if (!w->pseudo_window_p)
654 { 654 {
655 BLOCK_INPUT; 655 block_input ();
656 656
657 if (cursor_on_p) 657 if (cursor_on_p)
658 display_and_set_cursor (w, 1, output_cursor.hpos, 658 display_and_set_cursor (w, 1, output_cursor.hpos,
@@ -662,7 +662,7 @@ x_update_window_end (struct window *w, int cursor_on_p,
662 if (draw_window_fringes (w, 1)) 662 if (draw_window_fringes (w, 1))
663 x_draw_vertical_border (w); 663 x_draw_vertical_border (w);
664 664
665 UNBLOCK_INPUT; 665 unblock_input ();
666 } 666 }
667 667
668 /* If a row with mouse-face was overwritten, arrange for 668 /* If a row with mouse-face was overwritten, arrange for
@@ -714,13 +714,13 @@ w32_frame_up_to_date (struct frame *f)
714 if (hlinfo->mouse_face_deferred_gc 714 if (hlinfo->mouse_face_deferred_gc
715 || f == hlinfo->mouse_face_mouse_frame) 715 || f == hlinfo->mouse_face_mouse_frame)
716 { 716 {
717 BLOCK_INPUT; 717 block_input ();
718 if (hlinfo->mouse_face_mouse_frame) 718 if (hlinfo->mouse_face_mouse_frame)
719 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, 719 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
720 hlinfo->mouse_face_mouse_x, 720 hlinfo->mouse_face_mouse_x,
721 hlinfo->mouse_face_mouse_y); 721 hlinfo->mouse_face_mouse_y);
722 hlinfo->mouse_face_deferred_gc = 0; 722 hlinfo->mouse_face_deferred_gc = 0;
723 UNBLOCK_INPUT; 723 unblock_input ();
724 } 724 }
725 } 725 }
726} 726}
@@ -761,7 +761,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
761 { 761 {
762 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 762 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
763 763
764 BLOCK_INPUT; 764 block_input ();
765 { 765 {
766 HDC hdc = get_frame_dc (f); 766 HDC hdc = get_frame_dc (f);
767 w32_clear_area (f, hdc, 0, y, width, height); 767 w32_clear_area (f, hdc, 0, y, width, height);
@@ -769,7 +769,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
769 y, width, height); 769 y, width, height);
770 release_frame_dc (f, hdc); 770 release_frame_dc (f, hdc);
771 } 771 }
772 UNBLOCK_INPUT; 772 unblock_input ();
773 } 773 }
774} 774}
775 775
@@ -2646,7 +2646,7 @@ x_clear_frame (struct frame *f)
2646 2646
2647 /* We don't set the output cursor here because there will always 2647 /* We don't set the output cursor here because there will always
2648 follow an explicit cursor_to. */ 2648 follow an explicit cursor_to. */
2649 BLOCK_INPUT; 2649 block_input ();
2650 2650
2651 w32_clear_window (f); 2651 w32_clear_window (f);
2652 2652
@@ -2654,7 +2654,7 @@ x_clear_frame (struct frame *f)
2654 colors or something like that, then they should be notified. */ 2654 colors or something like that, then they should be notified. */
2655 x_scroll_bar_clear (f); 2655 x_scroll_bar_clear (f);
2656 2656
2657 UNBLOCK_INPUT; 2657 unblock_input ();
2658} 2658}
2659 2659
2660 2660
@@ -2663,7 +2663,7 @@ x_clear_frame (struct frame *f)
2663static void 2663static void
2664w32_ring_bell (struct frame *f) 2664w32_ring_bell (struct frame *f)
2665{ 2665{
2666 BLOCK_INPUT; 2666 block_input ();
2667 2667
2668 if (FRAME_W32_P (f) && visible_bell) 2668 if (FRAME_W32_P (f) && visible_bell)
2669 { 2669 {
@@ -2680,7 +2680,7 @@ w32_ring_bell (struct frame *f)
2680 else 2680 else
2681 w32_sys_ring_bell (f); 2681 w32_sys_ring_bell (f);
2682 2682
2683 UNBLOCK_INPUT; 2683 unblock_input ();
2684} 2684}
2685 2685
2686 2686
@@ -2779,7 +2779,7 @@ x_scroll_run (struct window *w, struct run *run)
2779 expect_dirty = CreateRectRgn (x, y, x + width, to_y); 2779 expect_dirty = CreateRectRgn (x, y, x + width, to_y);
2780 } 2780 }
2781 2781
2782 BLOCK_INPUT; 2782 block_input ();
2783 2783
2784 /* Cursor off. Will be switched on again in x_update_window_end. */ 2784 /* Cursor off. Will be switched on again in x_update_window_end. */
2785 updated_window = w; 2785 updated_window = w;
@@ -2813,7 +2813,7 @@ x_scroll_run (struct window *w, struct run *run)
2813 DeleteObject (combined); 2813 DeleteObject (combined);
2814 } 2814 }
2815 2815
2816 UNBLOCK_INPUT; 2816 unblock_input ();
2817 DeleteObject (expect_dirty); 2817 DeleteObject (expect_dirty);
2818} 2818}
2819 2819
@@ -2998,9 +2998,9 @@ x_get_keysym_name (int keysym)
2998 /* Make static so we can always return it */ 2998 /* Make static so we can always return it */
2999 static char value[100]; 2999 static char value[100];
3000 3000
3001 BLOCK_INPUT; 3001 block_input ();
3002 GetKeyNameText (keysym, value, 100); 3002 GetKeyNameText (keysym, value, 100);
3003 UNBLOCK_INPUT; 3003 unblock_input ();
3004 3004
3005 return value; 3005 return value;
3006} 3006}
@@ -3308,7 +3308,7 @@ w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
3308{ 3308{
3309 FRAME_PTR f1; 3309 FRAME_PTR f1;
3310 3310
3311 BLOCK_INPUT; 3311 block_input ();
3312 3312
3313 if (! NILP (last_mouse_scroll_bar) && insist == 0) 3313 if (! NILP (last_mouse_scroll_bar) && insist == 0)
3314 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); 3314 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time);
@@ -3382,7 +3382,7 @@ w32_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
3382 } 3382 }
3383 } 3383 }
3384 3384
3385 UNBLOCK_INPUT; 3385 unblock_input ();
3386} 3386}
3387 3387
3388 3388
@@ -3480,12 +3480,12 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar,
3480 if (draggingp) 3480 if (draggingp)
3481 { 3481 {
3482 int near_bottom_p; 3482 int near_bottom_p;
3483 BLOCK_INPUT; 3483 block_input ();
3484 si.cbSize = sizeof (si); 3484 si.cbSize = sizeof (si);
3485 si.fMask = SIF_POS | SIF_PAGE; 3485 si.fMask = SIF_POS | SIF_PAGE;
3486 GetScrollInfo (w, SB_CTL, &si); 3486 GetScrollInfo (w, SB_CTL, &si);
3487 near_bottom_p = si.nPos + si.nPage >= range; 3487 near_bottom_p = si.nPos + si.nPage >= range;
3488 UNBLOCK_INPUT; 3488 unblock_input ();
3489 if (!near_bottom_p) 3489 if (!near_bottom_p)
3490 return; 3490 return;
3491 } 3491 }
@@ -3514,7 +3514,7 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar,
3514 3514
3515 sb_page = max (sb_page, VERTICAL_SCROLL_BAR_MIN_HANDLE); 3515 sb_page = max (sb_page, VERTICAL_SCROLL_BAR_MIN_HANDLE);
3516 3516
3517 BLOCK_INPUT; 3517 block_input ();
3518 3518
3519 si.cbSize = sizeof (si); 3519 si.cbSize = sizeof (si);
3520 si.fMask = SIF_PAGE | SIF_POS; 3520 si.fMask = SIF_PAGE | SIF_POS;
@@ -3523,7 +3523,7 @@ w32_set_scroll_bar_thumb (struct scroll_bar *bar,
3523 3523
3524 SetScrollInfo (w, SB_CTL, &si, TRUE); 3524 SetScrollInfo (w, SB_CTL, &si, TRUE);
3525 3525
3526 UNBLOCK_INPUT; 3526 unblock_input ();
3527} 3527}
3528 3528
3529 3529
@@ -3614,7 +3614,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
3614 = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); 3614 = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil));
3615 Lisp_Object barobj; 3615 Lisp_Object barobj;
3616 3616
3617 BLOCK_INPUT; 3617 block_input ();
3618 3618
3619 XSETWINDOW (bar->window, w); 3619 XSETWINDOW (bar->window, w);
3620 XSETINT (bar->top, top); 3620 XSETINT (bar->top, top);
@@ -3650,7 +3650,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
3650 if (! NILP (bar->next)) 3650 if (! NILP (bar->next))
3651 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); 3651 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
3652 3652
3653 UNBLOCK_INPUT; 3653 unblock_input ();
3654 3654
3655 return bar; 3655 return bar;
3656} 3656}
@@ -3664,7 +3664,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
3664{ 3664{
3665 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 3665 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
3666 3666
3667 BLOCK_INPUT; 3667 block_input ();
3668 3668
3669 /* Destroy the window. */ 3669 /* Destroy the window. */
3670 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); 3670 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar));
@@ -3672,7 +3672,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
3672 /* Dissociate this scroll bar from its window. */ 3672 /* Dissociate this scroll bar from its window. */
3673 wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); 3673 wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil);
3674 3674
3675 UNBLOCK_INPUT; 3675 unblock_input ();
3676} 3676}
3677 3677
3678/* Set the handle of the vertical scroll bar for WINDOW to indicate 3678/* Set the handle of the vertical scroll bar for WINDOW to indicate
@@ -3727,7 +3727,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3727 if (NILP (w->vertical_scroll_bar)) 3727 if (NILP (w->vertical_scroll_bar))
3728 { 3728 {
3729 HDC hdc; 3729 HDC hdc;
3730 BLOCK_INPUT; 3730 block_input ();
3731 if (width > 0 && height > 0) 3731 if (width > 0 && height > 0)
3732 { 3732 {
3733 hdc = get_frame_dc (f); 3733 hdc = get_frame_dc (f);
@@ -3737,7 +3737,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3737 w32_clear_area (f, hdc, left, top, width, height); 3737 w32_clear_area (f, hdc, left, top, width, height);
3738 release_frame_dc (f, hdc); 3738 release_frame_dc (f, hdc);
3739 } 3739 }
3740 UNBLOCK_INPUT; 3740 unblock_input ();
3741 3741
3742 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); 3742 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height);
3743 } 3743 }
@@ -3765,7 +3765,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3765 HDC hdc; 3765 HDC hdc;
3766 SCROLLINFO si; 3766 SCROLLINFO si;
3767 3767
3768 BLOCK_INPUT; 3768 block_input ();
3769 if (width && height) 3769 if (width && height)
3770 { 3770 {
3771 hdc = get_frame_dc (f); 3771 hdc = get_frame_dc (f);
@@ -3801,7 +3801,7 @@ w32_set_vertical_scroll_bar (struct window *w,
3801 XSETINT (bar->width, sb_width); 3801 XSETINT (bar->width, sb_width);
3802 XSETINT (bar->height, height); 3802 XSETINT (bar->height, height);
3803 3803
3804 UNBLOCK_INPUT; 3804 unblock_input ();
3805 } 3805 }
3806 } 3806 }
3807 bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; 3807 bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
@@ -4043,7 +4043,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
4043 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); 4043 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height));
4044 SCROLLINFO si; 4044 SCROLLINFO si;
4045 4045
4046 BLOCK_INPUT; 4046 block_input ();
4047 4047
4048 *fp = f; 4048 *fp = f;
4049 *bar_window = bar->window; 4049 *bar_window = bar->window;
@@ -4080,7 +4080,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
4080 4080
4081 *time = last_mouse_movement_time; 4081 *time = last_mouse_movement_time;
4082 4082
4083 UNBLOCK_INPUT; 4083 unblock_input ();
4084} 4084}
4085 4085
4086 4086
@@ -4157,15 +4157,7 @@ w32_read_socket (struct terminal *terminal,
4157 struct w32_display_info *dpyinfo = &one_w32_display_info; 4157 struct w32_display_info *dpyinfo = &one_w32_display_info;
4158 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; 4158 Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
4159 4159
4160 if (interrupt_input_blocked) 4160 block_input ();
4161 {
4162 interrupt_input_pending = 1;
4163 pending_signals = 1;
4164 return -1;
4165 }
4166
4167 interrupt_input_pending = 0;
4168 BLOCK_INPUT;
4169 4161
4170 /* So people can tell when we have read the available input. */ 4162 /* So people can tell when we have read the available input. */
4171 input_signal_count++; 4163 input_signal_count++;
@@ -4961,7 +4953,7 @@ w32_read_socket (struct terminal *terminal,
4961 } 4953 }
4962 } 4954 }
4963 4955
4964 UNBLOCK_INPUT; 4956 unblock_input ();
4965 return count; 4957 return count;
4966} 4958}
4967 4959
@@ -5476,7 +5468,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff,
5476 } 5468 }
5477 x_calc_absolute_position (f); 5469 x_calc_absolute_position (f);
5478 5470
5479 BLOCK_INPUT; 5471 block_input ();
5480 x_wm_set_size_hint (f, (long) 0, 0); 5472 x_wm_set_size_hint (f, (long) 0, 0);
5481 5473
5482 modified_left = f->left_pos; 5474 modified_left = f->left_pos;
@@ -5487,7 +5479,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff,
5487 modified_left, modified_top, 5479 modified_left, modified_top,
5488 0, 0, 5480 0, 0,
5489 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); 5481 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
5490 UNBLOCK_INPUT; 5482 unblock_input ();
5491} 5483}
5492 5484
5493 5485
@@ -5528,7 +5520,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
5528{ 5520{
5529 int pixelwidth, pixelheight; 5521 int pixelwidth, pixelheight;
5530 5522
5531 BLOCK_INPUT; 5523 block_input ();
5532 5524
5533 check_frame_size (f, &rows, &cols); 5525 check_frame_size (f, &rows, &cols);
5534 f->scroll_bar_actual_width 5526 f->scroll_bar_actual_width
@@ -5608,7 +5600,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
5608 cancel_mouse_face (f); 5600 cancel_mouse_face (f);
5609#endif 5601#endif
5610 5602
5611 UNBLOCK_INPUT; 5603 unblock_input ();
5612} 5604}
5613 5605
5614/* Mouse warping. */ 5606/* Mouse warping. */
@@ -5638,7 +5630,7 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
5638 RECT rect; 5630 RECT rect;
5639 POINT pt; 5631 POINT pt;
5640 5632
5641 BLOCK_INPUT; 5633 block_input ();
5642 5634
5643 GetClientRect (FRAME_W32_WINDOW (f), &rect); 5635 GetClientRect (FRAME_W32_WINDOW (f), &rect);
5644 pt.x = rect.left + pix_x; 5636 pt.x = rect.left + pix_x;
@@ -5647,7 +5639,7 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
5647 5639
5648 SetCursorPos (pt.x, pt.y); 5640 SetCursorPos (pt.x, pt.y);
5649 5641
5650 UNBLOCK_INPUT; 5642 unblock_input ();
5651} 5643}
5652 5644
5653 5645
@@ -5659,7 +5651,7 @@ x_focus_on_frame (struct frame *f)
5659 struct w32_display_info *dpyinfo = &one_w32_display_info; 5651 struct w32_display_info *dpyinfo = &one_w32_display_info;
5660 5652
5661 /* Give input focus to frame. */ 5653 /* Give input focus to frame. */
5662 BLOCK_INPUT; 5654 block_input ();
5663#if 0 5655#if 0
5664 /* Try not to change its Z-order if possible. */ 5656 /* Try not to change its Z-order if possible. */
5665 if (x_window_to_frame (dpyinfo, GetForegroundWindow ())) 5657 if (x_window_to_frame (dpyinfo, GetForegroundWindow ()))
@@ -5667,7 +5659,7 @@ x_focus_on_frame (struct frame *f)
5667 else 5659 else
5668#endif 5660#endif
5669 my_set_foreground_window (FRAME_W32_WINDOW (f)); 5661 my_set_foreground_window (FRAME_W32_WINDOW (f));
5670 UNBLOCK_INPUT; 5662 unblock_input ();
5671} 5663}
5672 5664
5673void 5665void
@@ -5679,7 +5671,7 @@ x_unfocus_frame (struct frame *f)
5679void 5671void
5680x_raise_frame (struct frame *f) 5672x_raise_frame (struct frame *f)
5681{ 5673{
5682 BLOCK_INPUT; 5674 block_input ();
5683 5675
5684 /* Strictly speaking, raise-frame should only change the frame's Z 5676 /* Strictly speaking, raise-frame should only change the frame's Z
5685 order, leaving input focus unchanged. This is reasonable behavior 5677 order, leaving input focus unchanged. This is reasonable behavior
@@ -5734,19 +5726,19 @@ x_raise_frame (struct frame *f)
5734 my_bring_window_to_top (FRAME_W32_WINDOW (f)); 5726 my_bring_window_to_top (FRAME_W32_WINDOW (f));
5735 } 5727 }
5736 5728
5737 UNBLOCK_INPUT; 5729 unblock_input ();
5738} 5730}
5739 5731
5740/* Lower frame F. */ 5732/* Lower frame F. */
5741void 5733void
5742x_lower_frame (struct frame *f) 5734x_lower_frame (struct frame *f)
5743{ 5735{
5744 BLOCK_INPUT; 5736 block_input ();
5745 my_set_window_pos (FRAME_W32_WINDOW (f), 5737 my_set_window_pos (FRAME_W32_WINDOW (f),
5746 HWND_BOTTOM, 5738 HWND_BOTTOM,
5747 0, 0, 0, 0, 5739 0, 0, 0, 0,
5748 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); 5740 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
5749 UNBLOCK_INPUT; 5741 unblock_input ();
5750} 5742}
5751 5743
5752static void 5744static void
@@ -5775,7 +5767,7 @@ x_make_frame_visible (struct frame *f)
5775{ 5767{
5776 Lisp_Object type; 5768 Lisp_Object type;
5777 5769
5778 BLOCK_INPUT; 5770 block_input ();
5779 5771
5780 type = x_icon_type (f); 5772 type = x_icon_type (f);
5781 if (!NILP (type)) 5773 if (!NILP (type))
@@ -5827,7 +5819,7 @@ x_make_frame_visible (struct frame *f)
5827 int count; 5819 int count;
5828 5820
5829 /* This must come after we set COUNT. */ 5821 /* This must come after we set COUNT. */
5830 UNBLOCK_INPUT; 5822 unblock_input ();
5831 5823
5832 XSETFRAME (frame, f); 5824 XSETFRAME (frame, f);
5833 5825
@@ -5870,7 +5862,7 @@ x_make_frame_invisible (struct frame *f)
5870 if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) 5862 if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f)
5871 FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; 5863 FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0;
5872 5864
5873 BLOCK_INPUT; 5865 block_input ();
5874 5866
5875 my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE); 5867 my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE);
5876 5868
@@ -5884,7 +5876,7 @@ x_make_frame_invisible (struct frame *f)
5884 f->async_visible = 0; 5876 f->async_visible = 0;
5885 f->async_iconified = 0; 5877 f->async_iconified = 0;
5886 5878
5887 UNBLOCK_INPUT; 5879 unblock_input ();
5888} 5880}
5889 5881
5890/* Change window state from mapped to iconified. */ 5882/* Change window state from mapped to iconified. */
@@ -5901,7 +5893,7 @@ x_iconify_frame (struct frame *f)
5901 if (f->async_iconified) 5893 if (f->async_iconified)
5902 return; 5894 return;
5903 5895
5904 BLOCK_INPUT; 5896 block_input ();
5905 5897
5906 type = x_icon_type (f); 5898 type = x_icon_type (f);
5907 if (!NILP (type)) 5899 if (!NILP (type))
@@ -5910,7 +5902,7 @@ x_iconify_frame (struct frame *f)
5910 /* Simulate the user minimizing the frame. */ 5902 /* Simulate the user minimizing the frame. */
5911 SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); 5903 SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0);
5912 5904
5913 UNBLOCK_INPUT; 5905 unblock_input ();
5914} 5906}
5915 5907
5916 5908
@@ -5922,7 +5914,7 @@ x_free_frame_resources (struct frame *f)
5922 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 5914 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
5923 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 5915 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
5924 5916
5925 BLOCK_INPUT; 5917 block_input ();
5926 5918
5927 /* We must free faces before destroying windows because some 5919 /* We must free faces before destroying windows because some
5928 font-driver (e.g. xft) access a window while finishing a 5920 font-driver (e.g. xft) access a window while finishing a
@@ -5970,7 +5962,7 @@ x_free_frame_resources (struct frame *f)
5970 hlinfo->mouse_face_mouse_frame = 0; 5962 hlinfo->mouse_face_mouse_frame = 0;
5971 } 5963 }
5972 5964
5973 UNBLOCK_INPUT; 5965 unblock_input ();
5974} 5966}
5975 5967
5976 5968
@@ -5990,10 +5982,10 @@ x_destroy_window (struct frame *f)
5990/* Set the normal size hints for the window manager, for frame F. 5982/* Set the normal size hints for the window manager, for frame F.
5991 FLAGS is the flags word to use--or 0 meaning preserve the flags 5983 FLAGS is the flags word to use--or 0 meaning preserve the flags
5992 that the window now has. 5984 that the window now has.
5993 If USER_POSITION is nonzero, we set the USPosition 5985 If USER_POSITION, set the USPosition
5994 flag (this is useful when FLAGS is 0). */ 5986 flag (this is useful when FLAGS is 0). */
5995void 5987void
5996x_wm_set_size_hint (struct frame *f, long flags, int user_position) 5988x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
5997{ 5989{
5998 Window window = FRAME_W32_WINDOW (f); 5990 Window window = FRAME_W32_WINDOW (f);
5999 5991
@@ -6254,10 +6246,10 @@ x_delete_terminal (struct terminal *terminal)
6254 if (!terminal->name) 6246 if (!terminal->name)
6255 return; 6247 return;
6256 6248
6257 BLOCK_INPUT; 6249 block_input ();
6258 6250
6259 x_delete_display (dpyinfo); 6251 x_delete_display (dpyinfo);
6260 UNBLOCK_INPUT; 6252 unblock_input ();
6261} 6253}
6262 6254
6263struct w32_display_info * 6255struct w32_display_info *
@@ -6267,7 +6259,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
6267 struct terminal *terminal; 6259 struct terminal *terminal;
6268 HDC hdc; 6260 HDC hdc;
6269 6261
6270 BLOCK_INPUT; 6262 block_input ();
6271 6263
6272 if (!w32_initialized) 6264 if (!w32_initialized)
6273 { 6265 {
@@ -6329,7 +6321,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
6329 init_sigio (connection); 6321 init_sigio (connection);
6330#endif /* ! defined (SIGIO) */ 6322#endif /* ! defined (SIGIO) */
6331 6323
6332 UNBLOCK_INPUT; 6324 unblock_input ();
6333 6325
6334 return dpyinfo; 6326 return dpyinfo;
6335} 6327}
diff --git a/src/widget.c b/src/widget.c
index fd5ad167125..1f472c6231c 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -677,13 +677,13 @@ EmacsFrameDestroy (Widget widget)
677 if (! s) emacs_abort (); 677 if (! s) emacs_abort ();
678 if (! s->output_data.x) emacs_abort (); 678 if (! s->output_data.x) emacs_abort ();
679 679
680 BLOCK_INPUT; 680 block_input ();
681 x_free_gcs (s); 681 x_free_gcs (s);
682 if (s->output_data.x->white_relief.gc) 682 if (s->output_data.x->white_relief.gc)
683 XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc); 683 XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc);
684 if (s->output_data.x->black_relief.gc) 684 if (s->output_data.x->black_relief.gc)
685 XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc); 685 XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc);
686 UNBLOCK_INPUT; 686 unblock_input ();
687} 687}
688 688
689static void 689static void
diff --git a/src/window.c b/src/window.c
index 6798be8231c..bb3b73f9acd 100644
--- a/src/window.c
+++ b/src/window.c
@@ -60,7 +60,7 @@ static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
60static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; 60static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
61static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; 61static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically;
62static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; 62static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
63static Lisp_Object Qsafe, Qabove, Qbelow, Qtemp_buffer_resize, Qclone_of; 63static Lisp_Object Qsafe, Qabove, Qbelow, Qwindow_size, Qclone_of;
64 64
65static int displayed_window_lines (struct window *); 65static int displayed_window_lines (struct window *);
66static int count_windows (struct window *); 66static int count_windows (struct window *);
@@ -2819,7 +2819,7 @@ window-start value is reasonable when this function is called. */)
2819 } 2819 }
2820 } 2820 }
2821 2821
2822 BLOCK_INPUT; 2822 block_input ();
2823 if (!FRAME_INITIAL_P (f)) 2823 if (!FRAME_INITIAL_P (f))
2824 { 2824 {
2825 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 2825 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
@@ -2961,7 +2961,7 @@ window-start value is reasonable when this function is called. */)
2961 } 2961 }
2962 2962
2963 adjust_glyphs (f); 2963 adjust_glyphs (f);
2964 UNBLOCK_INPUT; 2964 unblock_input ();
2965 2965
2966 run_window_configuration_change_hook (f); 2966 run_window_configuration_change_hook (f);
2967 2967
@@ -3696,14 +3696,14 @@ be applied on the Elisp level. */)
3696 (horflag ? r->total_cols : r->total_lines))) 3696 (horflag ? r->total_cols : r->total_lines)))
3697 return Qnil; 3697 return Qnil;
3698 3698
3699 BLOCK_INPUT; 3699 block_input ();
3700 window_resize_apply (r, horflag); 3700 window_resize_apply (r, horflag);
3701 3701
3702 windows_or_buffers_changed++; 3702 windows_or_buffers_changed++;
3703 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3703 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3704 3704
3705 adjust_glyphs (f); 3705 adjust_glyphs (f);
3706 UNBLOCK_INPUT; 3706 unblock_input ();
3707 3707
3708 run_window_configuration_change_hook (f); 3708 run_window_configuration_change_hook (f);
3709 3709
@@ -3973,13 +3973,13 @@ set correctly. See the code of `split-window' for how this is done. */)
3973 wset_new_total (n, total_size); 3973 wset_new_total (n, total_size);
3974 wset_new_normal (n, normal_size); 3974 wset_new_normal (n, normal_size);
3975 3975
3976 BLOCK_INPUT; 3976 block_input ();
3977 window_resize_apply (p, horflag); 3977 window_resize_apply (p, horflag);
3978 adjust_glyphs (f); 3978 adjust_glyphs (f);
3979 /* Set buffer of NEW to buffer of reference window. Don't run 3979 /* Set buffer of NEW to buffer of reference window. Don't run
3980 any hooks. */ 3980 any hooks. */
3981 set_window_buffer (new, r->buffer, 0, 1); 3981 set_window_buffer (new, r->buffer, 0, 1);
3982 UNBLOCK_INPUT; 3982 unblock_input ();
3983 3983
3984 /* Maybe we should run the scroll functions in Elisp (which already 3984 /* Maybe we should run the scroll functions in Elisp (which already
3985 runs the configuration change hook). */ 3985 runs the configuration change hook). */
@@ -4060,7 +4060,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4060 { 4060 {
4061 4061
4062 /* Block input. */ 4062 /* Block input. */
4063 BLOCK_INPUT; 4063 block_input ();
4064 window_resize_apply (p, horflag); 4064 window_resize_apply (p, horflag);
4065 4065
4066 /* If this window is referred to by the dpyinfo's mouse 4066 /* If this window is referred to by the dpyinfo's mouse
@@ -4132,7 +4132,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4132 else 4132 else
4133 fset_selected_window (f, new_selected_window); 4133 fset_selected_window (f, new_selected_window);
4134 4134
4135 UNBLOCK_INPUT; 4135 unblock_input ();
4136 4136
4137 /* Now look whether `get-mru-window' gets us something. */ 4137 /* Now look whether `get-mru-window' gets us something. */
4138 mru_window = call1 (Qget_mru_window, frame); 4138 mru_window = call1 (Qget_mru_window, frame);
@@ -4147,7 +4147,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4147 fset_selected_window (f, new_selected_window); 4147 fset_selected_window (f, new_selected_window);
4148 } 4148 }
4149 else 4149 else
4150 UNBLOCK_INPUT; 4150 unblock_input ();
4151 4151
4152 /* Must be run by the caller: 4152 /* Must be run by the caller:
4153 run_window_configuration_change_hook (f); */ 4153 run_window_configuration_change_hook (f); */
@@ -4197,7 +4197,7 @@ grow_mini_window (struct window *w, int delta)
4197 root, make_number (- delta)); 4197 root, make_number (- delta));
4198 if (INTEGERP (value) && window_resize_check (r, 0)) 4198 if (INTEGERP (value) && window_resize_check (r, 0))
4199 { 4199 {
4200 BLOCK_INPUT; 4200 block_input ();
4201 window_resize_apply (r, 0); 4201 window_resize_apply (r, 0);
4202 4202
4203 /* Grow the mini-window. */ 4203 /* Grow the mini-window. */
@@ -4209,7 +4209,7 @@ grow_mini_window (struct window *w, int delta)
4209 w->last_overlay_modified = 0; 4209 w->last_overlay_modified = 0;
4210 4210
4211 adjust_glyphs (f); 4211 adjust_glyphs (f);
4212 UNBLOCK_INPUT; 4212 unblock_input ();
4213 } 4213 }
4214} 4214}
4215 4215
@@ -4234,7 +4234,7 @@ shrink_mini_window (struct window *w)
4234 root, make_number (size - 1)); 4234 root, make_number (size - 1));
4235 if (INTEGERP (value) && window_resize_check (r, 0)) 4235 if (INTEGERP (value) && window_resize_check (r, 0))
4236 { 4236 {
4237 BLOCK_INPUT; 4237 block_input ();
4238 window_resize_apply (r, 0); 4238 window_resize_apply (r, 0);
4239 4239
4240 /* Shrink the mini-window. */ 4240 /* Shrink the mini-window. */
@@ -4246,7 +4246,7 @@ shrink_mini_window (struct window *w)
4246 w->last_overlay_modified = 0; 4246 w->last_overlay_modified = 0;
4247 4247
4248 adjust_glyphs (f); 4248 adjust_glyphs (f);
4249 UNBLOCK_INPUT; 4249 unblock_input ();
4250 } 4250 }
4251 /* If the above failed for whatever strange reason we must make a 4251 /* If the above failed for whatever strange reason we must make a
4252 one window frame here. The same routine will be needed when 4252 one window frame here. The same routine will be needed when
@@ -4278,7 +4278,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4278 && XINT (w->new_total) > 0 4278 && XINT (w->new_total) > 0
4279 && height == XINT (r->new_total) + XINT (w->new_total)) 4279 && height == XINT (r->new_total) + XINT (w->new_total))
4280 { 4280 {
4281 BLOCK_INPUT; 4281 block_input ();
4282 window_resize_apply (r, 0); 4282 window_resize_apply (r, 0);
4283 4283
4284 wset_total_lines (w, w->new_total); 4284 wset_total_lines (w, w->new_total);
@@ -4288,7 +4288,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4288 windows_or_buffers_changed++; 4288 windows_or_buffers_changed++;
4289 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4289 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
4290 adjust_glyphs (f); 4290 adjust_glyphs (f);
4291 UNBLOCK_INPUT; 4291 unblock_input ();
4292 4292
4293 run_window_configuration_change_hook (f); 4293 run_window_configuration_change_hook (f);
4294 return Qt; 4294 return Qt;
@@ -5624,7 +5624,7 @@ the return value is nil. Otherwise the value is t. */)
5624 5624
5625 /* The mouse highlighting code could get screwed up 5625 /* The mouse highlighting code could get screwed up
5626 if it runs during this. */ 5626 if it runs during this. */
5627 BLOCK_INPUT; 5627 block_input ();
5628 5628
5629 if (data->frame_lines != previous_frame_lines 5629 if (data->frame_lines != previous_frame_lines
5630 || data->frame_cols != previous_frame_cols) 5630 || data->frame_cols != previous_frame_cols)
@@ -5875,7 +5875,7 @@ the return value is nil. Otherwise the value is t. */)
5875 } 5875 }
5876 5876
5877 adjust_glyphs (f); 5877 adjust_glyphs (f);
5878 UNBLOCK_INPUT; 5878 unblock_input ();
5879 5879
5880 /* Scan dead buffer windows. */ 5880 /* Scan dead buffer windows. */
5881 for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows)) 5881 for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows))
@@ -6704,7 +6704,7 @@ syms_of_window (void)
6704 DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows"); 6704 DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows");
6705 DEFSYM (Qrecord_window_buffer, "record-window-buffer"); 6705 DEFSYM (Qrecord_window_buffer, "record-window-buffer");
6706 DEFSYM (Qget_mru_window, "get-mru-window"); 6706 DEFSYM (Qget_mru_window, "get-mru-window");
6707 DEFSYM (Qtemp_buffer_resize, "temp-buffer-resize"); 6707 DEFSYM (Qwindow_size, "window-size");
6708 DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook"); 6708 DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook");
6709 DEFSYM (Qabove, "above"); 6709 DEFSYM (Qabove, "above");
6710 DEFSYM (Qbelow, "below"); 6710 DEFSYM (Qbelow, "below");
@@ -6804,19 +6804,19 @@ This variable takes no effect if `window-combination-limit' is non-nil. */);
6804The following values are recognized: 6804The following values are recognized:
6805 6805
6806nil means splitting a window will create a new parent window only if the 6806nil means splitting a window will create a new parent window only if the
6807 window has no parent window or the window shall become a combination 6807 window has no parent window or the window shall become part of a
6808 orthogonal to the one it is part of. 6808 combination orthogonal to the one it is part of.
6809 6809
6810`temp-buffer-resize' means that splitting a window for displaying a 6810`window-size' means that splitting a window for displaying a buffer
6811 temporary buffer makes a new parent window provided 6811 makes a new parent window provided `display-buffer' is supposed to
6812 `temp-buffer-resize-mode' is enabled. Otherwise, this value is 6812 explicitly set the window's size due to the presence of a
6813 handled like nil. 6813 `window-height' or `window-width' entry in the alist used by
6814 `display-buffer'. Otherwise, this value is handled like nil.
6814 6815
6815`temp-buffer' means that splitting a window for displaying a temporary 6816`temp-buffer' means that splitting a window for displaying a temporary
6816 buffer always makes a new parent window. Otherwise, this value is 6817 buffer always makes a new parent window. Otherwise, this value is
6817 handled like nil. 6818 handled like nil.
6818 6819
6819
6820`display-buffer' means that splitting a window for displaying a buffer 6820`display-buffer' means that splitting a window for displaying a buffer
6821 always makes a new parent window. Since temporary buffers are 6821 always makes a new parent window. Since temporary buffers are
6822 displayed by the function `display-buffer', this value is stronger 6822 displayed by the function `display-buffer', this value is stronger
@@ -6829,7 +6829,7 @@ t means that splitting a window always creates a new parent window. If
6829 sibling. 6829 sibling.
6830 6830
6831Other values are reserved for future use. */); 6831Other values are reserved for future use. */);
6832 Vwindow_combination_limit = Qtemp_buffer_resize; 6832 Vwindow_combination_limit = Qwindow_size;
6833 6833
6834 DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters, 6834 DEFVAR_LISP ("window-persistent-parameters", Vwindow_persistent_parameters,
6835 doc: /* Alist of persistent window parameters. 6835 doc: /* Alist of persistent window parameters.
diff --git a/src/xdisp.c b/src/xdisp.c
index c2032696a1c..b23a06ff3d1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -275,6 +275,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
275#include <limits.h> 275#include <limits.h>
276 276
277#include "lisp.h" 277#include "lisp.h"
278#include "atimer.h"
278#include "keyboard.h" 279#include "keyboard.h"
279#include "frame.h" 280#include "frame.h"
280#include "window.h" 281#include "window.h"
@@ -332,10 +333,10 @@ static Lisp_Object Qinhibit_eval_during_redisplay;
332static Lisp_Object Qbuffer_position, Qposition, Qobject; 333static Lisp_Object Qbuffer_position, Qposition, Qobject;
333static Lisp_Object Qright_to_left, Qleft_to_right; 334static Lisp_Object Qright_to_left, Qleft_to_right;
334 335
335/* Cursor shapes */ 336/* Cursor shapes. */
336Lisp_Object Qbar, Qhbar, Qbox, Qhollow; 337Lisp_Object Qbar, Qhbar, Qbox, Qhollow;
337 338
338/* Pointer shapes */ 339/* Pointer shapes. */
339static Lisp_Object Qarrow, Qhand; 340static Lisp_Object Qarrow, Qhand;
340Lisp_Object Qtext; 341Lisp_Object Qtext;
341 342
@@ -346,6 +347,7 @@ static Lisp_Object Qfontification_functions;
346 347
347static Lisp_Object Qwrap_prefix; 348static Lisp_Object Qwrap_prefix;
348static Lisp_Object Qline_prefix; 349static Lisp_Object Qline_prefix;
350static Lisp_Object Qredisplay_internal;
349 351
350/* Non-nil means don't actually do any redisplay. */ 352/* Non-nil means don't actually do any redisplay. */
351 353
@@ -11402,11 +11404,11 @@ x_cursor_to (int vpos, int hpos, int y, int x)
11402 This will also set the cursor position of W. */ 11404 This will also set the cursor position of W. */
11403 if (updated_window == NULL) 11405 if (updated_window == NULL)
11404 { 11406 {
11405 BLOCK_INPUT; 11407 block_input ();
11406 display_and_set_cursor (w, 1, hpos, vpos, x, y); 11408 display_and_set_cursor (w, 1, hpos, vpos, x, y);
11407 if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional) 11409 if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional)
11408 FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ()); 11410 FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ());
11409 UNBLOCK_INPUT; 11411 unblock_input ();
11410 } 11412 }
11411} 11413}
11412 11414
@@ -11520,11 +11522,11 @@ update_tool_bar (struct frame *f, int save_match_data)
11520 /* Redisplay that happens asynchronously due to an expose event 11522 /* Redisplay that happens asynchronously due to an expose event
11521 may access f->tool_bar_items. Make sure we update both 11523 may access f->tool_bar_items. Make sure we update both
11522 variables within BLOCK_INPUT so no such event interrupts. */ 11524 variables within BLOCK_INPUT so no such event interrupts. */
11523 BLOCK_INPUT; 11525 block_input ();
11524 fset_tool_bar_items (f, new_tool_bar); 11526 fset_tool_bar_items (f, new_tool_bar);
11525 f->n_tool_bar_items = new_n_tool_bar; 11527 f->n_tool_bar_items = new_n_tool_bar;
11526 w->update_mode_line = 1; 11528 w->update_mode_line = 1;
11527 UNBLOCK_INPUT; 11529 unblock_input ();
11528 } 11530 }
11529 11531
11530 UNGCPRO; 11532 UNGCPRO;
@@ -12928,12 +12930,13 @@ redisplay_internal (void)
12928 struct frame *sf; 12930 struct frame *sf;
12929 int polling_stopped_here = 0; 12931 int polling_stopped_here = 0;
12930 Lisp_Object old_frame = selected_frame; 12932 Lisp_Object old_frame = selected_frame;
12933 struct backtrace backtrace;
12931 12934
12932 /* Non-zero means redisplay has to consider all windows on all 12935 /* Non-zero means redisplay has to consider all windows on all
12933 frames. Zero means, only selected_window is considered. */ 12936 frames. Zero means, only selected_window is considered. */
12934 int consider_all_windows_p; 12937 int consider_all_windows_p;
12935 12938
12936 /* Non-zero means redisplay has to redisplay the miniwindow */ 12939 /* Non-zero means redisplay has to redisplay the miniwindow. */
12937 int update_miniwindow_p = 0; 12940 int update_miniwindow_p = 0;
12938 12941
12939 TRACE ((stderr, "redisplay_internal %d\n", redisplaying_p)); 12942 TRACE ((stderr, "redisplay_internal %d\n", redisplaying_p));
@@ -12970,6 +12973,14 @@ redisplay_internal (void)
12970 redisplaying_p = 1; 12973 redisplaying_p = 1;
12971 specbind (Qinhibit_free_realized_faces, Qnil); 12974 specbind (Qinhibit_free_realized_faces, Qnil);
12972 12975
12976 /* Record this function, so it appears on the profiler's backtraces. */
12977 backtrace.next = backtrace_list;
12978 backtrace.function = Qredisplay_internal;
12979 backtrace.args = &Qnil;
12980 backtrace.nargs = 0;
12981 backtrace.debug_on_exit = 0;
12982 backtrace_list = &backtrace;
12983
12973 { 12984 {
12974 Lisp_Object tail, frame; 12985 Lisp_Object tail, frame;
12975 12986
@@ -13667,6 +13678,7 @@ redisplay_internal (void)
13667#endif /* HAVE_WINDOW_SYSTEM */ 13678#endif /* HAVE_WINDOW_SYSTEM */
13668 13679
13669 end_of_redisplay: 13680 end_of_redisplay:
13681 backtrace_list = backtrace.next;
13670 unbind_to (count, Qnil); 13682 unbind_to (count, Qnil);
13671 RESUME_POLLING; 13683 RESUME_POLLING;
13672} 13684}
@@ -16205,10 +16217,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16205 || w->pseudo_window_p))) 16217 || w->pseudo_window_p)))
16206 { 16218 {
16207 update_begin (f); 16219 update_begin (f);
16208 BLOCK_INPUT; 16220 block_input ();
16209 if (draw_window_fringes (w, 1)) 16221 if (draw_window_fringes (w, 1))
16210 x_draw_vertical_border (w); 16222 x_draw_vertical_border (w);
16211 UNBLOCK_INPUT; 16223 unblock_input ();
16212 update_end (f); 16224 update_end (f);
16213 } 16225 }
16214#endif /* HAVE_WINDOW_SYSTEM */ 16226#endif /* HAVE_WINDOW_SYSTEM */
@@ -20161,10 +20173,6 @@ display_menu_bar (struct window *w)
20161 this. */ 20173 this. */
20162 it.paragraph_embedding = L2R; 20174 it.paragraph_embedding = L2R;
20163 20175
20164 if (! mode_line_inverse_video)
20165 /* Force the menu-bar to be displayed in the default face. */
20166 it.base_face_id = it.face_id = DEFAULT_FACE_ID;
20167
20168 /* Clear all rows of the menu bar. */ 20176 /* Clear all rows of the menu bar. */
20169 for (i = 0; i < FRAME_MENU_BAR_LINES (f); ++i) 20177 for (i = 0; i < FRAME_MENU_BAR_LINES (f); ++i)
20170 { 20178 {
@@ -20334,10 +20342,6 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
20334 20342
20335 it.glyph_row->mode_line_p = 1; 20343 it.glyph_row->mode_line_p = 1;
20336 20344
20337 if (! mode_line_inverse_video)
20338 /* Force the mode-line to be displayed in the default face. */
20339 it.base_face_id = it.face_id = DEFAULT_FACE_ID;
20340
20341 /* FIXME: This should be controlled by a user option. But 20345 /* FIXME: This should be controlled by a user option. But
20342 supporting such an option is not trivial, since the mode line is 20346 supporting such an option is not trivial, since the mode line is
20343 made up of many separate strings. */ 20347 made up of many separate strings. */
@@ -25327,7 +25331,7 @@ x_write_glyphs (struct glyph *start, int len)
25327 if (updated_row->reversed_p && chpos >= updated_row->used[TEXT_AREA]) 25331 if (updated_row->reversed_p && chpos >= updated_row->used[TEXT_AREA])
25328 chpos = updated_row->used[TEXT_AREA] - 1; 25332 chpos = updated_row->used[TEXT_AREA] - 1;
25329 25333
25330 BLOCK_INPUT; 25334 block_input ();
25331 25335
25332 /* Write glyphs. */ 25336 /* Write glyphs. */
25333 25337
@@ -25345,7 +25349,7 @@ x_write_glyphs (struct glyph *start, int len)
25345 && chpos < hpos + len) 25349 && chpos < hpos + len)
25346 updated_window->phys_cursor_on_p = 0; 25350 updated_window->phys_cursor_on_p = 0;
25347 25351
25348 UNBLOCK_INPUT; 25352 unblock_input ();
25349 25353
25350 /* Advance the output cursor. */ 25354 /* Advance the output cursor. */
25351 output_cursor.hpos += len; 25355 output_cursor.hpos += len;
@@ -25368,7 +25372,7 @@ x_insert_glyphs (struct glyph *start, int len)
25368 ptrdiff_t hpos; 25372 ptrdiff_t hpos;
25369 25373
25370 eassert (updated_window && updated_row); 25374 eassert (updated_window && updated_row);
25371 BLOCK_INPUT; 25375 block_input ();
25372 w = updated_window; 25376 w = updated_window;
25373 f = XFRAME (WINDOW_FRAME (w)); 25377 f = XFRAME (WINDOW_FRAME (w));
25374 25378
@@ -25402,7 +25406,7 @@ x_insert_glyphs (struct glyph *start, int len)
25402 /* Advance the output cursor. */ 25406 /* Advance the output cursor. */
25403 output_cursor.hpos += len; 25407 output_cursor.hpos += len;
25404 output_cursor.x += shift_by_width; 25408 output_cursor.x += shift_by_width;
25405 UNBLOCK_INPUT; 25409 unblock_input ();
25406} 25410}
25407 25411
25408 25412
@@ -25471,10 +25475,10 @@ x_clear_end_of_line (int to_x)
25471 /* Prevent inadvertently clearing to end of the X window. */ 25475 /* Prevent inadvertently clearing to end of the X window. */
25472 if (to_x > from_x && to_y > from_y) 25476 if (to_x > from_x && to_y > from_y)
25473 { 25477 {
25474 BLOCK_INPUT; 25478 block_input ();
25475 FRAME_RIF (f)->clear_frame_area (f, from_x, from_y, 25479 FRAME_RIF (f)->clear_frame_area (f, from_x, from_y,
25476 to_x - from_x, to_y - from_y); 25480 to_x - from_x, to_y - from_y);
25477 UNBLOCK_INPUT; 25481 unblock_input ();
25478 } 25482 }
25479} 25483}
25480 25484
@@ -25801,7 +25805,7 @@ x_fix_overlapping_area (struct window *w, struct glyph_row *row,
25801{ 25805{
25802 int i, x; 25806 int i, x;
25803 25807
25804 BLOCK_INPUT; 25808 block_input ();
25805 25809
25806 x = 0; 25810 x = 0;
25807 for (i = 0; i < row->used[area];) 25811 for (i = 0; i < row->used[area];)
@@ -25829,7 +25833,7 @@ x_fix_overlapping_area (struct window *w, struct glyph_row *row,
25829 } 25833 }
25830 } 25834 }
25831 25835
25832 UNBLOCK_INPUT; 25836 unblock_input ();
25833} 25837}
25834 25838
25835 25839
@@ -26047,7 +26051,7 @@ display_and_set_cursor (struct window *w, int on,
26047 || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA])) 26051 || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA]))
26048 glyph = glyph_row->glyphs[TEXT_AREA] + hpos; 26052 glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
26049 26053
26050 eassert (interrupt_input_blocked); 26054 eassert (input_blocked_p ());
26051 26055
26052 /* Set new_cursor_type to the cursor we want to be displayed. */ 26056 /* Set new_cursor_type to the cursor we want to be displayed. */
26053 new_cursor_type = get_window_cursor_type (w, glyph, 26057 new_cursor_type = get_window_cursor_type (w, glyph,
@@ -26117,10 +26121,10 @@ update_window_cursor (struct window *w, int on)
26117 if (row->reversed_p && hpos >= row->used[TEXT_AREA]) 26121 if (row->reversed_p && hpos >= row->used[TEXT_AREA])
26118 hpos = row->used[TEXT_AREA] - 1; 26122 hpos = row->used[TEXT_AREA] - 1;
26119 26123
26120 BLOCK_INPUT; 26124 block_input ();
26121 display_and_set_cursor (w, on, hpos, vpos, 26125 display_and_set_cursor (w, on, hpos, vpos,
26122 w->phys_cursor.x, w->phys_cursor.y); 26126 w->phys_cursor.x, w->phys_cursor.y);
26123 UNBLOCK_INPUT; 26127 unblock_input ();
26124 } 26128 }
26125} 26129}
26126 26130
@@ -26298,10 +26302,10 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
26298 if (row->reversed_p && hpos >= row->used[TEXT_AREA]) 26302 if (row->reversed_p && hpos >= row->used[TEXT_AREA])
26299 hpos = row->used[TEXT_AREA] - 1; 26303 hpos = row->used[TEXT_AREA] - 1;
26300 26304
26301 BLOCK_INPUT; 26305 block_input ();
26302 display_and_set_cursor (w, 1, hpos, w->phys_cursor.vpos, 26306 display_and_set_cursor (w, 1, hpos, w->phys_cursor.vpos,
26303 w->phys_cursor.x, w->phys_cursor.y); 26307 w->phys_cursor.x, w->phys_cursor.y);
26304 UNBLOCK_INPUT; 26308 unblock_input ();
26305 } 26309 }
26306#endif /* HAVE_WINDOW_SYSTEM */ 26310#endif /* HAVE_WINDOW_SYSTEM */
26307 } 26311 }
@@ -28116,11 +28120,11 @@ x_clear_window_mouse_face (struct window *w)
28116 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); 28120 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
28117 Lisp_Object window; 28121 Lisp_Object window;
28118 28122
28119 BLOCK_INPUT; 28123 block_input ();
28120 XSETWINDOW (window, w); 28124 XSETWINDOW (window, w);
28121 if (EQ (window, hlinfo->mouse_face_window)) 28125 if (EQ (window, hlinfo->mouse_face_window))
28122 clear_mouse_face (hlinfo); 28126 clear_mouse_face (hlinfo);
28123 UNBLOCK_INPUT; 28127 unblock_input ();
28124} 28128}
28125 28129
28126 28130
@@ -28690,6 +28694,7 @@ syms_of_xdisp (void)
28690 staticpro (&Vmessage_stack); 28694 staticpro (&Vmessage_stack);
28691 28695
28692 DEFSYM (Qinhibit_redisplay, "inhibit-redisplay"); 28696 DEFSYM (Qinhibit_redisplay, "inhibit-redisplay");
28697 DEFSYM (Qredisplay_internal, "redisplay_internal (C function)");
28693 28698
28694 message_dolog_marker1 = Fmake_marker (); 28699 message_dolog_marker1 = Fmake_marker ();
28695 staticpro (&message_dolog_marker1); 28700 staticpro (&message_dolog_marker1);
@@ -28929,12 +28934,6 @@ A value of nil means to respect the value of `truncate-lines'.
28929If `word-wrap' is enabled, you might want to reduce this. */); 28934If `word-wrap' is enabled, you might want to reduce this. */);
28930 Vtruncate_partial_width_windows = make_number (50); 28935 Vtruncate_partial_width_windows = make_number (50);
28931 28936
28932 DEFVAR_BOOL ("mode-line-inverse-video", mode_line_inverse_video,
28933 doc: /* When nil, display the mode-line/header-line/menu-bar in the default face.
28934Any other value means to use the appropriate face, `mode-line',
28935`header-line', or `menu' respectively. */);
28936 mode_line_inverse_video = 1;
28937
28938 DEFVAR_LISP ("line-number-display-limit", Vline_number_display_limit, 28937 DEFVAR_LISP ("line-number-display-limit", Vline_number_display_limit,
28939 doc: /* Maximum buffer size for which line number should be displayed. 28938 doc: /* Maximum buffer size for which line number should be displayed.
28940If the buffer is bigger than this, the line number does not appear 28939If the buffer is bigger than this, the line number does not appear
@@ -29362,7 +29361,7 @@ init_xdisp (void)
29362 the following three functions in w32fns.c. */ 29361 the following three functions in w32fns.c. */
29363#ifndef WINDOWSNT 29362#ifndef WINDOWSNT
29364 29363
29365/* Platform-independent portion of hourglass implementation. */ 29364/* Platform-independent portion of hourglass implementation. */
29366 29365
29367/* Cancel a currently active hourglass timer, and start a new one. */ 29366/* Cancel a currently active hourglass timer, and start a new one. */
29368void 29367void
diff --git a/src/xfaces.c b/src/xfaces.c
index c240a05c6c0..28be6aaf082 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -605,9 +605,9 @@ static inline GC
605x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv) 605x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
606{ 606{
607 GC gc; 607 GC gc;
608 BLOCK_INPUT; 608 block_input ();
609 gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), mask, xgcv); 609 gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), mask, xgcv);
610 UNBLOCK_INPUT; 610 unblock_input ();
611 IF_DEBUG (++ngcs); 611 IF_DEBUG (++ngcs);
612 return gc; 612 return gc;
613} 613}
@@ -618,7 +618,7 @@ x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
618static inline void 618static inline void
619x_free_gc (struct frame *f, GC gc) 619x_free_gc (struct frame *f, GC gc)
620{ 620{
621 eassert (interrupt_input_blocked); 621 eassert (input_blocked_p ());
622 IF_DEBUG (eassert (--ngcs >= 0)); 622 IF_DEBUG (eassert (--ngcs >= 0));
623 XFreeGC (FRAME_X_DISPLAY (f), gc); 623 XFreeGC (FRAME_X_DISPLAY (f), gc);
624} 624}
@@ -632,9 +632,9 @@ static inline GC
632x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) 632x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
633{ 633{
634 GC gc; 634 GC gc;
635 BLOCK_INPUT; 635 block_input ();
636 gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv); 636 gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv);
637 UNBLOCK_INPUT; 637 unblock_input ();
638 IF_DEBUG (++ngcs); 638 IF_DEBUG (++ngcs);
639 return gc; 639 return gc;
640} 640}
@@ -907,7 +907,7 @@ load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr,
907 907
908 CHECK_TYPE (!NILP (Fbitmap_spec_p (name)), Qbitmap_spec_p, name); 908 CHECK_TYPE (!NILP (Fbitmap_spec_p (name)), Qbitmap_spec_p, name);
909 909
910 BLOCK_INPUT; 910 block_input ();
911 if (CONSP (name)) 911 if (CONSP (name))
912 { 912 {
913 /* Decode a bitmap spec into a bitmap. */ 913 /* Decode a bitmap spec into a bitmap. */
@@ -927,7 +927,7 @@ load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr,
927 /* It must be a string -- a file name. */ 927 /* It must be a string -- a file name. */
928 bitmap_id = x_create_bitmap_from_file (f, name); 928 bitmap_id = x_create_bitmap_from_file (f, name);
929 } 929 }
930 UNBLOCK_INPUT; 930 unblock_input ();
931 931
932 if (bitmap_id < 0) 932 if (bitmap_id < 0)
933 { 933 {
@@ -991,7 +991,7 @@ parse_rgb_list (Lisp_Object rgb_list, XColor *color)
991 non-zero, then the `standard' definition of the same color is 991 non-zero, then the `standard' definition of the same color is
992 returned in it. */ 992 returned in it. */
993 993
994static int 994static bool
995tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, 995tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
996 XColor *std_color) 996 XColor *std_color)
997{ 997{
@@ -1052,11 +1052,11 @@ tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color,
1052 1052
1053/* A version of defined_color for non-X frames. */ 1053/* A version of defined_color for non-X frames. */
1054 1054
1055static int 1055static bool
1056tty_defined_color (struct frame *f, const char *color_name, 1056tty_defined_color (struct frame *f, const char *color_name,
1057 XColor *color_def, int alloc) 1057 XColor *color_def, bool alloc)
1058{ 1058{
1059 int status = 1; 1059 bool status = 1;
1060 1060
1061 /* Defaults. */ 1061 /* Defaults. */
1062 color_def->pixel = FACE_TTY_DEFAULT_COLOR; 1062 color_def->pixel = FACE_TTY_DEFAULT_COLOR;
@@ -1084,13 +1084,13 @@ tty_defined_color (struct frame *f, const char *color_name,
1084 1084
1085/* Decide if color named COLOR_NAME is valid for the display 1085/* Decide if color named COLOR_NAME is valid for the display
1086 associated with the frame F; if so, return the rgb values in 1086 associated with the frame F; if so, return the rgb values in
1087 COLOR_DEF. If ALLOC is nonzero, allocate a new colormap cell. 1087 COLOR_DEF. If ALLOC, allocate a new colormap cell.
1088 1088
1089 This does the right thing for any type of frame. */ 1089 This does the right thing for any type of frame. */
1090 1090
1091static int 1091static bool
1092defined_color (struct frame *f, const char *color_name, XColor *color_def, 1092defined_color (struct frame *f, const char *color_name, XColor *color_def,
1093 int alloc) 1093 bool alloc)
1094{ 1094{
1095 if (!FRAME_WINDOW_P (f)) 1095 if (!FRAME_WINDOW_P (f))
1096 return tty_defined_color (f, color_name, color_def, alloc); 1096 return tty_defined_color (f, color_name, color_def, alloc);
@@ -1364,9 +1364,9 @@ unload_color (struct frame *f, long unsigned int pixel)
1364#ifdef HAVE_X_WINDOWS 1364#ifdef HAVE_X_WINDOWS
1365 if (pixel != -1) 1365 if (pixel != -1)
1366 { 1366 {
1367 BLOCK_INPUT; 1367 block_input ();
1368 x_free_colors (f, &pixel, 1); 1368 x_free_colors (f, &pixel, 1);
1369 UNBLOCK_INPUT; 1369 unblock_input ();
1370 } 1370 }
1371#endif 1371#endif
1372} 1372}
@@ -1382,7 +1382,7 @@ free_face_colors (struct frame *f, struct face *face)
1382 if (face->colors_copied_bitwise_p) 1382 if (face->colors_copied_bitwise_p)
1383 return; 1383 return;
1384 1384
1385 BLOCK_INPUT; 1385 block_input ();
1386 1386
1387 if (!face->foreground_defaulted_p) 1387 if (!face->foreground_defaulted_p)
1388 { 1388 {
@@ -1424,7 +1424,7 @@ free_face_colors (struct frame *f, struct face *face)
1424 IF_DEBUG (--ncolors_allocated); 1424 IF_DEBUG (--ncolors_allocated);
1425 } 1425 }
1426 1426
1427 UNBLOCK_INPUT; 1427 unblock_input ();
1428#endif /* HAVE_X_WINDOWS */ 1428#endif /* HAVE_X_WINDOWS */
1429} 1429}
1430 1430
@@ -3438,10 +3438,10 @@ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource,
3438 CHECK_STRING (resource); 3438 CHECK_STRING (resource);
3439 CHECK_STRING (class); 3439 CHECK_STRING (class);
3440 CHECK_LIVE_FRAME (frame); 3440 CHECK_LIVE_FRAME (frame);
3441 BLOCK_INPUT; 3441 block_input ();
3442 value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)), 3442 value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)),
3443 resource, class, Qnil, Qnil); 3443 resource, class, Qnil, Qnil);
3444 UNBLOCK_INPUT; 3444 unblock_input ();
3445 return value; 3445 return value;
3446} 3446}
3447 3447
@@ -4114,12 +4114,12 @@ free_realized_face (struct frame *f, struct face *face)
4114 free_face_fontset (f, face); 4114 free_face_fontset (f, face);
4115 if (face->gc) 4115 if (face->gc)
4116 { 4116 {
4117 BLOCK_INPUT; 4117 block_input ();
4118 if (face->font) 4118 if (face->font)
4119 font_done_for_face (f, face); 4119 font_done_for_face (f, face);
4120 x_free_gc (f, face->gc); 4120 x_free_gc (f, face->gc);
4121 face->gc = 0; 4121 face->gc = 0;
4122 UNBLOCK_INPUT; 4122 unblock_input ();
4123 } 4123 }
4124 4124
4125 free_face_colors (f, face); 4125 free_face_colors (f, face);
@@ -4153,7 +4153,7 @@ prepare_face_for_display (struct frame *f, struct face *face)
4153 xgcv.graphics_exposures = False; 4153 xgcv.graphics_exposures = False;
4154#endif 4154#endif
4155 4155
4156 BLOCK_INPUT; 4156 block_input ();
4157#ifdef HAVE_X_WINDOWS 4157#ifdef HAVE_X_WINDOWS
4158 if (face->stipple) 4158 if (face->stipple)
4159 { 4159 {
@@ -4165,7 +4165,7 @@ prepare_face_for_display (struct frame *f, struct face *face)
4165 face->gc = x_create_gc (f, mask, &xgcv); 4165 face->gc = x_create_gc (f, mask, &xgcv);
4166 if (face->font) 4166 if (face->font)
4167 font_prepare_for_face (f, face); 4167 font_prepare_for_face (f, face);
4168 UNBLOCK_INPUT; 4168 unblock_input ();
4169 } 4169 }
4170#endif /* HAVE_WINDOW_SYSTEM */ 4170#endif /* HAVE_WINDOW_SYSTEM */
4171} 4171}
@@ -4263,12 +4263,12 @@ clear_face_gcs (struct face_cache *c)
4263 struct face *face = c->faces_by_id[i]; 4263 struct face *face = c->faces_by_id[i];
4264 if (face && face->gc) 4264 if (face && face->gc)
4265 { 4265 {
4266 BLOCK_INPUT; 4266 block_input ();
4267 if (face->font) 4267 if (face->font)
4268 font_done_for_face (c->f, face); 4268 font_done_for_face (c->f, face);
4269 x_free_gc (c->f, face->gc); 4269 x_free_gc (c->f, face->gc);
4270 face->gc = 0; 4270 face->gc = 0;
4271 UNBLOCK_INPUT; 4271 unblock_input ();
4272 } 4272 }
4273 } 4273 }
4274#endif /* HAVE_WINDOW_SYSTEM */ 4274#endif /* HAVE_WINDOW_SYSTEM */
@@ -4292,7 +4292,7 @@ free_realized_faces (struct face_cache *c)
4292 /* We must block input here because we can't process X events 4292 /* We must block input here because we can't process X events
4293 safely while only some faces are freed, or when the frame's 4293 safely while only some faces are freed, or when the frame's
4294 current matrix still references freed faces. */ 4294 current matrix still references freed faces. */
4295 BLOCK_INPUT; 4295 block_input ();
4296 4296
4297 for (i = 0; i < c->used; ++i) 4297 for (i = 0; i < c->used; ++i)
4298 { 4298 {
@@ -4314,7 +4314,7 @@ free_realized_faces (struct face_cache *c)
4314 ++windows_or_buffers_changed; 4314 ++windows_or_buffers_changed;
4315 } 4315 }
4316 4316
4317 UNBLOCK_INPUT; 4317 unblock_input ();
4318 } 4318 }
4319} 4319}
4320 4320
@@ -5275,7 +5275,7 @@ realize_basic_faces (struct frame *f)
5275 5275
5276 /* Block input here so that we won't be surprised by an X expose 5276 /* Block input here so that we won't be surprised by an X expose
5277 event, for instance, without having the faces set up. */ 5277 event, for instance, without having the faces set up. */
5278 BLOCK_INPUT; 5278 block_input ();
5279 specbind (Qscalable_fonts_allowed, Qt); 5279 specbind (Qscalable_fonts_allowed, Qt);
5280 5280
5281 if (realize_default_face (f)) 5281 if (realize_default_face (f))
@@ -5306,7 +5306,7 @@ realize_basic_faces (struct frame *f)
5306 } 5306 }
5307 5307
5308 unbind_to (count, Qnil); 5308 unbind_to (count, Qnil);
5309 UNBLOCK_INPUT; 5309 unblock_input ();
5310 return success_p; 5310 return success_p;
5311} 5311}
5312 5312
@@ -6352,7 +6352,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */)
6352 int red, green, blue; 6352 int red, green, blue;
6353 int num; 6353 int num;
6354 6354
6355 BLOCK_INPUT; 6355 block_input ();
6356 6356
6357 while (fgets (buf, sizeof (buf), fp) != NULL) { 6357 while (fgets (buf, sizeof (buf), fp) != NULL) {
6358 if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3) 6358 if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3)
@@ -6372,7 +6372,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string. */)
6372 } 6372 }
6373 fclose (fp); 6373 fclose (fp);
6374 6374
6375 UNBLOCK_INPUT; 6375 unblock_input ();
6376 } 6376 }
6377 6377
6378 return cmap; 6378 return cmap;
diff --git a/src/xfns.c b/src/xfns.c
index 8304a3df04f..928e6367743 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -425,7 +425,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
425 unsigned char *tmp_data = NULL; 425 unsigned char *tmp_data = NULL;
426 Atom target_type = XA_CARDINAL; 426 Atom target_type = XA_CARDINAL;
427 427
428 BLOCK_INPUT; 428 block_input ();
429 429
430 x_catch_errors (dpy); 430 x_catch_errors (dpy);
431 431
@@ -543,7 +543,7 @@ x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
543 543
544 x_uncatch_errors (); 544 x_uncatch_errors ();
545 545
546 UNBLOCK_INPUT; 546 unblock_input ();
547 547
548 if (had_errors) return; 548 if (had_errors) return;
549 549
@@ -575,27 +575,27 @@ gamma_correct (struct frame *f, XColor *color)
575 575
576 576
577/* Decide if color named COLOR_NAME is valid for use on frame F. If 577/* Decide if color named COLOR_NAME is valid for use on frame F. If
578 so, return the RGB values in COLOR. If ALLOC_P is non-zero, 578 so, return the RGB values in COLOR. If ALLOC_P,
579 allocate the color. Value is zero if COLOR_NAME is invalid, or 579 allocate the color. Value is false if COLOR_NAME is invalid, or
580 no color could be allocated. */ 580 no color could be allocated. */
581 581
582int 582bool
583x_defined_color (struct frame *f, const char *color_name, 583x_defined_color (struct frame *f, const char *color_name,
584 XColor *color, int alloc_p) 584 XColor *color, bool alloc_p)
585{ 585{
586 int success_p = 0; 586 bool success_p = 0;
587 Display *dpy = FRAME_X_DISPLAY (f); 587 Display *dpy = FRAME_X_DISPLAY (f);
588 Colormap cmap = FRAME_X_COLORMAP (f); 588 Colormap cmap = FRAME_X_COLORMAP (f);
589 589
590 BLOCK_INPUT; 590 block_input ();
591#ifdef USE_GTK 591#ifdef USE_GTK
592 success_p = xg_check_special_colors (f, color_name, color); 592 success_p = xg_check_special_colors (f, color_name, color);
593#endif 593#endif
594 if (!success_p) 594 if (!success_p)
595 success_p = XParseColor (dpy, cmap, color_name, color); 595 success_p = XParseColor (dpy, cmap, color_name, color) != 0;
596 if (success_p && alloc_p) 596 if (success_p && alloc_p)
597 success_p = x_alloc_nearest_color (f, cmap, color); 597 success_p = x_alloc_nearest_color (f, cmap, color);
598 UNBLOCK_INPUT; 598 unblock_input ();
599 599
600 return success_p; 600 return success_p;
601} 601}
@@ -656,8 +656,8 @@ x_set_tool_bar_position (struct frame *f,
656 if (EQ (new_value, old_value)) return; 656 if (EQ (new_value, old_value)) return;
657 657
658#ifdef USE_GTK 658#ifdef USE_GTK
659 if (xg_change_toolbar_position (f, new_value)) 659 xg_change_toolbar_position (f, new_value);
660 fset_tool_bar_position (f, new_value); 660 fset_tool_bar_position (f, new_value);
661#endif 661#endif
662} 662}
663 663
@@ -679,7 +679,7 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file)
679 GdkPixbuf *pixbuf; 679 GdkPixbuf *pixbuf;
680 GError *err = NULL; 680 GError *err = NULL;
681 char *filename = SSDATA (found); 681 char *filename = SSDATA (found);
682 BLOCK_INPUT; 682 block_input ();
683 683
684 pixbuf = gdk_pixbuf_new_from_file (filename, &err); 684 pixbuf = gdk_pixbuf_new_from_file (filename, &err);
685 685
@@ -694,7 +694,7 @@ xg_set_icon (FRAME_PTR f, Lisp_Object file)
694 else 694 else
695 g_error_free (err); 695 g_error_free (err);
696 696
697 UNBLOCK_INPUT; 697 unblock_input ();
698 } 698 }
699 699
700 return result; 700 return result;
@@ -737,7 +737,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
737 { 737 {
738 Display *dpy = FRAME_X_DISPLAY (f); 738 Display *dpy = FRAME_X_DISPLAY (f);
739 739
740 BLOCK_INPUT; 740 block_input ();
741 XSetForeground (dpy, x->normal_gc, fg); 741 XSetForeground (dpy, x->normal_gc, fg);
742 XSetBackground (dpy, x->reverse_gc, fg); 742 XSetBackground (dpy, x->reverse_gc, fg);
743 743
@@ -748,7 +748,7 @@ x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
748 XSetBackground (dpy, x->cursor_gc, x->cursor_pixel); 748 XSetBackground (dpy, x->cursor_gc, x->cursor_pixel);
749 } 749 }
750 750
751 UNBLOCK_INPUT; 751 unblock_input ();
752 752
753 update_face_from_frame_parameter (f, Qforeground_color, arg); 753 update_face_from_frame_parameter (f, Qforeground_color, arg);
754 754
@@ -773,7 +773,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
773 { 773 {
774 Display *dpy = FRAME_X_DISPLAY (f); 774 Display *dpy = FRAME_X_DISPLAY (f);
775 775
776 BLOCK_INPUT; 776 block_input ();
777 XSetBackground (dpy, x->normal_gc, bg); 777 XSetBackground (dpy, x->normal_gc, bg);
778 XSetForeground (dpy, x->reverse_gc, bg); 778 XSetForeground (dpy, x->reverse_gc, bg);
779 XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg); 779 XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg);
@@ -797,7 +797,7 @@ x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
797 } 797 }
798#endif /* USE_TOOLKIT_SCROLL_BARS */ 798#endif /* USE_TOOLKIT_SCROLL_BARS */
799 799
800 UNBLOCK_INPUT; 800 unblock_input ();
801 update_face_from_frame_parameter (f, Qbackground_color, arg); 801 update_face_from_frame_parameter (f, Qbackground_color, arg);
802 802
803 if (FRAME_VISIBLE_P (f)) 803 if (FRAME_VISIBLE_P (f))
@@ -854,7 +854,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
854 unload_color (f, x->mouse_pixel); 854 unload_color (f, x->mouse_pixel);
855 x->mouse_pixel = pixel; 855 x->mouse_pixel = pixel;
856 856
857 BLOCK_INPUT; 857 block_input ();
858 858
859 /* It's not okay to crash if the user selects a screwy cursor. */ 859 /* It's not okay to crash if the user selects a screwy cursor. */
860 x_catch_errors (dpy); 860 x_catch_errors (dpy);
@@ -974,7 +974,7 @@ x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
974 x->horizontal_drag_cursor = horizontal_drag_cursor; 974 x->horizontal_drag_cursor = horizontal_drag_cursor;
975 975
976 XFlush (dpy); 976 XFlush (dpy);
977 UNBLOCK_INPUT; 977 unblock_input ();
978 978
979 update_face_from_frame_parameter (f, Qmouse_color, arg); 979 update_face_from_frame_parameter (f, Qmouse_color, arg);
980} 980}
@@ -1031,10 +1031,10 @@ x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1031 1031
1032 if (FRAME_X_WINDOW (f) != 0) 1032 if (FRAME_X_WINDOW (f) != 0)
1033 { 1033 {
1034 BLOCK_INPUT; 1034 block_input ();
1035 XSetBackground (FRAME_X_DISPLAY (f), x->cursor_gc, x->cursor_pixel); 1035 XSetBackground (FRAME_X_DISPLAY (f), x->cursor_gc, x->cursor_pixel);
1036 XSetForeground (FRAME_X_DISPLAY (f), x->cursor_gc, fore_pixel); 1036 XSetForeground (FRAME_X_DISPLAY (f), x->cursor_gc, fore_pixel);
1037 UNBLOCK_INPUT; 1037 unblock_input ();
1038 1038
1039 if (FRAME_VISIBLE_P (f)) 1039 if (FRAME_VISIBLE_P (f))
1040 { 1040 {
@@ -1058,9 +1058,9 @@ x_set_border_pixel (struct frame *f, int pix)
1058 1058
1059 if (FRAME_X_WINDOW (f) != 0 && f->border_width > 0) 1059 if (FRAME_X_WINDOW (f) != 0 && f->border_width > 0)
1060 { 1060 {
1061 BLOCK_INPUT; 1061 block_input ();
1062 XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), pix); 1062 XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), pix);
1063 UNBLOCK_INPUT; 1063 unblock_input ();
1064 1064
1065 if (FRAME_VISIBLE_P (f)) 1065 if (FRAME_VISIBLE_P (f))
1066 redraw_frame (f); 1066 redraw_frame (f);
@@ -1112,7 +1112,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1112 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) 1112 else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil))
1113 return; 1113 return;
1114 1114
1115 BLOCK_INPUT; 1115 block_input ();
1116 if (NILP (arg)) 1116 if (NILP (arg))
1117 result = x_text_icon (f, 1117 result = x_text_icon (f,
1118 SSDATA ((!NILP (f->icon_name) 1118 SSDATA ((!NILP (f->icon_name)
@@ -1123,12 +1123,12 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1123 1123
1124 if (result) 1124 if (result)
1125 { 1125 {
1126 UNBLOCK_INPUT; 1126 unblock_input ();
1127 error ("No icon window available"); 1127 error ("No icon window available");
1128 } 1128 }
1129 1129
1130 XFlush (FRAME_X_DISPLAY (f)); 1130 XFlush (FRAME_X_DISPLAY (f));
1131 UNBLOCK_INPUT; 1131 unblock_input ();
1132} 1132}
1133 1133
1134static void 1134static void
@@ -1149,7 +1149,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1149 if (f->output_data.x->icon_bitmap != 0) 1149 if (f->output_data.x->icon_bitmap != 0)
1150 return; 1150 return;
1151 1151
1152 BLOCK_INPUT; 1152 block_input ();
1153 1153
1154 result = x_text_icon (f, 1154 result = x_text_icon (f,
1155 SSDATA ((!NILP (f->icon_name) 1155 SSDATA ((!NILP (f->icon_name)
@@ -1160,12 +1160,12 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1160 1160
1161 if (result) 1161 if (result)
1162 { 1162 {
1163 UNBLOCK_INPUT; 1163 unblock_input ();
1164 error ("No icon window available"); 1164 error ("No icon window available");
1165 } 1165 }
1166 1166
1167 XFlush (FRAME_X_DISPLAY (f)); 1167 XFlush (FRAME_X_DISPLAY (f));
1168 UNBLOCK_INPUT; 1168 unblock_input ();
1169} 1169}
1170 1170
1171 1171
@@ -1228,10 +1228,10 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1228 { 1228 {
1229 y = FRAME_TOP_MARGIN_HEIGHT (f); 1229 y = FRAME_TOP_MARGIN_HEIGHT (f);
1230 1230
1231 BLOCK_INPUT; 1231 block_input ();
1232 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 1232 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
1233 0, y, width, height, False); 1233 0, y, width, height, False);
1234 UNBLOCK_INPUT; 1234 unblock_input ();
1235 } 1235 }
1236 1236
1237 if (nlines > 1 && nlines > olines) 1237 if (nlines > 1 && nlines > olines)
@@ -1239,10 +1239,10 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1239 y = (olines == 0 ? 1 : olines) * FRAME_LINE_HEIGHT (f); 1239 y = (olines == 0 ? 1 : olines) * FRAME_LINE_HEIGHT (f);
1240 height = nlines * FRAME_LINE_HEIGHT (f) - y; 1240 height = nlines * FRAME_LINE_HEIGHT (f) - y;
1241 1241
1242 BLOCK_INPUT; 1242 block_input ();
1243 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 1243 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
1244 0, y, width, height, False); 1244 0, y, width, height, False);
1245 UNBLOCK_INPUT; 1245 unblock_input ();
1246 } 1246 }
1247 1247
1248 if (nlines == 0 && WINDOWP (f->menu_bar_window)) 1248 if (nlines == 0 && WINDOWP (f->menu_bar_window))
@@ -1338,10 +1338,10 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1338 /* height can be zero here. */ 1338 /* height can be zero here. */
1339 if (height > 0 && width > 0) 1339 if (height > 0 && width > 0)
1340 { 1340 {
1341 BLOCK_INPUT; 1341 block_input ();
1342 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 1342 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
1343 0, y, width, height, False); 1343 0, y, width, height, False);
1344 UNBLOCK_INPUT; 1344 unblock_input ();
1345 } 1345 }
1346 1346
1347 if (WINDOWP (f->tool_bar_window)) 1347 if (WINDOWP (f->tool_bar_window))
@@ -1494,7 +1494,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
1494{ 1494{
1495 if (FRAME_X_WINDOW (f)) 1495 if (FRAME_X_WINDOW (f))
1496 { 1496 {
1497 BLOCK_INPUT; 1497 block_input ();
1498 { 1498 {
1499 XTextProperty text, icon; 1499 XTextProperty text, icon;
1500 ptrdiff_t bytes; 1500 ptrdiff_t bytes;
@@ -1586,7 +1586,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
1586 if (do_free_text_value) 1586 if (do_free_text_value)
1587 xfree (text.value); 1587 xfree (text.value);
1588 } 1588 }
1589 UNBLOCK_INPUT; 1589 unblock_input ();
1590 } 1590 }
1591} 1591}
1592 1592
@@ -1779,7 +1779,7 @@ hack_wm_protocols (FRAME_PTR f, Widget widget)
1779 int need_focus = 1; 1779 int need_focus = 1;
1780 int need_save = 1; 1780 int need_save = 1;
1781 1781
1782 BLOCK_INPUT; 1782 block_input ();
1783 { 1783 {
1784 Atom type; 1784 Atom type;
1785 unsigned char *catoms; 1785 unsigned char *catoms;
@@ -1827,7 +1827,7 @@ hack_wm_protocols (FRAME_PTR f, Widget widget)
1827 XA_ATOM, 32, PropModeAppend, 1827 XA_ATOM, 32, PropModeAppend,
1828 (unsigned char *) props, count); 1828 (unsigned char *) props, count);
1829 } 1829 }
1830 UNBLOCK_INPUT; 1830 unblock_input ();
1831} 1831}
1832#endif 1832#endif
1833 1833
@@ -2350,7 +2350,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2350 Arg al [25]; 2350 Arg al [25];
2351 int ac; 2351 int ac;
2352 2352
2353 BLOCK_INPUT; 2353 block_input ();
2354 2354
2355 /* Use the resource name as the top-level widget name 2355 /* Use the resource name as the top-level widget name
2356 for looking up resources. Make a non-Lisp copy 2356 for looking up resources. Make a non-Lisp copy
@@ -2572,7 +2572,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2572 f->output_data.x->current_cursor 2572 f->output_data.x->current_cursor
2573 = f->output_data.x->text_cursor); 2573 = f->output_data.x->text_cursor);
2574 2574
2575 UNBLOCK_INPUT; 2575 unblock_input ();
2576 2576
2577 /* This is a no-op, except under Motif. Make sure main areas are 2577 /* This is a no-op, except under Motif. Make sure main areas are
2578 set to something reasonable, in case we get an error later. */ 2578 set to something reasonable, in case we get an error later. */
@@ -2591,7 +2591,7 @@ x_window (FRAME_PTR f)
2591 FRAME_XIC (f) = NULL; 2591 FRAME_XIC (f) = NULL;
2592 if (use_xim) 2592 if (use_xim)
2593 { 2593 {
2594 BLOCK_INPUT; 2594 block_input ();
2595 create_frame_xic (f); 2595 create_frame_xic (f);
2596 if (FRAME_XIC (f)) 2596 if (FRAME_XIC (f))
2597 { 2597 {
@@ -2613,7 +2613,7 @@ x_window (FRAME_PTR f)
2613 attribute_mask, &attributes); 2613 attribute_mask, &attributes);
2614 } 2614 }
2615 } 2615 }
2616 UNBLOCK_INPUT; 2616 unblock_input ();
2617 } 2617 }
2618#endif 2618#endif
2619} 2619}
@@ -2638,7 +2638,7 @@ x_window (struct frame *f)
2638 attribute_mask = (CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask 2638 attribute_mask = (CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask
2639 | CWColormap); 2639 | CWColormap);
2640 2640
2641 BLOCK_INPUT; 2641 block_input ();
2642 FRAME_X_WINDOW (f) 2642 FRAME_X_WINDOW (f)
2643 = XCreateWindow (FRAME_X_DISPLAY (f), 2643 = XCreateWindow (FRAME_X_DISPLAY (f),
2644 f->output_data.x->parent_desc, 2644 f->output_data.x->parent_desc,
@@ -2715,7 +2715,7 @@ x_window (struct frame *f)
2715 f->output_data.x->current_cursor 2715 f->output_data.x->current_cursor
2716 = f->output_data.x->text_cursor); 2716 = f->output_data.x->text_cursor);
2717 2717
2718 UNBLOCK_INPUT; 2718 unblock_input ();
2719 2719
2720 if (FRAME_X_WINDOW (f) == 0) 2720 if (FRAME_X_WINDOW (f) == 0)
2721 error ("Unable to create window"); 2721 error ("Unable to create window");
@@ -2768,7 +2768,7 @@ x_icon (struct frame *f, Lisp_Object parms)
2768 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) 2768 else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
2769 error ("Both left and top icon corners of icon must be specified"); 2769 error ("Both left and top icon corners of icon must be specified");
2770 2770
2771 BLOCK_INPUT; 2771 block_input ();
2772 2772
2773 if (! EQ (icon_x, Qunbound)) 2773 if (! EQ (icon_x, Qunbound))
2774 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); 2774 x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y));
@@ -2787,7 +2787,7 @@ x_icon (struct frame *f, Lisp_Object parms)
2787 ? f->icon_name 2787 ? f->icon_name
2788 : f->name))); 2788 : f->name)));
2789 2789
2790 UNBLOCK_INPUT; 2790 unblock_input ();
2791} 2791}
2792 2792
2793/* Make the GCs needed for this window, setting the 2793/* Make the GCs needed for this window, setting the
@@ -2799,7 +2799,7 @@ x_make_gc (struct frame *f)
2799{ 2799{
2800 XGCValues gc_values; 2800 XGCValues gc_values;
2801 2801
2802 BLOCK_INPUT; 2802 block_input ();
2803 2803
2804 /* Create the GCs of this frame. 2804 /* Create the GCs of this frame.
2805 Note that many default values are used. */ 2805 Note that many default values are used. */
@@ -2847,7 +2847,7 @@ x_make_gc (struct frame *f)
2847 FRAME_BACKGROUND_PIXEL (f), 2847 FRAME_BACKGROUND_PIXEL (f),
2848 DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)))); 2848 DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))));
2849 2849
2850 UNBLOCK_INPUT; 2850 unblock_input ();
2851} 2851}
2852 2852
2853 2853
@@ -2858,7 +2858,7 @@ x_free_gcs (struct frame *f)
2858{ 2858{
2859 Display *dpy = FRAME_X_DISPLAY (f); 2859 Display *dpy = FRAME_X_DISPLAY (f);
2860 2860
2861 BLOCK_INPUT; 2861 block_input ();
2862 2862
2863 if (f->output_data.x->normal_gc) 2863 if (f->output_data.x->normal_gc)
2864 { 2864 {
@@ -2884,7 +2884,7 @@ x_free_gcs (struct frame *f)
2884 f->output_data.x->border_tile = 0; 2884 f->output_data.x->border_tile = 0;
2885 } 2885 }
2886 2886
2887 UNBLOCK_INPUT; 2887 unblock_input ();
2888} 2888}
2889 2889
2890 2890
@@ -3007,10 +3007,10 @@ If FRAME is nil, use the selected frame. */)
3007 if (NILP (frame)) 3007 if (NILP (frame))
3008 frame = selected_frame; 3008 frame = selected_frame;
3009 f = XFRAME (frame); 3009 f = XFRAME (frame);
3010 BLOCK_INPUT; 3010 block_input ();
3011 if (FRAME_X_P (f)) 3011 if (FRAME_X_P (f))
3012 x_wm_set_size_hint (f, 0, 0); 3012 x_wm_set_size_hint (f, 0, 0);
3013 UNBLOCK_INPUT; 3013 unblock_input ();
3014 return Qnil; 3014 return Qnil;
3015} 3015}
3016 3016
@@ -3405,9 +3405,9 @@ This function is an internal primitive--use `make-frame' instead. */)
3405 /* Tell the server what size and position, etc, we want, and how 3405 /* Tell the server what size and position, etc, we want, and how
3406 badly we want them. This should be done after we have the menu 3406 badly we want them. This should be done after we have the menu
3407 bar so that its size can be taken into account. */ 3407 bar so that its size can be taken into account. */
3408 BLOCK_INPUT; 3408 block_input ();
3409 x_wm_set_size_hint (f, window_prompting, 0); 3409 x_wm_set_size_hint (f, window_prompting, 0);
3410 UNBLOCK_INPUT; 3410 unblock_input ();
3411 3411
3412 /* Make the window appear on the frame and enable display, unless 3412 /* Make the window appear on the frame and enable display, unless
3413 the caller says not to. However, with explicit parent, Emacs 3413 the caller says not to. However, with explicit parent, Emacs
@@ -3431,7 +3431,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3431 } 3431 }
3432 } 3432 }
3433 3433
3434 BLOCK_INPUT; 3434 block_input ();
3435 3435
3436 /* Set machine name and pid for the purpose of window managers. */ 3436 /* Set machine name and pid for the purpose of window managers. */
3437 set_machine_and_pid_properties (f); 3437 set_machine_and_pid_properties (f);
@@ -3447,7 +3447,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3447 (unsigned char *) &dpyinfo->client_leader_window, 1); 3447 (unsigned char *) &dpyinfo->client_leader_window, 1);
3448 } 3448 }
3449 3449
3450 UNBLOCK_INPUT; 3450 unblock_input ();
3451 3451
3452 /* Initialize `default-minibuffer-frame' in case this is the first 3452 /* Initialize `default-minibuffer-frame' in case this is the first
3453 frame on this terminal. */ 3453 frame on this terminal. */
@@ -3506,7 +3506,7 @@ FRAME nil means use the selected frame. */)
3506 struct frame *f = check_x_frame (frame); 3506 struct frame *f = check_x_frame (frame);
3507 Display *dpy = FRAME_X_DISPLAY (f); 3507 Display *dpy = FRAME_X_DISPLAY (f);
3508 3508
3509 BLOCK_INPUT; 3509 block_input ();
3510 x_catch_errors (dpy); 3510 x_catch_errors (dpy);
3511 3511
3512 if (FRAME_X_EMBEDDED_P (f)) 3512 if (FRAME_X_EMBEDDED_P (f))
@@ -3524,7 +3524,7 @@ FRAME nil means use the selected frame. */)
3524 } 3524 }
3525 3525
3526 x_uncatch_errors (); 3526 x_uncatch_errors ();
3527 UNBLOCK_INPUT; 3527 unblock_input ();
3528 3528
3529 return Qnil; 3529 return Qnil;
3530} 3530}
@@ -4152,9 +4152,9 @@ If TERMINAL is omitted or nil, that stands for the selected frame's display. */
4152void 4152void
4153x_sync (FRAME_PTR f) 4153x_sync (FRAME_PTR f)
4154{ 4154{
4155 BLOCK_INPUT; 4155 block_input ();
4156 XSync (FRAME_X_DISPLAY (f), False); 4156 XSync (FRAME_X_DISPLAY (f), False);
4157 UNBLOCK_INPUT; 4157 unblock_input ();
4158} 4158}
4159 4159
4160 4160
@@ -4229,7 +4229,7 @@ FRAME. Default is to change on the edit X window. */)
4229 nelements = SBYTES (value); 4229 nelements = SBYTES (value);
4230 } 4230 }
4231 4231
4232 BLOCK_INPUT; 4232 block_input ();
4233 prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); 4233 prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False);
4234 if (! NILP (type)) 4234 if (! NILP (type))
4235 { 4235 {
@@ -4248,7 +4248,7 @@ FRAME. Default is to change on the edit X window. */)
4248 4248
4249 /* Make sure the property is set when we return. */ 4249 /* Make sure the property is set when we return. */
4250 XFlush (FRAME_X_DISPLAY (f)); 4250 XFlush (FRAME_X_DISPLAY (f));
4251 UNBLOCK_INPUT; 4251 unblock_input ();
4252 4252
4253 return value; 4253 return value;
4254} 4254}
@@ -4264,13 +4264,13 @@ FRAME nil or omitted means use the selected frame. Value is PROP. */)
4264 Atom prop_atom; 4264 Atom prop_atom;
4265 4265
4266 CHECK_STRING (prop); 4266 CHECK_STRING (prop);
4267 BLOCK_INPUT; 4267 block_input ();
4268 prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); 4268 prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False);
4269 XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom); 4269 XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom);
4270 4270
4271 /* Make sure the property is removed when we return. */ 4271 /* Make sure the property is removed when we return. */
4272 XFlush (FRAME_X_DISPLAY (f)); 4272 XFlush (FRAME_X_DISPLAY (f));
4273 UNBLOCK_INPUT; 4273 unblock_input ();
4274 4274
4275 return prop; 4275 return prop;
4276} 4276}
@@ -4318,7 +4318,7 @@ no value of TYPE (always string in the MS Windows case). */)
4318 target_window = FRAME_X_DISPLAY_INFO (f)->root_window; 4318 target_window = FRAME_X_DISPLAY_INFO (f)->root_window;
4319 } 4319 }
4320 4320
4321 BLOCK_INPUT; 4321 block_input ();
4322 if (STRINGP (type)) 4322 if (STRINGP (type))
4323 { 4323 {
4324 if (strcmp ("AnyPropertyType", SSDATA (type)) == 0) 4324 if (strcmp ("AnyPropertyType", SSDATA (type)) == 0)
@@ -4384,7 +4384,7 @@ no value of TYPE (always string in the MS Windows case). */)
4384 if (tmp_data) XFree (tmp_data); 4384 if (tmp_data) XFree (tmp_data);
4385 } 4385 }
4386 4386
4387 UNBLOCK_INPUT; 4387 unblock_input ();
4388 UNGCPRO; 4388 UNGCPRO;
4389 return prop_value; 4389 return prop_value;
4390} 4390}
@@ -4415,7 +4415,7 @@ show_hourglass (struct atimer *timer)
4415 { 4415 {
4416 Lisp_Object rest, frame; 4416 Lisp_Object rest, frame;
4417 4417
4418 BLOCK_INPUT; 4418 block_input ();
4419 4419
4420 FOR_EACH_FRAME (rest, frame) 4420 FOR_EACH_FRAME (rest, frame)
4421 { 4421 {
@@ -4459,7 +4459,7 @@ show_hourglass (struct atimer *timer)
4459 } 4459 }
4460 4460
4461 hourglass_shown_p = 1; 4461 hourglass_shown_p = 1;
4462 UNBLOCK_INPUT; 4462 unblock_input ();
4463 } 4463 }
4464} 4464}
4465 4465
@@ -4474,7 +4474,7 @@ hide_hourglass (void)
4474 { 4474 {
4475 Lisp_Object rest, frame; 4475 Lisp_Object rest, frame;
4476 4476
4477 BLOCK_INPUT; 4477 block_input ();
4478 FOR_EACH_FRAME (rest, frame) 4478 FOR_EACH_FRAME (rest, frame)
4479 { 4479 {
4480 struct frame *f = XFRAME (frame); 4480 struct frame *f = XFRAME (frame);
@@ -4493,7 +4493,7 @@ hide_hourglass (void)
4493 } 4493 }
4494 4494
4495 hourglass_shown_p = 0; 4495 hourglass_shown_p = 0;
4496 UNBLOCK_INPUT; 4496 unblock_input ();
4497 } 4497 }
4498} 4498}
4499 4499
@@ -4743,7 +4743,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4743 unsigned long mask; 4743 unsigned long mask;
4744 Atom type = FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type_tooltip; 4744 Atom type = FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type_tooltip;
4745 4745
4746 BLOCK_INPUT; 4746 block_input ();
4747 mask = CWBackPixel | CWOverrideRedirect | CWEventMask; 4747 mask = CWBackPixel | CWOverrideRedirect | CWEventMask;
4748 if (DoesSaveUnders (dpyinfo->screen)) 4748 if (DoesSaveUnders (dpyinfo->screen))
4749 mask |= CWSaveUnder; 4749 mask |= CWSaveUnder;
@@ -4770,7 +4770,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4770 FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type, 4770 FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type,
4771 XA_ATOM, 32, PropModeReplace, 4771 XA_ATOM, 32, PropModeReplace,
4772 (unsigned char *)&type, 1); 4772 (unsigned char *)&type, 1);
4773 UNBLOCK_INPUT; 4773 unblock_input ();
4774 } 4774 }
4775 4775
4776 x_make_gc (f); 4776 x_make_gc (f);
@@ -4884,10 +4884,10 @@ compute_tip_xy (struct frame *f, Lisp_Object parms, Lisp_Object dx, Lisp_Object
4884 show it. */ 4884 show it. */
4885 if (!INTEGERP (left) || !INTEGERP (top)) 4885 if (!INTEGERP (left) || !INTEGERP (top))
4886 { 4886 {
4887 BLOCK_INPUT; 4887 block_input ();
4888 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, 4888 XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window,
4889 &root, &child, root_x, root_y, &win_x, &win_y, &pmask); 4889 &root, &child, root_x, root_y, &win_x, &win_y, &pmask);
4890 UNBLOCK_INPUT; 4890 unblock_input ();
4891 } 4891 }
4892 4892
4893 if (INTEGERP (top)) 4893 if (INTEGERP (top))
@@ -4985,20 +4985,21 @@ Text larger than the specified size is clipped. */)
4985#ifdef USE_GTK 4985#ifdef USE_GTK
4986 if (x_gtk_use_system_tooltips) 4986 if (x_gtk_use_system_tooltips)
4987 { 4987 {
4988 int ok; 4988 bool ok;
4989 4989
4990 /* Hide a previous tip, if any. */ 4990 /* Hide a previous tip, if any. */
4991 Fx_hide_tip (); 4991 Fx_hide_tip ();
4992 4992
4993 BLOCK_INPUT; 4993 block_input ();
4994 if ((ok = xg_prepare_tooltip (f, string, &width, &height)) != 0) 4994 ok = xg_prepare_tooltip (f, string, &width, &height);
4995 if (ok)
4995 { 4996 {
4996 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); 4997 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
4997 xg_show_tooltip (f, root_x, root_y); 4998 xg_show_tooltip (f, root_x, root_y);
4998 /* This is used in Fx_hide_tip. */ 4999 /* This is used in Fx_hide_tip. */
4999 XSETFRAME (tip_frame, f); 5000 XSETFRAME (tip_frame, f);
5000 } 5001 }
5001 UNBLOCK_INPUT; 5002 unblock_input ();
5002 if (ok) goto start_timer; 5003 if (ok) goto start_timer;
5003 } 5004 }
5004#endif /* USE_GTK */ 5005#endif /* USE_GTK */
@@ -5026,12 +5027,12 @@ Text larger than the specified size is clipped. */)
5026 call1 (Qcancel_timer, timer); 5027 call1 (Qcancel_timer, timer);
5027 } 5028 }
5028 5029
5029 BLOCK_INPUT; 5030 block_input ();
5030 compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), 5031 compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f),
5031 FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y); 5032 FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y);
5032 XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f), 5033 XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f),
5033 root_x, root_y); 5034 root_x, root_y);
5034 UNBLOCK_INPUT; 5035 unblock_input ();
5035 goto start_timer; 5036 goto start_timer;
5036 } 5037 }
5037 } 5038 }
@@ -5185,11 +5186,11 @@ Text larger than the specified size is clipped. */)
5185 show it. */ 5186 show it. */
5186 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); 5187 compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y);
5187 5188
5188 BLOCK_INPUT; 5189 block_input ();
5189 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5190 XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5190 root_x, root_y, width, height); 5191 root_x, root_y, width, height);
5191 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 5192 XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
5192 UNBLOCK_INPUT; 5193 unblock_input ();
5193 5194
5194 /* Draw into the window. */ 5195 /* Draw into the window. */
5195 w->must_be_updated_p = 1; 5196 w->must_be_updated_p = 1;
@@ -5261,9 +5262,9 @@ Value is t if tooltip was open, nil otherwise. */)
5261 if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen) 5262 if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen)
5262 && w != NULL) 5263 && w != NULL)
5263 { 5264 {
5264 BLOCK_INPUT; 5265 block_input ();
5265 xlwmenu_redisplay (w); 5266 xlwmenu_redisplay (w);
5266 UNBLOCK_INPUT; 5267 unblock_input ();
5267 } 5268 }
5268 } 5269 }
5269#endif /* USE_LUCID */ 5270#endif /* USE_LUCID */
@@ -5327,11 +5328,11 @@ clean_up_file_dialog (Lisp_Object arg)
5327 Widget dialog = (Widget) p->pointer; 5328 Widget dialog = (Widget) p->pointer;
5328 5329
5329 /* Clean up. */ 5330 /* Clean up. */
5330 BLOCK_INPUT; 5331 block_input ();
5331 XtUnmanageChild (dialog); 5332 XtUnmanageChild (dialog);
5332 XtDestroyWidget (dialog); 5333 XtDestroyWidget (dialog);
5333 x_menu_set_in_use (0); 5334 x_menu_set_in_use (0);
5334 UNBLOCK_INPUT; 5335 unblock_input ();
5335 5336
5336 return Qnil; 5337 return Qnil;
5337} 5338}
@@ -5372,7 +5373,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5372 /* Prevent redisplay. */ 5373 /* Prevent redisplay. */
5373 specbind (Qinhibit_redisplay, Qt); 5374 specbind (Qinhibit_redisplay, Qt);
5374 5375
5375 BLOCK_INPUT; 5376 block_input ();
5376 5377
5377 /* Create the dialog with PROMPT as title, using DIR as initial 5378 /* Create the dialog with PROMPT as title, using DIR as initial
5378 directory and using "*" as pattern. */ 5379 directory and using "*" as pattern. */
@@ -5486,7 +5487,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5486 else 5487 else
5487 file = Qnil; 5488 file = Qnil;
5488 5489
5489 UNBLOCK_INPUT; 5490 unblock_input ();
5490 UNGCPRO; 5491 UNGCPRO;
5491 5492
5492 /* Make "Cancel" equivalent to C-g. */ 5493 /* Make "Cancel" equivalent to C-g. */
@@ -5543,7 +5544,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5543 specbind (Qinhibit_redisplay, Qt); 5544 specbind (Qinhibit_redisplay, Qt);
5544 record_unwind_protect (clean_up_dialog, Qnil); 5545 record_unwind_protect (clean_up_dialog, Qnil);
5545 5546
5546 BLOCK_INPUT; 5547 block_input ();
5547 5548
5548 if (STRINGP (default_filename)) 5549 if (STRINGP (default_filename))
5549 cdef_file = SSDATA (default_filename); 5550 cdef_file = SSDATA (default_filename);
@@ -5560,7 +5561,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
5560 xfree (fn); 5561 xfree (fn);
5561 } 5562 }
5562 5563
5563 UNBLOCK_INPUT; 5564 unblock_input ();
5564 UNGCPRO; 5565 UNGCPRO;
5565 5566
5566 /* Make "Cancel" equivalent to C-g. */ 5567 /* Make "Cancel" equivalent to C-g. */
@@ -5600,7 +5601,7 @@ nil, it defaults to the selected frame. */)
5600 specbind (Qinhibit_redisplay, Qt); 5601 specbind (Qinhibit_redisplay, Qt);
5601 record_unwind_protect (clean_up_dialog, Qnil); 5602 record_unwind_protect (clean_up_dialog, Qnil);
5602 5603
5603 BLOCK_INPUT; 5604 block_input ();
5604 5605
5605 GCPRO2 (font_param, font); 5606 GCPRO2 (font_param, font);
5606 5607
@@ -5618,7 +5619,7 @@ nil, it defaults to the selected frame. */)
5618 font = xg_get_font (f, default_name); 5619 font = xg_get_font (f, default_name);
5619 xfree (default_name); 5620 xfree (default_name);
5620 5621
5621 UNBLOCK_INPUT; 5622 unblock_input ();
5622 5623
5623 if (NILP (font)) 5624 if (NILP (font))
5624 Fsignal (Qquit, Qnil); 5625 Fsignal (Qquit, Qnil);
@@ -5655,14 +5656,14 @@ present and mapped to the usual X keysyms. */)
5655 Lisp_Object have_keys; 5656 Lisp_Object have_keys;
5656 int major, minor, op, event, error_code; 5657 int major, minor, op, event, error_code;
5657 5658
5658 BLOCK_INPUT; 5659 block_input ();
5659 5660
5660 /* Check library version in case we're dynamically linked. */ 5661 /* Check library version in case we're dynamically linked. */
5661 major = XkbMajorVersion; 5662 major = XkbMajorVersion;
5662 minor = XkbMinorVersion; 5663 minor = XkbMinorVersion;
5663 if (!XkbLibraryVersion (&major, &minor)) 5664 if (!XkbLibraryVersion (&major, &minor))
5664 { 5665 {
5665 UNBLOCK_INPUT; 5666 unblock_input ();
5666 return Qlambda; 5667 return Qlambda;
5667 } 5668 }
5668 5669
@@ -5671,7 +5672,7 @@ present and mapped to the usual X keysyms. */)
5671 minor = XkbMinorVersion; 5672 minor = XkbMinorVersion;
5672 if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor)) 5673 if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor))
5673 { 5674 {
5674 UNBLOCK_INPUT; 5675 unblock_input ();
5675 return Qlambda; 5676 return Qlambda;
5676 } 5677 }
5677 5678
@@ -5724,7 +5725,7 @@ present and mapped to the usual X keysyms. */)
5724 && XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode) 5725 && XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode)
5725 have_keys = Qt; 5726 have_keys = Qt;
5726 } 5727 }
5727 UNBLOCK_INPUT; 5728 unblock_input ();
5728 return have_keys; 5729 return have_keys;
5729#else /* not HAVE_XKBGETKEYBOARD */ 5730#else /* not HAVE_XKBGETKEYBOARD */
5730 return Qlambda; 5731 return Qlambda;
diff --git a/src/xfont.c b/src/xfont.c
index 1f2fd13f1b7..2d493088b0b 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -362,7 +362,7 @@ xfont_list_pattern (Display *display, const char *pattern,
362 } 362 }
363 } 363 }
364 364
365 BLOCK_INPUT; 365 block_input ();
366 x_catch_errors (display); 366 x_catch_errors (display);
367 367
368 for (limit = 512; ; limit *= 2) 368 for (limit = 512; ; limit *= 2)
@@ -479,7 +479,7 @@ xfont_list_pattern (Display *display, const char *pattern,
479 } 479 }
480 480
481 x_uncatch_errors (); 481 x_uncatch_errors ();
482 UNBLOCK_INPUT; 482 unblock_input ();
483 483
484 FONT_ADD_LOG ("xfont-list", build_string (pattern), list); 484 FONT_ADD_LOG ("xfont-list", build_string (pattern), list);
485 return list; 485 return list;
@@ -588,7 +588,7 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
588 if (xfont_encode_coding_xlfd (name) < 0) 588 if (xfont_encode_coding_xlfd (name) < 0)
589 return Qnil; 589 return Qnil;
590 590
591 BLOCK_INPUT; 591 block_input ();
592 entity = Qnil; 592 entity = Qnil;
593 xfont = XLoadQueryFont (display, name); 593 xfont = XLoadQueryFont (display, name);
594 if (xfont) 594 if (xfont)
@@ -615,7 +615,7 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
615 } 615 }
616 XFreeFont (display, xfont); 616 XFreeFont (display, xfont);
617 } 617 }
618 UNBLOCK_INPUT; 618 unblock_input ();
619 619
620 FONT_ADD_LOG ("xfont-match", spec, entity); 620 FONT_ADD_LOG ("xfont-match", spec, entity);
621 return entity; 621 return entity;
@@ -632,7 +632,7 @@ xfont_list_family (Lisp_Object frame)
632 char *last_family IF_LINT (= 0); 632 char *last_family IF_LINT (= 0);
633 int last_len; 633 int last_len;
634 634
635 BLOCK_INPUT; 635 block_input ();
636 x_catch_errors (dpyinfo->display); 636 x_catch_errors (dpyinfo->display);
637 names = XListFonts (dpyinfo->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", 637 names = XListFonts (dpyinfo->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*",
638 0x8000, &num_fonts); 638 0x8000, &num_fonts);
@@ -673,7 +673,7 @@ xfont_list_family (Lisp_Object frame)
673 673
674 XFreeFontNames (names); 674 XFreeFontNames (names);
675 x_uncatch_errors (); 675 x_uncatch_errors ();
676 UNBLOCK_INPUT; 676 unblock_input ();
677 677
678 return list; 678 return list;
679} 679}
@@ -717,7 +717,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
717 return Qnil; 717 return Qnil;
718 } 718 }
719 719
720 BLOCK_INPUT; 720 block_input ();
721 x_catch_errors (display); 721 x_catch_errors (display);
722 xfont = XLoadQueryFont (display, name); 722 xfont = XLoadQueryFont (display, name);
723 if (x_had_errors_p (display)) 723 if (x_had_errors_p (display))
@@ -784,7 +784,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
784 XFree (p0); 784 XFree (p0);
785 } 785 }
786 x_uncatch_errors (); 786 x_uncatch_errors ();
787 UNBLOCK_INPUT; 787 unblock_input ();
788 788
789 if (! xfont) 789 if (! xfont)
790 { 790 {
@@ -866,7 +866,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
866 } 866 }
867 } 867 }
868 868
869 BLOCK_INPUT; 869 block_input ();
870 font->underline_thickness 870 font->underline_thickness
871 = (XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &value) 871 = (XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &value)
872 ? (long) value : 0); 872 ? (long) value : 0);
@@ -882,7 +882,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
882 font->default_ascent 882 font->default_ascent
883 = (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_DEFAULT_ASCENT, &value) 883 = (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_DEFAULT_ASCENT, &value)
884 ? (long) value : 0); 884 ? (long) value : 0);
885 UNBLOCK_INPUT; 885 unblock_input ();
886 886
887 if (NILP (fullname)) 887 if (NILP (fullname))
888 fullname = AREF (font_object, FONT_NAME_INDEX); 888 fullname = AREF (font_object, FONT_NAME_INDEX);
@@ -897,18 +897,18 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
897static void 897static void
898xfont_close (FRAME_PTR f, struct font *font) 898xfont_close (FRAME_PTR f, struct font *font)
899{ 899{
900 BLOCK_INPUT; 900 block_input ();
901 XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); 901 XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont);
902 UNBLOCK_INPUT; 902 unblock_input ();
903} 903}
904 904
905static int 905static int
906xfont_prepare_face (FRAME_PTR f, struct face *face) 906xfont_prepare_face (FRAME_PTR f, struct face *face)
907{ 907{
908 BLOCK_INPUT; 908 block_input ();
909 XSetFont (FRAME_X_DISPLAY (f), face->gc, 909 XSetFont (FRAME_X_DISPLAY (f), face->gc,
910 ((struct xfont_info *) face->font)->xfont->fid); 910 ((struct xfont_info *) face->font)->xfont->fid);
911 UNBLOCK_INPUT; 911 unblock_input ();
912 912
913 return 0; 913 return 0;
914} 914}
@@ -1028,9 +1028,9 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1028 1028
1029 if (s->gc != s->face->gc) 1029 if (s->gc != s->face->gc)
1030 { 1030 {
1031 BLOCK_INPUT; 1031 block_input ();
1032 XSetFont (s->display, gc, xfont->fid); 1032 XSetFont (s->display, gc, xfont->fid);
1033 UNBLOCK_INPUT; 1033 unblock_input ();
1034 } 1034 }
1035 1035
1036 if (xfont->min_byte1 == 0 && xfont->max_byte1 == 0) 1036 if (xfont->min_byte1 == 0 && xfont->max_byte1 == 0)
@@ -1039,7 +1039,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1039 char *str = SAFE_ALLOCA (len); 1039 char *str = SAFE_ALLOCA (len);
1040 for (i = 0; i < len ; i++) 1040 for (i = 0; i < len ; i++)
1041 str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); 1041 str[i] = XCHAR2B_BYTE2 (s->char2b + from + i);
1042 BLOCK_INPUT; 1042 block_input ();
1043 if (with_background) 1043 if (with_background)
1044 { 1044 {
1045 if (s->padding_p) 1045 if (s->padding_p)
@@ -1060,12 +1060,12 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1060 XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), 1060 XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f),
1061 gc, x, y, str, len); 1061 gc, x, y, str, len);
1062 } 1062 }
1063 UNBLOCK_INPUT; 1063 unblock_input ();
1064 SAFE_FREE (); 1064 SAFE_FREE ();
1065 return s->nchars; 1065 return s->nchars;
1066 } 1066 }
1067 1067
1068 BLOCK_INPUT; 1068 block_input ();
1069 if (with_background) 1069 if (with_background)
1070 { 1070 {
1071 if (s->padding_p) 1071 if (s->padding_p)
@@ -1086,7 +1086,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1086 XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), 1086 XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f),
1087 gc, x, y, s->char2b + from, len); 1087 gc, x, y, s->char2b + from, len);
1088 } 1088 }
1089 UNBLOCK_INPUT; 1089 unblock_input ();
1090 1090
1091 return len; 1091 return len;
1092} 1092}
diff --git a/src/xftfont.c b/src/xftfont.c
index 9f52eb8b233..372ed87705f 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -93,7 +93,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
93 XGCValues xgcv; 93 XGCValues xgcv;
94 bool fg_done = 0, bg_done = 0; 94 bool fg_done = 0, bg_done = 0;
95 95
96 BLOCK_INPUT; 96 block_input ();
97 XGetGCValues (FRAME_X_DISPLAY (f), gc, 97 XGetGCValues (FRAME_X_DISPLAY (f), gc,
98 GCForeground | GCBackground, &xgcv); 98 GCForeground | GCBackground, &xgcv);
99 if (xftface_info) 99 if (xftface_info)
@@ -131,7 +131,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info *
131 bg->color.blue = colors[1].blue; 131 bg->color.blue = colors[1].blue;
132 } 132 }
133 } 133 }
134 UNBLOCK_INPUT; 134 unblock_input ();
135 } 135 }
136} 136}
137 137
@@ -324,7 +324,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
324 FcPatternAddInteger (pat, FC_INDEX, XINT (idx)); 324 FcPatternAddInteger (pat, FC_INDEX, XINT (idx));
325 325
326 326
327 BLOCK_INPUT; 327 block_input ();
328 /* Make sure that the Xrender extension is added before the Xft one. 328 /* Make sure that the Xrender extension is added before the Xft one.
329 Otherwise, the close-display hook set by Xft is called after the 329 Otherwise, the close-display hook set by Xft is called after the
330 one for Xrender, and the former tries to re-add the latter. This 330 one for Xrender, and the former tries to re-add the latter. This
@@ -345,12 +345,12 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
345 xftfont = XftFontOpenPattern (display, match); 345 xftfont = XftFontOpenPattern (display, match);
346 if (!xftfont) 346 if (!xftfont)
347 { 347 {
348 UNBLOCK_INPUT; 348 unblock_input ();
349 XftPatternDestroy (match); 349 XftPatternDestroy (match);
350 return Qnil; 350 return Qnil;
351 } 351 }
352 ft_face = XftLockFace (xftfont); 352 ft_face = XftLockFace (xftfont);
353 UNBLOCK_INPUT; 353 unblock_input ();
354 354
355 /* We should not destroy PAT here because it is kept in XFTFONT and 355 /* We should not destroy PAT here because it is kept in XFTFONT and
356 destroyed automatically when XFTFONT is closed. */ 356 destroyed automatically when XFTFONT is closed. */
@@ -399,7 +399,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
399 for (ch = 0; ch < 95; ch++) 399 for (ch = 0; ch < 95; ch++)
400 ascii_printable[ch] = ' ' + ch; 400 ascii_printable[ch] = ' ' + ch;
401 } 401 }
402 BLOCK_INPUT; 402 block_input ();
403 403
404 /* Unfortunately Xft doesn't provide a way to get minimum char 404 /* Unfortunately Xft doesn't provide a way to get minimum char
405 width. So, we set min_width to space_width. */ 405 width. So, we set min_width to space_width. */
@@ -425,7 +425,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
425 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); 425 XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents);
426 font->average_width = (font->space_width + extents.xOff) / 95; 426 font->average_width = (font->space_width + extents.xOff) / 95;
427 } 427 }
428 UNBLOCK_INPUT; 428 unblock_input ();
429 429
430 font->ascent = xftfont->ascent; 430 font->ascent = xftfont->ascent;
431 font->descent = xftfont->descent; 431 font->descent = xftfont->descent;
@@ -494,10 +494,10 @@ xftfont_close (FRAME_PTR f, struct font *font)
494 if (xftfont_info->otf) 494 if (xftfont_info->otf)
495 OTF_close (xftfont_info->otf); 495 OTF_close (xftfont_info->otf);
496#endif 496#endif
497 BLOCK_INPUT; 497 block_input ();
498 XftUnlockFace (xftfont_info->xftfont); 498 XftUnlockFace (xftfont_info->xftfont);
499 XftFontClose (xftfont_info->display, xftfont_info->xftfont); 499 XftFontClose (xftfont_info->display, xftfont_info->xftfont);
500 UNBLOCK_INPUT; 500 unblock_input ();
501} 501}
502 502
503static int 503static int
@@ -581,10 +581,10 @@ xftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct
581 struct xftfont_info *xftfont_info = (struct xftfont_info *) font; 581 struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
582 XGlyphInfo extents; 582 XGlyphInfo extents;
583 583
584 BLOCK_INPUT; 584 block_input ();
585 XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs, 585 XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs,
586 &extents); 586 &extents);
587 UNBLOCK_INPUT; 587 unblock_input ();
588 if (metrics) 588 if (metrics)
589 { 589 {
590 metrics->lbearing = - extents.x; 590 metrics->lbearing = - extents.x;
@@ -603,12 +603,12 @@ xftfont_get_xft_draw (FRAME_PTR f)
603 603
604 if (! xft_draw) 604 if (! xft_draw)
605 { 605 {
606 BLOCK_INPUT; 606 block_input ();
607 xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f), 607 xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f),
608 FRAME_X_WINDOW (f), 608 FRAME_X_WINDOW (f),
609 FRAME_X_VISUAL (f), 609 FRAME_X_VISUAL (f),
610 FRAME_X_COLORMAP (f)); 610 FRAME_X_COLORMAP (f));
611 UNBLOCK_INPUT; 611 unblock_input ();
612 eassert (xft_draw != NULL); 612 eassert (xft_draw != NULL);
613 font_put_frame_data (f, &xftfont_driver, xft_draw); 613 font_put_frame_data (f, &xftfont_driver, xft_draw);
614 } 614 }
@@ -633,7 +633,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y,
633 xftface_info = (struct xftface_info *) face->extra; 633 xftface_info = (struct xftface_info *) face->extra;
634 xftfont_get_colors (f, face, s->gc, xftface_info, 634 xftfont_get_colors (f, face, s->gc, xftface_info,
635 &fg, with_background ? &bg : NULL); 635 &fg, with_background ? &bg : NULL);
636 BLOCK_INPUT; 636 block_input ();
637 if (s->num_clips > 0) 637 if (s->num_clips > 0)
638 XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips); 638 XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips);
639 else 639 else
@@ -654,7 +654,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int x, int y,
654 else 654 else
655 XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, 655 XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont,
656 x, y, code, len); 656 x, y, code, len);
657 UNBLOCK_INPUT; 657 unblock_input ();
658 658
659 return len; 659 return len;
660} 660}
@@ -690,9 +690,9 @@ xftfont_end_for_frame (FRAME_PTR f)
690 690
691 if (xft_draw) 691 if (xft_draw)
692 { 692 {
693 BLOCK_INPUT; 693 block_input ();
694 XftDrawDestroy (xft_draw); 694 XftDrawDestroy (xft_draw);
695 UNBLOCK_INPUT; 695 unblock_input ();
696 font_put_frame_data (f, &xftfont_driver, NULL); 696 font_put_frame_data (f, &xftfont_driver, NULL);
697 } 697 }
698 return 0; 698 return 0;
diff --git a/src/xmenu.c b/src/xmenu.c
index d03a4bc974b..96a1ae87fdc 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -165,7 +165,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y)
165 if (! FRAME_X_P (f)) 165 if (! FRAME_X_P (f))
166 emacs_abort (); 166 emacs_abort ();
167 167
168 BLOCK_INPUT; 168 block_input ();
169 169
170 XQueryPointer (FRAME_X_DISPLAY (f), 170 XQueryPointer (FRAME_X_DISPLAY (f),
171 DefaultRootWindow (FRAME_X_DISPLAY (f)), 171 DefaultRootWindow (FRAME_X_DISPLAY (f)),
@@ -186,7 +186,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y)
186 we don't care. */ 186 we don't care. */
187 (unsigned int *) &dummy); 187 (unsigned int *) &dummy);
188 188
189 UNBLOCK_INPUT; 189 unblock_input ();
190 190
191 /* xmenu_show expects window coordinates, not root window 191 /* xmenu_show expects window coordinates, not root window
192 coordinates. Translate. */ 192 coordinates. Translate. */
@@ -328,9 +328,9 @@ for instance using the window manager, then this produces a quit and
328 list_of_panes (Fcons (contents, Qnil)); 328 list_of_panes (Fcons (contents, Qnil));
329 329
330 /* Display them in a dialog box. */ 330 /* Display them in a dialog box. */
331 BLOCK_INPUT; 331 block_input ();
332 selection = xdialog_show (f, 0, title, header, &error_name); 332 selection = xdialog_show (f, 0, title, header, &error_name);
333 UNBLOCK_INPUT; 333 unblock_input ();
334 334
335 unbind_to (specpdl_count, Qnil); 335 unbind_to (specpdl_count, Qnil);
336 discard_menu_items (); 336 discard_menu_items ();
@@ -490,7 +490,7 @@ If FRAME is nil or not given, use the selected frame. */)
490 XEvent ev; 490 XEvent ev;
491 FRAME_PTR f = check_x_frame (frame); 491 FRAME_PTR f = check_x_frame (frame);
492 Widget menubar; 492 Widget menubar;
493 BLOCK_INPUT; 493 block_input ();
494 494
495 if (FRAME_EXTERNAL_MENU_BAR (f)) 495 if (FRAME_EXTERNAL_MENU_BAR (f))
496 set_frame_menubar (f, 0, 1); 496 set_frame_menubar (f, 0, 1);
@@ -548,7 +548,7 @@ If FRAME is nil or not given, use the selected frame. */)
548 } 548 }
549 } 549 }
550 550
551 UNBLOCK_INPUT; 551 unblock_input ();
552 552
553 return Qnil; 553 return Qnil;
554} 554}
@@ -569,9 +569,9 @@ If FRAME is nil or not given, use the selected frame. */)
569 FRAME_PTR f; 569 FRAME_PTR f;
570 570
571 /* gcc 2.95 doesn't accept the FRAME_PTR declaration after 571 /* gcc 2.95 doesn't accept the FRAME_PTR declaration after
572 BLOCK_INPUT. */ 572 block_input (). */
573 573
574 BLOCK_INPUT; 574 block_input ();
575 f = check_x_frame (frame); 575 f = check_x_frame (frame);
576 576
577 if (FRAME_EXTERNAL_MENU_BAR (f)) 577 if (FRAME_EXTERNAL_MENU_BAR (f))
@@ -590,7 +590,7 @@ If FRAME is nil or not given, use the selected frame. */)
590 g_list_free (children); 590 g_list_free (children);
591 } 591 }
592 } 592 }
593 UNBLOCK_INPUT; 593 unblock_input ();
594 594
595 return Qnil; 595 return Qnil;
596} 596}
@@ -642,7 +642,7 @@ x_activate_menubar (FRAME_PTR f)
642#endif 642#endif
643 643
644 set_frame_menubar (f, 0, 1); 644 set_frame_menubar (f, 0, 1);
645 BLOCK_INPUT; 645 block_input ();
646 popup_activated_flag = 1; 646 popup_activated_flag = 1;
647#ifdef USE_GTK 647#ifdef USE_GTK
648 XPutBackEvent (f->output_data.x->display_info->display, 648 XPutBackEvent (f->output_data.x->display_info->display,
@@ -650,7 +650,7 @@ x_activate_menubar (FRAME_PTR f)
650#else 650#else
651 XtDispatchEvent (f->output_data.x->saved_menu_event); 651 XtDispatchEvent (f->output_data.x->saved_menu_event);
652#endif 652#endif
653 UNBLOCK_INPUT; 653 unblock_input ();
654 654
655 /* Ignore this if we get it a second time. */ 655 /* Ignore this if we get it a second time. */
656 f->output_data.x->saved_menu_event->type = 0; 656 f->output_data.x->saved_menu_event->type = 0;
@@ -803,10 +803,10 @@ menubar_selection_callback (GtkWidget *widget, gpointer client_data)
803 sit-for will exit at once if the focus event follows the menu selection 803 sit-for will exit at once if the focus event follows the menu selection
804 event. */ 804 event. */
805 805
806 BLOCK_INPUT; 806 block_input ();
807 while (gtk_events_pending ()) 807 while (gtk_events_pending ())
808 gtk_main_iteration (); 808 gtk_main_iteration ();
809 UNBLOCK_INPUT; 809 unblock_input ();
810 810
811 find_and_call_menu_selection (cb_data->cl_data->f, 811 find_and_call_menu_selection (cb_data->cl_data->f,
812 cb_data->cl_data->menu_bar_items_used, 812 cb_data->cl_data->menu_bar_items_used,
@@ -834,13 +834,13 @@ menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
834#endif /* not USE_GTK */ 834#endif /* not USE_GTK */
835 835
836/* Recompute all the widgets of frame F, when the menu bar has been 836/* Recompute all the widgets of frame F, when the menu bar has been
837 changed. Value is non-zero if widgets were updated. */ 837 changed. */
838 838
839static int 839static void
840update_frame_menubar (FRAME_PTR f) 840update_frame_menubar (FRAME_PTR f)
841{ 841{
842#ifdef USE_GTK 842#ifdef USE_GTK
843 return xg_update_frame_menubar (f); 843 xg_update_frame_menubar (f);
844#else 844#else
845 struct x_output *x; 845 struct x_output *x;
846 int columns, rows; 846 int columns, rows;
@@ -851,9 +851,9 @@ update_frame_menubar (FRAME_PTR f)
851 x = f->output_data.x; 851 x = f->output_data.x;
852 852
853 if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) 853 if (!x->menubar_widget || XtIsManaged (x->menubar_widget))
854 return 0; 854 return;
855 855
856 BLOCK_INPUT; 856 block_input ();
857 /* Save the size of the frame because the pane widget doesn't accept 857 /* Save the size of the frame because the pane widget doesn't accept
858 to resize itself. So force it. */ 858 to resize itself. So force it. */
859 columns = FRAME_COLS (f); 859 columns = FRAME_COLS (f);
@@ -880,9 +880,8 @@ update_frame_menubar (FRAME_PTR f)
880 880
881 /* Force the pane widget to resize itself with the right values. */ 881 /* Force the pane widget to resize itself with the right values. */
882 EmacsFrameSetCharSize (x->edit_widget, columns, rows); 882 EmacsFrameSetCharSize (x->edit_widget, columns, rows);
883 UNBLOCK_INPUT; 883 unblock_input ();
884#endif 884#endif
885 return 1;
886} 885}
887 886
888#ifdef USE_LUCID 887#ifdef USE_LUCID
@@ -921,7 +920,7 @@ apply_systemfont_to_menu (struct frame *f, Widget w)
921 it is set the first time this is called, from initialize_frame_menubar. */ 920 it is set the first time this is called, from initialize_frame_menubar. */
922 921
923void 922void
924set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) 923set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
925{ 924{
926 xt_or_gtk_widget menubar_widget; 925 xt_or_gtk_widget menubar_widget;
927#ifdef USE_X_TOOLKIT 926#ifdef USE_X_TOOLKIT
@@ -1164,7 +1163,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1164 1163
1165 /* Create or update the menu bar widget. */ 1164 /* Create or update the menu bar widget. */
1166 1165
1167 BLOCK_INPUT; 1166 block_input ();
1168 1167
1169#ifdef USE_GTK 1168#ifdef USE_GTK
1170 xg_crazy_callback_abort = 1; 1169 xg_crazy_callback_abort = 1;
@@ -1264,7 +1263,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1264 xg_crazy_callback_abort = 0; 1263 xg_crazy_callback_abort = 0;
1265#endif 1264#endif
1266 1265
1267 UNBLOCK_INPUT; 1266 unblock_input ();
1268} 1267}
1269 1268
1270/* Called from Fx_create_frame to create the initial menubar of a frame 1269/* Called from Fx_create_frame to create the initial menubar of a frame
@@ -1313,7 +1312,7 @@ free_frame_menubar (FRAME_PTR f)
1313 Position x0, y0, x1, y1; 1312 Position x0, y0, x1, y1;
1314#endif 1313#endif
1315 1314
1316 BLOCK_INPUT; 1315 block_input ();
1317 1316
1318#ifdef USE_MOTIF 1317#ifdef USE_MOTIF
1319 if (f->output_data.x->widget) 1318 if (f->output_data.x->widget)
@@ -1332,7 +1331,7 @@ free_frame_menubar (FRAME_PTR f)
1332#endif 1331#endif
1333 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); 1332 x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f));
1334 } 1333 }
1335 UNBLOCK_INPUT; 1334 unblock_input ();
1336 } 1335 }
1337} 1336}
1338#endif /* not USE_GTK */ 1337#endif /* not USE_GTK */
@@ -1417,9 +1416,9 @@ pop_down_menu (Lisp_Object arg)
1417 struct Lisp_Save_Value *p = XSAVE_VALUE (arg); 1416 struct Lisp_Save_Value *p = XSAVE_VALUE (arg);
1418 1417
1419 popup_activated_flag = 0; 1418 popup_activated_flag = 0;
1420 BLOCK_INPUT; 1419 block_input ();
1421 gtk_widget_destroy (GTK_WIDGET (p->pointer)); 1420 gtk_widget_destroy (GTK_WIDGET (p->pointer));
1422 UNBLOCK_INPUT; 1421 unblock_input ();
1423 return Qnil; 1422 return Qnil;
1424} 1423}
1425 1424
@@ -1527,9 +1526,9 @@ pop_down_menu (Lisp_Object arg)
1527 LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID) 1526 LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID)
1528 | XINT (XCDR (arg))); 1527 | XINT (XCDR (arg)));
1529 1528
1530 BLOCK_INPUT; 1529 block_input ();
1531 lw_destroy_all_widgets (id); 1530 lw_destroy_all_widgets (id);
1532 UNBLOCK_INPUT; 1531 unblock_input ();
1533 popup_activated_flag = 0; 1532 popup_activated_flag = 0;
1534 1533
1535 return Qnil; 1534 return Qnil;
@@ -1955,9 +1954,9 @@ dialog_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data)
1955 if ((intptr_t) client_data != -1) 1954 if ((intptr_t) client_data != -1)
1956 menu_item_selection = (Lisp_Object *) client_data; 1955 menu_item_selection = (Lisp_Object *) client_data;
1957 1956
1958 BLOCK_INPUT; 1957 block_input ();
1959 lw_destroy_all_widgets (id); 1958 lw_destroy_all_widgets (id);
1960 UNBLOCK_INPUT; 1959 unblock_input ();
1961 popup_activated_flag = 0; 1960 popup_activated_flag = 0;
1962} 1961}
1963 1962
@@ -2251,7 +2250,7 @@ pop_down_menu (Lisp_Object arg)
2251 FRAME_PTR f = p1->pointer; 2250 FRAME_PTR f = p1->pointer;
2252 XMenu *menu = p2->pointer; 2251 XMenu *menu = p2->pointer;
2253 2252
2254 BLOCK_INPUT; 2253 block_input ();
2255#ifndef MSDOS 2254#ifndef MSDOS
2256 XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime); 2255 XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime);
2257 XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime); 2256 XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime);
@@ -2271,7 +2270,7 @@ pop_down_menu (Lisp_Object arg)
2271 2270
2272#endif /* HAVE_X_WINDOWS */ 2271#endif /* HAVE_X_WINDOWS */
2273 2272
2274 UNBLOCK_INPUT; 2273 unblock_input ();
2275 2274
2276 return Qnil; 2275 return Qnil;
2277} 2276}
diff --git a/src/xml.c b/src/xml.c
index b668525cf26..a22ca208743 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -82,7 +82,7 @@ libxml2_loaded_p (void)
82#endif /* !WINDOWSNT */ 82#endif /* !WINDOWSNT */
83 83
84static int 84static int
85init_libxml2_functions (Lisp_Object libraries) 85init_libxml2_functions (void)
86{ 86{
87#ifdef WINDOWSNT 87#ifdef WINDOWSNT
88 if (libxml2_loaded_p ()) 88 if (libxml2_loaded_p ())
@@ -91,7 +91,7 @@ init_libxml2_functions (Lisp_Object libraries)
91 { 91 {
92 HMODULE library; 92 HMODULE library;
93 93
94 if (!(library = w32_delayed_load (libraries, Qlibxml2_dll))) 94 if (!(library = w32_delayed_load (Qlibxml2_dll)))
95 { 95 {
96 message ("%s", "libxml2 library not found"); 96 message ("%s", "libxml2 library not found");
97 return 0; 97 return 0;
@@ -257,7 +257,7 @@ DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
257If BASE-URL is non-nil, it is used to expand relative URLs. */) 257If BASE-URL is non-nil, it is used to expand relative URLs. */)
258 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) 258 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
259{ 259{
260 if (init_libxml2_functions (Vdynamic_library_alist)) 260 if (init_libxml2_functions ())
261 return parse_region (start, end, base_url, 1); 261 return parse_region (start, end, base_url, 1);
262 return Qnil; 262 return Qnil;
263} 263}
@@ -269,7 +269,7 @@ DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region,
269If BASE-URL is non-nil, it is used to expand relative URLs. */) 269If BASE-URL is non-nil, it is used to expand relative URLs. */)
270 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) 270 (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
271{ 271{
272 if (init_libxml2_functions (Vdynamic_library_alist)) 272 if (init_libxml2_functions ())
273 return parse_region (start, end, base_url, 0); 273 return parse_region (start, end, base_url, 0);
274 return Qnil; 274 return Qnil;
275} 275}
diff --git a/src/xselect.c b/src/xselect.c
index ab199e0b9b9..de9386bd7d9 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -247,9 +247,9 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Lisp_Object sym)
247 if (!SYMBOLP (sym)) emacs_abort (); 247 if (!SYMBOLP (sym)) emacs_abort ();
248 248
249 TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym))); 249 TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym)));
250 BLOCK_INPUT; 250 block_input ();
251 val = XInternAtom (dpyinfo->display, SSDATA (SYMBOL_NAME (sym)), False); 251 val = XInternAtom (dpyinfo->display, SSDATA (SYMBOL_NAME (sym)), False);
252 UNBLOCK_INPUT; 252 unblock_input ();
253 return val; 253 return val;
254} 254}
255 255
@@ -307,16 +307,16 @@ x_atom_to_symbol (Display *dpy, Atom atom)
307 if (atom == dpyinfo->Xatom_NULL) 307 if (atom == dpyinfo->Xatom_NULL)
308 return QNULL; 308 return QNULL;
309 309
310 BLOCK_INPUT; 310 block_input ();
311 str = XGetAtomName (dpy, atom); 311 str = XGetAtomName (dpy, atom);
312 UNBLOCK_INPUT; 312 unblock_input ();
313 TRACE1 ("XGetAtomName --> %s", str); 313 TRACE1 ("XGetAtomName --> %s", str);
314 if (! str) return Qnil; 314 if (! str) return Qnil;
315 val = intern (str); 315 val = intern (str);
316 BLOCK_INPUT; 316 block_input ();
317 /* This was allocated by Xlib, so use XFree. */ 317 /* This was allocated by Xlib, so use XFree. */
318 XFree (str); 318 XFree (str);
319 UNBLOCK_INPUT; 319 unblock_input ();
320 return val; 320 return val;
321} 321}
322 322
@@ -336,12 +336,12 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
336 Time timestamp = last_event_timestamp; 336 Time timestamp = last_event_timestamp;
337 Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name); 337 Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name);
338 338
339 BLOCK_INPUT; 339 block_input ();
340 x_catch_errors (display); 340 x_catch_errors (display);
341 XSetSelectionOwner (display, selection_atom, selecting_window, timestamp); 341 XSetSelectionOwner (display, selection_atom, selecting_window, timestamp);
342 x_check_errors (display, "Can't set selection: %s"); 342 x_check_errors (display, "Can't set selection: %s");
343 x_uncatch_errors (); 343 x_uncatch_errors ();
344 UNBLOCK_INPUT; 344 unblock_input ();
345 345
346 /* Now update the local cache */ 346 /* Now update the local cache */
347 { 347 {
@@ -469,12 +469,12 @@ x_decline_selection_request (struct input_event *event)
469 469
470 /* The reason for the error may be that the receiver has 470 /* The reason for the error may be that the receiver has
471 died in the meantime. Handle that case. */ 471 died in the meantime. Handle that case. */
472 BLOCK_INPUT; 472 block_input ();
473 x_catch_errors (reply->display); 473 x_catch_errors (reply->display);
474 XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base); 474 XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base);
475 XFlush (reply->display); 475 XFlush (reply->display);
476 x_uncatch_errors (); 476 x_uncatch_errors ();
477 UNBLOCK_INPUT; 477 unblock_input ();
478} 478}
479 479
480/* This is the selection request currently being processed. 480/* This is the selection request currently being processed.
@@ -536,9 +536,9 @@ x_selection_request_lisp_error (Lisp_Object ignore)
536static Lisp_Object 536static Lisp_Object
537x_catch_errors_unwind (Lisp_Object dummy) 537x_catch_errors_unwind (Lisp_Object dummy)
538{ 538{
539 BLOCK_INPUT; 539 block_input ();
540 x_uncatch_errors (); 540 x_uncatch_errors ();
541 UNBLOCK_INPUT; 541 unblock_input ();
542 return Qnil; 542 return Qnil;
543} 543}
544 544
@@ -610,7 +610,7 @@ x_reply_selection_request (struct input_event *event,
610 if (reply->property == None) 610 if (reply->property == None)
611 reply->property = reply->target; 611 reply->property = reply->target;
612 612
613 BLOCK_INPUT; 613 block_input ();
614 /* The protected block contains wait_for_property_change, which can 614 /* The protected block contains wait_for_property_change, which can
615 run random lisp code (process handlers) or signal. Therefore, we 615 run random lisp code (process handlers) or signal. Therefore, we
616 put the x_uncatch_errors call in an unwind. */ 616 put the x_uncatch_errors call in an unwind. */
@@ -682,7 +682,7 @@ x_reply_selection_request (struct input_event *event,
682 { 682 {
683 int format_bytes = cs->format / 8; 683 int format_bytes = cs->format / 8;
684 int had_errors = x_had_errors_p (display); 684 int had_errors = x_had_errors_p (display);
685 UNBLOCK_INPUT; 685 unblock_input ();
686 686
687 bytes_remaining = cs->size; 687 bytes_remaining = cs->size;
688 bytes_remaining *= format_bytes; 688 bytes_remaining *= format_bytes;
@@ -703,7 +703,7 @@ x_reply_selection_request (struct input_event *event,
703 int i = ((bytes_remaining < max_bytes) 703 int i = ((bytes_remaining < max_bytes)
704 ? bytes_remaining 704 ? bytes_remaining
705 : max_bytes) / format_bytes; 705 : max_bytes) / format_bytes;
706 BLOCK_INPUT; 706 block_input ();
707 707
708 cs->wait_object 708 cs->wait_object
709 = expect_property_change (display, window, cs->property, 709 = expect_property_change (display, window, cs->property,
@@ -722,7 +722,7 @@ x_reply_selection_request (struct input_event *event,
722 : format_bytes); 722 : format_bytes);
723 XFlush (display); 723 XFlush (display);
724 had_errors = x_had_errors_p (display); 724 had_errors = x_had_errors_p (display);
725 UNBLOCK_INPUT; 725 unblock_input ();
726 726
727 if (had_errors) break; 727 if (had_errors) break;
728 728
@@ -735,7 +735,7 @@ x_reply_selection_request (struct input_event *event,
735 735
736 /* Now write a zero-length chunk to the property to tell the 736 /* Now write a zero-length chunk to the property to tell the
737 requestor that we're done. */ 737 requestor that we're done. */
738 BLOCK_INPUT; 738 block_input ();
739 if (! waiting_for_other_props_on_window (display, window)) 739 if (! waiting_for_other_props_on_window (display, window))
740 XSelectInput (display, window, 0L); 740 XSelectInput (display, window, 0L);
741 741
@@ -757,15 +757,15 @@ x_reply_selection_request (struct input_event *event,
757 /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are 757 /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are
758 delivered before uncatch errors. */ 758 delivered before uncatch errors. */
759 XSync (display, False); 759 XSync (display, False);
760 UNBLOCK_INPUT; 760 unblock_input ();
761 761
762 /* GTK queues events in addition to the queue in Xlib. So we 762 /* GTK queues events in addition to the queue in Xlib. So we
763 UNBLOCK to enter the event loop and get possible errors delivered, 763 UNBLOCK to enter the event loop and get possible errors delivered,
764 and then BLOCK again because x_uncatch_errors requires it. */ 764 and then BLOCK again because x_uncatch_errors requires it. */
765 BLOCK_INPUT; 765 block_input ();
766 /* This calls x_uncatch_errors. */ 766 /* This calls x_uncatch_errors. */
767 unbind_to (count, Qnil); 767 unbind_to (count, Qnil);
768 UNBLOCK_INPUT; 768 unblock_input ();
769} 769}
770 770
771/* Handle a SelectionRequest event EVENT. 771/* Handle a SelectionRequest event EVENT.
@@ -1232,7 +1232,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
1232 if (! NILP (time_stamp)) 1232 if (! NILP (time_stamp))
1233 CONS_TO_INTEGER (time_stamp, Time, requestor_time); 1233 CONS_TO_INTEGER (time_stamp, Time, requestor_time);
1234 1234
1235 BLOCK_INPUT; 1235 block_input ();
1236 TRACE2 ("Get selection %s, type %s", 1236 TRACE2 ("Get selection %s, type %s",
1237 XGetAtomName (display, type_atom), 1237 XGetAtomName (display, type_atom),
1238 XGetAtomName (display, target_property)); 1238 XGetAtomName (display, target_property));
@@ -1257,7 +1257,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
1257 record_unwind_protect (queue_selection_requests_unwind, Qnil); 1257 record_unwind_protect (queue_selection_requests_unwind, Qnil);
1258#endif 1258#endif
1259 1259
1260 UNBLOCK_INPUT; 1260 unblock_input ();
1261 1261
1262 /* This allows quits. Also, don't wait forever. */ 1262 /* This allows quits. Also, don't wait forever. */
1263 timeout = max (0, x_selection_timeout); 1263 timeout = max (0, x_selection_timeout);
@@ -1309,7 +1309,7 @@ x_get_window_property (Display *display, Window window, Atom property,
1309 ? min (PTRDIFF_MAX, SIZE_MAX) - 1 1309 ? min (PTRDIFF_MAX, SIZE_MAX) - 1
1310 : LONG_MAX * x_long_size); 1310 : LONG_MAX * x_long_size);
1311 1311
1312 BLOCK_INPUT; 1312 block_input ();
1313 1313
1314 /* First probe the thing to find out how big it is. */ 1314 /* First probe the thing to find out how big it is. */
1315 result = XGetWindowProperty (display, window, property, 1315 result = XGetWindowProperty (display, window, property,
@@ -1410,19 +1410,19 @@ x_get_window_property (Display *display, Window window, Atom property,
1410 data[offset] = '\0'; 1410 data[offset] = '\0';
1411 1411
1412 done: 1412 done:
1413 UNBLOCK_INPUT; 1413 unblock_input ();
1414 *data_ret = data; 1414 *data_ret = data;
1415 *bytes_ret = offset; 1415 *bytes_ret = offset;
1416 return; 1416 return;
1417 1417
1418 size_overflow: 1418 size_overflow:
1419 free (data); 1419 free (data);
1420 UNBLOCK_INPUT; 1420 unblock_input ();
1421 memory_full (SIZE_MAX); 1421 memory_full (SIZE_MAX);
1422 1422
1423 memory_exhausted: 1423 memory_exhausted:
1424 free (data); 1424 free (data);
1425 UNBLOCK_INPUT; 1425 unblock_input ();
1426 memory_full (total_size + 1); 1426 memory_full (total_size + 1);
1427} 1427}
1428 1428
@@ -1454,7 +1454,7 @@ receive_incremental_selection (Display *display, Window window, Atom property,
1454 that property, then reading the property, then deleting it to ack. 1454 that property, then reading the property, then deleting it to ack.
1455 We are done when the sender places a property of length 0. 1455 We are done when the sender places a property of length 0.
1456 */ 1456 */
1457 BLOCK_INPUT; 1457 block_input ();
1458 XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask); 1458 XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask);
1459 TRACE1 (" Delete property %s", 1459 TRACE1 (" Delete property %s",
1460 SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property)))); 1460 SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property))));
@@ -1464,7 +1464,7 @@ receive_incremental_selection (Display *display, Window window, Atom property,
1464 wait_object = expect_property_change (display, window, property, 1464 wait_object = expect_property_change (display, window, property,
1465 PropertyNewValue); 1465 PropertyNewValue);
1466 XFlush (display); 1466 XFlush (display);
1467 UNBLOCK_INPUT; 1467 unblock_input ();
1468 1468
1469 while (1) 1469 while (1)
1470 { 1470 {
@@ -1496,14 +1496,14 @@ receive_incremental_selection (Display *display, Window window, Atom property,
1496 break; 1496 break;
1497 } 1497 }
1498 1498
1499 BLOCK_INPUT; 1499 block_input ();
1500 TRACE1 (" ACK by deleting property %s", 1500 TRACE1 (" ACK by deleting property %s",
1501 XGetAtomName (display, property)); 1501 XGetAtomName (display, property));
1502 XDeleteProperty (display, window, property); 1502 XDeleteProperty (display, window, property);
1503 wait_object = expect_property_change (display, window, property, 1503 wait_object = expect_property_change (display, window, property,
1504 PropertyNewValue); 1504 PropertyNewValue);
1505 XFlush (display); 1505 XFlush (display);
1506 UNBLOCK_INPUT; 1506 unblock_input ();
1507 1507
1508 if (*size_bytes_ret - offset < tmp_size_bytes) 1508 if (*size_bytes_ret - offset < tmp_size_bytes)
1509 *data_ret = xpalloc (*data_ret, size_bytes_ret, 1509 *data_ret = xpalloc (*data_ret, size_bytes_ret,
@@ -1545,10 +1545,10 @@ x_get_window_property_as_lisp_data (Display *display, Window window,
1545 if (! data) 1545 if (! data)
1546 { 1546 {
1547 int there_is_a_selection_owner; 1547 int there_is_a_selection_owner;
1548 BLOCK_INPUT; 1548 block_input ();
1549 there_is_a_selection_owner 1549 there_is_a_selection_owner
1550 = XGetSelectionOwner (display, selection_atom); 1550 = XGetSelectionOwner (display, selection_atom);
1551 UNBLOCK_INPUT; 1551 unblock_input ();
1552 if (there_is_a_selection_owner) 1552 if (there_is_a_selection_owner)
1553 signal_error ("Selection owner couldn't convert", 1553 signal_error ("Selection owner couldn't convert",
1554 actual_type 1554 actual_type
@@ -1565,22 +1565,22 @@ x_get_window_property_as_lisp_data (Display *display, Window window,
1565 /* That wasn't really the data, just the beginning. */ 1565 /* That wasn't really the data, just the beginning. */
1566 1566
1567 unsigned int min_size_bytes = * ((unsigned int *) data); 1567 unsigned int min_size_bytes = * ((unsigned int *) data);
1568 BLOCK_INPUT; 1568 block_input ();
1569 /* Use xfree, not XFree, because x_get_window_property 1569 /* Use xfree, not XFree, because x_get_window_property
1570 calls xmalloc itself. */ 1570 calls xmalloc itself. */
1571 xfree (data); 1571 xfree (data);
1572 UNBLOCK_INPUT; 1572 unblock_input ();
1573 receive_incremental_selection (display, window, property, target_type, 1573 receive_incremental_selection (display, window, property, target_type,
1574 min_size_bytes, &data, &bytes, 1574 min_size_bytes, &data, &bytes,
1575 &actual_type, &actual_format, 1575 &actual_type, &actual_format,
1576 &actual_size); 1576 &actual_size);
1577 } 1577 }
1578 1578
1579 BLOCK_INPUT; 1579 block_input ();
1580 TRACE1 (" Delete property %s", XGetAtomName (display, property)); 1580 TRACE1 (" Delete property %s", XGetAtomName (display, property));
1581 XDeleteProperty (display, window, property); 1581 XDeleteProperty (display, window, property);
1582 XFlush (display); 1582 XFlush (display);
1583 UNBLOCK_INPUT; 1583 unblock_input ();
1584 1584
1585 /* It's been read. Now convert it to a lisp object in some semi-rational 1585 /* It's been read. Now convert it to a lisp object in some semi-rational
1586 manner. */ 1586 manner. */
@@ -2096,13 +2096,13 @@ On MS-DOS, all this does is return non-nil if we own the selection. */)
2096 2096
2097 selection_atom = symbol_to_x_atom (dpyinfo, selection); 2097 selection_atom = symbol_to_x_atom (dpyinfo, selection);
2098 2098
2099 BLOCK_INPUT; 2099 block_input ();
2100 if (NILP (time_object)) 2100 if (NILP (time_object))
2101 timestamp = last_event_timestamp; 2101 timestamp = last_event_timestamp;
2102 else 2102 else
2103 CONS_TO_INTEGER (time_object, Time, timestamp); 2103 CONS_TO_INTEGER (time_object, Time, timestamp);
2104 XSetSelectionOwner (dpyinfo->display, selection_atom, None, timestamp); 2104 XSetSelectionOwner (dpyinfo->display, selection_atom, None, timestamp);
2105 UNBLOCK_INPUT; 2105 unblock_input ();
2106 2106
2107 /* It doesn't seem to be guaranteed that a SelectionClear event will be 2107 /* It doesn't seem to be guaranteed that a SelectionClear event will be
2108 generated for a window which owns the selection when that window sets 2108 generated for a window which owns the selection when that window sets
@@ -2179,9 +2179,9 @@ On Nextstep, TERMINAL is unused. */)
2179 2179
2180 atom = symbol_to_x_atom (dpyinfo, selection); 2180 atom = symbol_to_x_atom (dpyinfo, selection);
2181 if (atom == 0) return Qnil; 2181 if (atom == 0) return Qnil;
2182 BLOCK_INPUT; 2182 block_input ();
2183 owner = XGetSelectionOwner (dpyinfo->display, atom); 2183 owner = XGetSelectionOwner (dpyinfo->display, atom);
2184 UNBLOCK_INPUT; 2184 unblock_input ();
2185 return (owner ? Qt : Qnil); 2185 return (owner ? Qt : Qnil);
2186} 2186}
2187 2187
@@ -2353,9 +2353,9 @@ x_fill_property_data (Display *dpy, Lisp_Object data, void *ret, int format)
2353 val = cons_to_signed (o, LONG_MIN, LONG_MAX); 2353 val = cons_to_signed (o, LONG_MIN, LONG_MAX);
2354 else if (STRINGP (o)) 2354 else if (STRINGP (o))
2355 { 2355 {
2356 BLOCK_INPUT; 2356 block_input ();
2357 val = (long) XInternAtom (dpy, SSDATA (o), False); 2357 val = (long) XInternAtom (dpy, SSDATA (o), False);
2358 UNBLOCK_INPUT; 2358 unblock_input ();
2359 } 2359 }
2360 else 2360 else
2361 error ("Wrong type, must be string, number or cons"); 2361 error ("Wrong type, must be string, number or cons");
@@ -2413,7 +2413,7 @@ mouse_position_for_drop (FRAME_PTR f, int *x, int *y)
2413 Window root, dummy_window; 2413 Window root, dummy_window;
2414 int dummy; 2414 int dummy;
2415 2415
2416 BLOCK_INPUT; 2416 block_input ();
2417 2417
2418 XQueryPointer (FRAME_X_DISPLAY (f), 2418 XQueryPointer (FRAME_X_DISPLAY (f),
2419 DefaultRootWindow (FRAME_X_DISPLAY (f)), 2419 DefaultRootWindow (FRAME_X_DISPLAY (f)),
@@ -2439,7 +2439,7 @@ mouse_position_for_drop (FRAME_PTR f, int *x, int *y)
2439 *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); 2439 *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
2440 *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); 2440 *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
2441 2441
2442 UNBLOCK_INPUT; 2442 unblock_input ();
2443} 2443}
2444 2444
2445DEFUN ("x-get-atom-name", Fx_get_atom_name, 2445DEFUN ("x-get-atom-name", Fx_get_atom_name,
@@ -2462,7 +2462,7 @@ If the value is 0 or the atom is not known, return the empty string. */)
2462 2462
2463 CONS_TO_INTEGER (value, Atom, atom); 2463 CONS_TO_INTEGER (value, Atom, atom);
2464 2464
2465 BLOCK_INPUT; 2465 block_input ();
2466 x_catch_errors (dpy); 2466 x_catch_errors (dpy);
2467 name = atom ? XGetAtomName (dpy, atom) : empty; 2467 name = atom ? XGetAtomName (dpy, atom) : empty;
2468 had_errors = x_had_errors_p (dpy); 2468 had_errors = x_had_errors_p (dpy);
@@ -2474,7 +2474,7 @@ If the value is 0 or the atom is not known, return the empty string. */)
2474 if (atom && name) XFree (name); 2474 if (atom && name) XFree (name);
2475 if (NILP (ret)) ret = empty_unibyte_string; 2475 if (NILP (ret)) ret = empty_unibyte_string;
2476 2476
2477 UNBLOCK_INPUT; 2477 unblock_input ();
2478 2478
2479 return ret; 2479 return ret;
2480} 2480}
@@ -2496,9 +2496,9 @@ FRAME is on. If FRAME is nil, the selected frame is used. */)
2496 x_atom = symbol_to_x_atom (dpyinfo, atom); 2496 x_atom = symbol_to_x_atom (dpyinfo, atom);
2497 else if (STRINGP (atom)) 2497 else if (STRINGP (atom))
2498 { 2498 {
2499 BLOCK_INPUT; 2499 block_input ();
2500 x_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (atom), False); 2500 x_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (atom), False);
2501 UNBLOCK_INPUT; 2501 unblock_input ();
2502 } 2502 }
2503 else 2503 else
2504 error ("ATOM must be a symbol or a string"); 2504 error ("ATOM must be a symbol or a string");
@@ -2657,7 +2657,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
2657 if (wdest == 0) wdest = dpyinfo->root_window; 2657 if (wdest == 0) wdest = dpyinfo->root_window;
2658 to_root = wdest == dpyinfo->root_window; 2658 to_root = wdest == dpyinfo->root_window;
2659 2659
2660 BLOCK_INPUT; 2660 block_input ();
2661 2661
2662 event.xclient.message_type = message_type; 2662 event.xclient.message_type = message_type;
2663 event.xclient.display = dpyinfo->display; 2663 event.xclient.display = dpyinfo->display;
@@ -2683,7 +2683,7 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
2683 XFlush (dpyinfo->display); 2683 XFlush (dpyinfo->display);
2684 } 2684 }
2685 x_uncatch_errors (); 2685 x_uncatch_errors ();
2686 UNBLOCK_INPUT; 2686 unblock_input ();
2687} 2687}
2688 2688
2689 2689
diff --git a/src/xsettings.c b/src/xsettings.c
index 58c84495489..7c68ff295cf 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -929,7 +929,7 @@ init_xsettings (struct x_display_info *dpyinfo)
929{ 929{
930 Display *dpy = dpyinfo->display; 930 Display *dpy = dpyinfo->display;
931 931
932 BLOCK_INPUT; 932 block_input ();
933 933
934 /* Select events so we can detect client messages sent when selection 934 /* Select events so we can detect client messages sent when selection
935 owner changes. */ 935 owner changes. */
@@ -939,7 +939,7 @@ init_xsettings (struct x_display_info *dpyinfo)
939 if (dpyinfo->xsettings_window != None) 939 if (dpyinfo->xsettings_window != None)
940 read_and_apply_settings (dpyinfo, False); 940 read_and_apply_settings (dpyinfo, False);
941 941
942 UNBLOCK_INPUT; 942 unblock_input ();
943} 943}
944 944
945void 945void
diff --git a/src/xterm.c b/src/xterm.c
index 8c955d0e576..6cd1d583870 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -287,7 +287,7 @@ enum xembed_message
287 287
288/* Used in x_flush. */ 288/* Used in x_flush. */
289 289
290static int x_alloc_nearest_color_1 (Display *, Colormap, XColor *); 290static bool x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
291static void x_set_window_size_1 (struct frame *, int, int, int); 291static void x_set_window_size_1 (struct frame *, int, int, int);
292static void x_raise_frame (struct frame *); 292static void x_raise_frame (struct frame *);
293static void x_lower_frame (struct frame *); 293static void x_lower_frame (struct frame *);
@@ -353,7 +353,7 @@ x_flush (struct frame *f)
353 if (!NILP (Vinhibit_redisplay)) 353 if (!NILP (Vinhibit_redisplay))
354 return; 354 return;
355 355
356 BLOCK_INPUT; 356 block_input ();
357 if (f == NULL) 357 if (f == NULL)
358 { 358 {
359 Lisp_Object rest, frame; 359 Lisp_Object rest, frame;
@@ -363,7 +363,7 @@ x_flush (struct frame *f)
363 } 363 }
364 else if (FRAME_X_P (f)) 364 else if (FRAME_X_P (f))
365 XFlush (FRAME_X_DISPLAY (f)); 365 XFlush (FRAME_X_DISPLAY (f));
366 UNBLOCK_INPUT; 366 unblock_input ();
367} 367}
368 368
369 369
@@ -564,7 +564,7 @@ x_update_window_begin (struct window *w)
564 updated_window = w; 564 updated_window = w;
565 set_output_cursor (&w->cursor); 565 set_output_cursor (&w->cursor);
566 566
567 BLOCK_INPUT; 567 block_input ();
568 568
569 if (f == hlinfo->mouse_face_mouse_frame) 569 if (f == hlinfo->mouse_face_mouse_frame)
570 { 570 {
@@ -577,7 +577,7 @@ x_update_window_begin (struct window *w)
577 hlinfo->mouse_face_window = Qnil; 577 hlinfo->mouse_face_window = Qnil;
578 } 578 }
579 579
580 UNBLOCK_INPUT; 580 unblock_input ();
581} 581}
582 582
583 583
@@ -618,7 +618,7 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt
618 618
619 if (!w->pseudo_window_p) 619 if (!w->pseudo_window_p)
620 { 620 {
621 BLOCK_INPUT; 621 block_input ();
622 622
623 if (cursor_on_p) 623 if (cursor_on_p)
624 display_and_set_cursor (w, 1, output_cursor.hpos, 624 display_and_set_cursor (w, 1, output_cursor.hpos,
@@ -628,7 +628,7 @@ x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritt
628 if (draw_window_fringes (w, 1)) 628 if (draw_window_fringes (w, 1))
629 x_draw_vertical_border (w); 629 x_draw_vertical_border (w);
630 630
631 UNBLOCK_INPUT; 631 unblock_input ();
632 } 632 }
633 633
634 /* If a row with mouse-face was overwritten, arrange for 634 /* If a row with mouse-face was overwritten, arrange for
@@ -654,9 +654,9 @@ x_update_end (struct frame *f)
654 MOUSE_HL_INFO (f)->mouse_face_defer = 0; 654 MOUSE_HL_INFO (f)->mouse_face_defer = 0;
655 655
656#ifndef XFlush 656#ifndef XFlush
657 BLOCK_INPUT; 657 block_input ();
658 XFlush (FRAME_X_DISPLAY (f)); 658 XFlush (FRAME_X_DISPLAY (f));
659 UNBLOCK_INPUT; 659 unblock_input ();
660#endif 660#endif
661} 661}
662 662
@@ -675,13 +675,13 @@ XTframe_up_to_date (struct frame *f)
675 if (hlinfo->mouse_face_deferred_gc 675 if (hlinfo->mouse_face_deferred_gc
676 || f == hlinfo->mouse_face_mouse_frame) 676 || f == hlinfo->mouse_face_mouse_frame)
677 { 677 {
678 BLOCK_INPUT; 678 block_input ();
679 if (hlinfo->mouse_face_mouse_frame) 679 if (hlinfo->mouse_face_mouse_frame)
680 note_mouse_highlight (hlinfo->mouse_face_mouse_frame, 680 note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
681 hlinfo->mouse_face_mouse_x, 681 hlinfo->mouse_face_mouse_x,
682 hlinfo->mouse_face_mouse_y); 682 hlinfo->mouse_face_mouse_y);
683 hlinfo->mouse_face_deferred_gc = 0; 683 hlinfo->mouse_face_deferred_gc = 0;
684 UNBLOCK_INPUT; 684 unblock_input ();
685 } 685 }
686 } 686 }
687} 687}
@@ -722,13 +722,13 @@ x_after_update_window_line (struct glyph_row *desired_row)
722 { 722 {
723 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 723 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
724 724
725 BLOCK_INPUT; 725 block_input ();
726 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 726 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
727 0, y, width, height, False); 727 0, y, width, height, False);
728 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 728 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
729 FRAME_PIXEL_WIDTH (f) - width, 729 FRAME_PIXEL_WIDTH (f) - width,
730 y, width, height, False); 730 y, width, height, False);
731 UNBLOCK_INPUT; 731 unblock_input ();
732 } 732 }
733} 733}
734 734
@@ -899,8 +899,8 @@ static void x_compute_glyph_string_overhangs (struct glyph_string *);
899static void x_set_cursor_gc (struct glyph_string *); 899static void x_set_cursor_gc (struct glyph_string *);
900static void x_set_mode_line_face_gc (struct glyph_string *); 900static void x_set_mode_line_face_gc (struct glyph_string *);
901static void x_set_mouse_face_gc (struct glyph_string *); 901static void x_set_mouse_face_gc (struct glyph_string *);
902static int x_alloc_lighter_color (struct frame *, Display *, Colormap, 902static bool x_alloc_lighter_color (struct frame *, Display *, Colormap,
903 unsigned long *, double, int); 903 unsigned long *, double, int);
904static void x_setup_relief_color (struct frame *, struct relief *, 904static void x_setup_relief_color (struct frame *, struct relief *,
905 double, int, unsigned long); 905 double, int, unsigned long);
906static void x_setup_relief_colors (struct glyph_string *); 906static void x_setup_relief_colors (struct glyph_string *);
@@ -1469,9 +1469,9 @@ x_frame_of_widget (Widget widget)
1469 If this produces the same color as PIXEL, try a color where all RGB 1469 If this produces the same color as PIXEL, try a color where all RGB
1470 values have DELTA added. Return the allocated color in *PIXEL. 1470 values have DELTA added. Return the allocated color in *PIXEL.
1471 DISPLAY is the X display, CMAP is the colormap to operate on. 1471 DISPLAY is the X display, CMAP is the colormap to operate on.
1472 Value is non-zero if successful. */ 1472 Value is true if successful. */
1473 1473
1474int 1474bool
1475x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap, 1475x_alloc_lighter_color_for_widget (Widget widget, Display *display, Colormap cmap,
1476 unsigned long *pixel, double factor, int delta) 1476 unsigned long *pixel, double factor, int delta)
1477{ 1477{
@@ -1696,15 +1696,15 @@ x_query_color (struct frame *f, XColor *color)
1696 1696
1697/* Allocate the color COLOR->pixel on DISPLAY, colormap CMAP. If an 1697/* Allocate the color COLOR->pixel on DISPLAY, colormap CMAP. If an
1698 exact match can't be allocated, try the nearest color available. 1698 exact match can't be allocated, try the nearest color available.
1699 Value is non-zero if successful. Set *COLOR to the color 1699 Value is true if successful. Set *COLOR to the color
1700 allocated. */ 1700 allocated. */
1701 1701
1702static int 1702static bool
1703x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color) 1703x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
1704{ 1704{
1705 int rc; 1705 bool rc;
1706 1706
1707 rc = XAllocColor (dpy, cmap, color); 1707 rc = XAllocColor (dpy, cmap, color) != 0;
1708 if (rc == 0) 1708 if (rc == 0)
1709 { 1709 {
1710 /* If we got to this point, the colormap is full, so we're going 1710 /* If we got to this point, the colormap is full, so we're going
@@ -1735,7 +1735,7 @@ x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
1735 color->red = cells[nearest].red; 1735 color->red = cells[nearest].red;
1736 color->green = cells[nearest].green; 1736 color->green = cells[nearest].green;
1737 color->blue = cells[nearest].blue; 1737 color->blue = cells[nearest].blue;
1738 rc = XAllocColor (dpy, cmap, color); 1738 rc = XAllocColor (dpy, cmap, color) != 0;
1739 } 1739 }
1740 else 1740 else
1741 { 1741 {
@@ -1768,10 +1768,10 @@ x_alloc_nearest_color_1 (Display *dpy, Colormap cmap, XColor *color)
1768 1768
1769/* Allocate the color COLOR->pixel on frame F, colormap CMAP. If an 1769/* Allocate the color COLOR->pixel on frame F, colormap CMAP. If an
1770 exact match can't be allocated, try the nearest color available. 1770 exact match can't be allocated, try the nearest color available.
1771 Value is non-zero if successful. Set *COLOR to the color 1771 Value is true if successful. Set *COLOR to the color
1772 allocated. */ 1772 allocated. */
1773 1773
1774int 1774bool
1775x_alloc_nearest_color (struct frame *f, Colormap cmap, XColor *color) 1775x_alloc_nearest_color (struct frame *f, Colormap cmap, XColor *color)
1776{ 1776{
1777 gamma_correct (f, color); 1777 gamma_correct (f, color);
@@ -1789,10 +1789,10 @@ x_copy_color (struct frame *f, long unsigned int pixel)
1789 XColor color; 1789 XColor color;
1790 1790
1791 color.pixel = pixel; 1791 color.pixel = pixel;
1792 BLOCK_INPUT; 1792 block_input ();
1793 x_query_color (f, &color); 1793 x_query_color (f, &color);
1794 XAllocColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); 1794 XAllocColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color);
1795 UNBLOCK_INPUT; 1795 unblock_input ();
1796#ifdef DEBUG_X_COLORS 1796#ifdef DEBUG_X_COLORS
1797 register_color (pixel); 1797 register_color (pixel);
1798#endif 1798#endif
@@ -1821,12 +1821,12 @@ x_copy_color (struct frame *f, long unsigned int pixel)
1821 DISPLAY is the X display, CMAP is the colormap to operate on. 1821 DISPLAY is the X display, CMAP is the colormap to operate on.
1822 Value is non-zero if successful. */ 1822 Value is non-zero if successful. */
1823 1823
1824static int 1824static bool
1825x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long unsigned int *pixel, double factor, int delta) 1825x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long unsigned int *pixel, double factor, int delta)
1826{ 1826{
1827 XColor color, new; 1827 XColor color, new;
1828 long bright; 1828 long bright;
1829 int success_p; 1829 bool success_p;
1830 1830
1831 /* Get RGB color values. */ 1831 /* Get RGB color values. */
1832 color.pixel = *pixel; 1832 color.pixel = *pixel;
@@ -3028,7 +3028,7 @@ x_clear_frame (struct frame *f)
3028 3028
3029 /* We don't set the output cursor here because there will always 3029 /* We don't set the output cursor here because there will always
3030 follow an explicit cursor_to. */ 3030 follow an explicit cursor_to. */
3031 BLOCK_INPUT; 3031 block_input ();
3032 3032
3033 XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); 3033 XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f));
3034 3034
@@ -3045,7 +3045,7 @@ x_clear_frame (struct frame *f)
3045 3045
3046 XFlush (FRAME_X_DISPLAY (f)); 3046 XFlush (FRAME_X_DISPLAY (f));
3047 3047
3048 UNBLOCK_INPUT; 3048 unblock_input ();
3049} 3049}
3050 3050
3051 3051
@@ -3055,7 +3055,7 @@ x_clear_frame (struct frame *f)
3055static void 3055static void
3056XTflash (struct frame *f) 3056XTflash (struct frame *f)
3057{ 3057{
3058 BLOCK_INPUT; 3058 block_input ();
3059 3059
3060 { 3060 {
3061#ifdef USE_GTK 3061#ifdef USE_GTK
@@ -3208,14 +3208,14 @@ XTflash (struct frame *f)
3208 } 3208 }
3209 } 3209 }
3210 3210
3211 UNBLOCK_INPUT; 3211 unblock_input ();
3212} 3212}
3213 3213
3214 3214
3215static void 3215static void
3216XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) 3216XTtoggle_invisible_pointer (FRAME_PTR f, int invisible)
3217{ 3217{
3218 BLOCK_INPUT; 3218 block_input ();
3219 if (invisible) 3219 if (invisible)
3220 { 3220 {
3221 if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0) 3221 if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0)
@@ -3226,7 +3226,7 @@ XTtoggle_invisible_pointer (FRAME_PTR f, int invisible)
3226 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 3226 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3227 f->output_data.x->current_cursor); 3227 f->output_data.x->current_cursor);
3228 f->pointer_invisible = invisible; 3228 f->pointer_invisible = invisible;
3229 UNBLOCK_INPUT; 3229 unblock_input ();
3230} 3230}
3231 3231
3232 3232
@@ -3241,10 +3241,10 @@ XTring_bell (struct frame *f)
3241 XTflash (f); 3241 XTflash (f);
3242 else 3242 else
3243 { 3243 {
3244 BLOCK_INPUT; 3244 block_input ();
3245 XBell (FRAME_X_DISPLAY (f), 0); 3245 XBell (FRAME_X_DISPLAY (f), 0);
3246 XFlush (FRAME_X_DISPLAY (f)); 3246 XFlush (FRAME_X_DISPLAY (f));
3247 UNBLOCK_INPUT; 3247 unblock_input ();
3248 } 3248 }
3249 } 3249 }
3250} 3250}
@@ -3341,7 +3341,7 @@ x_scroll_run (struct window *w, struct run *run)
3341 height = run->height; 3341 height = run->height;
3342 } 3342 }
3343 3343
3344 BLOCK_INPUT; 3344 block_input ();
3345 3345
3346 /* Cursor off. Will be switched on again in x_update_window_end. */ 3346 /* Cursor off. Will be switched on again in x_update_window_end. */
3347 updated_window = w; 3347 updated_window = w;
@@ -3354,7 +3354,7 @@ x_scroll_run (struct window *w, struct run *run)
3354 width, height, 3354 width, height,
3355 x, to_y); 3355 x, to_y);
3356 3356
3357 UNBLOCK_INPUT; 3357 unblock_input ();
3358} 3358}
3359 3359
3360 3360
@@ -3371,7 +3371,7 @@ frame_highlight (struct frame *f)
3371 the ICCCM (section 4.1.6) says that the window's border pixmap 3371 the ICCCM (section 4.1.6) says that the window's border pixmap
3372 and border pixel are window attributes which are "private to the 3372 and border pixel are window attributes which are "private to the
3373 client", so we can always change it to whatever we want. */ 3373 client", so we can always change it to whatever we want. */
3374 BLOCK_INPUT; 3374 block_input ();
3375 /* I recently started to get errors in this XSetWindowBorder, depending on 3375 /* I recently started to get errors in this XSetWindowBorder, depending on
3376 the window-manager in use, tho something more is at play since I've been 3376 the window-manager in use, tho something more is at play since I've been
3377 using that same window-manager binary for ever. Let's not crash just 3377 using that same window-manager binary for ever. Let's not crash just
@@ -3380,7 +3380,7 @@ frame_highlight (struct frame *f)
3380 XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 3380 XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3381 f->output_data.x->border_pixel); 3381 f->output_data.x->border_pixel);
3382 x_uncatch_errors (); 3382 x_uncatch_errors ();
3383 UNBLOCK_INPUT; 3383 unblock_input ();
3384 x_update_cursor (f, 1); 3384 x_update_cursor (f, 1);
3385 x_set_frame_alpha (f); 3385 x_set_frame_alpha (f);
3386} 3386}
@@ -3392,13 +3392,13 @@ frame_unhighlight (struct frame *f)
3392 the ICCCM (section 4.1.6) says that the window's border pixmap 3392 the ICCCM (section 4.1.6) says that the window's border pixmap
3393 and border pixel are window attributes which are "private to the 3393 and border pixel are window attributes which are "private to the
3394 client", so we can always change it to whatever we want. */ 3394 client", so we can always change it to whatever we want. */
3395 BLOCK_INPUT; 3395 block_input ();
3396 /* Same as above for XSetWindowBorder (bug#9310). */ 3396 /* Same as above for XSetWindowBorder (bug#9310). */
3397 x_catch_errors (FRAME_X_DISPLAY (f)); 3397 x_catch_errors (FRAME_X_DISPLAY (f));
3398 XSetWindowBorderPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 3398 XSetWindowBorderPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
3399 f->output_data.x->border_tile); 3399 f->output_data.x->border_tile);
3400 x_uncatch_errors (); 3400 x_uncatch_errors ();
3401 UNBLOCK_INPUT; 3401 unblock_input ();
3402 x_update_cursor (f, 1); 3402 x_update_cursor (f, 1);
3403 x_set_frame_alpha (f); 3403 x_set_frame_alpha (f);
3404} 3404}
@@ -3765,9 +3765,9 @@ x_get_keysym_name (int keysym)
3765{ 3765{
3766 char *value; 3766 char *value;
3767 3767
3768 BLOCK_INPUT; 3768 block_input ();
3769 value = XKeysymToString (keysym); 3769 value = XKeysymToString (keysym);
3770 UNBLOCK_INPUT; 3770 unblock_input ();
3771 3771
3772 return value; 3772 return value;
3773} 3773}
@@ -3897,7 +3897,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
3897{ 3897{
3898 FRAME_PTR f1; 3898 FRAME_PTR f1;
3899 3899
3900 BLOCK_INPUT; 3900 block_input ();
3901 3901
3902 if (! NILP (last_mouse_scroll_bar) && insist == 0) 3902 if (! NILP (last_mouse_scroll_bar) && insist == 0)
3903 x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp); 3903 x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp);
@@ -4078,7 +4078,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
4078 } 4078 }
4079 } 4079 }
4080 4080
4081 UNBLOCK_INPUT; 4081 unblock_input ();
4082} 4082}
4083 4083
4084 4084
@@ -4267,7 +4267,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
4267 struct frame *f = XFRAME (w->frame); 4267 struct frame *f = XFRAME (w->frame);
4268 ptrdiff_t i; 4268 ptrdiff_t i;
4269 4269
4270 BLOCK_INPUT; 4270 block_input ();
4271 4271
4272 /* Construct a ClientMessage event to send to the frame. */ 4272 /* Construct a ClientMessage event to send to the frame. */
4273 ev->type = ClientMessage; 4273 ev->type = ClientMessage;
@@ -4314,7 +4314,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole)
4314 be sent to the client that created the window, and if that 4314 be sent to the client that created the window, and if that
4315 window no longer exists, no event will be sent. */ 4315 window no longer exists, no event will be sent. */
4316 XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, 0, &event); 4316 XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, 0, &event);
4317 UNBLOCK_INPUT; 4317 unblock_input ();
4318} 4318}
4319 4319
4320 4320
@@ -4405,9 +4405,9 @@ xm_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4405 int slider_size; 4405 int slider_size;
4406 4406
4407 /* Get the slider size. */ 4407 /* Get the slider size. */
4408 BLOCK_INPUT; 4408 block_input ();
4409 XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); 4409 XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL);
4410 UNBLOCK_INPUT; 4410 unblock_input ();
4411 4411
4412 whole = XM_SB_MAX - slider_size; 4412 whole = XM_SB_MAX - slider_size;
4413 portion = min (cs->value, whole); 4413 portion = min (cs->value, whole);
@@ -4528,9 +4528,9 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4528 int part; 4528 int part;
4529 4529
4530 /* Get the size of the thumb, a value between 0 and 1. */ 4530 /* Get the size of the thumb, a value between 0 and 1. */
4531 BLOCK_INPUT; 4531 block_input ();
4532 XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL); 4532 XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL);
4533 UNBLOCK_INPUT; 4533 unblock_input ();
4534 4534
4535 whole = 10000000; 4535 whole = 10000000;
4536 portion = shown < 1 ? top * whole : 0; 4536 portion = shown < 1 ? top * whole : 0;
@@ -4570,9 +4570,9 @@ xaw_scroll_callback (Widget widget, XtPointer client_data, XtPointer call_data)
4570 int part; 4570 int part;
4571 4571
4572 /* Get the height of the scroll bar. */ 4572 /* Get the height of the scroll bar. */
4573 BLOCK_INPUT; 4573 block_input ();
4574 XtVaGetValues (widget, XtNheight, &height, NULL); 4574 XtVaGetValues (widget, XtNheight, &height, NULL);
4575 UNBLOCK_INPUT; 4575 unblock_input ();
4576 4576
4577 if (eabs (position) >= height) 4577 if (eabs (position) >= height)
4578 part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle; 4578 part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle;
@@ -4603,11 +4603,11 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
4603{ 4603{
4604 const char *scroll_bar_name = SCROLL_BAR_NAME; 4604 const char *scroll_bar_name = SCROLL_BAR_NAME;
4605 4605
4606 BLOCK_INPUT; 4606 block_input ();
4607 xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback), 4607 xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback),
4608 G_CALLBACK (xg_end_scroll_callback), 4608 G_CALLBACK (xg_end_scroll_callback),
4609 scroll_bar_name); 4609 scroll_bar_name);
4610 UNBLOCK_INPUT; 4610 unblock_input ();
4611} 4611}
4612 4612
4613#else /* not USE_GTK */ 4613#else /* not USE_GTK */
@@ -4622,7 +4622,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
4622 const char *scroll_bar_name = SCROLL_BAR_NAME; 4622 const char *scroll_bar_name = SCROLL_BAR_NAME;
4623 unsigned long pixel; 4623 unsigned long pixel;
4624 4624
4625 BLOCK_INPUT; 4625 block_input ();
4626 4626
4627#ifdef USE_MOTIF 4627#ifdef USE_MOTIF
4628 /* Set resources. Create the widget. */ 4628 /* Set resources. Create the widget. */
@@ -4806,7 +4806,7 @@ x_create_toolkit_scroll_bar (struct frame *f, struct scroll_bar *bar)
4806 xwindow = XtWindow (widget); 4806 xwindow = XtWindow (widget);
4807 bar->x_window = xwindow; 4807 bar->x_window = xwindow;
4808 4808
4809 UNBLOCK_INPUT; 4809 unblock_input ();
4810} 4810}
4811#endif /* not USE_GTK */ 4811#endif /* not USE_GTK */
4812 4812
@@ -4830,7 +4830,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
4830 Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); 4830 Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar);
4831 float top, shown; 4831 float top, shown;
4832 4832
4833 BLOCK_INPUT; 4833 block_input ();
4834 4834
4835#ifdef USE_MOTIF 4835#ifdef USE_MOTIF
4836 4836
@@ -4921,7 +4921,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
4921 } 4921 }
4922#endif /* !USE_MOTIF */ 4922#endif /* !USE_MOTIF */
4923 4923
4924 UNBLOCK_INPUT; 4924 unblock_input ();
4925} 4925}
4926#endif /* not USE_GTK */ 4926#endif /* not USE_GTK */
4927 4927
@@ -4946,7 +4946,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
4946 = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); 4946 = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER);
4947 Lisp_Object barobj; 4947 Lisp_Object barobj;
4948 4948
4949 BLOCK_INPUT; 4949 block_input ();
4950 4950
4951#ifdef USE_TOOLKIT_SCROLL_BARS 4951#ifdef USE_TOOLKIT_SCROLL_BARS
4952 x_create_toolkit_scroll_bar (f, bar); 4952 x_create_toolkit_scroll_bar (f, bar);
@@ -5034,7 +5034,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height)
5034 XMapRaised (FRAME_X_DISPLAY (f), bar->x_window); 5034 XMapRaised (FRAME_X_DISPLAY (f), bar->x_window);
5035#endif /* not USE_TOOLKIT_SCROLL_BARS */ 5035#endif /* not USE_TOOLKIT_SCROLL_BARS */
5036 5036
5037 UNBLOCK_INPUT; 5037 unblock_input ();
5038 return bar; 5038 return bar;
5039} 5039}
5040 5040
@@ -5068,7 +5068,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild
5068 && end == bar->end) 5068 && end == bar->end)
5069 return; 5069 return;
5070 5070
5071 BLOCK_INPUT; 5071 block_input ();
5072 5072
5073 { 5073 {
5074 int inside_width = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (f, bar->width); 5074 int inside_width = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (f, bar->width);
@@ -5144,7 +5144,7 @@ x_scroll_bar_set_handle (struct scroll_bar *bar, int start, int end, int rebuild
5144 5144
5145 } 5145 }
5146 5146
5147 UNBLOCK_INPUT; 5147 unblock_input ();
5148} 5148}
5149 5149
5150#endif /* !USE_TOOLKIT_SCROLL_BARS */ 5150#endif /* !USE_TOOLKIT_SCROLL_BARS */
@@ -5156,7 +5156,7 @@ static void
5156x_scroll_bar_remove (struct scroll_bar *bar) 5156x_scroll_bar_remove (struct scroll_bar *bar)
5157{ 5157{
5158 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); 5158 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
5159 BLOCK_INPUT; 5159 block_input ();
5160 5160
5161#ifdef USE_TOOLKIT_SCROLL_BARS 5161#ifdef USE_TOOLKIT_SCROLL_BARS
5162#ifdef USE_GTK 5162#ifdef USE_GTK
@@ -5171,7 +5171,7 @@ x_scroll_bar_remove (struct scroll_bar *bar)
5171 /* Dissociate this scroll bar from its window. */ 5171 /* Dissociate this scroll bar from its window. */
5172 wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); 5172 wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil);
5173 5173
5174 UNBLOCK_INPUT; 5174 unblock_input ();
5175} 5175}
5176 5176
5177 5177
@@ -5239,7 +5239,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5239 { 5239 {
5240 if (width > 0 && height > 0) 5240 if (width > 0 && height > 0)
5241 { 5241 {
5242 BLOCK_INPUT; 5242 block_input ();
5243#ifdef USE_TOOLKIT_SCROLL_BARS 5243#ifdef USE_TOOLKIT_SCROLL_BARS
5244 if (fringe_extended_p) 5244 if (fringe_extended_p)
5245 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5245 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
@@ -5248,7 +5248,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5248#endif 5248#endif
5249 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 5249 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
5250 left, top, width, height, False); 5250 left, top, width, height, False);
5251 UNBLOCK_INPUT; 5251 unblock_input ();
5252 } 5252 }
5253 5253
5254 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); 5254 bar = x_scroll_bar_create (w, top, sb_left, sb_width, height);
@@ -5260,7 +5260,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5260 5260
5261 bar = XSCROLL_BAR (w->vertical_scroll_bar); 5261 bar = XSCROLL_BAR (w->vertical_scroll_bar);
5262 5262
5263 BLOCK_INPUT; 5263 block_input ();
5264 5264
5265 if (sb_left != bar->left) 5265 if (sb_left != bar->left)
5266 mask |= CWX; 5266 mask |= CWX;
@@ -5357,7 +5357,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
5357 bar->width = sb_width; 5357 bar->width = sb_width;
5358 bar->height = height; 5358 bar->height = height;
5359 5359
5360 UNBLOCK_INPUT; 5360 unblock_input ();
5361 } 5361 }
5362 5362
5363#ifdef USE_TOOLKIT_SCROLL_BARS 5363#ifdef USE_TOOLKIT_SCROLL_BARS
@@ -5508,7 +5508,7 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
5508 GC gc = f->output_data.x->normal_gc; 5508 GC gc = f->output_data.x->normal_gc;
5509 int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; 5509 int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM;
5510 5510
5511 BLOCK_INPUT; 5511 block_input ();
5512 5512
5513 x_scroll_bar_set_handle (bar, bar->start, bar->end, 1); 5513 x_scroll_bar_set_handle (bar, bar->start, bar->end, 1);
5514 5514
@@ -5530,7 +5530,7 @@ x_scroll_bar_expose (struct scroll_bar *bar, XEvent *event)
5530 XSetForeground (FRAME_X_DISPLAY (f), gc, 5530 XSetForeground (FRAME_X_DISPLAY (f), gc,
5531 FRAME_FOREGROUND_PIXEL (f)); 5531 FRAME_FOREGROUND_PIXEL (f));
5532 5532
5533 UNBLOCK_INPUT; 5533 unblock_input ();
5534 5534
5535} 5535}
5536#endif /* not USE_TOOLKIT_SCROLL_BARS */ 5536#endif /* not USE_TOOLKIT_SCROLL_BARS */
@@ -5643,7 +5643,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
5643 int dummy_coord; 5643 int dummy_coord;
5644 unsigned int dummy_mask; 5644 unsigned int dummy_mask;
5645 5645
5646 BLOCK_INPUT; 5646 block_input ();
5647 5647
5648 /* Get the mouse's position relative to the scroll bar window, and 5648 /* Get the mouse's position relative to the scroll bar window, and
5649 report that. */ 5649 report that. */
@@ -5695,7 +5695,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window,
5695 5695
5696 *timestamp = last_mouse_movement_time; 5696 *timestamp = last_mouse_movement_time;
5697 5697
5698 UNBLOCK_INPUT; 5698 unblock_input ();
5699} 5699}
5700 5700
5701 5701
@@ -5816,7 +5816,7 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data)
5816{ 5816{
5817 XEvent *xev = (XEvent *) gxev; 5817 XEvent *xev = (XEvent *) gxev;
5818 5818
5819 BLOCK_INPUT; 5819 block_input ();
5820 if (current_count >= 0) 5820 if (current_count >= 0)
5821 { 5821 {
5822 struct x_display_info *dpyinfo; 5822 struct x_display_info *dpyinfo;
@@ -5831,7 +5831,7 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data)
5831 && dpyinfo 5831 && dpyinfo
5832 && x_filter_event (dpyinfo, xev)) 5832 && x_filter_event (dpyinfo, xev))
5833 { 5833 {
5834 UNBLOCK_INPUT; 5834 unblock_input ();
5835 return GDK_FILTER_REMOVE; 5835 return GDK_FILTER_REMOVE;
5836 } 5836 }
5837#endif 5837#endif
@@ -5846,7 +5846,7 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data)
5846 else 5846 else
5847 current_finish = x_dispatch_event (xev, xev->xany.display); 5847 current_finish = x_dispatch_event (xev, xev->xany.display);
5848 5848
5849 UNBLOCK_INPUT; 5849 unblock_input ();
5850 5850
5851 if (current_finish == X_EVENT_GOTO_OUT || current_finish == X_EVENT_DROP) 5851 if (current_finish == X_EVENT_GOTO_OUT || current_finish == X_EVENT_DROP)
5852 return GDK_FILTER_REMOVE; 5852 return GDK_FILTER_REMOVE;
@@ -7041,10 +7041,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
7041 default: 7041 default:
7042 OTHER: 7042 OTHER:
7043#ifdef USE_X_TOOLKIT 7043#ifdef USE_X_TOOLKIT
7044 BLOCK_INPUT; 7044 block_input ();
7045 if (*finish != X_EVENT_DROP) 7045 if (*finish != X_EVENT_DROP)
7046 XtDispatchEvent (&event); 7046 XtDispatchEvent (&event);
7047 UNBLOCK_INPUT; 7047 unblock_input ();
7048#endif /* USE_X_TOOLKIT */ 7048#endif /* USE_X_TOOLKIT */
7049 break; 7049 break;
7050 } 7050 }
@@ -7122,16 +7122,7 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
7122 int count = 0; 7122 int count = 0;
7123 int event_found = 0; 7123 int event_found = 0;
7124 7124
7125 if (interrupt_input_blocked) 7125 block_input ();
7126 {
7127 interrupt_input_pending = 1;
7128 pending_signals = 1;
7129 return -1;
7130 }
7131
7132 interrupt_input_pending = 0;
7133 pending_signals = pending_atimers;
7134 BLOCK_INPUT;
7135 7126
7136 /* So people can tell when we have read the available input. */ 7127 /* So people can tell when we have read the available input. */
7137 input_signal_count++; 7128 input_signal_count++;
@@ -7224,7 +7215,7 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
7224 pending_autoraise_frame = 0; 7215 pending_autoraise_frame = 0;
7225 } 7216 }
7226 7217
7227 UNBLOCK_INPUT; 7218 unblock_input ();
7228 7219
7229 return count; 7220 return count;
7230} 7221}
@@ -7660,7 +7651,7 @@ x_uncatch_errors (void)
7660{ 7651{
7661 struct x_error_message_stack *tmp; 7652 struct x_error_message_stack *tmp;
7662 7653
7663 BLOCK_INPUT; 7654 block_input ();
7664 7655
7665 /* The display may have been closed before this function is called. 7656 /* The display may have been closed before this function is called.
7666 Check if it is still open before calling XSync. */ 7657 Check if it is still open before calling XSync. */
@@ -7670,7 +7661,7 @@ x_uncatch_errors (void)
7670 tmp = x_error_message; 7661 tmp = x_error_message;
7671 x_error_message = x_error_message->prev; 7662 x_error_message = x_error_message->prev;
7672 xfree (tmp); 7663 xfree (tmp);
7673 UNBLOCK_INPUT; 7664 unblock_input ();
7674} 7665}
7675 7666
7676/* If any X protocol errors have arrived since the last call to 7667/* If any X protocol errors have arrived since the last call to
@@ -7733,26 +7724,6 @@ x_trace_wire (void)
7733#endif /* ! 0 */ 7724#endif /* ! 0 */
7734 7725
7735 7726
7736/* Handle SIGPIPE, which can happen when the connection to a server
7737 simply goes away. SIGPIPE is handled by x_connection_signal.
7738 Don't need to do anything, because the write which caused the
7739 SIGPIPE will fail, causing Xlib to invoke the X IO error handler,
7740 which will do the appropriate cleanup for us. */
7741
7742static void
7743x_connection_signal (int signalnum) /* If we don't have an argument, */
7744 /* some compilers complain in signal calls. */
7745{
7746#ifdef USG
7747 /* USG systems forget handlers when they are used;
7748 must reestablish each time */
7749 struct sigaction action;
7750 emacs_sigaction_init (&action, x_connection_signal);
7751 sigaction (signalnum, &action, 0);
7752#endif /* USG */
7753}
7754
7755
7756/************************************************************************ 7727/************************************************************************
7757 Handling X errors 7728 Handling X errors
7758 ************************************************************************/ 7729 ************************************************************************/
@@ -7856,17 +7827,7 @@ For details, see etc/PROBLEMS.\n",
7856 /* NOTREACHED */ 7827 /* NOTREACHED */
7857 } 7828 }
7858 7829
7859 /* Ordinary stack unwind doesn't deal with these. */ 7830 totally_unblock_input ();
7860 {
7861 sigset_t unblocked;
7862 sigemptyset (&unblocked);
7863#ifdef USABLE_SIGIO
7864 sigaddset (&unblocked, SIGIO);
7865#endif
7866 sigaddset (&unblocked, SIGALRM);
7867 pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
7868 }
7869 TOTALLY_UNBLOCK_INPUT;
7870 7831
7871 unbind_to (idx, Qnil); 7832 unbind_to (idx, Qnil);
7872 clear_waiting_for_input (); 7833 clear_waiting_for_input ();
@@ -8005,9 +7966,9 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
8005 if (FRAME_XIC (f) 7966 if (FRAME_XIC (f)
8006 && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea))) 7967 && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea)))
8007 { 7968 {
8008 BLOCK_INPUT; 7969 block_input ();
8009 xic_set_xfontset (f, SSDATA (fontset_ascii (fontset))); 7970 xic_set_xfontset (f, SSDATA (fontset_ascii (fontset)));
8010 UNBLOCK_INPUT; 7971 unblock_input ();
8011 } 7972 }
8012#endif 7973#endif
8013 7974
@@ -8033,7 +7994,7 @@ xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data)
8033 struct x_display_info *dpyinfo = (struct x_display_info *) client_data; 7994 struct x_display_info *dpyinfo = (struct x_display_info *) client_data;
8034 Lisp_Object frame, tail; 7995 Lisp_Object frame, tail;
8035 7996
8036 BLOCK_INPUT; 7997 block_input ();
8037 7998
8038 /* No need to call XDestroyIC.. */ 7999 /* No need to call XDestroyIC.. */
8039 FOR_EACH_FRAME (tail, frame) 8000 FOR_EACH_FRAME (tail, frame)
@@ -8049,7 +8010,7 @@ xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data)
8049 /* No need to call XCloseIM. */ 8010 /* No need to call XCloseIM. */
8050 dpyinfo->xim = NULL; 8011 dpyinfo->xim = NULL;
8051 XFree (dpyinfo->xim_styles); 8012 XFree (dpyinfo->xim_styles);
8052 UNBLOCK_INPUT; 8013 unblock_input ();
8053} 8014}
8054 8015
8055#endif /* HAVE_X11R6 */ 8016#endif /* HAVE_X11R6 */
@@ -8124,7 +8085,7 @@ xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_
8124 { 8085 {
8125 Lisp_Object tail, frame; 8086 Lisp_Object tail, frame;
8126 8087
8127 BLOCK_INPUT; 8088 block_input ();
8128 FOR_EACH_FRAME (tail, frame) 8089 FOR_EACH_FRAME (tail, frame)
8129 { 8090 {
8130 struct frame *f = XFRAME (frame); 8091 struct frame *f = XFRAME (frame);
@@ -8144,7 +8105,7 @@ xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_
8144 } 8105 }
8145 } 8106 }
8146 8107
8147 UNBLOCK_INPUT; 8108 unblock_input ();
8148 } 8109 }
8149} 8110}
8150 8111
@@ -8291,7 +8252,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8291 } 8252 }
8292 x_calc_absolute_position (f); 8253 x_calc_absolute_position (f);
8293 8254
8294 BLOCK_INPUT; 8255 block_input ();
8295 x_wm_set_size_hint (f, (long) 0, 0); 8256 x_wm_set_size_hint (f, (long) 0, 0);
8296 8257
8297 modified_left = f->left_pos; 8258 modified_left = f->left_pos;
@@ -8330,7 +8291,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, int change_
8330 && FRAME_X_OUTPUT (f)->move_offset_top == 0)))) 8291 && FRAME_X_OUTPUT (f)->move_offset_top == 0))))
8331 x_check_expected_move (f, modified_left, modified_top); 8292 x_check_expected_move (f, modified_left, modified_top);
8332 8293
8333 UNBLOCK_INPUT; 8294 unblock_input ();
8334} 8295}
8335 8296
8336/* Return non-zero if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED 8297/* Return non-zero if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED
@@ -8353,7 +8314,7 @@ wm_supports (struct frame *f, Atom want_atom)
8353 unsigned char *tmp_data = NULL; 8314 unsigned char *tmp_data = NULL;
8354 Atom target_type = XA_WINDOW; 8315 Atom target_type = XA_WINDOW;
8355 8316
8356 BLOCK_INPUT; 8317 block_input ();
8357 8318
8358 x_catch_errors (dpy); 8319 x_catch_errors (dpy);
8359 rc = XGetWindowProperty (dpy, target_window, 8320 rc = XGetWindowProperty (dpy, target_window,
@@ -8366,7 +8327,7 @@ wm_supports (struct frame *f, Atom want_atom)
8366 { 8327 {
8367 if (tmp_data) XFree (tmp_data); 8328 if (tmp_data) XFree (tmp_data);
8368 x_uncatch_errors (); 8329 x_uncatch_errors ();
8369 UNBLOCK_INPUT; 8330 unblock_input ();
8370 return 0; 8331 return 0;
8371 } 8332 }
8372 8333
@@ -8379,7 +8340,7 @@ wm_supports (struct frame *f, Atom want_atom)
8379 if (x_had_errors_p (dpy)) 8340 if (x_had_errors_p (dpy))
8380 { 8341 {
8381 x_uncatch_errors (); 8342 x_uncatch_errors ();
8382 UNBLOCK_INPUT; 8343 unblock_input ();
8383 return 0; 8344 return 0;
8384 } 8345 }
8385 8346
@@ -8404,7 +8365,7 @@ wm_supports (struct frame *f, Atom want_atom)
8404 { 8365 {
8405 if (tmp_data) XFree (tmp_data); 8366 if (tmp_data) XFree (tmp_data);
8406 x_uncatch_errors (); 8367 x_uncatch_errors ();
8407 UNBLOCK_INPUT; 8368 unblock_input ();
8408 return 0; 8369 return 0;
8409 } 8370 }
8410 8371
@@ -8419,7 +8380,7 @@ wm_supports (struct frame *f, Atom want_atom)
8419 rc = dpyinfo->net_supported_atoms[i] == want_atom; 8380 rc = dpyinfo->net_supported_atoms[i] == want_atom;
8420 8381
8421 x_uncatch_errors (); 8382 x_uncatch_errors ();
8422 UNBLOCK_INPUT; 8383 unblock_input ();
8423 8384
8424 return rc; 8385 return rc;
8425} 8386}
@@ -8478,7 +8439,7 @@ get_current_wm_state (struct frame *f,
8478 *sticky = 0; 8439 *sticky = 0;
8479 *size_state = FULLSCREEN_NONE; 8440 *size_state = FULLSCREEN_NONE;
8480 8441
8481 BLOCK_INPUT; 8442 block_input ();
8482 x_catch_errors (dpy); 8443 x_catch_errors (dpy);
8483 rc = XGetWindowProperty (dpy, window, dpyinfo->Xatom_net_wm_state, 8444 rc = XGetWindowProperty (dpy, window, dpyinfo->Xatom_net_wm_state,
8484 0, max_len, False, target_type, 8445 0, max_len, False, target_type,
@@ -8489,7 +8450,7 @@ get_current_wm_state (struct frame *f,
8489 { 8450 {
8490 if (tmp_data) XFree (tmp_data); 8451 if (tmp_data) XFree (tmp_data);
8491 x_uncatch_errors (); 8452 x_uncatch_errors ();
8492 UNBLOCK_INPUT; 8453 unblock_input ();
8493 return ! f->iconified; 8454 return ! f->iconified;
8494 } 8455 }
8495 8456
@@ -8524,7 +8485,7 @@ get_current_wm_state (struct frame *f,
8524 } 8485 }
8525 8486
8526 if (tmp_data) XFree (tmp_data); 8487 if (tmp_data) XFree (tmp_data);
8527 UNBLOCK_INPUT; 8488 unblock_input ();
8528 return ! is_hidden; 8489 return ! is_hidden;
8529} 8490}
8530 8491
@@ -8604,10 +8565,10 @@ XTfullscreen_hook (FRAME_PTR f)
8604{ 8565{
8605 if (f->async_visible) 8566 if (f->async_visible)
8606 { 8567 {
8607 BLOCK_INPUT; 8568 block_input ();
8608 x_check_fullscreen (f); 8569 x_check_fullscreen (f);
8609 x_sync (f); 8570 x_sync (f);
8610 UNBLOCK_INPUT; 8571 unblock_input ();
8611 } 8572 }
8612} 8573}
8613 8574
@@ -8792,10 +8753,10 @@ x_wait_for_event (struct frame *f, int eventtype)
8792 8753
8793 while (pending_event_wait.eventtype) 8754 while (pending_event_wait.eventtype)
8794 { 8755 {
8795 interrupt_input_pending = 1; 8756 pending_signals = 1;
8796 TOTALLY_UNBLOCK_INPUT; 8757 totally_unblock_input ();
8797 /* XTread_socket is called after unblock. */ 8758 /* XTread_socket is called after unblock. */
8798 BLOCK_INPUT; 8759 block_input ();
8799 interrupt_input_blocked = level; 8760 interrupt_input_blocked = level;
8800 8761
8801 FD_ZERO (&fds); 8762 FD_ZERO (&fds);
@@ -8886,7 +8847,7 @@ x_set_window_size_1 (struct frame *f, int change_gravity, int cols, int rows)
8886void 8847void
8887x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) 8848x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
8888{ 8849{
8889 BLOCK_INPUT; 8850 block_input ();
8890 8851
8891 if (NILP (tip_frame) || XFRAME (tip_frame) != f) 8852 if (NILP (tip_frame) || XFRAME (tip_frame) != f)
8892 { 8853 {
@@ -8934,7 +8895,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
8934 so don't try--just let the highlighting be done afresh with new size. */ 8895 so don't try--just let the highlighting be done afresh with new size. */
8935 cancel_mouse_face (f); 8896 cancel_mouse_face (f);
8936 8897
8937 UNBLOCK_INPUT; 8898 unblock_input ();
8938} 8899}
8939 8900
8940/* Mouse warping. */ 8901/* Mouse warping. */
@@ -8953,11 +8914,11 @@ x_set_mouse_position (struct frame *f, int x, int y)
8953 if (pix_y < 0) pix_y = 0; 8914 if (pix_y < 0) pix_y = 0;
8954 if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f); 8915 if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f);
8955 8916
8956 BLOCK_INPUT; 8917 block_input ();
8957 8918
8958 XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), 8919 XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f),
8959 0, 0, 0, 0, pix_x, pix_y); 8920 0, 0, 0, 0, pix_x, pix_y);
8960 UNBLOCK_INPUT; 8921 unblock_input ();
8961} 8922}
8962 8923
8963/* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ 8924/* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */
@@ -8965,11 +8926,11 @@ x_set_mouse_position (struct frame *f, int x, int y)
8965void 8926void
8966x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) 8927x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
8967{ 8928{
8968 BLOCK_INPUT; 8929 block_input ();
8969 8930
8970 XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), 8931 XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f),
8971 0, 0, 0, 0, pix_x, pix_y); 8932 0, 0, 0, 0, pix_x, pix_y);
8972 UNBLOCK_INPUT; 8933 unblock_input ();
8973} 8934}
8974 8935
8975/* Raise frame F. */ 8936/* Raise frame F. */
@@ -8977,12 +8938,12 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y)
8977void 8938void
8978x_raise_frame (struct frame *f) 8939x_raise_frame (struct frame *f)
8979{ 8940{
8980 BLOCK_INPUT; 8941 block_input ();
8981 if (f->async_visible) 8942 if (f->async_visible)
8982 XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); 8943 XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
8983 8944
8984 XFlush (FRAME_X_DISPLAY (f)); 8945 XFlush (FRAME_X_DISPLAY (f));
8985 UNBLOCK_INPUT; 8946 unblock_input ();
8986} 8947}
8987 8948
8988/* Lower frame F. */ 8949/* Lower frame F. */
@@ -8992,10 +8953,10 @@ x_lower_frame (struct frame *f)
8992{ 8953{
8993 if (f->async_visible) 8954 if (f->async_visible)
8994 { 8955 {
8995 BLOCK_INPUT; 8956 block_input ();
8996 XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); 8957 XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f));
8997 XFlush (FRAME_X_DISPLAY (f)); 8958 XFlush (FRAME_X_DISPLAY (f));
8998 UNBLOCK_INPUT; 8959 unblock_input ();
8999 } 8960 }
9000} 8961}
9001 8962
@@ -9104,7 +9065,7 @@ x_make_frame_visible (struct frame *f)
9104 9065
9105 retry: 9066 retry:
9106 9067
9107 BLOCK_INPUT; 9068 block_input ();
9108 9069
9109 type = x_icon_type (f); 9070 type = x_icon_type (f);
9110 if (!NILP (type)) 9071 if (!NILP (type))
@@ -9163,7 +9124,7 @@ x_make_frame_visible (struct frame *f)
9163 original_top = f->top_pos; 9124 original_top = f->top_pos;
9164 9125
9165 /* This must come after we set COUNT. */ 9126 /* This must come after we set COUNT. */
9166 UNBLOCK_INPUT; 9127 unblock_input ();
9167 9128
9168 /* We unblock here so that arriving X events are processed. */ 9129 /* We unblock here so that arriving X events are processed. */
9169 9130
@@ -9186,7 +9147,7 @@ x_make_frame_visible (struct frame *f)
9186 int x, y; 9147 int x, y;
9187 unsigned int width, height, border, depth; 9148 unsigned int width, height, border, depth;
9188 9149
9189 BLOCK_INPUT; 9150 block_input ();
9190 9151
9191 /* On some window managers (such as FVWM) moving an existing 9152 /* On some window managers (such as FVWM) moving an existing
9192 window, even to the same place, causes the window manager 9153 window, even to the same place, causes the window manager
@@ -9202,7 +9163,7 @@ x_make_frame_visible (struct frame *f)
9202 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), 9163 XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
9203 original_left, original_top); 9164 original_left, original_top);
9204 9165
9205 UNBLOCK_INPUT; 9166 unblock_input ();
9206 } 9167 }
9207 9168
9208 XSETFRAME (frame, f); 9169 XSETFRAME (frame, f);
@@ -9269,7 +9230,7 @@ x_make_frame_invisible (struct frame *f)
9269 if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f) 9230 if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f)
9270 FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0; 9231 FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0;
9271 9232
9272 BLOCK_INPUT; 9233 block_input ();
9273 9234
9274 /* Before unmapping the window, update the WM_SIZE_HINTS property to claim 9235 /* Before unmapping the window, update the WM_SIZE_HINTS property to claim
9275 that the current position of the window is user-specified, rather than 9236 that the current position of the window is user-specified, rather than
@@ -9292,7 +9253,7 @@ x_make_frame_invisible (struct frame *f)
9292 if (! XWithdrawWindow (FRAME_X_DISPLAY (f), window, 9253 if (! XWithdrawWindow (FRAME_X_DISPLAY (f), window,
9293 DefaultScreen (FRAME_X_DISPLAY (f)))) 9254 DefaultScreen (FRAME_X_DISPLAY (f))))
9294 { 9255 {
9295 UNBLOCK_INPUT_RESIGNAL; 9256 unblock_input ();
9296 error ("Can't notify window manager of window withdrawal"); 9257 error ("Can't notify window manager of window withdrawal");
9297 } 9258 }
9298 } 9259 }
@@ -9309,7 +9270,7 @@ x_make_frame_invisible (struct frame *f)
9309 9270
9310 x_sync (f); 9271 x_sync (f);
9311 9272
9312 UNBLOCK_INPUT; 9273 unblock_input ();
9313} 9274}
9314 9275
9315/* Change window state from mapped to iconified. */ 9276/* Change window state from mapped to iconified. */
@@ -9329,7 +9290,7 @@ x_iconify_frame (struct frame *f)
9329 if (f->async_iconified) 9290 if (f->async_iconified)
9330 return; 9291 return;
9331 9292
9332 BLOCK_INPUT; 9293 block_input ();
9333 9294
9334 FRAME_SAMPLE_VISIBILITY (f); 9295 FRAME_SAMPLE_VISIBILITY (f);
9335 9296
@@ -9348,7 +9309,7 @@ x_iconify_frame (struct frame *f)
9348 f->visible = 1; 9309 f->visible = 1;
9349 f->async_iconified = 1; 9310 f->async_iconified = 1;
9350 f->async_visible = 0; 9311 f->async_visible = 0;
9351 UNBLOCK_INPUT; 9312 unblock_input ();
9352 return; 9313 return;
9353 } 9314 }
9354#endif 9315#endif
@@ -9368,14 +9329,14 @@ x_iconify_frame (struct frame *f)
9368 f->visible = 1; 9329 f->visible = 1;
9369 f->async_iconified = 1; 9330 f->async_iconified = 1;
9370 f->async_visible = 0; 9331 f->async_visible = 0;
9371 UNBLOCK_INPUT; 9332 unblock_input ();
9372 return; 9333 return;
9373 } 9334 }
9374 9335
9375 result = XIconifyWindow (FRAME_X_DISPLAY (f), 9336 result = XIconifyWindow (FRAME_X_DISPLAY (f),
9376 XtWindow (f->output_data.x->widget), 9337 XtWindow (f->output_data.x->widget),
9377 DefaultScreen (FRAME_X_DISPLAY (f))); 9338 DefaultScreen (FRAME_X_DISPLAY (f)));
9378 UNBLOCK_INPUT; 9339 unblock_input ();
9379 9340
9380 if (!result) 9341 if (!result)
9381 error ("Can't notify window manager of iconification"); 9342 error ("Can't notify window manager of iconification");
@@ -9384,9 +9345,9 @@ x_iconify_frame (struct frame *f)
9384 f->async_visible = 0; 9345 f->async_visible = 0;
9385 9346
9386 9347
9387 BLOCK_INPUT; 9348 block_input ();
9388 XFlush (FRAME_X_DISPLAY (f)); 9349 XFlush (FRAME_X_DISPLAY (f));
9389 UNBLOCK_INPUT; 9350 unblock_input ();
9390#else /* not USE_X_TOOLKIT */ 9351#else /* not USE_X_TOOLKIT */
9391 9352
9392 /* Make sure the X server knows where the window should be positioned, 9353 /* Make sure the X server knows where the window should be positioned,
@@ -9416,7 +9377,7 @@ x_iconify_frame (struct frame *f)
9416 SubstructureRedirectMask | SubstructureNotifyMask, 9377 SubstructureRedirectMask | SubstructureNotifyMask,
9417 &msg)) 9378 &msg))
9418 { 9379 {
9419 UNBLOCK_INPUT_RESIGNAL; 9380 unblock_input ();
9420 error ("Can't notify window manager of iconification"); 9381 error ("Can't notify window manager of iconification");
9421 } 9382 }
9422 } 9383 }
@@ -9435,7 +9396,7 @@ x_iconify_frame (struct frame *f)
9435 f->async_visible = 0; 9396 f->async_visible = 0;
9436 9397
9437 XFlush (FRAME_X_DISPLAY (f)); 9398 XFlush (FRAME_X_DISPLAY (f));
9438 UNBLOCK_INPUT; 9399 unblock_input ();
9439#endif /* not USE_X_TOOLKIT */ 9400#endif /* not USE_X_TOOLKIT */
9440} 9401}
9441 9402
@@ -9452,7 +9413,7 @@ x_free_frame_resources (struct frame *f)
9452 struct scroll_bar *b; 9413 struct scroll_bar *b;
9453#endif 9414#endif
9454 9415
9455 BLOCK_INPUT; 9416 block_input ();
9456 9417
9457 /* If a display connection is dead, don't try sending more 9418 /* If a display connection is dead, don't try sending more
9458 commands to the X server. */ 9419 commands to the X server. */
@@ -9555,7 +9516,7 @@ x_free_frame_resources (struct frame *f)
9555 hlinfo->mouse_face_mouse_frame = 0; 9516 hlinfo->mouse_face_mouse_frame = 0;
9556 } 9517 }
9557 9518
9558 UNBLOCK_INPUT; 9519 unblock_input ();
9559} 9520}
9560 9521
9561 9522
@@ -9580,13 +9541,13 @@ x_destroy_window (struct frame *f)
9580/* Set the normal size hints for the window manager, for frame F. 9541/* Set the normal size hints for the window manager, for frame F.
9581 FLAGS is the flags word to use--or 0 meaning preserve the flags 9542 FLAGS is the flags word to use--or 0 meaning preserve the flags
9582 that the window now has. 9543 that the window now has.
9583 If USER_POSITION is nonzero, we set the USPosition 9544 If USER_POSITION, set the USPosition
9584 flag (this is useful when FLAGS is 0). 9545 flag (this is useful when FLAGS is 0).
9585 The GTK version is in gtkutils.c */ 9546 The GTK version is in gtkutils.c. */
9586 9547
9587#ifndef USE_GTK 9548#ifndef USE_GTK
9588void 9549void
9589x_wm_set_size_hint (struct frame *f, long flags, int user_position) 9550x_wm_set_size_hint (struct frame *f, long flags, bool user_position)
9590{ 9551{
9591 XSizeHints size_hints; 9552 XSizeHints size_hints;
9592 Window window = FRAME_OUTER_WINDOW (f); 9553 Window window = FRAME_OUTER_WINDOW (f);
@@ -9935,7 +9896,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9935 Mouse_HLInfo *hlinfo; 9896 Mouse_HLInfo *hlinfo;
9936 ptrdiff_t lim; 9897 ptrdiff_t lim;
9937 9898
9938 BLOCK_INPUT; 9899 block_input ();
9939 9900
9940 if (!x_initialized) 9901 if (!x_initialized)
9941 { 9902 {
@@ -9996,11 +9957,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
9996 Call before gtk_init so Gtk+ event filters comes after our. */ 9957 Call before gtk_init so Gtk+ event filters comes after our. */
9997 gdk_window_add_filter (NULL, event_handler_gdk, NULL); 9958 gdk_window_add_filter (NULL, event_handler_gdk, NULL);
9998 9959
9960 /* gtk_init does set_locale. Fix locale before and after. */
9961 fixup_locale ();
9999 gtk_init (&argc, &argv2); 9962 gtk_init (&argc, &argv2);
9963 fixup_locale ();
9964
10000 g_log_remove_handler ("GLib", id); 9965 g_log_remove_handler ("GLib", id);
10001 9966
10002 /* gtk_init does set_locale. We must fix locale after calling it. */
10003 fixup_locale ();
10004 xg_initialize (); 9967 xg_initialize ();
10005 9968
10006 dpy = DEFAULT_GDK_DISPLAY (); 9969 dpy = DEFAULT_GDK_DISPLAY ();
@@ -10067,7 +10030,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10067 /* Detect failure. */ 10030 /* Detect failure. */
10068 if (dpy == 0) 10031 if (dpy == 0)
10069 { 10032 {
10070 UNBLOCK_INPUT; 10033 unblock_input ();
10071 return 0; 10034 return 0;
10072 } 10035 }
10073 10036
@@ -10114,12 +10077,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10114 10077
10115 /* Temporarily hide the partially initialized terminal. */ 10078 /* Temporarily hide the partially initialized terminal. */
10116 terminal_list = terminal->next_terminal; 10079 terminal_list = terminal->next_terminal;
10117 UNBLOCK_INPUT; 10080 unblock_input ();
10118 kset_system_key_alist 10081 kset_system_key_alist
10119 (terminal->kboard, 10082 (terminal->kboard,
10120 call1 (Qvendor_specific_keysyms, 10083 call1 (Qvendor_specific_keysyms,
10121 vendor ? build_string (vendor) : empty_unibyte_string)); 10084 vendor ? build_string (vendor) : empty_unibyte_string));
10122 BLOCK_INPUT; 10085 block_input ();
10123 terminal->next_terminal = terminal_list; 10086 terminal->next_terminal = terminal_list;
10124 terminal_list = terminal; 10087 terminal_list = terminal;
10125 UNGCPRO; 10088 UNGCPRO;
@@ -10468,7 +10431,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10468 x_session_initialize (dpyinfo); 10431 x_session_initialize (dpyinfo);
10469#endif 10432#endif
10470 10433
10471 UNBLOCK_INPUT; 10434 unblock_input ();
10472 10435
10473 return dpyinfo; 10436 return dpyinfo;
10474} 10437}
@@ -10548,7 +10511,7 @@ x_delete_display (struct x_display_info *dpyinfo)
10548static void 10511static void
10549x_process_timeouts (struct atimer *timer) 10512x_process_timeouts (struct atimer *timer)
10550{ 10513{
10551 BLOCK_INPUT; 10514 block_input ();
10552 x_timeout_atimer_activated_flag = 0; 10515 x_timeout_atimer_activated_flag = 0;
10553 if (toolkit_scroll_bar_interaction || popup_activated ()) 10516 if (toolkit_scroll_bar_interaction || popup_activated ())
10554 { 10517 {
@@ -10557,7 +10520,7 @@ x_process_timeouts (struct atimer *timer)
10557 /* Reactivate the atimer for next time. */ 10520 /* Reactivate the atimer for next time. */
10558 x_activate_timeout_atimer (); 10521 x_activate_timeout_atimer ();
10559 } 10522 }
10560 UNBLOCK_INPUT; 10523 unblock_input ();
10561} 10524}
10562 10525
10563/* Install an asynchronous timer that processes Xt timeout events 10526/* Install an asynchronous timer that processes Xt timeout events
@@ -10571,14 +10534,14 @@ x_process_timeouts (struct atimer *timer)
10571void 10534void
10572x_activate_timeout_atimer (void) 10535x_activate_timeout_atimer (void)
10573{ 10536{
10574 BLOCK_INPUT; 10537 block_input ();
10575 if (!x_timeout_atimer_activated_flag) 10538 if (!x_timeout_atimer_activated_flag)
10576 { 10539 {
10577 EMACS_TIME interval = make_emacs_time (0, 100 * 1000 * 1000); 10540 EMACS_TIME interval = make_emacs_time (0, 100 * 1000 * 1000);
10578 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); 10541 start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0);
10579 x_timeout_atimer_activated_flag = 1; 10542 x_timeout_atimer_activated_flag = 1;
10580 } 10543 }
10581 UNBLOCK_INPUT; 10544 unblock_input ();
10582} 10545}
10583 10546
10584#endif /* USE_X_TOOLKIT */ 10547#endif /* USE_X_TOOLKIT */
@@ -10631,7 +10594,7 @@ x_delete_terminal (struct terminal *terminal)
10631 if (!terminal->name) 10594 if (!terminal->name)
10632 return; 10595 return;
10633 10596
10634 BLOCK_INPUT; 10597 block_input ();
10635#ifdef HAVE_X_I18N 10598#ifdef HAVE_X_I18N
10636 /* We must close our connection to the XIM server before closing the 10599 /* We must close our connection to the XIM server before closing the
10637 X display. */ 10600 X display. */
@@ -10686,7 +10649,7 @@ x_delete_terminal (struct terminal *terminal)
10686 /* Mark as dead. */ 10649 /* Mark as dead. */
10687 dpyinfo->display = NULL; 10650 dpyinfo->display = NULL;
10688 x_delete_display (dpyinfo); 10651 x_delete_display (dpyinfo);
10689 UNBLOCK_INPUT; 10652 unblock_input ();
10690} 10653}
10691 10654
10692/* Create a struct terminal, initialize it with the X11 specific 10655/* Create a struct terminal, initialize it with the X11 specific
@@ -10743,8 +10706,6 @@ x_create_terminal (struct x_display_info *dpyinfo)
10743void 10706void
10744x_initialize (void) 10707x_initialize (void)
10745{ 10708{
10746 struct sigaction action;
10747
10748 baud_rate = 19200; 10709 baud_rate = 19200;
10749 10710
10750 x_noop_count = 0; 10711 x_noop_count = 0;
@@ -10790,9 +10751,6 @@ x_initialize (void)
10790 original error handler. */ 10751 original error handler. */
10791 XSetErrorHandler (x_error_handler); 10752 XSetErrorHandler (x_error_handler);
10792 XSetIOErrorHandler (x_io_error_quitter); 10753 XSetIOErrorHandler (x_io_error_quitter);
10793
10794 emacs_sigaction_init (&action, x_connection_signal);
10795 sigaction (SIGPIPE, &action, 0);
10796} 10754}
10797 10755
10798 10756
diff --git a/src/xterm.h b/src/xterm.h
index 2d718f49118..4bc8f9813ed 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -962,11 +962,11 @@ extern XtAppContext Xt_app_con;
962extern void x_activate_timeout_atimer (void); 962extern void x_activate_timeout_atimer (void);
963#endif 963#endif
964#ifdef USE_LUCID 964#ifdef USE_LUCID
965extern int x_alloc_lighter_color_for_widget (Widget, Display *, Colormap, 965extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
966 unsigned long *, 966 unsigned long *,
967 double, int); 967 double, int);
968#endif 968#endif
969extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *); 969extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *);
970extern void x_query_color (struct frame *f, XColor *); 970extern void x_query_color (struct frame *f, XColor *);
971extern void x_clear_area (Display *, Window, int, int, int, int, int); 971extern void x_clear_area (Display *, Window, int, int, int, int, int);
972#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK 972#if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK
@@ -1034,7 +1034,7 @@ extern void xic_set_statusarea (struct frame *);
1034extern void xic_set_xfontset (struct frame *, const char *); 1034extern void xic_set_xfontset (struct frame *, const char *);
1035extern int x_pixel_width (struct frame *); 1035extern int x_pixel_width (struct frame *);
1036extern int x_pixel_height (struct frame *); 1036extern int x_pixel_height (struct frame *);
1037extern int x_defined_color (struct frame *, const char *, XColor *, int); 1037extern bool x_defined_color (struct frame *, const char *, XColor *, bool);
1038#ifdef HAVE_X_I18N 1038#ifdef HAVE_X_I18N
1039extern void free_frame_xic (struct frame *); 1039extern void free_frame_xic (struct frame *);
1040# if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT 1040# if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT